OSDN Git Service

#xxxxx DTXViewerのプロジェクトを追加。
[dtxmania/dtxmania.git] / DTXViewerプロジェクト / @DTXViewerプロジェクト / ソースファイル / ActPlayAVI.cpp
diff --git a/DTXViewerプロジェクト/@DTXViewerプロジェクト/ソースファイル/ActPlayAVI.cpp b/DTXViewerプロジェクト/@DTXViewerプロジェクト/ソースファイル/ActPlayAVI.cpp
new file mode 100644 (file)
index 0000000..0e86b19
--- /dev/null
@@ -0,0 +1,290 @@
+#include "stdafx.h"
+#include "ActPlayAVI.h"
+#include "CSurface.h"
+#include "DTX.h"
+#include "CStage.h"
+#include "DTXViewer.h"
+
+namespace DTXViewer {
+       namespace Stage {
+               namespace Play {
+
+ActPlayAVI::ActPlayAVI()
+{
+       this->bFirstWork = true;
+       this->bActivate = false;
+}
+
+bool ActPlayAVI::MyOneTimeSceneInit()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81BAddChild() \82È\82Ç\81B
+       AddChild( &this->sfAVI );
+
+       return Activity::MyOneTimeSceneInit();
+}
+bool ActPlayAVI::MyFinalCleanup()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+
+       return Activity::MyFinalCleanup();
+}
+bool ActPlayAVI::MyInitDeviceObjects()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81BCTexture/CSurface::InitDeviceObjects() \82È\82Ç\81B
+       this->sfAVI.InitDeviceObjects( _T("AVI"), BGA_W, BGA_H );
+
+       return Activity::MyInitDeviceObjects();
+}
+bool ActPlayAVI::MyDeleteDeviceObjects()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+
+       // \8e\9f\82Ì Activity::MyDeleteDeviceObjects() \82Å\82Í\81A\8eq\83e\83N\83X\83`\83\83\81E\8eq\83T\81[\83t\83F\83C\83X\82Ì Delete (CTexture/CSurface::Delete) \82ª\8ds\82í\82ê\82é\81B
+       return Activity::MyDeleteDeviceObjects();
+}
+bool ActPlayAVI::MyActivate()
+{
+       this->bFirstWork = true;
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+       for( int i = 0; i < MAX_AVI_LAYER; i++ )
+       {
+               this->structLayer[i].pAVI                                               = NULL;
+               this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms                   =INIT_TIME;
+               this->structLayer[i].dw\91O\89ñ\95\\8e¦\82µ\82½\83t\83\8c\81[\83\80\94Ô\8d\86 = 0;
+       }
+
+       // \8e\9f\82Ì Activity::MyActivate() \82Å\82Í\81Athis->bActivity \82Ì\83Z\83b\83g\82È\82ç\82Ñ\82É\8eq\83T\81[\83t\83F\83C\83X\81E\8eq\83e\83N\83X\83`\83\83\82Ì Restore (MyRestoreDeviceTexture/Surface) \82ª\8ds\82í\82ê\82é\81B
+       // \82È\82¨\81A\8eq Activity \82Ì\8a\88\90«\89»\82Í\8ds\82í\82ê\82È\82¢\81B\81i\82±\82Ì\83\81\83\\83b\83h\82ð\94²\82¯\82Ä\82©\82ç\8ds\82í\82ê\82é\81B\81j
+       return Activity::MyActivate();
+}
+bool ActPlayAVI::MyUnActivate()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+
+       // \8e\9f\82Ì Activity::MyUnActivate() \82Å\82Í\81Athis->bActivity \82Ì\83\8a\83Z\83b\83g\82È\82ç\82Ñ\82É\8eq\83T\81[\83t\83F\83C\83X\81E\8eq\83e\83N\83X\83`\83\83\82Ì Invalidate (MyInvalidateDeviceObjects) \82ª\8ds\82í\82ê\82é\81B
+       // \82È\82¨\81A\8eqActivity \82Ì\94ñ\8a\88\90«\89»\82Í\8ds\82í\82ê\82È\82¢\81B\81i\82±\82Ì\83\81\83\\83b\83h\82ð\94²\82¯\82Ä\82©\82ç\8ds\82í\82ê\82é\81B\81j
+       return Activity::MyUnActivate();
+}
+bool ActPlayAVI::MyRestoreDeviceTextures()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+
+       // \8e\9f\82Ì Activity::MyRestoreDeviceTextures() \82Å\82Í\81A\8eq\83e\83N\83X\83`\83\83\82Ì Restore (CTexture::Restore) \82ª\8ds\82í\82ê\82é\81B
+       return Activity::MyRestoreDeviceTextures();
+}
+bool ActPlayAVI::MyRestoreDeviceSurfaces()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+
+       // \8e\9f\82Ì Activity::MyRestoreDeviceSurfaces() \82Å\82Í\81A\8eq\83T\81[\83t\83F\83C\83X\82Ì Restore (CSurface::Restore) \82ª\8ds\82í\82ê\82é\81B
+       return Activity::MyRestoreDeviceSurfaces();
+}
+bool ActPlayAVI::MyInvalidateDeviceObjects()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+
+       // \8e\9f\82Ì Activity::MyInvalidateDeviceObjects() \82Å\82Í\81A\8eq\83e\83N\83X\83`\83\83\81E\8eq\83T\81[\83t\83F\83C\83X\82Ì Invalidate (CTexture/CSurface::Invalidate) \82ª\8ds\82í\82ê\82é\81B
+       return Activity::MyRestoreDeviceSurfaces();
+}
+//
+void ActPlayAVI::Start( int n\83`\83\83\83\93\83l\83\8b\94Ô\8d\86, DTX::AVI* pAVI, int n\8aJ\8en\83T\83C\83YW, int n\8aJ\8en\83T\83C\83YH, int n\8fI\97¹\83T\83C\83YW, int n\8fI\97¹\83T\83C\83YH, int n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uX, int n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uY, int n\89æ\91\9c\91¤\8fI\97¹\88Ê\92uX, int n\89æ\91\9c\91¤\8fI\97¹\88Ê\92uY, int n\95\\8e¦\91¤\8aJ\8en\88Ê\92uX, int n\95\\8e¦\91¤\8aJ\8en\88Ê\92uY, int n\95\\8e¦\91¤\8fI\97¹\88Ê\92uX, int n\95\\8e¦\91¤\8fI\97¹\88Ê\92uY, double db\91\8d\88Ú\93®\8e\9e\8aÔms, double db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms )
+{
+       // \83`\83\83\83\93\83l\83\8b\83`\83F\83b\83N
+       if( n\83`\83\83\83\93\83l\83\8b\94Ô\8d\86 != 0x54 )
+               return;
+
+       // \83Z\83\8b\82É\92l\82ð\90Ý\92è
+       int i = 0;
+       this->structLayer[i].pAVI       = pAVI;
+       this->structLayer[i].n\8aJ\8en\83T\83C\83YW       = n\8aJ\8en\83T\83C\83YW;
+       this->structLayer[i].n\8aJ\8en\83T\83C\83YH       = n\8aJ\8en\83T\83C\83YH;
+       this->structLayer[i].n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uX   = n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uX;
+       this->structLayer[i].n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uY   = n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uY;
+       this->structLayer[i].n\95\\8e¦\91¤\8aJ\8en\88Ê\92uX   = n\95\\8e¦\91¤\8aJ\8en\88Ê\92uX;
+       this->structLayer[i].n\95\\8e¦\91¤\8aJ\8en\88Ê\92uY   = n\95\\8e¦\91¤\8aJ\8en\88Ê\92uY;
+       this->structLayer[i].db\91\8d\88Ú\93®\8e\9e\8aÔms             = db\91\8d\88Ú\93®\8e\9e\8aÔms;
+       this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms   = ( db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms != INIT_TIME ) ? db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms : g_Timer.Get();
+       this->structLayer[i].dw\91O\89ñ\95\\8e¦\82µ\82½\83t\83\8c\81[\83\80\94Ô\8d\86 = 0;
+}
+void ActPlayAVI::SkipStart( double db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms )
+{
+       for( DTX::Chip* cell = g_DTX.pChip; cell != NULL; cell = cell->next )
+       {
+               // \8aJ\8en\8e\9e\8d\8f\82æ\82è\8cã\82ë\82È\82ç\81A\82»\82Ì\83`\83b\83v\82Å\92²\8d¸\91Å\82¿\90Ø\82è\81B
+               if( cell->dbTime > db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms ) 
+                       break;
+
+               // AVI, AVIPAN \82È\82ç\8dÄ\90\8ew\8e¦
+               switch( cell->AVItype )
+               {
+
+               case AVITYPE_AVI:
+                       if( cell->pAVI )
+                               this->Start(
+                                       cell->nChannel, cell->pAVI,
+                                       BGA_W, BGA_H, 0, 0,                     // sw, sh, ew, eh               ; \97Ì\88æ   \8f\89\8aú\83T\83C\83Y\81A\8fI\97¹\83T\83C\83Y
+                                       0, 0, 0, 0,                                     // ssx, ssy, sex, sey   ; \89æ\91\9c\91¤ \8f\89\8aú\88Ê\92u\81A\8dÅ\8fI\88Ê\92u
+                                       0, 0, 0, 0,                                     // dsx, dsy, dex, dey   ; \95\\8e¦\91¤ \8f\89\8aú\88Ê\92u\81A\8dÅ\8fI\88Ê\92u
+                                       0, cell->dbTime );                      // len, start
+                       break;
+
+               case AVITYPE_AVIPAN:
+                       if( cell->pAVIPan )
+                               this->Start(
+                                       cell->nChannel, cell->pAVI,
+                                       cell->pAVIPan->sw, cell->pAVIPan->sh, cell->pAVIPan->ew, cell->pAVIPan->eh,             // \97Ì\88æ   \8f\89\8aú\83T\83C\83Y\81A\8fI\97¹\83T\83C\83Y
+                                       cell->pAVIPan->ssx, cell->pAVIPan->ssy, cell->pAVIPan->sex, cell->pAVIPan->sey, // \89æ\91\9c\91¤ \8f\89\8aú\88Ê\92u\81A\8dÅ\8fI\88Ê\92u
+                                       cell->pAVIPan->dsx, cell->pAVIPan->dsy, cell->pAVIPan->dex, cell->pAVIPan->dey, // \95\\8e¦\91¤ \8f\89\8aú\88Ê\92u\81A\8dÅ\8fI\88Ê\92u
+                                       cell->dbLong, cell->dbTime );                                                                                                   // len, start
+                       break;
+               }
+       }
+}
+void ActPlayAVI::Stop()
+{
+       for( int i = 0; i < MAX_AVI_LAYER; i++ ) {
+               if( this->structLayer[i].pAVI && this->structLayer[i].pAVI->bUse )
+                       this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = INIT_TIME;
+       }
+}
+void ActPlayAVI::Cont( double db\8dÄ\8aJ\8e\9e\8d\8f )
+{
+       for( int i = 0; i < MAX_AVI_LAYER; i++ ) {
+               if( this->structLayer[i].pAVI && this->structLayer[i].pAVI->bUse )
+                       this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = db\8dÄ\8aJ\8e\9e\8d\8f;
+       }
+}
+int  ActPlayAVI::MainWork( int x, int y )
+{
+       // AVI \8ew\92è\82È\82µ\82È\82ç\89½\82à\82µ\82È\82¢
+       if( ! g_DTX.bUseAVI )
+               return 0;
+
+       // \90i\8ds\81\95\95`\89æ
+       for( int i = 0; i < MAX_AVI_LAYER; i++ )
+       {
+               // \96¢\8eg\97p\82È\82ç\83X\83L\83b\83v
+               if( this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms == INIT_TIME )
+                       continue;
+               if( ! this->structLayer[i].pAVI || ! this->structLayer[i].pAVI->bUse )
+                       continue;
+
+               // \83p\83\89\83\81\81[\83^\92\8a\8fo\81E\8eZ\8fo
+               DTX::AVI*        pAVI           = this->structLayer[i].pAVI;
+               SIZE szAVI\83T\83C\83Y;               pAVI->avi._\83t\83\8c\81[\83\80\83T\83C\83Y\82ð\8eæ\93¾\82·\82é( &(szAVI\83T\83C\83Y.cx), &(szAVI\83T\83C\83Y.cy) );
+               SIZE szBGA\83T\83C\83Y                = { BGA_W, BGA_H };
+               SIZE sz\8aJ\8en\83T\83C\83Y               = { this->structLayer[i].n\8aJ\8en\83T\83C\83YW, this->structLayer[i].n\8aJ\8en\83T\83C\83YH };
+               SIZE sz\8fI\97¹\83T\83C\83Y               = { this->structLayer[i].n\8fI\97¹\83T\83C\83YW, this->structLayer[i].n\8fI\97¹\83T\83C\83YH };
+               POINT pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u  = { this->structLayer[i].n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uX, this->structLayer[i].n\89æ\91\9c\91¤\8fI\97¹\88Ê\92uY };
+               POINT pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u  = { this->structLayer[i].n\89æ\91\9c\91¤\8fI\97¹\88Ê\92uX, this->structLayer[i].n\89æ\91\9c\91¤\8fI\97¹\88Ê\92uY };
+               POINT pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u  = { this->structLayer[i].n\95\\8e¦\91¤\8aJ\8en\88Ê\92uX, this->structLayer[i].n\95\\8e¦\91¤\8aJ\8en\88Ê\92uY };
+               POINT pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u  = { this->structLayer[i].n\95\\8e¦\91¤\8fI\97¹\88Ê\92uX, this->structLayer[i].n\95\\8e¦\91¤\8fI\97¹\88Ê\92uY };
+               double db\91\8d\88Ú\93®\8e\9e\8aÔms   = this->structLayer[i].db\91\8d\88Ú\93®\8e\9e\8aÔms;
+               double db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms; if( g_Timer.Get() < db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms ) db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = g_Timer.Get();
+
+               double db\8c»\8dÝ\8e\9e\8d\8fms             = ( g_Timer.Get() - db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms ) * g_DTX.fSpeed;  // \8aJ\8en\82©\82ç\82Ì\8co\89ß\8e\9e\8aÔ[ms]
+               DWORD  dw\83t\83\8c\81[\83\80\94Ô\8d\86   = pAVI->avi._\8e\9e\8d\8f\82©\82ç\83t\83\8c\81[\83\80\94Ô\8d\86\82ð\95Ô\82·( db\8c»\8dÝ\8e\9e\8d\8fms );
+
+               // \8fI\97¹\94»\92è\81idb\91\8d\88Ú\93®\8e\9e\8aÔms==0 \82Ì\82Æ\82«\82ÍAVI\8dÄ\90\8fI\97¹\82Ü\82Å\81j
+               if( db\91\8d\88Ú\93®\8e\9e\8aÔms != 0.0 && db\91\8d\88Ú\93®\8e\9e\8aÔms < db\8c»\8dÝ\8e\9e\8d\8fms )
+               {
+                       this->structLayer[i].db\91\8d\88Ú\93®\8e\9e\8aÔms   = 0;
+                       this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = INIT_TIME;      // \8dÄ\90\8fI\97¹
+                       return 0;
+               }
+
+               // \8c»\8dÝ\8dÀ\95W\82Ì\8cv\8eZ\81G\88È\89º\82Ì\82Q\95Ï\90\94\82ð\8eZ\8fo\82·\82é\81B
+               RECT rc\89æ\91\9c\91¤\97Ì\88æ;              // \89æ\91\9c\82Ì\8d\8fã\82ª 0, 0
+               RECT rc\95\\8e¦\91¤\97Ì\88æ;              // BGA\97Ì\88æ\82Ì\8d\8fã\82ª 0, 0
+
+               if( db\91\8d\88Ú\93®\8e\9e\8aÔms == 0.0 )
+               {
+                       // \8f\89\8aú\88Ê\92u\81E\8f\89\8aú\83T\83C\83Y\82ð\82¸\82Á\82Æ\95Û\8e\9d
+                       SetRect( &rc\89æ\91\9c\91¤\97Ì\88æ,
+                               pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.x,
+                               pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.y,
+                               pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.x + sz\8aJ\8en\83T\83C\83Y.cx,
+                               pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.y + sz\8aJ\8en\83T\83C\83Y.cy );
+                       
+                       SetRect( &rc\95\\8e¦\91¤\97Ì\88æ,
+                               pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x,
+                               pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y,
+                               pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x + sz\8aJ\8en\83T\83C\83Y.cx,
+                               pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y + sz\8aJ\8en\83T\83C\83Y.cy );
+               }
+               else
+               {
+                       // db\8a\84\8d\87\8aJ\8en\81¨\8fI\97¹ \82Ì\82Æ\82« 0.0 \81¨ 1.0
+                       double db\8a\84\8d\87 = db\8c»\8dÝ\8e\9e\8d\8fms / db\91\8d\88Ú\93®\8e\9e\8aÔms;
+
+                       // \8c»\8dÝ\82Ì\83T\83C\83Y\81i\89æ\91\9c\81E\95\\8e¦\8b¤\92Ê\81j
+                       SIZE sz\8c»\8dÝ\82Ì\83T\83C\83Y = {
+                               sz\8aJ\8en\83T\83C\83Y.cx + (LONG)( ( sz\8fI\97¹\83T\83C\83Y.cx - sz\8aJ\8en\83T\83C\83Y.cx ) * db\8a\84\8d\87 ),
+                               sz\8aJ\8en\83T\83C\83Y.cy + (LONG)( ( sz\8fI\97¹\83T\83C\83Y.cy - sz\8aJ\8en\83T\83C\83Y.cy ) * db\8a\84\8d\87 )
+                       };
+
+                       // \93]\91\97\8c³\97Ì\88æ
+                       SetRect( &rc\89æ\91\9c\91¤\97Ì\88æ,
+                               (LONG)( ( pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u.x - pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.x ) * db\8a\84\8d\87 ),
+                               (LONG)( ( pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u.y - pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.y ) * db\8a\84\8d\87 ),
+                               (LONG)( ( pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u.x - pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.x ) * db\8a\84\8d\87 ) + sz\8c»\8dÝ\82Ì\83T\83C\83Y.cx,
+                               (LONG)( ( pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u.y - pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.y ) * db\8a\84\8d\87 ) + sz\8c»\8dÝ\82Ì\83T\83C\83Y.cy );
+
+                       // \93]\91\97\90æ\97Ì\88æ
+                       SetRect( &rc\95\\8e¦\91¤\97Ì\88æ,
+                               (LONG)( ( pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.x - pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x ) * db\8a\84\8d\87 ),
+                               (LONG)( ( pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.y - pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y ) * db\8a\84\8d\87 ),
+                               (LONG)( ( pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.x - pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x ) * db\8a\84\8d\87 ) + sz\8c»\8dÝ\82Ì\83T\83C\83Y.cx,
+                               (LONG)( ( pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.y - pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y ) * db\8a\84\8d\87 ) + sz\8c»\8dÝ\82Ì\83T\83C\83Y.cy );
+
+                       // \93]\91\97\95\94\95ª\82ª\82È\82¢\82È\82ç\83X\83L\83b\83v\87\83N\83\8a\83b\83s\83\93\83O\91O
+                       if( rc\89æ\91\9c\91¤\97Ì\88æ.right <= 0 || rc\89æ\91\9c\91¤\97Ì\88æ.bottom <= 0 || rc\89æ\91\9c\91¤\97Ì\88æ.left >= szAVI\83T\83C\83Y.cx || rc\89æ\91\9c\91¤\97Ì\88æ.top >= szAVI\83T\83C\83Y.cy ) continue;
+                       if( rc\95\\8e¦\91¤\97Ì\88æ.right <= 0 || rc\95\\8e¦\91¤\97Ì\88æ.bottom <= 0 || rc\95\\8e¦\91¤\97Ì\88æ.left >= szBGA\83T\83C\83Y.cx || rc\95\\8e¦\91¤\97Ì\88æ.top >= szBGA\83T\83C\83Y.cy ) continue;
+
+                       // \83N\83\8a\83b\83s\83\93\83O\87\93]\91\97\8c³
+                       if( rc\89æ\91\9c\91¤\97Ì\88æ.left < 0 )     { rc\95\\8e¦\91¤\97Ì\88æ.left += -rc\89æ\91\9c\91¤\97Ì\88æ.left; rc\89æ\91\9c\91¤\97Ì\88æ.left = 0; }
+                       if( rc\89æ\91\9c\91¤\97Ì\88æ.top  < 0 )     { rc\95\\8e¦\91¤\97Ì\88æ.top  += -rc\89æ\91\9c\91¤\97Ì\88æ.top;  rc\89æ\91\9c\91¤\97Ì\88æ.top  = 0; }
+                       if( rc\89æ\91\9c\91¤\97Ì\88æ.right  > szAVI\83T\83C\83Y.cx ) { rc\95\\8e¦\91¤\97Ì\88æ.right  -= rc\89æ\91\9c\91¤\97Ì\88æ.right  - szAVI\83T\83C\83Y.cx; rc\89æ\91\9c\91¤\97Ì\88æ.right  = szAVI\83T\83C\83Y.cx; }
+                       if( rc\89æ\91\9c\91¤\97Ì\88æ.bottom > szAVI\83T\83C\83Y.cy ) { rc\95\\8e¦\91¤\97Ì\88æ.bottom -= rc\89æ\91\9c\91¤\97Ì\88æ.bottom - szAVI\83T\83C\83Y.cy; rc\89æ\91\9c\91¤\97Ì\88æ.bottom = szAVI\83T\83C\83Y.cy; }
+
+                       // \83N\83\8a\83b\83s\83\93\83O\87\93]\91\97\90æ
+                       if( rc\95\\8e¦\91¤\97Ì\88æ.left < 0 ) { rc\89æ\91\9c\91¤\97Ì\88æ.left += -rc\95\\8e¦\91¤\97Ì\88æ.left; rc\95\\8e¦\91¤\97Ì\88æ.left = 0; }
+                       if( rc\95\\8e¦\91¤\97Ì\88æ.top  < 0 ) { rc\89æ\91\9c\91¤\97Ì\88æ.top  += -rc\95\\8e¦\91¤\97Ì\88æ.top;  rc\95\\8e¦\91¤\97Ì\88æ.top  = 0; }
+                       if( rc\95\\8e¦\91¤\97Ì\88æ.right  > szBGA\83T\83C\83Y.cx ) { rc\89æ\91\9c\91¤\97Ì\88æ.right  -= rc\95\\8e¦\91¤\97Ì\88æ.right  - szBGA\83T\83C\83Y.cx; rc\95\\8e¦\91¤\97Ì\88æ.right  = szBGA\83T\83C\83Y.cx; }
+                       if( rc\95\\8e¦\91¤\97Ì\88æ.bottom > szBGA\83T\83C\83Y.cy ) { rc\89æ\91\9c\91¤\97Ì\88æ.bottom -= rc\95\\8e¦\91¤\97Ì\88æ.bottom - szBGA\83T\83C\83Y.cy; rc\95\\8e¦\91¤\97Ì\88æ.bottom = szBGA\83T\83C\83Y.cy; }
+
+                       // \93]\91\97\95\94\95ª\82ª\82È\82¢\82È\82ç\83X\83L\83b\83v\87\83N\83\8a\83b\83s\83\93\83O\8cã
+                       if( rc\89æ\91\9c\91¤\97Ì\88æ.left >= rc\89æ\91\9c\91¤\97Ì\88æ.right || rc\89æ\91\9c\91¤\97Ì\88æ.top >= rc\89æ\91\9c\91¤\97Ì\88æ.bottom ) continue;
+                       if( rc\95\\8e¦\91¤\97Ì\88æ.left >= rc\95\\8e¦\91¤\97Ì\88æ.right || rc\95\\8e¦\91¤\97Ì\88æ.top >= rc\95\\8e¦\91¤\97Ì\88æ.bottom ) continue;
+                       if( rc\89æ\91\9c\91¤\97Ì\88æ.right < 0 || rc\89æ\91\9c\91¤\97Ì\88æ.bottom < 0 || rc\89æ\91\9c\91¤\97Ì\88æ.left > szAVI\83T\83C\83Y.cx || rc\89æ\91\9c\91¤\97Ì\88æ.top > szAVI\83T\83C\83Y.cy ) continue;
+                       if( rc\95\\8e¦\91¤\97Ì\88æ.right < 0 || rc\95\\8e¦\91¤\97Ì\88æ.bottom < 0 || rc\95\\8e¦\91¤\97Ì\88æ.left > szBGA\83T\83C\83Y.cx || rc\95\\8e¦\91¤\97Ì\88æ.top > szBGA\83T\83C\83Y.cy ) continue;
+               }
+       
+               // \95`\89æ
+               this->structLayer[i].dw\91O\89ñ\95\\8e¦\82µ\82½\83t\83\8c\81[\83\80\94Ô\8d\86 = dw\83t\83\8c\81[\83\80\94Ô\8d\86;
+
+               HDC hdc;
+               int ret = 0;
+               
+               this->sfAVI.Clear();
+               
+               if( SUCCEEDED( this->sfAVI.GetDC( &hdc ) ) )
+               {
+                       ret = pAVI->avi._\8ew\92è\8e\9e\8d\8f\82Ì\83t\83\8c\81[\83\80\82ðDC\82Ö\95`\89æ\82·\82é( g_App.hWnd, hdc, db\8c»\8dÝ\8e\9e\8d\8fms, 
+                               rc\89æ\91\9c\91¤\97Ì\88æ.left, rc\89æ\91\9c\91¤\97Ì\88æ.top, rc\89æ\91\9c\91¤\97Ì\88æ.right - rc\89æ\91\9c\91¤\97Ì\88æ.left, rc\89æ\91\9c\91¤\97Ì\88æ.bottom - rc\89æ\91\9c\91¤\97Ì\88æ.top,
+                               rc\95\\8e¦\91¤\97Ì\88æ.left, rc\95\\8e¦\91¤\97Ì\88æ.top, rc\95\\8e¦\91¤\97Ì\88æ.right - rc\95\\8e¦\91¤\97Ì\88æ.left, rc\95\\8e¦\91¤\97Ì\88æ.bottom - rc\95\\8e¦\91¤\97Ì\88æ.top );
+                       this->sfAVI.ReleaseDC( hdc );
+                       this->sfAVI.Draw( x, y );
+               }
+               if( ret != 0 )
+               {
+                       // \8dÄ\90\8a®\97¹
+                       this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = INIT_TIME;
+               }
+       }
+       return 0;
+}
+
+               }//Play
+       }//Stage
+}//DTXViewer