Mercurial > mm7
changeset 2070:4231fdf46dde
Minimap's drawing
author | Nomad |
---|---|
date | Tue, 03 Dec 2013 21:25:05 +0200 |
parents | 259df09dfb50 |
children | 9f4d5a9d6fd8 |
files | Bink_Smacker.cpp Game.cpp UI/UiGame.cpp VideoPlayer.cpp |
diffstat | 4 files changed, 42 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/Bink_Smacker.cpp Tue Dec 03 20:18:17 2013 +0200 +++ b/Bink_Smacker.cpp Tue Dec 03 21:25:05 2013 +0200 @@ -24,34 +24,45 @@ int (__stdcall *smackw32_SmackBlitClear)(HSMACKBLIT, unsigned short *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int) = 0; int (__stdcall *smackw32_SmackGoto)(_SMACK *, long) = 0; int (__stdcall *smackw32_SmackBufferOpen)(HWND a1, long a2, long a3, long a4, long a5, long a6) = nullptr; +int (__stdcall *smackw32_SmackBufferNewPalette)(long, long, long) = nullptr; +int (__stdcall *smackw32_SmackColorRemapWithTrans)(long, long, long, long, long) = nullptr; void SMACKW32_DLL_Initialize() { - HMODULE pDll = LoadLibraryW(L"SmackW32.dll"); + HMODULE pDll = LoadLibraryW(L"SmackW32.dll"); + + #define LOAD(x) smackw32_##x = (decltype(smackw32_##x))GetProcAddress(pDll, #x) + { + smackw32_SmackSoundUseMSS = (int (__stdcall *)(HDIGDRIVER))GetProcAddress(pDll, "_SmackSoundUseMSS@4"); + smackw32_SmackUseMMX = (unsigned int (__stdcall *)(unsigned int))GetProcAddress(pDll, "_SmackUseMMX@4"); + smackw32_SmackOpen = (HSMACK (__stdcall *)(HANDLE, unsigned int, unsigned int))GetProcAddress(pDll, "_SmackOpen@12"); + smackw32_SmackBlitOpen = (HSMACKBLIT (__stdcall *)(unsigned int))GetProcAddress(pDll, "_SmackBlitOpen@4"); + smackw32_SmackToBuffer = (void (__stdcall *)(HSMACK, unsigned int, unsigned int, unsigned int, unsigned int, void *, unsigned int))GetProcAddress(pDll, "_SmackToBuffer@28"); + smackw32_SmackBlitSetPalette = (void (__stdcall *)(HSMACKBLIT, void *, unsigned int))GetProcAddress(pDll, "_SmackBlitSetPalette@12"); + smackw32_SmackDoFrame = (unsigned int (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackDoFrame@4"); + smackw32_SmackToBufferRect = (unsigned int (__stdcall *)(HSMACK, unsigned int))GetProcAddress(pDll, "_SmackToBufferRect@8"); + smackw32_SmackBlit = (void (__stdcall *)(HSMACKBLIT, void *, unsigned int, unsigned int, unsigned int, void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int))GetProcAddress(pDll, "_SmackBlit@44"); + smackw32_SmackNextFrame = (void (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackNextFrame@4"); + smackw32_SmackWait = (unsigned int (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackWait@4"); + smackw32_SmackSoundOnOff = (unsigned int (__stdcall *)(HSMACK, unsigned int))GetProcAddress(pDll, "_SmackSoundOnOff@8"); + smackw32_SmackClose = (void (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackClose@4"); + smackw32_SmackBufferClose = (void (__stdcall *)(HSMACKBUF))GetProcAddress(pDll, "_SmackBufferClose@4"); + smackw32_SmackBlitClose = (void (__stdcall *)(HSMACKBLIT))GetProcAddress(pDll, "_SmackBlitClose@4"); + smackw32_SmackBlitClear = (int (__stdcall *)(HSMACKBLIT, unsigned short *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int))GetProcAddress(pDll, "_SmackBlitClear@32"); + smackw32_SmackGoto = (int (__stdcall *)(_SMACK *, long))GetProcAddress(pDll, "_SmackGoto@8"); + smackw32_SmackBufferOpen = (int (__stdcall *)(HWND, long, long, long, long, long))GetProcAddress(pDll, "_SmackBufferOpen@24"); - smackw32_SmackSoundUseMSS = (int (__stdcall *)(HDIGDRIVER))GetProcAddress(pDll, "_SmackSoundUseMSS@4"); - smackw32_SmackUseMMX = (unsigned int (__stdcall *)(unsigned int))GetProcAddress(pDll, "_SmackUseMMX@4"); - smackw32_SmackOpen = (HSMACK (__stdcall *)(HANDLE, unsigned int, unsigned int))GetProcAddress(pDll, "_SmackOpen@12"); - smackw32_SmackBlitOpen = (HSMACKBLIT (__stdcall *)(unsigned int))GetProcAddress(pDll, "_SmackBlitOpen@4"); - smackw32_SmackToBuffer = (void (__stdcall *)(HSMACK, unsigned int, unsigned int, unsigned int, unsigned int, void *, unsigned int))GetProcAddress(pDll, "_SmackToBuffer@28"); - smackw32_SmackBlitSetPalette = (void (__stdcall *)(HSMACKBLIT, void *, unsigned int))GetProcAddress(pDll, "_SmackBlitSetPalette@12"); - smackw32_SmackDoFrame = (unsigned int (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackDoFrame@4"); - smackw32_SmackToBufferRect = (unsigned int (__stdcall *)(HSMACK, unsigned int))GetProcAddress(pDll, "_SmackToBufferRect@8"); - smackw32_SmackBlit = (void (__stdcall *)(HSMACKBLIT, void *, unsigned int, unsigned int, unsigned int, void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int))GetProcAddress(pDll, "_SmackBlit@44"); - smackw32_SmackNextFrame = (void (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackNextFrame@4"); - smackw32_SmackWait = (unsigned int (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackWait@4"); - smackw32_SmackSoundOnOff = (unsigned int (__stdcall *)(HSMACK, unsigned int))GetProcAddress(pDll, "_SmackSoundOnOff@8"); - smackw32_SmackClose = (void (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackClose@4"); - smackw32_SmackBufferClose = (void (__stdcall *)(HSMACKBUF))GetProcAddress(pDll, "_SmackBufferClose@4"); - smackw32_SmackBlitClose = (void (__stdcall *)(HSMACKBLIT))GetProcAddress(pDll, "_SmackBlitClose@4"); - smackw32_SmackBlitClear = (int (__stdcall *)(HSMACKBLIT, unsigned short *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int))GetProcAddress(pDll, "_SmackBlitClear@32"); - smackw32_SmackGoto = (int (__stdcall *)(_SMACK *, long))GetProcAddress(pDll, "_SmackGoto@8"); - smackw32_SmackBufferOpen = (int (__stdcall *)(HWND, long, long, long, long, long))GetProcAddress(pDll, "_SmackBufferOpen@24"); + LOAD(SmackBufferNewPalette); + LOAD(SmackColorRemapWithTrans); + } } - +int __stdcall SmackColorRemapWithTrans(long a1, long a2, long a3, long a4, long a5) +{ + return (smackw32_SmackColorRemapWithTrans)(a1, a2, a3, a4, a5); +} void __stdcall SmackBlitClose(HSMACKBLIT hBlit) { @@ -154,19 +165,9 @@ // sub_4D83D0: using guessed type int __stdcall SmackBufferNewPalette(_DWORD, _DWORD, _DWORD); int __stdcall SmackBufferNewPalette(long a1, long a2, long a3) { - //__asm int 3 - return 0; + return (smackw32_SmackBufferNewPalette)(a1, a2, a3); } -// sub_4D83D4: using guessed type int __stdcall SmackColorRemapWithTrans(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -int __stdcall SmackColorRemapWithTrans(long a1, long a2, long a3, long a4, long a5) -{ - //__asm int 3 - return 0; -} - - -
--- a/Game.cpp Tue Dec 03 20:18:17 2013 +0200 +++ b/Game.cpp Tue Dec 03 21:25:05 2013 +0200 @@ -170,7 +170,7 @@ } if (!pVideoPlayer->pSmackerMovie) { - GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, pParty->uFlags & 2); + GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2); if (v4) { if ( !PauseGameDrawing() && pRenderer->pRenderD3D) // clear game viewport with transparent color
--- a/UI/UiGame.cpp Tue Dec 03 20:18:17 2013 +0200 +++ b/UI/UiGame.cpp Tue Dec 03 21:25:05 2013 +0200 @@ -1914,6 +1914,8 @@ pRenderer->WritePixel16(uX + x, uY + y, pPal[pMapLod0Line[v29]]); v29 = (v70 + x * v73) >> 16; } + uBluea += v73; + v27 = uBluea >> 16; } /*v29 = v70 >> 16;
--- a/VideoPlayer.cpp Tue Dec 03 20:18:17 2013 +0200 +++ b/VideoPlayer.cpp Tue Dec 03 21:25:05 2013 +0200 @@ -458,6 +458,8 @@ a2.dwSize = 32; a2.dwFlags = 64; pRenderer->GetTargetPixelFormat(&a2); + if (a2.dwRGBBitCount == 32) + return SMACKBUFFER565; if ( a2.dwRGBBitCount != 8 ) { if ( a2.dwRBitMask == 0xF800 ) @@ -849,6 +851,9 @@ unsigned int v5; // eax@1 //_SMACK *v6; // eax@1 + Log::Warning(L"smacker"); + return; + pRenderer->BeginScene(); auto pixels = new unsigned short[640 * 480]; @@ -859,7 +864,7 @@ SmackToBuffer(pSmackerMovie, 8, 8, 2 * v4, pRenderer->field_14, v3, v5); - for (unsigned int y = 8; y < 8 + pRenderer->field_14; ++y) + for (unsigned int y = 8; y < 8 + pSmackerMovie->Height; ++y) for (unsigned int x = 8; x < 8 + pSmackerMovie->Width; ++x) { pRenderer->WritePixel16(x, y, pixels[x + y * 640]); @@ -867,7 +872,7 @@ delete [] pixels; //v6 = pSmackerMovie; - if ( pSmackerMovie->NewPalette ) + if (false&& pSmackerMovie->NewPalette ) { SmackBufferNewPalette((long)pSmackerBuffer, (long)pSmackerMovie->Palette, LOWORD(pSmackerMovie->PalType)); SmackColorRemapWithTrans(