From c5c7bb8a44e636728fe1ffeee2515a12f6c4ad7c Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sun, 2 Jun 2019 21:15:50 +0300 Subject: [PATCH 01/54] Clean up FindPath. --- Source/path.cpp | 63 +++++++++++++++---------------------------------- 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/Source/path.cpp b/Source/path.cpp index e6b93dbe..5da77cb2 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -40,36 +40,23 @@ char path_directions[9] = { 5, 1, 6, 2, 0, 3, 8, 4, 7 }; */ int FindPath(BOOL(*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, int dy, char *path) { - PATHNODE *path_start; // esi - char initial_h; // al - PATHNODE *next_node; // eax - int result; // eax - PATHNODE *current; // edx - PATHNODE **previous; // eax - int path_length; // edi - BOOLEAN path_is_full; // zf - int *step_ptr; // ecx - char step; // dl + PATHNODE *path_start, *next_node, *current; + int path_length, i; // clear all nodes, create root nodes for the visited/frontier linked lists gdwCurNodes = 0; path_2_nodes = path_new_step(); - gdwCurPathStep = 0; pnode_ptr = path_new_step(); + gdwCurPathStep = 0; path_start = path_new_step(); path_start->g = 0; - initial_h = path_get_h_cost(sx, sy, dx, dy); - path_start->h = initial_h; + path_start->h = path_get_h_cost(sx, sy, dx, dy); path_start->x = sx; - path_start->f = initial_h + path_start->g; + path_start->f = path_start->h + path_start->g; path_start->y = sy; path_2_nodes->NextNode = path_start; // A* search until we find (dx,dy) or fail - while (TRUE) { - next_node = GetNextPath(); - // frontier is empty, no path! - if (!next_node) - return 0; + while ((next_node = GetNextPath())) { // reached the end, success! if (next_node->x == dx && next_node->y == dy) break; @@ -77,35 +64,23 @@ int FindPath(BOOL(*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, if (!path_get_path(PosOk, PosOkArg, next_node, dx, dy)) return 0; } + // frontier is empty, no path! + if (!next_node) + return 0; current = next_node; - previous = &next_node->Parent; path_length = 0; - if (*previous) { - while (TRUE) { - path_is_full = path_length == 25; - if (path_length >= 25) - break; - pnode_vals[++path_length - 1] = path_directions[3 * (current->y - (*previous)->y) - (*previous)->x + 4 + current->x]; - current = *previous; - previous = &(*previous)->Parent; - if (!*previous) { - path_is_full = path_length == 25; - break; - } - } - if (path_is_full) - return 0; + while (current->Parent) { + if (path_length >= 25) + break; + pnode_vals[path_length++] = path_directions[3 * (current->y - current->Parent->y) - current->Parent->x + 4 + current->x]; + current = current->Parent; } - result = 0; - if (path_length > 0) { - step_ptr = &pnode_vals[path_length - 1]; - do { - step = *(_BYTE *)step_ptr; - --step_ptr; - path[result++] = step; - } while (result < path_length); + if (path_length != 25) { + for (i = 0; i < path_length; i++) + path[i] = pnode_vals[path_length - i - 1]; + return i; } - return result; + return 0; } /* heuristic, estimated cost from (sx,sy) to (dx,dy) */ From 74da7a9e7e7ef4e9bc1e6ec9b0709bf2ed663a8e Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sun, 2 Jun 2019 23:12:16 +0300 Subject: [PATCH 02/54] Clean up path_next_node. --- Source/path.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/path.cpp b/Source/path.cpp index 5da77cb2..d3134a2e 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -273,21 +273,23 @@ PATHNODE *path_get_node2(int dx, int dy) * distance) */ void path_next_node(PATHNODE *pPath) { - PATHNODE *current; // edx - PATHNODE *next; // eax + PATHNODE *next, *current; + int f; - current = path_2_nodes; - next = path_2_nodes->NextNode; - if (next != NULL) { - do { - if (next->f >= pPath->f) - break; + next = path_2_nodes; + if (path_2_nodes->NextNode) { + current = path_2_nodes; + next = path_2_nodes->NextNode; + f = pPath->f; + while (next && next->f < f) { current = next; next = next->NextNode; - } while (next != NULL); + } pPath->NextNode = next; + current->NextNode = pPath; + } else { + path_2_nodes->NextNode = pPath; } - current->NextNode = pPath; } /* update all path costs using depth-first search starting at pPath */ From 11b6b1f8600329ac28ecd5cdc584135c7261d9aa Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 2 Jun 2019 18:37:20 +0200 Subject: [PATCH 03/54] Remove more garbage --- DiabloUI/_temp_data.cpp | 2 +- DiabloUI/_temp_funcs.h | 88 +++---- DiabloUI/bn_prof.cpp | 254 ++++++++++----------- DiabloUI/bnetgw.cpp | 92 ++++---- DiabloUI/connect.cpp | 52 ++--- DiabloUI/copyprot.cpp | 4 +- DiabloUI/cr8game.cpp | 10 +- DiabloUI/creadung.cpp | 16 +- DiabloUI/credits.cpp | 14 +- DiabloUI/diabedit.cpp | 8 +- DiabloUI/diabloui.h | 2 +- DiabloUI/dirlink.cpp | 32 +-- DiabloUI/disclaim.cpp | 6 +- DiabloUI/doom.cpp | 28 +-- DiabloUI/entdial.cpp | 10 +- DiabloUI/entname.cpp | 2 +- DiabloUI/fade.cpp | 2 +- DiabloUI/focus.cpp | 14 +- DiabloUI/local.cpp | 20 +- DiabloUI/mainmenu.cpp | 4 +- DiabloUI/modem.cpp | 32 +-- DiabloUI/modmstat.cpp | 18 +- DiabloUI/okcancel.cpp | 4 +- DiabloUI/progress.cpp | 32 +-- DiabloUI/sbar.cpp | 58 ++--- DiabloUI/selclass.cpp | 6 +- DiabloUI/selconn.cpp | 112 ++++----- DiabloUI/seldial.cpp | 14 +- DiabloUI/selgame.cpp | 10 +- DiabloUI/selhero.cpp | 6 +- DiabloUI/selipx.cpp | 158 ++++++------- DiabloUI/sellist.cpp | 10 +- DiabloUI/selload.cpp | 6 +- DiabloUI/selmodem.cpp | 96 ++++---- DiabloUI/selregn.cpp | 86 +++---- DiabloUI/selyesno.cpp | 8 +- DiabloUI/title.cpp | 32 +-- Source/debug.cpp | 2 +- Source/dthread.cpp | 6 +- Source/missiles.cpp | 2 +- Source/mpqapi.cpp | 2 +- Source/multi.cpp | 8 +- Source/render.cpp | 492 ++++++++++++++++++++-------------------- defs.h | 16 +- 44 files changed, 932 insertions(+), 944 deletions(-) diff --git a/DiabloUI/_temp_data.cpp b/DiabloUI/_temp_data.cpp index 69ef3e82..493fb0a5 100644 --- a/DiabloUI/_temp_data.cpp +++ b/DiabloUI/_temp_data.cpp @@ -136,7 +136,7 @@ HGDIOBJ dword_10029420; // idb HGDIOBJ dword_10029424; // idb BYTE *dword_10029428; // idb void *dword_1002942C; // idb -int(__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); // weak +int(__stdcall *dword_10029430)(DWORD, DWORD, DWORD, DWORD); // weak void *dword_10029434; // idb int dword_10029438[4]; // weak char nullcharacter; /* check */ diff --git a/DiabloUI/_temp_funcs.h b/DiabloUI/_temp_funcs.h index 4afc93d1..a7c7a62a 100644 --- a/DiabloUI/_temp_funcs.h +++ b/DiabloUI/_temp_funcs.h @@ -15,56 +15,56 @@ void __fastcall artfont_PrintFontStr(char *str, DWORD **pSurface, int sx, int sy signed int bn_prof_100014E8(); //const char *UiProfileGetString(); -//BOOL __stdcall UiProfileCallback(int a1, int a2, int a3, int a4, LPARAM a5, int a6, int a7, int a8, int (__stdcall *a9)(_DWORD, _DWORD, _DWORD, _DWORD)); +//BOOL __stdcall UiProfileCallback(int a1, int a2, int a3, int a4, LPARAM a5, int a6, int a7, int a8, int (__stdcall *a9)(DWORD, DWORD, DWORD, DWORD)); HGDIOBJ __stdcall bn_prof_1000155F(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); void UNKCALL bn_prof_100016DD(HWND arg); void __fastcall bn_prof_100018CE(int a1, int a2); -int __fastcall bn_prof_10001938(HDC a1, _DWORD *a2, char *a3, int a4, int a5); +int __fastcall bn_prof_10001938(HDC a1, DWORD *a2, char *a3, int a4, int a5); int __fastcall bn_prof_10001A10(HWND a1, HWND a2); HINSTANCE __fastcall bn_prof_10001B0A(HWND a1, const CHAR *a2); HWND UNKCALL bn_prof_10001C0E(HWND hWnd); -void __fastcall bn_prof_10001CB9(_DWORD *a1, int a2, void(__fastcall *a3)(_BYTE *, _DWORD, int), int a4); +void __fastcall bn_prof_10001CB9(DWORD *a1, int a2, void(__fastcall *a3)(BYTE *, DWORD, int), int a4); BOOL UNKCALL bn_prof_10001CF3(HWND hWnd); HFONT __fastcall bn_prof_10001D81(HWND hWnd, int a2, int a3); void UNKCALL bn_prof_10001E34(void *arg); void __fastcall bn_prof_10001E4C(char *a1, LPARAM lParam, HWND hDlg); -void __fastcall bn_prof_10001ED0(char *a1, _BYTE *a2, int a3); +void __fastcall bn_prof_10001ED0(char *a1, BYTE *a2, int a3); void *bn_prof_10001F29(); BYTE *bn_prof_10001F84(); //int __stdcall UiProfileDraw(int, int, int, int, HGDIOBJ ho, int, int, int, int, int, int); // idb BOOL bn_prof_100021C4(); void *bn_prof_10002247(); int j_bn_prof_10002282(); -_DWORD *bn_prof_10002282(); +DWORD *bn_prof_10002282(); void __cdecl bn_prof_10002298(); // idb int UNKCALL bn_prof_100022A2(HWND hWnd); // idb int UNKCALL bn_prof_10002353(HGDIOBJ h); // idb HGDIOBJ bn_prof_100023D8(); -_DWORD *__fastcall bn_prof_10002410(HDC hdc, _DWORD *a2); -signed int __fastcall bn_prof_10002456(int a1, const CHAR *a2, char a3, _DWORD *a4); +DWORD *__fastcall bn_prof_10002410(HDC hdc, DWORD *a2); +signed int __fastcall bn_prof_10002456(int a1, const CHAR *a2, char a3, DWORD *a4); signed int bn_prof_100026B9(); -signed int UNKCALL bn_prof_100026C4(_DWORD *arg); -void UNKCALL bn_prof_100026F0(_DWORD *arg); -int UNKCALL bn_prof_10002749(_DWORD *arg, _DWORD *location); -_DWORD *UNKCALL bn_prof_10002782(int *arg, int a2, int a3, char a4); -_DWORD *UNKCALL bn_prof_100027CE(_DWORD *arg); -void UNKCALL bn_prof_100027D8(_DWORD *arg); -_DWORD *UNKCALL bn_prof_1000280C(int *arg, _DWORD *a2, int a3, _DWORD *a4); -void UNKCALL bn_prof_1000287D(_DWORD *arg); -void UNKCALL bn_prof_10002890(_DWORD *arg); +signed int UNKCALL bn_prof_100026C4(DWORD *arg); +void UNKCALL bn_prof_100026F0(DWORD *arg); +int UNKCALL bn_prof_10002749(DWORD *arg, DWORD *location); +DWORD *UNKCALL bn_prof_10002782(int *arg, int a2, int a3, char a4); +DWORD *UNKCALL bn_prof_100027CE(DWORD *arg); +void UNKCALL bn_prof_100027D8(DWORD *arg); +DWORD *UNKCALL bn_prof_1000280C(int *arg, DWORD *a2, int a3, DWORD *a4); +void UNKCALL bn_prof_1000287D(DWORD *arg); +void UNKCALL bn_prof_10002890(DWORD *arg); -void UNKCALL BNetGW_100028C2(_DWORD *arg); -void UNKCALL BNetGW_100029BF(_DWORD *arg, int a2); -void *UNKCALL BNetGW_10002A07(_DWORD *arg); -_DWORD *UNKCALL BNetGW_10002A84(_DWORD *arg, signed int a2); +void UNKCALL BNetGW_100028C2(DWORD *arg); +void UNKCALL BNetGW_100029BF(DWORD *arg, int a2); +void *UNKCALL BNetGW_10002A07(DWORD *arg); +DWORD *UNKCALL BNetGW_10002A84(DWORD *arg, signed int a2); signed int BNetGW_10002AE5(); -int UNKCALL BNetGW_10002AF0(_DWORD *arg, char *a2); -_BYTE *UNKCALL BNetGW_10002B21(_DWORD *arg, signed int a2); -void UNKCALL BNetGW_10002B51(_DWORD *arg, signed int a2); +int UNKCALL BNetGW_10002AF0(DWORD *arg, char *a2); +BYTE *UNKCALL BNetGW_10002B21(DWORD *arg, signed int a2); +void UNKCALL BNetGW_10002B51(DWORD *arg, signed int a2); char *UNKCALL BNetGW_10002B78(void *arg, char *a2); -char *UNKCALL BNetGW_10002C23(_DWORD *arg); -int UNKCALL BNetGW_10002C51(_DWORD *arg); -int UNKCALL BNetGW_10002DBF(_DWORD *arg); +char *UNKCALL BNetGW_10002C23(DWORD *arg); +int UNKCALL BNetGW_10002C51(DWORD *arg); +int UNKCALL BNetGW_10002DBF(DWORD *arg); char *__stdcall BNetGW_10002DEB(char *a1, unsigned int a2); char *__stdcall BNetGW_10002E0B(char *a1, unsigned int a2); @@ -77,7 +77,7 @@ BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, BOOL __stdcall UiSoundCallback(int a1, int type, int a3); BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPSTR lpBuffer, int cchBufferMax); BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8); -BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, _DWORD *a6, _DWORD *a7); +BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7); int __fastcall Connect_GetRankFromLevel(char *str); BOOL __fastcall Connect_DiffFromString(char *str, _gamedata *gamedata, int a3, int a4); void __fastcall Connect_SetDiffString(_gamedata *gamedata, const char *str1, char *str2, char *str3, int size); @@ -165,7 +165,7 @@ void __cdecl j_DiabloUI_cpp_init(); void __cdecl DiabloUI_cpp_init(); signed int DirLink_10005CFA(); -BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid); +BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, DWORD *a4, int a5, int playerid); int __stdcall DirLink_10005D63(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); int __fastcall DirLink_10005EB2(HWND hDlg, int a2); int UNKCALL DirLink_10005F1F(HWND hDlg); // idb @@ -301,7 +301,7 @@ signed int Modem_10008648(); int Modem_10008653(); int Modem_10008659(); int UNKCALL Modem_1000865F(char *); // idb -BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid); +BOOL __fastcall Modem_10008680(int a1, int a2, int a3, DWORD *a4, int a5, int playerid); int __stdcall Modem_100086DE(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb void **UNKCALL Modem_1000879E(HWND hDlg); BOOL UNKCALL Modem_100087DB(HWND hWnd); @@ -367,7 +367,7 @@ HWND __fastcall SelConn_1000A226(HWND hDlg, int nIDDlgItem); HWND UNKCALL SelConn_1000A3E2(HWND hDlg); int SelConn_1000A3FF(); void UNKCALL SelConn_1000A43A(HWND hDlg); -BOOL __fastcall SelConn_1000A4B9(_DWORD *a1); +BOOL __fastcall SelConn_1000A4B9(DWORD *a1); BOOL UNKCALL SelConn_1000A4CD(void *location); HWND UNKCALL SelConn_1000A4E4(HWND hWnd, char *a2, int a3); signed int __stdcall SelConn_1000A5F3(int a1, char *a2, char *a3, int a4); @@ -378,7 +378,7 @@ HWND UNKCALL SelConn_1000A866(HWND hWnd); HWND UNKCALL SelConn_1000A8D7(HWND hWnd); HWND UNKCALL SelConn_1000A948(HWND hWnd); int UNKCALL SelConn_1000A9F3(HWND hWnd); // idb -_DWORD *__fastcall SelConn_1000AA28(int a1); +DWORD *__fastcall SelConn_1000AA28(int a1); HWND UNKCALL SelConn_1000AA3B(HWND hWnd); HWND UNKCALL SelConn_1000AAEB(HWND hWnd); HWND UNKCALL SelConn_1000AB83(HWND hWnd); @@ -449,21 +449,21 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf void *SelIPX_1000C610(); signed int SelIPX_1000C629(); -BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid); +BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, DWORD *a4, int a5, int playerid); int __stdcall SelIPX_1000C692(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb LONG __fastcall SelIPX_1000C818(HWND hDlg, int nIDDlgItem); HWND UNKCALL SelIPX_1000C982(HWND hDlg); int SelIPX_1000C99F(); const char *UNKCALL SelIPX_1000C9DA(HWND hDlg); -void __fastcall SelIPX_1000CA64(_DWORD *a1); -_DWORD **__fastcall SelIPX_1000CA71(_DWORD *a1); +void __fastcall SelIPX_1000CA64(DWORD *a1); +DWORD **__fastcall SelIPX_1000CA71(DWORD *a1); BOOL UNKCALL SelIPX_1000CAC1(void *location); void *__stdcall SelIPX_1000CAD5(int a1, char *a2, char *a3); -_DWORD *__fastcall SelIPX_1000CB50(_DWORD *a1, _DWORD *a2); -_DWORD *__fastcall SelIPX_1000CB73(_DWORD *a1, int a2); +DWORD *__fastcall SelIPX_1000CB50(DWORD *a1, DWORD *a2); +DWORD *__fastcall SelIPX_1000CB73(DWORD *a1, int a2); int __fastcall SelIPX_1000CB83(HWND a1, const char *a2); int UNKCALL SelIPX_1000CC41(HWND hDlg); // idb -BOOL __fastcall SelIPX_1000CCC5(_DWORD *a1); +BOOL __fastcall SelIPX_1000CCC5(DWORD *a1); HWND UNKCALL SelIPX_1000CCD9(HWND hWnd); HWND UNKCALL SelIPX_1000CD4A(HWND hWnd); void UNKCALL SelIPX_1000CEE6(HWND hDlg); @@ -471,7 +471,7 @@ LRESULT __stdcall SelIPX_1000CF38(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa HWND UNKCALL SelIPX_1000D070(HWND hWnd); HWND UNKCALL SelIPX_1000D0E1(HWND hWnd); int UNKCALL SelIPX_1000D18C(HWND hWnd); // idb -_DWORD *__fastcall SelIPX_1000D1C1(int a1); +DWORD *__fastcall SelIPX_1000D1C1(int a1); HWND UNKCALL SelIPX_1000D1D4(HWND hWnd); HWND UNKCALL SelIPX_1000D284(HWND hWnd); HWND UNKCALL SelIPX_1000D31C(HWND hWnd); @@ -516,10 +516,10 @@ signed int SelModem_1000E42A(); int __fastcall SelModem_1000E435(void *a1, int a2, int a3, char *a4, char *a5); char *__stdcall SelModem_1000E497(int a1, char *a2, char *a3); void *SelModem_1000E4EC(); -_DWORD *__fastcall SelModem_1000E500(int a1, _DWORD *a2); +DWORD *__fastcall SelModem_1000E500(int a1, DWORD *a2); signed int UNKCALL SelModem_1000E505(void *arg); signed int SelModem_1000E51E(); -BOOL __fastcall SelModem_1000E553(_DWORD *a1); +BOOL __fastcall SelModem_1000E553(DWORD *a1); BOOL UNKCALL SelModem_1000E567(void *location); int __fastcall SelModem_1000E57B(int a1, int a2); signed int SelModem_1000E5CC(); @@ -534,7 +534,7 @@ LRESULT __stdcall SelModem_1000EA04(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l HWND UNKCALL SelModem_1000EB2C(HWND hWnd); HWND UNKCALL SelModem_1000EB9D(HWND hWnd); HWND UNKCALL SelModem_1000EC0E(HWND hWnd); -_DWORD *__fastcall SelModem_1000EC9F(int a1); +DWORD *__fastcall SelModem_1000EC9F(int a1); HWND UNKCALL SelModem_1000ECB2(HWND hWnd); HWND UNKCALL SelModem_1000ED3B(HWND hWnd); HWND UNKCALL SelModem_1000EDBC(HWND hWnd); @@ -549,7 +549,7 @@ HWND __fastcall SelRegn_1000F0D7(HWND hDlg, int nIDDlgItem); HWND UNKCALL SelRegn_1000F109(HWND hDlg); int SelRegn_1000F126(); void UNKCALL SelRegn_1000F161(HWND hDlg); -BOOL __fastcall SelRegn_1000F1D4(_DWORD *a1); +BOOL __fastcall SelRegn_1000F1D4(DWORD *a1); BOOL UNKCALL SelRegn_1000F1E8(void *location); HWND UNKCALL SelRegn_1000F1FC(HWND hWnd); signed int SelRegn_1000F2ED(); @@ -560,14 +560,14 @@ HWND UNKCALL SelRegn_1000F53C(HWND hWnd); HWND UNKCALL SelRegn_1000F5AD(HWND hWnd); HWND UNKCALL SelRegn_1000F61E(HWND hWnd); int UNKCALL SelRegn_1000F6C9(HWND hWnd); // idb -_DWORD *__fastcall SelRegn_1000F6FE(int a1); +DWORD *__fastcall SelRegn_1000F6FE(int a1); HWND UNKCALL SelRegn_1000F711(HWND hWnd); HWND UNKCALL SelRegn_1000F7C1(HWND hWnd); HWND UNKCALL SelRegn_1000F859(HWND hWnd); signed int UNKCALL SelRegn_1000F8DD(void *arg); signed int SelRegn_1000F8F6(); HWND __fastcall SelRegn_1000F929(HWND hWnd, int a2, int height); -//signed int __stdcall UiSelectRegion(_DWORD *a1); +//signed int __stdcall UiSelectRegion(DWORD *a1); int __fastcall SelYesNo_YesNoDialog(HWND hWnd, char *dialogstr, char *hero, int nofocus); /* void */ LRESULT __stdcall SelYesNo_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); diff --git a/DiabloUI/bn_prof.cpp b/DiabloUI/bn_prof.cpp index a2bdb374..560d6cee 100644 --- a/DiabloUI/bn_prof.cpp +++ b/DiabloUI/bn_prof.cpp @@ -18,7 +18,7 @@ int __stdcall UiProfileGetString() { return 0; } // ref: 0x100014F9 void __cdecl UiProfileCallback() { return; } -//BOOL __stdcall UiProfileCallback(int a1, int a2, int a3, int a4, LPARAM a5, int a6, int a7, int a8, int (__stdcall *a9)(_DWORD, _DWORD, _DWORD, _DWORD)) { return 0; } +//BOOL __stdcall UiProfileCallback(int a1, int a2, int a3, int a4, LPARAM a5, int a6, int a7, int a8, int (__stdcall *a9)(DWORD, DWORD, DWORD, DWORD)) { return 0; } /* { const char *v9; // eax int v10; // eax @@ -31,14 +31,14 @@ void __cdecl UiProfileCallback() { return; } v9 = "DIALOG_PROFILE"; if ( !a9 ) v9 = "DIALOG_STATIC_PROFILE"; - v10 = SDlgDialogBoxParam(hInstance, v9, *(_DWORD *)(a3 + 8), bn_prof_1000155F, 0); + v10 = SDlgDialogBoxParam(hInstance, v9, *(DWORD *)(a3 + 8), bn_prof_1000155F, 0); return v10 && v10 != -1; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // 10029408: using guessed type int dword_10029408; // 10029418: using guessed type int dword_10029418; // 1002941C: using guessed type int dword_1002941C; -// 10029430: using guessed type int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); +// 10029430: using guessed type int (__stdcall *dword_10029430)(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000155F HGDIOBJ __stdcall bn_prof_1000155F(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { return 0; } @@ -111,10 +111,10 @@ HGDIOBJ __stdcall bn_prof_1000155F(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP SetTextColor((HDC)wParam, 0xFFFFu); return GetStockObject(5); } */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); -// 10029430: using guessed type int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); +// 10029430: using guessed type int (__stdcall *dword_10029430)(DWORD, DWORD, DWORD, DWORD); // ref: 0x100016DD void UNKCALL bn_prof_100016DD(HWND arg) { return; } @@ -130,7 +130,7 @@ void UNKCALL bn_prof_100016DD(HWND arg) { return; } size_t v9; // eax char *v10; // eax int v11; // ebx - _DWORD *v12; // edi + DWORD *v12; // edi int v13; // eax int v14; // ebx size_t v15; // [esp+4h] [ebp-28h] @@ -158,7 +158,7 @@ void UNKCALL bn_prof_100016DD(HWND arg) { return; } v23 = 0; if ( dword_10029408 > 0 ) { - v19 = v4 - (_DWORD)v3; + v19 = v4 - (DWORD)v3; do { v5 = 0; @@ -208,12 +208,12 @@ LABEL_13: v11 = v1 - 1; if ( v11 >= 0 ) { - v12 = (_DWORD *)(v22 + 4 * v11); + v12 = (DWORD *)(v22 + 4 * v11); v13 = v18 - v22; v14 = v11 + 1; while ( 1 ) { - SMemFree(*(_DWORD *)((char *)v12 + v13), "C:\\Src\\Diablo\\DiabloUI\\bn_prof.cpp", 250, 0); + SMemFree(*(DWORD *)((char *)v12 + v13), "C:\\Src\\Diablo\\DiabloUI\\bn_prof.cpp", 250, 0); SMemFree(*v12, "C:\\Src\\Diablo\\DiabloUI\\bn_prof.cpp", 251, 0); --v12; if ( !--v14 ) @@ -225,13 +225,13 @@ LABEL_13: SMemFree(v22, "C:\\Src\\Diablo\\DiabloUI\\bn_prof.cpp", 254, 0); } } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // 1001F380: using guessed type int dword_1001F380[]; // 10029408: using guessed type int dword_10029408; // 10029418: using guessed type int dword_10029418; // 1002941C: using guessed type int dword_1002941C; -// 10029430: using guessed type int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); +// 10029430: using guessed type int (__stdcall *dword_10029430)(DWORD, DWORD, DWORD, DWORD); // ref: 0x100018CE void __fastcall bn_prof_100018CE(int a1, int a2) { return; } @@ -242,7 +242,7 @@ void __fastcall bn_prof_100018CE(int a1, int a2) { return; } char *v5; // ebx v2 = a2; - if ( *(_DWORD *)(a2 + 24) && *(_DWORD *)a2 == 5 ) + if ( *(DWORD *)(a2 + 24) && *(DWORD *)a2 == 5 ) { v3 = SendMessageA(*(HWND *)(a2 + 20), 0xEu, 0, 0); v4 = v3 + 1; @@ -250,16 +250,16 @@ void __fastcall bn_prof_100018CE(int a1, int a2) { return; } { v5 = (char *)SMemAlloc(v3 + 1, "C:\\Src\\Diablo\\DiabloUI\\bn_prof.cpp", 362, 0); SendMessageA(*(HWND *)(v2 + 20), 0xDu, v4, (LPARAM)v5); - bn_prof_10001938(*(HDC *)(v2 + 24), (_DWORD *)(v2 + 28), v5, 0, 0); + bn_prof_10001938(*(HDC *)(v2 + 24), (DWORD *)(v2 + 28), v5, 0, 0); SMemFree(v5, "C:\\Src\\Diablo\\DiabloUI\\bn_prof.cpp", 367, 0); } } } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // ref: 0x10001938 -int __fastcall bn_prof_10001938(HDC a1, _DWORD *a2, char *a3, int a4, int a5) { return 0; } +int __fastcall bn_prof_10001938(HDC a1, DWORD *a2, char *a3, int a4, int a5) { return 0; } /* { int result; // eax char *v6; // edi @@ -268,11 +268,11 @@ int __fastcall bn_prof_10001938(HDC a1, _DWORD *a2, char *a3, int a4, int a5) { char v9; // bl char *v10; // eax RECT rc; // [esp+Ch] [ebp-14h] - _DWORD *v12; // [esp+1Ch] [ebp-4h] + DWORD *v12; // [esp+1Ch] [ebp-4h] char *v13; // [esp+28h] [ebp+8h] result = (int)bn_prof_10002410(a1, a2); - v12 = (_DWORD *)result; + v12 = (DWORD *)result; if ( result ) { v6 = a3; @@ -304,7 +304,7 @@ int __fastcall bn_prof_10001938(HDC a1, _DWORD *a2, char *a3, int a4, int a5) { if ( a4 && PtInRect(&rc, *(POINT *)a4) ) { if ( a5 ) - *(_DWORD *)a5 = v8; + *(DWORD *)a5 = v8; return 1; } if ( !v6 ) @@ -372,8 +372,8 @@ int __fastcall bn_prof_10001A10(HWND a1, HWND a2) { return 0; } } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // ref: 0x10001B0A HINSTANCE __fastcall bn_prof_10001B0A(HWND a1, const CHAR *a2) { return 0; } @@ -420,7 +420,7 @@ HINSTANCE __fastcall bn_prof_10001B0A(HWND a1, const CHAR *a2) { return 0; } } return result; } */ -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10001C0E HWND UNKCALL bn_prof_10001C0E(HWND hWnd) { return 0; } @@ -440,9 +440,9 @@ HWND UNKCALL bn_prof_10001C0E(HWND hWnd) { return 0; } v3 = GetDlgItem(v1, 1126); SendMessageA(v3, 0xCu, 0, v2); bn_prof_10001CB9( - (_DWORD *)dword_1002941C, + (DWORD *)dword_1002941C, dword_10029418, - (void (__fastcall *)(_BYTE *, _DWORD, int))bn_prof_10001ED0, + (void (__fastcall *)(BYTE *, DWORD, int))bn_prof_10001ED0, 0); bn_prof_10001E34(v1); if ( dword_10029430 ) @@ -461,13 +461,13 @@ HWND UNKCALL bn_prof_10001C0E(HWND hWnd) { return 0; } } */ // 10029418: using guessed type int dword_10029418; // 1002941C: using guessed type int dword_1002941C; -// 10029430: using guessed type int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); +// 10029430: using guessed type int (__stdcall *dword_10029430)(DWORD, DWORD, DWORD, DWORD); // ref: 0x10001CB9 -void __fastcall bn_prof_10001CB9(_DWORD *a1, int a2, void (__fastcall *a3)(_BYTE *, _DWORD, int), int a4) { return; } +void __fastcall bn_prof_10001CB9(DWORD *a1, int a2, void (__fastcall *a3)(BYTE *, DWORD, int), int a4) { return; } /* { - _BYTE *v4; // eax - _DWORD *v5; // esi + BYTE *v4; // eax + DWORD *v5; // esi int v6; // edi if ( a1 ) @@ -476,18 +476,18 @@ void __fastcall bn_prof_10001CB9(_DWORD *a1, int a2, void (__fastcall *a3)(_BYTE { if ( a3 ) { - v4 = (_BYTE *)*a1; - if ( *(_BYTE *)*a1 ) + v4 = (BYTE *)*a1; + if ( *(BYTE *)*a1 ) { v5 = a1; - v6 = a2 - (_DWORD)a1; + v6 = a2 - (DWORD)a1; do { - a3(v4, *(_DWORD *)((char *)v5 + v6), a4); + a3(v4, *(DWORD *)((char *)v5 + v6), a4); ++v5; - v4 = (_BYTE *)*v5; + v4 = (BYTE *)*v5; } - while ( *(_BYTE *)*v5 ); + while ( *(BYTE *)*v5 ); } } } @@ -519,10 +519,10 @@ int UNKCALL bn_prof_10001CF3(HWND hWnd) { return 0; } local_10007944(0, 0, "Button", -1, 1, (int)"ui_art\\but_xsm.pcx", &dword_10029428, &v9, 1); return SDlgSetControlBitmaps(v1, &v6, 0, dword_10029428, &v9, 1, -1); } */ -// 10010388: using guessed type int __stdcall SDlgSetControlBitmaps(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010388: using guessed type int __stdcall SDlgSetControlBitmaps(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 10029410: using guessed type int dword_10029410; // 10029428: using guessed type int dword_10029428; -// 10029430: using guessed type int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); +// 10029430: using guessed type int (__stdcall *dword_10029430)(DWORD, DWORD, DWORD, DWORD); // ref: 0x10001D81 HFONT __fastcall bn_prof_10001D81(HWND hWnd, int a2, int a3) { return 0; } @@ -575,9 +575,9 @@ HFONT __fastcall bn_prof_10001D81(HWND hWnd, int a2, int a3) { return 0; } void UNKCALL bn_prof_10001E34(void *arg) { return; } /* { bn_prof_10001CB9( - (_DWORD *)dword_1002941C, + (DWORD *)dword_1002941C, dword_10029418, - (void (__fastcall *)(_BYTE *, _DWORD, int))bn_prof_10001E4C, + (void (__fastcall *)(BYTE *, DWORD, int))bn_prof_10001E4C, (int)arg); } */ // 10029418: using guessed type int dword_10029418; @@ -627,14 +627,14 @@ void __fastcall bn_prof_10001E4C(char *a1, LPARAM lParam, HWND hDlg) { return; } // 1001F380: using guessed type int dword_1001F380[]; // 1001F384: using guessed type int dword_1001F384[]; // 10022258: using guessed type int dword_10022258; -// 10029430: using guessed type int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); +// 10029430: using guessed type int (__stdcall *dword_10029430)(DWORD, DWORD, DWORD, DWORD); // ref: 0x10001ED0 -void __fastcall bn_prof_10001ED0(char *a1, _BYTE *a2, int a3) { return; } +void __fastcall bn_prof_10001ED0(char *a1, BYTE *a2, int a3) { return; } /* { int v3; // esi bool v4; // zf - _BYTE *v5; // edi + BYTE *v5; // edi char *v6; // ebp const char **v7; // ebx @@ -685,7 +685,7 @@ void *bn_prof_10001F29() { return 0; } dword_10029434 = 0; return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // 10029434: using guessed type int dword_10029434; // ref: 0x10001F84 @@ -706,7 +706,7 @@ BYTE *bn_prof_10001F84() { return 0; } } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // 10029410: using guessed type int dword_10029410; // 10029428: using guessed type int dword_10029428; @@ -837,14 +837,14 @@ void __cdecl UiProfileDraw() { return; } SGdiDeleteObject(v18, v20, v41); return 1; } */ -// 1001038E: using guessed type int __fastcall SGdiDeleteObject(_DWORD, _DWORD, _DWORD); -// 10010394: using guessed type int __stdcall SGdiExtTextOut(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 1001039A: using guessed type int __stdcall SGdiGetTextExtent(_DWORD, _DWORD, _DWORD); -// 100103A0: using guessed type int __stdcall SStrLen(_DWORD); -// 100103A6: using guessed type int __stdcall SGdiSetPitch(_DWORD); -// 100103AC: using guessed type int __stdcall SGdiSelectObject(_DWORD); -// 100103B2: using guessed type int __stdcall SGdiImportFont(_DWORD, _DWORD); -// 100103B8: using guessed type int __stdcall SBltROP3Clipped(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 1001038E: using guessed type int __fastcall SGdiDeleteObject(DWORD, DWORD, DWORD); +// 10010394: using guessed type int __stdcall SGdiExtTextOut(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); +// 1001039A: using guessed type int __stdcall SGdiGetTextExtent(DWORD, DWORD, DWORD); +// 100103A0: using guessed type int __stdcall SStrLen(DWORD); +// 100103A6: using guessed type int __stdcall SGdiSetPitch(DWORD); +// 100103AC: using guessed type int __stdcall SGdiSelectObject(DWORD); +// 100103B2: using guessed type int __stdcall SGdiImportFont(DWORD, DWORD); +// 100103B8: using guessed type int __stdcall SBltROP3Clipped(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 1002940C: using guessed type int dword_1002940C; // 10029414: using guessed type int dword_10029414; // 1002942C: using guessed type int dword_1002942C; @@ -867,8 +867,8 @@ int bn_prof_100021C4() { return 0; } dword_10029414 = v2; return SBmpLoadImage("ui_Art\\profilebkg.pcx", 0, dword_1002942C, v0, &v3, &v2, 0); } */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); -// 100103BE: using guessed type int __stdcall SBmpLoadImage(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); +// 100103BE: using guessed type int __stdcall SBmpLoadImage(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 1002940C: using guessed type int dword_1002940C; // 10029414: using guessed type int dword_10029414; // 1002942C: using guessed type int dword_1002942C; @@ -888,7 +888,7 @@ void *bn_prof_10002247() { return 0; } } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // 1002940C: using guessed type int dword_1002940C; // 10029414: using guessed type int dword_10029414; // 1002942C: using guessed type int dword_1002942C; @@ -901,10 +901,10 @@ int j_bn_prof_10002282() { return 0; } } */ // ref: 0x10002282 -_DWORD *bn_prof_10002282() { return 0; } +DWORD *bn_prof_10002282() { return 0; } /* { - _DWORD *result; // eax - _DWORD *v1; // edx + DWORD *result; // eax + DWORD *v1; // edx result = dword_10029460; v1 = &dword_10029460[1]; @@ -1011,21 +1011,21 @@ HGDIOBJ bn_prof_100023D8() { return 0; } v1 = dword_10029460[2]; if ( v1 <= 0 ) break; - bn_prof_100027D8((_DWORD *)dword_10029460[2]); + bn_prof_100027D8((DWORD *)dword_10029460[2]); result = (HGDIOBJ)SMemFree(v1, ".?AU_DRAWTEXT@@", -2, 0); } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // ref: 0x10002410 -_DWORD *__fastcall bn_prof_10002410(HDC hdc, _DWORD *a2) { return 0; } +DWORD *__fastcall bn_prof_10002410(HDC hdc, DWORD *a2) { return 0; } /* { HDC v2; // ebp - _DWORD *v3; // esi - _DWORD *v4; // eax - _DWORD *v5; // ebx - _DWORD *v6; // esi + DWORD *v3; // esi + DWORD *v4; // eax + DWORD *v5; // ebx + DWORD *v6; // esi v2 = hdc; v3 = a2; @@ -1047,7 +1047,7 @@ _DWORD *__fastcall bn_prof_10002410(HDC hdc, _DWORD *a2) { return 0; } } */ // ref: 0x10002456 -signed int __fastcall bn_prof_10002456(int a1, const CHAR *a2, char a3, _DWORD *a4) { return 0; } +signed int __fastcall bn_prof_10002456(int a1, const CHAR *a2, char a3, DWORD *a4) { return 0; } /* { int v4; // esi HGDIOBJ v6; // edi @@ -1101,18 +1101,18 @@ signed int __fastcall bn_prof_10002456(int a1, const CHAR *a2, char a3, _DWORD * h = SelectObject(*(HDC *)(v4 + 8), v6); if ( a4 ) { - *a4 = *(_DWORD *)(v4 + 28); - a4[1] = *(_DWORD *)(v4 + 32); + *a4 = *(DWORD *)(v4 + 28); + a4[1] = *(DWORD *)(v4 + 32); } do { - while ( cchString > 0 && *(_WORD *)lpszString == 2573 ) + while ( cchString > 0 && *(WORD *)lpszString == 2573 ) { - v8 = *(_DWORD *)(v4 + 92); + v8 = *(DWORD *)(v4 + 92); cchString -= 2; - *(_DWORD *)(v4 + 32) += v8; + *(DWORD *)(v4 + 32) += v8; lpszString += 2; - *(_DWORD *)(v4 + 28) = 0; + *(DWORD *)(v4 + 28) = 0; } if ( !cchString ) break; @@ -1121,7 +1121,7 @@ signed int __fastcall bn_prof_10002456(int a1, const CHAR *a2, char a3, _DWORD * *(HDC *)(v4 + 8), lpszString, cchString, - *(_DWORD *)(v4 + 20) - *(_DWORD *)(v4 + 28) - *(_DWORD *)(v4 + 12) - v29 + 1, + *(DWORD *)(v4 + 20) - *(DWORD *)(v4 + 28) - *(DWORD *)(v4 + 12) - v29 + 1, &nFit, 0, &Size); @@ -1146,7 +1146,7 @@ LABEL_26: goto LABEL_27; } } - if ( *(_DWORD *)(v4 + 28) > 0 ) + if ( *(DWORD *)(v4 + 28) > 0 ) { if ( isspace(lpszString[v9]) ) goto LABEL_26; @@ -1157,7 +1157,7 @@ LABEL_27: v11 = 0; if ( nFit > 0 ) { - while ( *(_WORD *)&lpszString[v11] != 2573 && lpszString[v11] != 9 ) + while ( *(WORD *)&lpszString[v11] != 2573 && lpszString[v11] != 9 ) { if ( ++v11 >= nFit ) goto LABEL_34; @@ -1167,7 +1167,7 @@ LABEL_27: LABEL_34: if ( a4 ) { - v12 = *(_DWORD *)(v4 + 28); + v12 = *(DWORD *)(v4 + 28); if ( v12 < *a4 ) *a4 = v12; } @@ -1175,8 +1175,8 @@ LABEL_34: { ExtTextOutA( *(HDC *)(v4 + 8), - *(_DWORD *)(v4 + 28), - *(_DWORD *)(v4 + 32), + *(DWORD *)(v4 + 28), + *(DWORD *)(v4 + 32), 4u, (const RECT *)(v4 + 12), lpszString, @@ -1188,47 +1188,47 @@ LABEL_34: v14 = Size.cx; if ( a4 ) { - v15 = Size.cx + *(_DWORD *)(v4 + 28); + v15 = Size.cx + *(DWORD *)(v4 + 28); if ( v15 > a4[2] ) a4[2] = v15; - v16 = Size.cy + *(_DWORD *)(v4 + 32); + v16 = Size.cy + *(DWORD *)(v4 + 32); if ( v16 > a4[3] ) a4[3] = v16; } v17 = nFit; - *(_DWORD *)(v4 + 28) += v14; - v18 = *(_DWORD *)(v4 + 28); + *(DWORD *)(v4 + 28) += v14; + v18 = *(DWORD *)(v4 + 28); if ( v17 < cchString ) { v19 = &v13[v17]; if ( *v19 == 9 ) { ++nFit; - *(_DWORD *)(v4 + 28) = 8 * v29 + v18 - v18 % (8 * v29); + *(DWORD *)(v4 + 28) = 8 * v29 + v18 - v18 % (8 * v29); } else { - if ( *(_WORD *)v19 == 2573 ) + if ( *(WORD *)v19 == 2573 ) nFit += 2; - v20 = *(_DWORD *)(v4 + 92); - *(_DWORD *)(v4 + 28) = 0; - *(_DWORD *)(v4 + 32) += v20; + v20 = *(DWORD *)(v4 + 92); + *(DWORD *)(v4 + 28) = 0; + *(DWORD *)(v4 + 32) += v20; } } cchString -= nFit; lpszString += nFit; continue; } - v10 = *(_DWORD *)(v4 + 92); - *(_DWORD *)(v4 + 28) &= nFit; - *(_DWORD *)(v4 + 32) += v10; + v10 = *(DWORD *)(v4 + 92); + *(DWORD *)(v4 + 28) &= nFit; + *(DWORD *)(v4 + 32) += v10; } while ( cchString > 0 ); - if ( *(_DWORD *)(v4 + 28) > *(_DWORD *)(v4 + 20) - *(_DWORD *)(v4 + 12) - v29 + 1 ) + if ( *(DWORD *)(v4 + 28) > *(DWORD *)(v4 + 20) - *(DWORD *)(v4 + 12) - v29 + 1 ) { - v21 = *(_DWORD *)(v4 + 92); - *(_DWORD *)(v4 + 28) = 0; - *(_DWORD *)(v4 + 32) += v21; + v21 = *(DWORD *)(v4 + 92); + *(DWORD *)(v4 + 28) = 0; + *(DWORD *)(v4 + 32) += v21; } if ( h ) SelectObject(*(HDC *)(v4 + 8), h); @@ -1250,7 +1250,7 @@ signed int bn_prof_100026B9() { return 0; } // 10029454: using guessed type int dword_10029454; // ref: 0x100026C4 -signed int UNKCALL bn_prof_100026C4(_DWORD *arg) { return 0; } +signed int UNKCALL bn_prof_100026C4(DWORD *arg) { return 0; } /* { if ( !arg ) return 0; @@ -1259,9 +1259,9 @@ signed int UNKCALL bn_prof_100026C4(_DWORD *arg) { return 0; } } */ // ref: 0x100026F0 -void UNKCALL bn_prof_100026F0(_DWORD *arg) { return; } +void UNKCALL bn_prof_100026F0(DWORD *arg) { return; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi v1 = arg; bn_prof_1000287D(arg); @@ -1269,7 +1269,7 @@ void UNKCALL bn_prof_100026F0(_DWORD *arg) { return; } } */ // ref: 0x10002749 -int UNKCALL bn_prof_10002749(char *arg, _DWORD *a2) { return 0; } +int UNKCALL bn_prof_10002749(char *arg, DWORD *a2) { return 0; } /* { int v2; // eax int v3; // eax @@ -1278,7 +1278,7 @@ int UNKCALL bn_prof_10002749(char *arg, _DWORD *a2) { return 0; } v2 = (int)a2; if ( !a2 ) v2 = (int)(arg + 4); - v3 = *(_DWORD *)(v2 + 4); + v3 = *(DWORD *)(v2 + 4); if ( v3 > 0 ) v4 = v3; else @@ -1287,20 +1287,20 @@ int UNKCALL bn_prof_10002749(char *arg, _DWORD *a2) { return 0; } SMemFree(a2, ".?AU_DRAWTEXT@@", -2, 0); return v4; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // ref: 0x10002782 -_DWORD *UNKCALL bn_prof_10002782(int *arg, int a2, int a3, int a4) { return 0; } +DWORD *UNKCALL bn_prof_10002782(int *arg, int a2, int a3, int a4) { return 0; } /* { int v4; // eax int *v5; // edi - _DWORD *v6; // eax - _DWORD *v7; // esi + DWORD *v6; // eax + DWORD *v7; // esi v4 = a4; LOBYTE(v4) = a4 | 8; v5 = arg; - v6 = (_DWORD *)SMemAlloc(a3 + 96, ".?AU_DRAWTEXT@@", -2, v4); + v6 = (DWORD *)SMemAlloc(a3 + 96, ".?AU_DRAWTEXT@@", -2, v4); if ( v6 ) v7 = bn_prof_100027CE(v6); else @@ -1309,12 +1309,12 @@ _DWORD *UNKCALL bn_prof_10002782(int *arg, int a2, int a3, int a4) { return 0; } bn_prof_1000280C(v5, v7, a2, 0); return v7; } */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // ref: 0x100027CE -_DWORD *UNKCALL bn_prof_100027CE(_DWORD *arg) { return 0; } +DWORD *UNKCALL bn_prof_100027CE(DWORD *arg) { return 0; } /* { - _DWORD *result; // eax + DWORD *result; // eax result = arg; *arg = 0; @@ -1323,9 +1323,9 @@ _DWORD *UNKCALL bn_prof_100027CE(_DWORD *arg) { return 0; } } */ // ref: 0x100027D8 -void UNKCALL bn_prof_100027D8(_DWORD *arg) { return; } +void UNKCALL bn_prof_100027D8(DWORD *arg) { return; } /* { - _DWORD *v1; // ST00_4 + DWORD *v1; // ST00_4 v1 = arg; bn_prof_10002890(arg); @@ -1333,11 +1333,11 @@ void UNKCALL bn_prof_100027D8(_DWORD *arg) { return; } } */ // ref: 0x1000280C -_DWORD *UNKCALL bn_prof_1000280C(int *arg, _DWORD *a2, int a3, _DWORD *a4) { return 0; } +DWORD *UNKCALL bn_prof_1000280C(int *arg, DWORD *a2, int a3, DWORD *a4) { return 0; } /* { int *v4; // edi - _DWORD *v5; // esi - _DWORD *result; // eax + DWORD *v5; // esi + DWORD *result; // eax int v7; // ecx int v8; // edx int v9; // ecx @@ -1361,37 +1361,37 @@ _DWORD *UNKCALL bn_prof_1000280C(int *arg, _DWORD *a2, int a3, _DWORD *a4) { ret if ( v8 > 0 ) { if ( v9 < 0 ) - v9 = (int)result - *(_DWORD *)(*result + 4); + v9 = (int)result - *(DWORD *)(*result + 4); v10 = v9 + v8; } else { v10 = ~v8; } - *(_DWORD *)v10 = v5; + *(DWORD *)v10 = v5; result[1] = a2; } else if ( a3 == 2 ) { v7 = *result; *v5 = *result; - v5[1] = *(_DWORD *)(v7 + 4); - *(_DWORD *)(v7 + 4) = a2; + v5[1] = *(DWORD *)(v7 + 4); + *(DWORD *)(v7 + 4) = a2; *result = v5; } return result; } */ // ref: 0x1000287D -void UNKCALL bn_prof_1000287D(_DWORD *arg) { return; } +void UNKCALL bn_prof_1000287D(DWORD *arg) { return; } /* { - _DWORD *v1; // esi - _DWORD *v2; // ecx + DWORD *v1; // esi + DWORD *v2; // ecx v1 = arg; while ( 1 ) { - v2 = (_DWORD *)v1[2]; + v2 = (DWORD *)v1[2]; if ( (signed int)v2 <= 0 ) break; bn_prof_10002890(v2); @@ -1399,7 +1399,7 @@ void UNKCALL bn_prof_1000287D(_DWORD *arg) { return; } } */ // ref: 0x10002890 -void UNKCALL bn_prof_10002890(_DWORD *arg) { return; } +void UNKCALL bn_prof_10002890(DWORD *arg) { return; } /* { int v1; // esi int v2; // edx @@ -1410,11 +1410,11 @@ void UNKCALL bn_prof_10002890(_DWORD *arg) { return; } { v2 = arg[1]; if ( v2 > 0 ) - v3 = (int)arg + v2 - *(_DWORD *)(v1 + 4); + v3 = (int)arg + v2 - *(DWORD *)(v1 + 4); else v3 = ~v2; - *(_DWORD *)v3 = v1; - *(_DWORD *)(*arg + 4) = arg[1]; + *(DWORD *)v3 = v1; + *(DWORD *)(*arg + 4) = arg[1]; *arg = 0; arg[1] = 0; } diff --git a/DiabloUI/bnetgw.cpp b/DiabloUI/bnetgw.cpp index 881cdb53..f7bc43d8 100644 --- a/DiabloUI/bnetgw.cpp +++ b/DiabloUI/bnetgw.cpp @@ -1,7 +1,7 @@ // ref: 0x100028C2 -void UNKCALL BNetGW_100028C2(_DWORD *arg) { return; } +void UNKCALL BNetGW_100028C2(DWORD *arg) { return; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi bool v2; // zf bool v3; // sf int v4; // edi @@ -21,7 +21,7 @@ void UNKCALL BNetGW_100028C2(_DWORD *arg) { return; } arg[4] = 0; arg[5] = 0; arg[6] = 0; - *(_BYTE *)arg = 0; + *(BYTE *)arg = 0; BNetGW_10002C23(arg); if ( !v1[4] ) goto LABEL_15; @@ -72,14 +72,14 @@ LABEL_15: v1[3] = 0; } } */ -// 100103A0: using guessed type int __stdcall SStrLen(_DWORD); -// 100103C4: using guessed type int __stdcall SMemZero(_DWORD, _DWORD); +// 100103A0: using guessed type int __stdcall SStrLen(DWORD); +// 100103C4: using guessed type int __stdcall SMemZero(DWORD, DWORD); // 100103CA: using guessed type int __stdcall SRegDeleteValue(const char *, const char *, unsigned int); // ref: 0x100029BF -void UNKCALL BNetGW_100029BF(_DWORD *arg, int a2) { return; } +void UNKCALL BNetGW_100029BF(DWORD *arg, int a2) { return; } /* { - _DWORD *v2; // esi + DWORD *v2; // esi char *v3; // edi signed int v4; // ebx signed int v5; // ebp @@ -109,11 +109,11 @@ void UNKCALL BNetGW_100029BF(_DWORD *arg, int a2) { return; } } */ // ref: 0x10002A07 -void *UNKCALL BNetGW_10002A07(_DWORD *arg) { return 0; } +void *UNKCALL BNetGW_10002A07(DWORD *arg) { return 0; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi int v2; // edi - _BYTE *v3; // ecx + BYTE *v3; // ecx const char *v4; // eax int result; // eax @@ -123,7 +123,7 @@ void *UNKCALL BNetGW_10002A07(_DWORD *arg) { return 0; } v2 = arg[4]; if ( v2 ) { - v3 = (_BYTE *)(v2 + SStrLen(arg[4]) + 1); + v3 = (BYTE *)(v2 + SStrLen(arg[4]) + 1); *v3 = v1[3] / 10 + 48; v4 = "Override Battle.net gateways"; v3[1] = v1[3] % 10 + 48; @@ -141,12 +141,12 @@ void *UNKCALL BNetGW_10002A07(_DWORD *arg) { return 0; } } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 100103A0: using guessed type int __stdcall SStrLen(_DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); +// 100103A0: using guessed type int __stdcall SStrLen(DWORD); // 100103D0: using guessed type int __stdcall SRegSaveData(const char *, const char *, unsigned int, void *, unsigned int); // ref: 0x10002A84 -_DWORD *UNKCALL BNetGW_10002A84(_DWORD *arg, signed int a2) { return 0; } +DWORD *UNKCALL BNetGW_10002A84(DWORD *arg, signed int a2) { return 0; } /* { signed int v2; // eax signed int v3; // ebx @@ -155,9 +155,9 @@ _DWORD *UNKCALL BNetGW_10002A84(_DWORD *arg, signed int a2) { return 0; } bool v6; // sf unsigned char v7; // of int v8; // eax - _DWORD *result; // eax - _DWORD *v10; // [esp+8h] [ebp-4h] - _DWORD *v11; // [esp+14h] [ebp+8h] + DWORD *result; // eax + DWORD *v10; // [esp+8h] [ebp-4h] + DWORD *v11; // [esp+14h] [ebp+8h] v10 = arg; if ( !arg[4] ) @@ -168,7 +168,7 @@ _DWORD *UNKCALL BNetGW_10002A84(_DWORD *arg, signed int a2) { return 0; } return arg; v4 = 3 * a2; v5 = 0; - v11 = (_DWORD *)arg[4]; + v11 = (DWORD *)arg[4]; if ( 3 * v2 <= 1 ) { LABEL_7: @@ -185,7 +185,7 @@ LABEL_7: break; v8 = SStrLen(v11); arg = v10; - v11 = (_DWORD *)((char *)v11 + ++v8); + v11 = (DWORD *)((char *)v11 + ++v8); v5 += v8; if ( ++v3 >= v4 ) goto LABEL_7; @@ -198,7 +198,7 @@ LABEL_7: return arg; return result; } */ -// 100103A0: using guessed type int __stdcall SStrLen(_DWORD); +// 100103A0: using guessed type int __stdcall SStrLen(DWORD); // ref: 0x10002AE5 signed int BNetGW_10002AE5() { return 0; } @@ -212,7 +212,7 @@ signed int BNetGW_10002AE5() { return 0; } // 10029478: using guessed type int dword_10029478; // ref: 0x10002AF0 -int UNKCALL BNetGW_10002AF0(_DWORD *arg, char *a2) { return 0; } +int UNKCALL BNetGW_10002AF0(DWORD *arg, char *a2) { return 0; } /* { const char *v2; // eax const char *v3; // esi @@ -223,17 +223,17 @@ int UNKCALL BNetGW_10002AF0(_DWORD *arg, char *a2) { return 0; } v3 = &v2[SStrLen(v2) + 1]; return strtol(v3, &a2, 10); } */ -// 100103A0: using guessed type int __stdcall SStrLen(_DWORD); +// 100103A0: using guessed type int __stdcall SStrLen(DWORD); // ref: 0x10002B21 -_BYTE *UNKCALL BNetGW_10002B21(_DWORD *arg, signed int a2) { return 0; } +BYTE *UNKCALL BNetGW_10002B21(DWORD *arg, signed int a2) { return 0; } /* { - _DWORD *v2; // eax - _BYTE *v3; // esi + DWORD *v2; // eax + BYTE *v3; // esi v2 = BNetGW_10002A84(arg, a2); v3 = v2; - if ( *(_BYTE *)v2 ) + if ( *(BYTE *)v2 ) { v3 = (char *)v2 + SStrLen(v2) + 1; if ( *v3 ) @@ -241,10 +241,10 @@ _BYTE *UNKCALL BNetGW_10002B21(_DWORD *arg, signed int a2) { return 0; } } return v3; } */ -// 100103A0: using guessed type int __stdcall SStrLen(_DWORD); +// 100103A0: using guessed type int __stdcall SStrLen(DWORD); // ref: 0x10002B51 -void UNKCALL BNetGW_10002B51(_DWORD *arg, signed int a2) { return; } +void UNKCALL BNetGW_10002B51(DWORD *arg, signed int a2) { return; } /* { signed int v2; // eax @@ -262,9 +262,9 @@ void UNKCALL BNetGW_10002B51(_DWORD *arg, signed int a2) { return; } } */ // ref: 0x10002B78 -char *UNKCALL BNetGW_10002B78(_DWORD *arg, char *a2) { return 0; } +char *UNKCALL BNetGW_10002B78(DWORD *arg, char *a2) { return 0; } /* { - _DWORD *v2; // esi + DWORD *v2; // esi char *result; // eax char *v4; // ST08_4 void *v5; // eax @@ -302,14 +302,14 @@ char *UNKCALL BNetGW_10002B78(_DWORD *arg, char *a2) { return 0; } } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // 100103D6: using guessed type int __stdcall SRegLoadData(const char *, const char *, unsigned int, void *, unsigned int, unsigned int *); // ref: 0x10002C23 -char *UNKCALL BNetGW_10002C23(_DWORD *arg) { return 0; } +char *UNKCALL BNetGW_10002C23(DWORD *arg) { return 0; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi char *result; // eax v1 = arg; @@ -322,24 +322,24 @@ char *UNKCALL BNetGW_10002C23(_DWORD *arg) { return 0; } } */ // ref: 0x10002C51 -int UNKCALL BNetGW_10002C51(_DWORD *arg) { return 0; } +int UNKCALL BNetGW_10002C51(DWORD *arg) { return 0; } /* { int result; // eax char *v2; // edi char *v3; // esi unsigned int v4; // ebx char *v5; // esi - _BYTE *v6; // esi + BYTE *v6; // esi char *v7; // eax char *v8; // eax - _BYTE *v9; // esi + BYTE *v9; // esi char *v10; // esi char v11; // al unsigned int v12; // esi char *v13; // [esp+4h] [ebp-10h] int v14; // [esp+8h] [ebp-Ch] int v15; // [esp+Ch] [ebp-8h] - _DWORD *v16; // [esp+10h] [ebp-4h] + DWORD *v16; // [esp+10h] [ebp-4h] v15 = 0; v16 = arg; @@ -426,20 +426,20 @@ LABEL_8: SMemFree(v14, "C:\\Src\\Diablo\\DiabloUI\\BNetGW.cpp", 429, 0); result = (int)v16; v16[5] = v12; - *(_DWORD *)(result + 16) = v13; - *(_DWORD *)(result + 24) = 1000; + *(DWORD *)(result + 16) = v13; + *(DWORD *)(result + 24) = 1000; } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); -// 100103A0: using guessed type int __stdcall SStrLen(_DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); +// 100103A0: using guessed type int __stdcall SStrLen(DWORD); // 100103D0: using guessed type int __stdcall SRegSaveData(const char *, const char *, unsigned int, void *, unsigned int); // ref: 0x10002DBF -int UNKCALL BNetGW_10002DBF(_DWORD *arg) { return 0; } +int UNKCALL BNetGW_10002DBF(DWORD *arg) { return 0; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi int v3; // [esp+4h] [ebp-8h] int v4; // [esp+8h] [ebp-4h] @@ -449,7 +449,7 @@ int UNKCALL BNetGW_10002DBF(_DWORD *arg) { return 0; } *v1 = v4; return v3; } */ -// 100103DC: using guessed type int __stdcall SFileLoadFile(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 100103DC: using guessed type int __stdcall SFileLoadFile(DWORD, DWORD, DWORD, DWORD, DWORD); // ref: 0x10002DEB char *__stdcall BNetGW_10002DEB(char *a1, unsigned int a2) { return 0; } diff --git a/DiabloUI/connect.cpp b/DiabloUI/connect.cpp index d2fc005b..1eb03e4a 100644 --- a/DiabloUI/connect.cpp +++ b/DiabloUI/connect.cpp @@ -79,7 +79,7 @@ BOOL __stdcall UiArtCallback(int game_type, unsigned int art_code, PALETTEENTRY pszFileName[0] = nullcharacter; memset(&pszFileName[1], 0, 0x100u); - *(_WORD *)&pszFileName[257] = 0; + *(WORD *)&pszFileName[257] = 0; pszFileName[259] = 0; SStrCopy(pszFileName, "ui_art\\", sizeof(pszFileName)); if (game_type == 'BNET') { @@ -285,7 +285,7 @@ void __cdecl Connect_cpp_init() BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, int a5) { signed int v5; // edi - _DWORD *v6; // esi + DWORD *v6; // esi HCURSOR v7; // eax v5 = 0; @@ -301,7 +301,7 @@ BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, } return 0; case 2: - v6 = (unsigned int *)a3; + v6 = (DWORD *)a3; v5 = 4; if (!a3) goto LABEL_24; @@ -310,7 +310,7 @@ BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, v7 = LoadCursorA(ghUiInst, "DIABLO_LINKCURSOR"); break; case 3: - v6 = (unsigned int *)a3; + v6 = (DWORD *)a3; v5 = 4; if (!a3) goto LABEL_24; @@ -319,7 +319,7 @@ BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, v7 = LoadCursorA(ghUiInst, "DIABLO_ARROWCURSOR"); break; case 4: - v6 = (unsigned int *)a3; + v6 = (DWORD *)a3; v5 = 4; if (!a3) goto LABEL_24; @@ -330,7 +330,7 @@ BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, default: goto LABEL_24; } - *v6 = (unsigned int)v7; + *v6 = (DWORD)v7; if (v7) goto LABEL_24; return 0; @@ -338,14 +338,14 @@ BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, v5 = 4; if (a3) { if ((unsigned int)a4 >= 4) { - *(_DWORD *)a3 = 54; + *(DWORD *)a3 = 54; goto LABEL_24; } return 0; } LABEL_24: if (a5) - *(_DWORD *)a5 = v5; + *(DWORD *)a5 = v5; return v5 != 0; } @@ -378,7 +378,7 @@ BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPS _uiheroinfo heroinfo; // [esp+400h] [ebp-34h] _gamedata GameData; // [esp+42Ch] [ebp-8h] - *(_DWORD *)&GameData.bDiff = 0; + *(DWORD *)&GameData.bDiff = 0; if (cchBufferMax) *lpBuffer = 0; v7 = strlen(a3) + 1; @@ -403,7 +403,7 @@ BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPS } if (heroinfo.heroclass != v9) goto LABEL_20; - *(_DWORD *)&GameData.bDiff = 1; + *(DWORD *)&GameData.bDiff = 1; LABEL_16: LoadStringA(ghUiInst, 0x408u, Buffer, 256); v10 = strstr(v17, Buffer); @@ -413,7 +413,7 @@ BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPS if (heroinfo.level >= v12) return 1; } - if (*(_DWORD *)&GameData.bDiff) + if (*(DWORD *)&GameData.bDiff) return 1; LABEL_20: if (lpBuffer) { @@ -488,7 +488,7 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha v8 = a8; memset(&Buffer[1], 0, 0x7Cu); v9 = a8[4]; - *(_WORD *)&Buffer[125] = 0; + *(WORD *)&Buffer[125] = 0; Buffer[127] = 0; v10 = (unsigned char)v9 & 1; v11 = strlen(a4) + 1; @@ -517,7 +517,7 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha v15 = strlen(Buffer); TextOutA(v8[6], 0, 0, Buffer, v15); LoadStringA(ghUiInst, 0x409u, String, 128); - MoveToEx(v8[6], (int)v8[7], (int)v8[8] + (_DWORD)lpStringa, 0); + MoveToEx(v8[6], (int)v8[7], (int)v8[8] + (DWORD)lpStringa, 0); v16 = strlen(String); TextOutA(v8[6], 0, 0, String, v16); v17 = v8[6]; @@ -541,7 +541,7 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha if (!v19->tm_hour) v19->tm_hour = 12; sprintf(String, &heroinfo.name[8], v31, v19->tm_hour, v19->tm_min, &rc.top); - MoveToEx(v8[6], (int)v8[7], (int)v8[8] + 2 * (_DWORD)lpStringa, 0); + MoveToEx(v8[6], (int)v8[7], (int)v8[8] + 2 * (DWORD)lpStringa, 0); v21 = strlen(String); TextOutA(v8[6], 0, 0, String, v21); } @@ -581,7 +581,7 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha (HWND)v8[5], 0, (char *)v8[7], - (int)v8[8] + (_DWORD)a4, + (int)v8[8] + (DWORD)a4, connect_data3, &rc, (SIZE *)special_data, @@ -600,16 +600,16 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha } if (a5 & 8) { v25 = (arg0 != 'BNET') - 1; - _LOBYTE(v25) = v25 & 0xFD; + v25 = v25 & 0xFD; v24 = v25 + 4; goto LABEL_46; } } - if (*(_DWORD *)a1 == 'CHAT') { + if (*(DWORD *)a1 == 'CHAT') { v27 = 6; goto LABEL_45; } - if (*(_DWORD *)a1 == 'SEXP' || *(_DWORD *)a1 == 'SSHR' || *(_DWORD *)a1 == 'STAR') { + if (*(DWORD *)a1 == 'SEXP' || *(DWORD *)a1 == 'SSHR' || *(DWORD *)a1 == 'STAR') { v27 = 7; goto LABEL_45; } @@ -655,7 +655,7 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha (HWND)v8[5], 0, (char *)v8[7], - (int)v8[8] + (_DWORD)a4, + (int)v8[8] + (DWORD)a4, connect_data4, &rc, (SIZE *)heroport_data, @@ -676,7 +676,7 @@ LABEL_55: // 10029614: using guessed type int connect_color_text; // ref: 0x10003CE4 -BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, _DWORD *a6, _DWORD *a7) +BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7) { *a7 = 0xFFFF; *a6 = Connect_GetRankFromLevel(connect_categorystr); @@ -736,12 +736,12 @@ BOOL __fastcall Connect_DiffFromString(char *str, _gamedata *gamedata, int a3, i *v8 = 0; v9 = v8 + 1; if (a3) - *(_DWORD *)a3 = (unsigned int)v9; + *(DWORD *)a3 = (DWORD)v9; v10 = (char *)strchr(v9, 13); if (v10) { *v10 = 0; if (a4) - *(_DWORD *)a4 = (unsigned int)v10 + 1; + *(DWORD *)a4 = (DWORD)v10 + 1; } } return 1; @@ -788,12 +788,12 @@ BOOL __fastcall Connect_GetHeroInfoConc(const char *a1, _uiheroinfo *pInfo) memset(pInfo, 0, 0x2Cu); if (!*a1) return 0; - v4 = *(_DWORD *)a1; - if (*(_DWORD *)a1 != 'DRTL' && v4 != 'DSHR' && v4 != 'DTST') + v4 = *(DWORD *)a1; + if (*(DWORD *)a1 != 'DRTL' && v4 != 'DSHR' && v4 != 'DTST') return 0; if (sscanf(a1 + 4, "%d %d %d %d %d %d %d %d %d", &v13, &v12, &v11, &v18, &v17, &v16, &v15, &v10, &v14) != 9) return 0; - v5 = *(_DWORD *)a1; + v5 = *(DWORD *)a1; v6 = v14; if (v5 == 'DRTL') { if (v14) @@ -824,7 +824,7 @@ BOOL __fastcall Connect_GetHeroInfoConc(const char *a1, _uiheroinfo *pInfo) // ref: 0x10003F6F void __fastcall Connect_MakeDescString(_uiheroinfo *a1, char *name, size_t size) { - *(_DWORD *)name = (unsigned int)connect_charname; + *(DWORD *)name = (DWORD)connect_charname; _snprintf( name + 4, size, diff --git a/DiabloUI/copyprot.cpp b/DiabloUI/copyprot.cpp index afc7f364..c7ddd3d9 100644 --- a/DiabloUI/copyprot.cpp +++ b/DiabloUI/copyprot.cpp @@ -15,7 +15,7 @@ BOOL __stdcall UiCopyProtError(int *pdwResult) *pdwResult = v2; return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x100040AF LRESULT __stdcall CopyProt_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) @@ -68,7 +68,7 @@ LRESULT __stdcall CopyProt_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10004173 void __cdecl CopyProt_FreeCopyResrcs() diff --git a/DiabloUI/cr8game.cpp b/DiabloUI/cr8game.cpp index 8603c157..f7ff0912 100644 --- a/DiabloUI/cr8game.cpp +++ b/DiabloUI/cr8game.cpp @@ -28,11 +28,11 @@ BOOL __fastcall cr8game_GetSnetCreaGame(HWND hWnd) if (UiAuthCallback(2, a2, str, 0, a4, Text, 256)) { v2 = cr8_somegamestruct; if (cr8_somegamestruct[8] >= 8) { - *(_BYTE *)(cr8_somegamestruct[7] + 4) = cr8_gamedata.bDiff; + *(BYTE *)(cr8_somegamestruct[7] + 4) = cr8_gamedata.bDiff; v2 = cr8_somegamestruct; } v3 = cr8game_playerID; - v4 = *(_DWORD *)(cr8_playercount + 8); + v4 = *(DWORD *)(cr8_playercount + 8); v5 = v2[8]; v6 = (char *)v2[7]; v7 = Connect_GetRankFromLevel(str); @@ -53,7 +53,7 @@ BOOL __fastcall cr8game_GetSnetCreaGame(HWND hWnd) } return result; } -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); // 10029630: using guessed type int cr8_playercount; // ref: 0x100044AA @@ -67,7 +67,7 @@ BOOL __stdcall UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int cr8_dword_10029640 = a5; cr8_dword_1002963C = a4; cr8game_playerID = (int *)a6; - v6 = SDlgDialogBoxParam(ghUiInst, "DIALOG_CREATE_GAME", *(_DWORD *)(a4 + 8), cr8game_WndProc, 0); + v6 = SDlgDialogBoxParam(ghUiInst, "DIALOG_CREATE_GAME", *(DWORD *)(a4 + 8), cr8game_WndProc, 0); return v6 != -1 ? v6 : 0; } // 10029630: using guessed type int cr8_playercount; @@ -169,7 +169,7 @@ LRESULT __stdcall cr8game_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa } return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10004828 void __cdecl cr8game_FreeCreaStuff() diff --git a/DiabloUI/creadung.cpp b/DiabloUI/creadung.cpp index ea1f7bec..562d28c3 100644 --- a/DiabloUI/creadung.cpp +++ b/DiabloUI/creadung.cpp @@ -34,9 +34,9 @@ LRESULT __stdcall CreaDung_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP Focus_CheckPlayMove(lParam); Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam); CreaDung_ParseDungProcs(hWnd, (unsigned short)wParam); - } else if (HIWORD(wParam) == 5 || (_WORD)wParam == 1) { + } else if (HIWORD(wParam) == 5 || (WORD)wParam == 1) { CreaDung_DoAllPlaySnd(hWnd); - } else if ((_WORD)wParam == 2) { + } else if ((WORD)wParam == 2) { CreaDung_PlaySndAndKill(hWnd, 2); } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); @@ -58,7 +58,7 @@ LRESULT __stdcall CreaDung_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // 100296D8: using guessed type int creadung_dword_100296D8; // ref: 0x10004D75 @@ -196,7 +196,7 @@ void __fastcall CreaDung_DoSnetCreaGame(HWND hWnd) v2 = crea_somegamestruct; if (crea_somegamestruct[8] >= 8) { v3 = crea_somegamestruct[7]; - *(_BYTE *)(v3 + 4) = GetWindowLongA(v1, -12) - 70; + *(BYTE *)(v3 + 4) = GetWindowLongA(v1, -12) - 70; v2 = crea_somegamestruct; } if (SNetCreateGame( @@ -206,7 +206,7 @@ void __fastcall CreaDung_DoSnetCreaGame(HWND hWnd) 0, (char *)v2[7], v2[8], - *(_DWORD *)(creadung_playername + 8), + *(DWORD *)(creadung_playername + 8), a2, 0, creadung_playerID)) { @@ -223,7 +223,7 @@ void __fastcall CreaDung_DoSnetCreaGame(HWND hWnd) } } } -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); // 100296BC: using guessed type int creadung_playername; // 100296D4: using guessed type int creadung_lasterror; @@ -256,14 +256,14 @@ BOOL __fastcall CreaDung_SelDungDiff(int a1, int a2, int a3, int a4, int a5, int crea_somegamestruct = (DWORD *)a2; creadung_gamename = (char *)a8; v8 = SelHero_GetHeroIsGood(); - result = SDlgDialogBoxParam(ghUiInst, "SELDIFF_DIALOG", *(_DWORD *)(a4 + 8), CreaDung_WndProc, v8); + result = SDlgDialogBoxParam(ghUiInst, "SELDIFF_DIALOG", *(DWORD *)(a4 + 8), CreaDung_WndProc, v8); if (result != 1) { SErrSetLastError(creadung_lasterror); result = 0; } return result; } -// 1001041E: using guessed type int __stdcall SErrSetLastError(_DWORD); +// 1001041E: using guessed type int __stdcall SErrSetLastError(DWORD); // 100296BC: using guessed type int creadung_playername; // 100296C8: using guessed type int creadung_dword_100296C8; // 100296CC: using guessed type int creadung_delspinners; diff --git a/DiabloUI/credits.cpp b/DiabloUI/credits.cpp index 53b8b41a..b6e6b3d6 100644 --- a/DiabloUI/credits.cpp +++ b/DiabloUI/credits.cpp @@ -15,7 +15,7 @@ BOOL __stdcall UiCreditsDialog(int a1) SDlgDialogBoxParam(ghUiInst, "CREDITS_DIALOG", v1, credits_WndProc, 25); return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x100052C7 LRESULT __stdcall credits_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) @@ -37,7 +37,7 @@ LRESULT __stdcall credits_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } - if ((_WORD)wParam != 513 && (_WORD)wParam != 516) + if ((WORD)wParam != 513 && (WORD)wParam != 516) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); LABEL_25: Title_KillAndFadeDlg(hWnd); @@ -70,7 +70,7 @@ LRESULT __stdcall credits_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa credits_FreeCreditResrc(hWnd); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x100053D9 void __fastcall credits_FreeCreditResrc(HWND hWnd) @@ -145,12 +145,12 @@ void __fastcall credits_LoadImgCreditTxt(HWND hWnd, LPARAM lParam) // ref: 0x100055C0 void __fastcall credits_CalcPosROP3(HWND hWnd) { - _DWORD *v2; // edi + DWORD *v2; // edi struct tagRECT Rect; // [esp+Ch] [ebp-14h] HWND hWnda; // [esp+1Ch] [ebp-4h] hWnda = GetDlgItem(hWnd, 1000); - v2 = (_DWORD *)GetWindowLongA(hWnd, -21); + v2 = (DWORD *)GetWindowLongA(hWnd, -21); GetWindowRect(hWnda, &Rect); ScreenToClient(hWnd, (LPPOINT)&Rect); ScreenToClient(hWnd, (LPPOINT)&Rect.right); @@ -204,8 +204,8 @@ void __fastcall credits_PrintCredLines(HWND hWnd) if (i < 0) Title_KillAndFadeDlg(hWnd); } -// 100103A6: using guessed type int __stdcall SGdiSetPitch(_DWORD); -// 100103AC: using guessed type int __stdcall SGdiSelectObject(_DWORD); +// 100103A6: using guessed type int __stdcall SGdiSetPitch(DWORD); +// 100103AC: using guessed type int __stdcall SGdiSelectObject(DWORD); // 100296E8: using guessed type int credittext_size; // 100296FC: using guessed type int credit_vertical_pos1; // 10029700: using guessed type int credit_line_count; diff --git a/DiabloUI/diabedit.cpp b/DiabloUI/diabedit.cpp index 27c1df3e..d6ae340d 100644 --- a/DiabloUI/diabedit.cpp +++ b/DiabloUI/diabedit.cpp @@ -105,7 +105,7 @@ void __fastcall DiabEdit_GetCursorProp(HWND hWnd) String[0] = nullcharacter; memset(&String[1], 0, 0xFCu); - *(_WORD *)&String[253] = 0; + *(WORD *)&String[253] = 0; String[255] = 0; if (GetPropA(hWnd, "CURSOR")) { SetPropA(hWnd, "CURSOR", 0); @@ -139,9 +139,9 @@ void __fastcall DiabEdit_RestrictAndLimit(HWND hWnd, WPARAM wParam, LPARAM lPara String[0] = nullcharacter; v3 = wParam; memset(&String[1], 0, 0xFCu); - *(_WORD *)&String[253] = 0; + *(WORD *)&String[253] = 0; String[255] = 0; - if ((_BYTE)wParam == 8) + if ((BYTE)wParam == 8) goto LABEL_9; if ((unsigned char)wParam < 0x20u || (unsigned char)wParam > 0x7Eu && (unsigned char)wParam < 0xC0u) return; @@ -185,7 +185,7 @@ void __fastcall DiabEdit_SetTextAndProp(HWND hWnd, WPARAM wParam, LPARAM lParam) String[0] = nullcharacter; memset(&String[1], 0, 0xFCu); - *(_WORD *)&String[253] = 0; + *(WORD *)&String[253] = 0; String[255] = 0; v4 = wParam; GetWindowTextA(hWnd, String, 255); diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h index be52d82d..26497ab7 100644 --- a/DiabloUI/diabloui.h +++ b/DiabloUI/diabloui.h @@ -39,7 +39,7 @@ BOOL __stdcall UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc) int __stdcall UiProfileGetString(); void __cdecl UiProfileCallback(); void __cdecl UiProfileDraw(); -BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, _DWORD *a6, _DWORD *a7); +BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7); BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, int a5); BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPSTR lpBuffer, int cchBufferMax); BOOL __stdcall UiSoundCallback(int a1, int type, int a3); diff --git a/DiabloUI/dirlink.cpp b/DiabloUI/dirlink.cpp index 070e1604..cb571748 100644 --- a/DiabloUI/dirlink.cpp +++ b/DiabloUI/dirlink.cpp @@ -10,7 +10,7 @@ signed int DirLink_10005CFA() { return 0; } // 10029730: using guessed type int dword_10029730; // ref: 0x10005D05 -BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid) { return 0; } +BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, DWORD *a4, int a5, int playerid) { return 0; } /* { int v6; // esi @@ -24,7 +24,7 @@ BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int artfont_100010C8(); return v6 == 1; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // 1002983C: using guessed type int dword_1002983C; // 10029840: using guessed type int dword_10029840; // 10029844: using guessed type int gnDlinkPlayerid; @@ -75,7 +75,7 @@ int __stdcall DirLink_10005D63(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int { DirLink_100060D1(hWnd); } - else if ( (_WORD)wParam == 2 ) + else if ( (WORD)wParam == 2 ) { DirLink_10006047((int)hWnd, 2); } @@ -100,8 +100,8 @@ int __stdcall DirLink_10005D63(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int DirLink_10005F7B(hWnd); return 0; } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10005EB2 int __fastcall DirLink_10005EB2(HWND hDlg, int a2) { return 0; } @@ -128,7 +128,7 @@ int __fastcall DirLink_10005EB2(HWND hDlg, int a2) { return 0; } int UNKCALL DirLink_10005F1F(HWND hDlg) { return 0; } /* { HWND v1; // esi - _DWORD *v2; // eax + DWORD *v2; // eax v1 = hDlg; Doom_10006C53(hDlg, (int *)&unk_10022A54); @@ -136,7 +136,7 @@ int UNKCALL DirLink_10005F1F(HWND hDlg) { return 0; } Doom_10006C53(v1, (int *)&unk_10022A40); Doom_10006C53(v1, (int *)&unk_10022A38); Doom_10006C53(v1, (int *)&unk_10022A2C); - v2 = (_DWORD *)GetWindowLongA(v1, -21); + v2 = (DWORD *)GetWindowLongA(v1, -21); local_10007F72(v2); Title_100100E7(v1); return Focus_10007818(v1); @@ -175,7 +175,7 @@ int UNKCALL DirLink_10005F7B(HWND hWnd) { return 0; } DirLink_10006073(v1); return SDlgSetTimer(v1, 3, 2000, 0); } */ -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010412: using guessed type int __stdcall SDlgSetTimer(DWORD, DWORD, DWORD, DWORD); // ref: 0x10006047 int __fastcall DirLink_10006047(int a1, int a2) { return 0; } @@ -191,8 +191,8 @@ int __fastcall DirLink_10006047(int a1, int a2) { return 0; } Fade_100072BE(10); return SDlgEndDialog(v3, v2); } */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); +// 10010418: using guessed type int __stdcall SDlgKillTimer(DWORD, DWORD); // ref: 0x10006073 void UNKCALL DirLink_10006073(void *arg) { return; } @@ -209,7 +209,7 @@ void UNKCALL DirLink_10006073(void *arg) { return; } DirLink_10006047(v1, 1); } } */ -// 10010430: using guessed type int __stdcall SNetJoinGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010430: using guessed type int __stdcall SNetJoinGame(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 10029738: using guessed type int dword_10029738; // 10029844: using guessed type int gnDlinkPlayerid; @@ -267,7 +267,7 @@ int UNKCALL DirLink_10006141(void *arg) { return 0; } memset(&v6, 0, 0x10u); v6 = 16; v7 = 1396916812; - v8 = *(_DWORD *)(dword_1002984C + 24); + v8 = *(DWORD *)(dword_1002984C + 24); v9 = 0; result = CreaDung_100051D8( (int)&v6, @@ -317,8 +317,8 @@ int UNKCALL DirLink_100061E1(void *arg) { return 0; } } return SelYesNo_1000FD39(v1, v2, 0, 0); } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); -// 10010430: using guessed type int __stdcall SNetJoinGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); +// 10010430: using guessed type int __stdcall SNetJoinGame(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 10029738: using guessed type int dword_10029738; // 10029844: using guessed type int gnDlinkPlayerid; @@ -346,8 +346,8 @@ int UNKCALL DirLink_100062BF(void *arg, int a2, char *a3, char *a4) { return 0; } return result; } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); -// 10010436: using guessed type int __stdcall SNetEnumGames(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); +// 10010436: using guessed type int __stdcall SNetEnumGames(DWORD, DWORD, DWORD, DWORD); // 10029738: using guessed type int dword_10029738; // ref: 0x1000632B diff --git a/DiabloUI/disclaim.cpp b/DiabloUI/disclaim.cpp index 6c4cfd9c..ddbe3c1b 100644 --- a/DiabloUI/disclaim.cpp +++ b/DiabloUI/disclaim.cpp @@ -7,7 +7,7 @@ BOOL __stdcall UiBetaDisclaimer(int a1) SDlgDialogBoxParam(ghUiInst, "DISCLAIMER_DIALOG", v1, disclaim_WndProc, a1); return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x100063DA LRESULT __stdcall disclaim_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) @@ -17,7 +17,7 @@ LRESULT __stdcall disclaim_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP if (Msg > 0x111) { if (Msg != 513 && Msg != 516) { if (Msg == 528) { - if ((_WORD)wParam == 513 || (_WORD)wParam == 516) + if ((WORD)wParam == 513 || (WORD)wParam == 516) disclaim_FadeFromDisclaim(hWnd); } else if (Msg == 2024) { if (!Fade_CheckRange5()) @@ -50,7 +50,7 @@ LABEL_21: disclaim_FadeFromDisclaim(hWnd); return 0; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x100064C9 void __fastcall disclaim_DelDisclaimProcs(HWND hWnd) diff --git a/DiabloUI/doom.cpp b/DiabloUI/doom.cpp index c49cb19a..77c22289 100644 --- a/DiabloUI/doom.cpp +++ b/DiabloUI/doom.cpp @@ -45,8 +45,8 @@ void __fastcall Doom_GetSetWndText(HWND hWnd, int msg, int nFont, int a4) // ref: 0x1000663F void __fastcall Doom_PrintStrWithSpin(HWND hWnd, BOOL a2) { - _DWORD *v3; // eax - _DWORD *v4; // esi + DWORD *v3; // eax + DWORD *v4; // esi char *v5; // ebx int v6; // edi size_t v7; // eax @@ -57,7 +57,7 @@ void __fastcall Doom_PrintStrWithSpin(HWND hWnd, BOOL a2) char *v12; // [esp+108h] [ebp-Ch] int v14; // [esp+110h] [ebp-4h] - v3 = (_DWORD *)GetWindowLongA(hWnd, -21); + v3 = (DWORD *)GetWindowLongA(hWnd, -21); v4 = v3; if (v3 && *v3) { GetWindowTextA(hWnd, String, 255); @@ -103,23 +103,23 @@ void __fastcall Doom_AllocAndSetBMP(HWND hWnd, int a2, int bmp_flags) // ref: 0x1000678A void __fastcall Doom_GetWindowROP3(HWND hWnd1, HWND hWnd2) { - _DWORD *v3; // ebx + DWORD *v3; // ebx LONG v4; // eax MAPDST struct tagRECT Rect; // [esp+Ch] [ebp-14h] - v3 = (_DWORD *)GetWindowLongA(hWnd1, -21); + v3 = (DWORD *)GetWindowLongA(hWnd1, -21); v4 = GetWindowLongA(hWnd2, -21); if (v3 && *v3 && v4) { - if (*(_DWORD *)v4) { + if (*(DWORD *)v4) { GetWindowRect(hWnd2, &Rect); ScreenToClient(hWnd1, (LPPOINT)&Rect); ScreenToClient(hWnd1, (LPPOINT)&Rect.right); SBltROP3( *(void **)v4, (void *)(Rect.left + *v3 + Rect.top * v3[1]), - *(_DWORD *)(v4 + 4), - *(_DWORD *)(v4 + 8), - *(_DWORD *)(v4 + 4), + *(DWORD *)(v4 + 4), + *(DWORD *)(v4 + 8), + *(DWORD *)(v4 + 4), v3[1], 0, 0xCC0020u); @@ -201,13 +201,13 @@ void __fastcall Doom_GetSetWndTxt3(HWND hWnd, int msg, int nFont) // ref: 0x1000695D void __fastcall Doom_PrintStrWithSpn2(HWND hWnd, int justify_type) { - _DWORD *v2; // eax - _DWORD *v3; // esi + DWORD *v2; // eax + DWORD *v3; // esi char *v4; // edi int v5; // eax char String[256]; // [esp+4h] [ebp-108h] - v2 = (_DWORD *)GetWindowLongA(hWnd, -21); + v2 = (DWORD *)GetWindowLongA(hWnd, -21); v3 = v2; if (v2 && *v2) { GetWindowTextA(hWnd, String, 255); @@ -306,7 +306,7 @@ void __fastcall Doom_PrintTextMsg403(HWND hWnd) v2 = (BYTE *)GetWindowLongA(hWnd, -21); pWidthBin = v2; - if (v2 && *(_DWORD *)v2) { + if (v2 && *(DWORD *)v2) { GetWindowTextA(hWnd, String, 255); v14 = strlen(String); v3 = Focus_GetSpinWidthOrZero(); @@ -324,7 +324,7 @@ void __fastcall Doom_PrintTextMsg403(HWND hWnd) if (v12) String[v14 - 1] = 124; // *(&v9 + v14) = 124; v8 = artfont_GetFontMaxHeight(); - artfont_PrintFontStr(i, (DWORD **)pWidthBin, v4, (*((_DWORD *)pWidthBin + 2) - v8) / 2); + artfont_PrintFontStr(i, (DWORD **)pWidthBin, v4, (*((DWORD *)pWidthBin + 2) - v8) / 2); } } diff --git a/DiabloUI/entdial.cpp b/DiabloUI/entdial.cpp index 99931961..a150fe25 100644 --- a/DiabloUI/entdial.cpp +++ b/DiabloUI/entdial.cpp @@ -53,8 +53,8 @@ int __stdcall EntDial_10006C96(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam } return SDlgDefDialogProc(hDlg, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10006D78 HWND UNKCALL EntDial_10006D78(HWND hDlg) { return 0; } @@ -102,7 +102,7 @@ HWND USERCALL EntDial_10006DB8(HWND hWnd, int a2) { return 0; } return Modem_10008563(v6, (const char *)&v9, (int)&v8); } */ // 10006DB8: could not find valid save-restore pair for ebp -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010412: using guessed type int __stdcall SDlgSetTimer(DWORD, DWORD, DWORD, DWORD); // ref: 0x10006EA7 int __fastcall EntDial_10006EA7(HWND hDlg, int a2) { return 0; } @@ -122,8 +122,8 @@ int __fastcall EntDial_10006EA7(HWND hDlg, int a2) { return 0; } lpString[31] = 0; return SDlgEndDialog(v3, v2); } */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); +// 10010418: using guessed type int __stdcall SDlgKillTimer(DWORD, DWORD); // ref: 0x10006EE8 void __fastcall EntDial_10006EE8(HWND hWnd, unsigned int a2, int a3) { return; } diff --git a/DiabloUI/entname.cpp b/DiabloUI/entname.cpp index 17142484..d6887826 100644 --- a/DiabloUI/entname.cpp +++ b/DiabloUI/entname.cpp @@ -55,7 +55,7 @@ LRESULT __stdcall EntName_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000709E void __fastcall EntName_DelEntNameMsgs(HWND hWnd) diff --git a/DiabloUI/fade.cpp b/DiabloUI/fade.cpp index c386fe3b..014035a2 100644 --- a/DiabloUI/fade.cpp +++ b/DiabloUI/fade.cpp @@ -63,7 +63,7 @@ void __fastcall Fade_UpdatePaletteRange(int range) GetPaletteEntries(v6, 0xAu, 0xAu, &fadepal[246]); SDrawUpdatePalette(0, 0x100u, fadepal, 1); } -// 1001043C: using guessed type int __stdcall SDrawClearSurface(_DWORD); +// 1001043C: using guessed type int __stdcall SDrawClearSurface(DWORD); // ref: 0x1000739F BOOL __cdecl Fade_CheckRange5() diff --git a/DiabloUI/focus.cpp b/DiabloUI/focus.cpp index 4d667eab..bde3b973 100644 --- a/DiabloUI/focus.cpp +++ b/DiabloUI/focus.cpp @@ -21,7 +21,7 @@ int __cdecl Focus_GetSpinWidthOrZero() // ref: 0x10007492 void __fastcall Focus_BlitSpinner(HWND hWnd1, HWND hWnd2) { - _DWORD *v2; // edi + DWORD *v2; // edi LONG v3; // eax MAPDST int v5; // eax MAPDST int v7; // eax @@ -29,10 +29,10 @@ void __fastcall Focus_BlitSpinner(HWND hWnd1, HWND hWnd2) char *v9; // [esp+18h] [ebp-8h] v9 = (char *)hWnd1; - v2 = (_DWORD *)GetWindowLongA(hWnd1, -21); + v2 = (DWORD *)GetWindowLongA(hWnd1, -21); v3 = GetWindowLongA(hWnd2, -21); if (v2 && v3 && *v2) { - if (*(_DWORD *)v3) { + if (*(DWORD *)v3) { GetWindowRect(hWnd2, &Rect); ScreenToClient((HWND)v9, (LPPOINT)&Rect); ScreenToClient((HWND)v9, (LPPOINT)&Rect.right); @@ -40,8 +40,8 @@ void __fastcall Focus_BlitSpinner(HWND hWnd1, HWND hWnd2) *(void **)v3, (void *)(Rect.left + *v2 + Rect.top * v2[1]), focus_spin_width, - *(_DWORD *)(v3 + 8), - *(_DWORD *)(v3 + 4), + *(DWORD *)(v3 + 8), + *(DWORD *)(v3 + 4), v2[1], 0, 0xCC0020u); @@ -49,10 +49,10 @@ void __fastcall Focus_BlitSpinner(HWND hWnd1, HWND hWnd2) v7 = *v2 + Rect.top * v5; v9 = *(char **)(v3 + 4); SBltROP3( - &v9[*(_DWORD *)v3 - focus_spin_width], + &v9[*(DWORD *)v3 - focus_spin_width], &v9[v7 - focus_spin_width + Rect.left], focus_spin_width, - *(_DWORD *)(v3 + 8), + *(DWORD *)(v3 + 8), (int)v9, v5, 0, diff --git a/DiabloUI/local.cpp b/DiabloUI/local.cpp index c96ccfd1..2a7ba654 100644 --- a/DiabloUI/local.cpp +++ b/DiabloUI/local.cpp @@ -57,7 +57,7 @@ void __cdecl local_ClearSurface() { SDrawClearSurface(0); } -// 1001043C: using guessed type int __stdcall SDrawClearSurface(_DWORD); +// 1001043C: using guessed type int __stdcall SDrawClearSurface(DWORD); // ref: 0x100078BE BOOL __fastcall local_LoadArtImage(const char *pszFileName, BYTE **pBuffer, DWORD *pdwSize) @@ -122,7 +122,7 @@ BOOL __fastcall local_LoadArtWithPal(HWND hWnd, int a2, char *src, int mask, int } return 1; } -// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(_DWORD, _DWORD, _DWORD, _DWORD); +// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(DWORD, DWORD, DWORD, DWORD); // ref: 0x10007A68 void __fastcall local_AdjustRectSize(tagRECT *pRect, int a2, int a3) @@ -247,8 +247,8 @@ void __fastcall local_DlgDoPaint(HWND hWnd) SDlgBeginPaint(hWnd, v2); SDlgEndPaint(hWnd, v2); } -// 10010442: using guessed type int __stdcall SDlgEndPaint(_DWORD, _DWORD); -// 10010448: using guessed type int __stdcall SDlgBeginPaint(_DWORD, _DWORD); +// 10010442: using guessed type int __stdcall SDlgEndPaint(DWORD, DWORD); +// 10010448: using guessed type int __stdcall SDlgBeginPaint(DWORD, DWORD); // ref: 0x10007CB5 void __fastcall local_DoUiWndProc(HWND hWnd, DWORD *pdwMsgTbl) @@ -414,7 +414,7 @@ DWORD *__cdecl local_AllocWndLongData() result[1] = 0; result[2] = 0; result[3] = 0; - *((_BYTE *)result + 16) = 0; + *((BYTE *)result + 16) = 0; } return result; } @@ -435,9 +435,9 @@ void __fastcall local_SetWndLongStr(int WndLongData, const char *pszStr) if (WndLongData) { if (pszStr) { strncpy((char *)(WndLongData + 16), pszStr, 0xFFu); - *(_BYTE *)(WndLongData + 271) = 0; + *(BYTE *)(WndLongData + 271) = 0; } else { - *(_BYTE *)(WndLongData + 16) = 0; + *(BYTE *)(WndLongData + 16) = 0; } } } @@ -503,14 +503,14 @@ void __cdecl local_SetCursorArt() local_LoadArtCursor(); SDlgSetSystemCursor(gpCursorArt2, gpCursorArt, (int *)gdwCursData, 32512); } -// 1001044E: using guessed type int __stdcall SDlgSetSystemCursor(_DWORD, _DWORD, _DWORD, _DWORD); +// 1001044E: using guessed type int __stdcall SDlgSetSystemCursor(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000811B void __cdecl local_SetCursorDefault() { SDlgSetSystemCursor(0, 0, 0, 32512); } -// 1001044E: using guessed type int __stdcall SDlgSetSystemCursor(_DWORD, _DWORD, _DWORD, _DWORD); +// 1001044E: using guessed type int __stdcall SDlgSetSystemCursor(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000812B void __fastcall local_SetDiabloCursor(HWND hWnd) @@ -523,4 +523,4 @@ void __fastcall local_SetDiabloCursor(HWND hWnd) v2 = LoadCursorA(ghUiInst, "DIABLOCURSOR"); SDlgSetCursor(hWnd, v2, 32512, &v3); } -// 10010454: using guessed type int __stdcall SDlgSetCursor(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010454: using guessed type int __stdcall SDlgSetCursor(DWORD, DWORD, DWORD, DWORD); diff --git a/DiabloUI/mainmenu.cpp b/DiabloUI/mainmenu.cpp index 3295300b..fa3a2f45 100644 --- a/DiabloUI/mainmenu.cpp +++ b/DiabloUI/mainmenu.cpp @@ -26,7 +26,7 @@ BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSo *pdwResult = v5; return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // 1002A118: using guessed type int menu_item_timer; // ref: 0x100081E3 @@ -93,7 +93,7 @@ LRESULT __stdcall MainMenu_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // 10029728: using guessed type int app_is_active; // ref: 0x10008354 diff --git a/DiabloUI/modem.cpp b/DiabloUI/modem.cpp index 71ee376a..fb72e259 100644 --- a/DiabloUI/modem.cpp +++ b/DiabloUI/modem.cpp @@ -61,7 +61,7 @@ BOOL Modem_10008606() { return 0; } result = 0; return result; } */ -// 10010436: using guessed type int __stdcall SNetEnumGames(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010436: using guessed type int __stdcall SNetEnumGames(DWORD, DWORD, DWORD, DWORD); // 1002A150: using guessed type int dword_1002A150; // ref: 0x1000863D @@ -116,7 +116,7 @@ int UNKCALL Modem_1000865F(char *arg) { return 0; } } */ // ref: 0x10008680 -BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid) { return 0; } +BOOL __fastcall Modem_10008680(int a1, int a2, int a3, DWORD *a4, int a5, int playerid) { return 0; } /* { int v6; // esi @@ -130,7 +130,7 @@ BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int p artfont_100010C8(); return v6 == 1; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A138: using guessed type int dword_1002A138; // 1002A13C: using guessed type int dword_1002A13C; // 1002A140: using guessed type int gnModemPlayerid; @@ -183,20 +183,20 @@ int __stdcall Modem_100086DE(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) PostMessageA(hWnd, 0x7E8u, 0, 0); return 0; } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000879E void **UNKCALL Modem_1000879E(HWND hDlg) { return 0; } /* { HWND v1; // esi - _DWORD *v2; // eax + DWORD *v2; // eax v1 = hDlg; Doom_10006C53(hDlg, (int *)&unk_10022C5C); Doom_10006C53(v1, (int *)&unk_10022C54); Doom_10006C53(v1, (int *)&unk_10022C4C); - v2 = (_DWORD *)GetWindowLongA(v1, -21); + v2 = (DWORD *)GetWindowLongA(v1, -21); local_10007F72(v2); return Title_100100E7(v1); } */ @@ -259,8 +259,8 @@ int Modem_10008888() { return 0; } } return result; } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); -// 10010436: using guessed type int __stdcall SNetEnumGames(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); +// 10010436: using guessed type int __stdcall SNetEnumGames(DWORD, DWORD, DWORD, DWORD); // 1002A124: using guessed type int dword_1002A124; // 1002A130: using guessed type int dword_1002A130; // 1002A134: using guessed type int dword_1002A134; @@ -285,7 +285,7 @@ int UNKCALL Modem_100088DB(HWND hWnd) { return 0; } return PostMessageA(v1, 0xBD1u, 0, 0); return SelHero_1000C3E2((int)v1, 2); } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // ref: 0x1000893D int UNKCALL Modem_1000893D(HWND hWnd) { return 0; } @@ -309,7 +309,7 @@ int UNKCALL Modem_1000893D(HWND hWnd) { return 0; } memset(&v8, 0, 0x10u); v8 = 16; v9 = 1297040461; - v2 = *(_DWORD *)(dword_1002A138 + 24); + v2 = *(DWORD *)(dword_1002A138 + 24); v11 = 0; v10 = v2; LoadStringA(hInstance, 0x47u, &Buffer, 31); @@ -339,7 +339,7 @@ int UNKCALL Modem_1000893D(HWND hWnd) { return 0; } } return result; } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); // 1002A124: using guessed type int dword_1002A124; // 1002A130: using guessed type int dword_1002A130; // 1002A138: using guessed type int dword_1002A138; @@ -429,8 +429,8 @@ void __cdecl Modem_10008B42(char *a1) { return; } dword_1002A148 = 1; _endthread(); } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); -// 10010430: using guessed type int __stdcall SNetJoinGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); +// 10010430: using guessed type int __stdcall SNetJoinGame(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 10011E20: using guessed type int _endthread(void); // 1002A120: using guessed type int dword_1002A120; // 1002A124: using guessed type int dword_1002A124; @@ -452,7 +452,7 @@ int UNKCALL Modem_10008BB7(HWND hWnd) { return 0; } result = PostMessageA(v1, 0xBD0u, 0, 0); return result; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // ref: 0x10008BFE int UNKCALL Modem_10008BFE(HWND hWnd) { return 0; } @@ -473,5 +473,5 @@ int UNKCALL Modem_10008BFE(HWND hWnd) { return 0; } dword_1002A124 = 0; return PostMessageA(v1, 0xBD0u, 0, 0); } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A124: using guessed type int dword_1002A124; diff --git a/DiabloUI/modmstat.cpp b/DiabloUI/modmstat.cpp index 77286a4b..44a85c9f 100644 --- a/DiabloUI/modmstat.cpp +++ b/DiabloUI/modmstat.cpp @@ -17,7 +17,7 @@ int UNKCALL ModmStat_10008C87(void *arg) { return 0; } /* { return SDlgDialogBoxParam(hInstance, "MODMSTAT_DIALOG", arg, ModmStat_10008CA0, 0); } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // ref: 0x10008CA0 int __stdcall ModmStat_10008CA0(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { return 0; } @@ -53,7 +53,7 @@ int __stdcall ModmStat_10008CA0(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara Focus_10007458((void *)lParam); Focus_100075DC(hWnd, (HWND)lParam); } - else if ( (_WORD)wParam == 1 || (_WORD)wParam == 2 ) + else if ( (WORD)wParam == 1 || (WORD)wParam == 2 ) { ModmStat_10008E89((int)hWnd, 1); } @@ -74,8 +74,8 @@ int __stdcall ModmStat_10008CA0(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara } return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // 1002A258: using guessed type int dword_1002A258; // 1002A25C: using guessed type int dword_1002A25C; @@ -83,10 +83,10 @@ int __stdcall ModmStat_10008CA0(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara int UNKCALL ModmStat_10008DB3(HWND hDlg) { return 0; } /* { HWND v1; // esi - _DWORD *v2; // eax + DWORD *v2; // eax v1 = hDlg; - v2 = (_DWORD *)GetWindowLongA(hDlg, -21); + v2 = (DWORD *)GetWindowLongA(hDlg, -21); local_10007F72(v2); Focus_100076C3(); Doom_10006C53(v1, (int *)&unk_10022CB4); @@ -123,7 +123,7 @@ BOOL UNKCALL ModmStat_10008DE4(HWND hWnd) { return 0; } dword_1002A25C = 0; return result; } */ -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010412: using guessed type int __stdcall SDlgSetTimer(DWORD, DWORD, DWORD, DWORD); // 1002A258: using guessed type int dword_1002A258; // 1002A25C: using guessed type int dword_1002A25C; // 1002A260: using guessed type int (*dword_1002A260)(void); @@ -151,8 +151,8 @@ int __fastcall ModmStat_10008E89(int a1, int a2) { return 0; } return result; } */ // 1002A260: invalid function type has been ignored -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); +// 10010418: using guessed type int __stdcall SDlgKillTimer(DWORD, DWORD); // 1002A25C: using guessed type int dword_1002A25C; // 1002A260: using guessed type int (*dword_1002A260)(void); diff --git a/DiabloUI/okcancel.cpp b/DiabloUI/okcancel.cpp index 72c69cec..0af11dfc 100644 --- a/DiabloUI/okcancel.cpp +++ b/DiabloUI/okcancel.cpp @@ -103,7 +103,7 @@ LRESULT __stdcall OkCancel_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP SDlgEndDialog(hWnd, (HANDLE)0xFF000000); return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10009117 void __fastcall OkCancel_FreeDlgBmp(HWND hWnd) @@ -191,7 +191,7 @@ BOOL __fastcall OkCancel_LoadOkCancGFX(HWND hWnd, DWORD *lParam) } return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x100092F5 void __fastcall OkCancel_PlaySndEndDlg(HWND hWnd, int a2) diff --git a/DiabloUI/progress.cpp b/DiabloUI/progress.cpp index dccfcf8b..bf74670a 100644 --- a/DiabloUI/progress.cpp +++ b/DiabloUI/progress.cpp @@ -30,7 +30,7 @@ BOOL __stdcall UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc) } return result; } */ -// 1001045A: using guessed type int __stdcall SDlgCreateDialogParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 1001045A: using guessed type int __stdcall SDlgCreateDialogParam(DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A2E8: using guessed type int dword_1002A2E8; // 1002A2F0: using guessed type int dword_1002A2F0; // 1002A2F4: using guessed type int (*dword_1002A2F4)(void); @@ -67,7 +67,7 @@ int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara ShowCursor(TRUE); return 1; case 0x111u: - if ( (_WORD)wParam == 2 ) + if ( (WORD)wParam == 2 ) { SDlgKillTimer(hWnd, 1); v4 = GetParent(hWnd); @@ -84,9 +84,9 @@ int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara } return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); +// 10010418: using guessed type int __stdcall SDlgKillTimer(DWORD, DWORD); // ref: 0x100095EC void *Progress_100095EC() { return 0; } @@ -121,7 +121,7 @@ void *Progress_100095EC() { return 0; } } return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // 1002A318: using guessed type int dword_1002A318; // 1002A31C: using guessed type int dword_1002A31C; // 1002A320: using guessed type int dword_1002A320; @@ -175,11 +175,11 @@ BOOL __fastcall Progress_10009675(HWND hWnd, const CHAR *a2) { return 0; } ShowWindow(v6, bEnable != 0); return EnableWindow(v6, bEnable); } */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); -// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010400: using guessed type int __stdcall SDlgSetBitmapI(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); +// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(DWORD, DWORD, DWORD, DWORD); +// 10010400: using guessed type int __stdcall SDlgSetBitmapI(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); +// 10010412: using guessed type int __stdcall SDlgSetTimer(DWORD, DWORD, DWORD, DWORD); // 1002A2F0: using guessed type int dword_1002A2F0; // 1002A300: using guessed type int dword_1002A300; // 1002A304: using guessed type int dword_1002A304; @@ -225,7 +225,7 @@ BOOL __fastcall Progress_10009805(HWND hWnd, int a2) { return 0; } ScreenToClient(v2, (LPPOINT)&Rect.right); return InvalidateRect(v2, &Rect, 0); } */ -// 100103F4: using guessed type int __stdcall SBltROP3(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 100103F4: using guessed type int __stdcall SBltROP3(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A300: using guessed type int dword_1002A300; // 1002A304: using guessed type int dword_1002A304; // 1002A308: using guessed type int dword_1002A308; @@ -267,8 +267,8 @@ void UNKCALL Progress_100098C5(HWND hWnd) { return; } Progress_10009805(v1, v2); } } */ -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); +// 10010418: using guessed type int __stdcall SDlgKillTimer(DWORD, DWORD); // 1002A2E8: using guessed type int dword_1002A2E8; // 1002A2F4: using guessed type int (*dword_1002A2F4)(void); @@ -309,6 +309,6 @@ LABEL_12: dword_1002A2F8 = 0; return result; } */ -// 10010460: using guessed type _DWORD __stdcall SDlgUpdateCursor(); -// 10010466: using guessed type _DWORD __stdcall SDlgCheckTimers(); +// 10010460: using guessed type DWORD __stdcall SDlgUpdateCursor(); +// 10010466: using guessed type DWORD __stdcall SDlgCheckTimers(); // 1002A2F8: using guessed type int dword_1002A2F8; diff --git a/DiabloUI/sbar.cpp b/DiabloUI/sbar.cpp index c460bac5..7bd009dd 100644 --- a/DiabloUI/sbar.cpp +++ b/DiabloUI/sbar.cpp @@ -21,8 +21,8 @@ BOOL __fastcall Sbar_CheckIfNextHero(HWND hWnd) // ref: 0x100099DC int __fastcall Sbar_NumScrollLines(HWND hWnd, int width, int height) { - _DWORD *v4; // eax - _DWORD *v5; // esi + DWORD *v4; // eax + DWORD *v5; // esi int result; // eax signed int v7; // ecx LONG v8; // ebx @@ -36,7 +36,7 @@ int __fastcall Sbar_NumScrollLines(HWND hWnd, int width, int height) return 0; if (!IsWindowVisible(hWnd)) return 0; - v4 = (_DWORD *)GetWindowLongA(hWnd, -21); + v4 = (DWORD *)GetWindowLongA(hWnd, -21); v5 = v4; if (!v4) return 0; @@ -89,60 +89,60 @@ void __fastcall Sbar_DrawScrollBar(HWND hWnd, int nIDDlgItem, int width, int hei if (v4) { v5 = GetWindowLongA(v4, -21); if (v5) { - if (*(_DWORD *)(v5 + 4)) { - v7 = *(_DWORD *)(v5 + 16) == 0; - *(_DWORD *)(v5 + 52) = width; - *(_DWORD *)(v5 + 56) = height; + if (*(DWORD *)(v5 + 4)) { + v7 = *(DWORD *)(v5 + 16) == 0; + *(DWORD *)(v5 + 52) = width; + *(DWORD *)(v5 + 56) = height; if (!v7) { SrcBuffer.left = 0; DstRect.left = 0; SrcBuffer.top = 0; DstRect.top = 0; - DstRect.right = *(_DWORD *)(v5 + 8) - 1; - DstRect.bottom = *(_DWORD *)(v5 + 12) - 1; - SrcBuffer.right = *(_DWORD *)(v5 + 8) - 1; - SrcBuffer.bottom = *(_DWORD *)(v5 + 24) - 1; + DstRect.right = *(DWORD *)(v5 + 8) - 1; + DstRect.bottom = *(DWORD *)(v5 + 12) - 1; + SrcBuffer.right = *(DWORD *)(v5 + 8) - 1; + SrcBuffer.bottom = *(DWORD *)(v5 + 24) - 1; SBltROP3Tiled( *(void **)(v5 + 4), &DstRect, *(POINT **)(v5 + 8), - *(_DWORD *)(v5 + 16), + *(DWORD *)(v5 + 16), &SrcBuffer, *(RECT **)(v5 + 20), 0, 0, 0, 0xCC0020u); - if (*(_DWORD *)(v5 + 28)) { + if (*(DWORD *)(v5 + 28)) { if (width <= 1) v8 = 22; else - v8 = height * (*(_DWORD *)(v5 + 12) - *(_DWORD *)(v5 + 36) - 44) / (width - 1) + 22; + v8 = height * (*(DWORD *)(v5 + 12) - *(DWORD *)(v5 + 36) - 44) / (width - 1) + 22; SBltROP3( - (void *)(v8 * *(_DWORD *)(v5 + 8) + *(_DWORD *)(v5 + 4) + 3), + (void *)(v8 * *(DWORD *)(v5 + 8) + *(DWORD *)(v5 + 4) + 3), *(void **)(v5 + 28), 18, - *(_DWORD *)(v5 + 36), - *(_DWORD *)(v5 + 8), - *(_DWORD *)(v5 + 32), + *(DWORD *)(v5 + 36), + *(DWORD *)(v5 + 8), + *(DWORD *)(v5 + 32), 0, 0xCC0020u); SBltROP3( *(void **)(v5 + 4), - (void *)(*(_DWORD *)(v5 + 40) + 22 * (~*(_BYTE *)v5 & 1) * *(_DWORD *)(v5 + 44)), - *(_DWORD *)(v5 + 8), + (void *)(*(DWORD *)(v5 + 40) + 22 * (~*(BYTE *)v5 & 1) * *(DWORD *)(v5 + 44)), + *(DWORD *)(v5 + 8), 22, - *(_DWORD *)(v5 + 8), - *(_DWORD *)(v5 + 44), + *(DWORD *)(v5 + 8), + *(DWORD *)(v5 + 44), 0, 0xCC0020u); SBltROP3( - (void *)(*(_DWORD *)(v5 + 4) + *(_DWORD *)(v5 + 8) * (*(_DWORD *)(v5 + 12) - 22)), - (void *)(*(_DWORD *)(v5 + 40) + 22 * ((~*(_BYTE *)v5 & 4 | 8u) >> 2) * *(_DWORD *)(v5 + 44)), - *(_DWORD *)(v5 + 8), + (void *)(*(DWORD *)(v5 + 4) + *(DWORD *)(v5 + 8) * (*(DWORD *)(v5 + 12) - 22)), + (void *)(*(DWORD *)(v5 + 40) + 22 * ((~*(BYTE *)v5 & 4 | 8u) >> 2) * *(DWORD *)(v5 + 44)), + *(DWORD *)(v5 + 8), 22, - *(_DWORD *)(v5 + 8), - *(_DWORD *)(v5 + 44), + *(DWORD *)(v5 + 8), + *(DWORD *)(v5 + 44), 0, 0xCC0020u); InvalidateRect(hWnda, 0, 0); @@ -194,7 +194,7 @@ void __cdecl Sbar_cpp_init2() void __fastcall Sbar_FreeScrollBar(HWND hWnd, int nIDDlgItem) { HWND v2; // eax MAPDST - _DWORD *v4; // eax MAPDST + DWORD *v4; // eax MAPDST void *v6; // eax void *v7; // eax void *v8; // eax @@ -202,7 +202,7 @@ void __fastcall Sbar_FreeScrollBar(HWND hWnd, int nIDDlgItem) v2 = GetDlgItem(hWnd, nIDDlgItem); if (v2) { - v4 = (_DWORD *)GetWindowLongA(v2, -21); + v4 = (DWORD *)GetWindowLongA(v2, -21); if (v4) { v6 = (void *)v4[1]; if (v6) diff --git a/DiabloUI/selclass.cpp b/DiabloUI/selclass.cpp index 89ec9c77..235931f7 100644 --- a/DiabloUI/selclass.cpp +++ b/DiabloUI/selclass.cpp @@ -50,9 +50,9 @@ LRESULT __stdcall SelClass_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } else { if (HIWORD(wParam) != 6) { v5 = 1; - if (HIWORD(wParam) == 5 || (_WORD)wParam == 1) + if (HIWORD(wParam) == 5 || (WORD)wParam == 1) goto LABEL_19; - if ((_WORD)wParam != 2) + if ((WORD)wParam != 2) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); goto LABEL_21; } @@ -62,7 +62,7 @@ LRESULT __stdcall SelClass_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10009EC0 void __fastcall SelClass_FreeClassMsgTbl(HWND hWnd) diff --git a/DiabloUI/selconn.cpp b/DiabloUI/selconn.cpp index 413264fd..68f08def 100644 --- a/DiabloUI/selconn.cpp +++ b/DiabloUI/selconn.cpp @@ -3,7 +3,7 @@ void *SelConn_1000A082() { return 0; } /* { return SMemAlloc(272, "C:\\Src\\Diablo\\DiabloUI\\SelConn.cpp", 124, 0); } */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000A09B signed int SelConn_1000A09B() { return 0; } @@ -81,7 +81,7 @@ LABEL_25: { SelConn_1000AC30(hWnd); } - else if ( (_WORD)wParam == 2 ) + else if ( (WORD)wParam == 2 ) { SelConn_1000AC07((int)hWnd, 2); } @@ -95,8 +95,8 @@ LABEL_27: } return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000A226 HWND __fastcall SelConn_1000A226(HWND hDlg, int nIDDlgItem) { return 0; } @@ -129,7 +129,7 @@ HWND __fastcall SelConn_1000A226(HWND hDlg, int nIDDlgItem) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - v4 = *((_DWORD *)result + 3); + v4 = *((DWORD *)result + 3); if ( v4 ) { result = GetDlgItem(v2, 1081); @@ -144,18 +144,18 @@ HWND __fastcall SelConn_1000A226(HWND hDlg, int nIDDlgItem) { return 0; } LoadStringA(hInstance, 0x21u, &Buffer, 63); if ( dword_1002A370 ) { - v7 = *(_DWORD *)(dword_1002A370 + 24); - if ( v7 >= *(_DWORD *)(v4 + 12) ) - v7 = *(_DWORD *)(v4 + 12); + v7 = *(DWORD *)(dword_1002A370 + 24); + if ( v7 >= *(DWORD *)(v4 + 12) ) + v7 = *(DWORD *)(v4 + 12); wsprintfA(&v21, &Buffer, v7); } else { - wsprintfA(&v21, &Buffer, *(_DWORD *)(v4 + 12)); + wsprintfA(&v21, &Buffer, *(DWORD *)(v4 + 12)); } v8 = GetWindowLongA(v6, -21); local_10007FA4(v8, &v21); - if ( *(_DWORD *)(v4 + 8) == 1112425812 ) + if ( *(DWORD *)(v4 + 8) == 1112425812 ) { hWnd = GetDlgItem(v2, 1144); v9 = BNetGW_10002B21(&unk_10029480, dword_1002948C); @@ -216,8 +216,8 @@ int SelConn_1000A3FF() { return 0; } /* { HWND v0; // eax LONG v1; // eax - _DWORD *v2; // ecx - _DWORD *v3; // eax + DWORD *v2; // ecx + DWORD *v3; // eax int v5; // edx v0 = GetFocus(); @@ -226,10 +226,10 @@ int SelConn_1000A3FF() { return 0; } v1 = GetWindowLongA(v0, -21); if ( !v1 ) return 0; - v2 = (_DWORD *)dword_1002A35C; + v2 = (DWORD *)dword_1002A35C; if ( !dword_1002A35C ) return 0; - v3 = *(_DWORD **)(v1 + 12); + v3 = *(DWORD **)(v1 + 12); if ( !v3 ) return 0; v5 = 0; @@ -237,7 +237,7 @@ int SelConn_1000A3FF() { return 0; } { if ( v2 == v3 ) break; - v2 = (_DWORD *)*v2; + v2 = (DWORD *)*v2; ++v5; } while ( v2 ); @@ -249,36 +249,36 @@ int SelConn_1000A3FF() { return 0; } void UNKCALL SelConn_1000A43A(HWND hDlg) { return; } /* { HWND v1; // esi - _DWORD *v2; // eax + DWORD *v2; // eax v1 = hDlg; Title_100100E7(hDlg); Focus_10007818(v1); Sbar_10009CD2(v1, 1105); - SelConn_1000A4B9((_DWORD *)dword_1002A35C); + SelConn_1000A4B9((DWORD *)dword_1002A35C); Doom_10006C53(v1, &dword_10022F18); Doom_10006C53(v1, (int *)&unk_10022F08); Doom_10006C53(v1, (int *)&unk_10022ED8); Doom_10006C53(v1, (int *)&unk_10022EE4); Doom_10006C53(v1, (int *)&unk_10022F00); Doom_10006C53(v1, (int *)&unk_10022EF0); - v2 = (_DWORD *)GetWindowLongA(v1, -21); + v2 = (DWORD *)GetWindowLongA(v1, -21); local_10007F72(v2); } */ // 10022F18: using guessed type int dword_10022F18; // 1002A35C: using guessed type int dword_1002A35C; // ref: 0x1000A4B9 -int __fastcall SelConn_1000A4B9(_DWORD *a1) { return 0; } +int __fastcall SelConn_1000A4B9(DWORD *a1) { return 0; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi int result; // eax if ( a1 ) { do { - v1 = (_DWORD *)*a1; + v1 = (DWORD *)*a1; result = SelConn_1000A4CD(a1); a1 = v1; } @@ -296,7 +296,7 @@ int UNKCALL SelConn_1000A4CD(void *arg) { return 0; } result = SMemFree(arg, "C:\\Src\\Diablo\\DiabloUI\\SelConn.cpp", 130, 0); return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000A4E4 HWND UNKCALL SelConn_1000A4E4(HWND hWnd, char *a2, int a3) { return 0; } @@ -340,7 +340,7 @@ HWND UNKCALL SelConn_1000A4E4(HWND hWnd, char *a2, int a3) { return 0; } } return result; } */ -// 10010472: using guessed type int __stdcall SNetEnumProviders(_DWORD, _DWORD); +// 10010472: using guessed type int __stdcall SNetEnumProviders(DWORD, DWORD); // 10022F18: using guessed type int dword_10022F18; // 10029488: using guessed type int dword_10029488; // 1002A35C: using guessed type int dword_1002A35C; @@ -351,19 +351,19 @@ signed int __stdcall SelConn_1000A5F3(int a1, char *a2, char *a3, int a4) { retu /* { int v4; // esi int v6; // edx - _DWORD *v7; // eax + DWORD *v7; // eax v4 = SelConn_1000A082(); if ( !v4 || a1 == 1112425812 && !dword_1002A368 ) return 0; - *(_DWORD *)v4 = 0; - v6 = *(_DWORD *)(a4 + 4); - *(_DWORD *)(v4 + 8) = a1; - *(_DWORD *)(v4 + 4) = v6 & 2; - *(_DWORD *)(v4 + 12) = *(_DWORD *)(a4 + 16); + *(DWORD *)v4 = 0; + v6 = *(DWORD *)(a4 + 4); + *(DWORD *)(v4 + 8) = a1; + *(DWORD *)(v4 + 4) = v6 & 2; + *(DWORD *)(v4 + 12) = *(DWORD *)(a4 + 16); strcpy((char *)(v4 + 16), a2); strcpy((char *)(v4 + 144), a3); - v7 = SelRegn_1000EF56(dword_1002A35C, (_DWORD *)v4); + v7 = SelRegn_1000EF56(dword_1002A35C, (DWORD *)v4); ++dword_1002A360; dword_1002A35C = (int)v7; return 1; @@ -398,7 +398,7 @@ int __fastcall SelConn_1000A670(HWND a1, const char *a2) { return 0; } v6 = GetWindowLongA(v5, -21); if ( v6 ) { - *(_DWORD *)(v6 + 12) = v2; + *(DWORD *)(v6 + 12) = v2; local_10007FA4(v6, v2 + 16); v2 = *(const char **)v2; } @@ -593,7 +593,7 @@ HWND UNKCALL SelConn_1000A948(HWND hWnd) { return 0; } HWND v3; // esi HWND v4; // ebx HWND v5; // eax - _DWORD *v6; // eax + DWORD *v6; // eax int v7; // eax const char *v8; // ebx int v9; // eax @@ -611,7 +611,7 @@ HWND UNKCALL SelConn_1000A948(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v5, -21); if ( result ) { - v6 = (_DWORD *)*((_DWORD *)result + 3); + v6 = (DWORD *)*((DWORD *)result + 3); if ( v6 && *v6 ) { v7 = SelConn_1000A9F3(v4) + 6; @@ -642,8 +642,8 @@ HWND UNKCALL SelConn_1000A948(HWND hWnd) { return 0; } int UNKCALL SelConn_1000A9F3(HWND hWnd) { return 0; } /* { LONG v1; // eax - _DWORD *v2; // ecx - _DWORD *v3; // eax + DWORD *v2; // ecx + DWORD *v3; // eax int v5; // edx if ( !hWnd ) @@ -651,10 +651,10 @@ int UNKCALL SelConn_1000A9F3(HWND hWnd) { return 0; } v1 = GetWindowLongA(hWnd, -21); if ( !v1 ) return 0; - v2 = (_DWORD *)dword_1002A35C; + v2 = (DWORD *)dword_1002A35C; if ( !dword_1002A35C ) return 0; - v3 = *(_DWORD **)(v1 + 12); + v3 = *(DWORD **)(v1 + 12); if ( !v3 ) return 0; v5 = 0; @@ -662,7 +662,7 @@ int UNKCALL SelConn_1000A9F3(HWND hWnd) { return 0; } { if ( v2 == v3 ) break; - v2 = (_DWORD *)*v2; + v2 = (DWORD *)*v2; ++v5; } while ( v2 ); @@ -671,14 +671,14 @@ int UNKCALL SelConn_1000A9F3(HWND hWnd) { return 0; } // 1002A35C: using guessed type int dword_1002A35C; // ref: 0x1000AA28 -_DWORD *__fastcall SelConn_1000AA28(int a1) { return 0; } +DWORD *__fastcall SelConn_1000AA28(int a1) { return 0; } /* { - _DWORD *result; // eax + DWORD *result; // eax - result = (_DWORD *)dword_1002A35C; + result = (DWORD *)dword_1002A35C; while ( result && a1 ) { - result = (_DWORD *)*result; + result = (DWORD *)*result; --a1; } return result; @@ -709,7 +709,7 @@ HWND UNKCALL SelConn_1000AA3B(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { if ( result == (HWND)dword_1002A35C ) @@ -757,10 +757,10 @@ HWND UNKCALL SelConn_1000AAEB(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(hWnd, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { - if ( *(_DWORD *)result ) + if ( *(DWORD *)result ) { if ( GetWindowLongA(v1, -12) >= 1074 ) { @@ -771,7 +771,7 @@ HWND UNKCALL SelConn_1000AAEB(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - v4 = (const char *)*((_DWORD *)result + 3); + v4 = (const char *)*((DWORD *)result + 3); if ( v4 ) { TitleSnd_10010315(); @@ -813,7 +813,7 @@ HWND UNKCALL SelConn_1000AB83(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v1, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { v3 = (const char *)dword_1002A35C; @@ -850,7 +850,7 @@ int __fastcall SelConn_1000AC07(int a1, int a2) { return 0; } Fade_100072BE(10); return SDlgEndDialog(v3, v2); } */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); // ref: 0x1000AC30 int UNKCALL SelConn_1000AC30(HWND arg) { return 0; } @@ -897,7 +897,7 @@ LABEL_14: } return result; } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); // 1002A374: using guessed type int dword_1002A374; // ref: 0x1000AC9E @@ -926,7 +926,7 @@ int UNKCALL SelConn_1000AC9E(HWND hWnd) { return 0; } v3 = GetWindowLongA(v2, -21); if ( !v3 ) return 0; - v4 = *(_DWORD *)(v3 + 12); + v4 = *(DWORD *)(v3 + 12); if ( !v4 ) return 0; SelGame_1000B677(*(void **)(v4 + 8)); @@ -961,8 +961,8 @@ int UNKCALL SelConn_1000AC9E(HWND hWnd) { return 0; } SelConn_1000ADD0(v1); return v9; } */ -// 10010478: using guessed type _DWORD __stdcall SNetDestroy(); -// 1001047E: using guessed type int __stdcall SNetInitializeProvider(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010478: using guessed type DWORD __stdcall SNetDestroy(); +// 1001047E: using guessed type int __stdcall SNetInitializeProvider(DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A364: using guessed type int dword_1002A364; // 1002A370: using guessed type int dword_1002A370; @@ -1014,7 +1014,7 @@ int __fastcall SelConn_1000AE19(int a1, UINT a2) { return 0; } } return result; } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); // ref: 0x1000AE59 HWND __fastcall SelConn_1000AE59(HWND hWnd, int a2, int a3) { return 0; } @@ -1137,9 +1137,9 @@ int __stdcall UiSelectProvider(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYE } return 0; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); -// 1001041E: using guessed type int __stdcall SErrSetLastError(_DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); +// 1001041E: using guessed type int __stdcall SErrSetLastError(DWORD); // 1002A364: using guessed type int dword_1002A364; // 1002A36C: using guessed type int dword_1002A36C; // 1002A370: using guessed type int dword_1002A370; diff --git a/DiabloUI/seldial.cpp b/DiabloUI/seldial.cpp index a9313338..e1a0449a 100644 --- a/DiabloUI/seldial.cpp +++ b/DiabloUI/seldial.cpp @@ -111,7 +111,7 @@ int __stdcall SelDial_1000B0CF(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam v6 = 1; if ( wParam != 327681 ) { - if ( (_WORD)wParam != 2 ) + if ( (WORD)wParam != 2 ) return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); v6 = 2; } @@ -120,8 +120,8 @@ int __stdcall SelDial_1000B0CF(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam } return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000B1FB HWND __fastcall SelDial_1000B1FB(HWND hWnd, int a2) { return 0; } @@ -198,8 +198,8 @@ int __fastcall SelDial_1000B2D8(int a1, int a2) { return 0; } strcpy(dword_1002A378, &byte_1002A380[32 * (v5 - 1119)]); return SDlgEndDialog(v3, 4); } */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); +// 10010418: using guessed type int __stdcall SDlgKillTimer(DWORD, DWORD); // ref: 0x1000B354 HWND UNKCALL SelDial_1000B354(HWND hDlg) { return 0; } @@ -238,7 +238,7 @@ HWND UNKCALL SelDial_1000B354(HWND hDlg) { return 0; } } return result; } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); // ref: 0x1000B3D8 HWND UNKCALL SelDial_1000B3D8(HWND hDlg) { return 0; } @@ -367,7 +367,7 @@ HWND USERCALL SelDial_1000B483(HWND hWnd, int a2) { return 0; } return result; } */ // 1000B483: could not find valid save-restore pair for ebp -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010412: using guessed type int __stdcall SDlgSetTimer(DWORD, DWORD, DWORD, DWORD); // 1002A400: using guessed type int dword_1002A400; // ref: 0x1000B5D9 diff --git a/DiabloUI/selgame.cpp b/DiabloUI/selgame.cpp index d970f6de..e5ccf4f8 100644 --- a/DiabloUI/selgame.cpp +++ b/DiabloUI/selgame.cpp @@ -58,20 +58,20 @@ int __stdcall UiSelectGame(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDAT v17 = &v12; v18 = &v8; if ( SelGame_1000B671() ) - return SelIPX_1000C634(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid); + return SelIPX_1000C634(a1, a2, (int)&v16, (DWORD *)a4, a5, playerid); v6 = SelGame_1000B67E(); switch ( v6 ) { case 1230002254: - return SelIPX_1000C634(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid); + return SelIPX_1000C634(a1, a2, (int)&v16, (DWORD *)a4, a5, playerid); case 1297040461: - return Modem_10008680(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid); + return Modem_10008680(a1, a2, (int)&v16, (DWORD *)a4, a5, playerid); case 1396916812: - return DirLink_10005D05(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid); + return DirLink_10005D05(a1, a2, (int)&v16, (DWORD *)a4, a5, playerid); } return SNetSelectGame(a1, a2, &v16, a4, a5, playerid); } */ -// 10010490: using guessed type int __stdcall SNetSelectGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010490: using guessed type int __stdcall SNetSelectGame(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // ref: 0x1000B795 signed int SelGame_1000B795() { return 0; } diff --git a/DiabloUI/selhero.cpp b/DiabloUI/selhero.cpp index b1cf12c8..2fc330b3 100644 --- a/DiabloUI/selhero.cpp +++ b/DiabloUI/selhero.cpp @@ -243,7 +243,7 @@ BOOL __stdcall UiSelHeroMultDialog( *hero_is_created = selhero_is_created; return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // 1002A45C: using guessed type int selhero_is_created; // ref: 0x1000BC46 @@ -324,7 +324,7 @@ LRESULT __stdcall SelHero_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa SelHero_DoHeroSelClass(hWnd); return 0; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // 1002A420: using guessed type int selhero_difficulty; // ref: 0x1000BDAD @@ -742,5 +742,5 @@ BOOL __stdcall UiSelHeroSingDialog( artfont_FreeAllFonts(); return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // 1002A420: using guessed type int selhero_difficulty; diff --git a/DiabloUI/selipx.cpp b/DiabloUI/selipx.cpp index 30de9c83..931c9dca 100644 --- a/DiabloUI/selipx.cpp +++ b/DiabloUI/selipx.cpp @@ -3,7 +3,7 @@ void *SelIPX_1000C610() { return 0; } /* { return SMemAlloc(268, "C:\\Src\\Diablo\\DiabloUI\\SelIPX.cpp", 105, 0); } */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000C629 signed int SelIPX_1000C629() { return 0; } @@ -17,7 +17,7 @@ signed int SelIPX_1000C629() { return 0; } // 1002A4A4: using guessed type int dword_1002A4A4; // ref: 0x1000C634 -BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid) { return 0; } +BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, DWORD *a4, int a5, int playerid) { return 0; } /* { int v6; // esi @@ -31,7 +31,7 @@ BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int artfont_100010C8(); return v6 == 1; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A49C: using guessed type int dword_1002A49C; // 1002A4A8: using guessed type int gnIpxPlayerid; // 1002A4AC: using guessed type int dword_1002A4AC; @@ -105,7 +105,7 @@ LABEL_35: { SelIPX_1000D3C5(hWnd, (int)&savedregs); } - else if ( (_WORD)wParam == 2 ) + else if ( (WORD)wParam == 2 ) { SelIPX_1000D3A0((int)hWnd, 2); } @@ -119,8 +119,8 @@ LABEL_12: } return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000C818 LONG __fastcall SelIPX_1000C818(HWND hDlg, int nIDDlgItem) { return 0; } @@ -151,11 +151,11 @@ LONG __fastcall SelIPX_1000C818(HWND hDlg, int nIDDlgItem) { return 0; } result = GetWindowLongA(v3, -21); if ( result ) { - result = *(_DWORD *)(result + 12); + result = *(DWORD *)(result + 12); if ( result ) { v5 = (const char *)(result + 140); - if ( *(_DWORD *)(result + 4) ) + if ( *(DWORD *)(result + 4) ) { if ( result == -140 || strlen((const char *)(result + 140)) < 0x10 ) { @@ -212,8 +212,8 @@ int SelIPX_1000C99F() { return 0; } /* { HWND v0; // eax LONG v1; // eax - _DWORD *v2; // ecx - _DWORD *v3; // eax + DWORD *v2; // ecx + DWORD *v3; // eax int v5; // edx v0 = GetFocus(); @@ -222,10 +222,10 @@ int SelIPX_1000C99F() { return 0; } v1 = GetWindowLongA(v0, -21); if ( !v1 ) return 0; - v2 = (_DWORD *)dword_1002A4B4; + v2 = (DWORD *)dword_1002A4B4; if ( !dword_1002A4B4 ) return 0; - v3 = *(_DWORD **)(v1 + 12); + v3 = *(DWORD **)(v1 + 12); if ( !v3 ) return 0; v5 = 0; @@ -233,7 +233,7 @@ int SelIPX_1000C99F() { return 0; } { if ( v2 == v3 ) break; - v2 = (_DWORD *)*v2; + v2 = (DWORD *)*v2; ++v5; } while ( v2 ); @@ -253,9 +253,9 @@ const char *UNKCALL SelIPX_1000C9DA(HWND hDlg) { return 0; } v1 = hDlg; dword_1002A4B0 = 0; - SelIPX_1000CA64((_DWORD *)dword_1002A4B4); + SelIPX_1000CA64((DWORD *)dword_1002A4B4); SNetEnumGames(0, 0, SelIPX_1000CAD5, 0); - result = (const char *)SelIPX_1000CA71((_DWORD *)dword_1002A4B4); + result = (const char *)SelIPX_1000CA71((DWORD *)dword_1002A4B4); dword_1002A4B4 = (int)result; if ( dword_1002A4B0 ) { @@ -270,46 +270,46 @@ const char *UNKCALL SelIPX_1000C9DA(HWND hDlg) { return 0; } } return result; } */ -// 10010436: using guessed type int __stdcall SNetEnumGames(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010436: using guessed type int __stdcall SNetEnumGames(DWORD, DWORD, DWORD, DWORD); // 1002A4B0: using guessed type int dword_1002A4B0; // 1002A4B4: using guessed type int dword_1002A4B4; // ref: 0x1000CA64 -void __fastcall SelIPX_1000CA64(_DWORD *a1) { return; } +void __fastcall SelIPX_1000CA64(DWORD *a1) { return; } /* { while ( a1 ) { a1[2] = 0; - a1 = (_DWORD *)*a1; + a1 = (DWORD *)*a1; } } */ // ref: 0x1000CA71 -_DWORD **__fastcall SelIPX_1000CA71(_DWORD *a1) { return 0; } +DWORD **__fastcall SelIPX_1000CA71(DWORD *a1) { return 0; } /* { - _DWORD **v1; // edi - _DWORD *v2; // esi + DWORD **v1; // edi + DWORD *v2; // esi - v1 = (_DWORD **)a1; + v1 = (DWORD **)a1; v2 = 0; while ( a1 ) { if ( a1[2] || !a1[1] ) { v2 = a1; - a1 = (_DWORD *)*a1; + a1 = (DWORD *)*a1; } else { if ( v2 ) *v2 = *a1; else - v1 = (_DWORD **)*a1; + v1 = (DWORD **)*a1; SelIPX_1000CAC1(a1); --dword_1002A4B8; dword_1002A4B0 = 1; if ( v2 ) - a1 = (_DWORD *)*v2; + a1 = (DWORD *)*v2; else a1 = *v1; } @@ -327,17 +327,17 @@ int UNKCALL SelIPX_1000CAC1(void *arg) { return 0; } result = SMemFree(arg, "C:\\Src\\Diablo\\DiabloUI\\SelIPX.cpp", 110, 0); return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000CAD5 void *__stdcall SelIPX_1000CAD5(int a1, char *a2, char *a3) { return 0; } /* { - _DWORD *v3; // eax + DWORD *v3; // eax int result; // eax int v5; // esi - _DWORD *v6; // eax + DWORD *v6; // eax - v3 = SelIPX_1000CB73((_DWORD *)dword_1002A4B4, a1); + v3 = SelIPX_1000CB73((DWORD *)dword_1002A4B4, a1); if ( v3 ) { v3[2] = 1; @@ -348,12 +348,12 @@ void *__stdcall SelIPX_1000CAD5(int a1, char *a2, char *a3) { return 0; } v5 = result; if ( !result ) return result; - *(_DWORD *)result = 0; - *(_DWORD *)(result + 4) = a1; - *(_DWORD *)(result + 8) = 1; + *(DWORD *)result = 0; + *(DWORD *)(result + 4) = a1; + *(DWORD *)(result + 8) = 1; strcpy((char *)(result + 12), a2); strcpy((char *)(v5 + 140), a3); - v6 = SelIPX_1000CB50((_DWORD *)dword_1002A4B4, (_DWORD *)v5); + v6 = SelIPX_1000CB50((DWORD *)dword_1002A4B4, (DWORD *)v5); ++dword_1002A4B8; dword_1002A4B4 = (int)v6; dword_1002A4B0 = 1; @@ -364,15 +364,15 @@ void *__stdcall SelIPX_1000CAD5(int a1, char *a2, char *a3) { return 0; } // 1002A4B4: using guessed type int dword_1002A4B4; // ref: 0x1000CB50 -_DWORD *__fastcall SelIPX_1000CB50(_DWORD *a1, _DWORD *a2) { return 0; } +DWORD *__fastcall SelIPX_1000CB50(DWORD *a1, DWORD *a2) { return 0; } /* { - _DWORD *result; // eax - _DWORD *v3; // edi - _DWORD *i; // esi + DWORD *result; // eax + DWORD *v3; // edi + DWORD *i; // esi result = a1; v3 = 0; - for ( i = a1; i; i = (_DWORD *)*i ) + for ( i = a1; i; i = (DWORD *)*i ) v3 = i; *a2 = i; if ( !v3 ) @@ -382,11 +382,11 @@ _DWORD *__fastcall SelIPX_1000CB50(_DWORD *a1, _DWORD *a2) { return 0; } } */ // ref: 0x1000CB73 -_DWORD *__fastcall SelIPX_1000CB73(_DWORD *a1, int a2) { return 0; } +DWORD *__fastcall SelIPX_1000CB73(DWORD *a1, int a2) { return 0; } /* { - _DWORD *result; // eax + DWORD *result; // eax - for ( result = a1; result && result[1] != a2; result = (_DWORD *)*result ) + for ( result = a1; result && result[1] != a2; result = (DWORD *)*result ) ; return result; } */ @@ -419,7 +419,7 @@ int __fastcall SelIPX_1000CB83(HWND a1, const char *a2) { return 0; } v6 = GetWindowLongA(v4, -21); if ( v6 ) { - *(_DWORD *)(v6 + 12) = v8; + *(DWORD *)(v6 + 12) = v8; local_10007FA4(v6, v8 + 12); } v8 = *(const char **)v8; @@ -432,7 +432,7 @@ int __fastcall SelIPX_1000CB83(HWND a1, const char *a2) { return 0; } v5 = GetWindowLongA(v4, -21); if ( v5 ) { - *(_DWORD *)(v5 + 12) = 0; + *(DWORD *)(v5 + 12) = 0; local_10007FA4(v5, &byte_10029448); } } @@ -449,10 +449,10 @@ int __fastcall SelIPX_1000CB83(HWND a1, const char *a2) { return 0; } int UNKCALL SelIPX_1000CC41(HWND hDlg) { return 0; } /* { HWND v1; // esi - _DWORD *v2; // eax + DWORD *v2; // eax v1 = hDlg; - SelIPX_1000CCC5((_DWORD *)dword_1002A4B4); + SelIPX_1000CCC5((DWORD *)dword_1002A4B4); dword_1002A4B4 = 0; Sbar_10009CD2(v1, 1105); Doom_10006C53(v1, &dword_10023118); @@ -460,27 +460,27 @@ int UNKCALL SelIPX_1000CC41(HWND hDlg) { return 0; } Doom_10006C53(v1, (int *)&unk_10023104); Doom_10006C53(v1, (int *)&unk_100230FC); Doom_10006C53(v1, (int *)&unk_100230F0); - v2 = (_DWORD *)GetWindowLongA(v1, -21); + v2 = (DWORD *)GetWindowLongA(v1, -21); local_10007F72(v2); Title_100100E7(v1); Focus_10007818(v1); return SDrawClearSurface(); } */ -// 1001043C: using guessed type _DWORD __stdcall SDrawClearSurface(); +// 1001043C: using guessed type DWORD __stdcall SDrawClearSurface(); // 10023118: using guessed type int dword_10023118; // 1002A4B4: using guessed type int dword_1002A4B4; // ref: 0x1000CCC5 -int __fastcall SelIPX_1000CCC5(_DWORD *a1) { return 0; } +int __fastcall SelIPX_1000CCC5(DWORD *a1) { return 0; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi int result; // eax if ( a1 ) { do { - v1 = (_DWORD *)*a1; + v1 = (DWORD *)*a1; result = SelIPX_1000CAC1(a1); a1 = v1; } @@ -564,9 +564,9 @@ HWND UNKCALL SelIPX_1000CD4A(HWND hWnd) { return 0; } if ( v6 ) { ++dword_1002A4B8; - *(_DWORD *)(v6 + 4) = 0; - *(_BYTE *)(dword_1002A4B4 + 140) = 0; - *(_DWORD *)dword_1002A4B4 = 0; + *(DWORD *)(v6 + 4) = 0; + *(BYTE *)(dword_1002A4B4 + 140) = 0; + *(DWORD *)dword_1002A4B4 = 0; LoadStringA(hInstance, 0x24u, (LPSTR)(dword_1002A4B4 + 12), 127); LoadStringA(hInstance, 0x2Au, (LPSTR)(dword_1002A4B4 + 140), 127); } @@ -581,8 +581,8 @@ HWND UNKCALL SelIPX_1000CD4A(HWND hWnd) { return 0; } } return result; } */ -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010436: using guessed type int __stdcall SNetEnumGames(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010412: using guessed type int __stdcall SDlgSetTimer(DWORD, DWORD, DWORD, DWORD); +// 10010436: using guessed type int __stdcall SNetEnumGames(DWORD, DWORD, DWORD, DWORD); // 10023118: using guessed type int dword_10023118; // 1002A4B4: using guessed type int dword_1002A4B4; @@ -746,7 +746,7 @@ HWND UNKCALL SelIPX_1000D0E1(HWND hWnd) { return 0; } HWND v3; // esi HWND v4; // ebx HWND v5; // eax - _DWORD *v6; // eax + DWORD *v6; // eax int v7; // eax const char *v8; // ebx int v9; // eax @@ -764,7 +764,7 @@ HWND UNKCALL SelIPX_1000D0E1(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v5, -21); if ( result ) { - v6 = (_DWORD *)*((_DWORD *)result + 3); + v6 = (DWORD *)*((DWORD *)result + 3); if ( v6 && *v6 ) { v7 = SelIPX_1000D18C(v4) + 6; @@ -795,8 +795,8 @@ HWND UNKCALL SelIPX_1000D0E1(HWND hWnd) { return 0; } int UNKCALL SelIPX_1000D18C(HWND hWnd) { return 0; } /* { LONG v1; // eax - _DWORD *v2; // ecx - _DWORD *v3; // eax + DWORD *v2; // ecx + DWORD *v3; // eax int v5; // edx if ( !hWnd ) @@ -804,10 +804,10 @@ int UNKCALL SelIPX_1000D18C(HWND hWnd) { return 0; } v1 = GetWindowLongA(hWnd, -21); if ( !v1 ) return 0; - v2 = (_DWORD *)dword_1002A4B4; + v2 = (DWORD *)dword_1002A4B4; if ( !dword_1002A4B4 ) return 0; - v3 = *(_DWORD **)(v1 + 12); + v3 = *(DWORD **)(v1 + 12); if ( !v3 ) return 0; v5 = 0; @@ -815,7 +815,7 @@ int UNKCALL SelIPX_1000D18C(HWND hWnd) { return 0; } { if ( v2 == v3 ) break; - v2 = (_DWORD *)*v2; + v2 = (DWORD *)*v2; ++v5; } while ( v2 ); @@ -824,14 +824,14 @@ int UNKCALL SelIPX_1000D18C(HWND hWnd) { return 0; } // 1002A4B4: using guessed type int dword_1002A4B4; // ref: 0x1000D1C1 -_DWORD *__fastcall SelIPX_1000D1C1(int a1) { return 0; } +DWORD *__fastcall SelIPX_1000D1C1(int a1) { return 0; } /* { - _DWORD *result; // eax + DWORD *result; // eax - result = (_DWORD *)dword_1002A4B4; + result = (DWORD *)dword_1002A4B4; while ( result && a1 ) { - result = (_DWORD *)*result; + result = (DWORD *)*result; --a1; } return result; @@ -862,7 +862,7 @@ HWND UNKCALL SelIPX_1000D1D4(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { if ( result == (HWND)dword_1002A4B4 ) @@ -910,10 +910,10 @@ HWND UNKCALL SelIPX_1000D284(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(hWnd, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { - if ( *(_DWORD *)result ) + if ( *(DWORD *)result ) { if ( GetWindowLongA(v1, -12) >= 1093 ) { @@ -924,7 +924,7 @@ HWND UNKCALL SelIPX_1000D284(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - v4 = (const char *)*((_DWORD *)result + 3); + v4 = (const char *)*((DWORD *)result + 3); if ( v4 ) { TitleSnd_10010315(); @@ -966,7 +966,7 @@ HWND UNKCALL SelIPX_1000D31C(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v1, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { v3 = (const char *)dword_1002A4B4; @@ -1002,8 +1002,8 @@ int __fastcall SelIPX_1000D3A0(int a1, int a2) { return 0; } Fade_100072BE(10); return SDlgEndDialog(v3, v2); } */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); +// 10010418: using guessed type int __stdcall SDlgKillTimer(DWORD, DWORD); // ref: 0x1000D3C5 HWND USERCALL SelIPX_1000D3C5(HWND hDlg, int a2) { return 0; } @@ -1034,9 +1034,9 @@ HWND USERCALL SelIPX_1000D3C5(HWND hDlg, int a2) { return 0; } result = (HWND)GetWindowLongA(v4, -21); if ( result ) { - v6 = *((_DWORD *)result + 3); + v6 = *((DWORD *)result + 3); TitleSnd_1001031F(); - if ( *(_DWORD *)(v6 + 4) ) + if ( *(DWORD *)(v6 + 4) ) { result = (HWND)SelIPX_1000D5B0((int)v2, v6); } @@ -1051,7 +1051,7 @@ HWND USERCALL SelIPX_1000D3C5(HWND hDlg, int a2) { return 0; } memset(&v13, 0, 0x10u); v13 = 16; v14 = 1230002254; - v8 = *(_DWORD *)(dword_1002A4AC + 24); + v8 = *(DWORD *)(dword_1002A4AC + 24); v16 = 0; v15 = v8; v9 = GetFocus(); @@ -1168,7 +1168,7 @@ int __fastcall SelIPX_1000D5B0(int a1, int a2) { return 0; } Connect_10004028((int)&v9, 128, (int)&v7, 128); if ( UiAuthCallback(2, (int)&v9, &v7, 0, (char *)(v2 + 140), &v6, 256) ) { - if ( SNetJoinGame(*(_DWORD *)(v2 + 4), v2 + 12, 0, &v9, &v7, gnIpxPlayerid) ) + if ( SNetJoinGame(*(DWORD *)(v2 + 4), v2 + 12, 0, &v9, &v7, gnIpxPlayerid) ) return SelIPX_1000D3A0(v10, 1); if ( SErrGetLastError() == -2062548871 ) LoadStringA(hInstance, 0x32u, &Buffer, 127); @@ -1183,8 +1183,8 @@ int __fastcall SelIPX_1000D5B0(int a1, int a2) { return 0; } } return SelYesNo_1000FD39(v10, v3, 0, 0); } */ -// 10010406: using guessed type _DWORD __stdcall SErrGetLastError(); -// 10010430: using guessed type int __stdcall SNetJoinGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 10010406: using guessed type DWORD __stdcall SErrGetLastError(); +// 10010430: using guessed type int __stdcall SNetJoinGame(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A4A8: using guessed type int gnIpxPlayerid; // ref: 0x1000D696 diff --git a/DiabloUI/sellist.cpp b/DiabloUI/sellist.cpp index d98ca20a..9cbfac88 100644 --- a/DiabloUI/sellist.cpp +++ b/DiabloUI/sellist.cpp @@ -42,9 +42,9 @@ LRESULT __stdcall SelList_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa } if (HIWORD(wParam) != 6) { v6 = 1; - if (HIWORD(wParam) != 5 && (_WORD)wParam != 1) { + if (HIWORD(wParam) != 5 && (WORD)wParam != 1) { v6 = 2; - if ((_WORD)wParam != 2) + if ((WORD)wParam != 2) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } LABEL_25: @@ -61,7 +61,7 @@ LRESULT __stdcall SelList_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa SelList_DeleteFreeProcs(hWnd); return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); case 6u: - if ((_WORD)wParam == 1 || (_WORD)wParam == 2) + if ((WORD)wParam == 1 || (WORD)wParam == 2) SelList_LoadFocus16(hWnd); else SelList_KillFocus16(hWnd); @@ -87,7 +87,7 @@ LRESULT __stdcall SelList_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa SelList_ShowListWindow(hWnd); return 0; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000D916 void __fastcall SelList_DeleteFreeProcs(HWND hWnd) @@ -265,7 +265,7 @@ void __fastcall SelList_SetHeroDlgLong(HWND hWnd, _uiheroinfo *pInfo) v6 = GetWindowLongA(v4, -21); local_SetWndLongStr(v6, pInfo->name); if (v6) - *(_DWORD *)(v6 + 12) = (unsigned int)pInfo; + *(DWORD *)(v6 + 12) = (unsigned int)pInfo; pInfo = pInfo->next; } else { EnableWindow(v4, 0); diff --git a/DiabloUI/selload.cpp b/DiabloUI/selload.cpp index cd87186e..4e21b7f9 100644 --- a/DiabloUI/selload.cpp +++ b/DiabloUI/selload.cpp @@ -50,9 +50,9 @@ LRESULT __stdcall SelLoad_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa } else { if (HIWORD(wParam) != 6) { v5 = 1; - if (HIWORD(wParam) == 5 || (_WORD)wParam == 1) + if (HIWORD(wParam) == 5 || (WORD)wParam == 1) goto LABEL_19; - if ((_WORD)wParam != 2) + if ((WORD)wParam != 2) return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); goto LABEL_21; } @@ -61,7 +61,7 @@ LRESULT __stdcall SelLoad_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000E30E void __fastcall SelLoad_DeleteProcsAndSpin(HWND hWnd) diff --git a/DiabloUI/selmodem.cpp b/DiabloUI/selmodem.cpp index 69f44ebc..84c5e55c 100644 --- a/DiabloUI/selmodem.cpp +++ b/DiabloUI/selmodem.cpp @@ -28,7 +28,7 @@ int __fastcall SelModem_1000E435(void *a1, int a2, int a3, char *a4, char *a5) { return SelModem_1000E51E(); return SelModem_1000E5CC(); } */ -// 10010496: using guessed type int __stdcall SNetEnumDevices(_DWORD); +// 10010496: using guessed type int __stdcall SNetEnumDevices(DWORD); // 1002A4D0: using guessed type int dword_1002A4D0; // 1002A4DC: using guessed type int dword_1002A4DC; // 1002A4E0: using guessed type int dword_1002A4E0; @@ -39,17 +39,17 @@ char *__stdcall SelModem_1000E497(int a1, char *a2, char *a3) { return 0; } /* { int result; // eax int v4; // esi - _DWORD *v5; // eax + DWORD *v5; // eax result = SelModem_1000E4EC(); v4 = result; if ( result ) { - *(_DWORD *)result = 0; - *(_DWORD *)(result + 4) = a1; + *(DWORD *)result = 0; + *(DWORD *)(result + 4) = a1; strcpy((char *)(result + 8), a2); strcpy((char *)(v4 + 136), a3); - v5 = SelModem_1000E500(dword_1002A4DC, (_DWORD *)v4); + v5 = SelModem_1000E500(dword_1002A4DC, (DWORD *)v4); ++dword_1002A4D8; dword_1002A4DC = (int)v5; result = 1; @@ -63,12 +63,12 @@ void *SelModem_1000E4EC() { return 0; } /* { return SMemAlloc(264, "C:\\Src\\Diablo\\DiabloUI\\SelModem.cpp", 72, 0); } */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000E500 -_DWORD *__fastcall SelModem_1000E500(int a1, _DWORD *a2) { return 0; } +DWORD *__fastcall SelModem_1000E500(int a1, DWORD *a2) { return 0; } /* { - _DWORD *result; // eax + DWORD *result; // eax result = a2; *a2 = a1; @@ -83,16 +83,16 @@ signed int UNKCALL SelModem_1000E505(void *arg) { return 0; } SErrSetLastError(1222); return 0; } */ -// 1001041E: using guessed type int __stdcall SErrSetLastError(_DWORD); +// 1001041E: using guessed type int __stdcall SErrSetLastError(DWORD); // ref: 0x1000E51E signed int SelModem_1000E51E() { return 0; } /* { signed int result; // eax - if ( SelModem_1000E57B(*((_DWORD *)dword_1002A4D4 + 2), *(_DWORD *)(dword_1002A4DC + 4)) ) + if ( SelModem_1000E57B(*((DWORD *)dword_1002A4D4 + 2), *(DWORD *)(dword_1002A4DC + 4)) ) { - SelModem_1000E553((_DWORD *)dword_1002A4DC); + SelModem_1000E553((DWORD *)dword_1002A4DC); result = 1; } else @@ -102,20 +102,20 @@ signed int SelModem_1000E51E() { return 0; } } return result; } */ -// 1001041E: using guessed type int __stdcall SErrSetLastError(_DWORD); +// 1001041E: using guessed type int __stdcall SErrSetLastError(DWORD); // 1002A4DC: using guessed type int dword_1002A4DC; // ref: 0x1000E553 -int __fastcall SelModem_1000E553(_DWORD *a1) { return 0; } +int __fastcall SelModem_1000E553(DWORD *a1) { return 0; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi int result; // eax if ( a1 ) { do { - v1 = (_DWORD *)*a1; + v1 = (DWORD *)*a1; result = SelModem_1000E567(a1); a1 = v1; } @@ -133,7 +133,7 @@ int UNKCALL SelModem_1000E567(void *arg) { return 0; } result = SMemFree(arg, "C:\\Src\\Diablo\\DiabloUI\\SelModem.cpp", 77, 0); return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000E57B int __fastcall SelModem_1000E57B(int a1, int a2) { return 0; } @@ -152,7 +152,7 @@ int __fastcall SelModem_1000E57B(int a1, int a2) { return 0; } v6 = v3; return SNetInitializeDevice(v2, dword_1002A4E0, dword_1002A4E8, &v5, dword_1002A4D0); } */ -// 1001049C: using guessed type int __stdcall SNetInitializeDevice(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +// 1001049C: using guessed type int __stdcall SNetInitializeDevice(DWORD, DWORD, DWORD, DWORD, DWORD); // 1002A4D0: using guessed type int dword_1002A4D0; // 1002A4E0: using guessed type int dword_1002A4E0; // 1002A4E8: using guessed type int dword_1002A4E8; @@ -164,26 +164,26 @@ signed int SelModem_1000E5CC() { return 0; } signed int result; // eax v0 = 1; - if ( SDlgDialogBoxParam(hInstance, "SELMODEM_DIALOG", *((_DWORD *)dword_1002A4D4 + 2), SelModem_1000E63E, 0) == 1 ) + if ( SDlgDialogBoxParam(hInstance, "SELMODEM_DIALOG", *((DWORD *)dword_1002A4D4 + 2), SelModem_1000E63E, 0) == 1 ) { - if ( !SelModem_1000E57B(*((_DWORD *)dword_1002A4D4 + 2), dword_1002A4E4) ) + if ( !SelModem_1000E57B(*((DWORD *)dword_1002A4D4 + 2), dword_1002A4E4) ) { SErrSetLastError(-2062548879); v0 = 0; } - SelModem_1000E553((_DWORD *)dword_1002A4DC); + SelModem_1000E553((DWORD *)dword_1002A4DC); result = v0; } else { - SelModem_1000E553((_DWORD *)dword_1002A4DC); + SelModem_1000E553((DWORD *)dword_1002A4DC); SErrSetLastError(1223); result = 0; } return result; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 1001041E: using guessed type int __stdcall SErrSetLastError(_DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); +// 1001041E: using guessed type int __stdcall SErrSetLastError(DWORD); // 1002A4DC: using guessed type int dword_1002A4DC; // 1002A4E4: using guessed type int dword_1002A4E4; @@ -254,7 +254,7 @@ LABEL_25: v4 = 1; if ( wParam != 327681 ) { - if ( (_WORD)wParam != 2 ) + if ( (WORD)wParam != 2 ) return SDlgDefDialogProc(hDlg, Msg, wParam, lParam); v4 = 2; } @@ -262,14 +262,14 @@ LABEL_25: } return SDlgDefDialogProc(hDlg, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000E783 void UNKCALL SelModem_1000E783(HWND hDlg) { return; } /* { HWND v1; // esi - _DWORD *v2; // eax + DWORD *v2; // eax v1 = hDlg; Sbar_10009CD2(hDlg, 1105); @@ -280,7 +280,7 @@ void UNKCALL SelModem_1000E783(HWND hDlg) { return; } Doom_10006C53(v1, (int *)&unk_100231E0); Focus_10007818(v1); local_1000811B(); - v2 = (_DWORD *)GetWindowLongA(v1, -21); + v2 = (DWORD *)GetWindowLongA(v1, -21); local_10007F72(v2); } */ // 100231F4: using guessed type int dword_100231F4; @@ -302,8 +302,8 @@ HWND UNKCALL SelModem_1000E7E9(HWND hDlg) { return 0; } int UNKCALL SelModem_1000E80E(HWND hWnd) { return 0; } /* { LONG v1; // eax - _DWORD *v2; // ecx - _DWORD *v3; // eax + DWORD *v2; // ecx + DWORD *v3; // eax int v5; // edx if ( !hWnd ) @@ -311,10 +311,10 @@ int UNKCALL SelModem_1000E80E(HWND hWnd) { return 0; } v1 = GetWindowLongA(hWnd, -21); if ( !v1 ) return 0; - v2 = (_DWORD *)dword_1002A4DC; + v2 = (DWORD *)dword_1002A4DC; if ( !dword_1002A4DC ) return 0; - v3 = *(_DWORD **)(v1 + 12); + v3 = *(DWORD **)(v1 + 12); if ( !v3 ) return 0; v5 = 0; @@ -322,7 +322,7 @@ int UNKCALL SelModem_1000E80E(HWND hWnd) { return 0; } { if ( v2 == v3 ) break; - v2 = (_DWORD *)*v2; + v2 = (DWORD *)*v2; ++v5; } while ( v2 ); @@ -398,7 +398,7 @@ int __fastcall SelModem_1000E932(HWND a1, const char *a2) { return 0; } v6 = GetWindowLongA(v5, -21); local_10007FA4(v6, v2 + 8); if ( v6 ) - *(_DWORD *)(v6 + 12) = v2; + *(DWORD *)(v6 + 12) = v2; v2 = *(const char **)v2; } else @@ -590,7 +590,7 @@ HWND UNKCALL SelModem_1000EC0E(HWND hWnd) { return 0; } HWND v2; // edi HWND v3; // ebx HWND v4; // eax - _DWORD *v5; // eax + DWORD *v5; // eax int v6; // eax const char *v7; // esi @@ -606,7 +606,7 @@ HWND UNKCALL SelModem_1000EC0E(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v4, -21); if ( result ) { - v5 = (_DWORD *)*((_DWORD *)result + 3); + v5 = (DWORD *)*((DWORD *)result + 3); if ( v5 && *v5 ) { v6 = SelModem_1000E80E(v3) + 6; @@ -632,14 +632,14 @@ HWND UNKCALL SelModem_1000EC0E(HWND hWnd) { return 0; } } */ // ref: 0x1000EC9F -_DWORD *__fastcall SelModem_1000EC9F(int a1) { return 0; } +DWORD *__fastcall SelModem_1000EC9F(int a1) { return 0; } /* { - _DWORD *result; // eax + DWORD *result; // eax - result = (_DWORD *)dword_1002A4DC; + result = (DWORD *)dword_1002A4DC; while ( result && a1 ) { - result = (_DWORD *)*result; + result = (DWORD *)*result; --a1; } return result; @@ -667,7 +667,7 @@ HWND UNKCALL SelModem_1000ECB2(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { if ( result == (HWND)dword_1002A4DC ) @@ -711,10 +711,10 @@ HWND UNKCALL SelModem_1000ED3B(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(hWnd, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { - if ( *(_DWORD *)result ) + if ( *(DWORD *)result ) { if ( GetWindowLongA(v1, -12) >= 1115 ) { @@ -725,7 +725,7 @@ HWND UNKCALL SelModem_1000ED3B(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - v4 = (const char *)*((_DWORD *)result + 3); + v4 = (const char *)*((DWORD *)result + 3); if ( v4 ) { TitleSnd_10010315(); @@ -762,7 +762,7 @@ HWND UNKCALL SelModem_1000EDBC(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v1, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { v3 = (const char *)dword_1002A4DC; @@ -802,9 +802,9 @@ int __fastcall SelModem_1000EE29(int a1, int a2) { return 0; } v5 = GetWindowLongA(v4, -21); if ( v5 ) { - v6 = *(_DWORD *)(v5 + 12); + v6 = *(DWORD *)(v5 + 12); if ( v6 ) - dword_1002A4E4 = *(_DWORD *)(v6 + 4); + dword_1002A4E4 = *(DWORD *)(v6 + 4); } } } @@ -812,7 +812,7 @@ int __fastcall SelModem_1000EE29(int a1, int a2) { return 0; } Fade_100072BE(10); return SDlgEndDialog(v3, v2); } */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); +// 10010376: using guessed type int __stdcall SDlgEndDialog(DWORD, DWORD); // 1002A4E4: using guessed type int dword_1002A4E4; // ref: 0x1000EE78 diff --git a/DiabloUI/selregn.cpp b/DiabloUI/selregn.cpp index fd53f474..9bad3c3c 100644 --- a/DiabloUI/selregn.cpp +++ b/DiabloUI/selregn.cpp @@ -3,7 +3,7 @@ void *SelRegn_1000EF42() { return 0; } /* { return SMemAlloc(136, "C:\\Src\\Diablo\\DiabloUI\\SelRegn.cpp", 76, 0); } */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010364: using guessed type int __stdcall SMemAlloc(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000EF56 _uiheroinfo *__fastcall SelRegn_SetNextHero(_uiheroinfo *pNext, _uiheroinfo *pCurrent) @@ -88,7 +88,7 @@ LABEL_25: { SelRegn_1000F8DD(hWnd); } - else if ( (_WORD)wParam == 2 ) + else if ( (WORD)wParam == 2 ) { SelConn_1000AC07((int)hWnd, 2); } @@ -102,8 +102,8 @@ LABEL_27: } return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); } */ -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000F0D7 HWND __fastcall SelRegn_1000F0D7(HWND hDlg, int nIDDlgItem) { return 0; } @@ -118,7 +118,7 @@ HWND __fastcall SelRegn_1000F0D7(HWND hDlg, int nIDDlgItem) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - if ( *((_DWORD *)result + 3) ) + if ( *((DWORD *)result + 3) ) result = (HWND)Doom_10006A13(v2, (int *)&unk_10023250, 1); } } @@ -141,8 +141,8 @@ int SelRegn_1000F126() { return 0; } /* { HWND v0; // eax LONG v1; // eax - _DWORD *v2; // ecx - _DWORD *v3; // eax + DWORD *v2; // ecx + DWORD *v3; // eax int v5; // edx v0 = GetFocus(); @@ -151,10 +151,10 @@ int SelRegn_1000F126() { return 0; } v1 = GetWindowLongA(v0, -21); if ( !v1 ) return 0; - v2 = (_DWORD *)dword_1002A4EC; + v2 = (DWORD *)dword_1002A4EC; if ( !dword_1002A4EC ) return 0; - v3 = *(_DWORD **)(v1 + 12); + v3 = *(DWORD **)(v1 + 12); if ( !v3 ) return 0; v5 = 0; @@ -162,7 +162,7 @@ int SelRegn_1000F126() { return 0; } { if ( v2 == v3 ) break; - v2 = (_DWORD *)*v2; + v2 = (DWORD *)*v2; ++v5; } while ( v2 ); @@ -174,35 +174,35 @@ int SelRegn_1000F126() { return 0; } void UNKCALL SelRegn_1000F161(HWND hDlg) { return; } /* { HWND v1; // esi - _DWORD *v2; // eax + DWORD *v2; // eax v1 = hDlg; Title_100100E7(hDlg); Focus_10007818(v1); Sbar_10009CD2(v1, 1105); - SelRegn_1000F1D4((_DWORD *)dword_1002A4EC); + SelRegn_1000F1D4((DWORD *)dword_1002A4EC); Doom_10006C53(v1, &dword_1002326C); Doom_10006C53(v1, (int *)&unk_10023260); Doom_10006C53(v1, (int *)&unk_10023244); Doom_10006C53(v1, (int *)&unk_10023258); Doom_10006C53(v1, (int *)&unk_10023250); - v2 = (_DWORD *)GetWindowLongA(v1, -21); + v2 = (DWORD *)GetWindowLongA(v1, -21); local_10007F72(v2); } */ // 1002326C: using guessed type int dword_1002326C; // 1002A4EC: using guessed type int dword_1002A4EC; // ref: 0x1000F1D4 -int __fastcall SelRegn_1000F1D4(_DWORD *a1) { return 0; } +int __fastcall SelRegn_1000F1D4(DWORD *a1) { return 0; } /* { - _DWORD *v1; // esi + DWORD *v1; // esi int result; // eax if ( a1 ) { do { - v1 = (_DWORD *)*a1; + v1 = (DWORD *)*a1; result = SelRegn_1000F1E8(a1); a1 = v1; } @@ -220,7 +220,7 @@ int UNKCALL SelRegn_1000F1E8(void *arg) { return 0; } result = SMemFree(arg, "C:\\Src\\Diablo\\DiabloUI\\SelRegn.cpp", 82, 0); return result; } */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +// 10010340: using guessed type int __stdcall SMemFree(DWORD, DWORD, DWORD, DWORD); // ref: 0x1000F1FC HWND UNKCALL SelRegn_1000F1FC(HWND hWnd) { return 0; } @@ -272,7 +272,7 @@ signed int SelRegn_1000F2ED() { return 0; } char *v1; // eax char *v2; // esi const char *v3; // eax - _DWORD *v4; // eax + DWORD *v4; // eax for ( i = dword_10029488; ; --i ) { @@ -282,8 +282,8 @@ signed int SelRegn_1000F2ED() { return 0; } v2 = v1; if ( !v1 ) break; - *(_DWORD *)v1 = 0; - *((_DWORD *)v1 + 1) = i; + *(DWORD *)v1 = 0; + *((DWORD *)v1 + 1) = i; v3 = BNetGW_10002B21(&unk_10029480, i); strcpy(v2 + 8, v3); v4 = SelRegn_1000EF56(dword_1002A4EC, v2); @@ -322,7 +322,7 @@ int __fastcall SelRegn_1000F346(HWND a1, const char *a2) { return 0; } v6 = GetWindowLongA(v5, -21); if ( v6 ) { - *(_DWORD *)(v6 + 12) = v2; + *(DWORD *)(v6 + 12) = v2; local_10007FA4(v6, v2 + 8); v2 = *(const char **)v2; } @@ -517,7 +517,7 @@ HWND UNKCALL SelRegn_1000F61E(HWND hWnd) { return 0; } HWND v3; // esi HWND v4; // ebx HWND v5; // eax - _DWORD *v6; // eax + DWORD *v6; // eax int v7; // eax const char *v8; // ebx int v9; // eax @@ -535,7 +535,7 @@ HWND UNKCALL SelRegn_1000F61E(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v5, -21); if ( result ) { - v6 = (_DWORD *)*((_DWORD *)result + 3); + v6 = (DWORD *)*((DWORD *)result + 3); if ( v6 && *v6 ) { v7 = SelRegn_1000F6C9(v4) + 6; @@ -566,8 +566,8 @@ HWND UNKCALL SelRegn_1000F61E(HWND hWnd) { return 0; } int UNKCALL SelRegn_1000F6C9(HWND hWnd) { return 0; } /* { LONG v1; // eax - _DWORD *v2; // ecx - _DWORD *v3; // eax + DWORD *v2; // ecx + DWORD *v3; // eax int v5; // edx if ( !hWnd ) @@ -575,10 +575,10 @@ int UNKCALL SelRegn_1000F6C9(HWND hWnd) { return 0; } v1 = GetWindowLongA(hWnd, -21); if ( !v1 ) return 0; - v2 = (_DWORD *)dword_1002A4EC; + v2 = (DWORD *)dword_1002A4EC; if ( !dword_1002A4EC ) return 0; - v3 = *(_DWORD **)(v1 + 12); + v3 = *(DWORD **)(v1 + 12); if ( !v3 ) return 0; v5 = 0; @@ -586,7 +586,7 @@ int UNKCALL SelRegn_1000F6C9(HWND hWnd) { return 0; } { if ( v2 == v3 ) break; - v2 = (_DWORD *)*v2; + v2 = (DWORD *)*v2; ++v5; } while ( v2 ); @@ -595,14 +595,14 @@ int UNKCALL SelRegn_1000F6C9(HWND hWnd) { return 0; } // 1002A4EC: using guessed type int dword_1002A4EC; // ref: 0x1000F6FE -_DWORD *__fastcall SelRegn_1000F6FE(int a1) { return 0; } +DWORD *__fastcall SelRegn_1000F6FE(int a1) { return 0; } /* { - _DWORD *result; // eax + DWORD *result; // eax - result = (_DWORD *)dword_1002A4EC; + result = (DWORD *)dword_1002A4EC; while ( result && a1 ) { - result = (_DWORD *)*result; + result = (DWORD *)*result; --a1; } return result; @@ -633,7 +633,7 @@ HWND UNKCALL SelRegn_1000F711(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { if ( result == (HWND)dword_1002A4EC ) @@ -681,10 +681,10 @@ HWND UNKCALL SelRegn_1000F7C1(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(hWnd, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { - if ( *(_DWORD *)result ) + if ( *(DWORD *)result ) { if ( GetWindowLongA(v1, -12) >= 1140 ) { @@ -695,7 +695,7 @@ HWND UNKCALL SelRegn_1000F7C1(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(result, -21); if ( result ) { - v4 = (const char *)*((_DWORD *)result + 3); + v4 = (const char *)*((DWORD *)result + 3); if ( v4 ) { TitleSnd_10010315(); @@ -737,7 +737,7 @@ HWND UNKCALL SelRegn_1000F859(HWND hWnd) { return 0; } result = (HWND)GetWindowLongA(v1, -21); if ( result ) { - result = (HWND)*((_DWORD *)result + 3); + result = (HWND)*((DWORD *)result + 3); if ( result ) { v3 = (const char *)dword_1002A4EC; @@ -785,10 +785,10 @@ signed int SelRegn_1000F8F6() { return 0; } v1 = GetWindowLongA(v0, -21); if ( !v1 ) return 0; - v2 = *(_DWORD *)(v1 + 12); + v2 = *(DWORD *)(v1 + 12); if ( !v2 ) return 0; - BNetGW_10002B51(&unk_10029480, *(_DWORD *)(v2 + 4)); + BNetGW_10002B51(&unk_10029480, *(DWORD *)(v2 + 4)); return 1; } */ @@ -863,7 +863,7 @@ HWND __fastcall SelRegn_1000F929(HWND hWnd, int a2, int a3) { return 0; } } */ // ref: 0x1000F9F7 -signed int __stdcall UiSelectRegion(_DWORD *a1) { return 0; } +signed int __stdcall UiSelectRegion(DWORD *a1) { return 0; } /* { int v1; // eax int v2; // eax @@ -886,7 +886,7 @@ signed int __stdcall UiSelectRegion(_DWORD *a1) { return 0; } } return result; } */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); -// 1001041E: using guessed type int __stdcall SErrSetLastError(_DWORD); +// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(DWORD, DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); +// 1001041E: using guessed type int __stdcall SErrSetLastError(DWORD); // 1002948C: using guessed type int dword_1002948C; diff --git a/DiabloUI/selyesno.cpp b/DiabloUI/selyesno.cpp index ef013bec..428057bb 100644 --- a/DiabloUI/selyesno.cpp +++ b/DiabloUI/selyesno.cpp @@ -45,7 +45,7 @@ LRESULT __stdcall SelYesNo_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam); } else { v7 = 1; - if ((_WORD)wParam == 1) { + if ((WORD)wParam == 1) { v8 = GetFocus(); v9 = GetWindowLongA(v8, -12); v10 = hWnd; @@ -54,9 +54,9 @@ LRESULT __stdcall SelYesNo_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP else v7 = 2; } else { - if ((_WORD)wParam == 2) { + if ((WORD)wParam == 2) { v7 = 2; - } else if ((_WORD)wParam != 1109) { + } else if ((WORD)wParam != 1109) { return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } v10 = hWnd; @@ -77,7 +77,7 @@ LRESULT __stdcall SelYesNo_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP } return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam); } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x1000FBC7 void __fastcall SelYesNo_RemoveYNDialog(HWND hWnd) diff --git a/DiabloUI/title.cpp b/DiabloUI/title.cpp index ee8e59c7..51164957 100644 --- a/DiabloUI/title.cpp +++ b/DiabloUI/title.cpp @@ -1,13 +1,13 @@ // ref: 0x1000FDEE void __fastcall Title_BlitTitleBuffer(HWND hWnd) { - _DWORD *v2; // edi + DWORD *v2; // edi int v3; // eax HANDLE v4; // esi struct tagRECT Rect; // [esp+Ch] [ebp-18h] HWND hWnda; // [esp+20h] [ebp-4h] - v2 = (_DWORD *)GetWindowLongA(hWnd, -21); + v2 = (DWORD *)GetWindowLongA(hWnd, -21); hWnda = GetDlgItem(hWnd, 1043); if (IsWindowVisible(hWnd) && hWnda && v2 && *v2 && titlePHTrans[0]) { v3 = titleTransIdx + 1; @@ -22,13 +22,13 @@ void __fastcall Title_BlitTitleBuffer(HWND hWnd) SBltROP3( *(void **)v4, (void *)(Rect.left + *v2 + Rect.top * v2[1]), - *((_DWORD *)v4 + 1), - *((_DWORD *)v4 + 2), - *((_DWORD *)v4 + 1), + *((DWORD *)v4 + 1), + *((DWORD *)v4 + 2), + *((DWORD *)v4 + 1), v2[1], 0, 0xCC0020u); - STransBlt(*(void **)v4, 0, 0, *((_DWORD *)v4 + 1), (HANDLE)titlePHTrans[titleTransIdx]); + STransBlt(*(void **)v4, 0, 0, *((DWORD *)v4 + 1), (HANDLE)titlePHTrans[titleTransIdx]); InvalidateRect(hWnda, 0, 0); } } @@ -72,7 +72,7 @@ void __fastcall Title_FreeTransMem(HWND hWnd) void __fastcall Title_SetTitleBMP(HWND hWnd) { HWND v1; // eax MAPDST - _DWORD *v2; // esi + DWORD *v2; // esi void *v3; // eax struct tagRECT Rect; // [esp+0h] [ebp-18h] @@ -80,9 +80,9 @@ void __fastcall Title_SetTitleBMP(HWND hWnd) v1 = GetDlgItem(hWnd, 1043); if (v1) { GetClientRect(v1, &Rect); - v2 = (unsigned int *)SMemAlloc(0xCu, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 134, 0); + v2 = (DWORD *)SMemAlloc(0xCu, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 134, 0); v3 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 136, 8); - *v2 = (unsigned int)v3; + *v2 = (DWORD)v3; v2[1] = Rect.right; v2[2] = Rect.bottom; SDlgSetBitmapI(v1, 0, 0, -1, 1, v3, 0, Rect.right, Rect.bottom, -1); @@ -94,8 +94,8 @@ void __fastcall Title_SetTitleBMP(HWND hWnd) void __fastcall Title_LoadTitleImage(HWND hWnd, const char *pszFileName) { int v3; // edi - _DWORD *v4; // eax - _DWORD *v5; // esi + DWORD *v4; // eax + DWORD *v5; // esi int v6; // ebx int a5[4]; // [esp+8h] [ebp-20h] int data[2]; // [esp+18h] [ebp-10h] @@ -105,7 +105,7 @@ void __fastcall Title_LoadTitleImage(HWND hWnd, const char *pszFileName) v3 = 0; pBuffer = 0; local_LoadArtImage(pszFileName, &pBuffer, (DWORD *)data); - v4 = (unsigned int *)GetPropA(hWnd, "TITLE_BUFFER"); + v4 = (DWORD *)GetPropA(hWnd, "TITLE_BUFFER"); v5 = v4; if (pBuffer) { if (v4) { @@ -174,7 +174,7 @@ BOOL __stdcall UiTitleDialog(int a1) SDlgDialogBoxParam(ghUiInst, "TITLESCREEN_DIALOG", v1, Title_MainProc, a1); return 1; } -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10010126 LRESULT __stdcall Title_MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -209,7 +209,7 @@ LRESULT __stdcall Title_MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (uMsg != 275) { if (uMsg != 513 && uMsg != 516) { if (uMsg == 528) { - if ((_WORD)wParam == 513 || (_WORD)wParam == 516) + if ((WORD)wParam == 513 || (WORD)wParam == 516) Title_KillAndFadeDlg(hWnd); } else if (uMsg == 2024) { if (!Fade_CheckRange5()) @@ -226,8 +226,8 @@ LRESULT __stdcall Title_MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa goto LABEL_25; return 0; } -// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); +// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(DWORD, DWORD, DWORD, DWORD); +// 10010382: using guessed type DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10010235 void __fastcall Title_KillTimerAndFree(HWND hWnd) diff --git a/Source/debug.cpp b/Source/debug.cpp index 0a500b77..1c80e43a 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -195,7 +195,7 @@ void PrintDebugPlayer(BOOL bNextPlayer) char dstr[128]; if (bNextPlayer) - dbgplr = ((_BYTE)dbgplr + 1) & 3; + dbgplr = ((BYTE)dbgplr + 1) & 3; sprintf(dstr, "Plr %i : Active = %i", dbgplr, plr[dbgplr].plractive); NetSendCmdString(1 << myplr, dstr); diff --git a/Source/dthread.cpp b/Source/dthread.cpp index fb0c061e..9449e1de 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -41,7 +41,7 @@ void dthread_send_delta(int pnum, char cmd, void *pbSrc, int dwLen) pkt->pNext = NULL; pkt->dwSpaceLeft = pnum; pkt->data[0] = cmd; - *(_DWORD *)&pkt->data[4] = dwLen; + *(DWORD *)&pkt->data[4] = dwLen; memcpy(&pkt->data[8], pbSrc, dwLen); #ifdef __cplusplus sgMemCrit.Enter(); @@ -107,9 +107,9 @@ unsigned int __stdcall dthread_handler(void *unused) if (pkt) { if (pkt->dwSpaceLeft != 4) - multi_send_zero_packet(pkt->dwSpaceLeft, pkt->data[0], &pkt->data[8], *(_DWORD *)&pkt->data[4]); + multi_send_zero_packet(pkt->dwSpaceLeft, pkt->data[0], &pkt->data[8], *(DWORD *)&pkt->data[4]); - dwMilliseconds = 1000 * *(_DWORD *)&pkt->data[4] / gdwDeltaBytesSec; + dwMilliseconds = 1000 * *(DWORD *)&pkt->data[4] / gdwDeltaBytesSec; if (dwMilliseconds >= 1) dwMilliseconds = 1; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 8f3672ed..87f05f99 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -579,7 +579,7 @@ BOOL MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, BOOLE || t == MIS_HBOLT && monster[m].MType->mtype != MT_DIABLO && monster[m].MData->mMonstClass) { return FALSE; } - if (monster[m].MType->mtype == MT_ILLWEAV && _LOBYTE(monster[m]._mgoal) == MGOAL_RETREAT) + if (monster[m].MType->mtype == MT_ILLWEAV && monster[m]._mgoal == MGOAL_RETREAT) return FALSE; if (monster[m]._mmode == MM_CHARGE) return FALSE; diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 5e50dfdf..810a920d 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -107,7 +107,7 @@ void mpqapi_store_default_time(DWORD dwChar) /// ASSERT: assert(dwChar < MAX_CHARACTERS); idx = 16 * dwChar; mpqapi_reg_load_modification_time(dst, sizeof(dst)); - *(_DWORD *)&dst[idx + 4] = 0x78341348; // dwHighDateTime + *(DWORD *)&dst[idx + 4] = 0x78341348; // dwHighDateTime mpqapi_reg_store_modification_time(dst, sizeof(dst)); */ } diff --git a/Source/multi.cpp b/Source/multi.cpp index cfda2587..d3bdaba4 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -579,12 +579,12 @@ void multi_send_zero_packet(DWORD pnum, char a2, void *pbSrc, DWORD dwLen) pkt.hdr.bmag = 0; pkt.hdr.bdex = 0; pkt.body[0] = a2; - *(_WORD *)&pkt.body[1] = v5; + *(WORD *)&pkt.body[1] = v5; dwBody = gdwLargestMsgSize - 24; if (dwLen < dwBody) dwBody = dwLen; - *(_WORD *)&pkt.body[3] = dwBody; - memcpy(&pkt.body[5], pbSrc, *(_WORD *)&pkt.body[3]); + *(WORD *)&pkt.body[3] = dwBody; + memcpy(&pkt.body[5], pbSrc, *(WORD *)&pkt.body[3]); t = *(WORD *)&pkt.body[3] + 24; pkt.hdr.wLen = t; if (!SNetSendMessage(pnum, &pkt.hdr, t)) { @@ -593,7 +593,7 @@ void multi_send_zero_packet(DWORD pnum, char a2, void *pbSrc, DWORD dwLen) } pbSrc = (char *)pbSrc + *(WORD *)&pkt.body[3]; dwLen -= *(WORD *)&pkt.body[3]; - v5 += *(_WORD *)&pkt.body[3]; + v5 += *(WORD *)&pkt.body[3]; } } // 67975C: using guessed type int gdwLargestMsgSize; diff --git a/Source/render.cpp b/Source/render.cpp index 65200cac..4f306b87 100644 --- a/Source/render.cpp +++ b/Source/render.cpp @@ -132,17 +132,17 @@ void drawTopArchesUpperScreen(BYTE *pBuff) gpCelFrame = (unsigned char *)SpeedFrameTbl; dst = pBuff; - if (!(_BYTE)light_table_index) { + if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; goto LABEL_11; } - if ((_BYTE)light_table_index != lightmax) { + if ((BYTE)light_table_index != lightmax) { if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; cel_type_16 = (unsigned char)(level_cel_block >> 12); switch (cel_type_16) { @@ -186,7 +186,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) yy_32 -= width; } while (yy_32); LABEL_67: - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; dst -= 800; --xx_32; } while (xx_32); @@ -196,8 +196,8 @@ void drawTopArchesUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + src += (32 - (BYTE)xx_32) & 2; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -211,8 +211,8 @@ void drawTopArchesUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) break; dst += yy_32; - src += (32 - (_BYTE)yy_32) & 2; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + src += (32 - (BYTE)yy_32) & 2; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - yy_32, tbl, &dst, &src); } else { @@ -229,7 +229,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) WorldBoolFlag = 0; xx_32 = 30; while (dst >= gpBufEnd) { - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -243,7 +243,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) do { if (dst < gpBufEnd) break; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - yy_32, tbl, &dst, &src); } else { @@ -262,8 +262,8 @@ void drawTopArchesUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + src += (32 - (BYTE)xx_32) & 2; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -292,7 +292,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) WorldBoolFlag = 0; xx_32 = 30; while (dst >= gpBufEnd) { - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -322,7 +322,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) return; } src = (unsigned char *)pSpeedCels - + *(_DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; + + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; cel_type_16 = (unsigned char)(level_cel_block >> 12); LABEL_11: @@ -370,7 +370,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) xx_32 -= width; if (!xx_32) { LABEL_271: - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; dst -= 800; if (!--yy_32) return; @@ -441,7 +441,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) while (dst >= gpBufEnd) { dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -484,7 +484,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) break; dst += yy_32; y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = y_minus >> 2; if (y_minus & 2) { @@ -530,7 +530,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { for (n_draw_shift = x_minus >> 2; n_draw_shift; --n_draw_shift) { dst[1] = src[1]; @@ -564,7 +564,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) break; y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { for (n_draw_shift = y_minus >> 2; n_draw_shift; --n_draw_shift) { dst[1] = src[1]; @@ -605,7 +605,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) while (dst >= gpBufEnd) { dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -677,7 +677,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { for (n_draw_shift = x_minus >> 2; n_draw_shift; --n_draw_shift) { dst[1] = src[1]; @@ -685,7 +685,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { + if ((32 - (BYTE)xx_32) & 2) { dst[1] = src[1]; src += 4; dst += 2; @@ -697,7 +697,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { + if ((32 - (BYTE)xx_32) & 2) { dst[0] = src[0]; src += 4; dst += 2; @@ -740,9 +740,9 @@ void drawTopArchesUpperScreen(BYTE *pBuff) return; } if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // upper (top transparent), black @@ -839,7 +839,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) yy_32 -= width; } while (yy_32); LABEL_391: - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; dst -= 800; if (!--xx_32) return; @@ -851,7 +851,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) return; dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -891,7 +891,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) break; dst += yy_32; y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = y_minus >> 2; if (y_minus & 2) { @@ -931,7 +931,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) return; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -971,7 +971,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) break; y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = y_minus >> 2; if (y_minus & 2) { @@ -1012,7 +1012,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) return; dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -1077,7 +1077,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) return; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -1157,11 +1157,11 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) gpCelFrame = (unsigned char *)SpeedFrameTbl; dst = pBuff; gpDrawMask = pMask; - if (!(_BYTE)light_table_index) { + if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; LABEL_12: switch (cel_type_16) { @@ -1230,13 +1230,13 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -1252,13 +1252,13 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) dst += yy_32; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -1275,12 +1275,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) xx_32 = 30; while (dst >= gpBufEnd) { for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -1292,12 +1292,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) if (dst < gpBufEnd) break; for (n_draw_shift = (unsigned int)(32 - yy_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)yy_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)yy_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -1314,13 +1314,13 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -1356,12 +1356,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) xx_32 = 30; while (dst >= gpBufEnd) { for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -1395,9 +1395,9 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) } return; } - if ((_BYTE)light_table_index != lightmax) { + if ((BYTE)light_table_index != lightmax) { if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; cel_type_16 = (unsigned char)(level_cel_block >> 12); switch (cel_type_16) { @@ -1445,7 +1445,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) xx_32 = 30; while (dst >= gpBufEnd) { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -1455,7 +1455,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) if (dst < gpBufEnd) break; dst += yy_32; - src += (32 - (_BYTE)yy_32) & 2; + src += (32 - (BYTE)yy_32) & 2; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); dst -= 800; yy_32 += 2; @@ -1489,7 +1489,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) xx_32 = 30; while (dst >= gpBufEnd) { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -1536,14 +1536,14 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) return; } src = (unsigned char *)pSpeedCels - + *(_DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; + + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; cel_type_16 = (unsigned char)(level_cel_block >> 12); goto LABEL_12; } if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // upper (bottom transparent), black @@ -1610,12 +1610,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -1629,12 +1629,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) dst += yy_32; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -1652,12 +1652,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) while (dst >= gpBufEnd) { n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -1670,12 +1670,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) break; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -1695,12 +1695,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -1735,12 +1735,12 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) while (dst >= gpBufEnd) { n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -1808,11 +1808,11 @@ void drawUpperScreen(BYTE *pBuff) } gpCelFrame = (unsigned char *)SpeedFrameTbl; dst = pBuff; - if (!(_BYTE)light_table_index) { + if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; LABEL_22: switch (cel_type_16) { @@ -1823,7 +1823,7 @@ void drawUpperScreen(BYTE *pBuff) break; j = 8; do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --j; @@ -1858,14 +1858,14 @@ void drawUpperScreen(BYTE *pBuff) } n_draw_shift = chk_sh_and >> 1; if (chk_sh_and & 1) { - *(_WORD *)dst = *(_WORD *)src; + *(WORD *)dst = *(WORD *)src; src += 2; dst += 2; if (!n_draw_shift) continue; } do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -1882,13 +1882,13 @@ void drawUpperScreen(BYTE *pBuff) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -1904,13 +1904,13 @@ void drawUpperScreen(BYTE *pBuff) dst += yy_32; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -1927,12 +1927,12 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -1944,12 +1944,12 @@ void drawUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) break; for (n_draw_shift = (unsigned int)(32 - yy_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)yy_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)yy_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -1966,13 +1966,13 @@ void drawUpperScreen(BYTE *pBuff) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -1987,7 +1987,7 @@ void drawUpperScreen(BYTE *pBuff) break; j = 8; do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --j; @@ -2003,12 +2003,12 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -2021,7 +2021,7 @@ void drawUpperScreen(BYTE *pBuff) break; j = 8; do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --j; @@ -2036,9 +2036,9 @@ void drawUpperScreen(BYTE *pBuff) } return; } - if ((_BYTE)light_table_index != lightmax) { + if ((BYTE)light_table_index != lightmax) { if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; cel_type_16 = (unsigned short)level_cel_block >> 12; switch (cel_type_16) { @@ -2081,7 +2081,7 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -2091,7 +2091,7 @@ void drawUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) break; dst += yy_32; - src += (32 - (_BYTE)yy_32) & 2; + src += (32 - (BYTE)yy_32) & 2; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); dst -= 800; yy_32 += 2; @@ -2125,7 +2125,7 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -2166,14 +2166,14 @@ void drawUpperScreen(BYTE *pBuff) return; } src = (unsigned char *)pSpeedCels - + *(_DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; + + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; cel_type_16 = (unsigned short)level_cel_block >> 12; goto LABEL_22; } if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((unsigned int)level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // upper (solid), black @@ -2183,7 +2183,7 @@ void drawUpperScreen(BYTE *pBuff) break; j = 8; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); @@ -2218,13 +2218,13 @@ void drawUpperScreen(BYTE *pBuff) } n_draw_shift = width >> 2; if (chk_sh_and & 1) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; if (!n_draw_shift) continue; } do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -2240,12 +2240,12 @@ void drawUpperScreen(BYTE *pBuff) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -2259,12 +2259,12 @@ void drawUpperScreen(BYTE *pBuff) dst += yy_32; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -2282,12 +2282,12 @@ void drawUpperScreen(BYTE *pBuff) while (dst >= gpBufEnd) { n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -2300,12 +2300,12 @@ void drawUpperScreen(BYTE *pBuff) break; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -2325,12 +2325,12 @@ void drawUpperScreen(BYTE *pBuff) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -2343,7 +2343,7 @@ void drawUpperScreen(BYTE *pBuff) break; j = 8; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); @@ -2360,12 +2360,12 @@ void drawUpperScreen(BYTE *pBuff) while (dst >= gpBufEnd) { n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -2378,7 +2378,7 @@ void drawUpperScreen(BYTE *pBuff) break; j = 8; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); @@ -2414,19 +2414,19 @@ void drawTopArchesLowerScreen(BYTE *pBuff) gpCelFrame = (unsigned char *)SpeedFrameTbl; dst = pBuff; - if (!(_BYTE)light_table_index) { + if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; goto LABEL_11; } - if ((_BYTE)light_table_index == lightmax) { + if ((BYTE)light_table_index == lightmax) { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // lower (top transparent), black @@ -2476,7 +2476,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) yy_32 -= width; if (!yy_32) { LABEL_433: - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; dst -= 800; if (!--xx_32) return; @@ -2546,7 +2546,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -2589,7 +2589,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { dst += yy_32; y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = y_minus >> 2; if (y_minus & 2) { @@ -2632,7 +2632,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) for (xx_32 = 30;; xx_32 -= 2) { if (dst < gpBufEnd) { x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -2675,7 +2675,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) do { if (dst < gpBufEnd) { y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = y_minus >> 2; if (y_minus & 2) { @@ -2719,7 +2719,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -2793,7 +2793,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) for (xx_32 = 30;; xx_32 -= 2) { if (dst < gpBufEnd) { x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -2867,7 +2867,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) return; } if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; cel_type_16 = (unsigned char)(level_cel_block >> 12); switch (cel_type_16) { @@ -2920,7 +2920,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } } while (yy_32); LABEL_69: - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; dst -= 800; --xx_32; } while (xx_32); @@ -2948,8 +2948,8 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } do { dst += yy_32; - src += (32 - (_BYTE)yy_32) & 2; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + src += (32 - (BYTE)yy_32) & 2; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - yy_32, tbl, &dst, &src); } else { @@ -2969,8 +2969,8 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } do { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + src += (32 - (BYTE)xx_32) & 2; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -3002,7 +3002,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) WorldBoolFlag += world_tbl >> 1; } do { - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - yy_32, tbl, &dst, &src); } else { @@ -3022,7 +3022,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) WorldBoolFlag += world_tbl >> 1; } do { - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -3071,8 +3071,8 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } do { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + src += (32 - (BYTE)xx_32) & 2; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -3119,7 +3119,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) WorldBoolFlag += world_tbl >> 1; } do { - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { asm_trans_light_cel_0_2(32 - xx_32, tbl, &dst, &src); } else { @@ -3133,7 +3133,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } return; } - src = (unsigned char *)pSpeedCels + *(_DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; + src = (unsigned char *)pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; cel_type_16 = (unsigned char)(level_cel_block >> 12); LABEL_11: switch (cel_type_16) { @@ -3246,7 +3246,7 @@ LABEL_11: yy_32 -= width; } while (yy_32); LABEL_293: - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; dst -= 800; if (!--xx_32) return; @@ -3275,7 +3275,7 @@ LABEL_11: do { dst += yy_32; y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = y_minus >> 2; if (y_minus & 2) { @@ -3325,7 +3325,7 @@ LABEL_11: do { dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -3379,7 +3379,7 @@ LABEL_11: do { LABEL_326: x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { for (n_draw_shift = x_minus >> 2; n_draw_shift; --n_draw_shift) { dst[1] = src[1]; @@ -3387,7 +3387,7 @@ LABEL_11: src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { + if ((32 - (BYTE)xx_32) & 2) { dst[1] = src[1]; src += 4; dst += 2; @@ -3399,7 +3399,7 @@ LABEL_11: src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { + if ((32 - (BYTE)xx_32) & 2) { dst[0] = src[0]; src += 4; dst += 2; @@ -3427,7 +3427,7 @@ LABEL_11: } do { y_minus = 32 - yy_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { for (n_draw_shift = y_minus >> 2; n_draw_shift; --n_draw_shift) { dst[1] = src[1]; @@ -3435,7 +3435,7 @@ LABEL_11: src += 4; dst += 4; } - if ((32 - (_BYTE)yy_32) & 2) { + if ((32 - (BYTE)yy_32) & 2) { dst[1] = src[1]; src += 4; dst += 2; @@ -3447,7 +3447,7 @@ LABEL_11: src += 4; dst += 4; } - if ((32 - (_BYTE)yy_32) & 2) { + if ((32 - (BYTE)yy_32) & 2) { dst[0] = src[0]; src += 4; dst += 2; @@ -3510,7 +3510,7 @@ LABEL_11: do { dst += xx_32; x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { n_draw_shift = x_minus >> 2; if (x_minus & 2) { @@ -3600,7 +3600,7 @@ LABEL_11: } do { x_minus = 32 - xx_32; - WorldBoolFlag = ((_BYTE)WorldBoolFlag + 1) & 1; + WorldBoolFlag = ((BYTE)WorldBoolFlag + 1) & 1; if (WorldBoolFlag) { for (n_draw_shift = x_minus >> 2; n_draw_shift; --n_draw_shift) { dst[1] = src[1]; @@ -3608,7 +3608,7 @@ LABEL_11: src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { + if ((32 - (BYTE)xx_32) & 2) { dst[1] = src[1]; src += 4; dst += 2; @@ -3620,7 +3620,7 @@ LABEL_11: src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { + if ((32 - (BYTE)xx_32) & 2) { dst[0] = src[0]; src += 4; dst += 2; @@ -3652,12 +3652,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) gpCelFrame = (unsigned char *)SpeedFrameTbl; dst = pBuff; gpDrawMask = pMask; - if ((_BYTE)light_table_index) { - if ((_BYTE)light_table_index == lightmax) { + if ((BYTE)light_table_index) { + if ((BYTE)light_table_index == lightmax) { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // lower (bottom transparent), black @@ -3730,12 +3730,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) dst += i; n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -3754,12 +3754,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) dst += i; n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -3777,12 +3777,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) if (dst < gpBufEnd) { n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -3801,12 +3801,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) if (dst < gpBufEnd) { n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -3825,12 +3825,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) dst += i; n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -3870,12 +3870,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) if (dst < gpBufEnd) { n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -3915,7 +3915,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) return; } if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; cel_type_16 = (unsigned char)(level_cel_block >> 12); switch (cel_type_16) { @@ -3985,7 +3985,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } do { dst += yy_32; - src += (32 - (_BYTE)yy_32) & 2; + src += (32 - (BYTE)yy_32) & 2; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); yy_32 += 2; dst -= 800; @@ -3999,7 +3999,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } do { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -4074,7 +4074,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } do { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -4120,13 +4120,13 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) return; } src = (unsigned char *)pSpeedCels - + *(_DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; + + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; cel_type_16 = (unsigned char)(level_cel_block >> 12); } else { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; } switch (cel_type_16) { @@ -4217,13 +4217,13 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) dst += yy_32; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -4243,13 +4243,13 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -4272,12 +4272,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) do { LABEL_175: for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -4301,12 +4301,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } do { for (n_draw_shift = (unsigned int)(32 - yy_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)yy_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)yy_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -4355,13 +4355,13 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -4411,12 +4411,12 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } do { for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -4463,12 +4463,12 @@ void drawLowerScreen(BYTE *pBuff) } gpCelFrame = (unsigned char *)SpeedFrameTbl; dst = pBuff; - if ((_BYTE)light_table_index) { - if ((_BYTE)light_table_index == lightmax) { + if ((BYTE)light_table_index) { + if ((BYTE)light_table_index == lightmax) { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // lower (solid), black @@ -4477,7 +4477,7 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { j = 8; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); @@ -4515,12 +4515,12 @@ void drawLowerScreen(BYTE *pBuff) if (chk_sh_and) { n_draw_shift = width >> 2; if (chk_sh_and & 1) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -4542,12 +4542,12 @@ void drawLowerScreen(BYTE *pBuff) dst += i; n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -4566,12 +4566,12 @@ void drawLowerScreen(BYTE *pBuff) dst += i; n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -4589,12 +4589,12 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -4613,12 +4613,12 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -4637,12 +4637,12 @@ void drawLowerScreen(BYTE *pBuff) dst += i; n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -4660,7 +4660,7 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { j = 8; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); @@ -4677,12 +4677,12 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { n_draw_shift = (unsigned int)(32 - i) >> 2; if ((32 - i) & 2) { - *(_WORD *)dst = 0; + *(WORD *)dst = 0; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --n_draw_shift; } while (n_draw_shift); @@ -4701,7 +4701,7 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { j = 8; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); @@ -4717,7 +4717,7 @@ void drawLowerScreen(BYTE *pBuff) return; } if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; cel_type_16 = (unsigned short)level_cel_block >> 12; switch (cel_type_16) { @@ -4778,7 +4778,7 @@ void drawLowerScreen(BYTE *pBuff) } do { dst += yy_32; - src += (32 - (_BYTE)yy_32) & 2; + src += (32 - (BYTE)yy_32) & 2; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); yy_32 += 2; dst -= 800; @@ -4792,7 +4792,7 @@ void drawLowerScreen(BYTE *pBuff) } do { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -4864,7 +4864,7 @@ void drawLowerScreen(BYTE *pBuff) } do { dst += xx_32; - src += (32 - (_BYTE)xx_32) & 2; + src += (32 - (BYTE)xx_32) & 2; asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); dst -= 800; xx_32 -= 2; @@ -4907,13 +4907,13 @@ void drawLowerScreen(BYTE *pBuff) return; } src = (unsigned char *)pSpeedCels - + *(_DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; + + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; cel_type_16 = (unsigned short)level_cel_block >> 12; } else { if (level_cel_block & 0x8000) - level_cel_block = *(_DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((_DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (((unsigned int)level_cel_block >> 12) & 7) + 8; } switch (cel_type_16) { @@ -4923,7 +4923,7 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { j = 8; do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --j; @@ -4962,13 +4962,13 @@ void drawLowerScreen(BYTE *pBuff) if (chk_sh_and) { n_draw_shift = chk_sh_and >> 1; if (chk_sh_and & 1) { - *(_WORD *)dst = *(_WORD *)src; + *(WORD *)dst = *(WORD *)src; src += 2; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -5007,13 +5007,13 @@ void drawLowerScreen(BYTE *pBuff) dst += yy_32; n_draw_shift = (unsigned int)(32 - yy_32) >> 2; if ((32 - yy_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -5033,13 +5033,13 @@ void drawLowerScreen(BYTE *pBuff) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -5062,12 +5062,12 @@ void drawLowerScreen(BYTE *pBuff) do { LABEL_166: for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -5091,12 +5091,12 @@ void drawLowerScreen(BYTE *pBuff) } do { for (n_draw_shift = (unsigned int)(32 - yy_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)yy_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)yy_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -5118,7 +5118,7 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { j = 8; do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --j; @@ -5141,13 +5141,13 @@ void drawLowerScreen(BYTE *pBuff) dst += xx_32; n_draw_shift = (unsigned int)(32 - xx_32) >> 2; if ((32 - xx_32) & 2) { - *(_WORD *)dst = *((_WORD *)src + 1); + *(WORD *)dst = *((WORD *)src + 1); src += 4; dst += 2; } if (n_draw_shift) { do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --n_draw_shift; @@ -5170,7 +5170,7 @@ void drawLowerScreen(BYTE *pBuff) if (dst < gpBufEnd) { j = 8; do { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; --j; @@ -5191,12 +5191,12 @@ void drawLowerScreen(BYTE *pBuff) } do { for (n_draw_shift = (unsigned int)(32 - xx_32) >> 2; n_draw_shift; --n_draw_shift) { - *(_DWORD *)dst = *(_DWORD *)src; + *(DWORD *)dst = *(DWORD *)src; src += 4; dst += 4; } - if ((32 - (_BYTE)xx_32) & 2) { - *(_WORD *)dst = *(_WORD *)src; + if ((32 - (BYTE)xx_32) & 2) { + *(WORD *)dst = *(WORD *)src; src += 4; dst += 2; } @@ -5221,7 +5221,7 @@ void world_draw_black_tile(BYTE *pBuff) dst += xx_32; j = i; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); @@ -5236,7 +5236,7 @@ void world_draw_black_tile(BYTE *pBuff) dst += yy_32; j = i; do { - *(_DWORD *)dst = 0; + *(DWORD *)dst = 0; dst += 4; --j; } while (j); diff --git a/defs.h b/defs.h index 986323e3..23b44156 100644 --- a/defs.h +++ b/defs.h @@ -142,22 +142,10 @@ // Partially defined types. They are used when the decompiler does not know // anything about the type except its size. #define _BYTE unsigned char -#define _WORD unsigned short #define _DWORD unsigned int -// Some convenience macros to make partial accesses nicer -#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN -# define LOW_IND(x,part_type) (sizeof(x)/sizeof(part_type) - 1) -#else -# define LOW_IND(x,part_type) 0 -#endif - -// first unsigned macros: -#define BYTEn(x, n) (*((BYTE*)&(x)+n)) -#define WORDn(x, n) (*((WORD*)&(x)+n)) - -#define _LOBYTE(x) BYTEn(x,LOW_IND(x,BYTE)) -#define _LOWORD(x) WORDn(x,LOW_IND(x,WORD)) +#define _LOBYTE(x) (*((BYTE*)&(x))) +#define _LOWORD(x) (*((WORD*)&(x))) #endif /* IDA_GARBAGE */ From deaa8923d136bfab316ee97b490faf6c612b195e Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Mon, 3 Jun 2019 22:09:31 +0200 Subject: [PATCH 04/54] Converted Pkware.dsp to CRLF --- 3rdParty/PKWare/Pkware.dsp | 200 ++++++++++++++++++------------------- 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/3rdParty/PKWare/Pkware.dsp b/3rdParty/PKWare/Pkware.dsp index f3bdc223..ebdaeba0 100644 --- a/3rdParty/PKWare/Pkware.dsp +++ b/3rdParty/PKWare/Pkware.dsp @@ -1,100 +1,100 @@ -# Microsoft Developer Studio Project File - Name="Pkware" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=Pkware - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Pkware.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Pkware.mak" CFG="Pkware - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Pkware - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "Pkware - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Pkware - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "WinRel" -# PROP BASE Intermediate_Dir "WinRel" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "WinRel" -# PROP Intermediate_Dir "WinRel" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "Pkware - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "WinDebug" -# PROP BASE Intermediate_Dir "WinDebug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "WinDebug" -# PROP Intermediate_Dir "WinDebug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "Pkware - Win32 Release" -# Name "Pkware - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\explode.cpp -# End Source File -# Begin Source File - -SOURCE=.\implode.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="Pkware" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=Pkware - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Pkware.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Pkware.mak" CFG="Pkware - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Pkware - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "Pkware - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Pkware - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "WinRel" +# PROP BASE Intermediate_Dir "WinRel" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "WinRel" +# PROP Intermediate_Dir "WinRel" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Pkware - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "WinDebug" +# PROP BASE Intermediate_Dir "WinDebug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "WinDebug" +# PROP Intermediate_Dir "WinDebug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "Pkware - Win32 Release" +# Name "Pkware - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\explode.cpp +# End Source File +# Begin Source File + +SOURCE=.\implode.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# End Target +# End Project From e177fa50214e10dc81d9af68eaa9e37ae6dfcc25 Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Mon, 3 Jun 2019 16:01:38 -0500 Subject: [PATCH 05/54] multi_handle_all_packets --- Source/multi.cpp | 21 ++++++++++----------- Source/multi.h | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Source/multi.cpp b/Source/multi.cpp index d3bdaba4..81dee629 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -525,7 +525,7 @@ void multi_process_network_packets() } } } - multi_handle_all_packets(*(int *)arglist, (TPkt *)&v2[1], len - 19); + multi_handle_all_packets(*(int *)arglist, (BYTE *)&v2[1], len - 19); } //_LOBYTE(v15) = SNetReceiveMessage((int *)arglist, (char **)&pkt, &len); } while (SNetReceiveMessage((int *)arglist, (char **)&pkt, &len)); @@ -536,18 +536,17 @@ void multi_process_network_packets() // 676194: using guessed type char gbBufferMsgs; // 676198: using guessed type int pkt_counter; -void multi_handle_all_packets(int players, TPkt *packet, int a3) +void multi_handle_all_packets(int pnum, BYTE *pData, int nSize) { - TCmd *v3; // esi - int i; // edi - int v5; // eax + int nLen; - v3 = (TCmd *)packet; - for (i = players; a3; a3 -= v5) { - v5 = ParseCmd(i, v3); - if (!v5) + while(nSize != 0) { + nLen = ParseCmd(pnum, (TCmd *)pData); + if(nLen == 0) { break; - v3 += v5; + } + pData += nLen; + nSize -= nLen; } } @@ -557,7 +556,7 @@ void multi_process_tmsgs() TPkt pkt; while (cnt = tmsg_get((BYTE *)&pkt, 512)) { - multi_handle_all_packets(myplr, &pkt, cnt); + multi_handle_all_packets(myplr, (BYTE *)&pkt, cnt); } } diff --git a/Source/multi.h b/Source/multi.h index 5851c048..be7aad6e 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -39,7 +39,7 @@ void multi_mon_seeds(); void multi_begin_timeout(); void multi_check_drop_player(); void multi_process_network_packets(); -void multi_handle_all_packets(int players, TPkt *packet, int a3); +void multi_handle_all_packets(int pnum, BYTE *pData, int nSize); void multi_process_tmsgs(); void multi_send_zero_packet(DWORD pnum, char a2, void *pbSrc, DWORD dwLen); void NetClose(); From 635deebbd4f2cc04318ffe97328c256bbb28fe19 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 5 Jun 2019 03:14:59 +0200 Subject: [PATCH 06/54] Apply enums to SpawnQuestItem --- Source/items.cpp | 2 +- Source/objects.cpp | 9 ++++----- Source/quests.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index 37f371eb..eb998ddb 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -277,7 +277,7 @@ void InitItems() if (QuestStatus(QTYPE_INFRA)) SpawnRock(); if (QuestStatus(QTYPE_ANVIL)) - SpawnQuestItem(16, 2 * setpc_x + 27, 2 * setpc_y + 27, 0, 1); + SpawnQuestItem(IDI_ANVIL, 2 * setpc_x + 27, 2 * setpc_y + 27, 0, 1); if (currlevel > 0u && currlevel < 0x10u) AddInitItems(); } diff --git a/Source/objects.cpp b/Source/objects.cpp index f1952cb1..bbbfe020 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -2185,7 +2185,6 @@ void OperateL2LDoor(int pnum, int oi, BOOL sendflag) PlaySfxLoc(IS_DOORCLOS, object[oi]._ox, object[oi]._oy); return; } - xp = object[oi]._ox; yp = object[oi]._oy; if (object[oi]._oVar4 == 0) { @@ -2514,9 +2513,9 @@ void OperateBookLever(int pnum, int i) quests[QTYPE_BLOOD]._qactive = 2; quests[QTYPE_BLOOD]._qlog = 1; quests[QTYPE_BLOOD]._qvar1 = 1; - SpawnQuestItem(21, 2 * setpc_x + 19, 2 * setpc_y + 26, 0, 1); - SpawnQuestItem(21, 2 * setpc_x + 31, 2 * setpc_y + 26, 0, 1); - SpawnQuestItem(21, 2 * setpc_x + 25, 2 * setpc_y + 33, 0, 1); + SpawnQuestItem(IDI_BLDSTONE, 2 * setpc_x + 19, 2 * setpc_y + 26, 0, 1); + SpawnQuestItem(IDI_BLDSTONE, 2 * setpc_x + 31, 2 * setpc_y + 26, 0, 1); + SpawnQuestItem(IDI_BLDSTONE, 2 * setpc_x + 25, 2 * setpc_y + 33, 0, 1); } object[i]._otype = object[i]._otype; if (object[i]._otype == OBJ_STEELTOME && !quests[QTYPE_WARLRD]._qvar1) { @@ -3753,7 +3752,7 @@ void OperateLazStand(int pnum, int i) object[i]._oAnimFrame++; object[i]._oSelFlag = 0; GetSuperItemLoc(object[i]._ox, object[i]._oy, &xx, &yy); - SpawnQuestItem(33, xx, yy, 0, 0); + SpawnQuestItem(IDI_LGTFORGE, xx, yy, 0, 0); } } diff --git a/Source/quests.cpp b/Source/quests.cpp index 755b39e0..cb90e20c 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -662,7 +662,7 @@ void ResyncQuests() } if (currlevel == quests[QTYPE_VEIL]._qlevel + 1 && quests[QTYPE_VEIL]._qactive == 2 && !quests[QTYPE_VEIL]._qvar1) { quests[QTYPE_VEIL]._qvar1 = 1; - SpawnQuestItem(15, 0, 0, 5, 1); + SpawnQuestItem(IDI_GLDNELIX, 0, 0, 5, 1); } if (setlevel && setlvlnum == 5) { if (quests[QTYPE_VB]._qvar1 >= 4u) From 58bbfcf8ad6aa5b9de315e2198e884d2579a481a Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 5 Jun 2019 12:56:49 +0200 Subject: [PATCH 07/54] Fix OperateLazStand --- Source/objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/objects.cpp b/Source/objects.cpp index bbbfe020..5db07998 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3752,7 +3752,7 @@ void OperateLazStand(int pnum, int i) object[i]._oAnimFrame++; object[i]._oSelFlag = 0; GetSuperItemLoc(object[i]._ox, object[i]._oy, &xx, &yy); - SpawnQuestItem(IDI_LGTFORGE, xx, yy, 0, 0); + SpawnQuestItem(IDI_LAZSTAFF, xx, yy, 0, 0); } } From ce1f397658ffaa635a1aa731014683a3952f3dcf Mon Sep 17 00:00:00 2001 From: Manuel K Date: Wed, 5 Jun 2019 17:27:26 +0200 Subject: [PATCH 08/54] Use MAX_PLRS --- Source/missiles.cpp | 2 +- Source/monster.cpp | 14 +++++++------- Source/msg.cpp | 2 +- Source/objects.cpp | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 87f05f99..cad22695 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -3025,7 +3025,7 @@ void MI_Town(int i) missile[i]._miVar2++; } - for (p = 0; p < 4; p++) { + for (p = 0; p < MAX_PLRS; p++) { if (plr[p].plractive && currlevel == plr[p].plrlevel && !plr[p]._pLvlChanging && !plr[p]._pmode && plr[p].WorldX == missile[i]._mix && plr[p].WorldY == missile[i]._miy) { ClrPlrPath(p); if (p == myplr) { diff --git a/Source/monster.cpp b/Source/monster.cpp index 68ddd7b3..7301a6b3 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1636,7 +1636,7 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg) if (pnum >= 0) monster[i].mWhoHit |= 1 << pnum; - if (pnum < 4 && i > 4) + if (pnum < MAX_PLRS && i > MAX_PLRS) AddPlrMonstExper(monster[i].mLevel, monster[i].mExp, monster[i].mWhoHit); monstkills[monster[i].MType->mtype]++; monster[i]._mhitpoints = 0; @@ -1691,14 +1691,14 @@ void M2MStartKill(int i, int mid) NetSendCmdLocParam1(FALSE, CMD_MONSTDEATH, monster[mid]._mx, monster[mid]._my, mid); monster[mid].mWhoHit |= 1 << i; - if (i < 4) + if (i < MAX_PLRS) AddPlrMonstExper(monster[mid].mLevel, monster[mid].mExp, monster[mid].mWhoHit); monstkills[monster[mid].MType->mtype]++; monster[mid]._mhitpoints = 0; SetRndSeed(monster[mid]._mRndSeed); - if (mid >= 4) + if (mid >= MAX_PLRS) SpawnItem(mid, monster[mid]._mx, monster[mid]._my, TRUE); if (monster[mid].MType->mtype == MT_DIABLO) @@ -4484,7 +4484,7 @@ void DeleteMonsterList() while (i < nummonsters) { if (monster[monstactive[i]]._mDelFlag) { DeleteMonster(i); - i = 0; // TODO: check if this should be i=4. + i = 0; // TODO: check if this should be MAX_PLRS. } else { i++; } @@ -5506,21 +5506,21 @@ int encode_enemy(int m) enemy = monster[m]._menemy; if (monster[m]._mFlags & MFLAG_TARGETS_MONSTER) - enemy += 4; + enemy += MAX_PLRS; return enemy; } void decode_enemy(int m, int enemy) { - if (enemy < 4) { + if (enemy < MAX_PLRS) { monster[m]._mFlags &= ~MFLAG_TARGETS_MONSTER; monster[m]._menemy = enemy; monster[m]._menemyx = plr[enemy]._px; monster[m]._menemyy = plr[enemy]._py; } else { monster[m]._mFlags |= MFLAG_TARGETS_MONSTER; - enemy -= 4; + enemy -= MAX_PLRS; monster[m]._menemy = enemy; monster[m]._menemyx = monster[enemy]._mfutx; monster[m]._menemyy = monster[enemy]._mfuty; diff --git a/Source/msg.cpp b/Source/msg.cpp index 0fd20006..2641637a 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -520,7 +520,7 @@ void DeltaLoadLevel() decode_enemy(i, sgLevels[currlevel].monster[i]._menemy); if (monster[i]._mx && monster[i]._mx != 1 || monster[i]._my) dMonster[monster[i]._mx][monster[i]._my] = i + 1; - if (i < 4) { + if (i < MAX_PLRS) { MAI_Golum(i); monster[i]._mFlags |= (MFLAG_TARGETS_MONSTER | MFLAG_GOLEM); } else { diff --git a/Source/objects.cpp b/Source/objects.cpp index 5db07998..9cd8c0ba 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3480,13 +3480,13 @@ void OperateBookCase(int pnum, int i, BOOL sendmsg) SetRndSeed(object[i]._oRndSeed); CreateTypeItem(object[i]._ox, object[i]._oy, 0, ITYPE_MISC, IMISC_BOOK, sendmsg, 0); if (QuestStatus(QTYPE_ZHAR) - && monster[4].mName == UniqMonst[UMT_ZHAR].mName - && monster[4]._msquelch == UCHAR_MAX - && monster[4]._mhitpoints) { - monster[4].mtalkmsg = QUEST_ZHAR2; - M_StartStand(0, monster[4]._mdir); - monster[4]._mgoal = MGOAL_SHOOT; - monster[4]._mmode = MM_TALK; + && monster[MAX_PLRS].mName == UniqMonst[UMT_ZHAR].mName + && monster[MAX_PLRS]._msquelch == UCHAR_MAX + && monster[MAX_PLRS]._mhitpoints) { + monster[MAX_PLRS].mtalkmsg = QUEST_ZHAR2; + M_StartStand(0, monster[MAX_PLRS]._mdir); + monster[MAX_PLRS]._mgoal = MGOAL_SHOOT; + monster[MAX_PLRS]._mmode = MM_TALK; } if (pnum == myplr) NetSendCmdParam1(FALSE, CMD_OPERATEOBJ, i); From 97c1edd3a01b7739cc3e45e2af33eb737dac29b6 Mon Sep 17 00:00:00 2001 From: Manuel K Date: Wed, 5 Jun 2019 18:00:16 +0200 Subject: [PATCH 09/54] Use BUFFER_WIDTH --- Source/automap.cpp | 2 +- Source/capture.cpp | 2 +- Source/control.cpp | 102 ++++++++++++++-------------- Source/engine.cpp | 162 ++++++++++++++++++++++---------------------- Source/inv.cpp | 4 +- Source/items.cpp | 4 +- Source/minitext.cpp | 4 +- Source/scrollrt.cpp | 86 +++++++++++------------ Source/stores.cpp | 8 +-- Source/town.cpp | 66 +++++++++--------- 10 files changed, 220 insertions(+), 220 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index d7e0002c..a2e1a1fa 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -173,7 +173,7 @@ void DrawAutomap() return; } - gpBufEnd = (unsigned char *)&gpBuffer[(VIEWPORT_HEIGHT + SCREEN_Y) * 768]; + gpBufEnd = (unsigned char *)&gpBuffer[(VIEWPORT_HEIGHT + SCREEN_Y) * BUFFER_WIDTH]; MapX = (ViewX - 16) >> 1; while (MapX + AutoMapXOfs < 0) diff --git a/Source/capture.cpp b/Source/capture.cpp index 06749670..f4d34014 100644 --- a/Source/capture.cpp +++ b/Source/capture.cpp @@ -20,7 +20,7 @@ void CaptureScreen() lock_buf(2); success = CaptureHdr(hObject, 640, 480); if (success) { - success = CapturePix(hObject, 640, 480, 768, &gpBuffer[SCREENXY(0, 0)]); + success = CapturePix(hObject, 640, 480, BUFFER_WIDTH, &gpBuffer[SCREENXY(0, 0)]); if (success) { success = CapturePal(hObject, palette); } diff --git a/Source/control.cpp b/Source/control.cpp index 29b5d712..dc41f2d0 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -76,31 +76,31 @@ const unsigned char fontkern[68] = { 4, 4, 9, 6, 6, 12, 3, 7 }; const int lineoffset[25] = { - 768 * 594 + 241, - 768 * 32, - 768 * 32, - 768 * 32, - 768 * 32 + 180, - 768 * 582 + 241, - 768 * 606 + 241, - 768 * 32, - 768 * 32, - 768 * 32, - 768 * 576 + 241, - 768 * 594 + 241, - 768 * 612 + 241, - 768 * 32, - 768 * 32, - 768 * 572 + 241, - 768 * 587 + 241, - 768 * 601 + 241, - 768 * 616 + 241, - 768 * 32, - 768 * 570 + 241, - 768 * 582 + 241, - 768 * 594 + 241, - 768 * 606 + 241, - 768 * 617 + 241 + BUFFER_WIDTH * 594 + 241, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 32 + 180, + BUFFER_WIDTH * 582 + 241, + BUFFER_WIDTH * 606 + 241, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 576 + 241, + BUFFER_WIDTH * 594 + 241, + BUFFER_WIDTH * 612 + 241, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 572 + 241, + BUFFER_WIDTH * 587 + 241, + BUFFER_WIDTH * 601 + 241, + BUFFER_WIDTH * 616 + 241, + BUFFER_WIDTH * 32, + BUFFER_WIDTH * 570 + 241, + BUFFER_WIDTH * 582 + 241, + BUFFER_WIDTH * 594 + 241, + BUFFER_WIDTH * 606 + 241, + BUFFER_WIDTH * 617 + 241 }; const unsigned char gbFontTransTbl[256] = { // clang-format off @@ -240,7 +240,7 @@ void DrawSpellCel(int xp, int yp, BYTE *Trans, int nCel, int w) sub edx, eax jnz label2 label7: - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, w cmp esi, end jnz label1 @@ -255,7 +255,7 @@ void DrawSpellCel(int xp, int yp, BYTE *Trans, int nCel, int w) src = &Trans[pFrameTable[0]]; end = &src[pFrameTable[1] - pFrameTable[0]]; - for (; src != end; dst -= 768 + w) { + for (; src != end; dst -= BUFFER_WIDTH + w) { for (i = w; i;) { width = *src++; if (!(width & 0x80)) { @@ -615,7 +615,7 @@ void CPrintString(int nOffset, int nCel, char col) sub edx, eax jnz c0_label2 c0_label7: - sub edi, 768 + 13 + sub edi, BUFFER_WIDTH + 13 cmp ebx, esi jnz c0_label1 jmp labret @@ -652,7 +652,7 @@ void CPrintString(int nOffset, int nCel, char col) sub edx, eax jnz c1_label2 c1_label7: - sub edi, 768 + 13 + sub edi, BUFFER_WIDTH + 13 cmp ebx, esi jnz c1_label1 jmp labret @@ -684,7 +684,7 @@ void CPrintString(int nOffset, int nCel, char col) sub edx, eax jnz c2_label2 c2_label6: - sub edi, 768 + 13 + sub edi, BUFFER_WIDTH + 13 cmp ebx, esi jnz c2_label1 jmp labret @@ -721,7 +721,7 @@ void CPrintString(int nOffset, int nCel, char col) sub edx, eax jnz d_label2 d_label7: - sub edi, 768 + 13 + sub edi, BUFFER_WIDTH + 13 cmp ebx, esi jnz d_label1 @@ -740,7 +740,7 @@ void CPrintString(int nOffset, int nCel, char col) switch (col) { case COL_WHITE: - for (; src != end; dst -= 768 + 13) { + for (; src != end; dst -= BUFFER_WIDTH + 13) { for (i = 13; i;) { width = *src++; if (!(width & 0x80)) { @@ -776,7 +776,7 @@ void CPrintString(int nOffset, int nCel, char col) } break; case COL_BLUE: - for (; src != end; dst -= 768 + 13) { + for (; src != end; dst -= BUFFER_WIDTH + 13) { for (i = 13; i;) { width = *src++; if (!(width & 0x80)) { @@ -799,7 +799,7 @@ void CPrintString(int nOffset, int nCel, char col) } break; case COL_RED: - for (; src != end; dst -= 768 + 13) { + for (; src != end; dst -= BUFFER_WIDTH + 13) { for (i = 13; i;) { width = *src++; if (!(width & 0x80)) { @@ -820,7 +820,7 @@ void CPrintString(int nOffset, int nCel, char col) } break; default: - for (; src != end; dst -= 768 + 13) { + for (; src != end; dst -= BUFFER_WIDTH + 13) { for (i = 13; i;) { width = *src++; if (!(width & 0x80)) { @@ -870,7 +870,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) /// ASSERT: assert(gpBuffer); nSrcOff = x + 640 * y; - nDstOff = sx + 768 * sy; + nDstOff = sx + BUFFER_WIDTH * sy; #ifdef USE_ASM __asm { @@ -898,7 +898,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) label4: add esi, 640 sub esi, ebx - add edi, 768 + add edi, BUFFER_WIDTH sub edi, ebx dec edx jnz label1 @@ -910,7 +910,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) src = &pBtmBuff[nSrcOff]; dst = &gpBuffer[nDstOff]; - for (hgt = h; hgt; hgt--, src += 640 - w, dst += 768 - w) { + for (hgt = h; hgt; hgt--, src += 640 - w, dst += BUFFER_WIDTH - w) { wdt = w; if (wdt & 1) { dst[0] = src[0]; @@ -945,7 +945,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int c, int r) /// ASSERT: assert(gpBuffer); nSrcOff = 88 * min; - nDstOff = c + 768 * r; + nDstOff = c + BUFFER_WIDTH * r; w = max - min; #ifdef USE_ASM @@ -958,7 +958,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int c, int r) label1: mov ecx, 88 / 4 rep movsd - add edi, 768 - 88 + add edi, BUFFER_WIDTH - 88 dec edx jnz label1 } @@ -968,7 +968,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int c, int r) src = &pCelBuff[nSrcOff]; dst = &gpBuffer[nDstOff]; - for (; w; w--, src += 88, dst += 768) + for (; w; w--, src += 88, dst += BUFFER_WIDTH) memcpy(dst, src, 88); #endif } @@ -994,7 +994,7 @@ void DrawFlask(BYTE *pCelBuff, int w, int nSrcOff, BYTE *pBuff, int nDstOff, int loop label2 add esi, w sub esi, 59 - add edi, 768 - 59 + add edi, BUFFER_WIDTH - 59 dec edx jnz label1 } @@ -1005,7 +1005,7 @@ void DrawFlask(BYTE *pCelBuff, int w, int nSrcOff, BYTE *pBuff, int nDstOff, int src = &pCelBuff[nSrcOff]; dst = &pBuff[nDstOff]; - for (hgt = h; hgt; hgt--, src += w - 59, dst += 768 - 59) { + for (hgt = h; hgt; hgt--, src += w - 59, dst += BUFFER_WIDTH - 59) { for (wdt = 59; wdt; wdt--) { if (*src) *dst = *src; @@ -1028,9 +1028,9 @@ void DrawLifeFlask() filled = 11; filled += 2; - DrawFlask(pLifeBuff, 88, 277, gpBuffer, 768 * 499 + 173, filled); + DrawFlask(pLifeBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173, filled); if (filled != 13) - DrawFlask(pBtmBuff, 640, 640 * filled + 2029, gpBuffer, 768 * filled + 768 * 499 + 173, 13 - filled); + DrawFlask(pBtmBuff, 640, 640 * filled + 2029, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173, 13 - filled); } void UpdateLifeFlask() @@ -1058,9 +1058,9 @@ void DrawManaFlask() filled = 11; filled += 2; - DrawFlask(pManaBuff, 88, 277, gpBuffer, 768 * 499 + 173 + 366, filled); + DrawFlask(pManaBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173 + 366, filled); if (filled != 13) - DrawFlask(pBtmBuff, 640, 640 * filled + 2029 + 366, gpBuffer, 768 * filled + 768 * 499 + 173 + 366, 13 - filled); + DrawFlask(pBtmBuff, 640, 640 * filled + 2029 + 366, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173 + 366, 13 - filled); } void control_update_life_mana() @@ -2100,7 +2100,7 @@ void RedBack() xlat stosb loop lx_label2 - add edi, 768 - 640 + add edi, BUFFER_WIDTH - 640 dec edx jnz lx_label1 } @@ -2121,7 +2121,7 @@ void RedBack() l4_label3: stosb loop l4_label2 - add edi, 768 - 640 + add edi, BUFFER_WIDTH - 640 dec edx jnz l4_label1 } @@ -2133,7 +2133,7 @@ void RedBack() if (leveltype != DTYPE_HELL) { dst = &gpBuffer[SCREENXY(0, 0)]; tbl = &pLightTbl[idx]; - for (h = VIEWPORT_HEIGHT; h; h--, dst += 768 - 640) { + for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - 640) { for (w = 640; w; w--) { *dst = tbl[*dst]; dst++; @@ -2142,7 +2142,7 @@ void RedBack() } else { dst = &gpBuffer[SCREENXY(0, 0)]; tbl = &pLightTbl[idx]; - for (h = VIEWPORT_HEIGHT; h; h--, dst += 768 - 640) { + for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - 640) { for (w = 640; w; w--) { if (*dst >= 32) *dst = tbl[*dst]; diff --git a/Source/engine.cpp b/Source/engine.cpp index 55a16dff..709e5af9 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -34,7 +34,7 @@ void CelDrawDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) __asm { mov esi, pRLEBytes mov edi, pDecodeTo - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -82,7 +82,7 @@ void CelDrawDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) dst = pDecodeTo; w = nWidth; - for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) { + for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) { for (i = w; i;) { width = *src++; if (!(width & 0x80)) { @@ -256,7 +256,7 @@ void CelDecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi mov tbl, eax mov esi, pRLEBytes mov edi, pDecodeTo - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -353,7 +353,7 @@ void CelDecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi tbl = &pLightTbl[light_table_index * 256]; w = nWidth; - for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) { + for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) { for (i = w; i;) { width = *src++; if (!(width & 0x80)) { @@ -411,7 +411,7 @@ void CelDecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW mov tbl, eax mov esi, pRLEBytes mov edi, pDecodeTo - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -518,7 +518,7 @@ void CelDecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW w = nWidth; shift = (BYTE)dst & 1; - for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w, shift = (shift + 1) & 1) { + for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w, shift = (shift + 1) & 1) { for (i = w; i;) { width = *src++; if (!(width & 0x80)) { @@ -743,9 +743,9 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in __asm { mov esi, src mov edi, dst - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth - mov w, eax /* use C for w? w = 768 + nWidth */ + mov w, eax /* use C for w? w = BUFFER_WIDTH + nWidth */ mov ebx, nDataSize add ebx, esi label1: @@ -788,7 +788,7 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in end = &src[nDataSize]; - for (; src != end; dst -= 768 + nWidth) { + for (; src != end; dst -= BUFFER_WIDTH + nWidth) { for (w = nWidth; w;) { width = *src++; if (!(width & 0x80)) { @@ -828,7 +828,7 @@ void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) __asm { mov esi, pRLEBytes mov edi, pDecodeTo - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -882,7 +882,7 @@ void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) dst = pDecodeTo; w = nWidth; - for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) { + for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) { for (i = w; i;) { width = *src++; if (!(width & 0x80)) { @@ -1024,7 +1024,7 @@ void Cel2DecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW mov tbl, eax mov esi, pRLEBytes mov edi, pDecodeTo - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -1128,7 +1128,7 @@ void Cel2DecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW tbl = &pLightTbl[light_table_index * 256]; w = nWidth; - for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) { + for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) { for (i = w; i;) { width = *src++; if (!(width & 0x80)) { @@ -1195,7 +1195,7 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n mov tbl, eax mov esi, pRLEBytes mov edi, pDecodeTo - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -1308,7 +1308,7 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n w = nWidth; shift = (BYTE)dst & 1; - for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w, shift = (shift + 1) & 1) { + for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w, shift = (shift + 1) & 1) { for (i = w; i;) { width = *src++; if (!(width & 0x80)) { @@ -1504,7 +1504,7 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i tbl = &pLightTbl[idx]; #ifdef USE_ASM - w = 768 + nWidth; + w = BUFFER_WIDTH + nWidth; __asm { mov esi, src @@ -1557,7 +1557,7 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i end = &src[nDataSize]; - for (; src != end; dst -= 768 + nWidth) { + for (; src != end; dst -= BUFFER_WIDTH + nWidth) { for (w = nWidth; w;) { width = *src++; if (!(width & 0x80)) { @@ -1754,7 +1754,7 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth __asm { mov esi, src mov edi, dst - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -1773,10 +1773,10 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth lodsb or al, al jz label4 - mov [edi-768], ah + mov [edi-BUFFER_WIDTH], ah mov [edi-1], ah mov [edi+1], ah - mov [edi+768], ah + mov [edi+BUFFER_WIDTH], ah label4: inc edi loop label3 @@ -1817,17 +1817,17 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth end = &src[nDataSize]; dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; - for (; src != end; dst -= 768 + nWidth) { + for (; src != end; dst -= BUFFER_WIDTH + nWidth) { for (w = nWidth; w;) { width = *src++; if (!(width & 0x80)) { w -= width; while (width) { if (*src++) { - dst[-768] = col; + dst[-BUFFER_WIDTH] = col; dst[-1] = col; dst[1] = col; - dst[768] = col; + dst[BUFFER_WIDTH] = col; } dst++; width--; @@ -1895,7 +1895,7 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi __asm { mov esi, src mov edi, dst - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, nWidth mov w, eax mov ebx, nDataSize @@ -1915,7 +1915,7 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi add edi, eax jmp label9 label3: - sub ecx, 768 + sub ecx, BUFFER_WIDTH cmp edi, ecx jnb label6 mov ecx, eax @@ -1924,10 +1924,10 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi lodsb or al, al jz label5 - mov [edi-768], ah + mov [edi-BUFFER_WIDTH], ah mov [edi-1], ah mov [edi+1], ah - mov [edi+768], ah + mov [edi+BUFFER_WIDTH], ah label5: inc edi loop label4 @@ -1939,7 +1939,7 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi lodsb or al, al jz label8 - mov [edi-768], ah + mov [edi-BUFFER_WIDTH], ah mov [edi-1], ah mov [edi+1], ah label8: @@ -1983,16 +1983,16 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi end = &src[nDataSize]; dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; - for (; src != end; dst -= 768 + nWidth) { + for (; src != end; dst -= BUFFER_WIDTH + nWidth) { for (w = nWidth; w;) { width = *src++; if (!(width & 0x80)) { w -= width; if (dst < gpBufEnd) { - if (dst >= gpBufEnd - 768) { + if (dst >= gpBufEnd - BUFFER_WIDTH) { while (width) { if (*src++) { - dst[-768] = col; + dst[-BUFFER_WIDTH] = col; dst[-1] = col; dst[1] = col; } @@ -2002,10 +2002,10 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi } else { while (width) { if (*src++) { - dst[-768] = col; + dst[-BUFFER_WIDTH] = col; dst[-1] = col; dst[1] = col; - dst[768] = col; + dst[BUFFER_WIDTH] = col; } dst++; width--; @@ -2588,7 +2588,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) test ebx, ebx jnz label10 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx jmp label10 label6: @@ -2606,7 +2606,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) sub ebx, edx jnz label9 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx label9: test eax, eax @@ -2645,7 +2645,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } else { @@ -2659,7 +2659,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } @@ -2676,7 +2676,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } } } @@ -2759,8 +2759,8 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, sub ebx, eax mov [edi+eax], dl label2: - mov [edi-768], dl - mov [edi+768], dl + mov [edi-BUFFER_WIDTH], dl + mov [edi+BUFFER_WIDTH], dl dec eax lea edi, [edi+1] jnz label2 @@ -2775,8 +2775,8 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, jz label5 mov [edi-1], dl mov [edi+1], dl - mov [edi-768], dl - mov [edi+768], dl + mov [edi-BUFFER_WIDTH], dl + mov [edi+BUFFER_WIDTH], dl label5: dec eax lea edi, [edi+1] @@ -2785,7 +2785,7 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, test ebx, ebx jnz label11 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx jmp label11 label7: @@ -2803,7 +2803,7 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, sub ebx, edx jnz label10 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx label10: test eax, eax @@ -2838,14 +2838,14 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, dst[-1] = col; dst[width] = col; while (width) { - dst[-768] = col; - dst[768] = col; + dst[-BUFFER_WIDTH] = col; + dst[BUFFER_WIDTH] = col; dst++; width--; } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } @@ -2856,15 +2856,15 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, if (*src++) { dst[-1] = col; dst[1] = col; - dst[-768] = col; - dst[768] = col; + dst[-BUFFER_WIDTH] = col; + dst[BUFFER_WIDTH] = col; } dst++; width--; } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } @@ -2881,7 +2881,7 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } } } @@ -2991,7 +2991,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi test ebx, ebx jnz label10 mov ebx, sgnWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx jmp label10 label6: @@ -3009,7 +3009,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi sub ebx, edx jnz label9 mov ebx, sgnWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx label9: test eax, eax @@ -3050,7 +3050,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } if (!w) { w = sgnWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } else { @@ -3064,7 +3064,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } if (!w) { w = sgnWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } @@ -3081,7 +3081,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } if (!w) { w = sgnWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } } } @@ -3228,7 +3228,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) test ebx, ebx jnz label11 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx jmp label11 label7: @@ -3246,7 +3246,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) sub ebx, edx jnz label10 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx label10: test eax, eax @@ -3286,7 +3286,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } @@ -3302,7 +3302,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } else { @@ -3322,7 +3322,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } } } @@ -3365,14 +3365,14 @@ void Cl2DecodeClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid if (!nDataSize) nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; - gpBufEnd -= 768; + gpBufEnd -= BUFFER_WIDTH; Cl2DecDatClrHL( &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]], pRLEBytes + nDataStart, nDataSize - nDataStart, nWidth, col); - gpBufEnd += 768; + gpBufEnd += BUFFER_WIDTH; } // 69CF0C: using guessed type int gpBufEnd; @@ -3411,8 +3411,8 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, sub ebx, eax mov [edi+eax], dl label2: - mov [edi-768], dl - mov [edi+768], dl + mov [edi-BUFFER_WIDTH], dl + mov [edi+BUFFER_WIDTH], dl dec eax lea edi, [edi+1] jnz label2 @@ -3432,8 +3432,8 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, jz label6 mov [edi-1], dl mov [edi+1], dl - mov [edi-768], dl - mov [edi+768], dl + mov [edi-BUFFER_WIDTH], dl + mov [edi+BUFFER_WIDTH], dl label6: dec eax lea edi, [edi+1] @@ -3442,7 +3442,7 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, test ebx, ebx jnz label13 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx jmp label13 label9: @@ -3460,7 +3460,7 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, sub ebx, edx jnz label12 mov ebx, nWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx label12: test eax, eax @@ -3495,14 +3495,14 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, dst[-1] = col; dst[width] = col; while (width) { - dst[-768] = col; - dst[768] = col; + dst[-BUFFER_WIDTH] = col; + dst[BUFFER_WIDTH] = col; dst++; width--; } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } @@ -3514,15 +3514,15 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, if (*src++) { dst[-1] = col; dst[1] = col; - dst[-768] = col; - dst[768] = col; + dst[-BUFFER_WIDTH] = col; + dst[BUFFER_WIDTH] = col; } dst++; width--; } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } else { @@ -3542,7 +3542,7 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, } if (!w) { w = nWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } } } @@ -3660,7 +3660,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi test ebx, ebx jnz label11 mov ebx, sgnWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx jmp label11 label7: @@ -3678,7 +3678,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi sub ebx, edx jnz label10 mov ebx, sgnWidth - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx label10: test eax, eax @@ -3720,7 +3720,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } if (!w) { w = sgnWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } @@ -3736,7 +3736,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } if (!w) { w = sgnWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } continue; } else { @@ -3756,7 +3756,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } if (!w) { w = sgnWidth; - dst -= 768 + w; + dst -= BUFFER_WIDTH + w; } } } diff --git a/Source/inv.cpp b/Source/inv.cpp index e6195048..cfc7a095 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -141,7 +141,7 @@ void InvDrawSlotBack(int X, int Y, int W, int H) label5: inc edi loop label2 - sub edi, 768 + sub edi, BUFFER_WIDTH sub edi, ebx dec edx jnz label1 @@ -150,7 +150,7 @@ void InvDrawSlotBack(int X, int Y, int W, int H) int wdt, hgt; BYTE pix; - for (hgt = H; hgt; hgt--, dst -= 768 + W) { + for (hgt = H; hgt; hgt--, dst -= BUFFER_WIDTH + W) { for (wdt = W; wdt; wdt--) { pix = *dst; if (pix >= PAL16_BLUE) { diff --git a/Source/items.cpp b/Source/items.cpp index eb998ddb..544540f9 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2935,7 +2935,7 @@ void DrawULine(int y) mov edi, esi add esi, SCREENXY(26, 25) add edi, yy - mov ebx, 768 - 266 + mov ebx, BUFFER_WIDTH - 266 mov edx, 3 copyline: mov ecx, 266 / 4 @@ -2953,7 +2953,7 @@ void DrawULine(int y) src = &gpBuffer[SCREENXY(26, 25)]; dst = &gpBuffer[PitchTbl[SStringY[y] + 198] + 26 + 64]; - for (i = 0; i < 3; i++, src += 768, dst += 768) + for (i = 0; i < 3; i++, src += BUFFER_WIDTH, dst += BUFFER_WIDTH) memcpy(dst, src, 266); #endif } diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 1d31a49c..9c850037 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -143,7 +143,7 @@ void PrintQTextChr(int sx, int sy, BYTE *pCelBuff, int nCel) sub edx, eax jnz label2 label8: - sub edi, 768 + 22 + sub edi, BUFFER_WIDTH + 22 cmp ebx, esi jnz label1 } @@ -157,7 +157,7 @@ void PrintQTextChr(int sx, int sy, BYTE *pCelBuff, int nCel) src = &pCelBuff[pFrameTable[0]]; end = &src[pFrameTable[1] - pFrameTable[0]]; - for (; src != end; dst -= 768 + 22) { + for (; src != end; dst -= BUFFER_WIDTH + 22) { for (i = 22; i;) { width = *src++; if (!(width & 0x80)) { diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 83d4be3e..cde2ce77 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -552,27 +552,27 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag) drawLowerScreen(dst); } arch_draw_type = 0; - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[3]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[5]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[7]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[9]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[11]; if (level_cel_block != 0 && leveltype == DTYPE_HELL) { drawLowerScreen(dst); @@ -615,7 +615,7 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag) } arch_draw_type = 0; for (i = 2; i < MicroTileLen; i += 2) { - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[i]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -648,27 +648,27 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag) drawLowerScreen(dst); } arch_draw_type = 0; - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[2]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[4]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[6]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[8]; if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[10]; if (level_cel_block != 0 && leveltype == DTYPE_HELL) { drawLowerScreen(dst); @@ -775,7 +775,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, DrawClippedPlayer(p, sx, sy - 1, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, 8); if(eflag && pPlayer->_peflag != 0) { if(pPlayer->_peflag == 2) { - scrollrt_draw_clipped_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16); + scrollrt_draw_clipped_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16); } scrollrt_draw_clipped_e_flag(pBuff - 64, sx - 1, sy + 1, dx - 64, dy); } @@ -818,7 +818,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, DrawClippedPlayer(p, sx, sy, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, 8); if(eflag && pPlayer->_peflag != 0) { if(pPlayer->_peflag == 2) { - scrollrt_draw_clipped_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16); + scrollrt_draw_clipped_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16); } scrollrt_draw_clipped_e_flag(pBuff - 64, sx - 1, sy + 1, dx - 64, dy); } @@ -1025,7 +1025,7 @@ void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int a4, int a5) dst = pBuff; arch_draw_type = 0; for (i = 2; i < MicroTileLen; i += 2) { - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[i]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -1059,7 +1059,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu level_piece_id = dPiece[x][y]; light_table_index = dLight[x][y]; if (level_piece_id != 0) { - dst = &gpBuffer[sx - (768 * 32 - 32) + PitchTbl[sy]]; + dst = &gpBuffer[sx - (BUFFER_WIDTH * 32 - 32) + PitchTbl[sy]]; cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); for (i = 0; i < (MicroTileLen >> 1) - 1; i++) { if (skipChunks <= i) { @@ -1068,10 +1068,10 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu drawLowerScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } if (CelSkip < 8) { - scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0); + scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0); } } } @@ -1092,7 +1092,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu level_piece_id = dPiece[x][y]; light_table_index = dLight[x][y]; if (level_piece_id != 0) { - dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]]; + dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); i = 0; while (i < (MicroTileLen >> 1) - 1) { @@ -1107,10 +1107,10 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu } } i++; - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } if (CelSkip < 8) { - scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 32 * (skipChunks + 1)], x, y, skipChunks, CelSkip, sx, sy, 1); + scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 32 * (skipChunks + 1)], x, y, skipChunks, CelSkip, sx, sy, 1); } } } @@ -1124,7 +1124,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu level_piece_id = dPiece[x][y]; light_table_index = dLight[x][y]; if (level_piece_id != 0) { - dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]]; + dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); for (i = 0; i < (MicroTileLen >> 1) - 1; i++) { if (skipChunks <= i) { @@ -1133,10 +1133,10 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu drawLowerScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } if (CelSkip < 8) { - scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0); + scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0); } } } @@ -1239,7 +1239,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks DrawClippedPlayer(p, sx, sy - 1, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, CelSkip, 8); if(eflag && pPlayer->_peflag != 0) { if(pPlayer->_peflag == 2) { - scrollrt_draw_clipped_e_flag_2(pBuff - (768 * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16); + scrollrt_draw_clipped_e_flag_2(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16); } scrollrt_draw_clipped_e_flag_2(pBuff - 64, sx - 1, sy + 1, skipChunks, CelSkip, dx - 64, dy); } @@ -1282,7 +1282,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks DrawClippedPlayer(p, sx, sy, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, CelSkip, 8); if(eflag && pPlayer->_peflag != 0) { if(pPlayer->_peflag == 2) { - scrollrt_draw_clipped_e_flag_2(pBuff - (768 * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16); + scrollrt_draw_clipped_e_flag_2(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16); } scrollrt_draw_clipped_e_flag_2(pBuff - 64, sx - 1, sy + 1, skipChunks, CelSkip, dx - 64, dy); } @@ -1368,7 +1368,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s level_piece_id = dPiece[x][y]; light_table_index = dLight[x][y]; - dst = &pBuff[768 * 32 * skipChunks]; + dst = &pBuff[BUFFER_WIDTH * 32 * skipChunks]; cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; @@ -1383,7 +1383,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s drawLowerScreen(dst + 32); } case 1: - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[4]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -1393,7 +1393,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s drawLowerScreen(dst + 32); } case 2: - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[6]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -1403,7 +1403,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s drawLowerScreen(dst + 32); } case 3: - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; level_cel_block = pMap->mt[8]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -1453,21 +1453,21 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks arch_draw_type = 0; } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= 1) { level_cel_block = pMap->mt[3]; if (level_cel_block != 0) { drawUpperScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= 2) { level_cel_block = pMap->mt[5]; if (level_cel_block != 0) { drawUpperScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= 3) { level_cel_block = pMap->mt[7]; if (level_cel_block != 0) { @@ -1505,7 +1505,7 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks } arch_draw_type = 0; for (i = 1; i < (MicroTileLen >> 1) - 1; i++) { - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= i) { level_cel_block = pMap->mt[2 * i]; if (level_cel_block != 0) { @@ -1542,21 +1542,21 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks } } arch_draw_type = 0; - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= 1) { level_cel_block = pMap->mt[2]; if (level_cel_block != 0) { drawUpperScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= 2) { level_cel_block = pMap->mt[4]; if (level_cel_block != 0) { drawUpperScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= 3) { level_cel_block = pMap->mt[6]; if (level_cel_block != 0) { @@ -1660,7 +1660,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa DrawPlayer(p, sx, sy - 1, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, CelCap); if (eflag && pPlayer->_peflag != 0) { if (pPlayer->_peflag == 2) { - scrollrt_draw_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16); + scrollrt_draw_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16); } scrollrt_draw_e_flag(pBuff - 64, sx - 1, sy + 1, capChunks, CelCap, dx - 64, dy); } @@ -1703,7 +1703,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa DrawPlayer(p, sx, sy, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, CelCap); if (eflag && pPlayer->_peflag != 0) { if (pPlayer->_peflag == 2) { - scrollrt_draw_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16); + scrollrt_draw_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16); } scrollrt_draw_e_flag(pBuff - 64, sx - 1, sy + 1, capChunks, CelCap, dx - 64, dy); } @@ -1905,7 +1905,7 @@ void scrollrt_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int CelCap, arch_draw_type = 0; for (i = 1; i < (MicroTileLen >> 1) - 1; i++) { - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; if (capChunks >= i) { level_cel_block = pMap->mt[2 * i]; if (level_cel_block != 0) { @@ -2039,7 +2039,7 @@ void DrawZoom(int x, int y) add edi, edx add esi, ecx mov ebx, edi - add ebx, 768 + add ebx, BUFFER_WIDTH mov edx, 176 label1: mov ecx, wdt @@ -2053,7 +2053,7 @@ void DrawZoom(int x, int y) add ebx, 2 dec ecx jnz label2 - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, wdt sub esi, eax add eax, eax @@ -2068,9 +2068,9 @@ void DrawZoom(int x, int y) src = &gpBuffer[nSrcOff]; dst1 = &gpBuffer[nDstOff]; - dst2 = &gpBuffer[nDstOff + 768]; + dst2 = &gpBuffer[nDstOff + BUFFER_WIDTH]; - for (hgt = 176; hgt != 0; hgt--, src -= 768 + wdt, dst1 -= 2 * (768 + wdt), dst2 -= 2 * (768 + wdt)) { + for (hgt = 176; hgt != 0; hgt--, src -= BUFFER_WIDTH + wdt, dst1 -= 2 * (BUFFER_WIDTH + wdt), dst2 -= 2 * (BUFFER_WIDTH + wdt)) { for (i = wdt; i != 0; i--) { *dst1++ = *src; *dst1++ = *src; diff --git a/Source/stores.cpp b/Source/stores.cpp index 664bea7f..364aae70 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -201,12 +201,12 @@ void DrawSLine(int y) xy = SCREENXY(26, 25); yy = PitchTbl[SStringY[y] + 198] + 26 + 64; width = 586 / 4; - line = 768 - 586; + line = BUFFER_WIDTH - 586; } else { xy = SCREENXY(346, 25); yy = PitchTbl[SStringY[y] + 198] + 346 + 64; width = 266 / 4; - line = 768 - 266; + line = BUFFER_WIDTH - 266; } /// ASSERT: assert(gpBuffer); @@ -235,8 +235,8 @@ void DrawSLine(int y) src = &gpBuffer[xy]; dst = &gpBuffer[yy]; - for (i = 0; i < 3; i++, src += 768, dst += 768) - memcpy(dst, src, 768 - line); + for (i = 0; i < 3; i++, src += BUFFER_WIDTH, dst += BUFFER_WIDTH) + memcpy(dst, src, BUFFER_WIDTH - line); #endif } diff --git a/Source/town.cpp b/Source/town.cpp index f05f0341..7dd5e10c 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -17,7 +17,7 @@ void town_clear_upper_buf(BYTE *pBuff) mov ecx, ebx rep stosd add edi, edx - sub edi, 768 + 64 + sub edi, BUFFER_WIDTH + 64 or edx, edx jz label2 sub edx, 2 @@ -33,7 +33,7 @@ void town_clear_upper_buf(BYTE *pBuff) mov ecx, ebx rep stosd add edi, edx - sub edi, 768 + 64 + sub edi, BUFFER_WIDTH + 64 dec ebx add edx, 2 cmp edx, 32 @@ -47,13 +47,13 @@ void town_clear_upper_buf(BYTE *pBuff) dst = pBuff; - for (i = 30, j = 1; i >= 0 && dst >= gpBufEnd; i -= 2, j++, dst -= 768 + 64) { + for (i = 30, j = 1; i >= 0 && dst >= gpBufEnd; i -= 2, j++, dst -= BUFFER_WIDTH + 64) { dst += i; for (k = 0; k < 4 * j; k++) *dst++ = 0; dst += i; } - for (i = 2, j = 15; i != 32 && dst >= gpBufEnd; i += 2, j--, dst -= 768 + 64) { + for (i = 2, j = 15; i != 32 && dst >= gpBufEnd; i += 2, j--, dst -= BUFFER_WIDTH + 64) { dst += i; for (k = 0; k < 4 * j; k++) *dst++ = 0; @@ -83,7 +83,7 @@ void town_clear_low_buf(BYTE *pBuff) rep stosd add edi, edx label3: - sub edi, 768 + 64 + sub edi, BUFFER_WIDTH + 64 or edx, edx jz label4 sub edx, 2 @@ -103,7 +103,7 @@ void town_clear_low_buf(BYTE *pBuff) rep stosd add edi, edx label7: - sub edi, 768 + 64 + sub edi, BUFFER_WIDTH + 64 dec ebx add edx, 2 cmp edx, 32 @@ -115,7 +115,7 @@ void town_clear_low_buf(BYTE *pBuff) dst = pBuff; - for (i = 30, j = 1; i >= 0; i -= 2, j++, dst -= 768 + 64) { + for (i = 30, j = 1; i >= 0; i -= 2, j++, dst -= BUFFER_WIDTH + 64) { if (dst < gpBufEnd) { dst += i; for (k = 0; k < 4 * j; k++) @@ -125,7 +125,7 @@ void town_clear_low_buf(BYTE *pBuff) dst += 64; } } - for (i = 2, j = 15; i != 32; i += 2, j--, dst -= 768 + 64) { + for (i = 2, j = 15; i != 32; i += 2, j--, dst -= BUFFER_WIDTH + 64) { if (dst < gpBufEnd) { dst += i; for (k = 0; k < 4 * j; k++) @@ -156,7 +156,7 @@ void town_special_lower(BYTE *pBuff, int nCel) mov esi, pSpecialCels add esi, [ebx] mov edi, pBuff - mov eax, 768 + 64 + mov eax, BUFFER_WIDTH + 64 mov w, eax mov ebx, end add ebx, esi @@ -210,7 +210,7 @@ void town_special_lower(BYTE *pBuff, int nCel) dst = pBuff; end = &src[pFrameTable[nCel + 1] - pFrameTable[nCel]]; - for(; src != end; dst -= 768 + 64) { + for(; src != end; dst -= BUFFER_WIDTH + 64) { for(w = 64; w;) { width = *src++; if(!(width & 0x80)) { @@ -270,7 +270,7 @@ void town_special_upper(BYTE *pBuff, int nCel) mov esi, pSpecialCels add esi, [ebx] mov edi, pBuff - mov eax, 768 + 64 + mov eax, BUFFER_WIDTH + 64 mov w, eax mov ebx, end add ebx, esi @@ -322,7 +322,7 @@ void town_special_upper(BYTE *pBuff, int nCel) dst = pBuff; end = &src[pFrameTable[nCel + 1] - pFrameTable[nCel]]; - for(; src != end; dst -= 768 + 64) { + for(; src != end; dst -= BUFFER_WIDTH + 64) { for(w = 64; w;) { width = *src++; if(!(width & 0x80)) { @@ -380,7 +380,7 @@ void town_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int sx, int sy) if (level_cel_block != 0) { drawLowerScreen(dst + 32); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_clipped_town(pBuff, x, y, sx, sy, 0); @@ -473,7 +473,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_clipped_town(&gpBuffer[sx + PitchTbl[sy]], x, y, sx, sy, 0); } else { @@ -502,7 +502,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) if (level_cel_block != 0) { drawLowerScreen(dst + 32); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_clipped_town(&gpBuffer[sx + PitchTbl[sy]], x, y, sx, sy, 1); } else { @@ -527,7 +527,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) if (level_cel_block != 0) { drawLowerScreen(dst); } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_clipped_town(&gpBuffer[sx + PitchTbl[sy]], x, y, sx, sy, 0); } else { @@ -548,7 +548,7 @@ void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int a4, int a5, int s if (a4 == 0) { dst = pBuff; } else { - dst = &pBuff[768 * 32 * a4]; + dst = &pBuff[BUFFER_WIDTH * 32 * a4]; } pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; @@ -564,7 +564,7 @@ void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int a4, int a5, int s drawLowerScreen(dst + 32); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } if (a5 < 8) { @@ -650,7 +650,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { - dst = &gpBuffer[sx - (768 * 32 - 32) + PitchTbl[sy]]; + dst = &gpBuffer[sx - (BUFFER_WIDTH * 32 - 32) + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { if (a6 <= i) { @@ -659,7 +659,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl drawLowerScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } if (dir < 8) { town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); @@ -679,7 +679,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { - dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]]; + dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { if (a6 <= i) { @@ -692,10 +692,10 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl drawLowerScreen(dst + 32); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } if (dir < 8) { - town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 16 * dir], x, y, a6, dir, sx, sy, 1); + town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * dir], x, y, a6, dir, sx, sy, 1); } } else { town_clear_low_buf(&gpBuffer[sx + PitchTbl[sy]]); @@ -712,7 +712,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { - dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]]; + dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { if (a6 <= i) { @@ -721,7 +721,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl drawLowerScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } if (dir < 8) { town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); @@ -755,7 +755,7 @@ void town_draw_e_flag(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy drawUpperScreen(dst + 32); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_town_all(pBuff, x, y, a4, dir, sx, sy, 0); @@ -856,7 +856,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag drawUpperScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); } else { @@ -887,7 +887,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag drawUpperScreen(dst + 32); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 1); } else { @@ -914,7 +914,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag drawUpperScreen(dst); } } - dst -= 768 * 32; + dst -= BUFFER_WIDTH * 32; } town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); } else { @@ -1164,7 +1164,7 @@ void T_DrawZoom(int x, int y) add edi, edx add esi, ecx mov ebx, edi - add ebx, 768 + add ebx, BUFFER_WIDTH mov edx, 176 label1: mov ecx, wdt @@ -1178,7 +1178,7 @@ void T_DrawZoom(int x, int y) add ebx, 2 dec ecx jnz label2 - mov eax, 768 + mov eax, BUFFER_WIDTH add eax, wdt sub esi, eax add eax, eax @@ -1193,9 +1193,9 @@ void T_DrawZoom(int x, int y) src = &gpBuffer[nSrcOff]; dst1 = &gpBuffer[nDstOff]; - dst2 = &gpBuffer[nDstOff + 768]; + dst2 = &gpBuffer[nDstOff + BUFFER_WIDTH]; - for (hgt = 176; hgt != 0; hgt--, src -= 768 + wdt, dst1 -= 2 * (768 + wdt), dst2 -= 2 * (768 + wdt)) { + for (hgt = 176; hgt != 0; hgt--, src -= BUFFER_WIDTH + wdt, dst1 -= 2 * (BUFFER_WIDTH + wdt), dst2 -= 2 * (BUFFER_WIDTH + wdt)) { for (i = wdt; i != 0; i--) { *dst1++ = *src; *dst1++ = *src; From e9b4a013c362d6fbc96c9b90a4db0e44911947df Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sun, 2 Jun 2019 23:12:05 +0300 Subject: [PATCH 10/54] Clean up MI_Wave. --- Source/missiles.cpp | 112 +++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 69 deletions(-) diff --git a/Source/missiles.cpp b/Source/missiles.cpp index cad22695..2a8f3063 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -3648,83 +3648,57 @@ void MI_Apoca(int i) void MI_Wave(int i) { - int v1; // esi - int v2; // ebx - int v3; // eax - int v4; // edi - int v5; // ecx - int v6; // eax - int v7; // ebx - int v8; // eax - int v9; // ebx - int v10; // eax - int v11; // ebx - BOOLEAN v12; // zf - int v13; // [esp+Ch] [ebp-2Ch] - int v14; // [esp+10h] [ebp-28h] - int v15; // [esp+14h] [ebp-24h] - int v16; // [esp+14h] [ebp-24h] - signed int v17; // [esp+18h] [ebp-20h] - int *v18; // [esp+1Ch] [ebp-1Ch] - signed int v19; // [esp+20h] [ebp-18h] - int v20; // [esp+24h] [ebp-14h] - int v21; // [esp+24h] [ebp-14h] - int v22; // [esp+28h] [ebp-10h] - int j; // [esp+28h] [ebp-10h] - int id; // [esp+2Ch] [ebp-Ch] - int sx; // [esp+30h] [ebp-8h] - int sy; // [esp+34h] [ebp-4h] - int sya; // [esp+34h] [ebp-4h] + int sx, sy, sd, nxa, nxb, nya, nyb, dira, dirb; + int j, id, pn; + BOOL f1, f2; + int v1, v2; + + f1 = FALSE; + f2 = FALSE; + /// ASSERT: assert((DWORD)i < MAXMISSILES); - v19 = 0; - v1 = i; - v17 = 0; - v2 = missile[i]._mix; id = missile[i]._misource; - v14 = v2; - v20 = missile[i]._miy; - v3 = GetDirection(v2, v20, missile[i]._miVar1, missile[i]._miVar2); - v22 = ((_BYTE)v3 - 2) & 7; - v4 = v3; - v15 = ((_BYTE)v3 + 2) & 7; - v5 = YDirAdd[v3]; - v6 = XDirAdd[v3]; - v7 = v6 + v2; - sy = v5 + v20; - if (!nMissileTable[dPiece[v7][v5 + v20]]) { - v18 = &plr[id]._pdir; - AddMissile(v7, sy, v7 + v6, sy + v5, *v18, MIS_FIREMOVE, 0, id, 0, missile[v1]._mispllvl); - v13 = v22; - sya = YDirAdd[v22] + sy; - v8 = v15; - sx = XDirAdd[v22] + v7; - v16 = v8 * 4; - v9 = XDirAdd[v8]; - v10 = v20 + YDirAdd[v4] + YDirAdd[v8]; - v11 = v14 + XDirAdd[v4] + v9; - v21 = 0; - for (j = v10; v21 < (missile[v1]._mispllvl >> 1) + 2; ++v21) { - if (nMissileTable[dPiece[sx][sya]] || v19 || sx <= 0 || sx >= MAXDUNX || sya <= 0 || sya >= MAXDUNY) { - v19 = 1; + sx = missile[i]._mix; + sy = missile[i]._miy; + v1 = missile[i]._miVar1; + v2 = missile[i]._miVar2; + sd = GetDirection(sx, sy, v1, v2); + dira = (sd - 2) & 7; + dirb = (sd + 2) & 7; + nxa = sx + XDirAdd[sd]; + nya = sy + YDirAdd[sd]; + pn = dPiece[nxa][nya]; + /// ASSERT: assert((DWORD)pn <= MAXTILES); + if (nMissileTable[pn] == 0) { + AddMissile(nxa, nya, nxa + XDirAdd[sd], nya + YDirAdd[sd], plr[id]._pdir, MIS_FIREMOVE, 0, id, 0, missile[i]._mispllvl); + nxa += XDirAdd[dira]; + nya += YDirAdd[dira]; + nxb = sx + XDirAdd[sd] + XDirAdd[dirb]; + nyb = sy + YDirAdd[sd] + YDirAdd[dirb]; + for (j = 0; j < (missile[i]._mispllvl >> 1) + 2; j++) { + pn = dPiece[nxa][nya]; // BUGFIX: dPiece is accessed before check against dungeon size and 0 + /// ASSERT: assert((DWORD)pn <= MAXTILES); + if (nMissileTable[pn] || f1 || nxa <= 0 || nxa >= MAXDUNX || nya <= 0 || nya >= MAXDUNY) { + f1 = TRUE; } else { - AddMissile(sx, sya, sx + XDirAdd[v4], sya + YDirAdd[v4], *v18, MIS_FIREMOVE, 0, id, 0, missile[v1]._mispllvl); - sx += XDirAdd[v13]; - sya += YDirAdd[v13]; - v10 = j; + AddMissile(nxa, nya, nxa + XDirAdd[sd], nya + YDirAdd[sd], plr[id]._pdir, MIS_FIREMOVE, 0, id, 0, missile[i]._mispllvl); + nxa += XDirAdd[dira]; + nya += YDirAdd[dira]; } - if (nMissileTable[dPiece[v11][v10]] || v17 || v11 <= 0 || v11 >= MAXDUNX || v10 <= 0 || v10 >= MAXDUNY) { - v17 = 1; + pn = dPiece[nxb][nyb]; // BUGFIX: dPiece is accessed before check against dungeon size and 0 + /// ASSERT: assert((DWORD)pn <= MAXTILES); + if (nMissileTable[pn] || f2 || nxb <= 0 || nxb >= MAXDUNX || nyb <= 0 || nyb >= MAXDUNY) { + f2 = TRUE; } else { - AddMissile(v11, v10, v11 + XDirAdd[v4], v10 + YDirAdd[v4], *v18, MIS_FIREMOVE, 0, id, 0, missile[v1]._mispllvl); - v11 += *(int *)((char *)XDirAdd + v16); - j += *(int *)((char *)YDirAdd + v16); - v10 = j; + AddMissile(nxb, nyb, nxb + XDirAdd[sd], nyb + YDirAdd[sd], plr[id]._pdir, MIS_FIREMOVE, 0, id, 0, missile[i]._mispllvl); + nxb += XDirAdd[dirb]; + nyb += YDirAdd[dirb]; } } } - v12 = missile[v1]._mirange-- == 1; - if (v12) - missile[v1]._miDelFlag = TRUE; + missile[i]._mirange--; + if (missile[i]._mirange == 0) + missile[i]._miDelFlag = TRUE; } void MI_Nova(int i) From b0e75bc028cf19e6bc2d66a5c732ed92fa119fcb Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Thu, 6 Jun 2019 22:59:12 +0300 Subject: [PATCH 11/54] Clean up mpqapi_store_modified_time. --- Source/mpqapi.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 810a920d..814fccc2 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -574,28 +574,20 @@ void CloseMPQ(const char *pszArchive, BOOL bFree, int dwChar) void mpqapi_store_modified_time(const char *pszArchive, int dwChar) { - int v2; // esi - const char *v3; // ebx - HANDLE v4; // eax - int v5; // esi - struct _WIN32_FIND_DATAA FindFileData; // [esp+8h] [ebp-1E0h] - char dst[160]; // [esp+148h] [ebp-A0h] + HANDLE handle; + struct _WIN32_FIND_DATAA FindFileData; + char dst[160]; - v2 = dwChar; - v3 = pszArchive; if (gbMaxPlayers != 1) { mpqapi_reg_load_modification_time(dst, 160); - v4 = FindFirstFile(v3, &FindFileData); - if (v4 != INVALID_HANDLE_VALUE) { - FindClose(v4); - v5 = 16 * v2; - *(_DWORD *)&dst[v5 + 8] = FindFileData.ftLastWriteTime.dwLowDateTime; - *(_DWORD *)&dst[v5 + 12] = FindFileData.ftLastWriteTime.dwHighDateTime; + handle = FindFirstFile(pszArchive, &FindFileData); + if (handle != INVALID_HANDLE_VALUE) { + FindClose(handle); + *((FILETIME*) (dst) + dwChar * 2 + 1) = FindFileData.ftLastWriteTime; mpqapi_reg_store_modification_time(dst, 160); } } } -// 679660: using guessed type char gbMaxPlayers; void mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar) { From ae8a6cd5b8d821e20ec550a25b1d3bf26e0f0fc0 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Thu, 6 Jun 2019 23:01:59 +0300 Subject: [PATCH 12/54] Clean up mpqapi_store_creation_time. --- Source/mpqapi.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 814fccc2..a6d3ecd0 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -31,28 +31,20 @@ BOOL mpqapi_set_hidden(const char *pszArchive, BOOL hidden) void mpqapi_store_creation_time(const char *pszArchive, int dwChar) { - int v2; // esi - const char *v3; // ebx - HANDLE v4; // eax - int v5; // esi - struct _WIN32_FIND_DATAA FindFileData; // [esp+8h] [ebp-1E0h] - char dst[160]; // [esp+148h] [ebp-A0h] + HANDLE handle; + struct _WIN32_FIND_DATAA FindFileData; + char dst[160]; - v2 = dwChar; - v3 = pszArchive; if (gbMaxPlayers != 1) { mpqapi_reg_load_modification_time(dst, 160); - v4 = FindFirstFile(v3, &FindFileData); - if (v4 != INVALID_HANDLE_VALUE) { - FindClose(v4); - v5 = 16 * v2; - *(_DWORD *)&dst[v5] = FindFileData.ftCreationTime.dwLowDateTime; - *(_DWORD *)&dst[v5 + 4] = FindFileData.ftCreationTime.dwHighDateTime; + handle = FindFirstFile(pszArchive, &FindFileData); + if (handle != INVALID_HANDLE_VALUE) { + FindClose(handle); + *((FILETIME *)(dst) + dwChar * 2) = FindFileData.ftCreationTime; mpqapi_reg_store_modification_time(dst, 160); } } } -// 679660: using guessed type char gbMaxPlayers; BOOL mpqapi_reg_load_modification_time(char *dst, int size) { From 06411651810ef148745bdf29e73a822cb22b45f3 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Thu, 6 Jun 2019 23:57:59 +0300 Subject: [PATCH 13/54] Fix sneaky diff in path_get_node{1,2}. --- Source/path.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/path.cpp b/Source/path.cpp index d3134a2e..008bff71 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -254,7 +254,7 @@ BOOL path_parent_path(PATHNODE *pPath, int dx, int dy, int sx, int sy) /* return a node for (dx,dy) on the frontier, or NULL if not found */ PATHNODE *path_get_node1(int dx, int dy) { - PATHNODE *result = path_2_nodes; + PATHNODE *result = path_2_nodes->NextNode; while (result != NULL && (result->x != dx || result->y != dy)) result = result->NextNode; return result; @@ -263,7 +263,7 @@ PATHNODE *path_get_node1(int dx, int dy) /* return a node for (dx,dy) if it was visited, or NULL if not found */ PATHNODE *path_get_node2(int dx, int dy) { - PATHNODE *result = pnode_ptr; + PATHNODE *result = pnode_ptr->NextNode; while (result != NULL && (result->x != dx || result->y != dy)) result = result->NextNode; return result; From 3c7afcf29f4bbc5f4728d33c13b0ea547dfdfe86 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Thu, 6 Jun 2019 09:53:32 +0300 Subject: [PATCH 14/54] Clean up log_create. --- Source/logging.cpp | 75 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/Source/logging.cpp b/Source/logging.cpp index e71279b2..44e1cefd 100644 --- a/Source/logging.cpp +++ b/Source/logging.cpp @@ -11,7 +11,7 @@ DWORD nNumberOfBytesToWrite; // idb /* data */ -int log_not_created = 1; // weak +BOOL log_not_created = 1; HANDLE log_file = INVALID_HANDLE_VALUE; void __cdecl log_flush(BOOL force_close) @@ -44,53 +44,54 @@ void __cdecl log_flush(BOOL force_close) HANDLE log_create() { - char *v0; // eax - HANDLE v1; // ebx - HANDLE v2; // eax - char *v3; // edx - char Filename[MAX_PATH]; // [esp+Ch] [ebp-15Ch] - VS_FIXEDFILEINFO file_info; // [esp+110h] [ebp-58h] - char Buffer[32]; // [esp+144h] [ebp-24h] - DWORD pcbBuffer; // [esp+164h] [ebp-4h] + char *last_slash_pos; + HANDLE fh; + VS_FIXEDFILEINFO file_info; + DWORD i, j; + char buf[32]; if (log_not_created) { - if (GetModuleFileName(0, Filename, sizeof(Filename)) && (v0 = strrchr(Filename, '\\')) != 0) - v0[1] = 0; - else - Filename[0] = 0; - pcbBuffer = 32; - if (!GetUserName(Buffer, &pcbBuffer)) - Buffer[0] = 0; + char filename_tmp[MAX_PATH]; + if (GetModuleFileName(NULL, filename_tmp, sizeof filename_tmp) == 0) + filename_tmp[0] = '\0'; + else { + last_slash_pos = strrchr(filename_tmp, '\\'); + if (last_slash_pos == NULL) + filename_tmp[0] = '\0'; + else + *(last_slash_pos + 1) = '\0'; + } + i = 32; + if (!GetUserName(buf, &i)) + buf[0] = '\0'; log_get_version(&file_info); _snprintf( FileName, - sizeof(Filename), + sizeof(filename_tmp), "%s%s%02u%02u%02u.ERR", - Filename, - Buffer, - _LOWORD(file_info.dwProductVersionMS), + filename_tmp, + buf, + file_info.dwProductVersionMS & 0xFFFF, file_info.dwProductVersionLS >> 16, - _LOWORD(file_info.dwProductVersionLS)); + file_info.dwProductVersionLS & 0xFFFF); } - v1 = INVALID_HANDLE_VALUE; - for (pcbBuffer = log_not_created == 0; (signed int)pcbBuffer < 2; ++pcbBuffer) { - v2 = CreateFile(FileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - v1 = v2; - if (v2 != INVALID_HANDLE_VALUE) { - if (GetFileSize(v2, 0) > 0x10000) - SetEndOfFile(v1); + fh = INVALID_HANDLE_VALUE; + for (i = log_not_created ? 0 : 1; (int)i < 2; i++) { + fh = CreateFile(FileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (fh != INVALID_HANDLE_VALUE) { + if (GetFileSize(fh, NULL) > 0x10000) + SetEndOfFile(fh); break; } - v3 = strrchr(FileName, '\\'); - if (!v3) - v3 = FileName; - strcpy(Filename, "c:\\"); - memset(&Filename[4], 0, 0x100u); - strcat(Filename, v3); - strcpy(FileName, Filename); + last_slash_pos = strrchr(FileName, '\\'); + if (!last_slash_pos) + last_slash_pos = FileName; + char filename_tmp[MAX_PATH] = "c:\\"; + strcat(filename_tmp, last_slash_pos); + strcpy(FileName, filename_tmp); } - log_not_created = 0; - return v1; + log_not_created = FALSE; + return fh; } // 4947D4: using guessed type int log_not_created; From cd02bc176a5ba7fa4a8af7c76f78096c39c64aa8 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 7 Jun 2019 00:27:59 +0200 Subject: [PATCH 15/54] Remove a bit of garbage --- Source/logging.cpp | 2 +- defs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/logging.cpp b/Source/logging.cpp index 44e1cefd..335d095d 100644 --- a/Source/logging.cpp +++ b/Source/logging.cpp @@ -47,7 +47,7 @@ HANDLE log_create() char *last_slash_pos; HANDLE fh; VS_FIXEDFILEINFO file_info; - DWORD i, j; + DWORD i; char buf[32]; if (log_not_created) { diff --git a/defs.h b/defs.h index 23b44156..0f7eeb55 100644 --- a/defs.h +++ b/defs.h @@ -145,7 +145,6 @@ #define _DWORD unsigned int #define _LOBYTE(x) (*((BYTE*)&(x))) -#define _LOWORD(x) (*((WORD*)&(x))) #endif /* IDA_GARBAGE */ From 64e5fa2f0595241254e1dc9d3b6cbddaf985a7ff Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 7 Jun 2019 00:28:10 +0200 Subject: [PATCH 16/54] Apply enums to NetSendCmdQuest --- Source/quests.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/quests.cpp b/Source/quests.cpp index cb90e20c..d46e94eb 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -257,7 +257,7 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE82; } if (sendmsg) - NetSendCmdQuest(TRUE, 12); + NetSendCmdQuest(TRUE, QTYPE_KING); } else if (monster[m].MType->mtype == MT_CLEAVER) { quests[QTYPE_BUTCH]._qactive = 3; @@ -270,7 +270,7 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE80; } if (sendmsg) - NetSendCmdQuest(TRUE, 6); + NetSendCmdQuest(TRUE, QTYPE_BUTCH); } else if (monster[m].mName == UniqMonst[UMT_GARBUD].mName) { //"Gharbad the Weak" quests[QTYPE_GARB]._qactive = 3; sfxdelay = 30; @@ -315,8 +315,8 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE83; } if (sendmsg) { - NetSendCmdQuest(TRUE, 15); - NetSendCmdQuest(TRUE, 5); + NetSendCmdQuest(TRUE, QTYPE_VB); + NetSendCmdQuest(TRUE, QTYPE_MOD); } } else if (monster[m].mName == UniqMonst[UMT_LAZURUS].mName && gbMaxPlayers == 1) { //"Arch-Bishop Lazarus" quests[QTYPE_VB]._qactive = 3; From a369eb8d46239ccb95aefe3fcc90357abf3d767c Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 8 Jun 2019 12:55:19 +0200 Subject: [PATCH 17/54] Fix DrawSpellList --- Source/control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/control.cpp b/Source/control.cpp index dc41f2d0..97bbc7cd 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -479,7 +479,7 @@ void DrawSpellList() for (t = 0; t < 4; t++) { if (plr[myplr]._pSplHotKey[t] == pSpell && plr[myplr]._pSplTHotKey[t] == pSplType) { DrawSpellCel(x, y, pSpellCels, t + 48, 56); - printf(tempstr, "Spell Hot Key #F%i", t + 5); + sprintf(tempstr, "Spell Hot Key #F%i", t + 5); AddPanelString(tempstr, 1); } } From 334c06c6d32efd2114459bc2f44853bc6cfaba13 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 8 Jun 2019 13:03:14 +0200 Subject: [PATCH 18/54] Correct type in calls to AddPanelString --- Source/control.cpp | 28 +++++++++--------- Source/cursor.cpp | 4 +-- Source/diablo.cpp | 8 ++--- Source/items.cpp | 74 +++++++++++++++++++++++----------------------- Source/monster.cpp | 16 +++++----- 5 files changed, 65 insertions(+), 65 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 97bbc7cd..d5d0c90d 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -436,7 +436,7 @@ void DrawSpellList() sprintf(infostr, "%s Spell", spelldata[pSpell].sNameText); if (pSpell == SPL_HBOLT) { sprintf(tempstr, "Damages undead only"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (s == 0) sprintf(tempstr, "Spell Level 0 - Unusable"); @@ -480,7 +480,7 @@ void DrawSpellList() if (plr[myplr]._pSplHotKey[t] == pSpell && plr[myplr]._pSplTHotKey[t] == pSplType) { DrawSpellCel(x, y, pSpellCels, t + 48, 56); sprintf(tempstr, "Spell Hot Key #F%i", t + 5); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } } } @@ -1342,7 +1342,7 @@ void CheckPanelInfo() } if (PanBtnHotKey[i]) { sprintf(tempstr, "Hotkey : %s", PanBtnHotKey[i]); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } infoclr = COL_WHITE; panelflag = 1; @@ -1355,17 +1355,17 @@ void CheckPanelInfo() panelflag = 1; pinfoflag = TRUE; strcpy(tempstr, "Hotkey : 's'"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); v = plr[myplr]._pRSpell; if (v != -1) { switch (plr[myplr]._pRSplType) { case RSPLTYPE_SKILL: sprintf(tempstr, "%s Skill", spelldata[v].sSkillText); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case RSPLTYPE_SPELL: sprintf(tempstr, "%s Spell", spelldata[v].sNameText); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); c = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[v]; if (c < 0) c = 0; @@ -1373,11 +1373,11 @@ void CheckPanelInfo() sprintf(tempstr, "Spell Level 0 - Unusable"); else sprintf(tempstr, "Spell Level %i", c); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case RSPLTYPE_SCROLL: sprintf(tempstr, "Scroll of %s", spelldata[v].sNameText); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); s = 0; for (i = 0; i < plr[myplr]._pNumInv; i++) { if (plr[myplr].InvList[i]._itype != -1 @@ -1397,16 +1397,16 @@ void CheckPanelInfo() strcpy(tempstr, "1 Scroll"); else sprintf(tempstr, "%i Scrolls", s); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case RSPLTYPE_CHARGES: sprintf(tempstr, "Staff of %s", spelldata[v].sNameText); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges == 1) strcpy(tempstr, "1 Charge"); else sprintf(tempstr, "%i Charges", plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; } } @@ -1551,7 +1551,7 @@ void DrawInfoBox() sprintf(infostr, "%i gold %s", nGold, get_pieces_str(plr[myplr].HoldItem._ivalue)); } else if (!plr[myplr].HoldItem._iStatFlag) { ClearPanel(); - AddPanelString("Requirements not met", 1); + AddPanelString("Requirements not met", TRUE); pinfoflag = TRUE; } else { if (plr[myplr].HoldItem._iIdentified) @@ -1588,9 +1588,9 @@ void DrawInfoBox() strcpy(infostr, plr[pcursplr]._pName); ClearPanel(); sprintf(tempstr, "Level : %i", plr[pcursplr]._pLevel); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); sprintf(tempstr, "Hit Points %i of %i", plr[pcursplr]._pHitPoints >> 6, plr[pcursplr]._pMaxHP >> 6); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } } if (infostr[0] || pnumlines) diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 613ea296..7f072aa1 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -131,7 +131,7 @@ void CheckTown() ClearPanel(); strcpy(infostr, "Town Portal"); sprintf(tempstr, "from %s", plr[missile[mx]._misource]._pName); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); cursmx = missile[mx]._mix; cursmy = missile[mx]._miy; } @@ -160,7 +160,7 @@ void CheckRportal() strcpy(tempstr, "The Unholy Altar"); else strcpy(tempstr, "level 15"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); cursmx = missile[mx]._mix; cursmy = missile[mx]._miy; } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 82d5a828..3c3fa691 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1095,8 +1095,8 @@ void PressKey(int vkey) helpflag = 0; } else if(stextflag) { ClearPanel(); - AddPanelString("No help available", 1); /// BUGFIX: message isn't displayed - AddPanelString("while in stores", 1); + AddPanelString("No help available", TRUE); /// BUGFIX: message isn't displayed + AddPanelString("while in stores", TRUE); track_repeat_walk(0); } else { invflag = 0; @@ -1915,8 +1915,8 @@ void timeout_cursor(BOOL bTimeout) sgnTimeoutCurs = pcurs; multi_net_ping(); ClearPanel(); - AddPanelString("-- Network timeout --", 1); - AddPanelString("-- Waiting for players --", 1); + AddPanelString("-- Network timeout --", TRUE); + AddPanelString("-- Waiting for players --", TRUE); SetCursor_(CURSOR_HOURGLASS); drawpanflag = 255; } diff --git a/Source/items.cpp b/Source/items.cpp index 544540f9..45392cc3 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2585,67 +2585,67 @@ void PrintItemOil(char IDidx) switch (IDidx) { case IMISC_FULLHEAL: strcpy(tempstr, "fully recover life"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_HEAL: strcpy(tempstr, "recover partial life"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_OLDHEAL: strcpy(tempstr, "recover life"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_DEADHEAL: strcpy(tempstr, "deadly heal"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_MANA: strcpy(tempstr, "recover mana"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_FULLMANA: strcpy(tempstr, "fully recover mana"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXSTR: strcpy(tempstr, "increase strength"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXMAG: strcpy(tempstr, "increase magic"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXDEX: strcpy(tempstr, "increase dexterity"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXVIT: strcpy(tempstr, "increase vitality"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXWEAK: strcpy(tempstr, "decrease strength"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXDIS: strcpy(tempstr, "decrease strength"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXCLUM: strcpy(tempstr, "decrease dexterity"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_ELIXSICK: strcpy(tempstr, "decrease vitality"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_REJUV: strcpy(tempstr, "recover life and mana"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; case IMISC_FULLREJUV: strcpy(tempstr, "fully recover life and mana"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); break; } } @@ -2997,30 +2997,30 @@ void PrintItemMisc(ItemStruct *x) { if (x->_iMiscId == IMISC_SCROLL) { strcpy(tempstr, "Right-click to read"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMiscId == IMISC_SCROLLT) { strcpy(tempstr, "Right-click to read, then"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); strcpy(tempstr, "left-click to target"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMiscId >= IMISC_USEFIRST && x->_iMiscId <= IMISC_USELAST) { PrintItemOil(x->_iMiscId); strcpy(tempstr, "Right click to use"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMiscId == IMISC_BOOK) { strcpy(tempstr, "Right click to read"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMiscId == IMISC_MAPOFDOOM) { strcpy(tempstr, "Right click to view"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMiscId == IMISC_EAR) { sprintf(tempstr, "Level : %i", x->_ivalue); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } } @@ -3031,30 +3031,30 @@ void PrintItemDetails(ItemStruct *x) sprintf(tempstr, "damage: %i-%i Indestructible", x->_iMinDam, x->_iMaxDam); else sprintf(tempstr, "damage: %i-%i Dur: %i/%i", x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iClass == ICLASS_ARMOR) { if (x->_iMaxDur == 255) sprintf(tempstr, "armor: %i Indestructible", x->_iAC); else sprintf(tempstr, "armor: %i Dur: %i/%i", x->_iAC, x->_iDurability, x->_iMaxDur); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMiscId == IMISC_STAFF && x->_iMaxCharges) { sprintf(tempstr, "dam: %i-%i Dur: %i/%i", x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); sprintf(tempstr, "Charges: %i/%i", x->_iCharges, x->_iMaxCharges); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iPrePower != -1) { PrintItemPower(x->_iPrePower, x); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iSufPower != -1) { PrintItemPower(x->_iSufPower, x); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMagical == ITEM_QUALITY_UNIQUE) { - AddPanelString("unique item", 1); + AddPanelString("unique item", TRUE); uitemflag = 1; curruitem = *x; } @@ -3067,7 +3067,7 @@ void PrintItemDetails(ItemStruct *x) sprintf(tempstr, "%s %i Mag", tempstr, x->_iMinMag); if (x->_iMinDex) sprintf(tempstr, "%s %i Dex", tempstr, x->_iMinDex); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } pinfoflag = TRUE; } @@ -3079,29 +3079,29 @@ void PrintItemDur(ItemStruct *x) sprintf(tempstr, "damage: %i-%i Indestructible", x->_iMinDam, x->_iMaxDam); else sprintf(tempstr, "damage: %i-%i Dur: %i/%i", x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); if (x->_iMiscId == IMISC_STAFF && x->_iMaxCharges) { sprintf(tempstr, "Charges: %i/%i", x->_iCharges, x->_iMaxCharges); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (x->_iMagical != ITEM_QUALITY_NORMAL) - AddPanelString("Not Identified", 1); + AddPanelString("Not Identified", TRUE); } if (x->_iClass == ICLASS_ARMOR) { if (x->_iMaxDur == 255) sprintf(tempstr, "armor: %i Indestructible", x->_iAC); else sprintf(tempstr, "armor: %i Dur: %i/%i", x->_iAC, x->_iDurability, x->_iMaxDur); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); if (x->_iMagical != ITEM_QUALITY_NORMAL) - AddPanelString("Not Identified", 1); + AddPanelString("Not Identified", TRUE); if (x->_iMiscId == IMISC_STAFF && x->_iMaxCharges) { sprintf(tempstr, "Charges: %i/%i", x->_iCharges, x->_iMaxCharges); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } } if (x->_itype == ITYPE_RING || x->_itype == ITYPE_AMULET) - AddPanelString("Not Identified", 1); + AddPanelString("Not Identified", TRUE); PrintItemMisc(x); if (x->_iMinMag + x->_iMinDex + x->_iMinStr) { strcpy(tempstr, "Required:"); diff --git a/Source/monster.cpp b/Source/monster.cpp index 7301a6b3..3ccfda10 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4995,7 +4995,7 @@ void PrintMonstHistory(int mt) int minHP, maxHP, res; sprintf(tempstr, "Total kills : %i", monstkills[mt]); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); if (monstkills[mt] >= 30) { minHP = monsterdata[mt].mMinHP; maxHP = monsterdata[mt].mMaxHP; @@ -5016,7 +5016,7 @@ void PrintMonstHistory(int mt) maxHP = 4 * maxHP + 3; } sprintf(tempstr, "Hit Points : %i-%i", minHP, maxHP); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (monstkills[mt] >= 15) { if (gnDifficulty != DIFF_HELL) @@ -5026,7 +5026,7 @@ void PrintMonstHistory(int mt) res = res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING); if (!res) { strcpy(tempstr, "No magic resistance"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } else{ if (res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING)) { strcpy(tempstr, "Resists : "); @@ -5037,7 +5037,7 @@ void PrintMonstHistory(int mt) if (res & RESIST_LIGHTNING) strcat(tempstr, "Lightning "); tempstr[strlen(tempstr) - 1] = '\0'; - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } if (res & (IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING)) { strcpy(tempstr, "Immune : "); @@ -5048,7 +5048,7 @@ void PrintMonstHistory(int mt) if (res & IMUNE_LIGHTNING) strcat(tempstr, "Lightning "); tempstr[strlen(tempstr) - 1] = '\0'; - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); } } } @@ -5062,21 +5062,21 @@ void PrintUniqueHistory() res = monster[pcursmonst].mMagicRes & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING); if (!res) { strcpy(tempstr, "No resistances"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); strcpy(tempstr, "No Immunities"); } else { if (res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING)) strcpy(tempstr, "Some Magic Resistances"); else strcpy(tempstr, "No resistances"); - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); if (res & (IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING)) { strcpy(tempstr, "Some Magic Immunities"); } else { strcpy(tempstr, "No Immunities"); } } - AddPanelString(tempstr, 1); + AddPanelString(tempstr, TRUE); pinfoflag = TRUE; } From a22259f06b7e9e5f65b0507eac3b89e1693dd39c Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 8 Jun 2019 14:51:17 +0300 Subject: [PATCH 19/54] Clean up multi_process_network_packets. --- Source/multi.cpp | 138 ++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 80 deletions(-) diff --git a/Source/multi.cpp b/Source/multi.cpp index 81dee629..a440266a 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -443,92 +443,70 @@ void multi_check_drop_player() void multi_process_network_packets() { - //int v0; // eax - TPktHdr *v1; // ecx - TPktHdr *v2; // edi - int v3; // eax - BOOLEAN v4; // zf - unsigned char *v5; // esi - int v6; // ebx - int v7; // eax - int v8; // ecx - int v9; // eax - int v10; // eax - int v11; // esi - int v12; // eax - int v13; // ecx - int v14; // eax - //int v15; // eax - TPktHdr *pkt; // [esp+0h] [ebp-Ch] - int len; // [esp+4h] [ebp-8h] - char arglist[4]; // [esp+8h] [ebp-4h] /* fix, int */ + int dx, dy; + TPktHdr *pkt; + DWORD dwMsgSize; + DWORD dwID; + BOOL cond; + char *data; multi_clear_left_tbl(); multi_process_tmsgs(); - //_LOBYTE(v0) = SNetReceiveMessage((int *)arglist, (char **)&pkt, &len); - if (SNetReceiveMessage((int *)arglist, (char **)&pkt, &len)) { - do { - ++pkt_counter; - multi_clear_left_tbl(); - v1 = pkt; - v2 = pkt; - if ((unsigned int)len >= sizeof(TPktHdr) - && *(_DWORD *)arglist < MAX_PLRS - && pkt->wCheck == 'ip' - && (unsigned short)pkt->wLen == len) { - v3 = *(_DWORD *)arglist; - v4 = *(_DWORD *)arglist == myplr; - plr[v3]._pownerx = (unsigned char)pkt->px; - v5 = &v1->py; - plr[v3]._pownery = (unsigned char)v1->py; - if (!v4) { - v4 = gbBufferMsgs == 1; - plr[v3]._pHitPoints = v1->php; - plr[v3]._pMaxHP = v1->pmhp; - plr[v3]._pBaseStr = (unsigned char)v1->bstr; - plr[v3]._pBaseMag = (unsigned char)v1->bmag; - plr[v3]._pBaseDex = (unsigned char)v1->bdex; - if (!v4 && plr[v3].plractive && plr[v3]._pHitPoints) { - if (currlevel != plr[v3].plrlevel || plr[v3]._pLvlChanging) { - plr[v3].WorldX = (unsigned char)v1->px; - plr[v3].WorldY = (unsigned char)*v5; - plr[v3]._px = (unsigned char)v1->px; - plr[v3]._py = (unsigned char)*v5; - plr[v3]._ptargx = (unsigned char)v1->targx; - plr[v3]._ptargy = (unsigned char)v1->targy; - } else { - v6 = abs(plr[v3].WorldX - (unsigned char)v1->px); - v7 = abs(plr[*(_DWORD *)arglist].WorldY - (unsigned char)*v5); - if ((v6 > 3 || v7 > 3) && !dPlayer[(unsigned char)v2->px][(unsigned char)*v5]) { - FixPlrWalkTags(*(int *)arglist); - v8 = *(_DWORD *)arglist; - v9 = *(_DWORD *)arglist; - plr[v9]._poldx = plr[*(_DWORD *)arglist].WorldX; - plr[v9]._poldy = plr[v9].WorldY; - FixPlrWalkTags(v8); - v10 = *(_DWORD *)arglist; - plr[v10].WorldX = (unsigned char)v2->px; - plr[v10].WorldY = (unsigned char)*v5; - plr[v10]._px = (unsigned char)v2->px; - plr[v10]._py = (unsigned char)*v5; - dPlayer[plr[v10].WorldX][plr[v10].WorldY] = arglist[0] + 1; - } - v11 = abs(plr[*(_DWORD *)arglist]._px - plr[*(_DWORD *)arglist].WorldX); - v12 = abs(plr[*(_DWORD *)arglist]._py - plr[*(_DWORD *)arglist].WorldY); - v13 = *(_DWORD *)arglist; - if (v11 > 1 || v12 > 1) { - v14 = *(_DWORD *)arglist; - plr[v14]._px = plr[*(_DWORD *)arglist].WorldX; - plr[v14]._py = plr[v13].WorldY; - } - MakePlrPath(v13, (unsigned char)v2->targx, (unsigned char)v2->targy, 1u); - } + while (SNetReceiveMessage((int *)&dwID, &data, (int *)&dwMsgSize)) { + pkt_counter++; + multi_clear_left_tbl(); + pkt = (TPktHdr *)data; + if (dwMsgSize < sizeof(TPktHdr)) + continue; + if (dwID >= MAX_PLRS) + continue; + if (pkt->wCheck != 'ip') + continue; + if (pkt->wLen != dwMsgSize) + continue; + plr[dwID]._pownerx = pkt->px; + plr[dwID]._pownery = pkt->py; + if (dwID != myplr) { + // ASSERT: gbBufferMsgs != BUFFER_PROCESS (2) + plr[dwID]._pHitPoints = pkt->php; + plr[dwID]._pMaxHP = pkt->pmhp; + cond = gbBufferMsgs == 1; + plr[dwID]._pBaseStr = pkt->bstr; + plr[dwID]._pBaseMag = pkt->bmag; + plr[dwID]._pBaseDex = pkt->bdex; + if (!cond && plr[dwID].plractive && plr[dwID]._pHitPoints) { + if (currlevel == plr[dwID].plrlevel && !plr[dwID]._pLvlChanging) { + dx = abs(plr[dwID].WorldX - pkt->px); + dy = abs(plr[dwID].WorldY - pkt->py); + if ((dx > 3 || dy > 3) && dPlayer[pkt->px][pkt->py] == 0) { + FixPlrWalkTags(dwID); + plr[dwID]._poldx = plr[dwID].WorldX; + plr[dwID]._poldy = plr[dwID].WorldY; + FixPlrWalkTags(dwID); + plr[dwID].WorldX = pkt->px; + plr[dwID].WorldY = pkt->py; + plr[dwID]._px = pkt->px; + plr[dwID]._py = pkt->py; + dPlayer[plr[dwID].WorldX][plr[dwID].WorldY] = dwID + 1; } + dx = abs(plr[dwID]._px - plr[dwID].WorldX); + dy = abs(plr[dwID]._py - plr[dwID].WorldY); + if (dx > 1 || dy > 1) { + plr[dwID]._px = plr[dwID].WorldX; + plr[dwID]._py = plr[dwID].WorldY; + } + MakePlrPath(dwID, pkt->targx, pkt->targy, TRUE); + } else { + plr[dwID].WorldX = pkt->px; + plr[dwID].WorldY = pkt->py; + plr[dwID]._px = pkt->px; + plr[dwID]._py = pkt->py; + plr[dwID]._ptargx = pkt->targx; + plr[dwID]._ptargy = pkt->targy; } - multi_handle_all_packets(*(int *)arglist, (BYTE *)&v2[1], len - 19); } - //_LOBYTE(v15) = SNetReceiveMessage((int *)arglist, (char **)&pkt, &len); - } while (SNetReceiveMessage((int *)arglist, (char **)&pkt, &len)); + } + multi_handle_all_packets(dwID, (BYTE *)(pkt + 1), dwMsgSize - sizeof (TPktHdr)); } if (SErrGetLastError() != STORM_ERROR_NO_MESSAGES_WAITING) nthread_terminate_game("SNetReceiveMsg"); From f614822f82d4e123388bf1e2dad72278365af436 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 8 Jun 2019 15:11:12 +0300 Subject: [PATCH 20/54] Clean up NetSendHiPri. --- Source/multi.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Source/multi.cpp b/Source/multi.cpp index a440266a..0e235a50 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -128,12 +128,11 @@ void NetRecvPlrData(TPkt *pkt) void NetSendHiPri(BYTE *pbMsg, BYTE bLen) { - unsigned char *v5; // eax - BYTE *v6; // eax - int v7; // eax - int v8; // eax - TPkt pkt; // [esp+Ch] [ebp-204h] - int size; // [esp+20Ch] [ebp-4h] + BYTE *hipri_body; + BYTE *lowpri_body; + DWORD len; + TPkt pkt; + int size; if (pbMsg && bLen) { multi_copy_packet(&sgHiPriBuf, pbMsg, bLen); @@ -142,13 +141,13 @@ void NetSendHiPri(BYTE *pbMsg, BYTE bLen) if (!gbShouldValidatePackage) { gbShouldValidatePackage = TRUE; NetRecvPlrData(&pkt); - size = gdwNormalMsgSize - 19; - v5 = multi_recv_packet(&sgHiPriBuf, pkt.body, &size); - v6 = multi_recv_packet(&sgLoPriBuf, v5, &size); - v7 = sync_all_monsters(v6, size); - v8 = gdwNormalMsgSize - v7; - pkt.hdr.wLen = v8; - if (!SNetSendMessage(-2, &pkt.hdr, v8)) + size = gdwNormalMsgSize - sizeof(TPktHdr); + hipri_body = multi_recv_packet(&sgHiPriBuf, pkt.body, &size); + lowpri_body = multi_recv_packet(&sgLoPriBuf, hipri_body, &size); + size = sync_all_monsters(lowpri_body, size); + len = gdwNormalMsgSize - size; + pkt.hdr.wLen = len; + if (!SNetSendMessage(-2, &pkt.hdr, len)) nthread_terminate_game("SNetSendMessage"); } } From ed6c999c478bbf8de458738aff6b2c72163bda0d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 8 Jun 2019 14:51:14 +0200 Subject: [PATCH 21/54] Enable COPYPROT during compare builds --- .travis.yml | 2 +- MakefileVC | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7026fe31..702111fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,7 @@ jobs: echo '#!/bin/sh' | sudo tee /bin/wine echo 'docker run -v $(pwd):/root/devilution --entrypoint "/usr/bin/wine" diasurgical/riivaaja:stable $(basename $1) $2 $3' | sudo tee --append /bin/wine sudo chmod +x /bin/wine - docker run -v $(pwd):/root/devilution -e MAKE_BUILD=pdb diasurgical/riivaaja:stable + docker run -v $(pwd):/root/devilution -e MAKE_BUILD=pdb -e COPYPROT=1 diasurgical/riivaaja:stable ./devilution-comparer generate-full Diablo.exe --no-mem-disp docker run -v $(pwd):/root/devilution diasurgical/riivaaja:stable ../status.sh after_success: diff --git a/MakefileVC b/MakefileVC index 655b1da2..263c5d4e 100644 --- a/MakefileVC +++ b/MakefileVC @@ -39,6 +39,10 @@ endif CFLAGS=/nologo /c /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /Gr /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /Gm /Zi /FAs LINKFLAGS=/nologo /subsystem:windows /machine:I386 /incremental:no +ifeq ($(COPYPROT),1) + CFLAGS += /D "COPYPROT" +endif + ifeq ($(MAKE_BUILD),pdb) VC_LINK = $(VC6_LINK) LINKFLAGS += /pdb:"Diablo.pdb" /LIBPATH:$(VC6_LIB_DIR) /debug From 3c576ae999377c5f17e2fe4026967bbe27b89b40 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 8 Jun 2019 15:55:38 +0300 Subject: [PATCH 22/54] Clean up init_archives. (#1248) --- Source/init.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/init.cpp b/Source/init.cpp index eab9e576..765430a8 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -223,12 +223,12 @@ void init_await_mom_parent_exit() void init_archives() { - HANDLE a1; // [esp+8h] [ebp-8h] + HANDLE fh; #ifdef COPYPROT - int v1; // [esp+Ch] [ebp-4h] + int result; #endif - - fileinfo.size = 20; + memset (&fileinfo, 0, sizeof (fileinfo)); + fileinfo.size = sizeof (fileinfo); fileinfo.versionstring = gszVersionNumber; fileinfo.executablefile = diablo_exe_path; fileinfo.originalarchivefile = diabdat_mpq_path; @@ -241,14 +241,14 @@ void init_archives() #ifdef COPYPROT if (diabdat_mpq) break; - UiCopyProtError(&v1); - if (v1 == COPYPROT_CANCEL) + UiCopyProtError(&result); + if (result == COPYPROT_CANCEL) FileErrDlg("diabdat.mpq"); } #endif - if (!WOpenFile("ui_art\\title.pcx", &a1, 1)) + if (!WOpenFile("ui_art\\title.pcx", &fh, TRUE)) FileErrDlg("Main program archive: diabdat.mpq"); - WCloseFile(a1); + WCloseFile(fh); patch_rt_mpq = init_test_access(patch_rt_mpq_path, "\\patch_rt.mpq", "DiabloInstall", 2000, FS_PC); } From 5269ada59ec0397418b28fead81d5bae357ee33f Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 8 Jun 2019 16:02:24 +0300 Subject: [PATCH 23/54] Clean up init_test_access. --- 3rdParty/Storm/Source/storm.cpp | 2 +- 3rdParty/Storm/Source/storm.h | 2 +- Source/init.cpp | 56 +++++++++++++++------------------ 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/3rdParty/Storm/Source/storm.cpp b/3rdParty/Storm/Source/storm.cpp index a361d295..93f9d9bb 100644 --- a/3rdParty/Storm/Source/storm.cpp +++ b/3rdParty/Storm/Source/storm.cpp @@ -227,7 +227,7 @@ int STORMAPI SBigToBinaryBuffer(void *buffer, int length, int a3, int a4) rInt; void __stdcall SDrawMessageBox(char *,char *,int) rVoid; void __cdecl SDrawDestroy(void) rVoid; BOOLEAN __cdecl StormDestroy(void) rBool; -BOOLEAN __stdcall SFileSetBasePath(char *) rBool; +BOOL __stdcall SFileSetBasePath(char *) rBool; void __cdecl SDrawRealizePalette(void) rVoid; BOOL __cdecl SVidPlayContinue(void) rBool; BOOL __stdcall SNetGetOwnerTurnsWaiting(DWORD *) rBool; diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index 6a80540c..c0d6daf5 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -1313,7 +1313,7 @@ int STORMAPI SBigToBinaryBuffer(void *buffer, int length, int a3, int a4); void __stdcall SDrawMessageBox(char *,char *,int); void __cdecl SDrawDestroy(void); BOOLEAN __cdecl StormDestroy(void); -BOOLEAN __stdcall SFileSetBasePath(char *); +BOOL __stdcall SFileSetBasePath(char *); void __cdecl SDrawRealizePalette(void); BOOL __cdecl SVidPlayContinue(void); BOOL __stdcall SNetGetOwnerTurnsWaiting(DWORD *); diff --git a/Source/init.cpp b/Source/init.cpp index 765430a8..21d59ec6 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -254,16 +254,12 @@ void init_archives() HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int flags, int fs) { - char *v5; // esi - char *v7; // eax - char Filename[MAX_PATH]; // [esp+Ch] [ebp-314h] - char Buffer[MAX_PATH]; // [esp+110h] [ebp-210h] - char v15[MAX_PATH]; // [esp+214h] [ebp-10Ch] - char *mpq_namea; // [esp+318h] [ebp-8h] - HANDLE archive; // [esp+31Ch] [ebp-4h] + char *last_slash_pos; + char Filename[MAX_PATH]; + char Buffer[MAX_PATH]; + char archive_path[MAX_PATH]; + HANDLE archive; - mpq_namea = mpq_name; - v5 = mpq_path; if (!GetCurrentDirectory(sizeof(Buffer), Buffer)) app_fatal("Can't get program path"); init_strip_trailing_slash(Buffer); @@ -271,47 +267,47 @@ HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int flags app_fatal("SFileSetBasePath"); if (!GetModuleFileName(ghInst, Filename, sizeof(Filename))) app_fatal("Can't get program name"); - v7 = strrchr(Filename, '\\'); - if (v7) - *v7 = 0; + last_slash_pos = strrchr(Filename, '\\'); + if (last_slash_pos) + *last_slash_pos = '\0'; init_strip_trailing_slash(Filename); - strcpy(v5, Buffer); - strcat(v5, mpq_namea); + strcpy(mpq_path, Buffer); + strcat(mpq_path, mpq_name); #ifdef COPYPROT - if (SFileOpenArchive(v5, flags, fs, &archive)) + if (SFileOpenArchive(mpq_path, flags, fs, &archive)) #else - if (SFileOpenArchive(v5, flags, FS_PC, &archive)) + if (SFileOpenArchive(mpq_path, flags, FS_PC, &archive)) #endif return archive; if (strcmp(Filename, Buffer)) { - strcpy(v5, Filename); - strcat(v5, mpq_namea); + strcpy(mpq_path, Filename); + strcat(mpq_path, mpq_name); #ifdef COPYPROT - if (SFileOpenArchive(v5, flags, fs, &archive)) + if (SFileOpenArchive(mpq_path, flags, fs, &archive)) #else - if (SFileOpenArchive(v5, flags, FS_PC, &archive)) + if (SFileOpenArchive(mpq_path, flags, FS_PC, &archive)) #endif return archive; } - v15[0] = 0; + archive_path[0] = '\0'; if (reg_loc) { - if (SRegLoadString("Archives", (const char *)reg_loc, 0, v15, sizeof(v15))) { - init_strip_trailing_slash(v15); - strcpy(v5, v15); - strcat(v5, mpq_namea); + if (SRegLoadString("Archives", reg_loc, 0, archive_path, sizeof(archive_path))) { + init_strip_trailing_slash(archive_path); + strcpy(mpq_path, archive_path); + strcat(mpq_path, mpq_name); #ifdef COPYPROT - if (SFileOpenArchive(v5, flags, fs, &archive)) + if (SFileOpenArchive(mpq_path, flags, fs, &archive)) #else - if (SFileOpenArchive(v5, flags, FS_PC, &archive)) + if (SFileOpenArchive(mpq_path, flags, FS_PC, &archive)) #endif return archive; } } - if (fs == FS_CD && init_read_test_file(v15, mpq_namea, flags, &archive)) { - strcpy(v5, v15); + if (fs != FS_PC && init_read_test_file(archive_path, mpq_name, flags, &archive)) { + strcpy(mpq_path, archive_path); return archive; } - return 0; + return NULL; } char *init_strip_trailing_slash(char *path) From af687e8fd819736eac5797bb5bdc39f698114bbe Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 8 Jun 2019 22:55:16 +0300 Subject: [PATCH 24/54] Clean up mpqapi_flush_and_close. --- Source/mpqapi.cpp | 28 ++++++++++++++++------------ Source/mpqapi.h | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index a6d3ecd0..8629f87c 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -581,21 +581,25 @@ void mpqapi_store_modified_time(const char *pszArchive, int dwChar) } } -void mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar) +BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar) { - if (sghArchive != INVALID_HANDLE_VALUE) { - if (save_archive_modified) { - if (mpqapi_can_seek()) { - if (WriteMPQHeader()) { - if (mpqapi_write_block_table()) - mpqapi_write_hash_table(); - } - } + BOOL ret = FALSE; + if (sghArchive == INVALID_HANDLE_VALUE) + ret = TRUE; + else { + ret = FALSE; + if (!save_archive_modified) + ret = TRUE; + else if (mpqapi_can_seek() && WriteMPQHeader() && mpqapi_write_block_table()) { + if (mpqapi_write_hash_table()) + ret = TRUE; + else + ret = FALSE; } - } - CloseMPQ(pszArchive, bFree, dwChar); + } + CloseMPQ(pszArchive, bFree, dwChar); + return ret; } -// 65AB0C: using guessed type int save_archive_modified; BOOL WriteMPQHeader() { diff --git a/Source/mpqapi.h b/Source/mpqapi.h index abd8fb95..b9b79593 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -29,7 +29,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, int dwChar); BOOL ParseMPQHeader(_FILEHEADER *pHdr, int *pdwNextFileStart); void CloseMPQ(const char *pszArchive, BOOL bFree, int dwChar); void mpqapi_store_modified_time(const char *pszArchive, int dwChar); -void mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar); +BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar); BOOL WriteMPQHeader(); BOOL mpqapi_write_block_table(); BOOL mpqapi_write_hash_table(); From 2bc0fe09d87b42d1cb086c9befd940e3d41a5988 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sun, 9 Jun 2019 08:34:52 +0900 Subject: [PATCH 25/54] mpqapi_alloc_block bin exact (#1250) --- Source/mpqapi.cpp | 75 ++++++++++++++++++++--------------------------- Source/mpqapi.h | 2 +- 2 files changed, 33 insertions(+), 44 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 8629f87c..5e87d0ad 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -1,7 +1,7 @@ #include "diablo.h" #include "../3rdParty/Storm/Source/storm.h" -int sgdwMpqOffset; // idb +DWORD sgdwMpqOffset; char mpq_buf[4096]; _HASHENTRY *sgpHashTbl; BOOL save_archive_modified; // weak @@ -137,58 +137,47 @@ void mpqapi_remove_hash_entry(const char *pszName) block_offset = blockEntry->offset; block_size = blockEntry->sizealloc; memset(blockEntry, 0, sizeof(*blockEntry)); - mpqapi_free_block(block_offset, block_size); + mpqapi_alloc_block(block_offset, block_size); save_archive_modified = 1; } } -void mpqapi_free_block(int block_offset, int block_size) +void mpqapi_alloc_block(int block_offset, int block_size) { - int v2; // esi - int v3; // edi - _BLOCKENTRY *v4; // eax - signed int v5; // edx - signed int v6; // ecx - int v7; // ecx - BOOLEAN v8; // zf - _BLOCKENTRY *v9; // eax + _BLOCKENTRY *block; + int i; - v2 = block_size; - v3 = block_offset; -LABEL_2: - v4 = sgpBlockTbl; - v5 = 2048; - while (1) { - v6 = v5--; - if (!v6) - break; - v7 = v4->offset; - if (v4->offset && !v4->flags && !v4->sizefile) { - if (v7 + v4->sizealloc == v3) { - v3 = v4->offset; - LABEL_11: - v2 += v4->sizealloc; - memset(v4, 0, 0x10u); - goto LABEL_2; + block = sgpBlockTbl; + i = 2048; + while (i-- != 0) { + if (block->offset && !block->flags && !block->sizefile) { + if (block->offset + block->sizealloc == block_offset) { + block_offset = block->offset; + block_size += block->sizealloc; + memset(block, 0, sizeof(_BLOCKENTRY)); + mpqapi_alloc_block(block_offset, block_size); + return; + } + if (block_offset + block_size == block->offset) { + block_size += block->sizealloc; + memset(block, 0, sizeof(_BLOCKENTRY)); + mpqapi_alloc_block(block_offset, block_size); + return; } - if (v3 + v2 == v7) - goto LABEL_11; } - ++v4; + block++; } - v8 = v3 + v2 == sgdwMpqOffset; - if (v3 + v2 > sgdwMpqOffset) { + if (block_offset + block_size > sgdwMpqOffset) { app_fatal("MPQ free list error"); - v8 = v3 + v2 == sgdwMpqOffset; } - if (v8) { - sgdwMpqOffset = v3; + if (block_offset + block_size == sgdwMpqOffset) { + sgdwMpqOffset = block_offset; } else { - v9 = mpqapi_new_block(0); - v9->offset = v3; - v9->sizealloc = v2; - v9->sizefile = 0; - v9->flags = 0; + block = mpqapi_new_block(NULL); + block->offset = block_offset; + block->sizealloc = block_size; + block->sizefile = 0; + block->flags = 0; } } @@ -384,7 +373,7 @@ BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, int dwL if (v14 >= 0x400) { v15 = destsize + v9->offset; v9->sizealloc = destsize; - mpqapi_free_block(v15, v14); + mpqapi_alloc_block(v15, v14); } } return 1; @@ -472,7 +461,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, int dwChar) } if (!sgpBlockTbl || !sgpHashTbl) { memset(&fhdr, 0, sizeof(fhdr)); - if (!ParseMPQHeader(&fhdr, &sgdwMpqOffset)) { + if (!ParseMPQHeader(&fhdr, (int *)&sgdwMpqOffset)) { LABEL_15: CloseMPQ(lpFileName, 1, dwChar); return 0; diff --git a/Source/mpqapi.h b/Source/mpqapi.h index b9b79593..39b772fb 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -14,7 +14,7 @@ void mpqapi_store_default_time(DWORD dwChar); BOOLEAN mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen); _BLOCKENTRY *j_mpqapi_remove_hash_entry(char *pszName); void mpqapi_remove_hash_entry(const char *pszName); -void mpqapi_free_block(int block_offset, int block_size); +void mpqapi_alloc_block(int block_offset, int block_size); _BLOCKENTRY *mpqapi_new_block(int *block_index); int FetchHandle(const char *pszName); int mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale); From 19e4c20841ae64870334a09b5d1fcd459f50bece Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 8 Jun 2019 19:36:28 +0200 Subject: [PATCH 26/54] Remove unused garbage --- defs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/defs.h b/defs.h index 0f7eeb55..5644e393 100644 --- a/defs.h +++ b/defs.h @@ -138,14 +138,7 @@ ///////////////////////////////////////////////////////////////////////// #ifndef IDA_GARBAGE #define IDA_GARBAGE - -// Partially defined types. They are used when the decompiler does not know -// anything about the type except its size. -#define _BYTE unsigned char -#define _DWORD unsigned int - #define _LOBYTE(x) (*((BYTE*)&(x))) - #endif /* IDA_GARBAGE */ // Typedef for the function pointer From 328c74b6267a01ca1e12103857871d1189c7b0ac Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 8 Jun 2019 19:36:42 +0200 Subject: [PATCH 27/54] Correct called methode --- Source/control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/control.cpp b/Source/control.cpp index d5d0c90d..ecfa8721 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2404,7 +2404,7 @@ void control_set_gold_curs(int pnum) else plr[pnum].HoldItem._iCurs = ICURS_GOLD_MEDIUM; - SetCursor_(plr[pnum].HoldItem._iCurs + CURSOR_FIRSTITEM); + NewCursor(plr[pnum].HoldItem._iCurs + CURSOR_FIRSTITEM); } void DrawTalkPan() From 2270bad1b917d6e8e26abc293edad01f83c17151 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 8 Jun 2019 20:55:34 +0200 Subject: [PATCH 28/54] Correct type of dwChar in mpqapi.cpp --- Source/mpqapi.cpp | 16 ++++++++-------- Source/mpqapi.h | 15 +++++++-------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 5e87d0ad..a23bfd80 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -29,7 +29,7 @@ BOOL mpqapi_set_hidden(const char *pszArchive, BOOL hidden) return SetFileAttributes(pszArchive, dwFileAttributesToSet); } -void mpqapi_store_creation_time(const char *pszArchive, int dwChar) +void mpqapi_store_creation_time(const char *pszArchive, DWORD dwChar) { HANDLE handle; struct _WIN32_FIND_DATAA FindFileData; @@ -283,7 +283,7 @@ _BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_i return pBlk; } -BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, int dwLen, _BLOCKENTRY *pBlk) +BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD dwLen, _BLOCKENTRY *pBlk) { const char *v4; // esi const char *v5; // eax @@ -432,7 +432,7 @@ BOOL mpqapi_has_file(const char *pszName) return FetchHandle(pszName) != -1; } -BOOL OpenMPQ(const char *pszArchive, BOOL hidden, int dwChar) +BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar) { const char *v3; // ebp BOOL v4; // esi @@ -461,7 +461,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, int dwChar) } if (!sgpBlockTbl || !sgpHashTbl) { memset(&fhdr, 0, sizeof(fhdr)); - if (!ParseMPQHeader(&fhdr, (int *)&sgdwMpqOffset)) { + if (!ParseMPQHeader(&fhdr, &sgdwMpqOffset)) { LABEL_15: CloseMPQ(lpFileName, 1, dwChar); return 0; @@ -493,7 +493,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, int dwChar) // 65AB14: using guessed type char save_archive_open; // 679660: using guessed type char gbMaxPlayers; -BOOL ParseMPQHeader(_FILEHEADER *pHdr, int *pdwNextFileStart) +BOOL ParseMPQHeader(_FILEHEADER *pHdr, DWORD *pdwNextFileStart) { DWORD size; DWORD NumberOfBytesRead; @@ -533,7 +533,7 @@ BOOL ParseMPQHeader(_FILEHEADER *pHdr, int *pdwNextFileStart) return TRUE; } -void CloseMPQ(const char *pszArchive, BOOL bFree, int dwChar) +void CloseMPQ(const char *pszArchive, BOOL bFree, DWORD dwChar) { if (bFree) { MemFreeDbg(sgpBlockTbl); @@ -553,7 +553,7 @@ void CloseMPQ(const char *pszArchive, BOOL bFree, int dwChar) } } -void mpqapi_store_modified_time(const char *pszArchive, int dwChar) +void mpqapi_store_modified_time(const char *pszArchive, DWORD dwChar) { HANDLE handle; struct _WIN32_FIND_DATAA FindFileData; @@ -570,7 +570,7 @@ void mpqapi_store_modified_time(const char *pszArchive, int dwChar) } } -BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar) +BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, DWORD dwChar) { BOOL ret = FALSE; if (sghArchive == INVALID_HANDLE_VALUE) diff --git a/Source/mpqapi.h b/Source/mpqapi.h index 39b772fb..c1451b36 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -7,12 +7,11 @@ extern BOOL save_archive_modified; // weak extern BOOLEAN save_archive_open; // weak BOOL mpqapi_set_hidden(const char *pszArchive, BOOL hidden); -void mpqapi_store_creation_time(const char *pszArchive, int dwChar); +void mpqapi_store_creation_time(const char *pszArchive, DWORD dwChar); BOOL mpqapi_reg_load_modification_time(char *dst, int size); void mpqapi_xor_buf(char *pbData); void mpqapi_store_default_time(DWORD dwChar); BOOLEAN mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen); -_BLOCKENTRY *j_mpqapi_remove_hash_entry(char *pszName); void mpqapi_remove_hash_entry(const char *pszName); void mpqapi_alloc_block(int block_offset, int block_size); _BLOCKENTRY *mpqapi_new_block(int *block_index); @@ -21,15 +20,15 @@ int mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale); void mpqapi_remove_hash_entries(BOOL(__stdcall *fnGetName)(DWORD, char *)); BOOL mpqapi_write_file(const char *pszName, const BYTE *pbData, DWORD dwLen); _BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_index); -BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, int dwLen, _BLOCKENTRY *pBlk); +BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD dwLen, _BLOCKENTRY *pBlk); int mpqapi_find_free_block(int size, int *block_size); void mpqapi_rename(char *pszOld, char *pszNew); BOOL mpqapi_has_file(const char *pszName); -BOOL OpenMPQ(const char *pszArchive, BOOL hidden, int dwChar); -BOOL ParseMPQHeader(_FILEHEADER *pHdr, int *pdwNextFileStart); -void CloseMPQ(const char *pszArchive, BOOL bFree, int dwChar); -void mpqapi_store_modified_time(const char *pszArchive, int dwChar); -BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar); +BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar); +BOOL ParseMPQHeader(_FILEHEADER *pHdr, DWORD *pdwNextFileStart); +void CloseMPQ(const char *pszArchive, BOOL bFree, DWORD dwChar); +void mpqapi_store_modified_time(const char *pszArchive, DWORD dwChar); +BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, DWORD dwChar); BOOL WriteMPQHeader(); BOOL mpqapi_write_block_table(); BOOL mpqapi_write_hash_table(); From 78a8c05925dd9ca3cd0ab2588e84f3c86724e7dc Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 9 Jun 2019 01:50:02 +0200 Subject: [PATCH 29/54] Clean up ParseMPQHeader --- structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/structs.h b/structs.h index f7fd05cb..d052fdb5 100644 --- a/structs.h +++ b/structs.h @@ -1472,7 +1472,7 @@ typedef struct _FILEHEADER { int signature; int headersize; int filesize; - short version; + WORD version; short sectorsizeid; int hashoffset; int blockoffset; From a55d2a811f9518a2a28872f77aaba9e6bfb952f2 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 9 Jun 2019 01:52:24 +0200 Subject: [PATCH 30/54] Clean up mpqapi.cpp --- Source/mpqapi.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index a23bfd80..d247d319 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -4,7 +4,7 @@ DWORD sgdwMpqOffset; char mpq_buf[4096]; _HASHENTRY *sgpHashTbl; -BOOL save_archive_modified; // weak +BOOL save_archive_modified; _BLOCKENTRY *sgpBlockTbl; BOOLEAN save_archive_open; // weak @@ -457,7 +457,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar) if (sghArchive == INVALID_HANDLE_VALUE) return 0; save_archive_open = 1; - save_archive_modified = 1; + save_archive_modified = TRUE; } if (!sgpBlockTbl || !sgpHashTbl) { memset(&fhdr, 0, sizeof(fhdr)); @@ -489,7 +489,6 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar) } return 1; } -// 65AB0C: using guessed type int save_archive_modified; // 65AB14: using guessed type char save_archive_open; // 679660: using guessed type char gbMaxPlayers; @@ -526,7 +525,7 @@ BOOL ParseMPQHeader(_FILEHEADER *pHdr, DWORD *pdwNextFileStart) pHdr->sectorsizeid = 3; pHdr->version = 0; *pdwNextFileStart = 0x10068; - save_archive_modified = 1; + save_archive_modified = TRUE; save_archive_open = 1; } @@ -564,7 +563,7 @@ void mpqapi_store_modified_time(const char *pszArchive, DWORD dwChar) handle = FindFirstFile(pszArchive, &FindFileData); if (handle != INVALID_HANDLE_VALUE) { FindClose(handle); - *((FILETIME*) (dst) + dwChar * 2 + 1) = FindFileData.ftLastWriteTime; + *((FILETIME *)(dst) + dwChar * 2 + 1) = FindFileData.ftLastWriteTime; mpqapi_reg_store_modification_time(dst, 160); } } @@ -572,22 +571,22 @@ void mpqapi_store_modified_time(const char *pszArchive, DWORD dwChar) BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, DWORD dwChar) { - BOOL ret = FALSE; - if (sghArchive == INVALID_HANDLE_VALUE) + BOOL ret = FALSE; + if (sghArchive == INVALID_HANDLE_VALUE) ret = TRUE; else { - ret = FALSE; - if (!save_archive_modified) - ret = TRUE; - else if (mpqapi_can_seek() && WriteMPQHeader() && mpqapi_write_block_table()) { - if (mpqapi_write_hash_table()) + ret = FALSE; + if (!save_archive_modified) + ret = TRUE; + else if (mpqapi_can_seek() && WriteMPQHeader() && mpqapi_write_block_table()) { + if (mpqapi_write_hash_table()) ret = TRUE; else ret = FALSE; } - } - CloseMPQ(pszArchive, bFree, dwChar); - return ret; + } + CloseMPQ(pszArchive, bFree, dwChar); + return ret; } BOOL WriteMPQHeader() From 0022702c38148f4193dda8bdbfa1df6bc1f09832 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 9 Jun 2019 19:41:40 +0200 Subject: [PATCH 31/54] Clean up CalcPlrInv calls --- Source/inv.cpp | 14 +++++--------- Source/items.cpp | 6 +++--- Source/pack.cpp | 2 +- Source/stores.cpp | 6 +++--- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Source/inv.cpp b/Source/inv.cpp index cfc7a095..4a9fb73b 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1079,7 +1079,7 @@ void CheckInvPaste(int pnum, int mx, int my) drawsbarflag = 1; break; } - CalcPlrInv(pnum, 1); + CalcPlrInv(pnum, TRUE); if (pnum == myplr) { if (cn == 1) SetCursorPos(MouseX + (cursW >> 1), MouseY + (cursH >> 1)); @@ -1271,19 +1271,15 @@ void CheckInvCut(int pnum, int mx, int my) void inv_update_rem_item(int pnum, BYTE iv) { - BOOL Loadgfx; - if (iv < NUM_INVLOC) { plr[pnum].InvBody[iv]._itype = ITYPE_NONE; } - Loadgfx = FALSE; - - if (plr[pnum]._pmode != PM_DEATH) { - Loadgfx = TRUE; + if (plr[pnum]._pmode == PM_DEATH) { + CalcPlrInv(pnum, FALSE); + } else { + CalcPlrInv(pnum, TRUE); } - - CalcPlrInv(pnum, Loadgfx); } void RemoveInvItem(int pnum, int iv) diff --git a/Source/items.cpp b/Source/items.cpp index 45392cc3..4d59d04a 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2492,7 +2492,7 @@ void CheckIdentify(int pnum, int cii) pi = &plr[pnum].InvBody[cii]; pi->_iIdentified = TRUE; - CalcPlrInv(pnum, 1); + CalcPlrInv(pnum, TRUE); if (pnum == myplr) SetCursor_(CURSOR_HAND); @@ -2508,7 +2508,7 @@ void DoRepair(int pnum, int cii) PlaySfxLoc(IS_REPAIR, p->WorldX, p->WorldY); RepairItem(pi, p->_pLevel); - CalcPlrInv(pnum, 1); + CalcPlrInv(pnum, TRUE); if (pnum == myplr) SetCursor_(CURSOR_HAND); @@ -2557,7 +2557,7 @@ void DoRecharge(int pnum, int cii) r = spelldata[pi->_iSpell].sBookLvl; r = random(38, p->_pLevel / r) + 1; RechargeItem(pi, r); - CalcPlrInv(pnum, 1); + CalcPlrInv(pnum, TRUE); } if (pnum == myplr) diff --git a/Source/pack.cpp b/Source/pack.cpp index c79f6ebf..af1f7d07 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -208,7 +208,7 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok) witchitem[i]._itype = -1; } - CalcPlrInv(pnum, 0); + CalcPlrInv(pnum, FALSE); pPlayer->pTownWarps = 0; pPlayer->pDungMsgs = 0; pPlayer->pLvlLoad = 0; diff --git a/Source/stores.cpp b/Source/stores.cpp index 364aae70..5eaccfca 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -1883,7 +1883,7 @@ void SmithBuyItem() } smithitem[idx]._itype = ITYPE_NONE; } - CalcPlrInv(myplr, 1); + CalcPlrInv(myplr, TRUE); } void S_SBuyEnter() @@ -2267,7 +2267,7 @@ void WitchRechargeItem() else plr[myplr].InvList[i]._iCharges = plr[myplr].InvList[i]._iMaxCharges; - CalcPlrInv(myplr, 1u); + CalcPlrInv(myplr, TRUE); } void S_WRechargeEnter() @@ -2320,7 +2320,7 @@ void BoyBuyItem() StoreAutoPlace(); boyitem._itype = ITYPE_NONE; stextshold = STORE_BOY; - CalcPlrInv(myplr, 1); + CalcPlrInv(myplr, TRUE); } void HealerBuyItem() From 85651c015a55d693b147adf37da028c784e0eb63 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 10 Jun 2019 22:33:44 +0200 Subject: [PATCH 32/54] Consistent var naming in engine.cpp --- Source/engine.cpp | 216 ++++++++++++++++++++++++---------------------- 1 file changed, 114 insertions(+), 102 deletions(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index 709e5af9..4e1184a6 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -5,15 +5,15 @@ #pragma warning(disable : 4731) // frame pointer register 'ebp' modified by inline assembly code #endif -char gbPixelCol; // automap pixel color 8-bit (palette entry) +char gbPixelCol; // automap pixel color 8-bit (palette entry) int gbRotateMap; // BOOLEAN flip - if y < x -int orgseed; // weak +int orgseed; // weak int sgnWidth; int sglGameSeed; // weak #ifdef __cplusplus static CCritSect sgMemCrit; #endif -int SeedCount; // weak +int SeedCount; // weak int gbNotInView; // BOOLEAN valid - if x/y are in bounds const int rand_increment = 1; @@ -164,7 +164,7 @@ void CelDecDatOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth) */ void CelDrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes; DWORD *pFrameTable; @@ -176,13 +176,14 @@ void CelDrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Ce return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) return; nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; - if (CelCap == 8) nDataCap = 0; else @@ -205,7 +206,7 @@ void CelDrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Ce */ void CelDecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes; DWORD *pFrameTable; @@ -217,13 +218,14 @@ void CelDecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int Cel return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) return; nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; - if (CelCap == 8) nDataCap = 0; else @@ -610,7 +612,7 @@ void CelDecodeLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) */ void CelDecodeHdrLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; @@ -622,13 +624,14 @@ void CelDecodeHdrLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) return; nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; - if (CelCap == 8) nDataCap = 0; else @@ -654,7 +657,7 @@ void CelDecodeHdrLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, */ void CelDecodeHdrLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes; DWORD *pFrameTable; @@ -666,13 +669,14 @@ void CelDecodeHdrLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, i return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) return; nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; - if (CelCap == 8) nDataCap = 0; else @@ -700,8 +704,8 @@ void CelDecodeHdrLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, i */ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light) { - int w, idx, nDataStart, nDataCap, nDataSize; - BYTE *src, *dst, *tbl; + int nDataStart, nDataSize, nDataCap, w, idx; + BYTE *pRLEBytes, *dst, *tbl; DWORD *pFrameTable; /// ASSERT: assert(gpBuffer); @@ -712,23 +716,24 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in return; pFrameTable = (DWORD *)pCelBuff; - src = &pCelBuff[pFrameTable[nCel]]; - nDataStart = *(WORD *)&src[CelSkip]; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; + nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) return; nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; - if (CelCap == 8) nDataCap = 0; else - nDataCap = *(WORD *)&src[CelCap]; + nDataCap = *(WORD *)&pRLEBytes[CelCap]; if (nDataCap) nDataSize = nDataCap - nDataStart; else nDataSize -= nDataStart; - src += nDataStart; + pRLEBytes += nDataStart; dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; idx = light4flag ? 1024 : 4096; @@ -741,7 +746,7 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in #ifdef USE_ASM __asm { - mov esi, src + mov esi, pRLEBytes mov edi, dst mov eax, BUFFER_WIDTH add eax, nWidth @@ -786,16 +791,16 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in BYTE width; BYTE *end; - end = &src[nDataSize]; + end = &pRLEBytes[nDataSize]; - for (; src != end; dst -= BUFFER_WIDTH + nWidth) { + for (; pRLEBytes != end; dst -= BUFFER_WIDTH + nWidth) { for (w = nWidth; w;) { - width = *src++; + width = *pRLEBytes++; if (!(width & 0x80)) { w -= width; while (width) { - *dst = tbl[*src]; - src++; + *dst = tbl[*pRLEBytes]; + pRLEBytes++; dst++; width--; } @@ -930,7 +935,7 @@ void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) */ void Cel2DrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes; DWORD *pFrameTable; @@ -942,13 +947,14 @@ void Cel2DrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) return; nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; - if (CelCap == 8) nDataCap = 0; else @@ -971,7 +977,7 @@ void Cel2DrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C */ void Cel2DecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes; DWORD *pFrameTable; @@ -983,6 +989,8 @@ void Cel2DecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int Ce return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -1380,7 +1388,7 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n */ void Cel2DecodeHdrLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; @@ -1392,6 +1400,8 @@ void Cel2DecodeHdrLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -1423,7 +1433,7 @@ void Cel2DecodeHdrLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in */ void Cel2DecodeLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataCap, nDataSize; + int nDataStart, nDataSize, nDataCap; BYTE *pRLEBytes; DWORD *pFrameTable; @@ -1432,6 +1442,8 @@ void Cel2DecodeLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int return; pFrameTable = (DWORD *)pCelBuff; + /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -1465,8 +1477,8 @@ void Cel2DecodeLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int */ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light) { - int w, hdr, idx, nDataSize, v1; - BYTE *src, *dst, *tbl; + int nDataStart, nDataSize, nDataCap, w, idx; + BYTE *pRLEBytes, *dst, *tbl; DWORD *pFrameTable; /// ASSERT: assert(gpBuffer); @@ -1477,22 +1489,22 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i return; pFrameTable = (DWORD *)pCelBuff; - src = &pCelBuff[pFrameTable[nCel]]; - hdr = *(WORD *)&src[CelSkip]; - if (!hdr) + pRLEBytes = &pCelBuff[pFrameTable[nCel]]; + nDataStart = *(WORD *)&pRLEBytes[CelSkip]; + if (!nDataStart) return; nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; if (CelCap == 8) - v1 = 0; + nDataCap = 0; else - v1 = *(WORD *)&src[CelCap]; - if (v1) - nDataSize = v1 - hdr; + nDataCap = *(WORD *)&pRLEBytes[CelCap]; + if (nDataCap) + nDataSize = nDataCap - nDataStart; else - nDataSize -= hdr; + nDataSize -= nDataStart; - src += hdr; + pRLEBytes += nDataStart; dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; idx = light4flag ? 1024 : 4096; @@ -1507,7 +1519,7 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i w = BUFFER_WIDTH + nWidth; __asm { - mov esi, src + mov esi, pRLEBytes mov edi, dst mov ecx, nDataSize add ecx, esi @@ -1555,22 +1567,22 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i BYTE width; BYTE *end; - end = &src[nDataSize]; + end = &pRLEBytes[nDataSize]; - for (; src != end; dst -= BUFFER_WIDTH + nWidth) { + for (; pRLEBytes != end; dst -= BUFFER_WIDTH + nWidth) { for (w = nWidth; w;) { - width = *src++; + width = *pRLEBytes++; if (!(width & 0x80)) { w -= width; if (dst < gpBufEnd) { while (width) { - *dst = tbl[*src]; - src++; + *dst = tbl[*pRLEBytes]; + pRLEBytes++; dst++; width--; } } else { - src += width; + pRLEBytes += width; dst += width; } } else { @@ -1587,7 +1599,7 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i void CelDecodeRect(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, int nCel, int nWidth) { - BYTE *src, *dst, *end; + BYTE *pRLEBytes, *dst, *end; /// ASSERT: assert(pCelBuff != NULL); if (!pCelBuff) @@ -1607,13 +1619,13 @@ void CelDecodeRect(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, i mov end, eax mov eax, pCelBuff add eax, [ebx] - mov src, eax + mov pRLEBytes, eax } dst = &pBuff[hgt * wdt + CelSkip]; __asm { - mov esi, src + mov esi, pRLEBytes mov edi, dst mov eax, wdt add eax, nWidth @@ -1660,34 +1672,34 @@ void CelDecodeRect(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, i DWORD *pFrameTable; pFrameTable = (DWORD *)&pCelBuff[4 * nCel]; - src = &pCelBuff[pFrameTable[0]]; - end = &src[pFrameTable[1] - pFrameTable[0]]; + pRLEBytes = &pCelBuff[pFrameTable[0]]; + end = &pRLEBytes[pFrameTable[1] - pFrameTable[0]]; dst = &pBuff[hgt * wdt + CelSkip]; - for (; src != end; dst -= wdt + nWidth) { + for (; pRLEBytes != end; dst -= wdt + nWidth) { for (i = nWidth; i;) { - width = *src++; + width = *pRLEBytes++; if (!(width & 0x80)) { i -= width; if (width & 1) { - dst[0] = src[0]; - src++; + dst[0] = pRLEBytes[0]; + pRLEBytes++; dst++; } width >>= 1; if (width & 1) { - dst[0] = src[0]; - dst[1] = src[1]; - src += 2; + dst[0] = pRLEBytes[0]; + dst[1] = pRLEBytes[1]; + pRLEBytes += 2; dst += 2; } width >>= 1; while (width) { - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = src[3]; - src += 4; + dst[0] = pRLEBytes[0]; + dst[1] = pRLEBytes[1]; + dst[2] = pRLEBytes[2]; + dst[3] = pRLEBytes[3]; + pRLEBytes += 4; dst += 4; width--; } @@ -1707,8 +1719,8 @@ void CelDecodeRect(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, i */ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int w, nDataStart, nDataCap, nDataSize; - BYTE *src, *dst; + int nDataStart, nDataSize, nDataCap, w; + BYTE *pRLEBytes, *dst; /// ASSERT: assert(pCelBuff != NULL); if (!pCelBuff) @@ -1728,12 +1740,12 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth mov nDataSize, eax mov edx, pCelBuff add edx, [ebx] - mov src, edx + mov pRLEBytes, edx add edx, CelSkip xor eax, eax mov ax, [edx] mov nDataStart, eax - mov edx, src + mov edx, pRLEBytes add edx, CelCap mov ax, [edx] mov nDataCap, eax @@ -1748,11 +1760,11 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth else nDataSize -= nDataStart; - src += nDataStart; + pRLEBytes += nDataStart; dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; __asm { - mov esi, src + mov esi, pRLEBytes mov edi, dst mov eax, BUFFER_WIDTH add eax, nWidth @@ -1795,7 +1807,7 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth } #else BYTE width; - BYTE *end, *pRLEBytes; + BYTE *end, *src; DWORD *pFrameTable; pFrameTable = (DWORD *)&pCelBuff[4 * nCel]; @@ -1848,8 +1860,8 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth */ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int w, nDataStart, nDataCap, nDataSize; - BYTE *src, *dst; + int nDataStart, nDataSize, nDataCap, w; + BYTE *pRLEBytes, *dst; /// ASSERT: assert(pCelBuff != NULL); if (!pCelBuff) @@ -1869,12 +1881,12 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi mov nDataSize, eax mov edx, pCelBuff add edx, [ebx] - mov src, edx + mov pRLEBytes, edx add edx, CelSkip xor eax, eax mov ax, [edx] mov nDataStart, eax - mov edx, src + mov edx, pRLEBytes add edx, CelCap mov ax, [edx] mov nDataCap, eax @@ -1889,11 +1901,11 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi else nDataSize -= nDataStart; - src += nDataStart; + pRLEBytes += nDataStart; dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; __asm { - mov esi, src + mov esi, pRLEBytes mov edi, dst mov eax, BUFFER_WIDTH add eax, nWidth @@ -1961,7 +1973,7 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi } #else BYTE width; - BYTE *end, *pRLEBytes; + BYTE *end, *src; DWORD *pFrameTable; pFrameTable = (DWORD *)&pCelBuff[4 * nCel]; @@ -2370,7 +2382,7 @@ int random(BYTE idx, int v) void engine_debug_trap(BOOL show_cursor) { -/* + /* TMemBlock *pCurr; sgMemCrit.Enter(); @@ -2444,14 +2456,14 @@ DWORD LoadFileWithMem(const char *pszName, void *p) HANDLE hsFile; /// ASSERT: assert(pszName); - if(p == NULL) { + if (p == NULL) { app_fatal("LoadFileWithMem(NULL):\n%s", pszName); } WOpenFile(pszName, &hsFile, FALSE); dwFileLen = WGetFileSize(hsFile, NULL); - if(dwFileLen == 0) { + if (dwFileLen == 0) { app_fatal("Zero length SFILE:\n%s", pszName); } @@ -2894,8 +2906,8 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, */ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light) { - int hdr, idx, nDataSize; - BYTE *pRLEBytes; + int nDataStart, nDataSize, nDataCap, idx; + BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); @@ -2912,8 +2924,8 @@ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; - hdr = *(WORD *)&pRLEBytes[CelSkip]; - if (!hdr) + nDataStart = *(WORD *)&pRLEBytes[CelSkip]; + if (!nDataStart) return; if (CelCap == 8) @@ -2931,8 +2943,8 @@ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel Cl2DecDatLightTbl1( &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]], - &pRLEBytes[hdr], - nDataSize - hdr, + &pRLEBytes[nDataStart], + nDataSize - nDataStart, nWidth, &pLightTbl[idx]); } @@ -3095,7 +3107,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi */ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int hdr, nDataSize; + int nDataStart, nDataSize; BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; @@ -3113,8 +3125,8 @@ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; - hdr = *(WORD *)&pRLEBytes[CelSkip]; - if (!hdr) + nDataStart = *(WORD *)&pRLEBytes[CelSkip]; + if (!nDataStart) return; if (CelCap == 8) @@ -3127,9 +3139,9 @@ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int pDecodeTo = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; if (light_table_index) - Cl2DecDatLightTbl1(pDecodeTo, &pRLEBytes[hdr], nDataSize - hdr, nWidth, &pLightTbl[light_table_index * 256]); + Cl2DecDatLightTbl1(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth, &pLightTbl[light_table_index * 256]); else - Cl2DecDatFrm1(pDecodeTo, &pRLEBytes[hdr], nDataSize - hdr, nWidth); + Cl2DecDatFrm1(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth); } // 69BEF8: using guessed type int light_table_index; @@ -3556,7 +3568,7 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, */ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light) { - int hdr, idx, nDataSize; + int nDataStart, nDataSize, idx; BYTE *pRLEBytes; DWORD *pFrameTable; @@ -3574,8 +3586,8 @@ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; - hdr = *(WORD *)&pRLEBytes[CelSkip]; - if (!hdr) + nDataStart = *(WORD *)&pRLEBytes[CelSkip]; + if (!nDataStart) return; if (CelCap == 8) @@ -3593,8 +3605,8 @@ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel Cl2DecDatLightTbl2( &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]], - &pRLEBytes[hdr], - nDataSize - hdr, + &pRLEBytes[nDataStart], + nDataSize - nDataStart, nWidth, &pLightTbl[idx]); } @@ -3771,7 +3783,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi */ void Cl2DecodeFrm6(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int hdr, nDataSize; + int nDataStart, nDataSize; BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; @@ -3789,8 +3801,8 @@ void Cl2DecodeFrm6(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; - hdr = *(WORD *)&pRLEBytes[CelSkip]; - if (!hdr) + nDataStart = *(WORD *)&pRLEBytes[CelSkip]; + if (!nDataStart) return; if (CelCap == 8) @@ -3803,9 +3815,9 @@ void Cl2DecodeFrm6(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel pDecodeTo = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; if (light_table_index) - Cl2DecDatLightTbl2(pDecodeTo, &pRLEBytes[hdr], nDataSize - hdr, nWidth, &pLightTbl[light_table_index * 256]); + Cl2DecDatLightTbl2(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth, &pLightTbl[light_table_index * 256]); else - Cl2DecDatFrm4(pDecodeTo, &pRLEBytes[hdr], nDataSize - hdr, nWidth); + Cl2DecDatFrm4(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth); } // 69BEF8: using guessed type int light_table_index; From 0397dbe9e3358aa70940e378f0aeb135dd418039 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 11 Jun 2019 11:08:50 +0200 Subject: [PATCH 33/54] Allign similar code in engine.cpp --- Source/engine.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index 4e1184a6..d41691a2 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -176,7 +176,6 @@ void CelDrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Ce return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -218,7 +217,6 @@ void CelDecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int Cel return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -624,7 +622,6 @@ void CelDecodeHdrLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -669,7 +666,6 @@ void CelDecodeHdrLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, i return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -716,7 +712,6 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -947,7 +942,6 @@ void Cel2DrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -989,7 +983,6 @@ void Cel2DecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int Ce return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -1400,7 +1393,6 @@ void Cel2DecodeHdrLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -1442,7 +1434,6 @@ void Cel2DecodeLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; @@ -2534,7 +2525,6 @@ void Cl2DecodeFrm1(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -2717,7 +2707,6 @@ void Cl2DecodeFrm2(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidt pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -2922,7 +2911,6 @@ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3123,7 +3111,6 @@ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3167,7 +3154,6 @@ void Cl2DecodeFrm4(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3364,7 +3350,6 @@ void Cl2DecodeClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3584,7 +3569,6 @@ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3799,7 +3783,6 @@ void Cl2DecodeFrm6(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel pFrameTable = (DWORD *)pCelBuff; /// ASSERT: assert(nCel <= (int) pFrameTable[0]); - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) From 536b1b58aa316e85a06a83a4c18082c17601b0d6 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Wed, 12 Jun 2019 23:08:47 +0300 Subject: [PATCH 34/54] Clean up OpenMPQ (with goto) --- Source/mpqapi.cpp | 76 ++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index d247d319..1c513f14 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -434,63 +434,57 @@ BOOL mpqapi_has_file(const char *pszName) BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar) { - const char *v3; // ebp - BOOL v4; // esi - DWORD v6; // edi - int v8; // eax - int v10; // eax - const char *lpFileName; // [esp+10h] [ebp-70h] - DWORD dwTemp; // [esp+14h] [ebp-6Ch] - _FILEHEADER fhdr; // [esp+18h] [ebp-68h] + DWORD dwFlagsAndAttributes; + DWORD key; + DWORD dwTemp; + _FILEHEADER fhdr; - v3 = pszArchive; - v4 = hidden; - lpFileName = pszArchive; InitHash(); - if (!mpqapi_set_hidden(v3, v4)) - return 0; - v6 = (unsigned char)gbMaxPlayers > 1u ? FILE_FLAG_WRITE_THROUGH : 0; - save_archive_open = 0; - sghArchive = CreateFile(v3, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, v6, NULL); + if (!mpqapi_set_hidden(pszArchive, hidden)) { + return FALSE; + } + dwFlagsAndAttributes = gbMaxPlayers > 1 ? FILE_FLAG_WRITE_THROUGH : 0; + save_archive_open = FALSE; + sghArchive = CreateFile(pszArchive, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, dwFlagsAndAttributes, NULL); if (sghArchive == INVALID_HANDLE_VALUE) { - sghArchive = CreateFile(lpFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, v6 | (v4 != 0 ? FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN : 0), NULL); + sghArchive = CreateFile(pszArchive, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, dwFlagsAndAttributes | (hidden ? FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN : 0), NULL); if (sghArchive == INVALID_HANDLE_VALUE) - return 0; - save_archive_open = 1; + return FALSE; + save_archive_open = TRUE; save_archive_modified = TRUE; } - if (!sgpBlockTbl || !sgpHashTbl) { + if (sgpBlockTbl == NULL || sgpHashTbl == NULL) { memset(&fhdr, 0, sizeof(fhdr)); - if (!ParseMPQHeader(&fhdr, &sgdwMpqOffset)) { - LABEL_15: - CloseMPQ(lpFileName, 1, dwChar); - return 0; + if (ParseMPQHeader(&fhdr, &sgdwMpqOffset) == FALSE) { + goto on_error; } sgpBlockTbl = (_BLOCKENTRY *)DiabloAllocPtr(0x8000); - memset(sgpBlockTbl, 0, 0x8000u); + memset(sgpBlockTbl, 0, 0x8000); if (fhdr.blockcount) { - if (SetFilePointer(sghArchive, 104, NULL, FILE_BEGIN) == -1 - || !ReadFile(sghArchive, sgpBlockTbl, 0x8000u, &dwTemp, NULL)) { - goto LABEL_15; - } - v8 = Hash("(block table)", 3); - Decrypt(sgpBlockTbl, 0x8000, v8); + if (SetFilePointer(sghArchive, 104, NULL, FILE_BEGIN) == -1) + goto on_error; + if (!ReadFile(sghArchive, sgpBlockTbl, 0x8000, &dwTemp, NULL)) + goto on_error; + key = Hash("(block table)", 3); + Decrypt(sgpBlockTbl, 0x8000, key); } sgpHashTbl = (_HASHENTRY *)DiabloAllocPtr(0x8000); - memset(sgpHashTbl, 255, 0x8000u); + memset(sgpHashTbl, 255, 0x8000); if (fhdr.hashcount) { - if (SetFilePointer(sghArchive, 32872, NULL, FILE_BEGIN) == -1 - || !ReadFile(sghArchive, sgpHashTbl, 0x8000u, &dwTemp, NULL)) { - goto LABEL_15; - } - v10 = Hash("(hash table)", 3); - Decrypt(sgpHashTbl, 0x8000, v10); + if (SetFilePointer(sghArchive, 32872, NULL, FILE_BEGIN) == -1) + goto on_error; + if (!ReadFile(sghArchive, sgpHashTbl, 0x8000, &dwTemp, NULL)) + goto on_error; + key = Hash("(hash table)", 3); + Decrypt(sgpHashTbl, 0x8000, key); } + return TRUE; } - return 1; + return TRUE; +on_error: + CloseMPQ(pszArchive, TRUE, dwChar); + return FALSE; } -// 65AB14: using guessed type char save_archive_open; -// 679660: using guessed type char gbMaxPlayers; BOOL ParseMPQHeader(_FILEHEADER *pHdr, DWORD *pdwNextFileStart) { From a9a431fc1211e0bb4b36ad7f876731315d16e72e Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 1 Jun 2019 11:27:51 +0300 Subject: [PATCH 35/54] Fix small diff in NetSendCmdString. --- Source/msg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/msg.cpp b/Source/msg.cpp index 2641637a..41fb1bdf 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -983,8 +983,8 @@ void NetSendCmdString(int pmask, const char *pszStr) int dwStrLen; TCmdString cmd; - cmd.bCmd = CMD_STRING; dwStrLen = strlen(pszStr); + cmd.bCmd = CMD_STRING; strcpy(cmd.str, pszStr); multi_send_msg_packet(pmask, (BYTE *)&cmd.bCmd, dwStrLen + 2); } From 2b816ff9a88936dd576b7ff051ced3e555755133 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Thu, 13 Jun 2019 10:11:42 +0300 Subject: [PATCH 36/54] Make CelDrawHdrLightRed bin exact. --- Source/engine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index d41691a2..d9bd34d8 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -737,10 +737,11 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in if (light >= 4) idx += (light - 1) << 8; - tbl = &pLightTbl[idx]; - #ifdef USE_ASM __asm { + mov eax, pLightTbl + add eax, idx + mov tbl, eax mov esi, pRLEBytes mov edi, dst mov eax, BUFFER_WIDTH @@ -786,6 +787,7 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in BYTE width; BYTE *end; + tbl = &pLightTbl[idx]; end = &pRLEBytes[nDataSize]; for (; pRLEBytes != end; dst -= BUFFER_WIDTH + nWidth) { From f31cac0ee0633c4102c43293977e4d9ef8af694d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 11 Jun 2019 00:30:34 +0200 Subject: [PATCH 37/54] Clean up Cl2DecodeFrm3, Cl2DecodeFrm5, Cl2DecodeLightTbl & Cl2DecodeFrm6 --- Source/engine.cpp | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index d9bd34d8..1435ea00 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -2897,7 +2897,7 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, */ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light) { - int nDataStart, nDataSize, nDataCap, idx; + int nDataStart, nDataSize, idx, nSize; BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; @@ -2925,6 +2925,10 @@ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel if (!nDataSize) nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; + nSize = nDataSize - nDataStart; + pRLEBytes += nDataStart; + pDecodeTo = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; + idx = light4flag ? 1024 : 4096; if (light == 2) idx += 256; @@ -2932,9 +2936,9 @@ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel idx += (light - 1) << 8; Cl2DecDatLightTbl1( - &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]], - &pRLEBytes[nDataStart], - nDataSize - nDataStart, + pDecodeTo, + pRLEBytes, + nSize, nWidth, &pLightTbl[idx]); } @@ -3097,7 +3101,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi */ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataSize; + int nDataStart, nDataSize, nSize; BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; @@ -3125,12 +3129,14 @@ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int if (!nDataSize) nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; + nSize = nDataSize - nDataStart; + pRLEBytes += nDataStart; pDecodeTo = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; if (light_table_index) - Cl2DecDatLightTbl1(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth, &pLightTbl[light_table_index * 256]); + Cl2DecDatLightTbl1(pDecodeTo, pRLEBytes, nSize, nWidth, &pLightTbl[light_table_index * 256]); else - Cl2DecDatFrm1(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth); + Cl2DecDatFrm1(pDecodeTo, pRLEBytes, nSize, nWidth); } // 69BEF8: using guessed type int light_table_index; @@ -3555,8 +3561,8 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, */ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light) { - int nDataStart, nDataSize, idx; - BYTE *pRLEBytes; + int nDataStart, nDataSize, idx, nSize; + BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); @@ -3583,6 +3589,10 @@ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel if (!nDataSize) nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; + nSize = nDataSize - nDataStart; + pRLEBytes += nDataStart; + pDecodeTo = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; + idx = light4flag ? 1024 : 4096; if (light == 2) idx += 256; @@ -3590,9 +3600,9 @@ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel idx += (light - 1) << 8; Cl2DecDatLightTbl2( - &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]], - &pRLEBytes[nDataStart], - nDataSize - nDataStart, + pDecodeTo, + pRLEBytes, + nSize, nWidth, &pLightTbl[idx]); } @@ -3769,7 +3779,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi */ void Cl2DecodeFrm6(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap) { - int nDataStart, nDataSize; + int nDataStart, nDataSize, nSize; BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; @@ -3797,12 +3807,14 @@ void Cl2DecodeFrm6(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel if (!nDataSize) nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; + nSize = nDataSize - nDataStart; + pRLEBytes += nDataStart; pDecodeTo = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]]; if (light_table_index) - Cl2DecDatLightTbl2(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth, &pLightTbl[light_table_index * 256]); + Cl2DecDatLightTbl2(pDecodeTo, pRLEBytes, nSize, nWidth, &pLightTbl[light_table_index * 256]); else - Cl2DecDatFrm4(pDecodeTo, &pRLEBytes[nDataStart], nDataSize - nDataStart, nWidth); + Cl2DecDatFrm4(pDecodeTo, pRLEBytes, nSize, nWidth); } // 69BEF8: using guessed type int light_table_index; From 19d9fec7f876352a6bac188fef7e3a2e06acef75 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Fri, 14 Jun 2019 01:24:01 +0300 Subject: [PATCH 38/54] Clean up delta_get_item. --- Source/msg.cpp | 57 ++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/Source/msg.cpp b/Source/msg.cpp index 41fb1bdf..65bddaf5 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1476,37 +1476,39 @@ BOOL delta_get_item(TCmdGItem *pI, BYTE bLevel) BOOL result; TCmdPItem *pD; int i; + BOOL found; + result = TRUE; + found = FALSE; if (gbMaxPlayers != 1) { - for (i = 0; i < MAXITEMS; i++) { - pD = &sgLevels[bLevel].item[i]; - if (*(BYTE *)pD != 0xFF - && pD->wIndx == pI->wIndx - && pD->wCI == pI->wCI - && pD->dwSeed == pI->dwSeed) { - if (pD->bCmd == CMD_STAND) { - sgbDeltaChanged = 1; - pD->bCmd = CMD_WALKXY; - return TRUE; - } else if (pD->bCmd == CMD_WALKXY) { - return TRUE; - } else if (pD->bCmd == CMD_ACK_PLRINFO) { - *(BYTE *)pD = 0xFF; - sgbDeltaChanged = 1; - return TRUE; - } else { - app_fatal("delta:1"); - } - return result; + pD = sgLevels[bLevel].item; + for (i = 0; i < MAXITEMS; i++, pD++) { + if (pD->bCmd != 0xFF && pD->wIndx == pI->wIndx && pD->wCI == pI->wCI && pD->dwSeed == pI->dwSeed) { + found = TRUE; + break; } } - + if (found) { + if (pD->bCmd == CMD_WALKXY) { + return result; + } + if (pD->bCmd == CMD_STAND) { + sgbDeltaChanged = 1; + pD->bCmd = CMD_WALKXY; + return result; + } + if (pD->bCmd == CMD_ACK_PLRINFO) { + pD->bCmd = 0xFF; + sgbDeltaChanged = 1; + return result; + } + app_fatal("delta:1"); + } if (((pI->wCI >> 8) & 0x80) == 0) return FALSE; - - for (i = 0; i < MAXITEMS; i++) { - pD = &sgLevels[bLevel].item[i]; - if (*(BYTE *)pD == 0xFF) { + pD = sgLevels[bLevel].item; + for (i = 0; i < MAXITEMS; i++, pD++) { + if (pD->bCmd == 0xFF) { sgbDeltaChanged = 1; pD->bCmd = CMD_WALKXY; pD->x = pI->x; @@ -1521,11 +1523,12 @@ BOOL delta_get_item(TCmdGItem *pI, BYTE bLevel) pD->bMCh = pI->bMCh; pD->wValue = pI->wValue; pD->dwBuff = pI->dwBuff; - return TRUE; + result = TRUE; + break; } } } - return TRUE; + return result; } // 679660: using guessed type char gbMaxPlayers; From dec73be85e18c07bf413b500014a20b05b18d134 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 14 Jun 2019 02:10:17 +0200 Subject: [PATCH 39/54] Apply bflags --- Source/scrollrt.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index cde2ce77..045718fc 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1596,10 +1596,10 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa negPlr = dPlayer[sx][sy - 1]; negMon = dMonster[sx][sy - 1]; - if (visiondebug && (bFlag & 0x40)) { + if (visiondebug && (bFlag & BFLAG_LIT)) { CelDecodeHdrOnly(pBuff, (BYTE *)pSquareCel, 1, 64, 0, CelCap); } - if (MissilePreFlag && (bFlag & 1)) { + if (MissilePreFlag && (bFlag & BFLAG_MISSILE)) { DrawMissile(sx, sy, dx, dy, 0, CelCap, 1); } if (light_table_index < lightmax) { @@ -1651,7 +1651,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa } } } - if (bFlag & 0x20) { + if (bFlag & BFLAG_PLAYERLR) { p = -(negPlr + 1); if ((DWORD)p < MAX_PLRS) { pPlayer = &plr[p]; @@ -1668,7 +1668,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa // app_fatal("draw player: tried to draw illegal player %d", p); } } - if ((bFlag & 0x10) && ((bFlag & 0x40) || plr[myplr]._pInfraFlag) && negMon < 0) { + if ((bFlag & BFLAG_MONSTLR) && ((bFlag & BFLAG_LIT) || plr[myplr]._pInfraFlag) && negMon < 0) { draw_monster_num = -(negMon + 1); if ((DWORD)draw_monster_num < MAXMONSTERS) { pMonster = &monster[draw_monster_num]; @@ -1691,7 +1691,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa // app_fatal("Draw Monster: tried to draw illegal monster %d", draw_monster_num); } } - if (bFlag & 4) { + if (bFlag & BFLAG_DEAD_PLAYER) { DrawDeadPlayer(sx, sy, dx, dy, 0, CelCap, 0); } if (bPlr > 0) { @@ -1711,7 +1711,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa // app_fatal("draw player: tried to draw illegal player %d", p); } } - if (nMon > 0 && ((bFlag & 0x40) || plr[myplr]._pInfraFlag)) { + if (nMon > 0 && ((bFlag & BFLAG_LIT) || plr[myplr]._pInfraFlag)) { draw_monster_num = nMon - 1; if ((DWORD)draw_monster_num < MAXMONSTERS) { pMonster = &monster[draw_monster_num]; @@ -1734,7 +1734,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa // app_fatal("Draw Monster: tried to draw illegal monster %d", draw_monster_num); } } - if (bFlag & 1) { + if (bFlag & BFLAG_MISSILE) { DrawMissile(sx, sy, dx, dy, 0, CelCap, 0); } if (bObj != 0 && light_table_index < lightmax) { From c66c93c15e4b0671eb0a970dd5f1c81530ca1a5c Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 14 Jun 2019 02:00:55 +0200 Subject: [PATCH 40/54] Clean up AddRportal --- Source/missiles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 2a8f3063..5a54d613 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -2401,9 +2401,9 @@ void AddRportal(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, missile[mi]._miy = sy; missile[mi]._misx = sx; missile[mi]._misy = sy; + missile[mi]._mirange = 100; missile[mi]._miVar1 = 100 - missile[mi]._miAnimLen; missile[mi]._miVar2 = 0; - missile[mi]._mirange = 100; PutMissile(mi); } From 3328682a43d074ac3e3c931f58406d170ab7b4ca Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 14 Jun 2019 01:36:09 +0200 Subject: [PATCH 41/54] Correct TSyncHeader and TSyncMonster types --- structs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/structs.h b/structs.h index d052fdb5..dd100d91 100644 --- a/structs.h +++ b/structs.h @@ -866,7 +866,7 @@ typedef struct TSyncHeader { BYTE bItemY; WORD wItemIndx; WORD wItemCI; - int dwItemSeed; + DWORD dwItemSeed; BYTE bItemId; BYTE bItemDur; BYTE bItemMDur; @@ -877,15 +877,15 @@ typedef struct TSyncHeader { BYTE bPInvLoc; WORD wPInvIndx; WORD wPInvCI; - int dwPInvSeed; + DWORD dwPInvSeed; BYTE bPInvId; } TSyncHeader; typedef struct TSyncMonster { BYTE _mndx; - char _mx; - char _my; - char _menemy; + BYTE _mx; + BYTE _my; + BYTE _menemy; BYTE _mdelta; } TSyncMonster; From 19a485866b108157cb5e50e5b8d41bc5a6c9bf35 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 14 Jun 2019 15:48:12 +0200 Subject: [PATCH 42/54] Use version 0.4.0 of devilution-comparer --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 702111fd..615e2f97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,8 +55,8 @@ jobs: script: - | set -e - wget https://github.com/diasurgical/devilution-comparer/releases/download/v0.3.5/devilution-comparer-v0.3.5-x86_64-unknown-linux-gnu.tar.xz - tar xf devilution-comparer-v0.3.5-x86_64-unknown-linux-gnu.tar.xz + wget https://github.com/diasurgical/devilution-comparer/releases/download/v0.4.0/devilution-comparer-v0.4.0-x86_64-unknown-linux-gnu.tar.xz + tar xf devilution-comparer-v0.4.0-x86_64-unknown-linux-gnu.tar.xz rm comparer-config.toml wget https://raw.githubusercontent.com/diasurgical/devilution-comparer/master/comparer-config.toml echo '#!/bin/sh' | sudo tee /bin/wine From dc3d4d694d91ad69779907b5b5584689e2863c8e Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 14 Jun 2019 15:49:33 +0200 Subject: [PATCH 43/54] Use --truncate-to-original to get a probably more accurate diff --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 615e2f97..721ebedf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,7 +63,7 @@ jobs: echo 'docker run -v $(pwd):/root/devilution --entrypoint "/usr/bin/wine" diasurgical/riivaaja:stable $(basename $1) $2 $3' | sudo tee --append /bin/wine sudo chmod +x /bin/wine docker run -v $(pwd):/root/devilution -e MAKE_BUILD=pdb -e COPYPROT=1 diasurgical/riivaaja:stable - ./devilution-comparer generate-full Diablo.exe --no-mem-disp + ./devilution-comparer generate-full Diablo.exe --no-mem-disp --truncate-to-original docker run -v $(pwd):/root/devilution diasurgical/riivaaja:stable ../status.sh after_success: - | From f3f29cf0a928bcb3eae1a174dc99fcbf07667ee2 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Wed, 12 Jun 2019 11:31:03 +0300 Subject: [PATCH 44/54] Clean up mpqapi_write_file_contents. --- Source/mpqapi.cpp | 155 +++++++++++++++++++++------------------------- 1 file changed, 72 insertions(+), 83 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 1c513f14..05baa05b 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -285,98 +285,87 @@ _BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_i BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD dwLen, _BLOCKENTRY *pBlk) { - const char *v4; // esi - const char *v5; // eax - unsigned int destsize; // ebx - const char *v7; // eax - unsigned int v8; // esi - _BLOCKENTRY *v9; // edi - int v10; // eax - signed int v11; // eax - unsigned int v13; // eax - unsigned int v14; // eax - int v15; // ecx - int size; // [esp+Ch] [ebp-10h] - const BYTE *v17; // [esp+10h] [ebp-Ch] - int v18; // [esp+14h] [ebp-8h] - DWORD nNumberOfBytesToWrite; // [esp+18h] [ebp-4h] + DWORD *sectoroffsettable; + DWORD destsize, num_bytes, block_size, nNumberOfBytesToWrite; + const BYTE *src; + const char *tmp, *str_ptr; + int i, j; - v4 = pszName; - v17 = pbData; - v5 = strchr(pszName, ':'); + str_ptr = pszName; + src = pbData; + while ((tmp = strchr(str_ptr, ':'))) { + str_ptr = tmp + 1; + } + while ((tmp = strchr(str_ptr, '\\'))) { + str_ptr = tmp + 1; + } + Hash(str_ptr, 3); + num_bytes = (dwLen + 4095) >> 12; + nNumberOfBytesToWrite = 4 * num_bytes + 4; + pBlk->offset = mpqapi_find_free_block(dwLen + nNumberOfBytesToWrite, &pBlk->sizealloc); + pBlk->sizefile = dwLen; + pBlk->flags = 0x80000100; + if (SetFilePointer(sghArchive, pBlk->offset, NULL, FILE_BEGIN) == (DWORD)-1) + return FALSE; + j = 0; destsize = 0; - while (v5) { - v4 = v5 + 1; - v5 = strchr(v5 + 1, ':'); - } - while (1) { - v7 = strchr(v4, '\\'); - if (!v7) - break; - v4 = v7 + 1; - } - Hash(v4, 3); - v8 = dwLen; - v9 = pBlk; - size = 4 * ((unsigned int)(dwLen + 4095) >> 12) + 4; - nNumberOfBytesToWrite = 4 * ((unsigned int)(dwLen + 4095) >> 12) + 4; - v10 = mpqapi_find_free_block(size + dwLen, &pBlk->sizealloc); - v9->offset = v10; - v9->sizefile = v8; - v9->flags = 0x80000100; - if (SetFilePointer(sghArchive, v10, NULL, FILE_BEGIN) == -1) - return 0; - pBlk = 0; - v18 = 0; - while (v8) { - v11 = 0; - do - mpq_buf[v11++] -= 86; - while (v11 < 4096); - dwLen = v8; - if (v8 >= 0x1000) - dwLen = 4096; - memcpy(mpq_buf, v17, dwLen); - v17 += dwLen; - dwLen = PkwareCompress(mpq_buf, dwLen); - if (!v18) { - nNumberOfBytesToWrite = size; - pBlk = (_BLOCKENTRY *)DiabloAllocPtr(size); - memset(pBlk, 0, nNumberOfBytesToWrite); - if (!WriteFile(sghArchive, pBlk, nNumberOfBytesToWrite, &nNumberOfBytesToWrite, 0)) - goto LABEL_25; + sectoroffsettable = NULL; + while (dwLen != 0) { + for (i = 0; i < 4096; i++) + mpq_buf[i] -= 86; + DWORD len = dwLen; + if (dwLen >= 4096) + len = 4096; + memcpy(mpq_buf, src, len); + src += len; + len = PkwareCompress(mpq_buf, len); + if (j == 0) { + nNumberOfBytesToWrite = 4 * num_bytes + 4; + sectoroffsettable = (DWORD *)DiabloAllocPtr(nNumberOfBytesToWrite); + memset(sectoroffsettable, 0, nNumberOfBytesToWrite); + if (!WriteFile(sghArchive, sectoroffsettable, nNumberOfBytesToWrite, &nNumberOfBytesToWrite, 0)) { + goto on_error; + } destsize += nNumberOfBytesToWrite; } - *(&pBlk->offset + v18) = destsize; - if (!WriteFile(sghArchive, mpq_buf, dwLen, (LPDWORD)&dwLen, 0)) - goto LABEL_25; - ++v18; - if (v8 <= 0x1000) - v8 = 0; + sectoroffsettable[j] = destsize; + if (!WriteFile(sghArchive, mpq_buf, len, &len, NULL)) { + goto on_error; + } + j++; + if (dwLen > 4096) + dwLen -= 4096; else - v8 -= 4096; - destsize += dwLen; + dwLen = 0; + destsize += len; } - *(&pBlk->offset + v18) = destsize; - if (SetFilePointer(sghArchive, -destsize, NULL, FILE_CURRENT) == -1 - || !WriteFile(sghArchive, pBlk, nNumberOfBytesToWrite, &nNumberOfBytesToWrite, 0) - || SetFilePointer(sghArchive, destsize - nNumberOfBytesToWrite, NULL, FILE_CURRENT) == -1) { - LABEL_25: - if (pBlk) - mem_free_dbg(pBlk); - return 0; + + sectoroffsettable[j] = destsize; + if (SetFilePointer(sghArchive, -destsize, NULL, FILE_CURRENT) == (DWORD)-1) { + goto on_error; } - mem_free_dbg(pBlk); - v13 = v9->sizealloc; - if (destsize < v13) { - v14 = v13 - destsize; - if (v14 >= 0x400) { - v15 = destsize + v9->offset; - v9->sizealloc = destsize; - mpqapi_alloc_block(v15, v14); + + if (!WriteFile(sghArchive, sectoroffsettable, nNumberOfBytesToWrite, &nNumberOfBytesToWrite, 0)) { + goto on_error; + } + + if (SetFilePointer(sghArchive, destsize - nNumberOfBytesToWrite, NULL, FILE_CURRENT) == (DWORD)-1) { + goto on_error; + } + + mem_free_dbg(sectoroffsettable); + if (destsize < pBlk->sizealloc) { + block_size = pBlk->sizealloc - destsize; + if (block_size >= 1024) { + pBlk->sizealloc = destsize; + mpqapi_alloc_block(pBlk->sizealloc + pBlk->offset, block_size); } } - return 1; + return TRUE; +on_error: + if (sectoroffsettable) + mem_free_dbg(sectoroffsettable); + return FALSE; } int mpqapi_find_free_block(int size, int *block_size) From 8ac54ddcaac759bc8d7c6442d9ec897913d911e3 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 14 Jun 2019 23:51:47 +0200 Subject: [PATCH 45/54] Make mpqapi_write_file_contents C compatible --- Source/mpqapi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 05baa05b..61dcd710 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -311,9 +311,10 @@ BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD d destsize = 0; sectoroffsettable = NULL; while (dwLen != 0) { + DWORD len; for (i = 0; i < 4096; i++) mpq_buf[i] -= 86; - DWORD len = dwLen; + len = dwLen; if (dwLen >= 4096) len = 4096; memcpy(mpq_buf, src, len); From 81ec719e1bc31ce5d7a3aadda1f72166fe8956a3 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 15 Jun 2019 01:42:54 +0300 Subject: [PATCH 46/54] Fix min diff in ResyncQuests. --- Source/quests.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/quests.cpp b/Source/quests.cpp index d46e94eb..cd455abd 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -601,7 +601,7 @@ void ResyncMPQuests() void ResyncQuests() { - int i, tren; + int i, tren, x, y; if (setlevel && setlvlnum == quests[QTYPE_PW]._qslvl && quests[QTYPE_PW]._qactive != 1 && leveltype == quests[QTYPE_PW]._qlvltype) { @@ -636,7 +636,9 @@ void ResyncQuests() TransVal = tren; } if (quests[QTYPE_BOL]._qvar1 == 3) { - ObjChangeMapResync(setpc_x, setpc_y, setpc_w + setpc_x + 1, setpc_h + setpc_y + 1); + x = setpc_x; + y = setpc_y; + ObjChangeMapResync(x, y, x + setpc_w + 1, y + setpc_h + 1); for (i = 0; i < nobjects; i++) SyncObjectAnim(objectactive[i]); tren = TransVal; From 3b879cc373193aa1317a98e48c80282adc0f7e19 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 15 Jun 2019 11:18:36 +0200 Subject: [PATCH 47/54] Fix CheckStoreBtn --- Source/stores.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/stores.cpp b/Source/stores.cpp index 5eaccfca..ecb52af6 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2754,7 +2754,7 @@ void CheckStoreBtn() if (MouseX < 344 || MouseX > 616) return; } else { - if (MouseX < 3 || MouseX > 616) + if (MouseX < 24 || MouseX > 616) return; } y = (MouseY - 32) / 12; @@ -2764,7 +2764,7 @@ void CheckStoreBtn() STextUp(); stextscrlubtn = 10; } else { - --stextscrlubtn; + stextscrlubtn--; } } if (y == 20) { @@ -2772,7 +2772,7 @@ void CheckStoreBtn() STextDown(); stextscrldbtn = 10; } else { - --stextscrldbtn; + stextscrldbtn--; } } } else if (y >= 5) { @@ -2782,7 +2782,7 @@ void CheckStoreBtn() if (stext[y - 2]._ssel) { y -= 2; } else if (stext[y - 1]._ssel) { - --y; + y--; } } if (stext[y]._ssel || stextscrl && y == 22) { From 2edb45b670ca245121ff815db20f3077f587d9d1 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 15 Jun 2019 07:09:28 +0300 Subject: [PATCH 48/54] Fix diff in ForceTownTrig. --- Source/trigs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/trigs.cpp b/Source/trigs.cpp index 458b93c9..12cf9de7 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -359,7 +359,7 @@ BOOL ForceTownTrig() } if (townwarps[2]) { - for (l = 1240; l <= 1254; l++) { + for (l = 1240; l <= 1255; l++) { if (dPiece[cursmx][cursmy] == l) { strcpy(infostr, "Down to hell"); cursmx = 41; From 7e39fe457fa952d85e00acfc26dc360bad586e68 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 15 Jun 2019 07:35:43 +0300 Subject: [PATCH 49/54] Fix diff in snd_play_snd. --- Source/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/sound.cpp b/Source/sound.cpp index e94c3e05..f64af1a1 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -104,7 +104,7 @@ void snd_play_snd(TSnd *pSnd, int lVolume, int lPan) tc = GetTickCount(); if (tc - pSnd->start_tc < 80) { - pSnd->start_tc = GetTickCount(); + GetTickCount(); // BUGFIX: unnecessary GetTickCount return; } From b5f7a744e68b6b837999eea8770ff4e3398c4f00 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 15 Jun 2019 07:37:56 +0300 Subject: [PATCH 50/54] Fix diff in AddMissile. --- Source/missiles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 5a54d613..93698cd3 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -2451,8 +2451,8 @@ int AddMissile(int sx, int sy, int dx, int dy, int midir, int mitype, char micas missile[mi]._misource = id; missile[mi]._miAnimType = missiledata[mitype].mFileNum; missile[mi]._miDrawFlag = missiledata[mitype].mDraw; - missile[mi]._mimfnum = midir; missile[mi]._mispllvl = spllvl; + missile[mi]._mimfnum = midir; if (missile[mi]._miAnimType == 255 || misfiledata[missile[mi]._miAnimType].mAnimFAmt < 8) SetMissDir(mi, 0); From 2aa37dccc128417dce5db38b288d07c263781f7a Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Fri, 14 Jun 2019 23:44:56 +0300 Subject: [PATCH 51/54] Make MakeSpeedCels bin exact. --- Source/gendung.cpp | 50 +++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 23cf8dbd..c25b1db5 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -122,14 +122,14 @@ void FillSolidBlockTbls() void MakeSpeedCels() { - int i, j, x, y; - int total_frames, blocks, total_size, frameidx, lfs_adder, blk_cnt, currtile, nDataSize; + int i, j, k, x, y, mt, t, z; + int total_frames, blocks, total_size, frameidx, blk_cnt, nDataSize; WORD m; BOOL blood_flag; DWORD *pFrameTable; MICROS *pMap; #ifndef USE_ASM - int k, l; + int l; BYTE width, pix; BYTE *src, *dst, *tbl; #endif @@ -149,22 +149,25 @@ void MakeSpeedCels() for (x = 0; x < MAXDUNX; x++) { for (i = 0; i < blocks; i++) { pMap = &dpiece_defs_map_2[x][y]; - if (pMap->mt[i]) { + mt = pMap->mt[i]; + if (mt) { level_frame_count[pMap->mt[i] & 0xFFF]++; - level_frame_types[pMap->mt[i] & 0xFFF] = pMap->mt[i] & 0x7000; + level_frame_types[pMap->mt[i] & 0xFFF] = mt & 0x7000; } } } } pFrameTable = (DWORD *)pDungeonCels; - nlevel_frames = pFrameTable[0] & 0xFFFF; + nDataSize = pFrameTable[0]; + nlevel_frames = nDataSize & 0xFFFF; for (i = 1; i < nlevel_frames; i++) { + z = i; #ifdef USE_ASM __asm { mov ebx, pDungeonCels - mov eax, i + mov eax, z shl eax, 2 add ebx, eax mov eax, [ebx+4] @@ -181,22 +184,23 @@ void MakeSpeedCels() if (leveltype == DTYPE_HELL) { for (i = 0; i < nlevel_frames; i++) { - if (!i) + if (i == 0) level_frame_count[0] = 0; + z = i; blood_flag = TRUE; - if (level_frame_count[i]) { + if (level_frame_count[i] != 0) { if (level_frame_types[i] != 0x1000) { #ifdef USE_ASM - j = level_frame_sizes[i]; + t = level_frame_sizes[i]; __asm { mov ebx, pDungeonCels - mov eax, i + mov eax, z shl eax, 2 add ebx, eax mov esi, pDungeonCels add esi, [ebx] xor ebx, ebx - mov ecx, j + mov ecx, t jecxz l1_label3 l1_label1: lodsb @@ -222,7 +226,7 @@ void MakeSpeedCels() #ifdef USE_ASM __asm { mov ebx, pDungeonCels - mov eax, i + mov eax, z shl eax, 2 add ebx, eax mov esi, pDungeonCels @@ -314,16 +318,16 @@ void MakeSpeedCels() blk_cnt = 15; for (i = 0; i < total_frames; i++) { - currtile = tile_defs[i]; - SpeedFrameTbl[i][0] = currtile; + z = tile_defs[i]; + SpeedFrameTbl[i][0] = z; if (level_frame_types[i] != 0x1000) { - lfs_adder = level_frame_sizes[i]; + t = level_frame_sizes[i]; for (j = 1; j < blk_cnt; j++) { SpeedFrameTbl[i][j] = frameidx; #ifdef USE_ASM __asm { mov ebx, pDungeonCels - mov eax, currtile + mov eax, z shl eax, 2 add ebx, eax mov esi, pDungeonCels @@ -333,7 +337,7 @@ void MakeSpeedCels() mov ebx, j shl ebx, 8 add ebx, pLightTbl - mov ecx, lfs_adder + mov ecx, t jecxz l3_label2 l3_label1: lodsb @@ -344,14 +348,14 @@ void MakeSpeedCels() nop } #else - src = &pDungeonCels[pFrameTable[currtile]]; + src = &pDungeonCels[pFrameTable[z]]; dst = &pSpeedCels[frameidx]; tbl = &pLightTbl[256 * j]; - for (k = lfs_adder; k; k--) { + for (k = t; k; k--) { *dst++ = tbl[*src++]; } #endif - frameidx += lfs_adder; + frameidx += t; } } else { for (j = 1; j < blk_cnt; j++) { @@ -359,7 +363,7 @@ void MakeSpeedCels() #ifdef USE_ASM __asm { mov ebx, pDungeonCels - mov eax, currtile + mov eax, z shl eax, 2 add ebx, eax mov esi, pDungeonCels @@ -398,7 +402,7 @@ void MakeSpeedCels() loop l4_label1 } #else - src = &pDungeonCels[pFrameTable[currtile]]; + src = &pDungeonCels[pFrameTable[z]]; dst = &pSpeedCels[frameidx]; tbl = &pLightTbl[256 * j]; for (k = 32; k; k--) { From 121eebdea50cdcf188d489eac16ff56b37f5a03e Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 15 Jun 2019 12:53:03 +0200 Subject: [PATCH 52/54] Clean up DRLG_PlaceThemeRooms --- Source/gendung.cpp | 111 +++++++++++++++------------------------------ Source/gendung.h | 6 +-- 2 files changed, 39 insertions(+), 78 deletions(-) diff --git a/Source/gendung.cpp b/Source/gendung.cpp index c25b1db5..ae704344 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -5,17 +5,17 @@ int themeCount; char nTransTable[2049]; //int dword_52D204; int dMonster[MAXDUNX][MAXDUNY]; -BYTE dungeon[40][40]; +BYTE dungeon[DMAXX][DMAXY]; char dObject[MAXDUNX][MAXDUNY]; BYTE *pSpeedCels; int nlevel_frames; // weak -char pdungeon[40][40]; +char pdungeon[DMAXX][DMAXY]; char dDead[MAXDUNX][MAXDUNY]; MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; char dPreLight[MAXDUNX][MAXDUNY]; -char TransVal; // weak +char TransVal; int MicroTileLen; -char dflags[40][40]; +char dflags[DMAXX][DMAXY]; int dPiece[MAXDUNX][MAXDUNY]; char dLight[MAXDUNX][MAXDUNY]; int setloadflag_2; // weak @@ -891,83 +891,44 @@ void DRLG_CreateThemeRoom(int themeIndex) void DRLG_PlaceThemeRooms(int minSize, int maxSize, int floor, int freq, int rndSize) { - int v5; // ebx - //int v7; // eax - int v8; // esi - int v9; // edi - int v10; // eax - int v12; // eax - int v14; // eax - int v16; // eax - int v17; // edi - int v18; // esi - int v19; // ecx - int v20; // ecx - int v21; // eax - int minSize2; // [esp+10h] [ebp-1Ch] - int maxSize2; // [esp+14h] [ebp-18h] - unsigned char *v24; // [esp+18h] [ebp-14h] - signed int x_start; // [esp+1Ch] [ebp-10h] - int x; // [esp+20h] [ebp-Ch] - int width; // [esp+24h] [ebp-8h] - int height; // [esp+28h] [ebp-4h] + int i, j; + int themeW, themeH; + int rv2, min, max; - v5 = 0; - maxSize2 = maxSize; - minSize2 = minSize; themeCount = 0; memset(themeLoc, 0, sizeof(*themeLoc)); - do { - x = 0; - x_start = 20; - v24 = (unsigned char *)dungeon + v5; - do { - if (*v24 == floor) { - if (!random(0, freq)) { - //_LOBYTE(v7) = DRLG_WillThemeRoomFit(floor, x, v5, minSize2, maxSize2, &width, &height); - if (DRLG_WillThemeRoomFit(floor, x, v5, minSize2, maxSize2, &width, &height)) { - if (rndSize) { - v8 = minSize2 - 2; - v9 = maxSize2 - 2; - v10 = random(0, width - (minSize2 - 2) + 1); - v12 = minSize2 - 2 + random(0, v10); - if (v12 < minSize2 - 2 || (width = v12, v12 > v9)) - width = minSize2 - 2; - v14 = random(0, height - v8 + 1); - v16 = v8 + random(0, v14); - if (v16 < v8 || v16 > v9) - v16 = minSize2 - 2; - height = v16; - } else { - v16 = height; - } - v17 = themeCount; - v18 = themeCount; - themeLoc[v18].x = x + 1; - themeLoc[v18].y = v5 + 1; - v19 = width; - themeLoc[v18].width = width; - themeLoc[v18].height = v16; - v20 = x + v19; - v21 = v5 + v16; - if (leveltype == DTYPE_CAVES) - DRLG_RectTrans(x_start, 2 * v5 + 20, 2 * v20 + 15, 2 * v21 + 15); - else - DRLG_MRectTrans(x + 1, v5 + 1, v20, v21); - themeLoc[v18].ttval = TransVal - 1; - DRLG_CreateThemeRoom(v17); - ++themeCount; - } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] == floor && !random(0, freq) && DRLG_WillThemeRoomFit(floor, i, j, minSize, maxSize, &themeW, &themeH)) { + if (rndSize) { + min = minSize - 2; + max = maxSize - 2; + rv2 = min + random(0, random(0, themeW - min + 1)); + if (rv2 >= min && rv2 <= max) + themeW = rv2; + else + themeW = min; + rv2 = min + random(0, random(0, themeH - min + 1)); + if (rv2 >= min && rv2 <= max) + themeH = rv2; + else + themeH = min; } + themeLoc[themeCount].x = i + 1; + themeLoc[themeCount].y = j + 1; + themeLoc[themeCount].width = themeW; + themeLoc[themeCount].height = themeH; + if (leveltype == DTYPE_CAVES) + DRLG_RectTrans(2 * i + 20, 2 * j + 20, 2 * (i + themeW) + 15, 2 * (j + themeH) + 15); + else + DRLG_MRectTrans(i + 1, j + 1, i + themeW, j + themeH); + themeLoc[themeCount].ttval = TransVal - 1; + DRLG_CreateThemeRoom(themeCount); + themeCount++; } - x_start += 2; - ++x; - v24 += 40; - } while (x_start < 100); - ++v5; - } while (v5 < 40); + } + } } -// 5A5590: using guessed type char TransVal; void DRLG_HoldThemeRooms() { diff --git a/Source/gendung.h b/Source/gendung.h index da808795..e2c4afe9 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -7,17 +7,17 @@ extern int themeCount; extern char nTransTable[2049]; //int dword_52D204; extern int dMonster[MAXDUNX][MAXDUNY]; -extern BYTE dungeon[40][40]; +extern BYTE dungeon[DMAXX][DMAXY]; extern char dObject[MAXDUNX][MAXDUNY]; extern BYTE *pSpeedCels; extern int nlevel_frames; // weak -extern char pdungeon[40][40]; +extern char pdungeon[DMAXX][DMAXY]; extern char dDead[MAXDUNX][MAXDUNY]; extern MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; extern char dPreLight[MAXDUNX][MAXDUNY]; extern char TransVal; // weak extern int MicroTileLen; -extern char dflags[40][40]; +extern char dflags[DMAXX][DMAXY]; extern int dPiece[MAXDUNX][MAXDUNY]; extern char dLight[MAXDUNX][MAXDUNY]; extern int setloadflag_2; // weak From 863a0ae0e3664d7e4de891b3a0dc5e1357616592 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 15 Jun 2019 20:59:14 +0300 Subject: [PATCH 53/54] Make some member functions of TList bin exact. --- Source/list.h | 6 ++++-- Source/msgcmd.cpp | 22 +++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Source/list.h b/Source/list.h index e381c9ce..f9fa86f0 100644 --- a/Source/list.h +++ b/Source/list.h @@ -69,7 +69,6 @@ private: static __forceinline void SDelete(T *node) { - node->~T(); SMemFree(node, (char *)OBJECT_NAME(T), SLOG_OBJECT, 0); } }; @@ -97,8 +96,10 @@ TList::TList() template void TList::DeleteAll() { - while (T *node = m_link.Next()) + while (T *node = m_link.Next()) { + node->Delete(0x0); SDelete(node); + } } //============================================================================= @@ -122,6 +123,7 @@ T *TList::Remove(T *node) { TLink *link = node ? &node->m_Link : &m_link; T *next = link->Next(); + node->Delete(0x0); SDelete(node); return next; } diff --git a/Source/msgcmd.cpp b/Source/msgcmd.cpp index d1d79ef3..0f859562 100644 --- a/Source/msgcmd.cpp +++ b/Source/msgcmd.cpp @@ -12,17 +12,21 @@ struct EXTERNMESSAGE { LIST_LINK(EXTERNMESSAGE) m_Link; char command[COMMAND_LEN]; - ~EXTERNMESSAGE() - { - // BUGFIX: this is already called by m_Link's destructor - m_Link.Unlink(); - } - static void operator delete(void *p) { - if (p) - SMemFree(p, "delete", SLOG_FUNCTION, 0); - } + + void *Delete(DWORD flags); }; +void *EXTERNMESSAGE::Delete(DWORD flags) +{ + // BUGFIX: this is already called by m_Link's destructor + m_Link.Unlink(); + this->~EXTERNMESSAGE(); + if ((flags & 0x1) && this) { + SMemFree(this, "delete", SLOG_FUNCTION, 0); + } + return this; +} + static TList sgChat_Cmd; void msgcmd_cmd_cleanup() From 6a4142fb08490a1ea895ea228917d9d0e32fcfb7 Mon Sep 17 00:00:00 2001 From: Duarte Alvim Date: Mon, 10 Jun 2019 22:39:07 +0200 Subject: [PATCH 54/54] Add gold constants --- Source/control.cpp | 4 ++-- Source/debug.cpp | 4 ++-- Source/inv.cpp | 52 +++++++++++++++++++++++----------------------- Source/items.cpp | 18 ++++++++-------- Source/player.cpp | 8 +++---- Source/stores.cpp | 40 +++++++++++++++++------------------ defs.h | 4 ++++ 7 files changed, 67 insertions(+), 63 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index ecfa8721..a6ca23ce 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2397,9 +2397,9 @@ void control_remove_gold(int pnum, int gold_index) void control_set_gold_curs(int pnum) { - if (plr[pnum].HoldItem._ivalue >= 2500) + if (plr[pnum].HoldItem._ivalue >= GOLD_MEDIUM_LIMIT) plr[pnum].HoldItem._iCurs = ICURS_GOLD_LARGE; - else if (plr[pnum].HoldItem._ivalue <= 1000) + else if (plr[pnum].HoldItem._ivalue <= GOLD_SMALL_LIMIT) plr[pnum].HoldItem._iCurs = ICURS_GOLD_SMALL; else plr[pnum].HoldItem._iCurs = ICURS_GOLD_MEDIUM; diff --git a/Source/debug.cpp b/Source/debug.cpp index 1c80e43a..0b1e75e5 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -102,9 +102,9 @@ void GiveGoldCheat() ni = plr[myplr]._pNumInv++; SetPlrHandItem(&plr[myplr].InvList[ni], IDI_GOLD); GetPlrHandSeed(&plr[myplr].InvList[ni]); - plr[myplr].InvList[ni]._ivalue = 5000; + plr[myplr].InvList[ni]._ivalue = GOLD_MAX_LIMIT; plr[myplr].InvList[ni]._iCurs = 6; - plr[myplr]._pGold += 5000; + plr[myplr]._pGold += GOLD_MAX_LIMIT; plr[myplr].InvGrid[i] = plr[myplr]._pNumInv; } } diff --git a/Source/inv.cpp b/Source/inv.cpp index 4a9fb73b..8cd52e66 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -589,11 +589,11 @@ BOOL GoldAutoPlace(int pnum) done = FALSE; for (i = 0; i < plr[pnum]._pNumInv && !done; i++) { if (plr[pnum].InvList[i]._itype == ITYPE_GOLD) { - if (plr[pnum].HoldItem._ivalue + plr[pnum].InvList[i]._ivalue <= 5000) { + if (plr[pnum].HoldItem._ivalue + plr[pnum].InvList[i]._ivalue <= GOLD_MAX_LIMIT) { plr[pnum].InvList[i]._ivalue = plr[pnum].HoldItem._ivalue + plr[pnum].InvList[i]._ivalue; - if (plr[pnum].InvList[i]._ivalue >= 2500) + if (plr[pnum].InvList[i]._ivalue >= GOLD_MEDIUM_LIMIT) plr[pnum].InvList[i]._iCurs = ICURS_GOLD_LARGE; - else if (plr[pnum].InvList[i]._ivalue <= 1000) + else if (plr[pnum].InvList[i]._ivalue <= GOLD_SMALL_LIMIT) plr[pnum].InvList[i]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].InvList[i]._iCurs = ICURS_GOLD_MEDIUM; @@ -606,12 +606,12 @@ BOOL GoldAutoPlace(int pnum) return done; for (i = 0; i < plr[pnum]._pNumInv && !done; i++) { - if (plr[pnum].InvList[i]._itype == ITYPE_GOLD && plr[pnum].InvList[i]._ivalue < 5000) { - if (plr[pnum].HoldItem._ivalue + plr[pnum].InvList[i]._ivalue <= 5000) { + if (plr[pnum].InvList[i]._itype == ITYPE_GOLD && plr[pnum].InvList[i]._ivalue < GOLD_MAX_LIMIT) { + if (plr[pnum].HoldItem._ivalue + plr[pnum].InvList[i]._ivalue <= GOLD_MAX_LIMIT) { plr[pnum].InvList[i]._ivalue = plr[pnum].HoldItem._ivalue + plr[pnum].InvList[i]._ivalue; - if (plr[pnum].InvList[i]._ivalue >= 2500) + if (plr[pnum].InvList[i]._ivalue >= GOLD_MEDIUM_LIMIT) plr[pnum].InvList[i]._iCurs = ICURS_GOLD_LARGE; - else if (plr[pnum].InvList[i]._ivalue <= 1000) + else if (plr[pnum].InvList[i]._ivalue <= GOLD_SMALL_LIMIT) plr[pnum].InvList[i]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].InvList[i]._iCurs = ICURS_GOLD_MEDIUM; @@ -631,9 +631,9 @@ BOOL GoldAutoPlace(int pnum) plr[pnum].InvList[ii] = plr[pnum].HoldItem; plr[pnum]._pNumInv = plr[pnum]._pNumInv + 1; plr[pnum].InvGrid[xx + yy] = plr[pnum]._pNumInv; - if (plr[pnum].HoldItem._ivalue >= 2500) + if (plr[pnum].HoldItem._ivalue >= GOLD_MEDIUM_LIMIT) plr[pnum].InvList[ii]._iCurs = ICURS_GOLD_LARGE; - else if (plr[pnum].HoldItem._ivalue <= 1000) + else if (plr[pnum].HoldItem._ivalue <= GOLD_SMALL_LIMIT) plr[pnum].InvList[ii]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].InvList[ii]._iCurs = ICURS_GOLD_MEDIUM; @@ -955,25 +955,25 @@ void CheckInvPaste(int pnum, int mx, int my) il--; gt = plr[pnum].InvList[il]._ivalue; ig = plr[pnum].HoldItem._ivalue + gt; - if (ig <= 5000) { + if (ig <= GOLD_MAX_LIMIT) { plr[pnum].InvList[il]._ivalue = ig; plr[pnum]._pGold += plr[pnum].HoldItem._ivalue; - if (ig >= 2500) + if (ig >= GOLD_MEDIUM_LIMIT) plr[pnum].InvList[il]._iCurs = ICURS_GOLD_LARGE; - else if (ig <= 1000) + else if (ig <= GOLD_SMALL_LIMIT) plr[pnum].InvList[il]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].InvList[il]._iCurs = ICURS_GOLD_MEDIUM; } else { - ig = 5000 - gt; + ig = GOLD_MAX_LIMIT - gt; plr[pnum]._pGold += ig; plr[pnum].HoldItem._ivalue -= ig; - plr[pnum].InvList[il]._ivalue = 5000; + plr[pnum].InvList[il]._ivalue = GOLD_MAX_LIMIT; plr[pnum].InvList[il]._iCurs = ICURS_GOLD_LARGE; // BUGFIX: incorrect values here are leftover from beta - if (plr[pnum].HoldItem._ivalue >= 2500) + if (plr[pnum].HoldItem._ivalue >= GOLD_MEDIUM_LIMIT) cn = 18; - else if (plr[pnum].HoldItem._ivalue <= 1000) + else if (plr[pnum].HoldItem._ivalue <= GOLD_SMALL_LIMIT) cn = 16; else cn = 17; @@ -984,10 +984,10 @@ void CheckInvPaste(int pnum, int mx, int my) plr[pnum]._pNumInv++; plr[pnum].InvGrid[yy + xx] = plr[pnum]._pNumInv; plr[pnum]._pGold += plr[pnum].HoldItem._ivalue; - if (plr[pnum].HoldItem._ivalue <= 5000) { - if (plr[pnum].HoldItem._ivalue >= 2500) + if (plr[pnum].HoldItem._ivalue <= GOLD_MAX_LIMIT) { + if (plr[pnum].HoldItem._ivalue >= GOLD_MEDIUM_LIMIT) plr[pnum].InvList[il]._iCurs = ICURS_GOLD_LARGE; - else if (plr[pnum].HoldItem._ivalue <= 1000) + else if (plr[pnum].HoldItem._ivalue <= GOLD_SMALL_LIMIT) plr[pnum].InvList[il]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].InvList[il]._iCurs = ICURS_GOLD_MEDIUM; @@ -1037,26 +1037,26 @@ void CheckInvPaste(int pnum, int mx, int my) if (plr[pnum].SpdList[ii]._itype != ITYPE_NONE) { if (plr[pnum].SpdList[ii]._itype == ITYPE_GOLD) { i = plr[pnum].HoldItem._ivalue + plr[pnum].SpdList[ii]._ivalue; - if (i <= 5000) { + if (i <= GOLD_MAX_LIMIT) { plr[pnum].SpdList[ii]._ivalue += plr[pnum].HoldItem._ivalue; plr[pnum]._pGold += plr[pnum].HoldItem._ivalue; - if (i >= 2500) + if (i >= GOLD_MEDIUM_LIMIT) plr[pnum].SpdList[ii]._iCurs = ICURS_GOLD_LARGE; - else if (i <= 1000) + else if (i <= GOLD_SMALL_LIMIT) plr[pnum].SpdList[ii]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].SpdList[ii]._iCurs = ICURS_GOLD_MEDIUM; } else { - i = 5000 - plr[pnum].SpdList[ii]._ivalue; + i = GOLD_MAX_LIMIT - plr[pnum].SpdList[ii]._ivalue; plr[pnum]._pGold += i; plr[pnum].HoldItem._ivalue -= i; - plr[pnum].SpdList[ii]._ivalue = 5000; + plr[pnum].SpdList[ii]._ivalue = GOLD_MAX_LIMIT; plr[pnum].SpdList[ii]._iCurs = ICURS_GOLD_LARGE; // BUGFIX: incorrect values here are leftover from beta - if (plr[pnum].HoldItem._ivalue >= 2500) + if (plr[pnum].HoldItem._ivalue >= GOLD_MEDIUM_LIMIT) cn = 18; - else if (plr[pnum].HoldItem._ivalue <= 1000) + else if (plr[pnum].HoldItem._ivalue <= GOLD_SMALL_LIMIT) cn = 16; else cn = 17; diff --git a/Source/items.cpp b/Source/items.cpp index 4d59d04a..b2e82f42 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -840,9 +840,9 @@ void SetPlrHandSeed(ItemStruct *h, int iseed) void SetPlrHandGoldCurs(ItemStruct *h) { - if (h->_ivalue >= 2500) + if (h->_ivalue >= GOLD_MEDIUM_LIMIT) h->_iCurs = ICURS_GOLD_LARGE; - else if (h->_ivalue <= 1000) + else if (h->_ivalue <= GOLD_SMALL_LIMIT) h->_iCurs = ICURS_GOLD_SMALL; else h->_iCurs = ICURS_GOLD_MEDIUM; @@ -932,7 +932,7 @@ void CreatePlrItems(int p) plr[p].InvGrid[30] = plr[p]._pNumInv; #ifdef _DEBUG } else { - plr[p].HoldItem._ivalue = 5000; + plr[p].HoldItem._ivalue = GOLD_MAX_LIMIT; plr[p].HoldItem._iCurs = ICURS_GOLD_LARGE; plr[p]._pGold = plr[p].HoldItem._ivalue * 40; for (i = 0; i < 40; i++) { @@ -1306,15 +1306,15 @@ void GetItemAttrs(int i, int idata, int lvl) if (leveltype == DTYPE_HELL) rndv += rndv >> 3; - if (rndv > 5000) - rndv = 5000; + if (rndv > GOLD_MAX_LIMIT) + rndv = GOLD_MAX_LIMIT; item[i]._ivalue = rndv; - if (rndv >= 2500) + if (rndv >= GOLD_MEDIUM_LIMIT) item[i]._iCurs = ICURS_GOLD_LARGE; else - item[i]._iCurs = (rndv > 1000) + 4; + item[i]._iCurs = (rndv > GOLD_SMALL_LIMIT) + 4; } } @@ -2227,9 +2227,9 @@ void RecreateItem(int ii, int idx, unsigned short ic, int iseed, int ivalue) item[ii]._iSeed = iseed; item[ii]._iCreateInfo = ic; item[ii]._ivalue = ivalue; - if (ivalue >= 2500) + if (ivalue >= GOLD_MEDIUM_LIMIT) item[ii]._iCurs = ICURS_GOLD_LARGE; - else if (ivalue <= 1000) + else if (ivalue <= GOLD_SMALL_LIMIT) item[ii]._iCurs = ICURS_GOLD_SMALL; else item[ii]._iCurs = ICURS_GOLD_MEDIUM; diff --git a/Source/player.cpp b/Source/player.cpp index 87710ebd..ec40ebb2 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1791,7 +1791,7 @@ void DropHalfPlayersGold(int pnum) hGold = plr[pnum]._pGold >> 1; for (i = 0; i < MAXBELTITEMS && hGold > 0; i++) { - if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && plr[pnum].SpdList[i]._ivalue != 5000) { + if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && plr[pnum].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { if (hGold < plr[pnum].SpdList[i]._ivalue) { plr[pnum].SpdList[i]._ivalue -= hGold; SetSpdbarGoldCurs(pnum, i); @@ -1841,7 +1841,7 @@ void DropHalfPlayersGold(int pnum) drawpanflag = 255; if (hGold > 0) { for (i = 0; i < plr[pnum]._pNumInv && hGold > 0; i++) { - if (plr[pnum].InvList[i]._itype == ITYPE_GOLD && plr[pnum].InvList[i]._ivalue != 5000) { + if (plr[pnum].InvList[i]._itype == ITYPE_GOLD && plr[pnum].InvList[i]._ivalue != GOLD_MAX_LIMIT) { if (hGold < plr[pnum].InvList[i]._ivalue) { plr[pnum].InvList[i]._ivalue -= hGold; SetGoldCurs(pnum, i); @@ -3306,8 +3306,8 @@ void ValidatePlayer() gt = 0; for (i = 0; i < plr[myplr]._pNumInv; i++) { if (plr[myplr].InvList[i]._itype == ITYPE_GOLD) { - if (plr[myplr].InvList[i]._ivalue > 5000) { - plr[myplr].InvList[i]._ivalue = 5000; + if (plr[myplr].InvList[i]._ivalue > GOLD_MAX_LIMIT) { + plr[myplr].InvList[i]._ivalue = GOLD_MAX_LIMIT; } gt += plr[myplr].InvList[i]._ivalue; } diff --git a/Source/stores.cpp b/Source/stores.cpp index ecb52af6..cfa984b2 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -1782,9 +1782,9 @@ void S_SmithEnter() void SetGoldCurs(int pnum, int i) { - if (plr[pnum].InvList[i]._ivalue >= 2500) + if (plr[pnum].InvList[i]._ivalue >= GOLD_MEDIUM_LIMIT) plr[pnum].InvList[i]._iCurs = ICURS_GOLD_LARGE; - else if (plr[pnum].InvList[i]._ivalue <= 1000) + else if (plr[pnum].InvList[i]._ivalue <= GOLD_SMALL_LIMIT) plr[pnum].InvList[i]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].InvList[i]._iCurs = ICURS_GOLD_MEDIUM; @@ -1792,9 +1792,9 @@ void SetGoldCurs(int pnum, int i) void SetSpdbarGoldCurs(int pnum, int i) { - if (plr[pnum].SpdList[i]._ivalue >= 2500) + if (plr[pnum].SpdList[i]._ivalue >= GOLD_MEDIUM_LIMIT) plr[pnum].SpdList[i]._iCurs = ICURS_GOLD_LARGE; - else if (plr[pnum].SpdList[i]._ivalue <= 1000) + else if (plr[pnum].SpdList[i]._ivalue <= GOLD_SMALL_LIMIT) plr[pnum].SpdList[i]._iCurs = ICURS_GOLD_SMALL; else plr[pnum].SpdList[i]._iCurs = ICURS_GOLD_MEDIUM; @@ -1806,7 +1806,7 @@ void TakePlrsMoney(int cost) plr[myplr]._pGold = CalculateGold(myplr) - cost; for (i = 0; i < MAXBELTITEMS && cost > 0; i++) { - if (plr[myplr].SpdList[i]._itype == ITYPE_GOLD && plr[myplr].SpdList[i]._ivalue != 5000) { + if (plr[myplr].SpdList[i]._itype == ITYPE_GOLD && plr[myplr].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { if (cost < plr[myplr].SpdList[i]._ivalue) { plr[myplr].SpdList[i]._ivalue -= cost; SetSpdbarGoldCurs(myplr, i); @@ -1836,7 +1836,7 @@ void TakePlrsMoney(int cost) drawpanflag = 255; if (cost > 0) { for (i = 0; i < plr[myplr]._pNumInv && cost > 0; i++) { - if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != 5000) { + if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != GOLD_MAX_LIMIT) { if (cost < plr[myplr].InvList[i]._ivalue) { plr[myplr].InvList[i]._ivalue -= cost; SetGoldCurs(myplr, i); @@ -1984,8 +1984,8 @@ BOOL StoreGoldFit(int idx) int i, sz, cost, numsqrs; cost = storehold[idx]._iIvalue; - sz = cost / 5000; - if (cost % 5000) + sz = cost / GOLD_MAX_LIMIT; + if (cost % GOLD_MAX_LIMIT) sz++; SetCursor_(storehold[idx]._iCurs + CURSOR_FIRSTITEM); @@ -2001,16 +2001,16 @@ BOOL StoreGoldFit(int idx) } for (i = 0; i < plr[myplr]._pNumInv; i++) { - if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != 5000) { - if (cost + plr[myplr].InvList[i]._ivalue <= 5000) + if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != GOLD_MAX_LIMIT) { + if (cost + plr[myplr].InvList[i]._ivalue <= GOLD_MAX_LIMIT) cost = 0; else - cost -= 5000 - plr[myplr].InvList[i]._ivalue; + cost -= GOLD_MAX_LIMIT - plr[myplr].InvList[i]._ivalue; } } - sz = cost / 5000; - if (cost % 5000) + sz = cost / GOLD_MAX_LIMIT; + if (cost % GOLD_MAX_LIMIT) sz++; return numsqrs >= sz; @@ -2059,22 +2059,22 @@ void StoreSellItem() } plr[myplr]._pGold += cost; for (i = 0; i < plr[myplr]._pNumInv && cost > 0; i++) { - if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != 5000) { - if (cost + plr[myplr].InvList[i]._ivalue <= 5000) { + if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != GOLD_MAX_LIMIT) { + if (cost + plr[myplr].InvList[i]._ivalue <= GOLD_MAX_LIMIT) { plr[myplr].InvList[i]._ivalue += cost; SetGoldCurs(myplr, i); cost = 0; } else { - cost -= 5000 - plr[myplr].InvList[i]._ivalue; - plr[myplr].InvList[i]._ivalue = 5000; + cost -= GOLD_MAX_LIMIT - plr[myplr].InvList[i]._ivalue; + plr[myplr].InvList[i]._ivalue = GOLD_MAX_LIMIT; SetGoldCurs(myplr, i); } } } if (cost > 0) { - while (cost > 5000) { - PlaceStoreGold(5000); - cost -= 5000; + while (cost > GOLD_MAX_LIMIT) { + PlaceStoreGold(GOLD_MAX_LIMIT); + cost -= GOLD_MAX_LIMIT; } PlaceStoreGold(cost); } diff --git a/defs.h b/defs.h index 5644e393..38cf4be8 100644 --- a/defs.h +++ b/defs.h @@ -51,6 +51,10 @@ // from diablo 2 beta #define MAXEXP 2000000000 +#define GOLD_SMALL_LIMIT 1000 +#define GOLD_MEDIUM_LIMIT 2500 +#define GOLD_MAX_LIMIT 5000 + #define PLR_NAME_LEN 32 #define MAXPATHNODES 300