diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index bb098041a..dc5484c4d 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -662,7 +662,7 @@ SDrawCaptureScreen( HWND STORMAPI SDrawGetFrameWindow( - HWND *sdraw_framewindow = NULL); + HWND *sdraw_framewindow); /* SDrawGetObjects @ 347 diff --git a/DiabloUI/bn_prof.cpp b/DiabloUI/bn_prof.cpp index 2d71e9faa..db97e576c 100644 --- a/DiabloUI/bn_prof.cpp +++ b/DiabloUI/bn_prof.cpp @@ -66,7 +66,7 @@ HGDIOBJ __stdcall bn_prof_1000155F(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP default: if ( Msg > 0x103 && Msg <= 0x105 ) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); } return (HGDIOBJ)SDlgDefDialogProc(hWnd, Msg, wParam, lParam); @@ -395,7 +395,7 @@ HINSTANCE __fastcall bn_prof_10001B0A(HWND a1, const CHAR *a2) { return 0; } hWnd = a1; v3 = GetDesktopWindow(); SetForegroundWindow(v3); - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); result = ShellExecuteA(v4, "open", v2, 0, 0, 1); if ( (unsigned int)result <= 0x20 ) { @@ -404,12 +404,12 @@ HINSTANCE __fastcall bn_prof_10001B0A(HWND a1, const CHAR *a2) { return 0; } fclose(v6); if ( (unsigned int)FindExecutableA("battle.htm", 0, &Result) <= 0x20 ) { - v7 = (HWND)SDrawGetFrameWindow(); + v7 = (HWND)SDrawGetFrameWindow(NULL); if ( (unsigned int)ShellExecuteA(v7, "open", &Result, v2, 0, 1) <= 0x20 ) { - v8 = (HWND)SDrawGetFrameWindow(); + v8 = (HWND)SDrawGetFrameWindow(NULL); SetActiveWindow(v8); - v9 = (HWND)SDrawGetFrameWindow(); + v9 = (HWND)SDrawGetFrameWindow(NULL); ShowWindow(v9, 0); LoadStringA(hInstance, 0x50u, &Buffer, 512); LoadStringA(hInstance, 0x51u, &Caption, 64); diff --git a/DiabloUI/copyprot.cpp b/DiabloUI/copyprot.cpp index eb85c8349..300be5565 100644 --- a/DiabloUI/copyprot.cpp +++ b/DiabloUI/copyprot.cpp @@ -9,7 +9,7 @@ BOOL __stdcall UiCopyProtError(int *pdwResult) LoadStringA(ghUiInst, 0x3Fu, Buffer, 127); else LoadStringA(ghUiInst, 0x1Bu, Buffer, 127); - v1 = (int)SDrawGetFrameWindow(); + v1 = (int)SDrawGetFrameWindow(NULL); v2 = SDlgDialogBoxParam(ghUiInst, "OKCANCEL_DIALOG", v1, CopyProt_WndProc, (int)Buffer); if (pdwResult) *pdwResult = v2; @@ -34,7 +34,7 @@ LRESULT __stdcall CopyProt_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP if (Msg <= 0x103) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); if (Msg <= 0x105) { - v9 = (HWND)SDrawGetFrameWindow(); + v9 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v9, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } diff --git a/DiabloUI/cr8game.cpp b/DiabloUI/cr8game.cpp index 841b83296..8603c157b 100644 --- a/DiabloUI/cr8game.cpp +++ b/DiabloUI/cr8game.cpp @@ -164,7 +164,7 @@ LRESULT __stdcall cr8game_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa } return 0; } - v8 = (HWND)SDrawGetFrameWindow(); + v8 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v8, Msg, wParam, lParam); } return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam); diff --git a/DiabloUI/creadung.cpp b/DiabloUI/creadung.cpp index 2fea53898..ea1f7bec0 100644 --- a/DiabloUI/creadung.cpp +++ b/DiabloUI/creadung.cpp @@ -53,7 +53,7 @@ LRESULT __stdcall CreaDung_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } return 0; } - v6 = (HWND)SDrawGetFrameWindow(); + v6 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v6, Msg, wParam, lParam); } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); diff --git a/DiabloUI/credits.cpp b/DiabloUI/credits.cpp index 1db3a4fae..53b8b41ab 100644 --- a/DiabloUI/credits.cpp +++ b/DiabloUI/credits.cpp @@ -11,7 +11,7 @@ BOOL __stdcall UiCreditsDialog(int a1) { int v1; // eax - v1 = (int)SDrawGetFrameWindow(); + v1 = (int)SDrawGetFrameWindow(NULL); SDlgDialogBoxParam(ghUiInst, "CREDITS_DIALOG", v1, credits_WndProc, 25); return 1; } @@ -51,7 +51,7 @@ LRESULT __stdcall credits_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa if (Msg != 256) { if (Msg > 0x103) { if (Msg <= 0x105) { - v5 = (HWND)SDrawGetFrameWindow(); + v5 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v5, Msg, wParam, lParam); } else if (Msg == 272) { credits_LoadImgCreditTxt(hWnd, lParam); diff --git a/DiabloUI/dirlink.cpp b/DiabloUI/dirlink.cpp index 3f8fde91f..f4ac74695 100644 --- a/DiabloUI/dirlink.cpp +++ b/DiabloUI/dirlink.cpp @@ -90,7 +90,7 @@ int __stdcall DirLink_10005D63(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); if ( Msg <= 0x105 ) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } diff --git a/DiabloUI/disclaim.cpp b/DiabloUI/disclaim.cpp index 6f154bfb7..6c4cfd9c6 100644 --- a/DiabloUI/disclaim.cpp +++ b/DiabloUI/disclaim.cpp @@ -3,7 +3,7 @@ BOOL __stdcall UiBetaDisclaimer(int a1) { int v1; // eax - v1 = (int)SDrawGetFrameWindow(); + v1 = (int)SDrawGetFrameWindow(NULL); SDlgDialogBoxParam(ghUiInst, "DISCLAIMER_DIALOG", v1, disclaim_WndProc, a1); return 1; } @@ -31,7 +31,7 @@ LRESULT __stdcall disclaim_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP if (Msg != 256) { if (Msg > 0x103) { if (Msg <= 0x105) { - v5 = (HWND)SDrawGetFrameWindow(); + v5 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v5, Msg, wParam, lParam); } else if (Msg == 272) { disclaim_LoadDisclaimGFX(hWnd); diff --git a/DiabloUI/entdial.cpp b/DiabloUI/entdial.cpp index f65b531bb..999319619 100644 --- a/DiabloUI/entdial.cpp +++ b/DiabloUI/entdial.cpp @@ -15,7 +15,7 @@ int __stdcall EntDial_10006C96(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam { if ( Msg <= 0x105 ) { - v7 = (HWND)SDrawGetFrameWindow(); + v7 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v7, Msg, wParam, lParam); } else diff --git a/DiabloUI/entname.cpp b/DiabloUI/entname.cpp index 2321a003d..171424840 100644 --- a/DiabloUI/entname.cpp +++ b/DiabloUI/entname.cpp @@ -15,7 +15,7 @@ LRESULT __stdcall EntName_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa if (Msg <= 0x103) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); if (Msg <= 0x105) { - v9 = (HWND)SDrawGetFrameWindow(); + v9 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v9, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } diff --git a/DiabloUI/mainmenu.cpp b/DiabloUI/mainmenu.cpp index 09b4d8cf4..3295300bb 100644 --- a/DiabloUI/mainmenu.cpp +++ b/DiabloUI/mainmenu.cpp @@ -18,7 +18,7 @@ BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSo menu_version_str[0] = 0; if (name) strncpy(menu_version_str, name, 0x40u); - v4 = (int)SDrawGetFrameWindow(); + v4 = (int)SDrawGetFrameWindow(NULL); v5 = SDlgDialogBoxParam(ghUiInst, "MAINMENU_DIALOG", v4, MainMenu_WndProc, 0); if (v5 == 5) artfont_FreeAllFonts(); @@ -40,7 +40,7 @@ LRESULT __stdcall MainMenu_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP MainMenu_KillAndFreeMenu(hWnd); } else if (Msg > 0x103) { if (Msg <= 0x105) { - v5 = (HWND)SDrawGetFrameWindow(); + v5 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v5, Msg, wParam, lParam); } else { if (Msg == 272) { diff --git a/DiabloUI/modem.cpp b/DiabloUI/modem.cpp index ffb0400cf..b6b93d62f 100644 --- a/DiabloUI/modem.cpp +++ b/DiabloUI/modem.cpp @@ -173,7 +173,7 @@ int __stdcall Modem_100086DE(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); if ( Msg <= 0x105 ) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } diff --git a/DiabloUI/modmstat.cpp b/DiabloUI/modmstat.cpp index e1ab60592..77286a4bc 100644 --- a/DiabloUI/modmstat.cpp +++ b/DiabloUI/modmstat.cpp @@ -33,7 +33,7 @@ int __stdcall ModmStat_10008CA0(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara { if ( Msg <= 0x105 ) { - v6 = (HWND)SDrawGetFrameWindow(); + v6 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v6, Msg, wParam, lParam); } else diff --git a/DiabloUI/okcancel.cpp b/DiabloUI/okcancel.cpp index 076029a6f..13d1e4abe 100644 --- a/DiabloUI/okcancel.cpp +++ b/DiabloUI/okcancel.cpp @@ -63,7 +63,7 @@ LRESULT __stdcall OkCancel_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP if (Msg <= 0x103) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); if (Msg <= 0x105) { - v9 = (HWND)SDrawGetFrameWindow(); + v9 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v9, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } @@ -160,7 +160,7 @@ BOOL __fastcall OkCancel_LoadOkCancGFX(HWND hWnd, DWORD *lParam) pszFileName = "ui_art\\spopup.pcx"; } v4 = GetParent(hWnd); - if ((HWND)SDrawGetFrameWindow() == v4) { + if ((HWND)SDrawGetFrameWindow(NULL) == v4) { local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, pszFileName, pBuffer, 0, 1); v5 = local_GetArtPalEntry(0); SDrawUpdatePalette(0, 0xAu, v5, 0); @@ -170,7 +170,7 @@ BOOL __fastcall OkCancel_LoadOkCancGFX(HWND hWnd, DWORD *lParam) local_LoadArtWithPal(hWnd, (int)v6, "Popup", -1, 1, pszFileName, pBuffer, 0, 1); } v7 = GetParent(hWnd); - if ((HWND)SDrawGetFrameWindow() == v7) + if ((HWND)SDrawGetFrameWindow(NULL) == v7) Fade_SetInputWindow(hWnd); v8 = pBuffer + 1; local_LoadArtImage("ui_art\\but_sml.pcx", pBuffer + 1, data); diff --git a/DiabloUI/progress.cpp b/DiabloUI/progress.cpp index 9054b631f..f6873e60f 100644 --- a/DiabloUI/progress.cpp +++ b/DiabloUI/progress.cpp @@ -52,7 +52,7 @@ int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara { if ( Msg <= 0x105 ) { - v7 = (HWND)SDrawGetFrameWindow(); + v7 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v7, Msg, wParam, lParam); } else @@ -61,7 +61,7 @@ int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara { case 0x110u: Progress_10009675(hWnd, (const CHAR *)lParam); - v5 = (void *)SDrawGetFrameWindow(); + v5 = (void *)SDrawGetFrameWindow(NULL); local_1000812B(v5); local_1000812B(hWnd); ShowCursor(1); @@ -71,7 +71,7 @@ int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara { SDlgKillTimer(hWnd, 1); v4 = GetParent(hWnd); - if ( (HWND)SDrawGetFrameWindow() == v4 ) + if ( (HWND)SDrawGetFrameWindow(NULL) == v4 ) Fade_100072BE(10); Progress_100098B0(); } @@ -153,7 +153,7 @@ BOOL __fastcall Progress_10009675(HWND hWnd, const CHAR *a2) { return 0; } SDlgSetTimer(hWnd, 1, 50, 0); local_10007944((int)v2, 0, &byte_10029448, -1, 1, (int)"ui_art\\spopup.pcx", &dword_1002A318, 0, 0); v3 = GetParent(v2); - if ( (HWND)SDrawGetFrameWindow() == v3 ) + if ( (HWND)SDrawGetFrameWindow(NULL) == v3 ) Fade_100073EF(v2); v4 = local_10007895(0); SDrawUpdatePalette(0, 10, v4, 0); @@ -257,7 +257,7 @@ void UNKCALL Progress_100098C5(HWND hWnd) { return; } { SDlgKillTimer(v1, 1); v3 = GetParent(v1); - if ( (HWND)SDrawGetFrameWindow() == v3 ) + if ( (HWND)SDrawGetFrameWindow(NULL) == v3 ) Fade_100072BE(10); Progress_100098B0(); dword_1002A2E8 &= v4; diff --git a/DiabloUI/selclass.cpp b/DiabloUI/selclass.cpp index 03377a192..89ec9c774 100644 --- a/DiabloUI/selclass.cpp +++ b/DiabloUI/selclass.cpp @@ -14,7 +14,7 @@ LRESULT __stdcall SelClass_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP if (Msg <= 0x103) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); if (Msg <= 0x105) { - v9 = (HWND)SDrawGetFrameWindow(); + v9 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v9, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } diff --git a/DiabloUI/selconn.cpp b/DiabloUI/selconn.cpp index 34fde3259..055abc06f 100644 --- a/DiabloUI/selconn.cpp +++ b/DiabloUI/selconn.cpp @@ -57,7 +57,7 @@ LABEL_25: return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); if ( Msg <= 0x105 ) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } @@ -1115,7 +1115,7 @@ int __stdcall UiSelectProvider(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYE dword_1002A364 = a4; dword_1002A358 = a5; artfont_10001159(); - v6 = SDrawGetFrameWindow(); + v6 = SDrawGetFrameWindow(NULL); v7 = SDlgDialogBoxParam(hInstance, "SELCONNECT_DIALOG", v6, SelConn_1000A0A6, 0); if ( a6 ) *a6 = SelGame_1000B67E(); diff --git a/DiabloUI/seldial.cpp b/DiabloUI/seldial.cpp index 4d427c70e..a93133387 100644 --- a/DiabloUI/seldial.cpp +++ b/DiabloUI/seldial.cpp @@ -67,7 +67,7 @@ int __stdcall SelDial_1000B0CF(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam { if ( Msg <= 0x105 ) { - v7 = (HWND)SDrawGetFrameWindow(); + v7 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v7, Msg, wParam, lParam); return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } diff --git a/DiabloUI/selhero.cpp b/DiabloUI/selhero.cpp index 7cc22a9c4..09c901ee4 100644 --- a/DiabloUI/selhero.cpp +++ b/DiabloUI/selhero.cpp @@ -226,7 +226,7 @@ BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf sgpHeroInfo = 0; selhero_is_good = 1; selhero_is_created = 0; - v7 = (int)SDrawGetFrameWindow(); + v7 = (int)SDrawGetFrameWindow(NULL); v8 = SDlgDialogBoxParam(ghUiInst, "SELHERO_DIALOG", v7, SelHero_WndProc, 0); if (dlgresult) *dlgresult = v8; @@ -295,7 +295,7 @@ LRESULT __stdcall SelHero_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa if (Msg <= 0x103) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); if (Msg <= 0x105) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } @@ -716,7 +716,7 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf selhero_fnstats = fnstats; sgpHeroInfo = 0; selhero_is_good = 0; - v7 = (int)SDrawGetFrameWindow(); + v7 = (int)SDrawGetFrameWindow(NULL); v8 = SDlgDialogBoxParam(ghUiInst, "SELHERO_DIALOG", v7, SelHero_WndProc, 0); if (dlgresult) *dlgresult = v8; diff --git a/DiabloUI/selipx.cpp b/DiabloUI/selipx.cpp index d41e7cf3b..bcbaab342 100644 --- a/DiabloUI/selipx.cpp +++ b/DiabloUI/selipx.cpp @@ -82,7 +82,7 @@ LABEL_35: return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); if ( Msg <= 0x105 ) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } diff --git a/DiabloUI/sellist.cpp b/DiabloUI/sellist.cpp index b70c6b3af..d98ca20a3 100644 --- a/DiabloUI/sellist.cpp +++ b/DiabloUI/sellist.cpp @@ -78,7 +78,7 @@ LRESULT __stdcall SelList_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa if (Msg <= 0x103) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); if (Msg <= 0x105) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } diff --git a/DiabloUI/selload.cpp b/DiabloUI/selload.cpp index 9ad9f4305..cd87186ea 100644 --- a/DiabloUI/selload.cpp +++ b/DiabloUI/selload.cpp @@ -14,7 +14,7 @@ LRESULT __stdcall SelLoad_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa if (Msg <= 0x103) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); if (Msg <= 0x105) { - v9 = (HWND)SDrawGetFrameWindow(); + v9 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v9, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } diff --git a/DiabloUI/selmodem.cpp b/DiabloUI/selmodem.cpp index e06aa82da..69f44ebc5 100644 --- a/DiabloUI/selmodem.cpp +++ b/DiabloUI/selmodem.cpp @@ -229,7 +229,7 @@ LABEL_25: return SDlgDefDialogProc(hDlg, Msg, wParam, lParam); if ( Msg <= 0x105 ) { - v5 = (HWND)SDrawGetFrameWindow(); + v5 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v5, Msg, wParam, lParam); return SDlgDefDialogProc(hDlg, Msg, wParam, lParam); } diff --git a/DiabloUI/selregn.cpp b/DiabloUI/selregn.cpp index 6251efd30..fd53f474c 100644 --- a/DiabloUI/selregn.cpp +++ b/DiabloUI/selregn.cpp @@ -65,7 +65,7 @@ LABEL_25: return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); if ( Msg <= 0x105 ) { - v4 = (HWND)SDrawGetFrameWindow(); + v4 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v4, Msg, wParam, lParam); return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } @@ -870,7 +870,7 @@ signed int __stdcall UiSelectRegion(_DWORD *a1) { return 0; } signed int result; // eax artfont_10001159(); - v1 = SDrawGetFrameWindow(); + v1 = SDrawGetFrameWindow(NULL); v2 = SDlgDialogBoxParam(hInstance, "SELREGION_DIALOG", v1, SelRegn_1000EF6B, 0); if ( a1 ) *a1 = dword_1002948C; diff --git a/DiabloUI/selyesno.cpp b/DiabloUI/selyesno.cpp index 81b1fcc8c..ef013bec5 100644 --- a/DiabloUI/selyesno.cpp +++ b/DiabloUI/selyesno.cpp @@ -29,7 +29,7 @@ LRESULT __stdcall SelYesNo_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } if (Msg > 0x103) { if (Msg <= 0x105) { - v11 = (HWND)SDrawGetFrameWindow(); + v11 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v11, Msg, wParam, lParam); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } diff --git a/DiabloUI/title.cpp b/DiabloUI/title.cpp index 2eea1851d..ee8e59c70 100644 --- a/DiabloUI/title.cpp +++ b/DiabloUI/title.cpp @@ -170,7 +170,7 @@ BOOL __stdcall UiTitleDialog(int a1) int v1; // eax artfont_LoadAllFonts(); - v1 = (int)SDrawGetFrameWindow(); + v1 = (int)SDrawGetFrameWindow(NULL); SDlgDialogBoxParam(ghUiInst, "TITLESCREEN_DIALOG", v1, Title_MainProc, a1); return 1; } @@ -189,7 +189,7 @@ LRESULT __stdcall Title_MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (uMsg != 256) { if (uMsg > 0x103) { if (uMsg <= 0x105) { - v5 = (HWND)SDrawGetFrameWindow(); + v5 = (HWND)SDrawGetFrameWindow(NULL); SendMessageA(v5, uMsg, wParam, lParam); } else if (uMsg == 272) { Title_LoadAllTitleImgs(hWnd, lParam); diff --git a/Source/appfat.cpp b/Source/appfat.cpp index bdcf91457..f726c24a5 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -3,20 +3,12 @@ #include "../types.h" // +Infinity after initialization of appfat.cpp. -float appfat_cpp_init_value; +static float appfat_cpp_init_value = INFINITY; char sz_error_buf[256]; int terminating; // weak int cleanup_thread_id; // weak -// appfat_cpp_init initializes the C++ runtime of appfat.cpp. -struct appfat_cpp_init { - appfat_cpp_init() - { - appfat_cpp_init_value = INFINITY; - } -} appfat_cpp_init; - // delete overloads the delete operator. void operator delete(void *ptr) { diff --git a/Source/control.cpp b/Source/control.cpp index 5622f1194..a3b41b24a 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -581,11 +581,12 @@ void __fastcall SetSpeedSpell(int slot) void __fastcall ToggleSpell(int slot) { + unsigned __int64 spells; + if (plr[myplr]._pSplHotKey[slot] == -1) { return; } - unsigned __int64 spells; switch (plr[myplr]._pSplTHotKey[slot]) { case RSPLTYPE_SKILL: spells = plr[myplr]._pAblSpells; @@ -1088,14 +1089,15 @@ void __cdecl DrawCtrlPan() void __cdecl DoSpeedBook() { unsigned __int64 spells, spell; + int xo, yo, X, Y, i, j; spselflag = 1; - int xo = 636; - int yo = 495; - int X = 600; - int Y = 307; + xo = 636; + yo = 495; + X = 600; + Y = 307; if (plr[myplr]._pRSpell != -1) { - for (int i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { switch (i) { case RSPLTYPE_SKILL: spells = plr[myplr]._pAblSpells; @@ -1111,7 +1113,7 @@ void __cdecl DoSpeedBook() break; } spell = (__int64)1; - for (int j = 1; j < MAX_SPELLS; j++) { + for (j = 1; j < MAX_SPELLS; j++) { if (spell & spells) { if (j == plr[myplr]._pRSpell && i == plr[myplr]._pRSplType) { X = xo - 36; diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 1e673a87c..b9aa4fb0c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -2,7 +2,7 @@ #include "../types.h" -int diablo_cpp_init_value; // weak +static float diablo_cpp_init_value = INFINITY; HWND ghMainWnd; int glMid1Seed[NUMLEVELS]; int glMid2Seed[NUMLEVELS]; @@ -35,8 +35,6 @@ int sgnTimeoutCurs; char sgbMouseDown; // weak int color_cycle_timer; // weak -int diablo_inf = 0x7F800000; // weak - /* rdata */ BOOL fullscreen = TRUE; @@ -67,15 +65,6 @@ char *spszMsgTbl[4] = { }; // weak char *spszMsgKeyTbl[4] = { "F9", "F10", "F11", "F12" }; // weak -struct diablo_cpp_init { - diablo_cpp_init() - { - diablo_cpp_init_value = diablo_inf; - } -} _diablo_cpp_init; -// 479BF8: using guessed type int diablo_inf; -// 525514: using guessed type int diablo_cpp_init_value; - void __cdecl FreeGameMem() { void *p; @@ -269,6 +258,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi HINSTANCE hInst; int nData; char szFileName[MAX_PATH]; + BOOL bNoEvent; hInst = hInstance; #ifndef DEBUGGER @@ -289,7 +279,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi InitHash(); exception_get_filter(); - BOOL bNoEvent = diablo_get_not_running(); + bNoEvent = diablo_get_not_running(); if (!diablo_find_window("DIABLO") && bNoEvent) { #ifdef _DEBUG SFileEnableDirectAccess(TRUE); diff --git a/Source/diablo.h b/Source/diablo.h index 274c3e3ac..4e3acd0c6 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -2,7 +2,6 @@ #ifndef __DIABLO_H__ #define __DIABLO_H__ -extern int diablo_cpp_init_value; // weak extern HWND ghMainWnd; extern int glMid1Seed[NUMLEVELS]; extern int glMid2Seed[NUMLEVELS]; diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 3bcdff8f1..50beace72 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -209,10 +209,13 @@ void __fastcall LoadL1Dungeon(char *sFileName, int vx, int vy) void __cdecl DRLG_L1Floor() { - for (int j = 0; j < DMAXY; j++) { - for (int i = 0; i < DMAXX; i++) { + int i, j; + long rv; + + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { if (mydflags[i][j] == 0 && dungeon[i][j] == 13) { - long rv = random(0, 3); + rv = random(0, 3); if (rv == 1) dungeon[i][j] = 162; @@ -669,9 +672,10 @@ void __fastcall DRLG_PlaceDoor(int x, int y) void __cdecl DRLG_L1Shadows() { - int x, y; + int x, y, i; unsigned char sd[2][2]; unsigned char tnv3; + BOOL patflag; for (y = 1; y < DMAXY; y++) { for (x = 1; x < DMAXX; x++) { @@ -680,9 +684,9 @@ void __cdecl DRLG_L1Shadows() sd[0][1] = BSTYPES[(unsigned char)dungeon[x][y - 1]]; sd[1][1] = BSTYPES[(unsigned char)dungeon[x - 1][y - 1]]; - for (int i = 0; i < 37; i++) { + for (i = 0; i < 37; i++) { if (SPATS[i].strig == sd[0][0]) { - BOOL patflag = TRUE; + patflag = TRUE; if (SPATS[i].s1 && SPATS[i].s1 != sd[1][1]) patflag = FALSE; if (SPATS[i].s2 && SPATS[i].s2 != sd[0][1]) @@ -761,8 +765,9 @@ void __cdecl DRLG_L1Shadows() int __fastcall DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int noquad, int ldir) { int xx, yy, sx, sy; - int ii; + int ii, i, t, found; int numt; + BOOL abort; int sw = miniset[0]; int sh = miniset[1]; @@ -772,11 +777,11 @@ int __fastcall DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tma else numt = random(0, tmax - tmin) + tmin; - for (int i = 0; i < numt; i++) { + for (i = 0; i < numt; i++) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); - BOOL abort = FALSE; - int found = 0; + abort = FALSE; + found = 0; while (abort == FALSE) { abort = TRUE; @@ -806,8 +811,6 @@ int __fastcall DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tma if (sx > cx && sy > cy) abort = FALSE; break; - default: - break; } ii = 2; @@ -845,7 +848,7 @@ int __fastcall DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tma } if (miniset == PWATERIN) { - int t = TransVal; + t = TransVal; TransVal = 0; DRLG_MRectTrans(sx, sy + 2, sx + 5, sy + 4); TransVal = t; @@ -879,8 +882,10 @@ int __fastcall DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tma void __cdecl InitL5Dungeon() { - for (int j = 0; j < DMAXY; j++) { - for (int i = 0; i < DMAXX; i++) { + int i, j; + + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { dungeon[i][j] = 0; mydflags[i][j] = 0; } @@ -889,8 +894,10 @@ void __cdecl InitL5Dungeon() void __cdecl L5ClearFlags() { - for (int j = 0; j < DMAXY; j++) { - for (int i = 0; i < DMAXX; i++) { + int i, j; + + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { mydflags[i][j] &= 0xBF; } } @@ -898,9 +905,12 @@ void __cdecl L5ClearFlags() void __cdecl L5firstRoom() { + int ys, ye, y; + int xs, xe, x; + if (random(0, 2) == 0) { - int ys = 1; - int ye = 39; + ys = 1; + ye = 39; VR1 = random(0, 2); VR2 = random(0, 2); @@ -920,7 +930,7 @@ void __cdecl L5firstRoom() else ye = 22; - for (int y = ys; y < ye; y++) { + for (y = ys; y < ye; y++) { dungeon[17][y] = 1; dungeon[18][y] = 1; dungeon[19][y] = 1; @@ -940,8 +950,8 @@ void __cdecl L5firstRoom() HR2 = 0; HR1 = 0; } else { - int xs = 1; - int xe = 39; + xs = 1; + xe = 39; HR1 = random(0, 2); HR2 = random(0, 2); @@ -961,7 +971,7 @@ void __cdecl L5firstRoom() else xe = 22; - for (int x = xs; x < xe; x++) { + for (x = xs; x < xe; x++) { dungeon[x][17] = 1; dungeon[x][18] = 1; dungeon[x][19] = 1; @@ -985,8 +995,10 @@ void __cdecl L5firstRoom() void __fastcall L5drawRoom(int x, int y, int w, int h) { - for (int j = 0; j < h; j++) { - for (int i = 0; i < w; i++) { + int i, j; + + for (j = 0; j < h; j++) { + for (i = 0; i < w; i++) { dungeon[x + i][y + j] = 1; } } @@ -994,12 +1006,12 @@ void __fastcall L5drawRoom(int x, int y, int w, int h) void __fastcall L5roomGen(int x, int y, int w, int h, int dir) { - int num; + int num, dirProb; BOOL ran, ran2; int width, height, rx, ry, ry2; int cw, ch, cx1, cy1, cx2; - int dirProb = random(0, 4); + dirProb = random(0, 4); switch (dir == 1 ? dirProb != 0 : dirProb == 0) { case FALSE: @@ -1051,8 +1063,10 @@ void __fastcall L5roomGen(int x, int y, int w, int h, int dir) BOOL __fastcall L5checkRoom(int x, int y, int width, int height) { - for (int j = 0; j < height; j++) { - for (int i = 0; i < width; i++) { + int i, j; + + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { if (i + x < 0 || i + x >= DMAXX || j + y < 0 || j + y >= DMAXY) return FALSE; if (dungeon[i + x][j + y]) @@ -1065,10 +1079,13 @@ BOOL __fastcall L5checkRoom(int x, int y, int width, int height) int __cdecl L5GetArea() { - int rv = 0; + int i, j; + int rv; - for (int j = 0; j < DMAXY; j++) { - for (int i = 0; i < DMAXX; i++) { + rv = 0; + + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { if (dungeon[i][j] == 1) rv++; } @@ -1127,36 +1144,38 @@ void __cdecl L5makeDmt() void __cdecl L5AddWall() { - for (int j = 0; j < DMAXY; j++) { - for (int i = 0; i < DMAXX; i++) { + int i, j, x, y; + + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { if (!mydflags[i][j]) { if (dungeon[i][j] == 3 && random(0, 100) < 100) { - int x = L5HWallOk(i, j); + x = L5HWallOk(i, j); if (x != -1) L5HorizWall(i, j, 2, x); } if (dungeon[i][j] == 3 && random(0, 100) < 100) { - int y = L5VWallOk(i, j); + y = L5VWallOk(i, j); if (y != -1) L5VertWall(i, j, 1, y); } if (dungeon[i][j] == 6 && random(0, 100) < 100) { - int x = L5HWallOk(i, j); + x = L5HWallOk(i, j); if (x != -1) L5HorizWall(i, j, 4, x); } if (dungeon[i][j] == 7 && random(0, 100) < 100) { - int y = L5VWallOk(i, j); + y = L5VWallOk(i, j); if (y != -1) L5VertWall(i, j, 4, y); } if (dungeon[i][j] == 2 && random(0, 100) < 100) { - int x = L5HWallOk(i, j); + x = L5HWallOk(i, j); if (x != -1) L5HorizWall(i, j, 2, x); } if (dungeon[i][j] == 1 && random(0, 100) < 100) { - int y = L5VWallOk(i, j); + y = L5VWallOk(i, j); if (y != -1) L5VertWall(i, j, 1, y); } @@ -1168,13 +1187,14 @@ void __cdecl L5AddWall() int __fastcall L5HWallOk(int i, int j) { int x; + BOOL wallok; for (x = 1; dungeon[i + x][j] == 13; x++) { if (dungeon[i + x][j - 1] != 13 || dungeon[i + x][j + 1] != 13 || mydflags[i + x][j]) break; } - BOOL wallok = FALSE; + wallok = FALSE; if ((unsigned char)dungeon[i + x][j] >= 3 && (unsigned char)dungeon[i + x][j] <= 7) /* todo: unsigned */ wallok = TRUE; if ((unsigned char)dungeon[i + x][j] >= 16 && (unsigned char)dungeon[i + x][j] <= 24) @@ -1193,13 +1213,14 @@ int __fastcall L5HWallOk(int i, int j) int __fastcall L5VWallOk(int i, int j) { int y; + BOOL wallok; for (y = 1; dungeon[i][j + y] == 13; y++) { if (dungeon[i - 1][j + y] != 13 || dungeon[i + 1][j + y] != 13 || mydflags[i][j + y]) break; } - BOOL wallok = FALSE; + wallok = FALSE; if ((unsigned char)dungeon[i][j + y] >= 3 && (unsigned char)dungeon[i][j + y] <= 7) /* todo: unsigned */ wallok = TRUE; if ((unsigned char)dungeon[i][j + y] >= 16 && (unsigned char)dungeon[i][j + y] <= 24) @@ -1427,14 +1448,16 @@ void __cdecl L5tileFix() void __cdecl DRLG_L5Subs() { - for (int y = 0; y < DMAXY; y++) { - for (int x = 0; x < DMAXX; x++) { + int x, y, rv, i; + + for (y = 0; y < DMAXY; y++) { + for (x = 0; x < DMAXX; x++) { if (!random(0, 4)) { unsigned char c = L5BTYPES[(unsigned char)dungeon[x][y]]; /* todo: changed to unsigned */ if (c && !mydflags[x][y]) { - int rv = random(0, 16); - int i = -1; + rv = random(0, 16); + i = -1; while (rv >= 0) { if (++i == sizeof(L5BTYPES)) @@ -1673,18 +1696,21 @@ void __fastcall DRLG_L5GHall(int x1, int y1, int x2, int y2) void __fastcall DRLG_L5SetRoom(int rx1, int ry1) { - int rw = *(unsigned char *)pSetPiece; /* todo: BYTE */ - int rh = *((unsigned char *)pSetPiece + 2); + int rw, rh, i, j; + unsigned char *sp; + + rw = *(unsigned char *)pSetPiece; /* todo: BYTE */ + rh = *((unsigned char *)pSetPiece + 2); setpc_x = rx1; setpc_y = ry1; setpc_w = rw; setpc_h = rh; - unsigned char *sp = (unsigned char *)pSetPiece + 4; + sp = (unsigned char *)pSetPiece + 4; - for (int j = 0; j < rh; j++) { - for (int i = 0; i < rw; i++) { + for (j = 0; j < rh; j++) { + for (i = 0; i < rw; i++) { if (*sp) { dungeon[rx1 + i][ry1 + j] = *sp; mydflags[rx1 + i][ry1 + j] |= 0x80; @@ -1700,12 +1726,14 @@ void __fastcall DRLG_L5SetRoom(int rx1, int ry1) void __cdecl DRLG_L5FloodTVal() { - int yy = 16; + int xx, yy, i, j; + + yy = 16; - for (int j = 0; j < DMAXY; j++) { - int xx = 16; + for (j = 0; j < DMAXY; j++) { + xx = 16; - for (int i = 0; i < DMAXX; i++) { + for (i = 0; i < DMAXX; i++) { if (dungeon[i][j] == 13 && !dung_map[xx][yy]) { DRLG_L5FTVR(i, j, xx, yy, 0); TransVal++; @@ -1763,12 +1791,14 @@ void __fastcall DRLG_L5FTVR(int i, int j, int x, int y, int d) void __cdecl DRLG_L5TransFix() { - int yy = 16; + int xx, yy, i, j; - for (int j = 0; j < DMAXY; j++) { - int xx = 16; + yy = 16; - for (int i = 0; i < DMAXX; i++) { + for (j = 0; j < DMAXY; j++) { + xx = 16; + + for (i = 0; i < DMAXX; i++) { if (dungeon[i][j] == 23 && dungeon[i][j - 1] == 18) { dung_map[xx + 1][yy] = dung_map[xx][yy]; dung_map[xx + 1][yy + 1] = dung_map[xx][yy]; @@ -1798,8 +1828,10 @@ void __cdecl DRLG_L5TransFix() void __cdecl DRLG_L5DirtFix() { - for (int j = 0; j < DMAXY; j++) { - for (int i = 0; i < DMAXX; i++) { + int i, j; + + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { if (dungeon[i][j] == 21 && dungeon[i + 1][j] != 19) dungeon[i][j] = 202; if (dungeon[i][j] == 19 && dungeon[i + 1][j] != 19) diff --git a/Source/dthread.cpp b/Source/dthread.cpp index 54eb240e0..4dce1d1e4 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -2,27 +2,16 @@ #include "../types.h" -int dthread_cpp_init_value; // weak +static float dthread_cpp_init_value = INFINITY; static CRITICAL_SECTION sgMemCrit; // idb unsigned int glpDThreadId; // idb TMegaPkt *sgpInfoHead; /* may not be right struct */ char byte_52A508; // weak HANDLE sghWorkToDoEvent; // idb -int dthread_inf = 0x7F800000; // weak - /* rdata */ static HANDLE sghThread = (HANDLE)0xFFFFFFFF; // idb -struct dthread_cpp_init_1 { - dthread_cpp_init_1() - { - dthread_cpp_init_value = dthread_inf; - } -} _dthread_cpp_init_1; -// 47A460: using guessed type int dthread_inf; -// 52A4E0: using guessed type int dthread_cpp_init_value; - struct dthread_cpp_init_2 { dthread_cpp_init_2() { diff --git a/Source/dthread.h b/Source/dthread.h index 371164692..2a4781ffd 100644 --- a/Source/dthread.h +++ b/Source/dthread.h @@ -2,11 +2,10 @@ #ifndef __DTHREAD_H__ #define __DTHREAD_H__ -extern int dthread_cpp_init_value; // weak -extern unsigned int glpDThreadId; // idb -extern TMegaPkt *sgpInfoHead; /* may not be right struct */ -extern char byte_52A508; // weak -extern HANDLE sghWorkToDoEvent; // idb +extern unsigned int glpDThreadId; // idb +extern TMegaPkt *sgpInfoHead; /* may not be right struct */ +extern char byte_52A508; // weak +extern HANDLE sghWorkToDoEvent; // idb void __cdecl dthread_cpp_init_1(); void __cdecl dthread_cpp_init_2(); diff --git a/Source/dx.cpp b/Source/dx.cpp index 882b50b95..cedd5f60f 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -3,7 +3,7 @@ #include "../types.h" Screen *sgpBackBuf; -int dx_cpp_init_value; // weak +static float dx_cpp_init_value = INFINITY; LPDIRECTDRAW lpDDInterface; IDirectDrawPalette *lpDDPalette; // idb int sgdwLockCount; @@ -18,17 +18,6 @@ char gbBackBuf; // weak char gbEmulate; // weak HMODULE ghDiabMod; // idb -int dx_inf = 0x7F800000; // weak - -struct dx_cpp_init_1 { - dx_cpp_init_1() - { - dx_cpp_init_value = dx_inf; - } -} _dx_cpp_init_1; -// 47A464: using guessed type int dx_inf; -// 52A514: using guessed type int dx_cpp_init_value; - struct dx_cpp_init_2 { dx_cpp_init_2() { @@ -99,11 +88,13 @@ void __fastcall dx_init(HWND hWnd) void __cdecl dx_create_back_buffer() { DDSCAPS caps; - HRESULT error_code = lpDDSPrimary->GetCaps(&caps); + HRESULT error_code; + DDSURFACEDESC ddsd; + + error_code = lpDDSPrimary->GetCaps(&caps); if (error_code != DD_OK) DDErrMsg(error_code, 59, "C:\\Src\\Diablo\\Source\\dx.cpp"); - DDSURFACEDESC ddsd; if (gbBackBuf == NULL) { ddsd.dwSize = sizeof(ddsd); error_code = lpDDSPrimary->Lock(NULL, &ddsd, DDLOCK_WRITEONLY | DDLOCK_WAIT, NULL); @@ -136,11 +127,13 @@ void __cdecl dx_create_back_buffer() void __cdecl dx_create_primary_surface() { DDSURFACEDESC ddsd; + HRESULT error_code; + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - HRESULT error_code = lpDDInterface->CreateSurface(&ddsd, &lpDDSPrimary, NULL); + error_code = lpDDInterface->CreateSurface(&ddsd, &lpDDSPrimary, NULL); if (error_code != DD_OK) ErrDlg(IDD_DIALOG1, error_code, "C:\\Src\\Diablo\\Source\\dx.cpp", 109); } @@ -173,6 +166,9 @@ void __fastcall j_lock_buf_priv(BYTE idx) void __cdecl lock_buf_priv() { + DDSURFACEDESC ddsd; + HRESULT error_code; + EnterCriticalSection(&sgMemCrit); if (sgpBackBuf != NULL) { gpBuffer = sgpBackBuf; @@ -191,9 +187,8 @@ void __cdecl lock_buf_priv() sgdwLockCount++; return; } - DDSURFACEDESC ddsd; ddsd.dwSize = sizeof(ddsd); - HRESULT error_code = lpDDSBackBuf->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL); + error_code = lpDDSBackBuf->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL); if (error_code != DD_OK) DDErrMsg(error_code, 235, "C:\\Src\\Diablo\\Source\\dx.cpp"); @@ -214,6 +209,8 @@ void __fastcall j_unlock_buf_priv(BYTE idx) void __cdecl unlock_buf_priv() { + HRESULT error_code; + if (sgdwLockCount == 0) TermMsg("draw main unlock error"); if (!gpBuffer) @@ -224,7 +221,7 @@ void __cdecl unlock_buf_priv() gpBufEnd -= (int)gpBuffer; gpBuffer = NULL; if (sgpBackBuf == NULL) { - HRESULT error_code = lpDDSBackBuf->Unlock(NULL); + error_code = lpDDSBackBuf->Unlock(NULL); if (error_code != DD_OK) DDErrMsg(error_code, 273, "C:\\Src\\Diablo\\Source\\dx.cpp"); } @@ -267,9 +264,11 @@ void __cdecl dx_cleanup() void __cdecl dx_reinit() { + int lockCount; + EnterCriticalSection(&sgMemCrit); ClearCursor(); - int lockCount = sgdwLockCount; + lockCount = sgdwLockCount; while (sgdwLockCount != 0) unlock_buf_priv(); diff --git a/Source/dx.h b/Source/dx.h index bd19ceb6b..495d19c38 100644 --- a/Source/dx.h +++ b/Source/dx.h @@ -3,7 +3,6 @@ #define __DX_H__ extern Screen *sgpBackBuf; -extern int dx_cpp_init_value; // weak extern IDirectDraw *lpDDInterface; extern IDirectDrawPalette *lpDDPalette; // idb extern int sgdwLockCount;