Mercurial > might-and-magic-trilogy
changeset 185:48f9a1ac8376
Слияние
author | Ritor1 |
---|---|
date | Thu, 20 Dec 2012 09:26:47 +0600 |
parents | 705a6c270835 (current diff) 80201f210d42 (diff) |
children | 0a0eb74e8e95 |
files | VideoPlayer.cpp |
diffstat | 2 files changed, 41 insertions(+), 101 deletions(-) [+] |
line wrap: on
line diff
--- a/VideoPlayer.cpp Thu Dec 20 09:26:37 2012 +0600 +++ b/VideoPlayer.cpp Thu Dec 20 09:26:47 2012 +0600 @@ -285,10 +285,6 @@ BYTE3(_this->uBinkDDSurfaceType) &= 0xFB; } } - - - - //----- (004BF794) -------------------------------------------------------- void __cdecl ShowIntroVideo_and_LoadingScreen() { @@ -464,67 +460,46 @@ //----- (004BE9D8) -------------------------------------------------------- void VideoPlayer::Initialize() { - //VideoPlayer *v1; // esi@1 - HANDLE v2; // eax@1 - char *v3; // ebp@2 - HANDLE v4; // eax@5 - HANDLE v5; // eax@7 - unsigned int v6; // eax@9 - const char *v7; // [sp-8h] [bp-1Ch]@3 - char *v8; // [sp-4h] [bp-18h]@2 DWORD NumberOfBytesRead; // [sp+10h] [bp-4h]@9 - - + uint uBinkVersionMajor = -1, uBinkVersionMinor = -1; GetDllVersion(L"BINKW32.DLL", &uBinkVersionMajor, &uBinkVersionMinor); uBinkVersion = (unsigned __int64)uBinkVersionMajor << 32 | uBinkVersionMinor; - - //v1 = this; strcpy(pTmpBuf, "anims\\might7.vid"); - v2 = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); - hMightVid = v2; - if ( v2 == INVALID_HANDLE_VALUE ) + hMightVid = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); + if ( hMightVid == INVALID_HANDLE_VALUE ) { - v8 = pTmpBuf; - v3 = pTmpBuf2; -LABEL_3: - v7 = "Can't open file - anims\\%s.smk"; -LABEL_4: - sprintf(v3, v7, v8); - MessageBoxA(0, v3, "Video File Error", 0); + sprintf(pTmpBuf2, "Can't open file - anims\\%s.smk", pTmpBuf); + MessageBoxA(0, pTmpBuf2, "Video File Error", 0); return; } strcpy(pTmpBuf, "anims\\magic7.vid"); - v4 = CreateFileW(L"anims\\magic7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); - hMagicVid = v4; - if ( v4 == INVALID_HANDLE_VALUE ) + hMagicVid = CreateFileW(L"anims\\magic7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); + if ( hMagicVid == INVALID_HANDLE_VALUE ) { - v3 = pTmpBuf2; - v8 = pTmpBuf; if ( !bCanLoadFromCD ) - goto LABEL_3; + { + sprintf(pTmpBuf2, "Can't open file - anims\\%s.smk", pTmpBuf); + MessageBoxA(0, pTmpBuf2, "Video File Error", 0); + return; + } sprintf(pTmpBuf2, "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf); - v5 = CreateFileA(pTmpBuf2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); - hMagicVid = v5; - if ( v5 == (HANDLE)INVALID_HANDLE_VALUE ) + hMagicVid = CreateFileA(pTmpBuf2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); + if ( hMagicVid == (HANDLE)INVALID_HANDLE_VALUE ) { - v8 = pTmpBuf; - v7 = "Can't open file - %s"; - goto LABEL_4; + sprintf(pTmpBuf2, "Can't open file - %s", pTmpBuf); + MessageBoxA(0, pTmpBuf2, "Video File Error", 0); + return; } } - ReadFile(hMightVid, &uNumMightVideoHeaders, 4u, &NumberOfBytesRead, 0); - ReadFile(hMagicVid, &uNumMagicVideoHeaders, 4u, &NumberOfBytesRead, 0); - v6 = 44 * uNumMightVideoHeaders + 2; + ReadFile(hMightVid, &uNumMightVideoHeaders, 4, &NumberOfBytesRead, 0); + ReadFile(hMagicVid, &uNumMagicVideoHeaders, 4, &NumberOfBytesRead, 0); pMagicVideoHeaders = 0; pMightVideoHeaders = 0; - pMightVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(0, v6, 0); - pMagicVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk( - pMagicVideoHeaders, - 44 * uNumMagicVideoHeaders + 2, - 0); + pMightVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(0, 44 * uNumMightVideoHeaders + 2, 0); + pMagicVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(pMagicVideoHeaders, 44 * uNumMagicVideoHeaders + 2, 0); ReadFile(hMightVid, pMightVideoHeaders, 44 * uNumMightVideoHeaders, &NumberOfBytesRead, 0); ReadFile(hMagicVid, pMagicVideoHeaders, 44 * uNumMagicVideoHeaders, &NumberOfBytesRead, 0); } @@ -550,7 +525,7 @@ v1->bFirstFrame = 0; v1->bUsingSmackerMMX = SmackUseMMX(1); BinkSetSoundSystem(BinkOpenMiles, pAudioPlayer->hDigDriver); - if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) + if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5 ) v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer4; else v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer2; @@ -668,14 +643,8 @@ BinkGetRects(pBinkMovie, pBinkBuffer->uBinkDDSurfaceType); if ( BinkLockBuffer(pBinkBuffer) ) { - BinkCopyToBuffer( - pBinkMovie, - pBinkBuffer->pDDrawSurfaceData, - pBinkBuffer->uDDrawSurfacePitch, - pBinkBuffer->uHeight, - 0, - 0, - pBinkBuffer->uBinkDDSurfaceType); + BinkCopyToBuffer(pBinkMovie, pBinkBuffer->pDDrawSurfaceData, pBinkBuffer->uDDrawSurfacePitch, pBinkBuffer->uHeight, + 0, 0, pBinkBuffer->uBinkDDSurfaceType); BinkUnlockBuffer(pBinkBuffer); } v5 = pBinkBuffer; @@ -815,18 +784,8 @@ while ( v8 ) { v10 = v4->pSmackerMovie; - SmackBlit( - v4->pSmackMovieBlit, - pOutSurface, - uPixelsPerRow, - Point.x + v10->LastRectx, - a3 + Point.y + v10->LastRecty, - v4->pSomeSmackerBuffer, - v10->Width, - v10->LastRectx, - v10->LastRecty, - v10->LastRectw, - v10->LastRecth); + SmackBlit(v4->pSmackMovieBlit, pOutSurface, uPixelsPerRow, Point.x + v10->LastRectx, a3 + Point.y + v10->LastRecty, + v4->pSomeSmackerBuffer, v10->Width, v10->LastRectx, v10->LastRecty, v10->LastRectw, v10->LastRecth); v8 = SmackToBufferRect(v4->pSmackerMovie, 0); } } @@ -836,18 +795,8 @@ while ( SmackToBufferRect(v4->pSmackerMovie, 0) ) { v11 = v4->pSmackerMovie; - SmackBlit( - v4->pSmackMovieBlit, - pOutSurface, - uPixelsPerRow, - v11->LastRectx, - a3 + v11->LastRecty, - v4->pSomeSmackerBuffer, - v11->Width, - v11->LastRectx, - v11->LastRecty, - v11->LastRectw, - v11->LastRecth); + SmackBlit(v4->pSmackMovieBlit, pOutSurface, uPixelsPerRow, v11->LastRectx, a3 + v11->LastRecty, v4->pSomeSmackerBuffer, + v11->Width, v11->LastRectx, v11->LastRecty, v11->LastRectw, v11->LastRecth); } } pRenderer->UnlockFrontBuffer(); @@ -944,43 +893,35 @@ 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 + //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; - v3 = 0; if ( (signed int)this->uNumMightVideoHeaders > 0 ) { - v4 = 0; - while ( _strcmpi(pVideoPlayer->pMightVideoHeaders[v4].pVideoName, pFilename) ) + for ( v3 = 0; v3 < (signed int)pVideoPlayer->uNumMightVideoHeaders; ++v3) { - ++v3; - ++v4; - if ( v3 >= (signed int)pVideoPlayer->uNumMightVideoHeaders ) - goto LABEL_5; + v4 = _strcmpi(pVideoPlayer->pMightVideoHeaders[v3].pVideoName, pFilename); + if ( !v4 ) + { + SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0); + return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1); + } } - SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0); - return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1); } -LABEL_5: v5 = 0; if ( (signed int)pVideoPlayer->uNumMagicVideoHeaders > 0 ) { - v6 = 0; - while ( _strcmpi(pVideoPlayer->pMagicVideoHeaders[v6].pVideoName, pFilename) ) + while ( _strcmpi(pVideoPlayer->pMagicVideoHeaders[v5].pVideoName, pFilename) ) { ++v5; - ++v6; if ( v5 >= (signed int)pVideoPlayer->uNumMagicVideoHeaders ) return 0; } SetFilePointer(pVideoPlayer->hMagicVid, pVideoPlayer->pMagicVideoHeaders[v5].uFileOffset, 0, 0); - v10 = -1; - v9 = 0x7140u; - v8 = pVideoPlayer->hMagicVid; - return SmackOpen(v8, v9, v10); + return SmackOpen(pVideoPlayer->hMagicVid, 0x7140, -1); } return 0; }