diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 7e98b0b31..6844f61c8 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -257,7 +257,7 @@ void DrawDlg(char *pszFmt, ...) SDrawMessageBox(text, "Diablo", MB_TASKMODAL|MB_ICONEXCLAMATION); } -void __fastcall DDErrDlg(int error_code, int log_line_nr, char *log_file_path) +void __fastcall DDErrMsg(int error_code, int log_line_nr, char *log_file_path) { int v3; // esi char *v4; // eax @@ -270,7 +270,7 @@ void __fastcall DDErrDlg(int error_code, int log_line_nr, char *log_file_path) } } -void __fastcall DSErrDlg(int error_code, int log_line_nr, char *log_file_path) +void __fastcall DSErrMsg(int error_code, int log_line_nr, char *log_file_path) { int v3; // esi char *v4; // eax @@ -283,7 +283,7 @@ void __fastcall DSErrDlg(int error_code, int log_line_nr, char *log_file_path) } } -void __fastcall CenterDlg(HWND hDlg) +void __fastcall center_window(HWND hDlg) { LONG v1; // esi LONG v2; // edi @@ -309,7 +309,7 @@ void __fastcall CenterDlg(HWND hDlg) } } -void __fastcall TermDlg(int template_id, int error_code, char *log_file_path, int log_line_nr) +void __fastcall ErrDlg(int template_id, int error_code, char *log_file_path, int log_line_nr) { int v4; // ebx int v5; // edi @@ -327,7 +327,7 @@ void __fastcall TermDlg(int template_id, int error_code, char *log_file_path, in v6 = v7 + 1; v8 = GetErr(v4); wsprintfA((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v6, log_line_nr); - if ( DialogBoxParamA(ghInst, (LPCSTR)(unsigned short)v5, ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam) == -1 ) + if ( DialogBoxParamA(ghInst, MAKEINTRESOURCE(v5), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam) == -1 ) TermMsg("ErrDlg: %d", v5); TermMsg(0); } @@ -361,12 +361,12 @@ void __fastcall TextDlg(HWND hDlg, char *text) v2 = text; v3 = hDlg; - CenterDlg(hDlg); + center_window(hDlg); if ( v2 ) SetDlgItemTextA(v3, 1000, v2); } -void __fastcall ErrDlg(template_id template_id, int error_code, char *log_file_path, int log_line_nr) +void __fastcall ErrOkDlg(int template_id, int error_code, char *log_file_path, int log_line_nr) { char *v4; // esi int v5; // edi @@ -383,7 +383,7 @@ void __fastcall ErrDlg(template_id template_id, int error_code, char *log_file_p v4 = v7 + 1; v8 = GetErr(v5); wsprintfA((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v4, log_line_nr); - DialogBoxParamA(ghInst, (LPCSTR)v6, ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam); + DialogBoxParamA(ghInst, MAKEINTRESOURCE(v6), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam); } void __fastcall FileErrDlg(char *error) @@ -394,7 +394,7 @@ void __fastcall FileErrDlg(char *error) FreeDlg(); if ( !v1 ) v1 = &empty_string; - if ( DialogBoxParamA(ghInst, (LPCSTR)0x6A, ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) + if ( DialogBoxParamA(ghInst, MAKEINTRESOURCE(IDD_DIALOG3), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) TermMsg("FileErrDlg"); TermMsg(0); } @@ -405,7 +405,7 @@ void __fastcall DiskFreeDlg(char *error) v1 = error; FreeDlg(); - if ( DialogBoxParamA(ghInst, (LPCSTR)0x6E, ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) + if ( DialogBoxParamA(ghInst, MAKEINTRESOURCE(IDD_DIALOG7), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) TermMsg("DiskFreeDlg"); TermMsg(0); } @@ -415,20 +415,20 @@ bool __cdecl InsertCDDlg() int v0; // edi ShowCursor(1); - v0 = DialogBoxParamA(ghInst, (LPCSTR)0x70, ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)&empty_string); + v0 = DialogBoxParamA(ghInst, MAKEINTRESOURCE(IDD_DIALOG9), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)&empty_string); if ( v0 == -1 ) TermMsg("InsertCDDlg"); ShowCursor(0); return v0 == 1; } -void __fastcall DirErrDlg(char *error) +void __fastcall DirErrorDlg(char *error) { char *v1; // esi v1 = error; FreeDlg(); - if ( DialogBoxParamA(ghInst, (LPCSTR)0x72, ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) + if ( DialogBoxParamA(ghInst, MAKEINTRESOURCE(IDD_DIALOG11), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) TermMsg("DirErrorDlg"); TermMsg(0); } diff --git a/Source/appfat.h b/Source/appfat.h index 6450ce07f..eb98e830c 100644 --- a/Source/appfat.h +++ b/Source/appfat.h @@ -15,16 +15,16 @@ void TermMsg(char *pszFmt, ...); void __fastcall MsgBox(char *pszFmt, va_list va); void __cdecl FreeDlg(); void DrawDlg(char *pszFmt, ...); -void __fastcall DDErrDlg(int error_code, int log_line_nr, char *log_file_path); -void __fastcall DSErrDlg(int error_code, int log_line_nr, char *log_file_path); -void __fastcall CenterDlg(HWND hDlg); -void __fastcall TermDlg(int template_id, int error_code, char *log_file_path, int log_line_nr); +void __fastcall DDErrMsg(int error_code, int log_line_nr, char *log_file_path); +void __fastcall DSErrMsg(int error_code, int log_line_nr, char *log_file_path); +void __fastcall center_window(HWND hDlg); +void __fastcall ErrDlg(int template_id, int error_code, char *log_file_path, int log_line_nr); bool __stdcall FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, char *text); void __fastcall TextDlg(HWND hDlg, char *text); -void __fastcall ErrDlg(template_id template_id, int error_code, char *log_file_path, int log_line_nr); +void __fastcall ErrOkDlg(int template_id, int error_code, char *log_file_path, int log_line_nr); void __fastcall FileErrDlg(char *error); void __fastcall DiskFreeDlg(char *error); bool __cdecl InsertCDDlg(); -void __fastcall DirErrDlg(char *error); +void __fastcall DirErrorDlg(char *error); #endif /* __APPFAT_H__ */ diff --git a/Source/automap.cpp b/Source/automap.cpp index 47799fe7b..e73d3880e 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -448,10 +448,10 @@ void __fastcall DrawAutomapType(int screen_x, int screen_y, short automap_type) } if ( automap_type < 0 ) { - engine_draw_automap_pixels(v4 - AMPlayerX, v5 - AMPlayerX - AMPlayerY, v4 + AMPlayerX + AutoMapYPos, AMPlayerY + v5, 144); - engine_draw_automap_pixels(v4 - AutoMapYPos, v5 - AMPlayerX, AutoMapYPos + v4, AMPlayerX + v5, 144); - engine_draw_automap_pixels(v4 - AutoMapYPos - AMPlayerX, v5 - AMPlayerY, AMPlayerX + v4, v5 + AMPlayerX + AMPlayerY, 144); - engine_draw_automap_pixels(v4 - AutoMapXPos, v5, v4, v5 + AutoMapYPos, 144); + DrawLine(v4 - AMPlayerX, v5 - AMPlayerX - AMPlayerY, v4 + AMPlayerX + AutoMapYPos, AMPlayerY + v5, 144); + DrawLine(v4 - AutoMapYPos, v5 - AMPlayerX, AutoMapYPos + v4, AMPlayerX + v5, 144); + DrawLine(v4 - AutoMapYPos - AMPlayerX, v5 - AMPlayerY, AMPlayerX + v4, v5 + AMPlayerX + AMPlayerY, 144); + DrawLine(v4 - AutoMapXPos, v5, v4, v5 + AutoMapYPos, 144); v3 = automap_type; } v31 = 0; @@ -464,9 +464,9 @@ void __fastcall DrawAutomapType(int screen_x, int screen_y, short automap_type) a1 = v4 - AutoMapYPos; a2 = v5 - AutoMapYPos; automap_typea = v5 - AMPlayerX; - engine_draw_automap_pixels(v4, v5 - AutoMapYPos, v4 - AutoMapYPos, v5 - AMPlayerX, 200); - engine_draw_automap_pixels(v4, a2, a3, automap_typea, 200); - engine_draw_automap_pixels(v4, v5, a1, automap_typea, 200); + DrawLine(v4, v5 - AutoMapYPos, v4 - AutoMapYPos, v5 - AMPlayerX, 200); + DrawLine(v4, a2, a3, automap_typea, 200); + DrawLine(v4, v5, a1, automap_typea, 200); v9 = v5; v29 = automap_typea; v28 = a3; @@ -491,16 +491,16 @@ LABEL_8: v11 = v4 - AutoMapYPos; v12 = v5 - AutoMapYPos; automap_typeb = v5 - AMPlayerX; - engine_draw_automap_pixels(v4, v5 - AutoMapYPos, v4 - AMPlayerX, v5 - AutoMapYPos + AMPlayerY, 200); - engine_draw_automap_pixels(v10, v5, v10 + AMPlayerX, v5 - AMPlayerY, 200); - engine_draw_automap_pixels(v11, v12, v10, automap_typeb, 144); - engine_draw_automap_pixels(v11, v12, v4, automap_typeb, 144); - engine_draw_automap_pixels(v11, v5, v10, automap_typeb, 144); - engine_draw_automap_pixels(v11, v5, v4, automap_typeb, 144); + DrawLine(v4, v5 - AutoMapYPos, v4 - AMPlayerX, v5 - AutoMapYPos + AMPlayerY, 200); + DrawLine(v10, v5, v10 + AMPlayerX, v5 - AMPlayerY, 200); + DrawLine(v11, v12, v10, automap_typeb, 144); + DrawLine(v11, v12, v4, automap_typeb, 144); + DrawLine(v11, v5, v10, automap_typeb, 144); + DrawLine(v11, v5, v4, automap_typeb, 144); } if ( v33 & 0x10 ) { - engine_draw_automap_pixels(v4 - AutoMapYPos, v5 - AMPlayerX, v4 - AutoMapXPos, v5, 200); + DrawLine(v4 - AutoMapYPos, v5 - AMPlayerX, v4 - AutoMapXPos, v5, 200); v33 |= 4u; } if ( v33 & 4 ) @@ -509,13 +509,13 @@ LABEL_8: v14 = v4 - AutoMapYPos; v15 = v5 - AutoMapYPos; automap_typec = v5 - AMPlayerX; - engine_draw_automap_pixels(v4, v5 - AutoMapYPos, v4 - AutoMapYPos, v5 - AMPlayerX, 200); - engine_draw_automap_pixels(v4, v15, v13, automap_typec, 200); - engine_draw_automap_pixels(v4, v5, v14, automap_typec, 200); - engine_draw_automap_pixels(v4, v5, v13, automap_typec, 200); + DrawLine(v4, v5 - AutoMapYPos, v4 - AutoMapYPos, v5 - AMPlayerX, 200); + DrawLine(v4, v15, v13, automap_typec, 200); + DrawLine(v4, v5, v14, automap_typec, 200); + DrawLine(v4, v5, v13, automap_typec, 200); } if ( !(v33 & 0x15) ) - engine_draw_automap_pixels(v4, v5 - AutoMapYPos, v4 - AutoMapXPos, v5, 200); + DrawLine(v4, v5 - AutoMapYPos, v4 - AutoMapXPos, v5, 200); if ( v31 ) goto LABEL_17; goto LABEL_25; @@ -528,16 +528,16 @@ LABEL_17: v17 = v5 - AutoMapYPos; v18 = v4 + AutoMapXPos; automap_typed = v5 - AMPlayerX; - engine_draw_automap_pixels(v4, v5 - AutoMapYPos, v4 + AMPlayerX, v5 - AutoMapYPos + AMPlayerY, 200); - engine_draw_automap_pixels(v18, v5, v18 - AMPlayerX, v5 - AMPlayerY, 200); - engine_draw_automap_pixels(v16, v17, v4, automap_typed, 144); - engine_draw_automap_pixels(v16, v17, v18, automap_typed, 144); - engine_draw_automap_pixels(v16, v5, v4, automap_typed, 144); - engine_draw_automap_pixels(v16, v5, v18, automap_typed, 144); + DrawLine(v4, v5 - AutoMapYPos, v4 + AMPlayerX, v5 - AutoMapYPos + AMPlayerY, 200); + DrawLine(v18, v5, v18 - AMPlayerX, v5 - AMPlayerY, 200); + DrawLine(v16, v17, v4, automap_typed, 144); + DrawLine(v16, v17, v18, automap_typed, 144); + DrawLine(v16, v5, v4, automap_typed, 144); + DrawLine(v16, v5, v18, automap_typed, 144); } if ( v33 & 0x20 ) { - engine_draw_automap_pixels(AutoMapYPos + v4, v5 - AMPlayerX, v4 + AutoMapXPos, v5, 200); + DrawLine(AutoMapYPos + v4, v5 - AMPlayerX, v4 + AutoMapXPos, v5, 200); v33 |= 8u; } if ( v33 & 8 ) @@ -546,13 +546,13 @@ LABEL_17: v20 = v4 - AutoMapYPos; v21 = v5 - AutoMapYPos; automap_typee = v5 - AMPlayerX; - engine_draw_automap_pixels(v4, v5 - AutoMapYPos, v4 - AutoMapYPos, v5 - AMPlayerX, 200); - engine_draw_automap_pixels(v4, v21, v19, automap_typee, 200); - engine_draw_automap_pixels(v4, v5, v20, automap_typee, 200); - engine_draw_automap_pixels(v4, v5, v19, automap_typee, 200); + DrawLine(v4, v5 - AutoMapYPos, v4 - AutoMapYPos, v5 - AMPlayerX, 200); + DrawLine(v4, v21, v19, automap_typee, 200); + DrawLine(v4, v5, v20, automap_typee, 200); + DrawLine(v4, v5, v19, automap_typee, 200); } if ( !(v33 & 0x2A) ) - engine_draw_automap_pixels(v4, v5 - AutoMapYPos, v4 + AutoMapXPos, v5, 200); + DrawLine(v4, v5 - AutoMapYPos, v4 + AutoMapXPos, v5, 200); LABEL_25: if ( v30 ) goto LABEL_26; @@ -570,16 +570,16 @@ LABEL_26: v23 = v4 - AutoMapYPos; v24 = AutoMapYPos + v5; automap_typef = AMPlayerX + v5; - engine_draw_automap_pixels(v4, AutoMapYPos + v5, v4 - AMPlayerX, AutoMapYPos + v5 - AMPlayerY, 200); - engine_draw_automap_pixels(v22, v5, v22 + AMPlayerX, v5 + AMPlayerY, 200); - engine_draw_automap_pixels(v23, v24, v22, automap_typef, 144); - engine_draw_automap_pixels(v23, v24, v4, automap_typef, 144); - engine_draw_automap_pixels(v23, v5, v22, automap_typef, 144); - engine_draw_automap_pixels(v23, v5, v4, automap_typef, 144); + DrawLine(v4, AutoMapYPos + v5, v4 - AMPlayerX, AutoMapYPos + v5 - AMPlayerY, 200); + DrawLine(v22, v5, v22 + AMPlayerX, v5 + AMPlayerY, 200); + DrawLine(v23, v24, v22, automap_typef, 144); + DrawLine(v23, v24, v4, automap_typef, 144); + DrawLine(v23, v5, v22, automap_typef, 144); + DrawLine(v23, v5, v4, automap_typef, 144); } else { - engine_draw_automap_pixels(v4, AutoMapYPos + v5, v4 - AutoMapXPos, v5, 200); + DrawLine(v4, AutoMapYPos + v5, v4 - AutoMapXPos, v5, 200); } LABEL_32: if ( v32 ) @@ -591,12 +591,12 @@ LABEL_33: v26 = AutoMapYPos + v5; v27 = v4 + AutoMapXPos; automap_typeg = AMPlayerX + v5; - engine_draw_automap_pixels(v4, AutoMapYPos + v5, v4 + AMPlayerX, AutoMapYPos + v5 - AMPlayerY, 200); - engine_draw_automap_pixels(v27, v5, v27 - AMPlayerX, v5 + AMPlayerY, 200); - engine_draw_automap_pixels(v25, v26, v4, automap_typeg, 144); - engine_draw_automap_pixels(v25, v26, v27, automap_typeg, 144); - engine_draw_automap_pixels(v25, v5, v4, automap_typeg, 144); - engine_draw_automap_pixels(v25, v5, v27, automap_typeg, 144); + DrawLine(v4, AutoMapYPos + v5, v4 + AMPlayerX, AutoMapYPos + v5 - AMPlayerY, 200); + DrawLine(v27, v5, v27 - AMPlayerX, v5 + AMPlayerY, 200); + DrawLine(v25, v26, v4, automap_typeg, 144); + DrawLine(v25, v26, v27, automap_typeg, 144); + DrawLine(v25, v5, v4, automap_typeg, 144); + DrawLine(v25, v5, v27, automap_typeg, 144); } else { @@ -604,7 +604,7 @@ LABEL_33: v28 = v4 + AutoMapXPos; v9 = AutoMapYPos + v5; LABEL_36: - engine_draw_automap_pixels(v4, v9, v28, v29, 200); + DrawLine(v4, v9, v28, v29, 200); } } break; @@ -669,14 +669,14 @@ void __cdecl DrawAutomapPlr() switch ( plr[v0]._pdir ) { case DIR_S: - engine_draw_automap_pixels(v3, v4, v3, v4 + AutoMapYPos, 153); - engine_draw_automap_pixels(v3, AutoMapYPos + v4, v3 + AMPlayerY, v4 + AMPlayerX, 153); + DrawLine(v3, v4, v3, v4 + AutoMapYPos, 153); + DrawLine(v3, AutoMapYPos + v4, v3 + AMPlayerY, v4 + AMPlayerX, 153); v10 = v4 + AMPlayerX; v9 = v3 - AMPlayerY; v5 = AutoMapYPos + v4; goto LABEL_19; case DIR_SW: - engine_draw_automap_pixels( + DrawLine( v3, AMPlayerX * (v12 + v11) + (AutoMapScale * ScrollInfo._syoff / 100 >> 1) @@ -689,22 +689,22 @@ void __cdecl DrawAutomapPlr() + (AutoMapScale * plr[v0]._pyoff / 100 >> 1) + 336, 153); - engine_draw_automap_pixels(v3 - AutoMapYPos, AMPlayerX + v4, v3 - AMPlayerY - AMPlayerX, v4, 153); + DrawLine(v3 - AutoMapYPos, AMPlayerX + v4, v3 - AMPlayerY - AMPlayerX, v4, 153); v7 = AMPlayerX; v8 = v3; v5 = AMPlayerX + v4; v10 = AMPlayerX + v4; goto LABEL_23; case DIR_W: - engine_draw_automap_pixels(v3, v4, v3 - AutoMapYPos, v4, 153); - engine_draw_automap_pixels(v3 - AutoMapYPos, v4, v3 - AMPlayerX, v4 - AMPlayerY, 153); + DrawLine(v3, v4, v3 - AutoMapYPos, v4, 153); + DrawLine(v3 - AutoMapYPos, v4, v3 - AMPlayerX, v4 - AMPlayerY, 153); v5 = v4; v10 = v4 + AMPlayerY; v9 = v3 - AMPlayerX; goto LABEL_24; case DIR_NW: - engine_draw_automap_pixels(v3, v4, v3 - AutoMapYPos, v4 - AMPlayerX, 153); - engine_draw_automap_pixels(v3 - AutoMapYPos, v4 - AMPlayerX, v3 - AMPlayerX, v4 - AMPlayerX, 153); + DrawLine(v3, v4, v3 - AutoMapYPos, v4 - AMPlayerX, 153); + DrawLine(v3 - AutoMapYPos, v4 - AMPlayerX, v3 - AMPlayerX, v4 - AMPlayerX, 153); v7 = AMPlayerX; v8 = v3 - AMPlayerY; v10 = v4; @@ -715,8 +715,8 @@ LABEL_24: v6 = v3 - AutoMapYPos; goto LABEL_25; case DIR_N: - engine_draw_automap_pixels(v3, v4, v3, v4 - AutoMapYPos, 153); - engine_draw_automap_pixels(v3, v4 - AutoMapYPos, v3 - AMPlayerY, v4 - AMPlayerX, 153); + DrawLine(v3, v4, v3, v4 - AutoMapYPos, 153); + DrawLine(v3, v4 - AutoMapYPos, v3 - AMPlayerY, v4 - AMPlayerX, 153); v10 = v4 - AMPlayerX; v5 = v4 - AutoMapYPos; v9 = v3 + AMPlayerY; @@ -724,19 +724,19 @@ LABEL_19: v6 = v3; goto LABEL_25; case DIR_NE: - engine_draw_automap_pixels(v3, v4, v3 + AutoMapYPos, v4 - AMPlayerX, 153); - engine_draw_automap_pixels(AutoMapYPos + v3, v4 - AMPlayerX, v3 + AMPlayerX, v4 - AMPlayerX, 153); + DrawLine(v3, v4, v3 + AutoMapYPos, v4 - AMPlayerX, 153); + DrawLine(AutoMapYPos + v3, v4 - AMPlayerX, v3 + AMPlayerX, v4 - AMPlayerX, 153); v10 = v4; v9 = v3 + AMPlayerX + AMPlayerY; v5 = v4 - AMPlayerX; goto LABEL_17; case DIR_E: - engine_draw_automap_pixels(v3, v4, v3 + AutoMapYPos, v4, 153); - engine_draw_automap_pixels(AutoMapYPos + v3, v4, v3 + AMPlayerX, v4 - AMPlayerY, 153); - engine_draw_automap_pixels(AutoMapYPos + v3, v4, v3 + AMPlayerX, v4 + AMPlayerY, 153); + DrawLine(v3, v4, v3 + AutoMapYPos, v4, 153); + DrawLine(AutoMapYPos + v3, v4, v3 + AMPlayerX, v4 - AMPlayerY, 153); + DrawLine(AutoMapYPos + v3, v4, v3 + AMPlayerX, v4 + AMPlayerY, 153); break; case DIR_SE: - engine_draw_automap_pixels( + DrawLine( v3, AMPlayerX * (v12 + v11) + (AutoMapScale * ScrollInfo._syoff / 100 >> 1) @@ -749,14 +749,14 @@ LABEL_19: + (AutoMapScale * plr[v0]._pyoff / 100 >> 1) + 336, 153); - engine_draw_automap_pixels(AutoMapYPos + v3, AMPlayerX + v4, v3 + AMPlayerX + AMPlayerY, v4, 153); + DrawLine(AutoMapYPos + v3, AMPlayerX + v4, v3 + AMPlayerX + AMPlayerY, v4, 153); v5 = AMPlayerX + v4; v10 = AMPlayerX + v4; v9 = v3 + AMPlayerX; LABEL_17: v6 = AutoMapYPos + v3; LABEL_25: - engine_draw_automap_pixels(v6, v5, v9, v10, 153); + DrawLine(v6, v5, v9, v10, 153); break; default: return; @@ -770,46 +770,46 @@ LABEL_25: // 4B8968: using guessed type int sbookflag; // 69BD04: using guessed type int questlog; -short __fastcall GetAutomapType(int tx, int ty, bool view) +short __fastcall GetAutomapType(int x, int y, bool view) { int v3; // edi int v4; // esi int v6; // eax short v7; // bp - v3 = ty; - v4 = tx; + v3 = y; + v4 = x; if ( view ) { - if ( tx == -1 && ty >= 0 && ty < 40 && automapview[0][ty] ) + if ( x == -1 && y >= 0 && y < 40 && automapview[0][y] ) { - tx = 0; - return ~GetAutomapType(tx, ty, 0) & 0x4000; + x = 0; + return ~GetAutomapType(x, y, 0) & 0x4000; } - if ( ty == -1 ) + if ( y == -1 ) { - if ( tx < 0 ) + if ( x < 0 ) return 0; - if ( tx < 40 && automapview[tx][0] ) + if ( x < 40 && automapview[x][0] ) { - ty = 0; - return ~GetAutomapType(tx, ty, 0) & 0x4000; + y = 0; + return ~GetAutomapType(x, y, 0) & 0x4000; } } } - if ( tx < 0 ) + if ( x < 0 ) return 0; - if ( tx >= 40 ) + if ( x >= 40 ) return 0; - if ( ty < 0 ) + if ( y < 0 ) return 0; - if ( ty >= 40 ) + if ( y >= 40 ) return 0; - v6 = ty + 40 * tx; + v6 = y + 40 * x; if ( !automapview[0][v6] && view ) return 0; v7 = automaptype[(unsigned char)dungeon[0][v6]]; - if ( v7 == 7 && ((unsigned short)GetAutomapType(tx - 1, ty, 0) >> 8) & 8 ) + if ( v7 == 7 && ((unsigned short)GetAutomapType(x - 1, y, 0) >> 8) & 8 ) { if ( ((unsigned short)GetAutomapType(v4, v3 - 1, 0) >> 8) & 4 ) v7 = 1; diff --git a/Source/automap.h b/Source/automap.h index 8a3fa1579..8126d0996 100644 --- a/Source/automap.h +++ b/Source/automap.h @@ -29,7 +29,7 @@ void __cdecl AutomapZoomOut(); void __cdecl DrawAutomap(); void __fastcall DrawAutomapType(int screen_x, int screen_y, short automap_type); void __cdecl DrawAutomapPlr(); -short __fastcall GetAutomapType(int tx, int ty, bool view); +short __fastcall GetAutomapType(int x, int y, bool view); void __cdecl DrawAutomapGame(); void __fastcall SetAutomapView(int x, int y); void __cdecl AutomapZoomReset(); diff --git a/Source/control.h b/Source/control.h index 3c9b67f08..7184b03eb 100644 --- a/Source/control.h +++ b/Source/control.h @@ -64,7 +64,7 @@ void __cdecl DrawSpellList(); void __cdecl SetSpell(); void __fastcall SetSpeedSpell(int slot); void __fastcall ToggleSpell(int slot); -void __fastcall CPrintString(int No, unsigned char pszStr, int Just); +void __fastcall CPrintString(int No, unsigned char pszStr, int Just); /* check arg names */ void __fastcall AddPanelString(char *str, int just); void __cdecl ClearPanel(); void __fastcall DrawPanelBox(int x, int y, int w, int h, int sx, int sy); diff --git a/Source/diablo.cpp b/Source/diablo.cpp index abb859403..6f6a7a3fa 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -291,12 +291,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine #endif ghInst = v4; if ( RestrictedTest() ) - ErrDlg(TEMPLATE_ERR_RESTRICTED, 0, "C:\\Src\\Diablo\\Source\\DIABLO.CPP", 877); + ErrOkDlg(IDD_DIALOG10, 0, "C:\\Src\\Diablo\\Source\\DIABLO.CPP", 877); if ( ReadOnlyTest() ) { if ( !GetModuleFileNameA(ghInst, Filename, 0x104u) ) *Filename = '\0'; - DirErrDlg(Filename); + DirErrorDlg(Filename); } ShowCursor(FALSE); srand(GetTickCount()); @@ -333,7 +333,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine #endif mainmenu_action(0); /* v11 fix unused arg */ UiDestroy(); - palette_save_gamme(); + SaveGamma(); if ( ghMainWnd ) { Sleep(300); @@ -1638,11 +1638,11 @@ LABEL_72: return; case 'F': case 'f': - palette_inc_gamma(); + IncreaseGamma(); return; case 'G': case 'g': - palette_dec_gamma(); + DecreaseGamma(); return; case 'I': case 'i': @@ -2018,7 +2018,7 @@ void __fastcall LoadGameLevel(bool firstflag, int lvldir) glMid1Seed[currlevel] = GetRndSeed(); InitMonsters(); glMid2Seed[currlevel] = GetRndSeed(); - InitObjects(currlevel); + InitObjects(); InitItems(); CreateThemeRooms(); glMid3Seed[currlevel] = GetRndSeed(); @@ -2151,12 +2151,12 @@ LABEL_72: // 5CF31D: using guessed type char setlevel; // 679660: using guessed type char gbMaxPlayers; -void __fastcall game_loop(bool startup) +void __fastcall game_loop(bool bStartup) { int v1; // ecx int v2; // esi - v1 = startup != 0 ? 0x39 : 0; + v1 = bStartup != 0 ? 0x39 : 0; v2 = v1 + 3; if ( v1 != -3 ) { @@ -2243,9 +2243,9 @@ void __cdecl game_logic() // 5BB1ED: using guessed type char leveltype; // 679660: using guessed type char gbMaxPlayers; -void __fastcall timeout_cursor(bool timeout) +void __fastcall timeout_cursor(bool bTimeout) { - if ( timeout ) + if ( bTimeout ) { if ( sgnTimeoutCurs == CURSOR_NONE && !sgbMouseDown ) { diff --git a/Source/diablo.h b/Source/diablo.h index a1cbcaee5..6e86a22d8 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -65,9 +65,9 @@ void __cdecl LoadLvlGFX(); void __cdecl LoadAllGFX(); void __fastcall CreateLevel(int lvldir); void __fastcall LoadGameLevel(bool firstflag, int lvldir); -void __fastcall game_loop(bool startup); +void __fastcall game_loop(bool bStartup); void __cdecl game_logic(); -void __fastcall timeout_cursor(bool timeout); +void __fastcall timeout_cursor(bool bTimeout); void __cdecl diablo_color_cyc_logic(); /* data */ diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 9b0f33ac6..65ccb88ca 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -211,8 +211,8 @@ void __fastcall LoadL1Dungeon(char *sFileName, int vx, int vy) DRLG_L1Pass3(); DRLG_Init_Globals(); DRLG_InitL1Vals(); - SetMapMonsters((char *)v4, 0, 0); - SetMapObjects((char *)v4, 0, 0); + SetMapMonsters(v4, 0, 0); + SetMapObjects(v4, 0, 0); mem_free_dbg(v4); } // 5CF328: using guessed type int dmaxx; diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 0a53453ee..ca529dc6b 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -532,8 +532,8 @@ void __fastcall LoadL2Dungeon(char *sFileName, int vx, int vy) while ( (signed int)v25 < (signed int)dPiece[1] ); ViewX = v30; ViewY = vy; - SetMapMonsters(ptr, 0, 0); - SetMapObjects(ptr, 0, 0); + SetMapMonsters((unsigned char *)ptr, 0, 0); + SetMapObjects((unsigned char *)ptr, 0, 0); mem_free_dbg(ptr); } diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index b448f50e9..0216e1da0 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -2860,8 +2860,8 @@ void __fastcall LoadL3Dungeon(char *sFileName, int vx, int vy) DRLG_Init_Globals(); ViewX = 31; ViewY = 83; - SetMapMonsters(v5, 0, 0); - SetMapObjects(v5, 0, 0); + SetMapMonsters((unsigned char *)v5, 0, 0); + SetMapObjects((unsigned char *)v5, 0, 0); v19 = dPiece; do { diff --git a/Source/dx.cpp b/Source/dx.cpp index 88a65015e..54db8528f 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -72,7 +72,7 @@ void __fastcall dx_init(HWND hWnd) v2 = (GUID *)DDCREATE_EMULATIONONLY; v3 = dx_DirectDrawCreate(v2, &lpDDInterface, NULL); if ( v3 ) - TermDlg(104, v3, "C:\\Src\\Diablo\\Source\\dx.cpp", 149); + ErrDlg(IDD_DIALOG1, v3, "C:\\Src\\Diablo\\Source\\dx.cpp", 149); fullscreen = 1; v4 = lpDDInterface->SetCooperativeLevel(v1, DDSCL_EXCLUSIVE|DDSCL_ALLOWREBOOT|DDSCL_FULLSCREEN); if ( v4 == DDERR_EXCLUSIVEMODEALREADYSET ) @@ -81,7 +81,7 @@ void __fastcall dx_init(HWND hWnd) } else if ( v4 ) { - TermDlg(104, v4, "C:\\Src\\Diablo\\Source\\dx.cpp", 170); + ErrDlg(IDD_DIALOG1, v4, "C:\\Src\\Diablo\\Source\\dx.cpp", 170); } if ( lpDDInterface->SetDisplayMode(640, 480, 8) ) { @@ -89,7 +89,7 @@ void __fastcall dx_init(HWND hWnd) v7 = GetSystemMetrics(SM_CYSCREEN); v8 = lpDDInterface->SetDisplayMode(v6, v7, 8); if ( v8 ) - TermDlg(104, v8, "C:\\Src\\Diablo\\Source\\dx.cpp", 183); + ErrDlg(IDD_DIALOG1, v8, "C:\\Src\\Diablo\\Source\\dx.cpp", 183); } dx_create_primary_surface(); palette_init(); @@ -111,7 +111,7 @@ void __cdecl dx_create_back_buffer() v0 = lpDDSPrimary->GetCaps(&v5); if ( v0 ) - DDErrDlg(v0, 59, "C:\\Src\\Diablo\\Source\\dx.cpp"); + DDErrMsg(v0, 59, "C:\\Src\\Diablo\\Source\\dx.cpp"); if ( !gbBackBuf ) { v4.dwSize = 108; @@ -123,7 +123,7 @@ void __cdecl dx_create_back_buffer() return; } if ( v1 != DDERR_CANTLOCKSURFACE ) - TermDlg(104, v1, "C:\\Src\\Diablo\\Source\\dx.cpp", 81); + ErrDlg(IDD_DIALOG1, v1, "C:\\Src\\Diablo\\Source\\dx.cpp", 81); } memset(&v4, 0, 0x6Cu); v4.dwWidth = 768; @@ -135,10 +135,10 @@ void __cdecl dx_create_back_buffer() v4.ddpfPixelFormat.dwSize = 32; v2 = lpDDSPrimary->GetPixelFormat(&v4.ddpfPixelFormat); if ( v2 ) - TermDlg(104, v2, "C:\\Src\\Diablo\\Source\\dx.cpp", 94); + ErrDlg(IDD_DIALOG1, v2, "C:\\Src\\Diablo\\Source\\dx.cpp", 94); v3 = lpDDInterface->CreateSurface(&v4, &lpDDSBackBuf, NULL); if ( v3 ) - TermDlg(104, v3, "C:\\Src\\Diablo\\Source\\dx.cpp", 96); + ErrDlg(IDD_DIALOG1, v3, "C:\\Src\\Diablo\\Source\\dx.cpp", 96); } // 52A548: using guessed type char gbBackBuf; @@ -153,7 +153,7 @@ void __cdecl dx_create_primary_surface() v1.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; v0 = lpDDInterface->CreateSurface(&v1, &lpDDSPrimary, NULL); if ( v0 ) - TermDlg(104, v0, "C:\\Src\\Diablo\\Source\\dx.cpp", 109); + ErrDlg(IDD_DIALOG1, v0, "C:\\Src\\Diablo\\Source\\dx.cpp", 109); } HRESULT __fastcall dx_DirectDrawCreate(GUID *guid, IDirectDraw **DD, void *unknown) @@ -172,14 +172,14 @@ HRESULT __fastcall dx_DirectDrawCreate(GUID *guid, IDirectDraw **DD, void *unkno if ( !ghDiabMod ) { v4 = GetLastError(); - TermDlg(107, v4, "C:\\Src\\Diablo\\Source\\dx.cpp", 122); + ErrDlg(IDD_DIALOG4, v4, "C:\\Src\\Diablo\\Source\\dx.cpp", 122); } } v5 = GetProcAddress(ghDiabMod, "DirectDrawCreate"); if ( !v5 ) { v6 = GetLastError(); - TermDlg(107, v6, "C:\\Src\\Diablo\\Source\\dx.cpp", 127); + ErrDlg(IDD_DIALOG4, v6, "C:\\Src\\Diablo\\Source\\dx.cpp", 127); } return ((int (__stdcall *)(GUID *, IDirectDraw **, void *))v5)(v8, v3, unknown); } @@ -201,7 +201,7 @@ void __cdecl dx_lock_mutex() v2.dwSize = 108; v1 = lpDDSBackBuf->Lock(NULL, &v2, DDLOCK_WAIT, NULL); if ( v1 ) - DDErrDlg(v1, 235, "C:\\Src\\Diablo\\Source\\dx.cpp"); + DDErrMsg(v1, 235, "C:\\Src\\Diablo\\Source\\dx.cpp"); v0 = (Screen *)v2.lpSurface; screen_buf_end += (int)v2.lpSurface; LABEL_8: @@ -233,7 +233,7 @@ void __cdecl dx_unlock_mutex() { v1 = lpDDSBackBuf->Unlock(NULL); if ( v1 ) - DDErrDlg(v1, 273, "C:\\Src\\Diablo\\Source\\dx.cpp"); + DDErrMsg(v1, 273, "C:\\Src\\Diablo\\Source\\dx.cpp"); } } LeaveCriticalSection(&sgMemCrit); diff --git a/Source/engine.cpp b/Source/engine.cpp index 3ee39578c..ce9ba6560 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -3,7 +3,7 @@ #include "../types.h" int engine_cpp_init_value; // weak -char byte_52B96C; // automap pixel color 8-bit (palette entry) +char gbPixelCol; // automap pixel color 8-bit (palette entry) int dword_52B970; // bool flip - if y < x int orgseed; // weak int sgnWidth; @@ -1488,16 +1488,16 @@ void __fastcall engine_draw_pixel(int x, int y) v2 = (unsigned char *)gpBuffer + screen_y_times_768[y] + x; LABEL_14: if ( (unsigned int)v2 < screen_buf_end ) - *v2 = byte_52B96C; + *v2 = gbPixelCol; return; } } -// 52B96C: using guessed type char byte_52B96C; +// 52B96C: using guessed type char gbPixelCol; // 52B970: using guessed type int dword_52B970; // 52B99C: using guessed type int dword_52B99C; // 69CF0C: using guessed type int screen_buf_end; -void __fastcall engine_draw_automap_pixels(int x1, int y1, int x2, int y2, char a5) +void __fastcall DrawLine(int x0, int y0, int x1, int y1, char col) { int v5; // ST18_4 int v6; // ST2C_4 @@ -1538,28 +1538,28 @@ void __fastcall engine_draw_automap_pixels(int x1, int y1, int x2, int y2, char int v41; // [esp+50h] [ebp-4h] int x2a; // [esp+5Ch] [ebp+8h] - v8 = y1; - v9 = x1; - byte_52B96C = a5; + v8 = y0; + v9 = x0; + gbPixelCol = col; dword_52B99C = 0; + if ( x0 < 64 || x0 >= 704 ) + dword_52B99C = 1; if ( x1 < 64 || x1 >= 704 ) dword_52B99C = 1; - if ( x2 < 64 || x2 >= 704 ) + if ( y0 < 160 || y0 >= 512 ) dword_52B99C = 1; if ( y1 < 160 || y1 >= 512 ) dword_52B99C = 1; - if ( y2 < 160 || y2 >= 512 ) - dword_52B99C = 1; - if ( x2 - x1 < 0 ) + if ( x1 - x0 < 0 ) v36 = -1; else v36 = 1; - v11 = v36 * (x2 - x1); - if ( y2 - y1 < 0 ) + v11 = v36 * (x1 - x0); + if ( y1 - y0 < 0 ) v35 = -1; else v35 = 1; - v10 = v35 * (y2 - y1); + v10 = v35 * (y1 - y0); if ( v35 == v36 ) v12 = 1; else @@ -1570,27 +1570,27 @@ void __fastcall engine_draw_automap_pixels(int x1, int y1, int x2, int y2, char } else { - v8 = y1 ^ x1 ^ y1; - v9 = v8 ^ y1 ^ x1; - x2a = y2 ^ x2; - y2 ^= x2a; - x2 = y2 ^ x2a; + v8 = y0 ^ x0 ^ y0; + v9 = v8 ^ y0 ^ x0; + x2a = y1 ^ x1; + y1 ^= x2a; + x1 = y1 ^ x2a; v5 = v10 ^ v11; v10 ^= v5; v11 = v10 ^ v5; dword_52B970 = 1; } - if ( x2 >= v9 ) + if ( x1 >= v9 ) { x = v9; y = v8; - v32 = x2; - v13 = y2; + v32 = x1; + v13 = y1; } else { - x = x2; - y = y2; + x = x1; + y = y1; v32 = v9; v13 = v8; } @@ -1767,7 +1767,7 @@ void __fastcall engine_draw_automap_pixels(int x1, int y1, int x2, int y2, char } } } -// 52B96C: using guessed type char byte_52B96C; +// 52B96C: using guessed type char gbPixelCol; // 52B970: using guessed type int dword_52B970; // 52B99C: using guessed type int dword_52B99C; @@ -1889,17 +1889,17 @@ void *__fastcall DiabloAllocPtr(int dwBytes) if ( !v2 ) { v3 = GetLastError(); - TermDlg(105, v3, "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2269); + ErrDlg(IDD_DIALOG2, v3, "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2269); } return v2; } -void __fastcall mem_free_dbg(void *ptr) +void __fastcall mem_free_dbg(void *p) { void *v1; // edi - v1 = ptr; - if ( ptr ) + v1 = p; + if ( p ) { EnterCriticalSection(&sgMemCrit); SMemFree(v1, "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2317, 0); diff --git a/Source/engine.h b/Source/engine.h index 72e0ee241..e4383f1ac 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -6,7 +6,7 @@ //pCelBuff->pFrameTable[0] extern int engine_cpp_init_value; // weak -extern char byte_52B96C; // automap pixel color 8-bit (palette entry) +extern char gbPixelCol; // automap pixel color 8-bit (palette entry) extern int dword_52B970; // bool flip - if y < x extern int orgseed; // weak extern int sgnWidth; @@ -41,7 +41,7 @@ void __fastcall CelDecodeClr(char colour, int screen_x, int screen_y, char *pCel void __fastcall CelDrawHdrClrHL(char colour, int screen_x, int screen_y, char *pCelBuff, int frame, int frame_width, int a7, int direction); void __fastcall ENG_set_pixel(int screen_x, int screen_y, char pixel); void __fastcall engine_draw_pixel(int x, int y); -void __fastcall engine_draw_automap_pixels(int x1, int y1, int x2, int y2, char a5); +void __fastcall DrawLine(int x0, int y0, int x1, int y1, char col); int __fastcall GetDirection(int x1, int y1, int x2, int y2); void __fastcall SetRndSeed(int s); int __cdecl GetRndSeed(); @@ -51,7 +51,7 @@ void __cdecl mem_init_mutex(); void __cdecl mem_atexit_mutex(); void __cdecl mem_free_mutex(); void *__fastcall DiabloAllocPtr(int dwBytes); -void __fastcall mem_free_dbg(void *ptr); +void __fastcall mem_free_dbg(void *p); unsigned char *__fastcall LoadFileInMem(char *pszName, int *pdwFileLen); void __fastcall LoadFileWithMem(char *pszName, void *buf); void __fastcall Cl2ApplyTrans(char *p, char *ttbl, int last_frame); diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index f5a9fd8fc..1fceffed8 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -207,7 +207,7 @@ void __cdecl gamemenu_get_color_cycling() void __cdecl gamemenu_get_gamma() { gmenu_slider_3(&sgOptionMenu[2], 15); - gmenu_slider_1(&sgOptionMenu[2], 30, 100, palette_update_gamma(0)); + gmenu_slider_1(&sgOptionMenu[2], 30, 100, UpdateGamma(0)); } void __fastcall gamemenu_music_volume(int a1) @@ -303,7 +303,7 @@ void __fastcall gamemenu_gamma(int a1) if ( a1 ) { - v1 = -(palette_update_gamma(0) != 30); + v1 = -(UpdateGamma(0) != 30); _LOBYTE(v1) = v1 & 0xBA; v2 = v1 + 100; } @@ -311,7 +311,7 @@ void __fastcall gamemenu_gamma(int a1) { v2 = gamemenu_slider_gamma(); } - palette_update_gamma(v2); + UpdateGamma(v2); gamemenu_get_gamma(); } diff --git a/Source/interfac.cpp b/Source/interfac.cpp index a8c88a24c..0c10b2ccc 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -248,7 +248,7 @@ void __cdecl FreeInterface() mem_free_dbg(v0); } -void __fastcall InitCutscene(int interface_mode) +void __fastcall InitCutscene(int uMsg) { int v1; // eax int v2; // eax @@ -265,7 +265,7 @@ void __fastcall InitCutscene(int interface_mode) int v13; // eax int v14; // eax - switch ( interface_mode ) + switch ( uMsg ) { case WM_DIABNEXTLVL: v1 = gnLevelTypeTbl[currlevel]; diff --git a/Source/interfac.h b/Source/interfac.h index 6b6d3ab75..8b362d55b 100644 --- a/Source/interfac.h +++ b/Source/interfac.h @@ -14,7 +14,7 @@ void __cdecl DrawCutscene(); void __fastcall DrawProgress(int screen_x, int screen_y, int progress_id); void __fastcall ShowProgress(int uMsg); void __cdecl FreeInterface(); -void __fastcall InitCutscene(int interface_mode); +void __fastcall InitCutscene(int uMsg); /* data */ diff --git a/Source/items.cpp b/Source/items.cpp index 54b9ff179..6de9257cd 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -651,15 +651,15 @@ void __cdecl InitItemGFX() memset(UniqueItemFlag, 0, 0x200u); } -bool __fastcall ItemPlace(int x, int y) +bool __fastcall ItemPlace(int xp, int yp) { int v2; // ecx int v3; // eax bool result; // al - v2 = x; - v3 = v2 * 112 + y; - if ( dMonster[0][v3] || dPlayer[v2][y] || dItem[v2][y] || dObject[v2][y] || dFlags[v2][y] & 8 ) + v2 = xp; + v3 = v2 * 112 + yp; + if ( dMonster[0][v3] || dPlayer[v2][yp] || dItem[v2][yp] || dObject[v2][yp] || dFlags[v2][yp] & 8 ) result = 0; else result = nSolidTable[dPiece[0][v3]] == 0; diff --git a/Source/items.h b/Source/items.h index 14f179686..ee2854d27 100644 --- a/Source/items.h +++ b/Source/items.h @@ -16,7 +16,7 @@ extern int numitems; extern int gnNumGetRecords; void __cdecl InitItemGFX(); -bool __fastcall ItemPlace(int x, int y); +bool __fastcall ItemPlace(int xp, int yp); void __cdecl AddInitItems(); void __cdecl InitItems(); void __fastcall CalcPlrItemVals(int p, bool Loadgfx); diff --git a/Source/monster.cpp b/Source/monster.cpp index 5f2622ba5..e5dc641a9 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1337,31 +1337,31 @@ void __cdecl PlaceQuestMonsters() if ( QuestStatus(7) ) { setp = LoadFileInMem("Levels\\L1Data\\Banner1.DUN", 0); - SetMapMonsters((char *)setp, 2 * setpc_x, 2 * setpc_y); + SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } if ( QuestStatus(9) ) { setp = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", 0); - SetMapMonsters((char *)setp, 2 * setpc_x, 2 * setpc_y); + SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } if ( QuestStatus(8) ) { setp = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", 0); - SetMapMonsters((char *)setp, 2 * setpc_x, 2 * setpc_y); + SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } if ( QuestStatus(10) ) { setp = LoadFileInMem("Levels\\L3Data\\Anvil.DUN", 0); - SetMapMonsters((char *)setp, 2 * setpc_x + 2, 2 * setpc_y + 2); + SetMapMonsters(setp, 2 * setpc_x + 2, 2 * setpc_y + 2); mem_free_dbg(setp); } if ( QuestStatus(11) ) { setp = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", 0); - SetMapMonsters((char *)setp, 2 * setpc_x, 2 * setpc_y); + SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); AddMonsterType((char)UniqMonst[8].mtype, 1); } @@ -1377,7 +1377,7 @@ void __cdecl PlaceQuestMonsters() PlaceUniqueMonst(5, 0, 0); PlaceUniqueMonst(6, 0, 0); setp = LoadFileInMem("Levels\\L4Data\\Vile1.DUN", 0); - SetMapMonsters((char *)setp, 2 * setpc_x, 2 * setpc_y); + SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } } @@ -1522,16 +1522,16 @@ void __cdecl LoadDiabMonsts() unsigned char *lpSetPiece; // esi lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab1.DUN", 0); - SetMapMonsters((char *)lpSetPiece, 2 * diabquad1x, 2 * diabquad1y); + SetMapMonsters(lpSetPiece, 2 * diabquad1x, 2 * diabquad1y); mem_free_dbg(lpSetPiece); lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", 0); - SetMapMonsters((char *)lpSetPiece, 2 * diabquad2x, 2 * diabquad2y); + SetMapMonsters(lpSetPiece, 2 * diabquad2x, 2 * diabquad2y); mem_free_dbg(lpSetPiece); lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", 0); - SetMapMonsters((char *)lpSetPiece, 2 * diabquad3x, 2 * diabquad3y); + SetMapMonsters(lpSetPiece, 2 * diabquad3x, 2 * diabquad3y); mem_free_dbg(lpSetPiece); lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4a.DUN", 0); - SetMapMonsters((char *)lpSetPiece, 2 * diabquad4x, 2 * diabquad4y); + SetMapMonsters(lpSetPiece, 2 * diabquad4x, 2 * diabquad4y); mem_free_dbg(lpSetPiece); } // 5289C4: using guessed type int diabquad1x; @@ -1777,20 +1777,20 @@ LABEL_23: } } -void __fastcall SetMapMonsters(char *pMap, int startx, int starty) +void __fastcall SetMapMonsters(unsigned char *pMap, int startx, int starty) { - char *v3; // esi + unsigned char *v3; // esi unsigned short v4; // cx int v5; // edx int v6; // edi int v7; // ecx - char *v8; // edx + unsigned char *v8; // edx int i; // esi int v10; // eax int v11; // ecx int v12; // [esp+Ch] [ebp-Ch] int v13; // [esp+10h] [ebp-8h] - char *v14; // [esp+14h] [ebp-4h] + unsigned char *v14; // [esp+14h] [ebp-4h] int startya; // [esp+20h] [ebp+8h] v12 = startx; @@ -2191,7 +2191,7 @@ void __fastcall M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, int E M_CheckEFlag(v6); } -void __fastcall M_StartWalk2(int i, int xvel, int yvel, int a4, int a5, int a6, int a7, int EndDir) +void __fastcall M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int EndDir) { int v8; // esi int v9; // edx @@ -2207,7 +2207,7 @@ void __fastcall M_StartWalk2(int i, int xvel, int yvel, int a4, int a5, int a6, v15 = xvel; ia = i; v8 = i; - v9 = a6 + monster[i]._mx; + v9 = xadd + monster[i]._mx; EndDira = monster[i]._mx; v10 = monster[i]._my; v11 = monster[v8]._my; @@ -2215,7 +2215,7 @@ void __fastcall M_StartWalk2(int i, int xvel, int yvel, int a4, int a5, int a6, dMonster[0][v10 + 112 * EndDira] = -1 - ia; monster[v8]._mVar1 = EndDira; monster[v8]._moldx = EndDira; - v12 = a7 + v11; + v12 = yadd + v11; monster[v8]._moldy = v10; v13 = monster[v8]._uniqtype == 0; monster[v8]._mx = v9; @@ -2228,19 +2228,19 @@ void __fastcall M_StartWalk2(int i, int xvel, int yvel, int a4, int a5, int a6, v14 = monster[v8].MType; monster[v8]._mxvel = v15; monster[v8]._myvel = yvel; - monster[v8]._mxoff = a4; - monster[v8]._myoff = a5; + monster[v8]._mxoff = xoff; + monster[v8]._myoff = yoff; monster[v8]._mmode = MM_WALK2; monster[v8]._mVar3 = EndDir; monster[v8]._mdir = EndDir; NewMonsterAnim(ia, &v14->Anims[1], EndDir); monster[v8]._mVar8 = 0; - monster[v8]._mVar6 = 16 * a4; - monster[v8]._mVar7 = 16 * a5; + monster[v8]._mVar6 = 16 * xoff; + monster[v8]._mVar7 = 16 * yoff; M_CheckEFlag(ia); } -void __fastcall M_StartWalk3(int i, int xvel, int yvel, int a4, int a5, int a6, int a7, int a8, int a9, int EndDir) +void __fastcall M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, int EndDir) { int v10; // esi int v11; // ebx @@ -2259,10 +2259,10 @@ void __fastcall M_StartWalk3(int i, int xvel, int yvel, int a4, int a5, int a6, v11 = monster[i]._my; v12 = monster[i]._mx; v17 = xvel; - a6a = v12 + a6; - a7a = v11 + a7; - v13 = a8 + v12; - v14 = a9 + v11; + a6a = v12 + xadd; + a7a = v11 + yadd; + v13 = mapx + v12; + v14 = mapy + v11; if ( monster[i]._uniqtype ) ChangeLightXY((unsigned char)monster[v10].mlid, v13, v14); v15 = monster[v10]._my + 112 * monster[v10]._mx; @@ -2280,15 +2280,15 @@ void __fastcall M_StartWalk3(int i, int xvel, int yvel, int a4, int a5, int a6, monster[v10]._mfuty = a7a; monster[v10]._mVar1 = a6a; monster[v10]._mVar2 = a7a; - monster[v10]._mxoff = a4; - monster[v10]._myoff = a5; + monster[v10]._mxoff = xoff; + monster[v10]._myoff = yoff; monster[v10]._mmode = MM_WALK3; monster[v10]._mVar3 = EndDir; monster[v10]._mdir = EndDir; NewMonsterAnim(ia, &v16->Anims[1], EndDir); monster[v10]._mVar8 = 0; - monster[v10]._mVar6 = 16 * a4; - monster[v10]._mVar7 = 16 * a5; + monster[v10]._mVar6 = 16 * xoff; + monster[v10]._mVar7 = 16 * yoff; M_CheckEFlag(ia); } diff --git a/Source/monster.h b/Source/monster.h index 63a418842..b3cb8abab 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -33,7 +33,7 @@ void __fastcall PlaceGroup(int mtype, int num, unsigned char leaderf, int leader void __cdecl LoadDiabMonsts(); void __cdecl InitMonsters(); void __cdecl PlaceUniques(); -void __fastcall SetMapMonsters(char *pMap, int startx, int starty); +void __fastcall SetMapMonsters(unsigned char *pMap, int startx, int starty); void __fastcall DeleteMonster(int i); int __fastcall AddMonster(int x, int y, int dir, int mtype, int InMap); void __fastcall NewMonsterAnim(int i, AnimStruct *anim, int md); @@ -46,8 +46,8 @@ void __fastcall M_StartStand(int i, int md); void __fastcall M_StartDelay(int i, int len); void __fastcall M_StartSpStand(int i, int md); void __fastcall M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, int EndDir); -void __fastcall M_StartWalk2(int i, int xvel, int yvel, int a4, int a5, int a6, int a7, int EndDir); -void __fastcall M_StartWalk3(int i, int xvel, int yvel, int a4, int a5, int a6, int a7, int a8, int a9, int EndDir); +void __fastcall M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int EndDir); +void __fastcall M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, int EndDir); void __fastcall M_StartAttack(int i); void __fastcall M_StartRAttack(int i, int missile_type, int dam); void __fastcall M_StartRSpAttack(int i, int missile_type, int dam); diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index f1b3303e8..c27728096 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -164,13 +164,13 @@ void __fastcall mpqapi_remove_hash_entry(char *pszName) v4 = v3->offset; v5 = v3->sizealloc; memset(v3, 0, 0x10u); - mpqapi_alloc_block(v4, v5); + mpqapi_free_block(v4, v5); save_archive_modified = 1; } } // 65AB0C: using guessed type int save_archive_modified; -void __fastcall mpqapi_alloc_block(int block_offset, int block_size) +void __fastcall mpqapi_free_block(int block_offset, int block_size) { int v2; // esi int v3; // edi @@ -470,7 +470,7 @@ LABEL_25: { v15 = destsize + v9->offset; v9->sizealloc = destsize; - mpqapi_alloc_block(v15, v14); + mpqapi_free_block(v15, v14); } } return 1; diff --git a/Source/mpqapi.h b/Source/mpqapi.h index 6688a03a1..b8d6cb6b6 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -18,7 +18,7 @@ void __fastcall mpqapi_xor_buf(char *pbData); bool __fastcall mpqapi_reg_store_modification_time(char *pbData, int dwLen); _BLOCKENTRY *__fastcall j_mpqapi_remove_hash_entry(char *pszName); void __fastcall mpqapi_remove_hash_entry(char *pszName); -void __fastcall mpqapi_alloc_block(int block_offset, int block_size); +void __fastcall mpqapi_free_block(int block_offset, int block_size); _BLOCKENTRY *__fastcall mpqapi_new_block(int *block_index); int __fastcall mpqapi_get_hash_index_of_path(char *pszName); int __fastcall mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale); diff --git a/Source/msg.cpp b/Source/msg.cpp index a20d3ed5c..db1b85f3f 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -535,14 +535,14 @@ void __fastcall delta_leave_sync(unsigned char bLevel) // 67618C: using guessed type char sgbDeltaChanged; // 679660: using guessed type char gbMaxPlayers; -bool __fastcall delta_portal_inited(int portal_num) +bool __fastcall delta_portal_inited(int i) { - return sgJunk[0].portal[portal_num].x == -1; + return sgJunk[0].portal[i].x == -1; } -bool __fastcall delta_quest_inited(int quest_num) +bool __fastcall delta_quest_inited(int i) { - return sgJunk[0].quests[quest_num].qstate != -1; + return sgJunk[0].quests[i].qstate != -1; } void __fastcall DeltaAddItem(int ii) diff --git a/Source/msg.h b/Source/msg.h index b7cbc2867..e3501b239 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -42,8 +42,8 @@ void __fastcall delta_monster_hp(int mi, int hp, unsigned char bLevel); void __fastcall delta_sync_monster(TCmdLocParam1 *packet, char level); void __fastcall delta_sync_golem(TCmdGolem *pG, int pnum, int bLevel); void __fastcall delta_leave_sync(unsigned char bLevel); -bool __fastcall delta_portal_inited(int portal_num); -bool __fastcall delta_quest_inited(int quest_num); +bool __fastcall delta_portal_inited(int i); +bool __fastcall delta_quest_inited(int i); void __fastcall DeltaAddItem(int ii); void __cdecl DeltaSaveLevel(); void __cdecl DeltaLoadLevel(); diff --git a/Source/objects.cpp b/Source/objects.cpp index b47b5aa4c..4f03e47d2 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1466,7 +1466,7 @@ void __cdecl AddLazStand() AddObject(OBJ_STORYCANDLE, v4, v1 + 1); } -void __fastcall InitObjects(int a1) +void __cdecl InitObjects() { //int v1; // eax //int v2; // eax @@ -1483,9 +1483,8 @@ void __fastcall InitObjects(int a1) char v13; // al unsigned char *v14; // esi //int v15; // eax - int v16; // [esp+0h] [ebp-4h] + //int v16; // [esp+0h] [ebp-4h] - v16 = a1; ClrAllObjects(); if ( currlevel == 16 ) { @@ -1543,8 +1542,6 @@ void __fastcall InitObjects(int a1) else { v8 = QUEST_MBLINDING; - if ( v7 != 2 ) - v8 = v16; } } else @@ -1557,10 +1554,6 @@ void __fastcall InitObjects(int a1) LoadMapObjs(v9, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(v9); } - else - { - v8 = v16; - } //_LOBYTE(v10) = QuestStatus(9); if ( QuestStatus(9) ) { @@ -1586,10 +1579,6 @@ void __fastcall InitObjects(int a1) } InitRndBarrels(); } - else - { - v8 = v16; - } if ( leveltype == DTYPE_CAVES ) { AddL3Objs(0, 0, 112, 112); @@ -1644,9 +1633,9 @@ void __fastcall InitObjects(int a1) // 679660: using guessed type char gbMaxPlayers; // 67D7C0: using guessed type int InitObjFlag; -void __fastcall SetMapObjects(char *pMap, int startx, int starty) +void __fastcall SetMapObjects(unsigned char *pMap, int startx, int starty) { - char *v3; // esi + unsigned char *v3; // esi int v6; // edi int v7; // eax int v8; // esi diff --git a/Source/objects.h b/Source/objects.h index f7ac3988e..03a5c6d9d 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -40,8 +40,8 @@ void __cdecl AddStoryBooks(); void __fastcall AddHookedBodies(int freq); void __cdecl AddL4Goodies(); void __cdecl AddLazStand(); -void __fastcall InitObjects(int a1); -void __fastcall SetMapObjects(char *pMap, int startx, int starty); +void __cdecl InitObjects(); +void __fastcall SetMapObjects(unsigned char *pMap, int startx, int starty); void __fastcall DeleteObject(int oi, int i); void __fastcall SetupObject(int i, int x, int y, int ot); void __fastcall SetObjMapRange(int i, int x1, int y1, int x2, int y2, int v); diff --git a/Source/palette.cpp b/Source/palette.cpp index c98199a15..fdabea5c0 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -26,7 +26,7 @@ struct palette_cpp_init // 47F16C: using guessed type int palette_inf; // 67DBCC: using guessed type int palette_cpp_init_value; -void __cdecl palette_save_gamme() +void __cdecl SaveGamma() { SRegSaveValue("Diablo", "Gamma Correction", 0, gamma_correction); SRegSaveValue("Diablo", "Color Cycling", 0, color_cycling_enabled); @@ -37,18 +37,18 @@ void __cdecl palette_init() int v0; // eax int v1; // eax - palette_load_gamma(); + LoadGamma(); memcpy(system_palette, orig_palette, 0x400u); LoadSysPal(); v0 = lpDDInterface->CreatePalette(DDPCAPS_ALLOW256|DDPCAPS_8BIT, system_palette, &lpDDPalette, NULL); if ( v0 ) - TermDlg(111, v0, "C:\\Src\\Diablo\\Source\\PALETTE.CPP", 143); + ErrDlg(IDD_DIALOG8, v0, "C:\\Src\\Diablo\\Source\\PALETTE.CPP", 143); v1 = lpDDSPrimary->SetPalette(lpDDPalette); if ( v1 ) - TermDlg(111, v1, "C:\\Src\\Diablo\\Source\\PALETTE.CPP", 146); + ErrDlg(IDD_DIALOG8, v1, "C:\\Src\\Diablo\\Source\\PALETTE.CPP", 146); } -void __cdecl palette_load_gamma() +void __cdecl LoadGamma() { int v3; // eax int value; // [esp+8h] [ebp-4h] @@ -147,14 +147,14 @@ void __cdecl ResetPal() } } -void __cdecl palette_inc_gamma() +void __cdecl IncreaseGamma() { if ( gamma_correction < 100 ) { gamma_correction += 5; if ( gamma_correction > 100 ) gamma_correction = 100; - palette_apply_gamma_correction(system_palette, logical_palette, 256); + ApplyGamma(system_palette, logical_palette, 256); palette_update(); } } @@ -178,7 +178,7 @@ void __cdecl palette_update() } // 484364: using guessed type int fullscreen; -void __fastcall palette_apply_gamma_correction(PALETTEENTRY *dst, PALETTEENTRY *src, int n) +void __fastcall ApplyGamma(PALETTEENTRY *dst, PALETTEENTRY *src, int n) { PALETTEENTRY *v3; // edi PALETTEENTRY *v4; // esi @@ -202,24 +202,24 @@ void __fastcall palette_apply_gamma_correction(PALETTEENTRY *dst, PALETTEENTRY * } } -void __cdecl palette_dec_gamma() +void __cdecl DecreaseGamma() { if ( gamma_correction > 30 ) { gamma_correction -= 5; if ( gamma_correction < 30 ) gamma_correction = 30; - palette_apply_gamma_correction(system_palette, logical_palette, 256); + ApplyGamma(system_palette, logical_palette, 256); palette_update(); } } -int __fastcall palette_update_gamma(int gamma) +int __fastcall UpdateGamma(int gamma) { if ( gamma ) { gamma_correction = 130 - gamma; - palette_apply_gamma_correction(system_palette, logical_palette, 256); + ApplyGamma(system_palette, logical_palette, 256); palette_update(); } return 130 - gamma_correction; @@ -252,7 +252,7 @@ void __fastcall PaletteFadeIn(int fr) { int i; // ebp - palette_apply_gamma_correction(logical_palette, orig_palette, 256); + ApplyGamma(logical_palette, orig_palette, 256); for(i = 0; i < 256; i += fr) SetFadeLevel(i); @@ -308,7 +308,7 @@ void __fastcall palette_update_quest_palette(int n) for ( i = 32 - n; i >= 0; --i ) logical_palette[i] = orig_palette[i]; - palette_apply_gamma_correction(system_palette, logical_palette, 32); + ApplyGamma(system_palette, logical_palette, 32); palette_update(); } diff --git a/Source/palette.h b/Source/palette.h index acf28161e..de8f09935 100644 --- a/Source/palette.h +++ b/Source/palette.h @@ -9,20 +9,20 @@ extern PALETTEENTRY orig_palette[256]; extern UINT gdwPalEntries; void __cdecl palette_cpp_init(); -void __cdecl palette_save_gamme(); +void __cdecl SaveGamma(); void __cdecl palette_init(); -void __cdecl palette_load_gamma(); +void __cdecl LoadGamma(); void __cdecl LoadSysPal(); void __fastcall LoadPalette(char *pszFileName); void __fastcall LoadRndLvlPal(int l); void __cdecl ResetPal(); -void __cdecl palette_inc_gamma(); +void __cdecl IncreaseGamma(); void __cdecl palette_update(); -void __fastcall palette_apply_gamma_correction(PALETTEENTRY *dst, PALETTEENTRY *src, int n); -void __cdecl palette_dec_gamma(); -int __fastcall palette_update_gamma(int gamma); +void __fastcall ApplyGamma(PALETTEENTRY *dst, PALETTEENTRY *src, int n); +void __cdecl DecreaseGamma(); +int __fastcall UpdateGamma(int gamma); void __cdecl BlackPalette(); -void __fastcall SetFadeLevel(int brightness); +void __fastcall SetFadeLevel(int fadeval); void __fastcall PaletteFadeIn(int fr); void __fastcall PaletteFadeOut(int fr); void __cdecl palette_update_caves(); diff --git a/Source/portal.cpp b/Source/portal.cpp index accdfbe96..6633bd33c 100644 --- a/Source/portal.cpp +++ b/Source/portal.cpp @@ -196,12 +196,12 @@ void __cdecl GetPortalLvlPos() } } -bool __fastcall PosOkPortal(int level, int x, int y) +bool __fastcall PosOkPortal(int lvl, int x, int y) { int *v3; // eax v3 = &portal[0].x; - while ( !*(v3 - 1) || v3[2] != level || (*v3 != x || v3[1] != y) && (*v3 != x - 1 || v3[1] != y - 1) ) + while ( !*(v3 - 1) || v3[2] != lvl || (*v3 != x || v3[1] != y) && (*v3 != x - 1 || v3[1] != y - 1) ) { v3 += 6; if ( (signed int)v3 >= (signed int)&portal[4].x ) diff --git a/Source/portal.h b/Source/portal.h index eb14e5d7d..b22956aa6 100644 --- a/Source/portal.h +++ b/Source/portal.h @@ -18,7 +18,7 @@ void __fastcall RemovePortalMissile(int id); void __fastcall SetCurrentPortal(int p); void __cdecl GetPortalLevel(); void __cdecl GetPortalLvlPos(); -bool __fastcall PosOkPortal(int level, int x, int y); +bool __fastcall PosOkPortal(int lvl, int x, int y); /* rdata */ extern int WarpDropX[4]; diff --git a/Source/quests.cpp b/Source/quests.cpp index 93dd76f6d..710cbb7b2 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -557,16 +557,16 @@ void __cdecl DrawButcher() DRLG_RectTrans(2 * setpc_x + 19, 2 * setpc_y + 19, 2 * setpc_x + 26, 2 * setpc_y + 26); } -void __fastcall DrawSkelKing(int quest_id, int xx, int yy) +void __fastcall DrawSkelKing(int q, int x, int y) { int v3; // eax - v3 = quest_id; - quests[v3]._qtx = 2 * xx + 28; - quests[v3]._qty = 2 * yy + 23; + v3 = q; + quests[v3]._qtx = 2 * x + 28; + quests[v3]._qty = 2 * y + 23; } -void __fastcall DrawWarLord(int xx, int yy) +void __fastcall DrawWarLord(int x, int y) { int v2; // esi int v3; // edi @@ -582,8 +582,8 @@ void __fastcall DrawWarLord(int xx, int yy) int v13; // [esp+10h] [ebp-8h] int v14; // [esp+14h] [ebp-4h] - v2 = yy; - v3 = xx; + v2 = y; + v3 = x; v4 = LoadFileInMem("Levels\\L4Data\\Warlord2.DUN", 0); v5 = *v4; ptr = v4; @@ -626,7 +626,7 @@ void __fastcall DrawWarLord(int xx, int yy) // 5CF330: using guessed type int setpc_h; // 5CF334: using guessed type int setpc_w; -void __fastcall DrawSChamber(int quest_id, int xx, int yy) +void __fastcall DrawSChamber(int q, int x, int y) { int v3; // esi unsigned char *v4; // eax @@ -643,20 +643,20 @@ void __fastcall DrawSChamber(int quest_id, int xx, int yy) int v15; // [esp+14h] [ebp-8h] int v16; // [esp+18h] [ebp-4h] - v3 = xx; - v14 = quest_id; + v3 = x; + v14 = q; v4 = LoadFileInMem("Levels\\L2Data\\Bonestr1.DUN", 0); - v5 = yy; + v5 = y; ptr = v4; - v6 = yy; + v6 = y; v7 = *v4; setpc_h = ptr[2]; v8 = (char *)(ptr + 4); setpc_w = v7; setpc_x = v3; - setpc_y = yy; - v15 = yy + setpc_h; - if ( yy < yy + setpc_h ) + setpc_y = y; + v15 = y + setpc_h; + if ( y < y + setpc_h ) { v16 = v3 + v7; do @@ -677,9 +677,9 @@ void __fastcall DrawSChamber(int quest_id, int xx, int yy) } while ( v9 ); } - v6 = yy++ + 1; + v6 = y++ + 1; } - while ( yy < v15 ); + while ( y < v15 ); } v12 = v14; quests[v12]._qtx = 2 * v3 + 22; @@ -689,7 +689,7 @@ void __fastcall DrawSChamber(int quest_id, int xx, int yy) // 5CF330: using guessed type int setpc_h; // 5CF334: using guessed type int setpc_w; -void __fastcall DrawLTBanner(int xx, int yy) +void __fastcall DrawLTBanner(int x, int y) { int v2; // ebx int v3; // esi @@ -705,9 +705,9 @@ void __fastcall DrawLTBanner(int xx, int yy) int v13; // [esp+14h] [ebp-8h] int v14; // [esp+18h] [ebp-4h] - v2 = yy; - v3 = xx; - v12 = yy; + v2 = y; + v3 = x; + v12 = y; v4 = LoadFileInMem("Levels\\L1Data\\Banner1.DUN", 0); v5 = v4; v14 = 0; @@ -748,7 +748,7 @@ void __fastcall DrawLTBanner(int xx, int yy) // 5CF330: using guessed type int setpc_h; // 5CF334: using guessed type int setpc_w; -void __fastcall DrawBlind(int xx, int yy) +void __fastcall DrawBlind(int x, int y) { int v2; // ebx int v3; // esi @@ -764,9 +764,9 @@ void __fastcall DrawBlind(int xx, int yy) int v13; // [esp+14h] [ebp-8h] int v14; // [esp+18h] [ebp-4h] - v2 = yy; - v3 = xx; - v12 = yy; + v2 = y; + v3 = x; + v12 = y; v4 = LoadFileInMem("Levels\\L2Data\\Blind1.DUN", 0); v5 = v4; v14 = 0; @@ -807,7 +807,7 @@ void __fastcall DrawBlind(int xx, int yy) // 5CF330: using guessed type int setpc_h; // 5CF334: using guessed type int setpc_w; -void __fastcall DrawBlood(int xx, int yy) +void __fastcall DrawBlood(int x, int y) { int v2; // ebx int v3; // esi @@ -823,9 +823,9 @@ void __fastcall DrawBlood(int xx, int yy) int v13; // [esp+14h] [ebp-8h] int v14; // [esp+18h] [ebp-4h] - v2 = yy; - v3 = xx; - v12 = yy; + v2 = y; + v3 = x; + v12 = y; v4 = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", 0); v5 = v4; v14 = 0; @@ -866,7 +866,7 @@ void __fastcall DrawBlood(int xx, int yy) // 5CF330: using guessed type int setpc_h; // 5CF334: using guessed type int setpc_w; -void __fastcall DRLG_CheckQuests(int xx, int yy) +void __fastcall DRLG_CheckQuests(int x, int y) { int v2; // esi int v3; // edi @@ -874,8 +874,8 @@ void __fastcall DRLG_CheckQuests(int xx, int yy) unsigned char *v5; // ebp //int v6; // eax - v2 = yy; - v3 = xx; + v2 = y; + v3 = x; v4 = 0; v5 = &quests[0]._qtype; do diff --git a/Source/quests.h b/Source/quests.h index 51b26d2b8..6bacbbd3f 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -22,13 +22,13 @@ bool __cdecl ForceQuests(); bool __fastcall QuestStatus(int i); void __fastcall CheckQuestKill(int m, unsigned char sendmsg); void __cdecl DrawButcher(); -void __fastcall DrawSkelKing(int quest_id, int xx, int yy); -void __fastcall DrawWarLord(int xx, int yy); -void __fastcall DrawSChamber(int quest_id, int xx, int yy); -void __fastcall DrawLTBanner(int xx, int yy); -void __fastcall DrawBlind(int xx, int yy); -void __fastcall DrawBlood(int xx, int yy); -void __fastcall DRLG_CheckQuests(int xx, int yy); +void __fastcall DrawSkelKing(int q, int x, int y); +void __fastcall DrawWarLord(int x, int y); +void __fastcall DrawSChamber(int q, int x, int y); +void __fastcall DrawLTBanner(int x, int y); +void __fastcall DrawBlind(int x, int y); +void __fastcall DrawBlood(int x, int y); +void __fastcall DRLG_CheckQuests(int x, int y); void __cdecl SetReturnLvlPos(); void __cdecl GetReturnLvlPos(); void __cdecl ResyncMPQuests(); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 817cbcf99..9bda4cde2 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -3175,7 +3175,7 @@ LABEL_8: LABEL_17: if ( v8 != DDERR_SURFACELOST && v8 != DDERR_WASSTILLDRAWING && v8 != DDERR_SURFACEBUSY ) { - DDErrDlg(v8, 3707, "C:\\Src\\Diablo\\Source\\SCROLLRT.CPP"); + DDErrMsg(v8, 3707, "C:\\Src\\Diablo\\Source\\SCROLLRT.CPP"); break; } return; @@ -3218,7 +3218,7 @@ LABEL_17: if ( v9 != DDERR_SURFACELOST ) { if ( v9 ) - DDErrDlg(v9, 3779, "C:\\Src\\Diablo\\Source\\SCROLLRT.CPP"); + DDErrMsg(v9, 3779, "C:\\Src\\Diablo\\Source\\SCROLLRT.CPP"); } } #ifdef _DEBUG @@ -3300,7 +3300,7 @@ void __fastcall DoBlitScreen(int dwX, int dwY, int dwWdt, int dwHgt) continue; } if ( error_code != DDERR_SURFACELOST && error_code != DDERR_WASSTILLDRAWING && error_code != DDERR_SURFACEBUSY ) - DDErrDlg(error_code, 3596, "C:\\Src\\Diablo\\Source\\SCROLLRT.CPP"); + DDErrMsg(error_code, 3596, "C:\\Src\\Diablo\\Source\\SCROLLRT.CPP"); return; } } diff --git a/Source/sound.cpp b/Source/sound.cpp index 814f38a3c..7142b3280 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -142,7 +142,7 @@ void __fastcall snd_play_snd(TSnd *pSnd, int lVolume, int lPan) } else if ( v8 ) { - DSErrDlg(v8, 261, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); + DSErrMsg(v8, 261, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); } v3->start_tc = v10; } @@ -242,11 +242,11 @@ TSnd *__fastcall sound_file_load(char *path) sound_CreateSoundBuffer(v4); v5 = v4->DSB->Lock(0, v4->len, &aptr1, &asize1, &aptr2, &asize2, 0); //v7); if ( v5 ) - DSErrDlg(v5, 318, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); + DSErrMsg(v5, 318, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); memcpy(aptr1, (char *)ptr + v4->offset, asize1); v6 = v4->DSB->Unlock(aptr1, asize1, aptr2, asize2); if ( v6 ) - DSErrDlg(v6, 325, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); + DSErrMsg(v6, 325, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); mem_free_dbg(ptr); WCloseFile(a1); return v4; @@ -267,7 +267,7 @@ void __fastcall sound_CreateSoundBuffer(TSnd *sound_file) v3.dwFlags = DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN|DSBCAPS_STATIC; v2 = sglpDS->CreateSoundBuffer(&v3, &v1->DSB, NULL); if ( v2 ) - DSErrDlg(v2, 282, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); + DSErrMsg(v2, 282, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); } void __fastcall sound_file_cleanup(TSnd *sound_file) @@ -350,14 +350,14 @@ void __fastcall sound_create_primary_buffer(int music_track) v4.dwFlags = DSBCAPS_PRIMARYBUFFER; v1 = sglpDS->CreateSoundBuffer(&v4, &sglpDSB, NULL); if ( v1 ) - DSErrDlg(v1, 375, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); + DSErrMsg(v1, 375, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); } if ( sglpDSB ) { v3.dwSize = 96; v2 = sglpDS->GetCaps(&v3); if ( v2 ) - DSErrDlg(v2, 383, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); + DSErrMsg(v2, 383, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); if ( !a1 || !LoadWaveFormat((HANDLE)a1, &a2) ) { memset(&a2, 0, 0x12u); @@ -390,14 +390,14 @@ int __fastcall sound_DirectSoundCreate(GUID *guid, IDirectSound **DS, int always if ( !hDsound_dll ) { v4 = GetLastError(); - TermDlg(108, v4, "C:\\Src\\Diablo\\Source\\SOUND.CPP", 422); + ErrDlg(IDD_DIALOG5, v4, "C:\\Src\\Diablo\\Source\\SOUND.CPP", 422); } } v5 = GetProcAddress(hDsound_dll, "DirectSoundCreate"); if ( !v5 ) { v6 = GetLastError(); - TermDlg(108, v6, "C:\\Src\\Diablo\\Source\\SOUND.CPP", 427); + ErrDlg(IDD_DIALOG5, v6, "C:\\Src\\Diablo\\Source\\SOUND.CPP", 427); } return ((int (__stdcall *)(GUID *, IDirectSound **, int))v5)(v8, v3, always_null); } diff --git a/Source/stores.cpp b/Source/stores.cpp index 373f82b96..6ed402f08 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -357,7 +357,7 @@ void __fastcall DrawSLine(int y) } // 6A09E0: using guessed type char stextsize; -void __fastcall DrawSArrows(int a1, int a2) +void __fastcall DrawSArrows(int y1, int y2) { int *v2; // ebp int v3; // ebx @@ -366,9 +366,9 @@ void __fastcall DrawSArrows(int a1, int a2) int v6; // eax int v7; // eax - v2 = &SStringY[a2]; - v3 = a1; - v4 = SStringY[a1] + 204; + v2 = &SStringY[y2]; + v3 = y1; + v4 = SStringY[y1] + 204; v5 = *v2 + 204; if ( stextscrlubtn == -1 ) CelDecodeOnly(665, v4, pSTextSlidCels, 10, 12); diff --git a/Source/stores.h b/Source/stores.h index 8590e5039..16b0c0fd2 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -42,7 +42,7 @@ void __cdecl FreeStoreMem(); void __cdecl DrawSTextBack(); void __fastcall PrintSString(int x, int y, unsigned char cjustflag, char *str, int col, int val); void __fastcall DrawSLine(int y); -void __fastcall DrawSArrows(int a1, int a2); +void __fastcall DrawSArrows(int y1, int y2); void __cdecl DrawSTextHelp(); void __fastcall ClearSText(int s, int e); void __fastcall AddSLine(int y); diff --git a/Source/themes.cpp b/Source/themes.cpp index 543ae82f6..622468277 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -251,19 +251,19 @@ bool __fastcall TFit_Obj3(int t) { int yp; // edi int xp; // esi - char objrnd[5]; // [esp+Bh] [ebp-5h] + char objrnd[4]; // [esp+Bh] [ebp-5h] + objrnd[0] = 4; objrnd[1] = 4; - objrnd[2] = 4; - objrnd[3] = 3; - objrnd[4] = 5; + objrnd[2] = 3; + objrnd[3] = 5; yp = 1; while ( 2 ) { xp = 1; do { - if ( CheckThemeObj3(xp, yp, t, objrnd[leveltype]) ) + if ( CheckThemeObj3(xp, yp, t, objrnd[leveltype-1]) ) { themex = xp; themey = yp; @@ -749,17 +749,17 @@ void __fastcall Theme_Barrel(int t) int yp; // edi int xp; // ebx int r; - char monstrnd[5]; - char barrnd[5]; - - barrnd[1] = 2; - barrnd[2] = 6; - barrnd[3] = 4; - barrnd[4] = 8; - monstrnd[1] = 5; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + char monstrnd[4]; + char barrnd[4]; + + barrnd[0] = 2; + barrnd[1] = 6; + barrnd[2] = 4; + barrnd[3] = 8; + monstrnd[0] = 5; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; for(yp = 0; yp < 112; yp++) { @@ -767,27 +767,27 @@ void __fastcall Theme_Barrel(int t) { if ( dung_map[xp][yp] == themes[t].ttval && !nSolidTable[dPiece[xp][yp]] ) { - if ( !random(0, barrnd[leveltype]) ) + if ( !random(0, barrnd[leveltype-1]) ) { - r = random(0, barrnd[leveltype]); + r = random(0, barrnd[leveltype-1]); AddObject((r != 0) + OBJ_BARREL, xp, yp); } } } } - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; void __fastcall Theme_Shrine(int t) { - char monstrnd[5]; // [esp+3h] [ebp-5h] + char monstrnd[4]; // [esp+3h] [ebp-5h] + monstrnd[0] = 6; monstrnd[1] = 6; - monstrnd[2] = 6; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_Shrine(t); if ( themeVar1 == 1 ) { @@ -801,7 +801,7 @@ void __fastcall Theme_Shrine(int t) AddObject(OBJ_SHRINEL, themex, themey); AddObject(OBJ_CANDLE2, themex, themey + 1); } - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; @@ -810,12 +810,12 @@ void __fastcall Theme_MonstPit(int t) int r; // eax int ixp; // ecx int iyp; // edx - char monstrnd[5]; // [esp+4h] [ebp-8h] + char monstrnd[4]; // [esp+4h] [ebp-8h] - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; r = random(0, 100) + 1; ixp = 0; iyp = 0; @@ -837,7 +837,7 @@ void __fastcall Theme_MonstPit(int t) } CreateRndItem(ixp, iyp, 1u, 0, 1); ItemNoFlippy(); - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; @@ -845,47 +845,47 @@ void __fastcall Theme_SkelRoom(int t) { int yp; // esi int xp; // edi - char monstrnd[5]; // [esp+Bh] [ebp-5h] + char monstrnd[4]; // [esp+Bh] [ebp-5h] - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_SkelRoom(t); yp = themey; xp = themex; AddObject(OBJ_SKFIRE, themex, themey); - if ( random(0, monstrnd[leveltype]) ) + if ( random(0, monstrnd[leveltype-1]) ) SpawnSkeleton(PreSpawnSkeleton(), xp - 1, yp - 1); else AddObject(OBJ_BANNERL, xp - 1, yp - 1); SpawnSkeleton(PreSpawnSkeleton(), xp, yp - 1); - if ( random(0, monstrnd[leveltype]) ) + if ( random(0, monstrnd[leveltype-1]) ) SpawnSkeleton(PreSpawnSkeleton(), xp + 1, yp - 1); else AddObject(OBJ_BANNERR, xp + 1, yp - 1); - if ( random(0, monstrnd[leveltype]) ) + if ( random(0, monstrnd[leveltype-1]) ) SpawnSkeleton(PreSpawnSkeleton(), xp - 1, yp); else AddObject(OBJ_BANNERM, xp - 1, yp); - if ( random(0, monstrnd[leveltype]) ) + if ( random(0, monstrnd[leveltype-1]) ) SpawnSkeleton(PreSpawnSkeleton(), xp + 1, yp); else AddObject(OBJ_BANNERM, xp + 1, yp); - if ( random(0, monstrnd[leveltype]) ) + if ( random(0, monstrnd[leveltype-1]) ) SpawnSkeleton(PreSpawnSkeleton(), xp - 1, yp + 1); else AddObject(OBJ_BANNERR, xp - 1, yp + 1); SpawnSkeleton(PreSpawnSkeleton(), xp, yp + 1); - if ( random(0, monstrnd[leveltype]) ) + if ( random(0, monstrnd[leveltype-1]) ) SpawnSkeleton(PreSpawnSkeleton(), xp + 1, yp + 1); else AddObject(OBJ_BANNERL, xp + 1, yp + 1); @@ -902,17 +902,17 @@ void __fastcall Theme_Treasure(int t) int yp; // esi int xp; // edi int rv; // [esp+14h] [ebp-10h] - char monstrnd[5]; // [esp+18h] [ebp-Ch] - char treasrnd[5]; // [esp+20h] [ebp-4h] - - treasrnd[1] = 4; - treasrnd[2] = 9; - treasrnd[3] = 7; - treasrnd[4] = 10; - monstrnd[1] = 6; - monstrnd[2] = 8; - monstrnd[3] = 3; - monstrnd[4] = 7; + char monstrnd[4]; // [esp+18h] [ebp-Ch] + char treasrnd[4]; // [esp+20h] [ebp-4h] + + treasrnd[0] = 4; + treasrnd[1] = 9; + treasrnd[2] = 7; + treasrnd[3] = 10; + monstrnd[0] = 6; + monstrnd[1] = 8; + monstrnd[2] = 3; + monstrnd[3] = 7; GetRndSeed(); for(yp = 0; yp < 112; yp++) { @@ -920,8 +920,8 @@ void __fastcall Theme_Treasure(int t) { if ( dung_map[xp][yp] == themes[t].ttval && !nSolidTable[dPiece[xp][yp]] ) { - rv = random(0, treasrnd[leveltype]); - if ( !(2 * random(0, treasrnd[leveltype])) ) + rv = random(0, treasrnd[leveltype-1]); + if ( !(2 * random(0, treasrnd[leveltype-1])) ) { CreateTypeItem(xp, yp, 0, ITYPE_GOLD, 0, 0, 1); ItemNoFlippy(); @@ -931,12 +931,12 @@ void __fastcall Theme_Treasure(int t) CreateRndItem(xp, yp, 0, 0, 1); ItemNoFlippy(); } - if ( rv >= treasrnd[leveltype] - 2 && leveltype != 1 ) + if ( rv >= treasrnd[leveltype-1] - 2 && leveltype != 1 ) item[ItemNoFlippy()]._ivalue >>= 1; /* check */ } } } - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; @@ -951,18 +951,18 @@ void __fastcall Theme_Library(int t) int ta; // [esp+Ch] [ebp-14h] int *v10; // [esp+10h] [ebp-10h] int *v11; // [esp+14h] [ebp-Ch] - char monstrnd[5]; // [esp+18h] [ebp-8h] - char librnd[5]; // [esp+1Ch] [ebp-4h] + char monstrnd[4]; // [esp+18h] [ebp-8h] + char librnd[4]; // [esp+1Ch] [ebp-4h] ta = t; - librnd[1] = 1; + librnd[0] = 1; + librnd[1] = 2; librnd[2] = 2; - librnd[3] = 2; - librnd[4] = 5; - monstrnd[1] = 5; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + librnd[3] = 5; + monstrnd[0] = 5; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_Shrine(t); v1 = 1; if ( themeVar1 == 1 ) @@ -990,10 +990,10 @@ void __fastcall Theme_Library(int t) { if ( !*v10 ) { - if ( !random(0, librnd[leveltype]) ) + if ( !random(0, librnd[leveltype-1]) ) { AddObject(OBJ_BOOKSTAND, v2, v1); - if ( random(0, 2 * librnd[leveltype]) ) + if ( random(0, 2 * librnd[leveltype-1]) ) { v7 = *v3 - 1; object[v7]._oSelFlag = 0; @@ -1013,7 +1013,7 @@ void __fastcall Theme_Library(int t) while ( (signed int)v11 < (signed int)&dMonster[1][111] ); //LOBYTE(v8) = QuestStatus(3); if ( !QuestStatus(3) || ta != zharlib ) - PlaceThemeMonsts(ta, monstrnd[leveltype]); + PlaceThemeMonsts(ta, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; // 6AAA64: using guessed type int zharlib; @@ -1025,20 +1025,20 @@ void __fastcall Theme_Torture(int t) char *v3; // edi //int v4; // eax int *x; // [esp+Ch] [ebp-14h] - char monstrnd[5]; // [esp+10h] [ebp-10h] + char monstrnd[4]; // [esp+10h] [ebp-10h] int *v8; // [esp+14h] [ebp-Ch] - char tortrnd[5]; // [esp+18h] [ebp-8h] + char tortrnd[4]; // [esp+18h] [ebp-8h] int v10; // [esp+1Ch] [ebp-4h] v1 = t; - tortrnd[1] = 6; - tortrnd[2] = 8; - tortrnd[3] = 3; - tortrnd[4] = 8; - monstrnd[1] = 6; - monstrnd[2] = 8; - monstrnd[3] = 3; - monstrnd[4] = 9; + tortrnd[0] = 6; + tortrnd[1] = 8; + tortrnd[2] = 3; + tortrnd[3] = 8; + monstrnd[0] = 6; + monstrnd[1] = 8; + monstrnd[2] = 3; + monstrnd[3] = 9; v2 = 1; v8 = &dPiece[1][1]; do @@ -1053,7 +1053,7 @@ void __fastcall Theme_Torture(int t) //LOBYTE(v4) = CheckThemeObj3(v10, v2, v1, -1); if ( CheckThemeObj3(v10, v2, v1, -1) ) { - if ( !random(0, tortrnd[leveltype]) ) + if ( !random(0, tortrnd[leveltype-1]) ) AddObject(OBJ_TNUDEM2, v10, v2); } } @@ -1066,21 +1066,21 @@ void __fastcall Theme_Torture(int t) ++v2; } while ( (signed int)v8 < (signed int)&dPiece[1][111] ); - PlaceThemeMonsts(v1, monstrnd[leveltype]); + PlaceThemeMonsts(v1, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; void __fastcall Theme_BloodFountain(int t) { - char monstrnd[5]; // [esp+3h] [ebp-5h] + char monstrnd[4]; // [esp+3h] [ebp-5h] - monstrnd[1] = 6; - monstrnd[2] = 8; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[0] = 6; + monstrnd[1] = 8; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_Obj5(t); AddObject(OBJ_BLOODFTN, themex, themey); - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; @@ -1091,20 +1091,20 @@ void __fastcall Theme_Decap(int t) char *v3; // edi //int v4; // eax int *x; // [esp+Ch] [ebp-14h] - char monstrnd[5]; // [esp+10h] [ebp-10h] + char monstrnd[4]; // [esp+10h] [ebp-10h] int *v8; // [esp+14h] [ebp-Ch] - char decaprnd[5]; // [esp+18h] [ebp-8h] + char decaprnd[4]; // [esp+18h] [ebp-8h] int v10; // [esp+1Ch] [ebp-4h] v1 = t; - decaprnd[1] = 6; - decaprnd[2] = 8; - decaprnd[3] = 3; - decaprnd[4] = 8; - monstrnd[1] = 6; - monstrnd[2] = 8; - monstrnd[3] = 3; - monstrnd[4] = 9; + decaprnd[0] = 6; + decaprnd[1] = 8; + decaprnd[2] = 3; + decaprnd[3] = 8; + monstrnd[0] = 6; + monstrnd[1] = 8; + monstrnd[2] = 3; + monstrnd[3] = 9; v2 = 1; v8 = &dPiece[1][1]; do @@ -1119,7 +1119,7 @@ void __fastcall Theme_Decap(int t) //LOBYTE(v4) = CheckThemeObj3(v10, v2, v1, -1); if ( CheckThemeObj3(v10, v2, v1, -1) ) { - if ( !random(0, decaprnd[leveltype]) ) + if ( !random(0, decaprnd[leveltype-1]) ) AddObject(OBJ_DECAP, v10, v2); } } @@ -1132,21 +1132,21 @@ void __fastcall Theme_Decap(int t) ++v2; } while ( (signed int)v8 < (signed int)&dPiece[1][111] ); - PlaceThemeMonsts(v1, monstrnd[leveltype]); + PlaceThemeMonsts(v1, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; void __fastcall Theme_PurifyingFountain(int t) { - char monstrnd[5]; // [esp+3h] [ebp-5h] + char monstrnd[4]; // [esp+3h] [ebp-5h] - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_Obj5(t); AddObject(OBJ_PURIFYINGFTN, themex, themey); - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; @@ -1158,20 +1158,20 @@ void __fastcall Theme_ArmorStand(int t) //int v4; // eax int ta; // [esp+Ch] [ebp-14h] int *v7; // [esp+10h] [ebp-10h] - char monstrnd[5]; // [esp+14h] [ebp-Ch] + char monstrnd[4]; // [esp+14h] [ebp-Ch] int *v9; // [esp+18h] [ebp-8h] - char armorrnd[5]; // [esp+1Ch] [ebp-4h] + char armorrnd[4]; // [esp+1Ch] [ebp-4h] v1 = 0; ta = t; - armorrnd[1] = 6; - armorrnd[2] = 8; - armorrnd[3] = 3; - armorrnd[4] = 8; - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + armorrnd[0] = 6; + armorrnd[1] = 8; + armorrnd[2] = 3; + armorrnd[3] = 8; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; if ( armorFlag ) { TFit_Obj3(t); @@ -1190,7 +1190,7 @@ void __fastcall Theme_ArmorStand(int t) //LOBYTE(v4) = CheckThemeObj3(v2, v1, ta, -1); if ( CheckThemeObj3(v2, v1, ta, -1) ) { - if ( !random(0, armorrnd[leveltype]) ) + if ( !random(0, armorrnd[leveltype-1]) ) AddObject(OBJ_ARMORSTANDN, v2, v1); } } @@ -1203,7 +1203,7 @@ void __fastcall Theme_ArmorStand(int t) ++v1; } while ( (signed int)v9 < (signed int)dPiece[1] ); - PlaceThemeMonsts(ta, monstrnd[leveltype]); + PlaceThemeMonsts(ta, monstrnd[leveltype-1]); armorFlag = 0; } // 5BB1ED: using guessed type char leveltype; @@ -1256,43 +1256,43 @@ void __fastcall Theme_GoatShrine(int t) void __fastcall Theme_Cauldron(int t) { - char monstrnd[5]; // [esp+3h] [ebp-5h] + char monstrnd[4]; // [esp+3h] [ebp-5h] - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_Obj5(t); AddObject(OBJ_CAULDRON, themex, themey); - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; void __fastcall Theme_MurkyFountain(int t) { - char monstrnd[5]; // [esp+3h] [ebp-5h] + char monstrnd[4]; // [esp+3h] [ebp-5h] - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_Obj5(t); AddObject(OBJ_MURKYFTN, themex, themey); - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; void __fastcall Theme_TearFountain(int t) { - char monstrnd[5]; // [esp+3h] [ebp-5h] + char monstrnd[4]; // [esp+3h] [ebp-5h] - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; TFit_Obj5(t); AddObject(OBJ_TEARFTN, themex, themey); - PlaceThemeMonsts(t, monstrnd[leveltype]); + PlaceThemeMonsts(t, monstrnd[leveltype-1]); } // 5BB1ED: using guessed type char leveltype; @@ -1304,19 +1304,19 @@ void __fastcall Theme_BrnCross(int t) //int v4; // eax int ta; // [esp+Ch] [ebp-14h] int *v7; // [esp+10h] [ebp-10h] - char monstrnd[5]; // [esp+14h] [ebp-Ch] + char monstrnd[4]; // [esp+14h] [ebp-Ch] int *v9; // [esp+18h] [ebp-8h] - char bcrossrnd[5]; // [esp+1Ch] [ebp-4h] + char bcrossrnd[4]; // [esp+1Ch] [ebp-4h] ta = t; - monstrnd[1] = 6; - monstrnd[2] = 8; - monstrnd[3] = 3; - monstrnd[4] = 9; - bcrossrnd[1] = 5; - bcrossrnd[2] = 7; - bcrossrnd[3] = 3; - bcrossrnd[4] = 8; + monstrnd[0] = 6; + monstrnd[1] = 8; + monstrnd[2] = 3; + monstrnd[3] = 9; + bcrossrnd[0] = 5; + bcrossrnd[1] = 7; + bcrossrnd[2] = 3; + bcrossrnd[3] = 8; v1 = 0; v9 = (int *)dPiece; do @@ -1331,7 +1331,7 @@ void __fastcall Theme_BrnCross(int t) //LOBYTE(v4) = CheckThemeObj3(v2, v1, ta, -1); if ( CheckThemeObj3(v2, v1, ta, -1) ) { - if ( !random(0, bcrossrnd[leveltype]) ) + if ( !random(0, bcrossrnd[leveltype-1]) ) AddObject(OBJ_TBCROSS, v2, v1); } } @@ -1344,7 +1344,7 @@ void __fastcall Theme_BrnCross(int t) ++v1; } while ( (signed int)v9 < (signed int)dPiece[1] ); - PlaceThemeMonsts(ta, monstrnd[leveltype]); + PlaceThemeMonsts(ta, monstrnd[leveltype-1]); bCrossFlag = 1; } // 5BB1ED: using guessed type char leveltype; @@ -1358,20 +1358,20 @@ void __fastcall Theme_WeaponRack(int t) //int v4; // eax int ta; // [esp+Ch] [ebp-14h] int *v7; // [esp+10h] [ebp-10h] - char monstrnd[5]; // [esp+14h] [ebp-Ch] + char monstrnd[4]; // [esp+14h] [ebp-Ch] int *v9; // [esp+18h] [ebp-8h] - char weaponrnd[5]; // [esp+1Ch] [ebp-4h] + char weaponrnd[4]; // [esp+1Ch] [ebp-4h] v1 = 0; ta = t; - weaponrnd[1] = 6; - weaponrnd[2] = 8; - weaponrnd[3] = 5; - weaponrnd[4] = 8; - monstrnd[1] = 6; - monstrnd[2] = 7; - monstrnd[3] = 3; - monstrnd[4] = 9; + weaponrnd[0] = 6; + weaponrnd[1] = 8; + weaponrnd[2] = 5; + weaponrnd[3] = 8; + monstrnd[0] = 6; + monstrnd[1] = 7; + monstrnd[2] = 3; + monstrnd[3] = 9; if ( weaponFlag ) { TFit_Obj3(t); @@ -1390,7 +1390,7 @@ void __fastcall Theme_WeaponRack(int t) //LOBYTE(v4) = CheckThemeObj3(v2, v1, ta, -1); if ( CheckThemeObj3(v2, v1, ta, -1) ) { - if ( !random(0, weaponrnd[leveltype]) ) + if ( !random(0, weaponrnd[leveltype-1]) ) AddObject(OBJ_WEAPONRACKN, v2, v1); } } @@ -1403,7 +1403,7 @@ void __fastcall Theme_WeaponRack(int t) ++v1; } while ( (signed int)v9 < (signed int)dPiece[1] ); - PlaceThemeMonsts(ta, monstrnd[leveltype]); + PlaceThemeMonsts(ta, monstrnd[leveltype-1]); weaponFlag = 0; } // 5BB1ED: using guessed type char leveltype; diff --git a/Source/towners.h b/Source/towners.h index d54f52ca0..174825639 100644 --- a/Source/towners.h +++ b/Source/towners.h @@ -12,8 +12,8 @@ extern void *pCowCels; // idb extern TownerStruct towner[16]; int __fastcall GetActiveTowner(int t); -void __fastcall SetTownerGPtrs(void *pData, void **pAnim); -void __fastcall NewTownerAnim(int tnum, void *pAnim, int numFrames, int Delay); +void __fastcall SetTownerGPtrs(void *pData, void **pAnim); /* unsigned char *+** */ +void __fastcall NewTownerAnim(int tnum, void *pAnim, int numFrames, int Delay); /* unsigned char * */ void __fastcall InitTownerInfo(int i, int w, bool sel, int t, int x, int y, int ao, int tp); void __fastcall InitQstSnds(int i); void __cdecl InitSmith(); diff --git a/enums.h b/enums.h index ad2d615ca..ab88672d6 100644 --- a/enums.h +++ b/enums.h @@ -1759,20 +1759,6 @@ enum PLR_MODE PM_QUIT = 11, }; -enum template_id -{ - TEMPLATE_ERR_DX = 0x68, - TEMPLATE_ERR_NOMEMORY = 0x69, - TEMPLATE_ERR_NOFILE = 0x6A, - TEMPLATE_ERR_DDRAW = 0x6B, - TEMPLATE_ERR_DSOUND = 0x6C, - TEMPLATE_ERR_DISKSPACE = 0x6E, - TEMPLATE_ERR_VIDEOMODE = 0x6F, - TEMPLATE_ERR_INSERTCD = 0x70, - TEMPLATE_ERR_RESTRICTED = 0x71, - TEMPLATE_ERR_READONLY = 0x72, -}; - enum spell_type { RSPLTYPE_SKILL = 0x0, diff --git a/resource.h b/resource.h index eee382473..bcfe205ac 100644 --- a/resource.h +++ b/resource.h @@ -3,17 +3,17 @@ // Used by Diablo.rc // #define IDI_ICON1 101 -#define IDD_DIALOG1 104 -#define IDD_DIALOG2 105 -#define IDD_DIALOG3 106 -#define IDD_DIALOG4 107 -#define IDD_DIALOG5 108 -#define IDD_DIALOG6 109 -#define IDD_DIALOG7 110 -#define IDD_DIALOG8 111 -#define IDD_DIALOG9 112 -#define IDD_DIALOG10 113 -#define IDD_DIALOG11 114 +#define IDD_DIALOG1 104 // DX +#define IDD_DIALOG2 105 // NOMEMORY +#define IDD_DIALOG3 106 // NOFILE +#define IDD_DIALOG4 107 // DDRAW +#define IDD_DIALOG5 108 // DSOUND +#define IDD_DIALOG6 109 // PENTIUM (deprecated in 1.00) +#define IDD_DIALOG7 110 // DISKSPACE +#define IDD_DIALOG8 111 // VIDEOMODE +#define IDD_DIALOG9 112 // INSERTCD +#define IDD_DIALOG10 113 // RESTRICTED +#define IDD_DIALOG11 114 // READONLY // Next default values for new objects // diff --git a/structs.h b/structs.h index 9ea79e760..4d65cf0ce 100644 --- a/structs.h +++ b/structs.h @@ -309,12 +309,12 @@ struct ItemStruct int _ix; int _iy; int _iAnimFlag; - int _iAnimData; // unsigned char * + int _iAnimData; // unsigned char * (PSX name -> ItemFrame) int _iAnimLen; int _iAnimFrame; int _iAnimWidth; int _iAnimWidth2; // width 2? - int offs002C; + int _isin; // set when item is flagged for deletion, deprecated in 1.02 char _iSelFlag; int _iPostDraw; int _iIdentified; @@ -370,7 +370,7 @@ struct ItemStruct char _iMinDex; int _iStatFlag; int IDidx; - int offs016C; + int offs016C; // _oldlight or _iInvalid }; struct DeadStruct