Browse Source

C++03 compatibility (#736)

* Use C++03 compatible constructors
* Remove conflicting definitions
pull/740/head
Anders Jenbo 6 years ago committed by GitHub
parent
commit
dc8be6c0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CMakeLists.txt
  2. 20
      Source/control.cpp
  3. 118
      Source/diablo.cpp
  4. 14
      Source/gmenu.cpp
  5. 10
      Source/init.cpp
  6. 2
      Source/interfac.cpp
  7. 10
      Source/movie.cpp
  8. 2
      Source/render.cpp
  9. 2
      Source/restrict.cpp
  10. 2
      Source/wave.cpp
  11. 5
      SourceS/miniwin.h
  12. 161
      SourceS/miniwin/misc.h
  13. 122
      SourceS/miniwin/misc_macro.h
  14. 19
      SourceX/DiabloUI/art.h
  15. 20
      SourceX/DiabloUI/credits.cpp
  16. 12
      SourceX/DiabloUI/diabloui.cpp
  17. 2
      SourceX/DiabloUI/dialogs.cpp
  18. 6
      SourceX/DiabloUI/scrollbar.h
  19. 2
      SourceX/DiabloUI/selhero.cpp
  20. 11
      SourceX/DiabloUI/text_draw.h
  21. 4
      SourceX/controls/controller_motion.cpp
  22. 6
      SourceX/controls/modifier_hints.cpp
  23. 14
      SourceX/controls/plrctrls.cpp
  24. 2
      SourceX/dvlnet/loopback.cpp
  25. 7
      SourceX/dvlnet/loopback.h
  26. 16
      SourceX/miniwin/misc_msg.cpp
  27. 14
      SourceX/storm/storm.cpp

3
CMakeLists.txt

@ -385,7 +385,6 @@ if(NOT NONET)
target_link_libraries(${BIN_TARGET} PRIVATE sodium)
endif()
target_compile_definitions(devilution PRIVATE DEVILUTION_ENGINE)
genex_for_option(DEBUG)
target_compile_definitions(devilution PUBLIC "$<${DEBUG_GENEX}:_DEBUG>")
target_compile_definitions(${BIN_TARGET} PRIVATE ASIO_STANDALONE)
@ -639,7 +638,7 @@ if(CPACK)
set(CPACK_PACKAGE_CONTACT "kai@gnukai.com")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
# -G RPM
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)

20
Source/control.cpp

@ -1941,14 +1941,14 @@ void control_drop_gold(char vkey)
memset(input, 0, sizeof(input));
snprintf(input, sizeof(input), "%d", dropGoldValue);
if (vkey == VK_RETURN) {
if (vkey == DVL_VK_RETURN) {
if (dropGoldValue > 0)
control_remove_gold(myplr, initialDropGoldIndex);
dropGoldFlag = FALSE;
} else if (vkey == VK_ESCAPE) {
} else if (vkey == DVL_VK_ESCAPE) {
dropGoldFlag = FALSE;
dropGoldValue = 0;
} else if (vkey == VK_BACK) {
} else if (vkey == DVL_VK_BACK) {
input[strlen(input) - 1] = '\0';
dropGoldValue = atoi(input);
} else if (vkey - '0' >= 0 && vkey - '0' <= 9) {
@ -2182,7 +2182,7 @@ BOOL control_talk_last_key(int vkey)
if (!talkflag)
return FALSE;
if ((DWORD)vkey < VK_SPACE)
if ((DWORD)vkey < DVL_VK_SPACE)
return FALSE;
result = strlen(sgszTalkMsg);
@ -2202,18 +2202,18 @@ BOOL control_presskeys(int vkey)
if (!talkflag) {
ret = FALSE;
} else {
if (vkey == VK_SPACE) {
} else if (vkey == VK_ESCAPE) {
if (vkey == DVL_VK_SPACE) {
} else if (vkey == DVL_VK_ESCAPE) {
control_reset_talk();
} else if (vkey == VK_RETURN) {
} else if (vkey == DVL_VK_RETURN) {
control_press_enter();
} else if (vkey == VK_BACK) {
} else if (vkey == DVL_VK_BACK) {
len = strlen(sgszTalkMsg);
if (len > 0)
sgszTalkMsg[len - 1] = '\0';
} else if (vkey == VK_DOWN) {
} else if (vkey == DVL_VK_DOWN) {
control_up_down(1);
} else if (vkey == VK_UP) {
} else if (vkey == DVL_VK_UP) {
control_up_down(-1);
} else {
return FALSE;

118
Source/diablo.cpp

@ -190,7 +190,7 @@ void run_game_loop(unsigned int uMsg)
while (gbRunGame) {
while (PeekMessage(&msg)) {
if (msg.message == WM_QUIT) {
if (msg.message == DVL_WM_QUIT) {
gbRunGameResult = FALSE;
gbRunGame = FALSE;
break;
@ -492,7 +492,7 @@ BOOL PressEscKey()
rv = TRUE;
}
if (dropGoldFlag) {
control_drop_gold(VK_ESCAPE);
control_drop_gold(DVL_VK_ESCAPE);
rv = TRUE;
}
if (spselflag) {
@ -512,35 +512,35 @@ static void GetMousePos(LPARAM lParam)
LRESULT DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_KEYDOWN:
case WM_KEYUP:
case WM_CHAR:
case WM_SYSKEYDOWN:
case WM_SYSCOMMAND:
case WM_MOUSEMOVE:
case DVL_WM_KEYDOWN:
case DVL_WM_KEYUP:
case DVL_WM_CHAR:
case DVL_WM_SYSKEYDOWN:
case DVL_WM_SYSCOMMAND:
case DVL_WM_MOUSEMOVE:
GetMousePos(lParam);
return 0;
case WM_LBUTTONDOWN:
case DVL_WM_LBUTTONDOWN:
if (sgbMouseDown != 0)
return 0;
sgbMouseDown = 1;
return 0;
case WM_LBUTTONUP:
case DVL_WM_LBUTTONUP:
if (sgbMouseDown != 1)
return 0;
sgbMouseDown = 0;
return 0;
case WM_RBUTTONDOWN:
case DVL_WM_RBUTTONDOWN:
if (sgbMouseDown != 0)
return 0;
sgbMouseDown = 2;
return 0;
case WM_RBUTTONUP:
case DVL_WM_RBUTTONUP:
if (sgbMouseDown != 2)
return 0;
sgbMouseDown = 0;
return 0;
case WM_CAPTURECHANGED:
case DVL_WM_CAPTURECHANGED:
if (hWnd == (HWND)lParam)
return 0;
sgbMouseDown = 0;
@ -553,38 +553,38 @@ LRESULT DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_KEYDOWN:
case DVL_WM_KEYDOWN:
PressKey(wParam);
return 0;
case WM_KEYUP:
case DVL_WM_KEYUP:
ReleaseKey(wParam);
return 0;
case WM_CHAR:
case DVL_WM_CHAR:
PressChar(wParam);
return 0;
case WM_SYSKEYDOWN:
case DVL_WM_SYSKEYDOWN:
if (PressSysKey(wParam))
return 0;
break;
case WM_SYSCOMMAND:
if (wParam == SC_CLOSE) {
case DVL_WM_SYSCOMMAND:
if (wParam == DVL_SC_CLOSE) {
gbRunGame = FALSE;
gbRunGameResult = FALSE;
return 0;
}
break;
case WM_MOUSEMOVE:
case DVL_WM_MOUSEMOVE:
GetMousePos(lParam);
gmenu_on_mouse_move();
return 0;
case WM_LBUTTONDOWN:
case DVL_WM_LBUTTONDOWN:
GetMousePos(lParam);
if (sgbMouseDown == 0) {
sgbMouseDown = 1;
track_repeat_walk(LeftMouseDown(wParam));
}
return 0;
case WM_LBUTTONUP:
case DVL_WM_LBUTTONUP:
GetMousePos(lParam);
if (sgbMouseDown == 1) {
sgbMouseDown = 0;
@ -592,20 +592,20 @@ LRESULT GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
track_repeat_walk(FALSE);
}
return 0;
case WM_RBUTTONDOWN:
case DVL_WM_RBUTTONDOWN:
GetMousePos(lParam);
if (sgbMouseDown == 0) {
sgbMouseDown = 2;
RightMouseDown();
}
return 0;
case WM_RBUTTONUP:
case DVL_WM_RBUTTONUP:
GetMousePos(lParam);
if (sgbMouseDown == 2) {
sgbMouseDown = 0;
}
return 0;
case WM_CAPTURECHANGED:
case DVL_WM_CAPTURECHANGED:
if (hWnd != (HWND)lParam) {
sgbMouseDown = 0;
track_repeat_walk(FALSE);
@ -675,7 +675,7 @@ BOOL LeftMouseDown(int wParam)
if (plr[myplr]._pStatPts != 0 && !spselflag)
CheckLvlBtn();
if (!lvlbtndown)
return LeftMouseCmd(wParam == MK_SHIFT + MK_LBUTTON);
return LeftMouseCmd(wParam == DVL_MK_SHIFT + DVL_MK_LBUTTON);
}
}
} else {
@ -835,7 +835,7 @@ void RightMouseDown()
BOOL PressSysKey(int wParam)
{
if (gmenu_is_active() || wParam != VK_F10)
if (gmenu_is_active() || wParam != DVL_VK_F10)
return FALSE;
diablo_hotkey_msg(1);
return TRUE;
@ -860,7 +860,7 @@ void diablo_hotkey_msg(DWORD dwMsg)
void ReleaseKey(int vkey)
{
if (vkey == VK_SNAPSHOT)
if (vkey == DVL_VK_SNAPSHOT)
CaptureScreen();
}
@ -874,26 +874,26 @@ void PressKey(int vkey)
if (sgnTimeoutCurs != CURSOR_NONE) {
return;
}
if (vkey == VK_F9) {
if (vkey == DVL_VK_F9) {
diablo_hotkey_msg(0);
}
if (vkey == VK_F10) {
if (vkey == DVL_VK_F10) {
diablo_hotkey_msg(1);
}
if (vkey == VK_F11) {
if (vkey == DVL_VK_F11) {
diablo_hotkey_msg(2);
}
if (vkey == VK_F12) {
if (vkey == DVL_VK_F12) {
diablo_hotkey_msg(3);
}
if (vkey == VK_RETURN) {
if (vkey == DVL_VK_RETURN) {
control_type_message();
}
if (vkey != VK_ESCAPE) {
if (vkey != DVL_VK_ESCAPE) {
return;
}
}
if (vkey == VK_ESCAPE) {
if (vkey == DVL_VK_ESCAPE) {
if (!PressEscKey()) {
track_repeat_walk(FALSE);
gamemenu_on();
@ -904,7 +904,7 @@ void PressKey(int vkey)
if (sgnTimeoutCurs != CURSOR_NONE || dropGoldFlag) {
return;
}
if (vkey == VK_PAUSE) {
if (vkey == DVL_VK_PAUSE) {
diablo_pause_game();
return;
}
@ -912,8 +912,8 @@ void PressKey(int vkey)
return;
}
if (vkey == VK_RETURN) {
if (GetAsyncKeyState(VK_MENU) & 0x8000) {
if (vkey == DVL_VK_RETURN) {
if (GetAsyncKeyState(DVL_VK_MENU) & 0x8000) {
dx_reinit();
} else if (stextflag) {
STextEnter();
@ -922,7 +922,7 @@ void PressKey(int vkey)
} else {
control_type_message();
}
} else if (vkey == VK_F1) {
} else if (vkey == DVL_VK_F1) {
if (helpflag) {
helpflag = FALSE;
} else if (stextflag != STORE_NONE) {
@ -948,11 +948,11 @@ void PressKey(int vkey)
}
}
#ifdef _DEBUG
else if (vkey == VK_F2) {
else if (vkey == DVL_VK_F2) {
}
#endif
#ifdef _DEBUG
else if (vkey == VK_F3) {
else if (vkey == DVL_VK_F3) {
if (pcursitem != -1) {
sprintf(
tempstr,
@ -967,47 +967,47 @@ void PressKey(int vkey)
}
#endif
#ifdef _DEBUG
else if (vkey == VK_F4) {
else if (vkey == DVL_VK_F4) {
PrintDebugQuest();
}
#endif
else if (vkey == VK_F5) {
else if (vkey == DVL_VK_F5) {
if (spselflag) {
SetSpeedSpell(0);
return;
}
ToggleSpell(0);
return;
} else if (vkey == VK_F6) {
} else if (vkey == DVL_VK_F6) {
if (spselflag) {
SetSpeedSpell(1);
return;
}
ToggleSpell(1);
return;
} else if (vkey == VK_F7) {
} else if (vkey == DVL_VK_F7) {
if (spselflag) {
SetSpeedSpell(2);
return;
}
ToggleSpell(2);
return;
} else if (vkey == VK_F8) {
} else if (vkey == DVL_VK_F8) {
if (spselflag) {
SetSpeedSpell(3);
return;
}
ToggleSpell(3);
return;
} else if (vkey == VK_F9) {
} else if (vkey == DVL_VK_F9) {
diablo_hotkey_msg(0);
} else if (vkey == VK_F10) {
} else if (vkey == DVL_VK_F10) {
diablo_hotkey_msg(1);
} else if (vkey == VK_F11) {
} else if (vkey == DVL_VK_F11) {
diablo_hotkey_msg(2);
} else if (vkey == VK_F12) {
} else if (vkey == DVL_VK_F12) {
diablo_hotkey_msg(3);
} else if (vkey == VK_UP) {
} else if (vkey == DVL_VK_UP) {
if (stextflag) {
STextUp();
} else if (questlog) {
@ -1017,7 +1017,7 @@ void PressKey(int vkey)
} else if (automapflag) {
AutomapUp();
}
} else if (vkey == VK_DOWN) {
} else if (vkey == DVL_VK_DOWN) {
if (stextflag) {
STextDown();
} else if (questlog) {
@ -1027,25 +1027,25 @@ void PressKey(int vkey)
} else if (automapflag) {
AutomapDown();
}
} else if (vkey == VK_PRIOR) {
} else if (vkey == DVL_VK_PRIOR) {
if (stextflag) {
STextPrior();
}
} else if (vkey == VK_NEXT) {
} else if (vkey == DVL_VK_NEXT) {
if (stextflag) {
STextNext();
}
} else if (vkey == VK_LEFT) {
} else if (vkey == DVL_VK_LEFT) {
if (automapflag && !talkflag) {
AutomapLeft();
}
} else if (vkey == VK_RIGHT) {
} else if (vkey == DVL_VK_RIGHT) {
if (automapflag && !talkflag) {
AutomapRight();
}
} else if (vkey == VK_TAB) {
} else if (vkey == DVL_VK_TAB) {
DoAutoMap();
} else if (vkey == VK_SPACE) {
} else if (vkey == DVL_VK_SPACE) {
if (!chrflag && invflag && MouseX < 480 && MouseY < PANEL_TOP && PANELS_COVER) {
SetCursorPos(MouseX + 160, MouseY);
}
@ -1712,7 +1712,7 @@ void game_logic()
}
#ifdef _DEBUG
if (debug_mode_key_inverted_v && GetAsyncKeyState(VK_SHIFT) & 0x8000) {
if (debug_mode_key_inverted_v && GetAsyncKeyState(DVL_VK_SHIFT) & 0x8000) {
ScrollView();
}
#endif

14
Source/gmenu.cpp

@ -240,28 +240,28 @@ BOOL gmenu_presskeys(int vkey)
if (!sgpCurrentMenu)
return FALSE;
switch (vkey) {
case VK_RETURN:
case DVL_VK_RETURN:
if ((sgpCurrItem->dwFlags & GMENU_ENABLED) != 0) {
PlaySFX(IS_TITLEMOV);
sgpCurrItem->fnMenu(TRUE);
}
break;
case VK_ESCAPE:
case DVL_VK_ESCAPE:
PlaySFX(IS_TITLEMOV);
gmenu_set_items(NULL, NULL);
break;
case VK_SPACE:
case DVL_VK_SPACE:
return FALSE;
case VK_LEFT:
case DVL_VK_LEFT:
gmenu_left_right(FALSE);
break;
case VK_RIGHT:
case DVL_VK_RIGHT:
gmenu_left_right(TRUE);
break;
case VK_UP:
case DVL_VK_UP:
gmenu_up_down(FALSE);
break;
case VK_DOWN:
case DVL_VK_DOWN:
gmenu_up_down(TRUE);
break;
}

10
Source/init.cpp

@ -121,16 +121,16 @@ void init_get_file_info()
LRESULT MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg) {
case WM_ERASEBKGND:
case DVL_WM_ERASEBKGND:
return 0;
case WM_PAINT:
case DVL_WM_PAINT:
force_redraw = 255;
break;
case WM_CLOSE:
case DVL_WM_CLOSE:
return 0;
case WM_QUERYNEWPALETTE:
case DVL_WM_QUERYNEWPALETTE:
return 1;
case WM_QUERYENDSESSION:
case DVL_WM_QUERYENDSESSION:
diablo_quit(0);
}

2
Source/interfac.cpp

@ -21,7 +21,7 @@ void interface_msg_pump()
MSG Msg;
while (PeekMessage(&Msg)) {
if (Msg.message != WM_QUIT) {
if (Msg.message != DVL_WM_QUIT) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}

10
Source/movie.cpp

@ -28,13 +28,13 @@ void play_movie(char *pszMovie, BOOL user_can_close)
while (video_stream && movie_playing) {
while (movie_playing && PeekMessage(&Msg)) {
switch (Msg.message) {
case WM_KEYDOWN:
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
if (user_can_close || (Msg.message == WM_KEYDOWN && Msg.wParam == VK_ESCAPE))
case DVL_WM_KEYDOWN:
case DVL_WM_LBUTTONDOWN:
case DVL_WM_RBUTTONDOWN:
if (user_can_close || (Msg.message == DVL_WM_KEYDOWN && Msg.wParam == DVL_VK_ESCAPE))
movie_playing = FALSE;
break;
case WM_QUIT:
case DVL_WM_QUIT:
SVidPlayEnd(video_stream);
diablo_quit(0);
break;

2
Source/render.cpp

@ -229,7 +229,7 @@ void RenderTile(BYTE *pBuff)
}
#ifdef _DEBUG
if (GetAsyncKeyState(VK_MENU) & 0x8000) {
if (GetAsyncKeyState(DVL_VK_MENU) & 0x8000) {
mask = &SolidMask[TILE_HEIGHT - 1];
}
#endif

2
Source/restrict.cpp

@ -9,7 +9,7 @@ void ReadOnlyTest()
char path[MAX_PATH], Filename[MAX_PATH];
GetPrefPath(path, MAX_PATH);
snprintf(Filename, DVL_MAX_PATH, "%sDiablo1ReadOnlyTest.foo", path);
snprintf(Filename, MAX_PATH, "%sDiablo1ReadOnlyTest.foo", path);
f = fopen(Filename, "wt");
if (!f) {

2
Source/wave.cpp

@ -28,7 +28,7 @@ BOOL WOpenFile(const char *FileName, HANDLE *phsFile, BOOL mayNotExist)
void WReadFile(HANDLE hsFile, LPVOID buf, DWORD to_read, const char *FileName)
{
if (SFileSetFilePointer(hsFile, 0, NULL, FILE_CURRENT) == -1)
if (SFileSetFilePointer(hsFile, 0, NULL, DVL_FILE_CURRENT) == -1)
FileErrDlg(FileName);
if (!SFileReadFile(hsFile, buf, to_read, NULL, NULL))

5
SourceS/miniwin.h

@ -25,8 +25,5 @@
#include "storm_full.h"
#ifndef MAX_PATH
#define MAX_PATH DVL_MAX_PATH
#endif
#ifdef DEVILUTION_ENGINE
#include "miniwin/misc_macro.h"
#define MAX_PATH 260
#endif

161
SourceS/miniwin/misc.h

@ -2,8 +2,6 @@
namespace dvl {
constexpr auto DVL_MAX_PATH = 260;
typedef uint16_t SHORT;
typedef int32_t LONG;
typedef uint8_t BOOLEAN;
@ -53,11 +51,18 @@ void FocusOnCharInfo();
SHORT GetAsyncKeyState(int vKey);
bool PeekMessageA(LPMSG lpMsg);
bool PeekMessage(LPMSG lpMsg);
bool TranslateMessage(const MSG *lpMsg);
LRESULT DispatchMessageA(const MSG *lpMsg);
bool PostMessageA(UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT DispatchMessage(const MSG *lpMsg);
bool PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#define FALSE false
#endif
//
// MSCVRT emulation
@ -96,80 +101,80 @@ bool PostMessageA(UINT Msg, WPARAM wParam, LPARAM lParam);
// Virtual key codes.
//
// ref: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
constexpr auto DVL_VK_BACK = 0x08; // BACKSPACE key
constexpr auto DVL_VK_TAB = 0x09; // TAB key
constexpr auto DVL_VK_RETURN = 0x0D; // ENTER key
constexpr auto DVL_VK_SHIFT = 0x10; // SHIFT key
constexpr auto DVL_VK_CONTROL = 0x11; // CONTROL key
constexpr auto DVL_VK_MENU = 0x12; // ALT key
constexpr auto DVL_VK_PAUSE = 0x13; // PAUSE key
constexpr auto DVL_VK_CAPITAL = 0x14; // CAPS LOCK key
constexpr auto DVL_VK_ESCAPE = 0x1B; // ESC key
constexpr auto DVL_VK_SPACE = 0x20; // SPACEBAR
constexpr auto DVL_VK_PRIOR = 0x21; // PAGE UP key
constexpr auto DVL_VK_NEXT = 0x22; // PAGE DOWN key
constexpr auto DVL_VK_END = 0x23; // END key
constexpr auto DVL_VK_HOME = 0x24; // HOME key
constexpr auto DVL_VK_LEFT = 0x25; // LEFT ARROW key
constexpr auto DVL_VK_UP = 0x26; // UP ARROW key
constexpr auto DVL_VK_RIGHT = 0x27; // RIGHT ARROW key
constexpr auto DVL_VK_DOWN = 0x28; // DOWN ARROW key
constexpr auto DVL_VK_SNAPSHOT = 0x2C; // PRINT SCREEN key
constexpr auto DVL_VK_INSERT = 0x2D; // INS key
constexpr auto DVL_VK_DELETE = 0x2E; // DEL key
#define DVL_VK_BACK 0x08 // BACKSPACE key
#define DVL_VK_TAB 0x09 // TAB key
#define DVL_VK_RETURN 0x0D // ENTER key
#define DVL_VK_SHIFT 0x10 // SHIFT key
#define DVL_VK_CONTROL 0x11 // CONTROL key
#define DVL_VK_MENU 0x12 // ALT key
#define DVL_VK_PAUSE 0x13 // PAUSE key
#define DVL_VK_CAPITAL 0x14 // CAPS LOCK key
#define DVL_VK_ESCAPE 0x1B // ESC key
#define DVL_VK_SPACE 0x20 // SPACEBAR
#define DVL_VK_PRIOR 0x21 // PAGE UP key
#define DVL_VK_NEXT 0x22 // PAGE DOWN key
#define DVL_VK_END 0x23 // END key
#define DVL_VK_HOME 0x24 // HOME key
#define DVL_VK_LEFT 0x25 // LEFT ARROW key
#define DVL_VK_UP 0x26 // UP ARROW key
#define DVL_VK_RIGHT 0x27 // RIGHT ARROW key
#define DVL_VK_DOWN 0x28 // DOWN ARROW key
#define DVL_VK_SNAPSHOT 0x2C // PRINT SCREEN key
#define DVL_VK_INSERT 0x2D // INS key
#define DVL_VK_DELETE 0x2E // DEL key
// DVL_VK_0 through DVL_VK_9 correspond to '0' - '9'
// DVL_VK_A through DVL_VK_Z correspond to 'A' - 'Z'
constexpr auto DVL_VK_LWIN = 0x5B; // Left Windows key (Natural keyboard)
constexpr auto DVL_VK_RWIN = 0x5C; // Right Windows key (Natural keyboard)
constexpr auto DVL_VK_NUMPAD0 = 0x60; // Numeric keypad 0 key
constexpr auto DVL_VK_NUMPAD1 = 0x61; // Numeric keypad 1 key
constexpr auto DVL_VK_NUMPAD2 = 0x62; // Numeric keypad 2 key
constexpr auto DVL_VK_NUMPAD3 = 0x63; // Numeric keypad 3 key
constexpr auto DVL_VK_NUMPAD4 = 0x64; // Numeric keypad 4 key
constexpr auto DVL_VK_NUMPAD5 = 0x65; // Numeric keypad 5 key
constexpr auto DVL_VK_NUMPAD6 = 0x66; // Numeric keypad 6 key
constexpr auto DVL_VK_NUMPAD7 = 0x67; // Numeric keypad 7 key
constexpr auto DVL_VK_NUMPAD8 = 0x68; // Numeric keypad 8 key
constexpr auto DVL_VK_NUMPAD9 = 0x69; // Numeric keypad 9 key
constexpr auto DVL_VK_MULTIPLY = 0x6A; // Multiply key
constexpr auto DVL_VK_ADD = 0x6B; // Add key
constexpr auto DVL_VK_SUBTRACT = 0x6D; // Subtract key
constexpr auto DVL_VK_DECIMAL = 0x6E; // Decimal key
constexpr auto DVL_VK_DIVIDE = 0x6F; // Divide key
constexpr auto DVL_VK_F1 = 0x70; // F1 key
constexpr auto DVL_VK_F2 = 0x71; // F2 key
constexpr auto DVL_VK_F3 = 0x72; // F3 key
constexpr auto DVL_VK_F4 = 0x73; // F4 key
constexpr auto DVL_VK_F5 = 0x74; // F5 key
constexpr auto DVL_VK_F6 = 0x75; // F6 key
constexpr auto DVL_VK_F7 = 0x76; // F7 key
constexpr auto DVL_VK_F8 = 0x77; // F8 key
constexpr auto DVL_VK_F9 = 0x78; // F9 key
constexpr auto DVL_VK_F10 = 0x79; // F10 key
constexpr auto DVL_VK_F11 = 0x7A; // F11 key
constexpr auto DVL_VK_F12 = 0x7B; // F12 key
constexpr auto DVL_VK_NUMLOCK = 0x90; // NUM LOCK key
constexpr auto DVL_VK_SCROLL = 0x91; // SCROLL LOCK key
constexpr auto DVL_VK_LSHIFT = 0xA0; // Left SHIFT key
constexpr auto DVL_VK_RSHIFT = 0xA1; // Right SHIFT key
constexpr auto DVL_VK_LCONTROL = 0xA2; // Left CONTROL key
constexpr auto DVL_VK_RCONTROL = 0xA3; // Right CONTROL key
constexpr auto DVL_VK_LMENU = 0xA4; // Left MENU key
constexpr auto DVL_VK_RMENU = 0xA5; // Right MENU key
constexpr auto DVL_VK_OEM_1 = 0xBA; // For the US standard keyboard, the ';:' key
constexpr auto DVL_VK_OEM_PLUS = 0xBB; // For any country/region, the '+' key
constexpr auto DVL_VK_OEM_COMMA = 0xBC; // For any country/region, the ',' key
constexpr auto DVL_VK_OEM_MINUS = 0xBD; // For any country/region, the '-' key
constexpr auto DVL_VK_OEM_PERIOD = 0xBE; // For any country/region, the '.' key
constexpr auto DVL_VK_OEM_2 = 0xBF; // For the US standard keyboard, the '/?' key
constexpr auto DVL_VK_OEM_3 = 0xC0; // For the US standard keyboard, the '`~' key
constexpr auto DVL_VK_OEM_4 = 0xDB; // For the US standard keyboard, the '[{' key
constexpr auto DVL_VK_OEM_5 = 0xDC; // For the US standard keyboard, the '\|' key
constexpr auto DVL_VK_OEM_6 = 0xDD; // For the US standard keyboard, the ']}' key
constexpr auto DVL_VK_OEM_7 = 0xDE; // For the US standard keyboard, the 'single-quote/double-quote' key
constexpr auto DVL_MK_SHIFT = 0x0004;
constexpr auto DVL_MK_LBUTTON = 0x0001;
constexpr auto DVL_MK_RBUTTON = 0x0002;
#define DVL_VK_LWIN 0x5B // Left Windows key (Natural keyboard)
#define DVL_VK_RWIN 0x5C // Right Windows key (Natural keyboard)
#define DVL_VK_NUMPAD0 0x60 // Numeric keypad 0 key
#define DVL_VK_NUMPAD1 0x61 // Numeric keypad 1 key
#define DVL_VK_NUMPAD2 0x62 // Numeric keypad 2 key
#define DVL_VK_NUMPAD3 0x63 // Numeric keypad 3 key
#define DVL_VK_NUMPAD4 0x64 // Numeric keypad 4 key
#define DVL_VK_NUMPAD5 0x65 // Numeric keypad 5 key
#define DVL_VK_NUMPAD6 0x66 // Numeric keypad 6 key
#define DVL_VK_NUMPAD7 0x67 // Numeric keypad 7 key
#define DVL_VK_NUMPAD8 0x68 // Numeric keypad 8 key
#define DVL_VK_NUMPAD9 0x69 // Numeric keypad 9 key
#define DVL_VK_MULTIPLY 0x6A // Multiply key
#define DVL_VK_ADD 0x6B // Add key
#define DVL_VK_SUBTRACT 0x6D // Subtract key
#define DVL_VK_DECIMAL 0x6E // Decimal key
#define DVL_VK_DIVIDE 0x6F // Divide key
#define DVL_VK_F1 0x70 // F1 key
#define DVL_VK_F2 0x71 // F2 key
#define DVL_VK_F3 0x72 // F3 key
#define DVL_VK_F4 0x73 // F4 key
#define DVL_VK_F5 0x74 // F5 key
#define DVL_VK_F6 0x75 // F6 key
#define DVL_VK_F7 0x76 // F7 key
#define DVL_VK_F8 0x77 // F8 key
#define DVL_VK_F9 0x78 // F9 key
#define DVL_VK_F10 0x79 // F10 key
#define DVL_VK_F11 0x7A // F11 key
#define DVL_VK_F12 0x7B // F12 key
#define DVL_VK_NUMLOCK 0x90 // NUM LOCK key
#define DVL_VK_SCROLL 0x91 // SCROLL LOCK key
#define DVL_VK_LSHIFT 0xA0 // Left SHIFT key
#define DVL_VK_RSHIFT 0xA1 // Right SHIFT key
#define DVL_VK_LCONTROL 0xA2 // Left CONTROL key
#define DVL_VK_RCONTROL 0xA3 // Right CONTROL key
#define DVL_VK_LMENU 0xA4 // Left MENU key
#define DVL_VK_RMENU 0xA5 // Right MENU key
#define DVL_VK_OEM_1 0xBA // For the US standard keyboard, the ':' key
#define DVL_VK_OEM_PLUS 0xBB // For any country/region, the '+' key
#define DVL_VK_OEM_COMMA 0xBC // For any country/region, the ',' key
#define DVL_VK_OEM_MINUS 0xBD // For any country/region, the '-' key
#define DVL_VK_OEM_PERIOD 0xBE // For any country/region, the '.' key
#define DVL_VK_OEM_2 0xBF // For the US standard keyboard, the '/?' key
#define DVL_VK_OEM_3 0xC0 // For the US standard keyboard, the '`~' key
#define DVL_VK_OEM_4 0xDB // For the US standard keyboard, the '[{' key
#define DVL_VK_OEM_5 0xDC // For the US standard keyboard, the '\|' key
#define DVL_VK_OEM_6 0xDD // For the US standard keyboard, the ']}' key
#define DVL_VK_OEM_7 0xDE // For the US standard keyboard, the 'single-quote/double-quote' key
#define DVL_MK_SHIFT 0x0004
#define DVL_MK_LBUTTON 0x0001
#define DVL_MK_RBUTTON 0x0002
} // namespace dvl

122
SourceS/miniwin/misc_macro.h

@ -1,122 +0,0 @@
#pragma once
#define TRUE true
#define FALSE false
#define PeekMessage PeekMessageA
#define DispatchMessage DispatchMessageA
#define PostMessage PostMessageA
//
// File I/O
//
#define FILE_CURRENT DVL_FILE_CURRENT
//
// Events
//
#define WM_QUIT DVL_WM_QUIT
#define WM_MOUSEMOVE DVL_WM_MOUSEMOVE
#define WM_LBUTTONDOWN DVL_WM_LBUTTONDOWN
#define WM_LBUTTONUP DVL_WM_LBUTTONUP
#define WM_RBUTTONDOWN DVL_WM_RBUTTONDOWN
#define WM_RBUTTONUP DVL_WM_RBUTTONUP
#define WM_KEYDOWN DVL_WM_KEYDOWN
#define WM_KEYUP DVL_WM_KEYUP
#define WM_SYSKEYDOWN DVL_WM_SYSKEYDOWN
#define WM_SYSCOMMAND DVL_WM_SYSCOMMAND
#define WM_CHAR DVL_WM_CHAR
#define WM_CAPTURECHANGED DVL_WM_CAPTURECHANGED
#define WM_PAINT DVL_WM_PAINT
#define WM_CLOSE DVL_WM_CLOSE
#define WM_QUERYENDSESSION DVL_WM_QUERYENDSESSION
#define WM_ERASEBKGND DVL_WM_ERASEBKGND
#define WM_QUERYNEWPALETTE DVL_WM_QUERYNEWPALETTE
#define SC_CLOSE DVL_SC_CLOSE
// Virtual key codes.
//
// ref: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
#define VK_BACK DVL_VK_BACK // BACKSPACE key
#define VK_TAB DVL_VK_TAB // TAB key
#define VK_RETURN DVL_VK_RETURN // ENTER key
#define VK_SHIFT DVL_VK_SHIFT // SHIFT key
#define VK_CONTROL DVL_VK_CONTROL // CONTROL key
#define VK_MENU DVL_VK_MENU // ALT key
#define VK_PAUSE DVL_VK_PAUSE // PAUSE key
#define VK_CAPITAL DVL_VK_CAPITAL // CAPS LOCK key
#define VK_ESCAPE DVL_VK_ESCAPE // ESC key
#define VK_SPACE DVL_VK_SPACE // SPACEBAR
#define VK_PRIOR DVL_VK_PRIOR // PAGE UP key
#define VK_NEXT DVL_VK_NEXT // PAGE DOWN key
#define VK_END DVL_VK_END // END key
#define VK_HOME DVL_VK_HOME // HOME key
#define VK_LEFT DVL_VK_LEFT // LEFT ARROW key
#define VK_UP DVL_VK_UP // UP ARROW key
#define VK_RIGHT DVL_VK_RIGHT // RIGHT ARROW key
#define VK_DOWN DVL_VK_DOWN // DOWN ARROW key
#define VK_SNAPSHOT DVL_VK_SNAPSHOT // PRINT SCREEN key
#define VK_INSERT DVL_VK_INSERT // INS key
#define VK_DELETE DVL_VK_DELETE // DEL key
// VK_0 through VK_9 correspond to '0' - '9'
// VK_A through VK_Z correspond to 'A' - 'Z'
#define VK_LWIN DVL_VK_LWIN // Left Windows key (Natural keyboard)
#define VK_RWIN DVL_VK_RWIN // Right Windows key (Natural keyboard)
#define VK_NUMPAD0 DVL_VK_NUMPAD0 // Numeric keypad 0 key
#define VK_NUMPAD1 DVL_VK_NUMPAD1 // Numeric keypad 1 key
#define VK_NUMPAD2 DVL_VK_NUMPAD2 // Numeric keypad 2 key
#define VK_NUMPAD3 DVL_VK_NUMPAD3 // Numeric keypad 3 key
#define VK_NUMPAD4 DVL_VK_NUMPAD4 // Numeric keypad 4 key
#define VK_NUMPAD5 DVL_VK_NUMPAD5 // Numeric keypad 5 key
#define VK_NUMPAD6 DVL_VK_NUMPAD6 // Numeric keypad 6 key
#define VK_NUMPAD7 DVL_VK_NUMPAD7 // Numeric keypad 7 key
#define VK_NUMPAD8 DVL_VK_NUMPAD8 // Numeric keypad 8 key
#define VK_NUMPAD9 DVL_VK_NUMPAD9 // Numeric keypad 9 key
#define VK_MULTIPLY DVL_VK_MULTIPLY // Multiply key
#define VK_ADD DVL_VK_ADD // Add key
#define VK_SUBTRACT DVL_VK_SUBTRACT // Subtract key
#define VK_DECIMAL DVL_VK_DECIMAL // Decimal key
#define VK_DIVIDE DVL_VK_DIVIDE // Divide key
#define VK_F1 DVL_VK_F1 // F1 key
#define VK_F2 DVL_VK_F2 // F2 key
#define VK_F3 DVL_VK_F3 // F3 key
#define VK_F4 DVL_VK_F4 // F4 key
#define VK_F5 DVL_VK_F5 // F5 key
#define VK_F6 DVL_VK_F6 // F6 key
#define VK_F7 DVL_VK_F7 // F7 key
#define VK_F8 DVL_VK_F8 // F8 key
#define VK_F9 DVL_VK_F9 // F9 key
#define VK_F10 DVL_VK_F10 // F10 key
#define VK_F11 DVL_VK_F11 // F11 key
#define VK_F12 DVL_VK_F12 // F12 key
#define VK_NUMLOCK DVL_VK_NUMLOCK // NUM LOCK key
#define VK_SCROLL DVL_VK_SCROLL // SCROLL LOCK key
#define VK_LSHIFT DVL_VK_LSHIFT // Left SHIFT key
#define VK_RSHIFT DVL_VK_RSHIFT // Right SHIFT key
#define VK_LCONTROL DVL_VK_LCONTROL // Left CONTROL key
#define VK_RCONTROL DVL_VK_RCONTROL // Right CONTROL key
#define VK_LMENU DVL_VK_LMENU // Left MENU key
#define VK_RMENU DVL_VK_RMENU // Right MENU key
#define VK_OEM_1 DVL_VK_OEM_1 // For the US standard keyboard, the ';:' key
#define VK_OEM_PLUS DVL_VK_OEM_PLUS // For any country/region, the '+' key
#define VK_OEM_COMMA DVL_VK_OEM_COMMA // For any country/region, the ',' key
#define VK_OEM_MINUS DVL_VK_OEM_MINUS // For any country/region, the '-' key
#define VK_OEM_PERIOD DVL_VK_OEM_PERIOD // For any country/region, the '.' key
#define VK_OEM_2 DVL_VK_OEM_2 // For the US standard keyboard, the '/?' key
#define VK_OEM_3 DVL_VK_OEM_3 // For the US standard keyboard, the '`~' key
#define VK_OEM_4 DVL_VK_OEM_4 // For the US standard keyboard, the '[{' key
#define VK_OEM_5 DVL_VK_OEM_5 // For the US standard keyboard, the '\|' key
#define VK_OEM_6 DVL_VK_OEM_6 // For the US standard keyboard, the ']}' key
#define VK_OEM_7 DVL_VK_OEM_7 // For the US standard keyboard, the 'single-quote/double-quote' key
#define MK_SHIFT DVL_MK_SHIFT
#define MK_LBUTTON DVL_MK_LBUTTON
#define MK_RBUTTON DVL_MK_RBUTTON

19
SourceX/DiabloUI/art.h

@ -6,11 +6,20 @@
namespace dvl {
struct Art {
SDL_Surface *surface = NULL;
int frames = 1;
int logical_width = 0;
int frame_height = 0; // logical frame height (before scaling)
unsigned int palette_version = 0;
SDL_Surface *surface;
int frames;
int logical_width;
int frame_height;
unsigned int palette_version;
Art()
{
surface = NULL;
frames = 1;
logical_width = 0;
frame_height = 0; // logical frame height (before scaling)
palette_version = 0;
}
int w() const
{

20
SourceX/DiabloUI/credits.cpp

@ -17,9 +17,9 @@ namespace dvl {
namespace {
const SDL_Rect VIEWPORT = { 0, 114, SCREEN_WIDTH, 251 };
constexpr int SHADOW_OFFSET_X = 2;
constexpr int SHADOW_OFFSET_Y = 2;
constexpr int LINE_H = 22;
const int SHADOW_OFFSET_X = 2;
const int SHADOW_OFFSET_Y = 2;
const int LINE_H = 22;
// The maximum number of visible lines is the number of whole lines
// (VIEWPORT.h / LINE_H) rounded up, plus one extra line for when
@ -110,13 +110,14 @@ CachedLine PrepareLine(std::size_t index)
class LinesBuffer {
public:
LinesBuffer(std::size_t capacity)
: start_(0)
, end_(0)
, empty_(true)
{
data_.reserve(capacity);
for (std::size_t i = 0; i < capacity; ++i)
data_.push_back(CachedLine());
data_.push_back(CachedLine(0, NULL));
start_ = 0;
end_ = 0;
empty_ = true;
}
bool empty() const
@ -172,13 +173,12 @@ class CreditsRenderer {
public:
CreditsRenderer()
: lines_(MAX_VISIBLE_LINES)
, finished_(false)
, prev_offset_y_(0)
{
LoadBackgroundArt("ui_art\\credits.pcx");
LoadTtfFont();
ticks_begin_ = SDL_GetTicks();
prev_offset_y_ = 0;
finished_ = false;
}
~CreditsRenderer()

12
SourceX/DiabloUI/diabloui.cpp

@ -55,9 +55,15 @@ namespace {
DWORD fadeTc;
int fadeValue = 0;
struct {
bool upArrowPressed = false;
bool downArrowPressed = false;
struct scrollBarState {
bool upArrowPressed;
bool downArrowPressed;
scrollBarState()
{
upArrowPressed = false;
downArrowPressed = false;
}
} scrollBarState;
} // namespace

2
SourceX/DiabloUI/dialogs.cpp

@ -32,7 +32,7 @@ void DialogActionOK()
dialogEnd = true;
}
constexpr auto DIALOG_ART_L = UiImage(&dialogArt, { PANEL_LEFT + 127, 100, 385, 280 });
const auto DIALOG_ART_L = UiImage(&dialogArt, { PANEL_LEFT + 127, 100, 385, 280 });
UiItem OK_DIALOG[] = {
UiImage(&dialogArt, { PANEL_LEFT + 180, 168, 280, 144 }),

6
SourceX/DiabloUI/scrollbar.h

@ -6,7 +6,7 @@
namespace dvl {
extern Art ArtScrollBarBackground;
constexpr decltype(SDL_Rect().w) SCROLLBAR_BG_WIDTH = 25;
const decltype(SDL_Rect().w) SCROLLBAR_BG_WIDTH = 25;
extern Art ArtScrollBarArrow;
enum class ScrollBarArrowFrame {
@ -17,7 +17,7 @@ enum class ScrollBarArrowFrame {
};
extern Art ArtScrollBarThumb;
constexpr decltype(SDL_Rect().w) SCROLLBAR_ARROW_WIDTH = 25;
const decltype(SDL_Rect().w) SCROLLBAR_ARROW_WIDTH = 25;
inline SDL_Rect UpArrowRect(const UiScrollBar &sb)
{
@ -56,7 +56,7 @@ inline SDL_Rect BarRect(const UiScrollBar &sb)
inline SDL_Rect ThumbRect(const UiScrollBar &sb, std::size_t selected_index, std::size_t num_items)
{
constexpr int THUMB_OFFSET_X = 3;
const int THUMB_OFFSET_X = 3;
const int thumb_max_y = BarHeight(sb) - sb.thumb->h();
const int thumb_y = (selected_index * thumb_max_y / (num_items - 1));
return {

2
SourceX/DiabloUI/selhero.cpp

@ -18,7 +18,7 @@ std::size_t selhero_SaveCount = 0;
_uiheroinfo selhero_heros[MAX_CHARACTERS];
_uiheroinfo selhero_heroInfo;
std::size_t listOffset = 0;
constexpr std::size_t kMaxViewportItems = 6;
const size_t kMaxViewportItems = 6;
char textStats[5][4];
char title[32];
char selhero_Lable[32];

11
SourceX/DiabloUI/text_draw.h

@ -5,14 +5,21 @@
namespace dvl {
struct TtfSurfaceCache {
TtfSurfaceCache()
{
text = NULL;
shadow = NULL;
}
~TtfSurfaceCache()
{
mem_free_dbg(text);
mem_free_dbg(shadow);
}
SDL_Surface *text = NULL;
SDL_Surface *shadow = NULL;
SDL_Surface *text;
SDL_Surface *shadow;
};
void DrawTTF(const char *text, const SDL_Rect &rect, int flags,

4
SourceX/controls/controller_motion.cpp

@ -63,8 +63,8 @@ bool leftStickNeedsScaling, rightStickNeedsScaling;
void ScaleJoysticks()
{
constexpr float rightDeadzone = 0.07;
constexpr float leftDeadzone = 0.07;
const float rightDeadzone = 0.07;
const float leftDeadzone = 0.07;
if (leftStickNeedsScaling) {
leftStickX = leftStickXUnscaled;

6
SourceX/controls/modifier_hints.cpp

@ -94,7 +94,7 @@ text_color CircleMenuHintTextColor(bool active)
void DrawCircleMenuHint(const CircleMenuHint &hint, int x, int y)
{
constexpr int kLineHeight = 25;
const int kLineHeight = 25;
PrintGameStr(x + hint.x_mid - hint.top_w / 2, y, hint.top, CircleMenuHintTextColor(IsTopActive(hint)));
y += kLineHeight;
@ -105,8 +105,8 @@ void DrawCircleMenuHint(const CircleMenuHint &hint, int x, int y)
PrintGameStr(x + hint.x_mid - hint.bottom_w / 2, y, hint.bottom, CircleMenuHintTextColor(IsBottomActive(hint)));
}
constexpr int kCircleMarginX = 16;
constexpr int kCirclesTop = PANEL_TOP - 76;
const int kCircleMarginX = 16;
const int kCirclesTop = PANEL_TOP - 76;
void DrawStartModifierMenu()
{

14
SourceX/controls/plrctrls.cpp

@ -847,6 +847,14 @@ void Movement()
}
struct RightStickAccumulator {
RightStickAccumulator()
{
lastTc = SDL_GetTicks();
hiresDX = 0;
hiresDY = 0;
}
void pool(int *x, int *y, int slowdown)
{
DWORD tc = SDL_GetTicks();
@ -865,9 +873,9 @@ struct RightStickAccumulator {
lastTc = SDL_GetTicks();
}
DWORD lastTc = SDL_GetTicks();
int hiresDX = 0;
int hiresDY = 0;
DWORD lastTc;
int hiresDX;
int hiresDY;
};
} // namespace

2
SourceX/dvlnet/loopback.cpp

@ -29,7 +29,7 @@ bool loopback::SNetReceiveMessage(int *sender, char **data, int *size)
bool loopback::SNetSendMessage(int dest, void *data, unsigned int size)
{
if (dest == plr_single || dest == SNPLAYER_ALL) {
auto raw_message = reinterpret_cast<unsigned char *>(data);
unsigned char *raw_message = reinterpret_cast<unsigned char *>(data);
buffer_t message(raw_message, raw_message + size);
message_queue.push(message);
}

7
SourceX/dvlnet/loopback.h

@ -14,9 +14,14 @@ class loopback : public abstract_net {
private:
std::queue<buffer_t> message_queue;
buffer_t message_last;
const int plr_single = 0;
int plr_single;
public:
loopback()
{
plr_single = 0;
};
virtual int create(std::string addrstr, std::string passwd);
virtual int join(std::string addrstr, std::string passwd);
virtual bool SNetReceiveMessage(int *sender, char **data, int *size);

16
SourceX/miniwin/misc_msg.cpp

@ -266,10 +266,10 @@ bool false_avail(const char *name, int value)
void StoreSpellCoords()
{
constexpr int START_X = 20;
constexpr int END_X = 636;
constexpr int END_Y = 495;
constexpr int BOX_SIZE = 56;
const int START_X = 20;
const int END_X = 636;
const int END_Y = 495;
const int BOX_SIZE = 56;
speedspellcount = 0;
int xo = END_X, yo = END_Y;
for (int i = 0; i < 4; i++) {
@ -344,7 +344,7 @@ bool BlurInventory()
return true;
}
bool PeekMessageA(LPMSG lpMsg)
bool PeekMessage(LPMSG lpMsg)
{
#ifdef __SWITCH__
HandleDocking();
@ -724,7 +724,7 @@ bool TranslateMessage(const MSG *lpMsg)
#endif
// XXX: This does not add extended info to lParam
PostMessageA(DVL_WM_CHAR, key, 0);
PostMessage(DVL_WM_CHAR, key, 0);
}
}
@ -758,14 +758,14 @@ SHORT GetAsyncKeyState(int vKey)
}
}
LRESULT DispatchMessageA(const MSG *lpMsg)
LRESULT DispatchMessage(const MSG *lpMsg)
{
assert(CurrentProc);
return CurrentProc(NULL, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
}
bool PostMessageA(UINT Msg, WPARAM wParam, LPARAM lParam)
bool PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
{
MSG msg;
msg.message = Msg;

14
SourceX/storm/storm.cpp

@ -21,7 +21,7 @@ std::string basePath;
DWORD nLastError = 0;
bool directFileAccess = false;
char SBasePath[DVL_MAX_PATH];
char SBasePath[MAX_PATH];
#ifdef USE_SDL1
static bool IsSVidVideoMode = false;
@ -29,8 +29,8 @@ static bool IsSVidVideoMode = false;
static std::string getIniPath()
{
char path[DVL_MAX_PATH];
GetPrefPath(path, DVL_MAX_PATH);
char path[MAX_PATH];
GetPrefPath(path, MAX_PATH);
std::string result = path;
result.append("diablo.ini");
return result;
@ -176,12 +176,12 @@ BOOL SFileOpenFile(const char *filename, HANDLE *phFile)
bool result = false;
if (directFileAccess) {
char directPath[DVL_MAX_PATH] = "\0";
char tmpPath[DVL_MAX_PATH] = "\0";
char directPath[MAX_PATH] = "\0";
char tmpPath[MAX_PATH] = "\0";
for (size_t i = 0; i < strlen(filename); i++) {
tmpPath[i] = AsciiToLowerTable_Path[static_cast<unsigned char>(filename[i])];
}
snprintf(directPath, DVL_MAX_PATH, "%s%s", SBasePath, tmpPath);
snprintf(directPath, MAX_PATH, "%s%s", SBasePath, tmpPath);
result = SFileOpenFileEx((HANDLE)0, directPath, 0xFFFFFFFF, phFile);
}
if (!result && patch_rt_mpq) {
@ -823,7 +823,7 @@ int SStrCopy(char *dest, const char *src, int max_length)
BOOL SFileSetBasePath(char *path)
{
strncpy(SBasePath, path, DVL_MAX_PATH);
strncpy(SBasePath, path, MAX_PATH);
return true;
}

Loading…
Cancel
Save