Browse Source

🔥 Remove a chunk of miniwin types

pull/1763/head
Anders Jenbo 5 years ago
parent
commit
3b04f67194
  1. 9
      Source/DiabloUI/diabloui.h
  2. 10
      Source/diablo.cpp
  3. 4
      Source/diablo.h
  4. 2
      Source/init.cpp
  5. 2
      Source/init.h
  6. 2
      Source/interfac.cpp
  7. 4
      Source/loadsave.cpp
  8. 34
      Source/miniwin/miniwin.h
  9. 25
      Source/miniwin/misc_msg.cpp
  10. 2
      Source/missiles.cpp
  11. 44
      Source/monster.cpp
  12. 2
      Source/movie.cpp
  13. 4
      Source/msg.cpp
  14. 6
      Source/multi.cpp
  15. 2
      Source/multi.h
  16. 2
      Source/nthread.cpp
  17. 2
      Source/objects.cpp
  18. 2
      Source/storm/storm.h
  19. 4
      Source/sync.cpp

9
Source/DiabloUI/diabloui.h

@ -103,15 +103,6 @@ bool UiCreditsDialog();
bool UiSupportDialog(); bool UiSupportDialog();
bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, void (*fnSound)(const char *file), int attractTimeOut); bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, void (*fnSound)(const char *file), int attractTimeOut);
bool UiProgressDialog(const char *msg, int (*fnfunc)()); 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 UiSelectGame(GameData *gameData, int *playerId);
bool UiSelectProvider(GameData *gameData); bool UiSelectProvider(GameData *gameData);
void UiFadeIn(); void UiFadeIn();

10
Source/diablo.cpp

@ -363,7 +363,7 @@ static bool ProcessInput()
static void run_game_loop(interface_mode uMsg) static void run_game_loop(interface_mode uMsg)
{ {
WNDPROC saveProc; WNDPROC saveProc;
MSG msg; tagMSG msg;
nthread_ignore_mutex(true); nthread_ignore_mutex(true);
start_game(uMsg); 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++ * @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) { if (gmenu_is_active() || control_talk_last_key(vkey) || sgnTimeoutCurs != CURSOR_NONE || deathflag) {
return; 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); MouseX = (short)(lParam & 0xffff);
MouseY = (short)((lParam >> 16) & 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) { switch (uMsg) {
case DVL_WM_KEYDOWN: case DVL_WM_KEYDOWN:
@ -1624,7 +1624,7 @@ void DisableInputWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
MainWndProc(uMsg); 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) { switch (uMsg) {
case DVL_WM_KEYDOWN: case DVL_WM_KEYDOWN:

4
Source/diablo.h

@ -55,8 +55,8 @@ int DiabloMain(int argc, char **argv);
bool TryIconCurs(); bool TryIconCurs();
void diablo_pause_game(); void diablo_pause_game();
bool PressEscKey(); bool PressEscKey();
void DisableInputWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam); void DisableInputWndProc(uint32_t uMsg, int32_t wParam, int32_t lParam);
void GM_Game(UINT uMsg, WPARAM wParam, LPARAM lParam); void GM_Game(uint32_t uMsg, int32_t wParam, int32_t lParam);
void LoadGameLevel(bool firstflag, lvl_entry lvldir); void LoadGameLevel(bool firstflag, lvl_entry lvldir);
void game_loop(bool bStartup); void game_loop(bool bStartup);
void diablo_color_cyc_logic(); void diablo_color_cyc_logic();

2
Source/init.cpp

@ -230,7 +230,7 @@ void init_create_window()
#endif #endif
} }
void MainWndProc(UINT Msg) void MainWndProc(uint32_t Msg)
{ {
switch (Msg) { switch (Msg) {
case DVL_WM_PAINT: case DVL_WM_PAINT:

2
Source/init.h

@ -30,7 +30,7 @@ extern HANDLE devilutionx_mpq;
void init_cleanup(); void init_cleanup();
void init_archives(); void init_archives();
void init_create_window(); void init_create_window();
void MainWndProc(UINT Msg); void MainWndProc(uint32_t Msg);
WNDPROC SetWindowProc(WNDPROC NewProc); WNDPROC SetWindowProc(WNDPROC NewProc);
/* data */ /* data */

2
Source/interfac.cpp

@ -190,7 +190,7 @@ static void DrawCutscene()
void interface_msg_pump() void interface_msg_pump()
{ {
MSG Msg; tagMSG Msg;
while (FetchMessage(&Msg)) { while (FetchMessage(&Msg)) {
if (Msg.message != DVL_WM_QUIT) { if (Msg.message != DVL_WM_QUIT) {

4
Source/loadsave.cpp

@ -1580,10 +1580,10 @@ static void SaveMonster(SaveHelper *file, int i)
file->skip(1); // Alignment file->skip(1); // Alignment
file->writeLE<uint16_t>(pMonster->mExp); file->writeLE<uint16_t>(pMonster->mExp);
file->writeLE<uint8_t>(pMonster->mHit < UCHAR_MAX ? pMonster->mHit : UCHAR_MAX); // For backwards compatibility file->writeLE<uint8_t>(pMonster->mHit < UINT8_MAX ? pMonster->mHit : UINT8_MAX); // For backwards compatibility
file->writeLE<uint8_t>(pMonster->mMinDamage); file->writeLE<uint8_t>(pMonster->mMinDamage);
file->writeLE<uint8_t>(pMonster->mMaxDamage); file->writeLE<uint8_t>(pMonster->mMaxDamage);
file->writeLE<uint8_t>(pMonster->mHit2 < UCHAR_MAX ? pMonster->mHit2 : UCHAR_MAX); // For backwards compatibility file->writeLE<uint8_t>(pMonster->mHit2 < UINT8_MAX ? pMonster->mHit2 : UINT8_MAX); // For backwards compatibility
file->writeLE<uint8_t>(pMonster->mMinDamage2); file->writeLE<uint8_t>(pMonster->mMinDamage2);
file->writeLE<uint8_t>(pMonster->mMaxDamage2); file->writeLE<uint8_t>(pMonster->mMaxDamage2);
file->writeLE<uint8_t>(pMonster->mArmorClass); file->writeLE<uint8_t>(pMonster->mArmorClass);

34
Source/miniwin/miniwin.h

@ -15,6 +15,7 @@ namespace devilution {
#ifndef MAX_PATH #ifndef MAX_PATH
#define MAX_PATH 260 #define MAX_PATH 260
#endif #endif
#ifdef __has_attribute #ifdef __has_attribute
#define DVL_HAVE_ATTRIBUTE(x) __has_attribute(x) #define DVL_HAVE_ATTRIBUTE(x) __has_attribute(x)
#else #else
@ -28,37 +29,24 @@ namespace devilution {
#define DVL_PRINTF_ATTRIBUTE(fmtargnum) #define DVL_PRINTF_ATTRIBUTE(fmtargnum)
#endif #endif
typedef uint16_t SHORT;
typedef int32_t LONG; typedef int32_t LONG;
typedef unsigned char UCHAR;
typedef uint32_t DWORD; typedef uint32_t DWORD;
typedef unsigned char BYTE; typedef unsigned char BYTE;
typedef unsigned short WORD; 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 // Handles
// //
typedef void *HANDLE; typedef void *HANDLE;
typedef HANDLE HMODULE, HDC, HINSTANCE; typedef void (*WNDPROC)(uint32_t, int32_t, int32_t);
typedef void (*WNDPROC)(UINT, WPARAM, LPARAM);
typedef struct tagMSG { typedef struct tagMSG {
UINT message; uint32_t message;
WPARAM wParam; int32_t wParam;
LPARAM lParam; int32_t lParam;
} MSG, *LPMSG; };
// //
// Everything else // Everything else
@ -67,13 +55,13 @@ typedef struct tagMSG {
void SetCursorPos(int X, int Y); void SetCursorPos(int X, int Y);
void FocusOnCharInfo(); void FocusOnCharInfo();
SHORT GetAsyncKeyState(int vKey); uint16_t GetAsyncKeyState(int vKey);
bool FetchMessage(LPMSG lpMsg); bool FetchMessage(tagMSG *lpMsg);
bool TranslateMessage(const MSG *lpMsg); bool TranslateMessage(const tagMSG *lpMsg);
void PushMessage(const MSG *lpMsg); void PushMessage(const tagMSG *lpMsg);
bool PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam); bool PostMessage(uint32_t Msg, int32_t wParam, int32_t lParam);
#ifdef _MSC_VER #ifdef _MSC_VER
#define strcasecmp _stricmp #define strcasecmp _stricmp

25
Source/miniwin/misc_msg.cpp

@ -16,6 +16,8 @@
#include "utils/sdl_compat.h" #include "utils/sdl_compat.h"
#include "utils/stubs.h" #include "utils/stubs.h"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "miniwin/miniwin.h"
#ifdef __SWITCH__ #ifdef __SWITCH__
#include "platform/switch/docking.h" #include "platform/switch/docking.h"
@ -29,7 +31,7 @@
namespace devilution { namespace devilution {
static std::deque<MSG> message_queue; static std::deque<tagMSG> message_queue;
bool mouseWarping = false; bool mouseWarping = false;
int mouseWarpingX; int mouseWarpingX;
@ -252,12 +254,12 @@ static int TranslateSdlKey(SDL_Keysym key)
namespace { namespace {
LPARAM PositionForMouse(short x, short y) int32_t PositionForMouse(short x, short y)
{ {
return (((uint16_t)(y & 0xFFFF)) << 16) | (uint16_t)(x & 0xFFFF); 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; ret |= (SDL_GetModState() & KMOD_SHIFT) ? DVL_MK_SHIFT : 0;
// XXX: other DVL_MK_* codes not implemented // XXX: other DVL_MK_* codes not implemented
@ -294,7 +296,7 @@ bool BlurInventory()
return true; return true;
} }
bool FetchMessage(LPMSG lpMsg) bool FetchMessage(tagMSG *lpMsg)
{ {
#ifdef __SWITCH__ #ifdef __SWITCH__
HandleDocking(); HandleDocking();
@ -575,7 +577,7 @@ bool FetchMessage(LPMSG lpMsg)
return true; return true;
} }
bool TranslateMessage(const MSG *lpMsg) bool TranslateMessage(const tagMSG *lpMsg)
{ {
if (lpMsg->message == DVL_WM_KEYDOWN) { if (lpMsg->message == DVL_WM_KEYDOWN) {
int key = lpMsg->wParam; int key = lpMsg->wParam;
@ -681,7 +683,7 @@ bool TranslateMessage(const MSG *lpMsg)
return true; return true;
} }
SHORT GetAsyncKeyState(int vKey) uint16_t GetAsyncKeyState(int vKey)
{ {
if (vKey == DVL_MK_LBUTTON) if (vKey == DVL_MK_LBUTTON)
return SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON(SDL_BUTTON_LEFT); 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); assert(CurrentProc);
CurrentProc(lpMsg->message, lpMsg->wParam, lpMsg->lParam); 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_queue.push_back({type, wParam, lParam});
message.message = type;
message.wParam = wParam;
message.lParam = lParam;
message_queue.push_back(message);
return true; return true;
} }

2
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) { if (monster[m]._msquelch == 0) {
monster[m]._msquelch = UCHAR_MAX; monster[m]._msquelch = UINT8_MAX;
monster[m].position.last = plr[pnum].position.tile; monster[m].position.last = plr[pnum].position.tile;
} }
return true; return true;

44
Source/monster.cpp

@ -2465,7 +2465,7 @@ bool M_DoTalk(int i)
if (monster[i]._uniqtype - 1 == UMT_LAZURUS && gbIsMultiplayer) { if (monster[i]._uniqtype - 1 == UMT_LAZURUS && gbIsMultiplayer) {
quests[Q_BETRAYER]._qvar1 = 6; quests[Q_BETRAYER]._qvar1 = 6;
monster[i]._mgoal = MGOAL_NORMAL; monster[i]._mgoal = MGOAL_NORMAL;
monster[i]._msquelch = UCHAR_MAX; monster[i]._msquelch = UINT8_MAX;
monster[i].mtalkmsg = 0; monster[i].mtalkmsg = 0;
} }
return false; return false;
@ -3439,10 +3439,10 @@ void MAI_Round(int i, bool special)
mx = Monst->position.tile.x - fx; mx = Monst->position.tile.x - fx;
my = Monst->position.tile.y - fy; my = Monst->position.tile.y - fy;
direction md = GetDirection(Monst->position.tile, Monst->position.last); direction md = GetDirection(Monst->position.tile, Monst->position.last);
if (Monst->_msquelch < UCHAR_MAX) if (Monst->_msquelch < UINT8_MAX)
MonstCheckDoors(i); MonstCheckDoors(i);
v = GenerateRnd(100); 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 || ((abs(mx) >= 4 || abs(my) >= 4) && GenerateRnd(4) == 0)) {
if (Monst->_mgoal != MGOAL_MOVE) { if (Monst->_mgoal != MGOAL_MOVE) {
Monst->_mgoalvar1 = 0; Monst->_mgoalvar1 = 0;
@ -3499,13 +3499,13 @@ void MAI_Ranged(int i, int missile_type, bool special)
} }
Monst = &monster[i]; 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; fx = Monst->enemyPosition.x;
fy = Monst->enemyPosition.y; fy = Monst->enemyPosition.y;
mx = Monst->position.tile.x - fx; mx = Monst->position.tile.x - fx;
my = Monst->position.tile.y - fy; my = Monst->position.tile.y - fy;
direction md = M_GetDir(i); direction md = M_GetDir(i);
if (Monst->_msquelch < UCHAR_MAX) if (Monst->_msquelch < UINT8_MAX)
MonstCheckDoors(i); MonstCheckDoors(i);
Monst->_mdir = md; Monst->_mdir = md;
if (Monst->_mVar1 == MM_RATTACK) { 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; mx = Monst->position.tile.x - fx;
my = Monst->position.tile.y - fy; my = Monst->position.tile.y - fy;
direction md = GetDirection(Monst->position.tile, Monst->position.last); direction md = GetDirection(Monst->position.tile, Monst->position.last);
if (checkdoors && Monst->_msquelch < UCHAR_MAX) if (checkdoors && Monst->_msquelch < UINT8_MAX)
MonstCheckDoors(i); MonstCheckDoors(i);
v = GenerateRnd(10000); v = GenerateRnd(10000);
dist = std::max(abs(mx), abs(my)); 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 || (dist >= 3 && GenerateRnd(4 << lessmissiles) == 0)) {
if (Monst->_mgoal != MGOAL_MOVE) { if (Monst->_mgoal != MGOAL_MOVE) {
Monst->_mgoalvar1 = 0; Monst->_mgoalvar1 = 0;
@ -3819,11 +3819,11 @@ void MAI_RR2(int i, int mistype, int dam)
mx = Monst->position.tile.x - fx; mx = Monst->position.tile.x - fx;
my = Monst->position.tile.y - fy; my = Monst->position.tile.y - fy;
direction md = GetDirection(Monst->position.tile, Monst->position.last); direction md = GetDirection(Monst->position.tile, Monst->position.last);
if (Monst->_msquelch < UCHAR_MAX) if (Monst->_msquelch < UINT8_MAX)
MonstCheckDoors(i); MonstCheckDoors(i);
v = GenerateRnd(100); v = GenerateRnd(100);
dist = std::max(abs(mx), abs(my)); 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 || dist >= 3) {
if (Monst->_mgoal != MGOAL_MOVE) { if (Monst->_mgoal != MGOAL_MOVE) {
Monst->_mgoalvar1 = 0; Monst->_mgoalvar1 = 0;
@ -3906,13 +3906,13 @@ void MAI_Golum(int i)
_menemy = monster[i]._menemy; _menemy = monster[i]._menemy;
monster[i].enemyPosition = monster[_menemy].position.tile; monster[i].enemyPosition = monster[_menemy].position.tile;
if (monster[_menemy]._msquelch == 0) { 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; monster[monster[i]._menemy].position.last = monster[i].position.tile;
for (int j = 0; j < 5; j++) { for (int j = 0; j < 5; j++) {
for (int k = 0; k < 5; k++) { for (int k = 0; k < 5; k++) {
_menemy = dMonster[monster[i].position.tile.x + k - 2][monster[i].position.tile.y + j - 2]; _menemy = dMonster[monster[i].position.tile.x + k - 2][monster[i].position.tile.y + j - 2];
if (_menemy > 0) 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; mx = Monst->position.tile.x - fx;
my = Monst->position.tile.y - fy; my = Monst->position.tile.y - fy;
direction md = GetDirection(Monst->position.tile, Monst->position.last); direction md = GetDirection(Monst->position.tile, Monst->position.last);
if (Monst->_msquelch < UCHAR_MAX) if (Monst->_msquelch < UINT8_MAX)
MonstCheckDoors(i); MonstCheckDoors(i);
v = GenerateRnd(100); v = GenerateRnd(100);
dist = std::max(abs(mx), abs(my)); 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 || ((abs(mx) >= 3 || abs(my) >= 3) && GenerateRnd(4) == 0)) {
if (Monst->_mgoal != MGOAL_MOVE) { if (Monst->_mgoal != MGOAL_MOVE) {
Monst->_mgoalvar1 = 0; Monst->_mgoalvar1 = 0;
@ -4017,7 +4017,7 @@ void MAI_Rhino(int i)
mx = Monst->position.tile.x - fx; mx = Monst->position.tile.x - fx;
my = Monst->position.tile.y - fy; my = Monst->position.tile.y - fy;
direction md = GetDirection(Monst->position.tile, Monst->position.last); direction md = GetDirection(Monst->position.tile, Monst->position.last);
if (Monst->_msquelch < UCHAR_MAX) if (Monst->_msquelch < UINT8_MAX)
MonstCheckDoors(i); MonstCheckDoors(i);
v = GenerateRnd(100); v = GenerateRnd(100);
dist = std::max(abs(mx), abs(my)); dist = std::max(abs(mx), abs(my));
@ -4154,7 +4154,7 @@ void MAI_Counselor(int i)
mx = Monst->position.tile.x - fx; mx = Monst->position.tile.x - fx;
my = Monst->position.tile.y - fy; my = Monst->position.tile.y - fy;
direction md = GetDirection(Monst->position.tile, Monst->position.last); direction md = GetDirection(Monst->position.tile, Monst->position.last);
if (Monst->_msquelch < UCHAR_MAX) if (Monst->_msquelch < UINT8_MAX)
MonstCheckDoors(i); MonstCheckDoors(i);
v = GenerateRnd(100); v = GenerateRnd(100);
if (Monst->_mgoal == MGOAL_RETREAT) { if (Monst->_mgoal == MGOAL_RETREAT) {
@ -4166,7 +4166,7 @@ void MAI_Counselor(int i)
} }
} else if (Monst->_mgoal == MGOAL_MOVE) { } else if (Monst->_mgoal == MGOAL_MOVE) {
dist = std::max(abs(mx), abs(my)); 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)) { if (Monst->_mgoalvar1++ < 2 * dist || !DirOK(i, md)) {
M_RoundWalk(i, md, &Monst->_mgoalvar2); M_RoundWalk(i, md, &Monst->_mgoalvar2);
} else { } else {
@ -4246,7 +4246,7 @@ void MAI_Garbud(int i)
if (Monst->mtalkmsg == TEXT_GARBUD4) { if (Monst->mtalkmsg == TEXT_GARBUD4) {
if (!effect_is_playing(USFX_GARBUD4) && Monst->_mgoal == MGOAL_TALKING) { if (!effect_is_playing(USFX_GARBUD4) && Monst->_mgoal == MGOAL_TALKING) {
Monst->_mgoal = MGOAL_NORMAL; Monst->_mgoal = MGOAL_NORMAL;
Monst->_msquelch = UCHAR_MAX; Monst->_msquelch = UINT8_MAX;
Monst->mtalkmsg = 0; Monst->mtalkmsg = 0;
} }
} }
@ -4284,7 +4284,7 @@ void MAI_Zhar(int i)
if (dFlags[mx][my] & BFLAG_VISIBLE) { if (dFlags[mx][my] & BFLAG_VISIBLE) {
if (Monst->mtalkmsg == TEXT_ZHAR2) { if (Monst->mtalkmsg == TEXT_ZHAR2) {
if (!effect_is_playing(USFX_ZHAR2) && Monst->_mgoal == MGOAL_TALKING) { if (!effect_is_playing(USFX_ZHAR2) && Monst->_mgoal == MGOAL_TALKING) {
Monst->_msquelch = UCHAR_MAX; Monst->_msquelch = UINT8_MAX;
Monst->mtalkmsg = 0; Monst->mtalkmsg = 0;
Monst->_mgoal = MGOAL_NORMAL; 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); ObjChangeMap(setpc_x, setpc_y, setpc_x + setpc_w + 1, setpc_y + setpc_h + 1);
quests[Q_LTBANNER]._qvar1 = 3; quests[Q_LTBANNER]._qvar1 = 3;
RedoPlayerVision(); RedoPlayerVision();
Monst->_msquelch = UCHAR_MAX; Monst->_msquelch = UINT8_MAX;
Monst->mtalkmsg = 0; Monst->mtalkmsg = 0;
Monst->_mgoal = MGOAL_NORMAL; Monst->_mgoal = MGOAL_NORMAL;
} }
@ -4377,7 +4377,7 @@ void MAI_Lazurus(int i)
RedoPlayerVision(); RedoPlayerVision();
quests[Q_BETRAYER]._qvar1 = 6; quests[Q_BETRAYER]._qvar1 = 6;
Monst->_mgoal = MGOAL_NORMAL; Monst->_mgoal = MGOAL_NORMAL;
Monst->_msquelch = UCHAR_MAX; Monst->_msquelch = UINT8_MAX;
Monst->mtalkmsg = 0; Monst->mtalkmsg = 0;
} }
} }
@ -4491,7 +4491,7 @@ void MAI_Warlord(int i)
if (Monst->mtalkmsg == TEXT_WARLRD9 && Monst->_mgoal == MGOAL_INQUIRING) if (Monst->mtalkmsg == TEXT_WARLRD9 && Monst->_mgoal == MGOAL_INQUIRING)
Monst->_mmode = MM_TALK; Monst->_mmode = MM_TALK;
if (Monst->mtalkmsg == TEXT_WARLRD9 && !effect_is_playing(USFX_WARLRD1) && Monst->_mgoal == MGOAL_TALKING) { 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->mtalkmsg = 0;
Monst->_mgoal = MGOAL_NORMAL; Monst->_mgoal = MGOAL_NORMAL;
} }
@ -4585,7 +4585,7 @@ void ProcessMonsters()
assurance((DWORD)_menemy < MAX_PLRS, _menemy); assurance((DWORD)_menemy < MAX_PLRS, _menemy);
Monst->enemyPosition = plr[Monst->_menemy].position.future; Monst->enemyPosition = plr[Monst->_menemy].position.future;
if (dFlags[mx][my] & BFLAG_VISIBLE) { if (dFlags[mx][my] & BFLAG_VISIBLE) {
Monst->_msquelch = UCHAR_MAX; Monst->_msquelch = UINT8_MAX;
Monst->position.last = plr[Monst->_menemy].position.future; Monst->position.last = plr[Monst->_menemy].position.future;
} else if (Monst->_msquelch != 0 && Monst->MType->mtype != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype' } else if (Monst->_msquelch != 0 && Monst->MType->mtype != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype'
Monst->_msquelch--; Monst->_msquelch--;

2
Source/movie.cpp

@ -38,7 +38,7 @@ void play_movie(const char *pszMovie, bool user_can_close)
#endif #endif
SVidPlayBegin(pszMovie, loop_movie ? 0x100C0808 : 0x10280808, &video_stream); SVidPlayBegin(pszMovie, loop_movie ? 0x100C0808 : 0x10280808, &video_stream);
MSG Msg; tagMSG Msg;
while (video_stream != nullptr && movie_playing) { while (video_stream != nullptr && movie_playing) {
while (movie_playing && FetchMessage(&Msg)) { while (movie_playing && FetchMessage(&Msg)) {
switch (Msg.message) { switch (Msg.message) {

4
Source/msg.cpp

@ -477,7 +477,7 @@ void delta_sync_monster(const TSyncMonster *pSync, BYTE bLevel)
pD->_mx = pSync->_mx; pD->_mx = pSync->_mx;
pD->_my = pSync->_my; pD->_my = pSync->_my;
pD->_mactive = UCHAR_MAX; pD->_mactive = UINT8_MAX;
pD->_menemy = pSync->_menemy; pD->_menemy = pSync->_menemy;
} }
@ -490,7 +490,7 @@ void delta_sync_golem(TCmdGolem *pG, int pnum, BYTE bLevel)
DMonsterStr *pD = &sgLevels[bLevel].monster[pnum]; DMonsterStr *pD = &sgLevels[bLevel].monster[pnum];
pD->_mx = pG->_mx; pD->_mx = pG->_mx;
pD->_my = pG->_my; pD->_my = pG->_my;
pD->_mactive = UCHAR_MAX; pD->_mactive = UINT8_MAX;
pD->_menemy = pG->_menemy; pD->_menemy = pG->_menemy;
pD->_mdir = pG->_mdir; pD->_mdir = pG->_mdir;
pD->_mhitpoints = pG->_mhitpoints; pD->_mhitpoints = pG->_mhitpoints;

6
Source/multi.cpp

@ -49,7 +49,7 @@ bool sgbTimeout;
char szPlayerName[128]; char szPlayerName[128];
BYTE gbDeltaSender; BYTE gbDeltaSender;
bool sgbNetInited; bool sgbNetInited;
int player_state[MAX_PLRS]; uint32_t player_state[MAX_PLRS];
/** /**
* Contains the set of supported event types supported by the multiplayer * 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() static void multi_begin_timeout()
{ {
int i, nTicks, nState, nLowestActive, nLowestPlayer; int i, nTicks, nLowestActive, nLowestPlayer;
BYTE bGroupPlayers, bGroupCount; BYTE bGroupPlayers, bGroupCount;
if (!sgbTimeout) { if (!sgbTimeout) {
@ -354,7 +354,7 @@ static void multi_begin_timeout()
bGroupPlayers = 0; bGroupPlayers = 0;
bGroupCount = 0; bGroupCount = 0;
for (i = 0; i < MAX_PLRS; i++) { for (i = 0; i < MAX_PLRS; i++) {
nState = player_state[i]; uint32_t nState = player_state[i];
if ((nState & PS_CONNECTED) != 0) { if ((nState & PS_CONNECTED) != 0) {
if (nLowestPlayer == -1) { if (nLowestPlayer == -1) {
nLowestPlayer = i; nLowestPlayer = i;

2
Source/multi.h

@ -45,7 +45,7 @@ extern bool gbSelectProvider;
extern bool gbIsMultiplayer; extern bool gbIsMultiplayer;
extern char szPlayerName[128]; extern char szPlayerName[128];
extern BYTE gbDeltaSender; 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 multi_msg_add(BYTE *pbMsg, BYTE bLen);
void NetSendLoPri(int playerId, BYTE *pbMsg, BYTE bLen); void NetSendLoPri(int playerId, BYTE *pbMsg, BYTE bLen);

2
Source/nthread.cpp

@ -97,7 +97,7 @@ bool nthread_recv_turns(bool *pfSendAsync)
#ifdef __3DS__ #ifdef __3DS__
return false; return false;
#else #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) if (SErrGetLastError() != STORM_ERROR_NO_MESSAGES_WAITING)
nthread_terminate_game("SNetReceiveTurns"); nthread_terminate_game("SNetReceiveTurns");
sgbTicsOutOfSync = false; sgbTicsOutOfSync = false;

2
Source/objects.cpp

@ -4542,7 +4542,7 @@ void OperateBookCase(int pnum, int i, bool sendmsg)
if (QuestStatus(Q_ZHAR) 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]._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]._uniqtype - 1 == UMT_ZHAR
&& monster[MAX_PLRS]._msquelch == UCHAR_MAX && monster[MAX_PLRS]._msquelch == UINT8_MAX
&& monster[MAX_PLRS]._mhitpoints) { && monster[MAX_PLRS]._mhitpoints) {
monster[MAX_PLRS].mtalkmsg = TEXT_ZHAR2; monster[MAX_PLRS].mtalkmsg = TEXT_ZHAR2;
M_StartStand(0, monster[MAX_PLRS]._mdir); M_StartStand(0, monster[MAX_PLRS]._mdir);

2
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 SFileCloseArchive(HANDLE hArchive);
bool WINAPI SFileOpenFileEx(HANDLE hMpq, const char *szFileName, DWORD dwSearchScope, HANDLE *phFile); 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); 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); DWORD WINAPI SFileSetFilePointer(HANDLE, int, int *, int);
bool WINAPI SFileCloseFile(HANDLE hFile); bool WINAPI SFileCloseFile(HANDLE hFile);

4
Source/sync.cpp

@ -237,7 +237,7 @@ static void sync_monster(int pnum, const TSyncMonster *p)
M_ClearSquares(ndx); M_ClearSquares(ndx);
dMonster[monster[ndx].position.tile.x][monster[ndx].position.tile.y] = ndx + 1; dMonster[monster[ndx].position.tile.x][monster[ndx].position.tile.y] = ndx + 1;
M_WalkDir(ndx, md); M_WalkDir(ndx, md);
monster[ndx]._msquelch = UCHAR_MAX; monster[ndx]._msquelch = UINT8_MAX;
} }
} }
} else if (dMonster[p->_mx][p->_my] == 0) { } 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); decode_enemy(ndx, p->_menemy);
direction md = GetDirection({ p->_mx, p->_my }, monster[ndx].enemyPosition); direction md = GetDirection({ p->_mx, p->_my }, monster[ndx].enemyPosition);
M_StartStand(ndx, md); M_StartStand(ndx, md);
monster[ndx]._msquelch = UCHAR_MAX; monster[ndx]._msquelch = UINT8_MAX;
} }
decode_enemy(ndx, p->_menemy); decode_enemy(ndx, p->_menemy);

Loading…
Cancel
Save