OSDN Git Service

#xxxxx DTXViewerのプロジェクトを追加。
[dtxmania/dtxmania.git] / DTXViewerプロジェクト / @DTXViewerプロジェクト / ソースファイル / ActPlayBGA.cpp
diff --git a/DTXViewerプロジェクト/@DTXViewerプロジェクト/ソースファイル/ActPlayBGA.cpp b/DTXViewerプロジェクト/@DTXViewerプロジェクト/ソースファイル/ActPlayBGA.cpp
new file mode 100644 (file)
index 0000000..e1c5bca
--- /dev/null
@@ -0,0 +1,313 @@
+#include "stdafx.h"
+#include "ActPlayBGA.h"
+#include "DTX.h"
+#include "DTXViewer.h"
+#include "CTimer.h"
+
+namespace DTXViewer {
+       namespace Stage {
+               namespace Play {
+
+static const int s_nChannel[8] = {
+       0x04, 0x07, 0x55, 0x56, 0x57, 0x58, 0x59, 0x60,
+};
+
+ActPlayBGA::ActPlayBGA()
+{
+       this->bFirstWork = true;
+       this->bActivate = false;
+}
+
+bool ActPlayBGA::MyOneTimeSceneInit()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81BAddChild() \82È\82Ç\81B
+
+       return Activity::MyOneTimeSceneInit();
+}
+bool ActPlayBGA::MyFinalCleanup()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+
+       return Activity::MyFinalCleanup();
+}
+bool ActPlayBGA::MyInitDeviceObjects()
+{
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81BCTexture/CSurface::InitDeviceObjects() \82È\82Ç\81B
+
+       return Activity::MyInitDeviceObjects();
+}
+bool ActPlayBGA::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 ActPlayBGA::MyActivate()
+{
+       this->bFirstWork = true;
+       // \82±\82±\82É\83R\81[\83h\82ð\8bL\8fq\82·\82é\81B
+       for( int i = 0; i < 8; i++ ) {
+               this->structLayer[i].pBMP = NULL;
+               this->structLayer[i].pBMPTEX = NULL;
+               this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = INIT_TIME;
+       }
+
+       // \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 ActPlayBGA::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 ActPlayBGA::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 ActPlayBGA::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 ActPlayBGA::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 ActPlayBGA::Start( int n\83`\83\83\83\93\83l\83\8b, DTX::BMP *bmp, DTX::BMPTEX* bmptex, 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
+       for( int i = 0; i < 8; i++ )
+       {
+               if( n\83`\83\83\83\93\83l\83\8b == s_nChannel[i] )
+               {
+                       // \83Z\83\8b\82É\92l\82ð\90Ý\92è                                                                                               BMP/BMPTEX      BGA             BGAPAN
+                       this->structLayer[i].pBMP                               = bmp;                          //              \81\9b              \81\9b              \81\9b
+                       this->structLayer[i].pBMPTEX                    = bmptex;                       //              \81\9b              \81\9b              \81\9b
+                       this->structLayer[i].sz\8aJ\8en\83T\83C\83Y.cx    = n\8aJ\8en\83T\83C\83YW;         //              \81\9b              \81\9b              \81\9b
+                       this->structLayer[i].sz\8aJ\8en\83T\83C\83Y.cy    = n\8aJ\8en\83T\83C\83YH;         //              \81\9b              \81\9b              \81\9b
+                       this->structLayer[i].sz\8fI\97¹\83T\83C\83Y.cx    = n\8fI\97¹\83T\83C\83YW;         //              --              --              \81\9b
+                       this->structLayer[i].sz\8fI\97¹\83T\83C\83Y.cy    = n\8fI\97¹\83T\83C\83YH;         //              --              --              \81\9b
+                       this->structLayer[i].pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.x = n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uX;     //              --              \81\9b              \81\9b
+                       this->structLayer[i].pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.y = n\89æ\91\9c\91¤\8aJ\8en\88Ê\92uY;     //              --              \81\9b              \81\9b
+                       this->structLayer[i].pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u.x = n\89æ\91\9c\91¤\8fI\97¹\88Ê\92uX;     //              --              --              \81\9b
+                       this->structLayer[i].pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u.y = n\89æ\91\9c\91¤\8fI\97¹\88Ê\92uY;     //              --              --              \81\9b
+                       this->structLayer[i].pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x = n\95\\8e¦\91¤\8aJ\8en\88Ê\92uX;     //              --              \81\9b              \81\9b
+                       this->structLayer[i].pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y = n\95\\8e¦\91¤\8aJ\8en\88Ê\92uY;     //              --              \81\9b              \81\9b
+                       this->structLayer[i].pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.x = n\95\\8e¦\91¤\8fI\97¹\88Ê\92uX;     //              --              --              \81\9b
+                       this->structLayer[i].pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.y = n\95\\8e¦\91¤\8fI\97¹\88Ê\92uY;     //              --              --              \81\9b
+                       this->structLayer[i].db\91\8d\88Ú\93®\8e\9e\8aÔms             = db\91\8d\88Ú\93®\8e\9e\8aÔms;       //              --              --              \81\9b
+                       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();
+               }
+       }
+}
+void ActPlayBGA::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;
+
+               // BMP, BMPTEX, BGA, BGAPAN \82È\82ç\8dÄ\90\8ew\8e¦
+               switch( cell->BGAtype )
+               {
+
+               case BGATYPE_BMP:
+                       if( cell->pBMP )
+                               Start( cell->nChannel, cell->pBMP, NULL,
+                                          cell->pBMP->pSurface->dwWidth, cell->pBMP->pSurface->dwHeight, 0, 0,
+                                          0, 0, 0, 0,
+                                          0, 0, 0, 0, 0, cell->dbTime );
+                       break;
+
+               case BGATYPE_BMPTEX:
+                       if( cell->pBMPTEX )
+                               Start( cell->nChannel, NULL, cell->pBMPTEX,
+                                          cell->pBMPTEX->pTexture->dwWidth, cell->pBMPTEX->pTexture->dwHeight, 0, 0,
+                                          0, 0, 0, 0,
+                                          0, 0, 0, 0, 0, cell->dbTime );
+                       break;
+
+               case BGATYPE_BGA:
+                       if( cell->pBGA )
+                               Start( cell->nChannel, cell->pBMP, cell->pBMPTEX,
+                                          cell->pBGA->x2 - cell->pBGA->x1, cell->pBGA->y2 - cell->pBGA->y1, 0, 0, 
+                                          cell->pBGA->x1, cell->pBGA->y1, 0, 0,
+                                          cell->pBGA->ox, cell->pBGA->oy, 0, 0, 0, cell->dbTime );
+                       break;
+
+               case BGATYPE_BGAPAN:
+                       if( cell->pBGAPan )
+                               Start( cell->nChannel, cell->pBMP, cell->pBMPTEX,
+                                               cell->pBGAPan->sw, cell->pBGAPan->sh, cell->pBGAPan->ew, cell->pBGAPan->eh,
+                                               cell->pBGAPan->ssx, cell->pBGAPan->ssy, cell->pBGAPan->sex, cell->pBGAPan->sey,
+                                               cell->pBGAPan->dsx, cell->pBGAPan->dsy, cell->pBGAPan->dex, cell->pBGAPan->dey,
+                                               cell->dbLong, cell->dbTime );
+                       break;
+               }
+       }
+}
+void ActPlayBGA::Stop()
+{
+       for( int i = 0; i < 8; i++ )
+               this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = INIT_TIME;
+}
+void ActPlayBGA::Cont( double db\8dÄ\8aJ\8e\9e\8d\8fms )
+{
+       for( int i = 0; i < 8; i++ )
+       {
+               if(  ( this->structLayer[i].pBMP    == NULL && this->structLayer[i].pBMPTEX == NULL ) 
+                 || ( this->structLayer[i].pBMP    != NULL && ( ! this->structLayer[i].pBMP->bUse    || this->structLayer[i].pBMP->pSurface    == NULL ) )
+                 || ( this->structLayer[i].pBMPTEX != NULL && ( ! this->structLayer[i].pBMPTEX->bUse || this->structLayer[i].pBMPTEX->pTexture == NULL ) ) )
+                       continue;
+
+               this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = db\8dÄ\8aJ\8e\9e\8d\8fms;
+       }
+}
+void ActPlayBGA::ChangeScope( int n\83`\83\83\83\93\83l\83\8b, DTX::BMP* bmp, DTX::BMPTEX* bmptex )
+{
+       // \83`\83\83\83\93\83l\83\8b\83`\83F\83b\83N
+       for( int i = 0; i < 8; i++ )
+       {
+               if( n\83`\83\83\83\93\83l\83\8b == s_nChannel[i] )
+               {
+                       // \83Z\83\8b\82É\92l\82ð\90Ý\92è(bmp, bmptex \82Ì\82Ý)
+                       this->structLayer[i].pBMP               = bmp;
+                       this->structLayer[i].pBMPTEX    = bmptex;
+               }
+       }
+}
+int  ActPlayBGA::MainWork( int x, int y )
+{
+       for( int i = 0; i < 8; 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
+                       || ( this->structLayer[i].pBMP    == NULL && this->structLayer[i].pBMPTEX == NULL ) 
+                       || ( this->structLayer[i].pBMP    != NULL && ( ! this->structLayer[i].pBMP->bUse    || this->structLayer[i].pBMP->pSurface    == NULL ) )
+                       || ( this->structLayer[i].pBMPTEX != NULL && ( ! this->structLayer[i].pBMPTEX->bUse || this->structLayer[i].pBMPTEX->pTexture == NULL ) ) )
+                       continue;
+
+               // \83p\83\89\83\81\81[\83^\92\8a\8fo\81E\8eZ\8fo
+               SIZE    sz\8aJ\8en\83T\83C\83Y            = this->structLayer[i].sz\8aJ\8en\83T\83C\83Y;
+               SIZE    sz\8fI\97¹\83T\83C\83Y            = this->structLayer[i].sz\8fI\97¹\83T\83C\83Y;
+               POINT   pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u        = this->structLayer[i].pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u;
+               POINT   pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u        = this->structLayer[i].pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u;
+               POINT   pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u        = this->structLayer[i].pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u;
+               POINT   pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u        = this->structLayer[i].pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u;
+               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();
+               SIZE    szBGA\83T\83C\83Y                     = { BGA_W, BGA_H };
+               SIZE    szBMP\83T\83C\83Y                     = { (this->structLayer[i].pBMP) ? this->structLayer[i].pBMP->pSurface->dwWidth  : this->structLayer[i].pBMPTEX->pTexture->dwImageWidth,
+                                                                               (this->structLayer[i].pBMP) ? this->structLayer[i].pBMP->pSurface->dwHeight : this->structLayer[i].pBMPTEX->pTexture->dwImageHeight };
+
+               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]
+
+               // \8fI\97¹\94»\92è (db\91\8d\88Ú\93®\8e\9e\8d\8fms==0 \82Ì\82Æ\82«\82Í\8fI\82í\82è\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].pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u = pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u = pt\89æ\91\9c\91¤\8fI\97¹\88Ê\92u;
+                       this->structLayer[i].pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u = pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u = pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u;
+                       this->structLayer[i].sz\8aJ\8en\83T\83C\83Y     = sz\8aJ\8en\83T\83C\83Y     = sz\8fI\97¹\83T\83C\83Y;
+                       this->structLayer[i].db\91\8d\88Ú\93®\8e\9e\8aÔms       = db\91\8d\88Ú\93®\8e\9e\8aÔms   = 0.0;
+                       //db\88Ú\93®\8aJ\8en\8e\9e\8d\8fnms     = this->structLayer[i].db\88Ú\93®\8aJ\8en\8e\9e\8d\8fms = INIT_TIME;            \83^\83C\83}\82ð\8f\89\8aú\89»\82µ\82½\82ç\83\8c\83C\83\84\8e©\91Ì\83X\83L\83b\83v\82³\82ê\82é\82©\82ç\83_\83\81
+               }
+
+               /////////////
+               // \8c»\8dÝ\8e\9e\8d\8f\82©\82ç\89æ\91\9c\97Ì\88æ\82Æ\95\\8e¦\97Ì\88æ\82ð\8cv\8eZ\82·\82é
+
+               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 )
+               {
+                       // \8aJ\8en\88Ê\92u\81E\8aJ\8en\83T\83C\83Y\82ð\82¸\82Á\82Æ\95Û\8e\9d
+                       rc\89æ\91\9c\91¤\97Ì\88æ.left   = pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.x;
+                       rc\89æ\91\9c\91¤\97Ì\88æ.top    = pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.y;
+                       rc\89æ\91\9c\91¤\97Ì\88æ.right  = rc\89æ\91\9c\91¤\97Ì\88æ.left + sz\8aJ\8en\83T\83C\83Y.cx;
+                       rc\89æ\91\9c\91¤\97Ì\88æ.bottom = rc\89æ\91\9c\91¤\97Ì\88æ.top  + sz\8aJ\8en\83T\83C\83Y.cy;
+                       
+                       rc\95\\8e¦\91¤\97Ì\88æ.left   = pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x;
+                       rc\95\\8e¦\91¤\97Ì\88æ.top    = pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y;
+                       rc\95\\8e¦\91¤\97Ì\88æ.right  = rc\95\\8e¦\91¤\97Ì\88æ.left + sz\8aJ\8en\83T\83C\83Y.cx;
+                       rc\95\\8e¦\91¤\97Ì\88æ.bottom = rc\95\\8e¦\91¤\97Ì\88æ.top  + 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æ
+                       rc\89æ\91\9c\91¤\97Ì\88æ.left   = pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.x + (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 );
+                       rc\89æ\91\9c\91¤\97Ì\88æ.top    = pt\89æ\91\9c\91¤\8aJ\8en\88Ê\92u.y + (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 );
+                       rc\89æ\91\9c\91¤\97Ì\88æ.right  = rc\89æ\91\9c\91¤\97Ì\88æ.left + sz\8c»\8dÝ\82Ì\83T\83C\83Y.cx;
+                       rc\89æ\91\9c\91¤\97Ì\88æ.bottom = rc\89æ\91\9c\91¤\97Ì\88æ.top  + sz\8c»\8dÝ\82Ì\83T\83C\83Y.cy;
+
+                       // \93]\91\97\90æ\97Ì\88æ
+                       rc\95\\8e¦\91¤\97Ì\88æ.left   = pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x + (LONG)( ( pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.x - pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.x ) * db\8a\84\8d\87 );
+                       rc\95\\8e¦\91¤\97Ì\88æ.top    = pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y + (LONG)( ( pt\95\\8e¦\91¤\8fI\97¹\88Ê\92u.y - pt\95\\8e¦\91¤\8aJ\8en\88Ê\92u.y ) * db\8a\84\8d\87 );
+                       rc\95\\8e¦\91¤\97Ì\88æ.right  = rc\95\\8e¦\91¤\97Ì\88æ.left + sz\8c»\8dÝ\82Ì\83T\83C\83Y.cx;
+                       rc\95\\8e¦\91¤\97Ì\88æ.bottom = rc\95\\8e¦\91¤\97Ì\88æ.top  + 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 >= szBMP\83T\83C\83Y.cx || rc\89æ\91\9c\91¤\97Ì\88æ.top >= szBMP\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  > szBMP\83T\83C\83Y.cx ) { rc\95\\8e¦\91¤\97Ì\88æ.right  -= rc\89æ\91\9c\91¤\97Ì\88æ.right  - szBMP\83T\83C\83Y.cx; rc\89æ\91\9c\91¤\97Ì\88æ.right  = szBMP\83T\83C\83Y.cx; }
+               if( rc\89æ\91\9c\91¤\97Ì\88æ.bottom > szBMP\83T\83C\83Y.cy ) { rc\95\\8e¦\91¤\97Ì\88æ.bottom -= rc\89æ\91\9c\91¤\97Ì\88æ.bottom - szBMP\83T\83C\83Y.cy; rc\89æ\91\9c\91¤\97Ì\88æ.bottom = szBMP\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 > szBMP\83T\83C\83Y.cx || rc\89æ\91\9c\91¤\97Ì\88æ.top > szBMP\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;
+
+               // \81¦\83Z\83\93\83^\83\8a\83\93\83O\82Í\81ABGAPAN \82Å\82Í\88Ó\96¡\82È\82¢\81i\82¸\82ê\82é\81j\82Ì\82Å\94p\8e~(2003/03/02)
+
+               // \95`\89æ
+               if( this->structLayer[i].pBMP )
+               {
+                       this->structLayer[i].pBMP->pSurface->ColorKeyEnable( (i == 0) ? false : (g_DTX.bBlackColorKey ? true : false) );        // \8dÅ\89º\91w\83\8c\83C\83\84\82Í\93§\89ß\82µ\82È\82¢
+                       this->structLayer[i].pBMP->pSurface->Draw( x + rc\95\\8e¦\91¤\97Ì\88æ.left, y + rc\95\\8e¦\91¤\97Ì\88æ.top, &rc\89æ\91\9c\91¤\97Ì\88æ );
+               }
+               else if( this->structLayer[i].pBMPTEX )
+               {
+                       this->structLayer[i].pBMPTEX->pTexture->Draw( x + rc\95\\8e¦\91¤\97Ì\88æ.left, y + rc\95\\8e¦\91¤\97Ì\88æ.top, &rc\89æ\91\9c\91¤\97Ì\88æ );
+               }
+       }
+       return 0;
+}
+
+               }//Play
+       }//Stage
+}//DTXViewer