diff --git a/Source/DiabloUI/diabloui.h b/Source/DiabloUI/diabloui.h index 1c76a7195..e18d91796 100644 --- a/Source/DiabloUI/diabloui.h +++ b/Source/DiabloUI/diabloui.h @@ -103,15 +103,6 @@ bool UiCreditsDialog(); bool UiSupportDialog(); bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, void (*fnSound)(const char *file), int attractTimeOut); bool UiProgressDialog(const char *msg, int (*fnfunc)()); -void UiProfileCallback(); -void UiProfileDraw(); -bool UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7); -bool UiGetDataCallback(int game_type, int data_code, void *a3, int a4, int a5); -bool UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, char *lpBuffer, int cchBufferMax); -bool UiSoundCallback(int a1, int type, int a3); -bool UiDrawDescCallback(int game_type, DWORD color, const char *lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8); -bool UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int a6); -bool UiArtCallback(int game_type, unsigned int art_code, SDL_Color *pPalette, BYTE *pBuffer, DWORD dwBuffersize, DWORD *pdwWidth, DWORD *pdwHeight, DWORD *pdwBpp); bool UiSelectGame(GameData *gameData, int *playerId); bool UiSelectProvider(GameData *gameData); void UiFadeIn(); diff --git a/Source/diablo.cpp b/Source/diablo.cpp index eba526d8e..9079ef62b 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -363,7 +363,7 @@ static bool ProcessInput() static void run_game_loop(interface_mode uMsg) { WNDPROC saveProc; - MSG msg; + tagMSG msg; nthread_ignore_mutex(true); start_game(uMsg); @@ -1286,7 +1286,7 @@ static void PressKey(int vkey) /** * @internal `return` must be used instead of `break` to be bin exact as C++ */ -static void PressChar(WPARAM vkey) +static void PressChar(int32_t vkey) { if (gmenu_is_active() || control_talk_last_key(vkey) || sgnTimeoutCurs != CURSOR_NONE || deathflag) { return; @@ -1578,13 +1578,13 @@ static void PressChar(WPARAM vkey) } } -static void GetMousePos(LPARAM lParam) +static void GetMousePos(int32_t lParam) { MouseX = (short)(lParam & 0xffff); MouseY = (short)((lParam >> 16) & 0xffff); } -void DisableInputWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) +void DisableInputWndProc(uint32_t uMsg, int32_t wParam, int32_t lParam) { switch (uMsg) { case DVL_WM_KEYDOWN: @@ -1624,7 +1624,7 @@ void DisableInputWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) MainWndProc(uMsg); } -void GM_Game(UINT uMsg, WPARAM wParam, LPARAM lParam) +void GM_Game(uint32_t uMsg, int32_t wParam, int32_t lParam) { switch (uMsg) { case DVL_WM_KEYDOWN: diff --git a/Source/diablo.h b/Source/diablo.h index fcb3da5d2..b27e46e86 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -55,8 +55,8 @@ int DiabloMain(int argc, char **argv); bool TryIconCurs(); void diablo_pause_game(); bool PressEscKey(); -void DisableInputWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam); -void GM_Game(UINT uMsg, WPARAM wParam, LPARAM lParam); +void DisableInputWndProc(uint32_t uMsg, int32_t wParam, int32_t lParam); +void GM_Game(uint32_t uMsg, int32_t wParam, int32_t lParam); void LoadGameLevel(bool firstflag, lvl_entry lvldir); void game_loop(bool bStartup); void diablo_color_cyc_logic(); diff --git a/Source/init.cpp b/Source/init.cpp index 816e796b8..772ede5f2 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -230,7 +230,7 @@ void init_create_window() #endif } -void MainWndProc(UINT Msg) +void MainWndProc(uint32_t Msg) { switch (Msg) { case DVL_WM_PAINT: diff --git a/Source/init.h b/Source/init.h index 8bbbbedf2..f9c674d3c 100644 --- a/Source/init.h +++ b/Source/init.h @@ -30,7 +30,7 @@ extern HANDLE devilutionx_mpq; void init_cleanup(); void init_archives(); void init_create_window(); -void MainWndProc(UINT Msg); +void MainWndProc(uint32_t Msg); WNDPROC SetWindowProc(WNDPROC NewProc); /* data */ diff --git a/Source/interfac.cpp b/Source/interfac.cpp index b71abc8e9..73b7e3959 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -190,7 +190,7 @@ static void DrawCutscene() void interface_msg_pump() { - MSG Msg; + tagMSG Msg; while (FetchMessage(&Msg)) { if (Msg.message != DVL_WM_QUIT) { diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index b56e7a10f..4bd5ff628 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -1580,10 +1580,10 @@ static void SaveMonster(SaveHelper *file, int i) file->skip(1); // Alignment file->writeLE(pMonster->mExp); - file->writeLE(pMonster->mHit < UCHAR_MAX ? pMonster->mHit : UCHAR_MAX); // For backwards compatibility + file->writeLE(pMonster->mHit < UINT8_MAX ? pMonster->mHit : UINT8_MAX); // For backwards compatibility file->writeLE(pMonster->mMinDamage); file->writeLE(pMonster->mMaxDamage); - file->writeLE(pMonster->mHit2 < UCHAR_MAX ? pMonster->mHit2 : UCHAR_MAX); // For backwards compatibility + file->writeLE(pMonster->mHit2 < UINT8_MAX ? pMonster->mHit2 : UINT8_MAX); // For backwards compatibility file->writeLE(pMonster->mMinDamage2); file->writeLE(pMonster->mMaxDamage2); file->writeLE(pMonster->mArmorClass); diff --git a/Source/miniwin/miniwin.h b/Source/miniwin/miniwin.h index 096d460d8..f248501cd 100644 --- a/Source/miniwin/miniwin.h +++ b/Source/miniwin/miniwin.h @@ -15,6 +15,7 @@ namespace devilution { #ifndef MAX_PATH #define MAX_PATH 260 #endif + #ifdef __has_attribute #define DVL_HAVE_ATTRIBUTE(x) __has_attribute(x) #else @@ -28,37 +29,24 @@ namespace devilution { #define DVL_PRINTF_ATTRIBUTE(fmtargnum) #endif -typedef uint16_t SHORT; typedef int32_t LONG; -typedef unsigned char UCHAR; - typedef uint32_t DWORD; typedef unsigned char BYTE; typedef unsigned short WORD; -typedef DWORD *LPDWORD; -typedef void *LPVOID; -typedef void *PVOID; - -typedef unsigned int UINT; - -typedef int32_t WPARAM; -typedef int32_t LPARAM; // // Handles // typedef void *HANDLE; -typedef HANDLE HMODULE, HDC, HINSTANCE; - -typedef void (*WNDPROC)(UINT, WPARAM, LPARAM); +typedef void (*WNDPROC)(uint32_t, int32_t, int32_t); typedef struct tagMSG { - UINT message; - WPARAM wParam; - LPARAM lParam; -} MSG, *LPMSG; + uint32_t message; + int32_t wParam; + int32_t lParam; +}; // // Everything else @@ -67,13 +55,13 @@ typedef struct tagMSG { void SetCursorPos(int X, int Y); void FocusOnCharInfo(); -SHORT GetAsyncKeyState(int vKey); +uint16_t GetAsyncKeyState(int vKey); -bool FetchMessage(LPMSG lpMsg); +bool FetchMessage(tagMSG *lpMsg); -bool TranslateMessage(const MSG *lpMsg); -void PushMessage(const MSG *lpMsg); -bool PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam); +bool TranslateMessage(const tagMSG *lpMsg); +void PushMessage(const tagMSG *lpMsg); +bool PostMessage(uint32_t Msg, int32_t wParam, int32_t lParam); #ifdef _MSC_VER #define strcasecmp _stricmp diff --git a/Source/miniwin/misc_msg.cpp b/Source/miniwin/misc_msg.cpp index 5b1bb3eef..8c23b98f2 100644 --- a/Source/miniwin/misc_msg.cpp +++ b/Source/miniwin/misc_msg.cpp @@ -16,6 +16,8 @@ #include "utils/sdl_compat.h" #include "utils/stubs.h" #include "utils/log.hpp" +#include "miniwin/miniwin.h" + #ifdef __SWITCH__ #include "platform/switch/docking.h" @@ -29,7 +31,7 @@ namespace devilution { -static std::deque message_queue; +static std::deque message_queue; bool mouseWarping = false; int mouseWarpingX; @@ -252,12 +254,12 @@ static int TranslateSdlKey(SDL_Keysym key) namespace { -LPARAM PositionForMouse(short x, short y) +int32_t PositionForMouse(short x, short y) { return (((uint16_t)(y & 0xFFFF)) << 16) | (uint16_t)(x & 0xFFFF); } -WPARAM KeystateForMouse(WPARAM ret) +int32_t KeystateForMouse(int32_t ret) { ret |= (SDL_GetModState() & KMOD_SHIFT) ? DVL_MK_SHIFT : 0; // XXX: other DVL_MK_* codes not implemented @@ -294,7 +296,7 @@ bool BlurInventory() return true; } -bool FetchMessage(LPMSG lpMsg) +bool FetchMessage(tagMSG *lpMsg) { #ifdef __SWITCH__ HandleDocking(); @@ -575,7 +577,7 @@ bool FetchMessage(LPMSG lpMsg) return true; } -bool TranslateMessage(const MSG *lpMsg) +bool TranslateMessage(const tagMSG *lpMsg) { if (lpMsg->message == DVL_WM_KEYDOWN) { int key = lpMsg->wParam; @@ -681,7 +683,7 @@ bool TranslateMessage(const MSG *lpMsg) return true; } -SHORT GetAsyncKeyState(int vKey) +uint16_t GetAsyncKeyState(int vKey) { if (vKey == DVL_MK_LBUTTON) return SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON(SDL_BUTTON_LEFT); @@ -708,21 +710,16 @@ SHORT GetAsyncKeyState(int vKey) } } -void PushMessage(const MSG *lpMsg) +void PushMessage(const tagMSG *lpMsg) { assert(CurrentProc); CurrentProc(lpMsg->message, lpMsg->wParam, lpMsg->lParam); } -bool PostMessage(UINT type, WPARAM wParam, LPARAM lParam) +bool PostMessage(uint32_t type, int32_t wParam, int32_t lParam) { - MSG message; - message.message = type; - message.wParam = wParam; - message.lParam = lParam; - - message_queue.push_back(message); + message_queue.push_back({type, wParam, lParam}); return true; } diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 4291a9d70..81dad6f72 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -675,7 +675,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool } if (monster[m]._msquelch == 0) { - monster[m]._msquelch = UCHAR_MAX; + monster[m]._msquelch = UINT8_MAX; monster[m].position.last = plr[pnum].position.tile; } return true; diff --git a/Source/monster.cpp b/Source/monster.cpp index e05ce195c..5224c9cad 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -2465,7 +2465,7 @@ bool M_DoTalk(int i) if (monster[i]._uniqtype - 1 == UMT_LAZURUS && gbIsMultiplayer) { quests[Q_BETRAYER]._qvar1 = 6; monster[i]._mgoal = MGOAL_NORMAL; - monster[i]._msquelch = UCHAR_MAX; + monster[i]._msquelch = UINT8_MAX; monster[i].mtalkmsg = 0; } return false; @@ -3439,10 +3439,10 @@ void MAI_Round(int i, bool special) mx = Monst->position.tile.x - fx; my = Monst->position.tile.y - fy; direction md = GetDirection(Monst->position.tile, Monst->position.last); - if (Monst->_msquelch < UCHAR_MAX) + if (Monst->_msquelch < UINT8_MAX) MonstCheckDoors(i); v = GenerateRnd(100); - if ((abs(mx) >= 2 || abs(my) >= 2) && Monst->_msquelch == UCHAR_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { + if ((abs(mx) >= 2 || abs(my) >= 2) && Monst->_msquelch == UINT8_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { if (Monst->_mgoal == MGOAL_MOVE || ((abs(mx) >= 4 || abs(my) >= 4) && GenerateRnd(4) == 0)) { if (Monst->_mgoal != MGOAL_MOVE) { Monst->_mgoalvar1 = 0; @@ -3499,13 +3499,13 @@ void MAI_Ranged(int i, int missile_type, bool special) } Monst = &monster[i]; - if (Monst->_msquelch == UCHAR_MAX || Monst->_mFlags & MFLAG_TARGETS_MONSTER) { + if (Monst->_msquelch == UINT8_MAX || Monst->_mFlags & MFLAG_TARGETS_MONSTER) { fx = Monst->enemyPosition.x; fy = Monst->enemyPosition.y; mx = Monst->position.tile.x - fx; my = Monst->position.tile.y - fy; direction md = M_GetDir(i); - if (Monst->_msquelch < UCHAR_MAX) + if (Monst->_msquelch < UINT8_MAX) MonstCheckDoors(i); Monst->_mdir = md; if (Monst->_mVar1 == MM_RATTACK) { @@ -3727,11 +3727,11 @@ void MAI_RoundRanged(int i, int missile_type, bool checkdoors, int dam, int less mx = Monst->position.tile.x - fx; my = Monst->position.tile.y - fy; direction md = GetDirection(Monst->position.tile, Monst->position.last); - if (checkdoors && Monst->_msquelch < UCHAR_MAX) + if (checkdoors && Monst->_msquelch < UINT8_MAX) MonstCheckDoors(i); v = GenerateRnd(10000); dist = std::max(abs(mx), abs(my)); - if (dist >= 2 && Monst->_msquelch == UCHAR_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { + if (dist >= 2 && Monst->_msquelch == UINT8_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { if (Monst->_mgoal == MGOAL_MOVE || (dist >= 3 && GenerateRnd(4 << lessmissiles) == 0)) { if (Monst->_mgoal != MGOAL_MOVE) { Monst->_mgoalvar1 = 0; @@ -3819,11 +3819,11 @@ void MAI_RR2(int i, int mistype, int dam) mx = Monst->position.tile.x - fx; my = Monst->position.tile.y - fy; direction md = GetDirection(Monst->position.tile, Monst->position.last); - if (Monst->_msquelch < UCHAR_MAX) + if (Monst->_msquelch < UINT8_MAX) MonstCheckDoors(i); v = GenerateRnd(100); dist = std::max(abs(mx), abs(my)); - if (dist >= 2 && Monst->_msquelch == UCHAR_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { + if (dist >= 2 && Monst->_msquelch == UINT8_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { if (Monst->_mgoal == MGOAL_MOVE || dist >= 3) { if (Monst->_mgoal != MGOAL_MOVE) { Monst->_mgoalvar1 = 0; @@ -3906,13 +3906,13 @@ void MAI_Golum(int i) _menemy = monster[i]._menemy; monster[i].enemyPosition = monster[_menemy].position.tile; if (monster[_menemy]._msquelch == 0) { - monster[_menemy]._msquelch = UCHAR_MAX; + monster[_menemy]._msquelch = UINT8_MAX; monster[monster[i]._menemy].position.last = monster[i].position.tile; for (int j = 0; j < 5; j++) { for (int k = 0; k < 5; k++) { _menemy = dMonster[monster[i].position.tile.x + k - 2][monster[i].position.tile.y + j - 2]; if (_menemy > 0) - monster[_menemy - 1]._msquelch = UCHAR_MAX; // BUGFIX: should be `monster[_menemy-1]`, not monster[_menemy]. (fixed) + monster[_menemy - 1]._msquelch = UINT8_MAX; // BUGFIX: should be `monster[_menemy-1]`, not monster[_menemy]. (fixed) } } } @@ -3954,11 +3954,11 @@ void MAI_SkelKing(int i) mx = Monst->position.tile.x - fx; my = Monst->position.tile.y - fy; direction md = GetDirection(Monst->position.tile, Monst->position.last); - if (Monst->_msquelch < UCHAR_MAX) + if (Monst->_msquelch < UINT8_MAX) MonstCheckDoors(i); v = GenerateRnd(100); dist = std::max(abs(mx), abs(my)); - if (dist >= 2 && Monst->_msquelch == UCHAR_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { + if (dist >= 2 && Monst->_msquelch == UINT8_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { if (Monst->_mgoal == MGOAL_MOVE || ((abs(mx) >= 3 || abs(my) >= 3) && GenerateRnd(4) == 0)) { if (Monst->_mgoal != MGOAL_MOVE) { Monst->_mgoalvar1 = 0; @@ -4017,7 +4017,7 @@ void MAI_Rhino(int i) mx = Monst->position.tile.x - fx; my = Monst->position.tile.y - fy; direction md = GetDirection(Monst->position.tile, Monst->position.last); - if (Monst->_msquelch < UCHAR_MAX) + if (Monst->_msquelch < UINT8_MAX) MonstCheckDoors(i); v = GenerateRnd(100); dist = std::max(abs(mx), abs(my)); @@ -4154,7 +4154,7 @@ void MAI_Counselor(int i) mx = Monst->position.tile.x - fx; my = Monst->position.tile.y - fy; direction md = GetDirection(Monst->position.tile, Monst->position.last); - if (Monst->_msquelch < UCHAR_MAX) + if (Monst->_msquelch < UINT8_MAX) MonstCheckDoors(i); v = GenerateRnd(100); if (Monst->_mgoal == MGOAL_RETREAT) { @@ -4166,7 +4166,7 @@ void MAI_Counselor(int i) } } else if (Monst->_mgoal == MGOAL_MOVE) { dist = std::max(abs(mx), abs(my)); - if (dist >= 2 && Monst->_msquelch == UCHAR_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { + if (dist >= 2 && Monst->_msquelch == UINT8_MAX && dTransVal[Monst->position.tile.x][Monst->position.tile.y] == dTransVal[fx][fy]) { if (Monst->_mgoalvar1++ < 2 * dist || !DirOK(i, md)) { M_RoundWalk(i, md, &Monst->_mgoalvar2); } else { @@ -4246,7 +4246,7 @@ void MAI_Garbud(int i) if (Monst->mtalkmsg == TEXT_GARBUD4) { if (!effect_is_playing(USFX_GARBUD4) && Monst->_mgoal == MGOAL_TALKING) { Monst->_mgoal = MGOAL_NORMAL; - Monst->_msquelch = UCHAR_MAX; + Monst->_msquelch = UINT8_MAX; Monst->mtalkmsg = 0; } } @@ -4284,7 +4284,7 @@ void MAI_Zhar(int i) if (dFlags[mx][my] & BFLAG_VISIBLE) { if (Monst->mtalkmsg == TEXT_ZHAR2) { if (!effect_is_playing(USFX_ZHAR2) && Monst->_mgoal == MGOAL_TALKING) { - Monst->_msquelch = UCHAR_MAX; + Monst->_msquelch = UINT8_MAX; Monst->mtalkmsg = 0; Monst->_mgoal = MGOAL_NORMAL; } @@ -4332,7 +4332,7 @@ void MAI_SnotSpil(int i) ObjChangeMap(setpc_x, setpc_y, setpc_x + setpc_w + 1, setpc_y + setpc_h + 1); quests[Q_LTBANNER]._qvar1 = 3; RedoPlayerVision(); - Monst->_msquelch = UCHAR_MAX; + Monst->_msquelch = UINT8_MAX; Monst->mtalkmsg = 0; Monst->_mgoal = MGOAL_NORMAL; } @@ -4377,7 +4377,7 @@ void MAI_Lazurus(int i) RedoPlayerVision(); quests[Q_BETRAYER]._qvar1 = 6; Monst->_mgoal = MGOAL_NORMAL; - Monst->_msquelch = UCHAR_MAX; + Monst->_msquelch = UINT8_MAX; Monst->mtalkmsg = 0; } } @@ -4491,7 +4491,7 @@ void MAI_Warlord(int i) if (Monst->mtalkmsg == TEXT_WARLRD9 && Monst->_mgoal == MGOAL_INQUIRING) Monst->_mmode = MM_TALK; if (Monst->mtalkmsg == TEXT_WARLRD9 && !effect_is_playing(USFX_WARLRD1) && Monst->_mgoal == MGOAL_TALKING) { - Monst->_msquelch = UCHAR_MAX; + Monst->_msquelch = UINT8_MAX; Monst->mtalkmsg = 0; Monst->_mgoal = MGOAL_NORMAL; } @@ -4585,7 +4585,7 @@ void ProcessMonsters() assurance((DWORD)_menemy < MAX_PLRS, _menemy); Monst->enemyPosition = plr[Monst->_menemy].position.future; if (dFlags[mx][my] & BFLAG_VISIBLE) { - Monst->_msquelch = UCHAR_MAX; + Monst->_msquelch = UINT8_MAX; Monst->position.last = plr[Monst->_menemy].position.future; } else if (Monst->_msquelch != 0 && Monst->MType->mtype != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype' Monst->_msquelch--; diff --git a/Source/movie.cpp b/Source/movie.cpp index 8df902be4..b16b7f052 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -38,7 +38,7 @@ void play_movie(const char *pszMovie, bool user_can_close) #endif SVidPlayBegin(pszMovie, loop_movie ? 0x100C0808 : 0x10280808, &video_stream); - MSG Msg; + tagMSG Msg; while (video_stream != nullptr && movie_playing) { while (movie_playing && FetchMessage(&Msg)) { switch (Msg.message) { diff --git a/Source/msg.cpp b/Source/msg.cpp index d84e59f12..83f231a0c 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -477,7 +477,7 @@ void delta_sync_monster(const TSyncMonster *pSync, BYTE bLevel) pD->_mx = pSync->_mx; pD->_my = pSync->_my; - pD->_mactive = UCHAR_MAX; + pD->_mactive = UINT8_MAX; pD->_menemy = pSync->_menemy; } @@ -490,7 +490,7 @@ void delta_sync_golem(TCmdGolem *pG, int pnum, BYTE bLevel) DMonsterStr *pD = &sgLevels[bLevel].monster[pnum]; pD->_mx = pG->_mx; pD->_my = pG->_my; - pD->_mactive = UCHAR_MAX; + pD->_mactive = UINT8_MAX; pD->_menemy = pG->_menemy; pD->_mdir = pG->_mdir; pD->_mhitpoints = pG->_mhitpoints; diff --git a/Source/multi.cpp b/Source/multi.cpp index 075171d05..7cf4b3b1e 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -49,7 +49,7 @@ bool sgbTimeout; char szPlayerName[128]; BYTE gbDeltaSender; bool sgbNetInited; -int player_state[MAX_PLRS]; +uint32_t player_state[MAX_PLRS]; /** * Contains the set of supported event types supported by the multiplayer @@ -328,7 +328,7 @@ static void multi_check_drop_player() static void multi_begin_timeout() { - int i, nTicks, nState, nLowestActive, nLowestPlayer; + int i, nTicks, nLowestActive, nLowestPlayer; BYTE bGroupPlayers, bGroupCount; if (!sgbTimeout) { @@ -354,7 +354,7 @@ static void multi_begin_timeout() bGroupPlayers = 0; bGroupCount = 0; for (i = 0; i < MAX_PLRS; i++) { - nState = player_state[i]; + uint32_t nState = player_state[i]; if ((nState & PS_CONNECTED) != 0) { if (nLowestPlayer == -1) { nLowestPlayer = i; diff --git a/Source/multi.h b/Source/multi.h index ef3789693..5325b9f1b 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -45,7 +45,7 @@ extern bool gbSelectProvider; extern bool gbIsMultiplayer; extern char szPlayerName[128]; extern BYTE gbDeltaSender; -extern int player_state[MAX_PLRS]; +extern uint32_t player_state[MAX_PLRS]; void multi_msg_add(BYTE *pbMsg, BYTE bLen); void NetSendLoPri(int playerId, BYTE *pbMsg, BYTE bLen); diff --git a/Source/nthread.cpp b/Source/nthread.cpp index b17ec8e90..d81a3daaa 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -97,7 +97,7 @@ bool nthread_recv_turns(bool *pfSendAsync) #ifdef __3DS__ return false; #else - if (!SNetReceiveTurns(0, MAX_PLRS, (char **)glpMsgTbl, gdwMsgLenTbl, (LPDWORD)player_state)) { + if (!SNetReceiveTurns(0, MAX_PLRS, (char **)glpMsgTbl, gdwMsgLenTbl, &player_state[0])) { if (SErrGetLastError() != STORM_ERROR_NO_MESSAGES_WAITING) nthread_terminate_game("SNetReceiveTurns"); sgbTicsOutOfSync = false; diff --git a/Source/objects.cpp b/Source/objects.cpp index b01318c6e..49a3e5254 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -4542,7 +4542,7 @@ void OperateBookCase(int pnum, int i, bool sendmsg) if (QuestStatus(Q_ZHAR) && monster[MAX_PLRS]._mmode == MM_STAND // prevents playing the "angry" message for the second time if zhar got aggroed by losing vision and talking again && monster[MAX_PLRS]._uniqtype - 1 == UMT_ZHAR - && monster[MAX_PLRS]._msquelch == UCHAR_MAX + && monster[MAX_PLRS]._msquelch == UINT8_MAX && monster[MAX_PLRS]._mhitpoints) { monster[MAX_PLRS].mtalkmsg = TEXT_ZHAR2; M_StartStand(0, monster[MAX_PLRS]._mdir); diff --git a/Source/storm/storm.h b/Source/storm/storm.h index 866ecfb90..db6057aa9 100644 --- a/Source/storm/storm.h +++ b/Source/storm/storm.h @@ -248,7 +248,7 @@ bool WINAPI SFileOpenArchive(const char *szMpqName, DWORD dwPriority, DWORD dwFl bool WINAPI SFileCloseArchive(HANDLE hArchive); bool WINAPI SFileOpenFileEx(HANDLE hMpq, const char *szFileName, DWORD dwSearchScope, HANDLE *phFile); bool WINAPI SFileReadFile(HANDLE hFile, void *buffer, DWORD nNumberOfBytesToRead, DWORD *read, LONG *lpDistanceToMoveHigh); -DWORD WINAPI SFileGetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh); +DWORD WINAPI SFileGetFileSize(HANDLE hFile, uint32_t *lpFileSizeHigh); DWORD WINAPI SFileSetFilePointer(HANDLE, int, int *, int); bool WINAPI SFileCloseFile(HANDLE hFile); diff --git a/Source/sync.cpp b/Source/sync.cpp index 70208a706..fe151c98b 100644 --- a/Source/sync.cpp +++ b/Source/sync.cpp @@ -237,7 +237,7 @@ static void sync_monster(int pnum, const TSyncMonster *p) M_ClearSquares(ndx); dMonster[monster[ndx].position.tile.x][monster[ndx].position.tile.y] = ndx + 1; M_WalkDir(ndx, md); - monster[ndx]._msquelch = UCHAR_MAX; + monster[ndx]._msquelch = UINT8_MAX; } } } else if (dMonster[p->_mx][p->_my] == 0) { @@ -247,7 +247,7 @@ static void sync_monster(int pnum, const TSyncMonster *p) decode_enemy(ndx, p->_menemy); direction md = GetDirection({ p->_mx, p->_my }, monster[ndx].enemyPosition); M_StartStand(ndx, md); - monster[ndx]._msquelch = UCHAR_MAX; + monster[ndx]._msquelch = UINT8_MAX; } decode_enemy(ndx, p->_menemy);