Mercurial > might-and-magic-trilogy
diff VideoPlayer.cpp @ 180:d8aa322a19e5
VideoSound(work)
author | Ritor1 |
---|---|
date | Wed, 19 Dec 2012 18:04:28 +0600 |
parents | ccc0cf95706a |
children | 80201f210d42 705a6c270835 |
line wrap: on
line diff
--- a/VideoPlayer.cpp Wed Dec 19 09:36:10 2012 +0600 +++ b/VideoPlayer.cpp Wed Dec 19 18:04:28 2012 +0600 @@ -328,7 +328,7 @@ { pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); AIL_redbook_stop(pAudioPlayer->hAILRedbook); - AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xEu, &uTrackStartMS, &uTrackEndMS); + AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &uTrackStartMS, &uTrackEndMS); AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS); } bGameoverLoop = 0; @@ -338,20 +338,20 @@ //----- (004BE70E) -------------------------------------------------------- -void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int a3, int a4) +void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int ScreenSizeFlag, int a4) { int v4; // ebp@1 - const char *v5; // edi@1 + const char *pName; // edi@1 MSG Msg; // [sp+Ch] [bp-1Ch]@12 v4 = a2; - v5 = pMovieName; + pName = pMovieName; if ( !(dword_6BE364_game_settings_1 & 0x44) ) { if ( a2 == 2 ) v4 = 0; ShowCursor(0); - pVideoPlayer->OpenMovie(v5, 0, a3); + pVideoPlayer->OpenMovie(pName, 0, ScreenSizeFlag); pVideoPlayer->bPlayingMovie = 1; pVideoPlayer->field_44 = v4; if ( pRenderer->pRenderD3D ) @@ -369,12 +369,12 @@ { if ( pVideoPlayer->pBinkMovie ) { - pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, a3); + pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); while ( pVideoPlayer->pBinkMovie ) { if ( pVideoPlayer->bStopBeforeSchedule ) break; - while ( PeekMessageA(&Msg, 0, 0, 0, 1u) ) + while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) { if ( Msg.message == 18 ) Game_DeinitializeAndTerminate(0); @@ -387,7 +387,7 @@ if ( !pVideoPlayer->pBinkMovie ) break; if ( !BinkWait(pVideoPlayer->pBinkMovie) && !pVideoPlayer->bStopBeforeSchedule ) - pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, a3); + pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); } } if ( pVideoPlayer->bStopBeforeSchedule == 1 ) @@ -399,12 +399,12 @@ { if ( pVideoPlayer->pSmackerMovie ) { - pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, a3); + pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); while ( pVideoPlayer->pSmackerMovie ) { if ( pVideoPlayer->bStopBeforeSchedule ) break; - while ( PeekMessageW(&Msg, 0, 0, 0, 1u) ) + while ( PeekMessageW(&Msg, 0, 0, 0, 1) ) { if (Msg.message == WM_QUIT) Game_DeinitializeAndTerminate(0); @@ -417,7 +417,7 @@ if ( !pVideoPlayer->pSmackerMovie ) break; if ( !SmackWait(pVideoPlayer->pSmackerMovie) && !pVideoPlayer->bStopBeforeSchedule ) - pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, a3); + pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); } } } @@ -562,49 +562,49 @@ //----- (004BEBD7) -------------------------------------------------------- void VideoPlayer::Unload() { - VideoPlayer *v1; // esi@1 - _BINK *v2; // eax@1 - _BINKBUF *v3; // eax@3 - _SMACK *v4; // eax@5 + VideoPlayer *pVideoPlayer; // esi@1 + _BINK *pBinkMovie; // eax@1 + _BINKBUF *pBinkBuffer; // eax@3 + _SMACK *pSmackerMovie; // eax@5 - v1 = this; - v2 = this->pBinkMovie; - if ( v2 ) + pVideoPlayer = this; + pBinkMovie = this->pBinkMovie; + if ( pBinkMovie ) { - BinkPause(v2, 1); - Sleep(300u); - BinkClose(v1->pBinkMovie); - v1->pBinkMovie = 0; + BinkPause(pBinkMovie, 1); + Sleep(300); + BinkClose(pVideoPlayer->pBinkMovie); + pVideoPlayer->pBinkMovie = 0; } - v3 = v1->pBinkBuffer; - if ( v3 ) + pBinkBuffer = pVideoPlayer->pBinkBuffer; + if ( pBinkBuffer ) { - v3->pTargetDDrawSurface->Release(); - v1->pBinkBuffer->pTargetDDrawSurface = 0; - free(v1->pBinkBuffer); - v1->pBinkBuffer = 0; + pBinkBuffer->pTargetDDrawSurface->Release(); + pVideoPlayer->pBinkBuffer->pTargetDDrawSurface = 0; + free(pVideoPlayer->pBinkBuffer); + pVideoPlayer->pBinkBuffer = 0; } - v4 = v1->pSmackerMovie; - if ( v4 ) + pSmackerMovie = pVideoPlayer->pSmackerMovie; + if ( pSmackerMovie ) { - SmackSoundOnOff(v4, 0); - SmackClose(v1->pSmackerMovie); - v1->pSmackerMovie = 0; + SmackSoundOnOff(pSmackerMovie, 0); + SmackClose(pVideoPlayer->pSmackerMovie); + pVideoPlayer->pSmackerMovie = 0; } - if ( v1->pSmackerBuffer ) + if ( pVideoPlayer->pSmackerBuffer ) { - SmackBufferClose(v1->pSmackerBuffer); - v1->pSmackerBuffer = 0; + SmackBufferClose(pVideoPlayer->pSmackerBuffer); + pVideoPlayer->pSmackerBuffer = 0; } - if ( v1->pSmackMovieBlit ) + if ( pVideoPlayer->pSmackMovieBlit ) { - SmackBlitClose(v1->pSmackMovieBlit); - v1->pSmackMovieBlit = 0; + SmackBlitClose(pVideoPlayer->pSmackMovieBlit); + pVideoPlayer->pSmackMovieBlit = 0; } - v1->field_54 = 0; - v1->uMovieFormat = 0; - v1->dword_0000A0 = 0; - memset(v1->pCurrentMovieName, 0, 0x40u); + pVideoPlayer->field_54 = 0; + pVideoPlayer->uMovieFormat = 0; + pVideoPlayer->dword_0000A0 = 0; + memset(pVideoPlayer->pCurrentMovieName, 0, 0x40); if ( pAudioPlayer->hAILRedbook && !bGameoverLoop ) AIL_redbook_resume(pAudioPlayer->hAILRedbook); pEventTimer->Resume(); @@ -941,7 +941,7 @@ //----- (004BF1E6) -------------------------------------------------------- _SMACK *VideoPlayer::OpenSmack(const char *pFilename) { - VideoPlayer *v2; // esi@1 + VideoPlayer *pVideoPlayer; // esi@1 signed int v3; // edi@1 int v4; // ebx@2 signed int v5; // edi@5 @@ -950,40 +950,37 @@ unsigned int v9; // [sp-8h] [bp-18h]@10 signed int v10; // [sp-4h] [bp-14h]@10 - v2 = this; + pVideoPlayer = this; v3 = 0; if ( (signed int)this->uNumMightVideoHeaders > 0 ) { v4 = 0; - while ( _strcmpi(v2->pMightVideoHeaders[v4].pVideoName, pFilename) ) + while ( _strcmpi(pVideoPlayer->pMightVideoHeaders[v4].pVideoName, pFilename) ) { ++v3; ++v4; - if ( v3 >= (signed int)v2->uNumMightVideoHeaders ) + if ( v3 >= (signed int)pVideoPlayer->uNumMightVideoHeaders ) goto LABEL_5; } - SetFilePointer(v2->hMightVid, v2->pMightVideoHeaders[v3].uFileOffset, 0, 0); - v10 = -1; - v9 = 0x7140u; - v8 = v2->hMightVid; - return SmackOpen(v8, v9, v10); + SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0); + return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1); } LABEL_5: v5 = 0; - if ( (signed int)v2->uNumMagicVideoHeaders > 0 ) + if ( (signed int)pVideoPlayer->uNumMagicVideoHeaders > 0 ) { v6 = 0; - while ( _strcmpi(v2->pMagicVideoHeaders[v6].pVideoName, pFilename) ) + while ( _strcmpi(pVideoPlayer->pMagicVideoHeaders[v6].pVideoName, pFilename) ) { ++v5; ++v6; - if ( v5 >= (signed int)v2->uNumMagicVideoHeaders ) + if ( v5 >= (signed int)pVideoPlayer->uNumMagicVideoHeaders ) return 0; } - SetFilePointer(v2->hMagicVid, v2->pMagicVideoHeaders[v5].uFileOffset, 0, 0); + SetFilePointer(pVideoPlayer->hMagicVid, pVideoPlayer->pMagicVideoHeaders[v5].uFileOffset, 0, 0); v10 = -1; v9 = 0x7140u; - v8 = v2->hMagicVid; + v8 = pVideoPlayer->hMagicVid; return SmackOpen(v8, v9, v10); } return 0; @@ -1068,8 +1065,8 @@ //----- (004BF411) -------------------------------------------------------- void VideoPlayer::OpenMovie(const char *pFilename, unsigned int bLoop, int a4) { - VideoPlayer *v4; // esi@1 - _BINK *v5; // eax@2 + VideoPlayer *pVideoPlayer; // esi@1 + _BINK *pVideoOpen; // eax@2 _SMACK *v6; // eax@3 _BINK *pBinkMovie; // eax@5 _SMACK *v8; // eax@7 @@ -1079,52 +1076,54 @@ const char *v12; // [sp-4h] [bp-38h]@8 char pVideoName[120]; // [sp+Ch] [bp-28h]@2 - v4 = this; + pVideoPlayer = this; if ( !this->field_54 ) { Prepare(); - v4->bLoopPlaying = bLoop; + pVideoPlayer->bLoopPlaying = bLoop; sprintf(pVideoName, "%s.bik", pFilename); - v5 = OpenBink(pVideoName); - v4->pBinkMovie = v5; - if ( v5 ) + pVideoOpen = OpenBink(pVideoName); + pVideoPlayer->pBinkMovie = pVideoOpen; + if ( pVideoOpen ) { - v4->uMovieFormat = 2; - strcpy(v4->pCurrentMovieName, pFilename); - pBinkMovie = v4->pBinkMovie; - v4->dword_0000A0 = 1; + pVideoPlayer->uMovieFormat = 2; + strcpy(pVideoPlayer->pCurrentMovieName, pFilename); + pBinkMovie = pVideoPlayer->pBinkMovie; + pVideoPlayer->dword_0000A0 = 1; if ( pBinkMovie ) - v4->pBinkBuffer = CreateBinkBuffer(v4->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); + pVideoPlayer->pBinkBuffer = CreateBinkBuffer(pVideoPlayer->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); } else { Unload(); sprintf(pVideoName, "%s.smk", pFilename); v6 = OpenSmack(pVideoName); - v4->pSmackerMovie = v6; + pVideoPlayer->pSmackerMovie = v6; if ( !v6 ) { Unload(); sprintf(pVideoName, "Can't load file - anims\\%s.smk", pFilename); -LABEL_17: +//LABEL_17: MessageBoxA(0, pVideoName, "Smacker Error", 0); return; } - v4->uMovieFormat = 1; - strcpy(v4->pCurrentMovieName, pFilename); - v8 = v4->pSmackerMovie; - v4->dword_0000A0 = 2; + pVideoPlayer->uMovieFormat = 1; + strcpy(pVideoPlayer->pCurrentMovieName, pFilename); + v8 = pVideoPlayer->pSmackerMovie; + pVideoPlayer->dword_0000A0 = 2; v9 = (char *)malloc(v8->Width * v8->Height); - v4->pSomeSmackerBuffer = v9; + pVideoPlayer->pSomeSmackerBuffer = v9; if ( !v9 ) { Unload(); v12 = "Can't allocate memory for buffer"; -LABEL_16: +//LABEL_16: sprintf(pVideoName, v12); - goto LABEL_17; + //goto LABEL_17; + MessageBoxA(0, pVideoName, "Smacker Error", 0); + return; } - SmackToBuffer(v4->pSmackerMovie, 0, 0, v4->pSmackerMovie->Width, v4->pSmackerMovie->Height, v9, 0); + SmackToBuffer(pVideoPlayer->pSmackerMovie, 0, 0, pVideoPlayer->pSmackerMovie->Width, pVideoPlayer->pSmackerMovie->Height, v9, 0); if ( a4 ) { if ( (unsigned int)uCPUSpeed < 165 ) @@ -1142,12 +1141,15 @@ v10 = SmackCheckSurfaceFromat(); } v11 = SmackBlitOpen(v10); - v4->pSmackMovieBlit = v11; + pVideoPlayer->pSmackMovieBlit = v11; if ( !v11 ) { Unload(); v12 = "Failed to open Blit API"; - goto LABEL_16; + //goto LABEL_16; + sprintf(pVideoName, v12); + MessageBoxA(0, pVideoName, "Smacker Error", 0); + return; } } }