Mercurial > mm7
diff VideoPlayer.cpp @ 1429:c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
author | Ritor1 |
---|---|
date | Thu, 01 Aug 2013 17:51:16 +0600 |
parents | eb02a65e5c82 |
children | 934074e7fcc1 |
line wrap: on
line diff
--- a/VideoPlayer.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/VideoPlayer.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -900,39 +900,27 @@ //----- (004BF1E6) -------------------------------------------------------- _SMACK *VideoPlayer::OpenSmack(const char *pFilename) { - VideoPlayer *pVideoPlayer; // esi@1 - signed int v3; // edi@1 - int v4; // ebx@2 - signed int v5; // edi@5 - //int v6; // ebx@6 - //HANDLE v8; // [sp-Ch] [bp-1Ch]@10 - //unsigned int v9; // [sp-8h] [bp-18h]@10 - //signed int v10; // [sp-4h] [bp-14h]@10 - - pVideoPlayer = this; - if ( (signed int)this->uNumMightVideoHeaders > 0 ) + if ( this->uNumMightVideoHeaders ) { - for ( v3 = 0; v3 < (signed int)pVideoPlayer->uNumMightVideoHeaders; ++v3) + for ( uint i = 0; i < (signed int)this->uNumMightVideoHeaders; ++i) { - v4 = _stricmp(pVideoPlayer->pMightVideoHeaders[v3].pVideoName, pFilename); - if ( !v4 ) - { - SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0); - return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1);//problem training house video in WinXP - } + if ( !_stricmp(this->pMightVideoHeaders[i].pVideoName, pFilename) ) + { + SetFilePointer(this->hMightVid, this->pMightVideoHeaders[i].uFileOffset, 0, 0); + return SmackOpen(this->hMightVid, 0x7140, -1); + } } } - v5 = 0; - if ( (signed int)pVideoPlayer->uNumMagicVideoHeaders > 0 ) + if ( this->uNumMagicVideoHeaders ) { - while ( _stricmp(pVideoPlayer->pMagicVideoHeaders[v5].pVideoName, pFilename) ) + for ( uint i = 0; i < (signed int)this->uNumMagicVideoHeaders; ++i ) { - ++v5; - if ( v5 >= (signed int)pVideoPlayer->uNumMagicVideoHeaders ) - return 0; + if ( !_stricmp(this->pMagicVideoHeaders[i].pVideoName, pFilename) ) + { + SetFilePointer(this->hMagicVid, this->pMagicVideoHeaders[i].uFileOffset, 0, 0); + return SmackOpen(this->hMagicVid, 0x7140, -1); + } } - SetFilePointer(pVideoPlayer->hMagicVid, pVideoPlayer->pMagicVideoHeaders[v5].uFileOffset, 0, 0); - return SmackOpen(pVideoPlayer->hMagicVid, 0x7140, -1); } return 0; } @@ -940,67 +928,35 @@ //----- (004BF28F) -------------------------------------------------------- void VideoPlayer::OpenHouseMovie(const char *pMovieName, unsigned int a3_1) { - VideoPlayer *v3; // esi@1 - std::string *v4; // ecx@3 - _SMACK *v5; // eax@4 - _SMACK *v6; // eax@7 - int v7; // eax@7 - int v8; // ecx@7 - unsigned int v9; // ebx@8 - unsigned int v10; // eax@8 - signed __int64 v11; // qax@9 - char *v12; // [sp-20h] [bp-54h]@3 - int v13; // [sp-1Ch] [bp-50h]@3 - std::string v14; // [sp-18h] [bp-4Ch]@3 - const char *v15; // [sp-8h] [bp-3Ch]@3 - int v16; // [sp-4h] [bp-38h]@3 - char Str2[0x30]; // [sp+Ch] [bp-28h]@4 - std::string *v18; // [sp+3Ch] [bp+8h]@3 - std::string *v19; // [sp+3Ch] [bp+8h]@5 - unsigned __int16 *v20; // [sp+3Ch] [bp+8h]@8 - - v3 = this; if ( !this->field_54 ) { Prepare(); - v3->bLoopPlaying = a3_1; - if ( LOBYTE(v3->field_104) == 1 ) + this->bLoopPlaying = a3_1; + if ( LOBYTE(this->field_104) == 1 ) { - v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925"; - v12 = "Unsupported Bink playback!"; - MessageBoxA(nullptr, v12, v15, 0); + MessageBoxA(nullptr, "Unsupported Bink playback!", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925", 0); return; } sprintfex(Str2, "%s.smk", pMovieName); - v5 = OpenSmack(Str2); - v3->pSmackerMovie = v5; - if ( !v5 ) + this->pSmackerMovie = OpenSmack(Str2); + if ( !this->pSmackerMovie ) { - v3->Unload(); + this->Unload(); sprintf(pTmpBuf.data(), "Can't load %s", &Str2); - v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937"; - MessageBoxA(nullptr, pTmpBuf.data(), v15, 0); + MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937", 0); return; } - v16 = (int)pMovieName; - v3->uMovieFormat = 1; - strcpy(v3->pCurrentMovieName, (const char *)v16); - v6 = v3->pSmackerMovie; - v3->dword_0000A0 = 1; - v7 = SmackBufferOpen(v3->hWindow, 4, LOWORD(v6->Width), LOWORD(v6->Height), LOWORD(v6->Width), LOWORD(v6->Height)); - v3->pSmackerBuffer = (_SMACKBUF *)v7; - if ( v7 ) + this->uMovieFormat = 1; + strcpy(this->pCurrentMovieName, (const char *)pMovieName); + this->dword_0000A0 = 1; + this->pSmackerBuffer = (_SMACKBUF *)SmackBufferOpen(this->hWindow, 4, LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height), LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height)); + if ( this->pSmackerBuffer ) { pRenderer->BeginScene(); - v9 = pRenderer->uTargetSurfacePitch; - v20 = pRenderer->pTargetSurface; - v10 = SmackCheckSurfaceFromat(); - SmackToBuffer(v3->pSmackerMovie, 8, 8, 2 * v9, pRenderer->field_14, v20, v10); + SmackToBuffer(this->pSmackerMovie, 8, 8, 2 * pRenderer->uTargetSurfacePitch, pRenderer->field_14, pRenderer->pTargetSurface, SmackCheckSurfaceFromat()); pRenderer->EndScene(); } - v16 = 32767; - v11 = (signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 32767.0); - SmackVolumePan(v3->pSmackerMovie, 1040384, v11, 32767); + SmackVolumePan(this->pSmackerMovie, 1040384, (signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 32767.0), 32767); } } @@ -1013,62 +969,48 @@ //----- (004BF411) -------------------------------------------------------- void VideoPlayer::OpenGlobalMovie(const char *pFilename, unsigned int bLoop, int a4) { - VideoPlayer *pVideoPlayer; // esi@1 - _BINK *pVideoOpen; // eax@2 - _SMACK *v6; // eax@3 - _BINK *pBinkMovie; // eax@5 - _SMACK *v8; // eax@7 - char *v9; // eax@7 unsigned int v10; // eax@11 - _SMACKBLIT *v11; // eax@14 - const char *v12; // [sp-4h] [bp-38h]@8 char pVideoName[120]; // [sp+Ch] [bp-28h]@2 - pVideoPlayer = this; if ( !this->field_54 ) { Prepare(); - pVideoPlayer->bLoopPlaying = bLoop; + this->bLoopPlaying = bLoop; sprintf(pVideoName, "%s.bik", pFilename); - pVideoOpen = OpenBink(pVideoName); - pVideoPlayer->pBinkMovie = pVideoOpen; - if ( pVideoOpen ) + this->pBinkMovie = OpenBink(pVideoName); + if ( this->pBinkMovie ) { - pVideoPlayer->uMovieFormat = 2; - strcpy(pVideoPlayer->pCurrentMovieName, pFilename); - pBinkMovie = pVideoPlayer->pBinkMovie; - pVideoPlayer->dword_0000A0 = 1; + this->uMovieFormat = 2; + strcpy(this->pCurrentMovieName, pFilename); + pBinkMovie = this->pBinkMovie; + this->dword_0000A0 = 1; if ( pBinkMovie ) - pVideoPlayer->pBinkBuffer = CreateBinkBuffer(pVideoPlayer->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); + this->pBinkBuffer = CreateBinkBuffer(this->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); } else { Unload(); sprintfex(pVideoName, "%s.smk", pFilename); - v6 = OpenSmack(pVideoName); - pVideoPlayer->pSmackerMovie = v6; - if ( !v6 ) + this->pSmackerMovie = OpenSmack(pVideoName); + if ( !this->pSmackerMovie ) { Unload(); sprintf(pVideoName, "Can't load file - anims\\%s.smk", pFilename); MessageBoxA(0, pVideoName, "Smacker Error", 0); return; } - pVideoPlayer->uMovieFormat = 1; - strcpy(pVideoPlayer->pCurrentMovieName, pFilename); - v8 = pVideoPlayer->pSmackerMovie; - pVideoPlayer->dword_0000A0 = 2; - v9 = (char *)malloc(v8->Width * v8->Height); - pVideoPlayer->pSomeSmackerBuffer = v9; - if ( !v9 ) + this->uMovieFormat = 1; + strcpy(this->pCurrentMovieName, pFilename); + this->dword_0000A0 = 2; + this->pSomeSmackerBuffer = (char *)malloc(this->pSmackerMovie->Width * this->pSmackerMovie->Height); + if ( !this->pSomeSmackerBuffer ) { Unload(); - v12 = "Can't allocate memory for buffer"; - sprintf(pVideoName, v12); - MessageBoxA(0, pVideoName, "Smacker Error", 0); + sprintf(pVideoName, "Can't allocate memory for buffer"); + MessageBoxA(0, pVideoName, "Smacker Error", 0); return; } - SmackToBuffer(pVideoPlayer->pSmackerMovie, 0, 0, pVideoPlayer->pSmackerMovie->Width, pVideoPlayer->pSmackerMovie->Height, v9, 0); + SmackToBuffer(this->pSmackerMovie, 0, 0, this->pSmackerMovie->Width, this->pSmackerMovie->Height, this->pSomeSmackerBuffer, 0); v10 = SmackCheckSurfaceFromat(); if ( a4 ) @@ -1081,13 +1023,11 @@ Log::Warning(L"Smacker seems to use lower resolution because it thinks CPU is slow"); } - v11 = SmackBlitOpen(v10); - pVideoPlayer->pSmackMovieBlit = v11; - if ( !v11 ) + this->pSmackMovieBlit = SmackBlitOpen(v10); + if ( !this->pSmackMovieBlit ) { Unload(); - v12 = "Failed to open Blit API"; - sprintf(pVideoName, v12); + sprintf(pVideoName, "Failed to open Blit API"); MessageBoxA(0, pVideoName, "Smacker Error", 0); return; } @@ -1099,22 +1039,15 @@ //----- (004BF5B2) -------------------------------------------------------- void VideoPlayer::_4BF5B2() { - VideoPlayer *v1; // esi@1 - unsigned int v2; // eax@1 - _BINK **v3; // edi@2 - - v1 = this; - v2 = this->uMovieFormat; - if ( v2 == 2 ) + if ( this->uMovieFormat == 2 ) { - v3 = &this->pBinkMovie; BinkGoto(pBinkMovie, 1, 0); BinkDoFrame(pBinkMovie); BinkNextFrame(pBinkMovie); } else { - if ( v2 != 1 ) + if ( this->uMovieFormat != 1 ) return; SmackGoto(pSmackerMovie, 1); if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) @@ -1124,7 +1057,7 @@ } } pMouse->_469E24(); - if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !v1->pSmackerMovie ) + if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !this->pSmackerMovie ) { bGameoverLoop = 1; sub_4BD8B5(); @@ -1146,27 +1079,16 @@ //----- (004BF73A) -------------------------------------------------------- void VideoPlayer::SelectMovieType() { - VideoPlayer *v1; // esi@1 - int v2; // edi@1 - unsigned __int8 v3; // bl@1 - int v4; // edi@1 char Source[32]; // [sp+Ch] [bp-40h]@1 - v1 = this; - v2 = this->dword_0000A0; - v3 = LOBYTE(this->bLoopPlaying); strcpy(Source, this->pCurrentMovieName); Unload(); - v4 = v2 - 1; - if ( v4 ) - { - if ( v4 == 1 ) - OpenGlobalMovie(Source, v3, 1); - } + if ( this->dword_0000A0 == 1 ) + OpenHouseMovie(Source, LOBYTE(this->bLoopPlaying)); + else if ( this->dword_0000A0 == 2 ) + OpenGlobalMovie(Source, LOBYTE(this->bLoopPlaying), 1); else - { - OpenHouseMovie(Source, v3); - } + __debugbreak(); } //----- (004BF8F6) --------------------------------------------------------