OSDN Git Service

#28821 CAct演奏AVI.cs をさらにロールバックし、rev760相当に戻した。これまでの#28821への対応で使用した、余計な修正を省くため。
authoryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Sat, 8 Feb 2014 13:55:42 +0000 (13:55 +0000)
committeryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Sat, 8 Feb 2014 13:55:42 +0000 (13:55 +0000)
git-svn-id: http://svn.osdn.jp/svnroot/dtxmania/branches/140113(DTXMania098%20with%2028821%20DTXVmode)@681 16f42ceb-6dc6-49c8-ba94-f2d53467949d

DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏AVI.cs

index f0cdb6d..ad8339a 100644 (file)
@@ -2,8 +2,6 @@
 using System.Collections.Generic;\r
 using System.Text;\r
 using System.Drawing;\r
-using System.Diagnostics;\r
-using System.Runtime.InteropServices;\r
 using SlimDX;\r
 using SlimDX.Direct3D9;\r
 using FDK;\r
@@ -17,13 +15,14 @@ namespace DTXMania
                public CAct演奏AVI()\r
                {\r
                        base.b活性化してない = true;\r
-               } \r
+               }\r
+\r
 \r
                // メソッド\r
 \r
-               public void Start( int nチャンネル番号, CDTX.CAVI rAVI, int n開始サイズW, int n開始サイズH, int n終了サイズW, int n終了サイズH, int n画像側開始位置X, int n画像側開始位置Y, int n画像側終了位置X, int n画像側終了位置Y, int n表示側開始位置X, int n表示側開始位置Y, int n表示側終了位置X, int n表示側終了位置Y, int n総移動時間ms, int n表示開始時刻ms )\r
+               public void Start( int nチャンネル番号, CDTX.CAVI rAVI, int n開始サイズW, int n開始サイズH, int n終了サイズW, int n終了サイズH, int n画像側開始位置X, int n画像側開始位置Y, int n画像側終了位置X, int n画像側終了位置Y, int n表示側開始位置X, int n表示側開始位置Y, int n表示側終了位置X, int n表示側終了位置Y, int n総移動時間ms, int n移動開始時刻ms )\r
                {\r
-                       if( nチャンネル番号 == 0x54 )\r
+                       if ( nチャンネル番号 == 0x54 )\r
                        {\r
                                this.rAVI = rAVI;\r
                                this.n開始サイズW = n開始サイズW;\r
@@ -39,31 +38,31 @@ namespace DTXMania
                                this.n表示側終了位置X = n表示側終了位置X;\r
                                this.n表示側終了位置Y = n表示側終了位置Y;\r
                                this.n総移動時間ms = n総移動時間ms;\r
-                               this.n表示開始時刻ms = ( n表示開始時刻ms != -1 ) ? n表示開始時刻ms : CSound管理.rc演奏用タイマ.n現在時刻;\r
+                               this.n移動開始時刻ms = ( n移動開始時刻ms != -1 ) ? n移動開始時刻ms : CSound管理.rc演奏用タイマ.n現在時刻;\r
                                this.n前回表示したフレーム番号 = -1;\r
                        }\r
                }\r
                public void SkipStart( int n移動開始時刻ms )\r
                {\r
-                       foreach( CDTX.CChip chip in CDTXMania.DTX.listChip )\r
+                       foreach ( CDTX.CChip chip in CDTXMania.DTX.listChip )\r
                        {\r
-                               if( chip.n発声時刻ms > n移動開始時刻ms )\r
+                               if ( chip.n発声時刻ms > n移動開始時刻ms )\r
                                {\r
                                        break;\r
                                }\r
-                               switch( chip.eAVI種別 )\r
+                               switch ( chip.eAVI種別 )\r
                                {\r
                                        case EAVI種別.AVI:\r
                                                {\r
-                                                       if( chip.rAVI != null )\r
+                                                       if ( chip.rAVI != null )\r
                                                        {\r
-                                                               this.Start( chip.nチャンネル番号, chip.rAVI, 278, 355, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, chip.n発声時刻ms );\r
+                                                               this.Start( chip.nチャンネル番号, chip.rAVI, 0x116, 0x163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, chip.n発声時刻ms );\r
                                                        }\r
                                                        continue;\r
                                                }\r
                                        case EAVI種別.AVIPAN:\r
                                                {\r
-                                                       if( chip.rAVIPan != null )\r
+                                                       if ( chip.rAVIPan != null )\r
                                                        {\r
                                                                this.Start( chip.nチャンネル番号, chip.rAVI, chip.rAVIPan.sz開始サイズ.Width, chip.rAVIPan.sz開始サイズ.Height, chip.rAVIPan.sz終了サイズ.Width, chip.rAVIPan.sz終了サイズ.Height, chip.rAVIPan.pt動画側開始位置.X, chip.rAVIPan.pt動画側開始位置.Y, chip.rAVIPan.pt動画側終了位置.X, chip.rAVIPan.pt動画側終了位置.Y, chip.rAVIPan.pt表示側開始位置.X, chip.rAVIPan.pt表示側開始位置.Y, chip.rAVIPan.pt表示側終了位置.X, chip.rAVIPan.pt表示側終了位置.Y, chip.n総移動時間, chip.n発声時刻ms );\r
                                                        }\r
@@ -74,99 +73,86 @@ namespace DTXMania
                }\r
                public void Stop()\r
                {\r
-                       if( ( this.rAVI != null ) && ( this.rAVI.avi != null ) )\r
+                       if ( ( this.rAVI != null ) && ( this.rAVI.avi != null ) )\r
                        {\r
-                               this.n表示開始時刻ms = -1;\r
+                               this.n移動開始時刻ms = -1;\r
                        }\r
                }\r
                public void Cont( int n再開時刻ms )\r
                {\r
-                       if( ( this.rAVI != null ) && ( this.rAVI.avi != null ) )\r
+                       if ( ( this.rAVI != null ) && ( this.rAVI.avi != null ) )\r
                        {\r
-                               this.n表示開始時刻ms = n再開時刻ms;\r
+                               this.n移動開始時刻ms = n再開時刻ms;\r
                        }\r
                }\r
-\r
                public unsafe int t進行描画( int x, int y )\r
                {\r
-                       if( !base.b活性化してない )\r
+                       if ( !base.b活性化してない )\r
                        {\r
                                Rectangle rectangle;\r
                                Rectangle rectangle2;\r
-                               if( ( ( this.n表示開始時刻ms == -1 ) || ( this.rAVI == null ) ) || ( this.rAVI.avi == null ) )\r
+                               if ( ( ( this.n移動開始時刻ms == -1 ) || ( this.rAVI == null ) ) || ( this.rAVI.avi == null ) )\r
                                {\r
                                        return 0;\r
                                }\r
-                               if( this.tx描画用 == null )\r
+                               if ( this.tx描画用 == null )\r
                                {\r
                                        return 0;\r
                                }\r
-                               int time = (int) ( ( CSound管理.rc演奏用タイマ.n現在時刻 - this.n表示開始時刻ms ) * ( ( (double) CDTXMania.ConfigIni.n演奏速度 ) / 20.0 ) );\r
-//Trace.TraceInformation( "n現在時刻=" + CSound管理.rc演奏用タイマ.n現在時刻 +  ", n表示開始時刻ms=" + n表示開始時刻ms + ", time=" + time );\r
-                               if ( time < 0 )\r
-                               {\r
-                                       return 0; \r
-                               }\r
+                               int time = (int) ( ( CSound管理.rc演奏用タイマ.n現在時刻 - this.n移動開始時刻ms ) * ( ( (double) CDTXMania.ConfigIni.n演奏速度 ) / 20.0 ) );\r
                                int frameNoFromTime = this.rAVI.avi.GetFrameNoFromTime( time );\r
-                               if( ( this.n総移動時間ms != 0 ) && ( this.n総移動時間ms < time ) )\r
+                               if ( ( this.n総移動時間ms != 0 ) && ( this.n総移動時間ms < time ) )\r
                                {\r
                                        this.n総移動時間ms = 0;\r
-                                       this.n表示開始時刻ms = -1;\r
+                                       this.n移動開始時刻ms = -1;\r
                                        return 0;\r
                                }\r
-                               if( ( this.n総移動時間ms == 0 ) && ( frameNoFromTime >= this.rAVI.avi.GetMaxFrameCount() ) )\r
+                               if ( ( this.n総移動時間ms == 0 ) && ( frameNoFromTime >= this.rAVI.avi.GetMaxFrameCount() ) )\r
                                {\r
-                                       this.n表示開始時刻ms = -1;\r
+                                       this.n移動開始時刻ms = -1;\r
                                        return 0;\r
                                }\r
-                               if( ( this.n前回表示したフレーム番号 != frameNoFromTime ) && !this.bフレームを作成した )\r
+                               if ( ( this.n前回表示したフレーム番号 != frameNoFromTime ) && !this.bフレームを作成した )\r
                                {\r
-                                       //this.pBmp = this.rAVI.avi.GetFramePtr( frameNoFromTime );\r
+                                       this.pBmp = this.rAVI.avi.GetFramePtr( frameNoFromTime );\r
                                        this.n前回表示したフレーム番号 = frameNoFromTime;\r
                                        this.bフレームを作成した = true;\r
                                }\r
                                Size size = new Size( (int) this.rAVI.avi.nフレーム幅, (int) this.rAVI.avi.nフレーム高さ );\r
-                               Size size2 = new Size( 278, 355 );\r
+                               Size size2 = new Size( 0x116, 0x163 );\r
                                Size size3 = new Size( this.n開始サイズW, this.n開始サイズH );\r
                                Size size4 = new Size( this.n終了サイズW, this.n終了サイズH );\r
                                Point location = new Point( this.n画像側開始位置X, this.n画像側終了位置Y );\r
                                Point point2 = new Point( this.n画像側終了位置X, this.n画像側終了位置Y );\r
                                Point point3 = new Point( this.n表示側開始位置X, this.n表示側開始位置Y );\r
                                Point point4 = new Point( this.n表示側終了位置X, this.n表示側終了位置Y );\r
-\r
-       \r
-                               \r
-                               long _n表示開始時刻 = this.n表示開始時刻ms;\r
-                               if ( CSound管理.rc演奏用タイマ.n現在時刻 < this.n表示開始時刻ms )\r
+                               long num3 = this.n総移動時間ms;\r
+                               long num4 = this.n移動開始時刻ms;\r
+                               if ( CSound管理.rc演奏用タイマ.n現在時刻 < num4 )\r
                                {\r
-                                       _n表示開始時刻 = CSound管理.rc演奏用タイマ.n現在時刻;\r
+                                       num4 = CSound管理.rc演奏用タイマ.n現在時刻;\r
                                }\r
-                               time = (int) ( ( CSound管理.rc演奏用タイマ.n現在時刻 - _n表示開始時刻 ) * ( ( (double) CDTXMania.ConfigIni.n演奏速度 ) / 20.0 ) );\r
-\r
-                               #region [ AVI ]\r
-                               long _n総移動時間 = this.n総移動時間ms;\r
-                               if ( _n総移動時間 == 0 )\r
+                               time = (int) ( ( CSound管理.rc演奏用タイマ.n現在時刻 - num4 ) * ( ( (double) CDTXMania.ConfigIni.n演奏速度 ) / 20.0 ) );\r
+                               if ( num3 == 0 )\r
                                {\r
                                        rectangle = new Rectangle( location, size3 );\r
                                        rectangle2 = new Rectangle( point3, size3 );\r
                                }\r
-                               #endregion\r
                                else\r
-                               #region [ AVIPAN ]\r
                                {\r
-                                       double num5 = ( (double) time ) / ( (double) _n総移動時間 );\r
+                                       double num5 = ( (double) time ) / ( (double) num3 );\r
                                        Size size5 = new Size( size3.Width + ( (int) ( ( size4.Width - size3.Width ) * num5 ) ), size3.Height + ( (int) ( ( size4.Height - size3.Height ) * num5 ) ) );\r
                                        rectangle = new Rectangle( (int) ( ( point2.X - location.X ) * num5 ), (int) ( ( point2.Y - location.Y ) * num5 ), ( (int) ( ( point2.X - location.X ) * num5 ) ) + size5.Width, ( (int) ( ( point2.Y - location.Y ) * num5 ) ) + size5.Height );\r
                                        rectangle2 = new Rectangle( (int) ( ( point4.X - point3.X ) * num5 ), (int) ( ( point4.Y - point3.Y ) * num5 ), ( (int) ( ( point4.X - point3.X ) * num5 ) ) + size5.Width, ( (int) ( ( point4.Y - point3.Y ) * num5 ) ) + size5.Height );\r
-                                       if( ( ( rectangle.Right <= 0 ) || ( rectangle.Bottom <= 0 ) ) || ( ( rectangle.Left >= size.Width ) || ( rectangle.Top >= size.Height ) ) )\r
+                                       if ( ( ( rectangle.Right <= 0 ) || ( rectangle.Bottom <= 0 ) ) || ( ( rectangle.Left >= size.Width ) || ( rectangle.Top >= size.Height ) ) )\r
                                        {\r
                                                return 0;\r
                                        }\r
-                                       if( ( ( rectangle2.Right <= 0 ) || ( rectangle2.Bottom <= 0 ) ) || ( ( rectangle2.Left >= size2.Width ) || ( rectangle2.Top >= size2.Height ) ) )\r
+                                       if ( ( ( rectangle2.Right <= 0 ) || ( rectangle2.Bottom <= 0 ) ) || ( ( rectangle2.Left >= size2.Width ) || ( rectangle2.Top >= size2.Height ) ) )\r
                                        {\r
                                                return 0;\r
                                        }\r
-                                       if( rectangle.X < 0 )\r
+                                       if ( rectangle.X < 0 )\r
                                        {\r
                                                int num6 = -rectangle.X;\r
                                                rectangle2.X += num6;\r
@@ -174,7 +160,7 @@ namespace DTXMania
                                                rectangle.X = 0;\r
                                                rectangle.Width -= num6;\r
                                        }\r
-                                       if( rectangle.Y < 0 )\r
+                                       if ( rectangle.Y < 0 )\r
                                        {\r
                                                int num7 = -rectangle.Y;\r
                                                rectangle2.Y += num7;\r
@@ -182,19 +168,19 @@ namespace DTXMania
                                                rectangle.Y = 0;\r
                                                rectangle.Height -= num7;\r
                                        }\r
-                                       if( rectangle.Right > size.Width )\r
+                                       if ( rectangle.Right > size.Width )\r
                                        {\r
                                                int num8 = rectangle.Right - size.Width;\r
                                                rectangle2.Width -= num8;\r
                                                rectangle.Width -= num8;\r
                                        }\r
-                                       if( rectangle.Bottom > size.Height )\r
+                                       if ( rectangle.Bottom > size.Height )\r
                                        {\r
                                                int num9 = rectangle.Bottom - size.Height;\r
                                                rectangle2.Height -= num9;\r
                                                rectangle.Height -= num9;\r
                                        }\r
-                                       if( rectangle2.X < 0 )\r
+                                       if ( rectangle2.X < 0 )\r
                                        {\r
                                                int num10 = -rectangle2.X;\r
                                                rectangle.X += num10;\r
@@ -202,7 +188,7 @@ namespace DTXMania
                                                rectangle2.X = 0;\r
                                                rectangle2.Width -= num10;\r
                                        }\r
-                                       if( rectangle2.Y < 0 )\r
+                                       if ( rectangle2.Y < 0 )\r
                                        {\r
                                                int num11 = -rectangle2.Y;\r
                                                rectangle.Y += num11;\r
@@ -210,66 +196,55 @@ namespace DTXMania
                                                rectangle2.Y = 0;\r
                                                rectangle2.Height -= num11;\r
                                        }\r
-                                       if( rectangle2.Right > size2.Width )\r
+                                       if ( rectangle2.Right > size2.Width )\r
                                        {\r
                                                int num12 = rectangle2.Right - size2.Width;\r
                                                rectangle.Width -= num12;\r
                                                rectangle2.Width -= num12;\r
                                        }\r
-                                       if( rectangle2.Bottom > size2.Height )\r
+                                       if ( rectangle2.Bottom > size2.Height )\r
                                        {\r
                                                int num13 = rectangle2.Bottom - size2.Height;\r
                                                rectangle.Height -= num13;\r
                                                rectangle2.Height -= num13;\r
                                        }\r
-                                       if( ( rectangle.X >= rectangle.Right ) || ( rectangle.Y >= rectangle.Bottom ) )\r
+                                       if ( ( rectangle.X >= rectangle.Right ) || ( rectangle.Y >= rectangle.Bottom ) )\r
                                        {\r
                                                return 0;\r
                                        }\r
-                                       if( ( rectangle2.X >= rectangle2.Right ) || ( rectangle2.Y >= rectangle2.Bottom ) )\r
+                                       if ( ( rectangle2.X >= rectangle2.Right ) || ( rectangle2.Y >= rectangle2.Bottom ) )\r
                                        {\r
                                                return 0;\r
                                        }\r
-                                       if( ( ( rectangle.Right < 0 ) || ( rectangle.Bottom < 0 ) ) || ( ( rectangle.X > size.Width ) || ( rectangle.Y > size.Height ) ) )\r
+                                       if ( ( ( rectangle.Right < 0 ) || ( rectangle.Bottom < 0 ) ) || ( ( rectangle.X > size.Width ) || ( rectangle.Y > size.Height ) ) )\r
                                        {\r
                                                return 0;\r
                                        }\r
-                                       if( ( ( rectangle2.Right < 0 ) || ( rectangle2.Bottom < 0 ) ) || ( ( rectangle2.X > size2.Width ) || ( rectangle2.Y > size2.Height ) ) )\r
+                                       if ( ( ( rectangle2.Right < 0 ) || ( rectangle2.Bottom < 0 ) ) || ( ( rectangle2.X > size2.Width ) || ( rectangle2.Y > size2.Height ) ) )\r
                                        {\r
                                                return 0;\r
                                        }\r
                                }\r
-                               #endregion\r
-                               if( ( this.tx描画用 != null ) && ( this.n総移動時間ms != -1 ) )\r
+                               if ( ( this.tx描画用 != null ) && ( this.n総移動時間ms != -1 ) )\r
                                {\r
-                                       if( this.bフレームを作成した )\r
+                                       if ( this.bフレームを作成した && ( this.pBmp != IntPtr.Zero ) )\r
                                        {\r
-                                               // unsafe中のローカル変数は、スタックに固定される(GCで動かされない)\r
-                                               // -> this.pBmpでなく、ローカルのpBmpを使う\r
-\r
-                                               IntPtr pBmp = this.rAVI.avi.GetFramePtr( frameNoFromTime );\r
+                                               DataRectangle rectangle3 = this.tx描画用.texture.LockRectangle( 0, LockFlags.None );\r
+                                               DataStream data = rectangle3.Data;\r
+                                               int num14 = rectangle3.Pitch / this.tx描画用.szテクスチャサイズ.Width;\r
+                                               BitmapUtil.BITMAPINFOHEADER* pBITMAPINFOHEADER = (BitmapUtil.BITMAPINFOHEADER*) this.pBmp.ToPointer();\r
+                                               if ( pBITMAPINFOHEADER->biBitCount == 0x18 )\r
                                                {\r
-                                                       if ( pBmp != IntPtr.Zero )\r
+                                                       switch ( num14 )\r
                                                        {\r
-                                                               DataRectangle rectangle3 = this.tx描画用.texture.LockRectangle( 0, LockFlags.None );\r
-                                                               DataStream data = rectangle3.Data;\r
-                                                               int num14 = rectangle3.Pitch / this.tx描画用.szテクスチャサイズ.Width;\r
-                                                               BitmapUtil.BITMAPINFOHEADER* pBITMAPINFOHEADER = (BitmapUtil.BITMAPINFOHEADER*) pBmp.ToPointer();\r
-                                                               if ( pBITMAPINFOHEADER->biBitCount == 24 )\r
-                                                               {\r
-                                                                       switch ( num14 )\r
-                                                                       {\r
-                                                                               case 2:\r
-                                                                                       this.rAVI.avi.tBitmap24ToGraphicsStreamR5G6B5( pBITMAPINFOHEADER, data, this.tx描画用.szテクスチャサイズ.Width, this.tx描画用.szテクスチャサイズ.Height );\r
-                                                                                       break;\r
+                                                               case 2:\r
+                                                                       this.rAVI.avi.tBitmap24ToGraphicsStreamR5G6B5( pBITMAPINFOHEADER, data, this.tx描画用.szテクスチャサイズ.Width, this.tx描画用.szテクスチャサイズ.Height );\r
+                                                                       break;\r
 \r
-                                                                               case 4:\r
-                                                                                       this.rAVI.avi.tBitmap24ToGraphicsStreamX8R8G8B8( pBITMAPINFOHEADER, data, this.tx描画用.szテクスチャサイズ.Width, this.tx描画用.szテクスチャサイズ.Height );\r
-                                                                                       break;\r
-                                                                       }\r
-                                                               }\r
+                                                               case 4:\r
+                                                                       this.rAVI.avi.tBitmap24ToGraphicsStreamX8R8G8B8( pBITMAPINFOHEADER, data, this.tx描画用.szテクスチャサイズ.Width, this.tx描画用.szテクスチャサイズ.Height );\r
+                                                                       break;\r
                                                        }\r
-\r
                                                }\r
                                                this.tx描画用.texture.UnlockRectangle( 0 );\r
                                                this.bフレームを作成した = false;\r
@@ -280,21 +255,21 @@ namespace DTXMania
                        return 0;\r
                }\r
 \r
-               \r
+\r
                // CActivity 実装\r
 \r
                public override void On活性化()\r
                {\r
                        this.rAVI = null;\r
-                       this.n表示開始時刻ms = -1;\r
+                       this.n移動開始時刻ms = -1;\r
                        this.n前回表示したフレーム番号 = -1;\r
                        this.bフレームを作成した = false;\r
-               //      this.pBmp = IntPtr.Zero;\r
+                       this.pBmp = IntPtr.Zero;\r
                        base.On活性化();\r
                }\r
                public override void OnManagedリソースの作成()\r
                {\r
-                       if( !base.b活性化してない )\r
+                       if ( !base.b活性化してない )\r
                        {\r
 #if TEST_Direct3D9Ex\r
                                this.tx描画用 = new CTexture( CDTXMania.app.Device, 320, 355, CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Default, Usage.Dynamic );\r
@@ -306,9 +281,9 @@ namespace DTXMania
                }\r
                public override void OnManagedリソースの解放()\r
                {\r
-                       if( !base.b活性化してない )\r
+                       if ( !base.b活性化してない )\r
                        {\r
-                               if( this.tx描画用 != null )\r
+                               if ( this.tx描画用 != null )\r
                                {\r
                                        this.tx描画用.Dispose();\r
                                        this.tx描画用 = null;\r
@@ -327,7 +302,7 @@ namespace DTXMania
                #region [ private ]\r
                //-----------------\r
                private bool bフレームを作成した;\r
-               private long n表示開始時刻ms;\r
+               private long n移動開始時刻ms;\r
                private int n画像側開始位置X;\r
                private int n画像側開始位置Y;\r
                private int n画像側終了位置X;\r
@@ -342,7 +317,7 @@ namespace DTXMania
                private int n表示側開始位置Y;\r
                private int n表示側終了位置X;\r
                private int n表示側終了位置Y;\r
-//             private IntPtr pBmp;\r
+               private IntPtr pBmp;\r
                private CDTX.CAVI rAVI;\r
                private CTexture tx描画用;\r
                //-----------------\r