diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 999fa170d..646926c62 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -9,8 +9,6 @@ DEVILUTION_BEGIN_NAMESPACE -/** Buffer used by GetErrorStr for its return value */ -char sz_error_buf[256]; /** Set to true when a fatal error is encountered and the application should shut down. */ BOOL terminating; /** Thread id of the last callee to FreeDlg(). */ diff --git a/Source/automap.cpp b/Source/automap.cpp index 8c0b0dbe1..f30aa114f 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -16,7 +16,6 @@ static int AutoMapX; static int AutoMapY; /** Specifies whether the automap is enabled. */ BOOL automapflag; -char AmShiftTab[32]; /** Tracks the explored areas of the map. */ BOOLEAN automapview[DMAXX][DMAXY]; /** Specifies the scale of the automap. */ diff --git a/Source/codec.cpp b/Source/codec.cpp index e8f682fb6..e16930c6f 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -19,7 +19,7 @@ typedef struct CodecSignature { #define BLOCKSIZE 64 -static void codec_init_key(int unused, const char *pszPassword) +static void codec_init_key(const char *pszPassword) { char key[136]; // last 64 bytes are the SHA1 uint32_t rand_state = 0x7058; @@ -58,7 +58,7 @@ int codec_decode(BYTE *pbSrcDst, DWORD size, const char *pszPassword) int i; CodecSignature *sig; - codec_init_key(0, pszPassword); + codec_init_key(pszPassword); if (size <= sizeof(CodecSignature)) return 0; size -= sizeof(CodecSignature); @@ -113,7 +113,7 @@ void codec_encode(BYTE *pbSrcDst, DWORD size, int size_64, const char *pszPasswo if (size_64 != codec_get_encoded_len(size)) app_fatal("Invalid encode parameters"); - codec_init_key(1, pszPassword); + codec_init_key(pszPassword); last_chunk = 0; while (size != 0) { diff --git a/Source/control.cpp b/Source/control.cpp index 15b2b5f5e..3028fd487 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -51,14 +51,12 @@ BOOL drawbtnflag; BYTE *pSpellBkCel; char infostr[256]; int numpanbtns; -BYTE *pStatusPanel; char panelstr[4][64]; BOOL panelflag; BYTE SplTransTbl[256]; int initialDropGoldValue; BYTE *pSpellCels; BOOL panbtndown; -BYTE *pTalkPanel; BOOL spselflag; /** Maps from font index to smaltext.cel frame number. */ @@ -782,6 +780,7 @@ void UpdateManaFlask() void InitControlPan() { int i; + BYTE *tBuff; if (!gbIsMultiplayer) { pBtmBuff = DiabloAllocPtr((PANEL_HEIGHT + 16) * PANEL_WIDTH); @@ -801,18 +800,18 @@ void InitControlPan() else pSpellCels = LoadFileInMem("Data\\SpelIcon.CEL", NULL); SetSpellTrans(RSPLTYPE_SKILL); - pStatusPanel = LoadFileInMem("CtrlPan\\Panel8.CEL", NULL); - CelBlitWidth(pBtmBuff, 0, (PANEL_HEIGHT + 16) - 1, PANEL_WIDTH, pStatusPanel, 1, PANEL_WIDTH); - MemFreeDbg(pStatusPanel); - pStatusPanel = LoadFileInMem("CtrlPan\\P8Bulbs.CEL", NULL); - CelBlitWidth(pLifeBuff, 0, 87, 88, pStatusPanel, 1, 88); - CelBlitWidth(pManaBuff, 0, 87, 88, pStatusPanel, 2, 88); - MemFreeDbg(pStatusPanel); + tBuff = LoadFileInMem("CtrlPan\\Panel8.CEL", NULL); + CelBlitWidth(pBtmBuff, 0, (PANEL_HEIGHT + 16) - 1, PANEL_WIDTH, tBuff, 1, PANEL_WIDTH); + MemFreeDbg(tBuff); + tBuff = LoadFileInMem("CtrlPan\\P8Bulbs.CEL", NULL); + CelBlitWidth(pLifeBuff, 0, 87, 88, tBuff, 1, 88); + CelBlitWidth(pManaBuff, 0, 87, 88, tBuff, 2, 88); + MemFreeDbg(tBuff); talkflag = FALSE; if (gbIsMultiplayer) { - pTalkPanel = LoadFileInMem("CtrlPan\\TalkPanl.CEL", NULL); - CelBlitWidth(pBtmBuff, 0, (PANEL_HEIGHT + 16) * 2 - 1, PANEL_WIDTH, pTalkPanel, 1, PANEL_WIDTH); - MemFreeDbg(pTalkPanel); + tBuff = LoadFileInMem("CtrlPan\\TalkPanl.CEL", NULL); + CelBlitWidth(pBtmBuff, 0, (PANEL_HEIGHT + 16) * 2 - 1, PANEL_WIDTH, tBuff, 1, PANEL_WIDTH); + MemFreeDbg(tBuff); pMultiBtns = LoadFileInMem("CtrlPan\\P8But2.CEL", NULL); pTalkBtns = LoadFileInMem("CtrlPan\\TalkButt.CEL", NULL); sgbPlrTalkTbl = 0; diff --git a/Source/control.h b/Source/control.h index 7e9f4a25b..a7fc706bc 100644 --- a/Source/control.h +++ b/Source/control.h @@ -21,7 +21,6 @@ typedef struct RECT32 { extern BOOL drawhpflag; extern BOOL dropGoldFlag; -extern BOOL panbtn[8]; extern BOOL chrbtn[4]; extern BOOL lvlbtndown; extern int dropGoldValue; @@ -33,7 +32,6 @@ extern BOOL pinfoflag; extern int pSpell; extern char infoclr; extern char tempstr[256]; -extern BOOLEAN whisper[MAX_PLRS]; extern int sbooktab; extern int pSplType; extern int initialDropGoldIndex; @@ -42,7 +40,6 @@ extern BOOL sbookflag; extern BOOL chrflag; extern BOOL drawbtnflag; extern char infostr[256]; -extern char panelstr[4][64]; extern BOOL panelflag; extern int initialDropGoldValue; extern BOOL panbtndown; diff --git a/Source/dead.cpp b/Source/dead.cpp index 1dcdbfe45..591d27f27 100644 --- a/Source/dead.cpp +++ b/Source/dead.cpp @@ -7,8 +7,6 @@ DEVILUTION_BEGIN_NAMESPACE -/** unused, this was probably for blood boil/burn */ -int spurtndx; DeadStruct dead[MAXDEAD]; int stonendx; @@ -42,7 +40,6 @@ void InitDead() dead[nd]._deadWidth = 128; dead[nd]._deadWidth2 = 32; dead[nd]._deadtrans = 0; - spurtndx = nd + 1; nd++; for (d = 0; d < 8; d++) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index d9342cbe5..c2077ff4d 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -28,19 +28,10 @@ BOOL zoomflag; /** Enable updating of player character, set to false once Diablo dies */ BOOL gbProcessPlayers; BOOL gbLoadGame; -int DebugMonsters[10]; BOOLEAN cineflag; int force_redraw; -BOOL visiondebug; -/** unused */ -BOOL scrollflag; BOOL light4flag; -BOOL leveldebug; -BOOL monstdebug; -/** unused */ -BOOL trigdebug; int setseed; -int debugmonsttypes; int PauseMode; bool forceSpawn; bool forceDiablo; @@ -65,8 +56,13 @@ Options sgOptions; * screen, as needed for efficient rendering in fullscreen mode. */ BOOL fullscreen = TRUE; -int showintrodebug = 1; +bool gbShowIntro = true; #ifdef _DEBUG +BOOL monstdebug; +int DebugMonsters[10]; +int debugmonsttypes; +BOOL visiondebug; +BOOL leveldebug; int questdebug = -1; int debug_mode_key_s; int debug_mode_key_w; @@ -79,10 +75,6 @@ int dbgqst; int dbgmon; int arrowdebug; #endif -int frameflag; -int frameend; -int framerate; -int framestart; /** Specifies whether players are in non-PvP mode. */ BOOL FriendlyMode = TRUE; /** Default quick messages */ @@ -157,7 +149,7 @@ static void diablo_parse_flags(int argc, char **argv) } else if (strcasecmp("--config-dir", argv[i]) == 0) { SetConfigPath(argv[++i]); } else if (strcasecmp("-n", argv[i]) == 0) { - showintrodebug = FALSE; + gbShowIntro = false; } else if (strcasecmp("-f", argv[i]) == 0) { EnableFrameCount(); } else if (strcasecmp("-x", argv[i]) == 0) { @@ -340,7 +332,7 @@ static void run_game_loop(unsigned int uMsg) } if (!gbRunGame) break; - if (!nthread_has_500ms_passed(FALSE)) { + if (!nthread_has_500ms_passed()) { ProcessInput(); DrawAndBlit(); continue; @@ -476,7 +468,7 @@ static void diablo_init() static void diablo_splash() { - if (!showintrodebug) + if (!gbShowIntro) return; play_movie("gendata\\logo.smk", TRUE); @@ -1914,7 +1906,7 @@ void game_loop(BOOL bStartup) timeout_cursor(FALSE); game_logic(); } - if (!gbRunGame || !gbIsMultiplayer || !nthread_has_500ms_passed(TRUE)) + if (!gbRunGame || !gbIsMultiplayer || !nthread_has_500ms_passed()) break; } } diff --git a/Source/diablo.h b/Source/diablo.h index 53cb774d2..f5fa5ed23 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -27,20 +27,12 @@ extern BOOL gbRunGameResult; extern BOOL zoomflag; extern BOOL gbProcessPlayers; extern BOOL gbLoadGame; -extern HINSTANCE ghInst; -extern int DebugMonsters[10]; extern BOOLEAN cineflag; extern int force_redraw; -extern BOOL visiondebug; /* These are defined in fonts.h */ extern BOOL was_fonts_init; extern void FontsCleanup(); -/** unused */ extern BOOL light4flag; -extern BOOL leveldebug; -extern BOOL monstdebug; -/** unused */ -extern int debugmonsttypes; extern int PauseMode; extern BOOLEAN UseTheoQuest; extern BOOLEAN UseCowFarmer; @@ -70,8 +62,12 @@ void LoadOptions(); /* rdata */ extern BOOL fullscreen; -extern int showintrodebug; #ifdef _DEBUG +extern BOOL monstdebug; +extern int debugmonsttypes; +extern int DebugMonsters[10]; +extern BOOL visiondebug; +extern BOOL leveldebug; extern int questdebug; extern int debug_mode_key_w; extern int debug_mode_key_inverted_v; @@ -82,10 +78,6 @@ extern int dbgplr; extern int dbgqst; extern int dbgmon; #endif -extern int frameflag; -extern int frameend; -extern int framerate; -extern int framestart; extern BOOL FriendlyMode; #ifdef __cplusplus diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index b509255d7..289560a31 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -20,11 +20,10 @@ int HR2; int HR3; int UberRow; int UberCol; -int dword_577368; -int IsUberRoomOpened; +bool IsUberRoomOpened; int UberLeverRow; int UberLeverCol; -int IsUberLeverActivated; +bool IsUberLeverActivated; int UberDiabloMonsterIndex; /** Specifies whether to generate a vertical room at position 1 in the Cathedral. */ BOOL VR1; @@ -2302,9 +2301,8 @@ void drlg_l1_set_crypt_room(int rx1, int ry1) setpc_y = ry1; setpc_w = rw; setpc_h = rh; - IsUberRoomOpened = 0; - dword_577368 = 0; - IsUberLeverActivated = 0; + IsUberRoomOpened = false; + IsUberLeverActivated = false; sp = 2; @@ -2747,11 +2745,10 @@ void CreateL5Dungeon(DWORD rseed, int entry) UberRow = 0; UberCol = 0; - IsUberRoomOpened = 0; - dword_577368 = 0; + IsUberRoomOpened = false; UberLeverRow = 0; UberLeverCol = 0; - IsUberLeverActivated = 0; + IsUberLeverActivated = false; UberDiabloMonsterIndex = 0; DRLG_InitTrans(); diff --git a/Source/drlg_l1.h b/Source/drlg_l1.h index d042fb12d..3062a1937 100644 --- a/Source/drlg_l1.h +++ b/Source/drlg_l1.h @@ -14,10 +14,10 @@ extern "C" { extern int UberRow; extern int UberCol; -extern int IsUberRoomOpened; +extern bool IsUberRoomOpened; extern int UberLeverRow; extern int UberLeverCol; -extern int IsUberLeverActivated; +extern bool IsUberLeverActivated; extern int UberDiabloMonsterIndex; void DRLG_Init_Globals(); diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index d9b3a996c..db011f3b7 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -22,16 +22,16 @@ HALLNODE *pHallList; int Area_Min = 2; int Room_Max = 10; int Room_Min = 4; -int Dir_Xadd[5] = { 0, 0, 1, 0, -1 }; -int Dir_Yadd[5] = { 0, -1, 0, 1, 0 }; -ShadowStruct SPATSL2[2] = { { 6, 3, 0, 3, 48, 0, 50 }, { 9, 3, 0, 3, 48, 0, 50 } }; +const int Dir_Xadd[5] = { 0, 0, 1, 0, -1 }; +const int Dir_Yadd[5] = { 0, -1, 0, 1, 0 }; +const ShadowStruct SPATSL2[2] = { { 6, 3, 0, 3, 48, 0, 50 }, { 9, 3, 0, 3, 48, 0, 50 } }; //short word_48489A = 0; -BYTE BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -BYTE BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const BYTE BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const BYTE BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /** Miniset: Arch vertical. */ -BYTE VARCH1[] = { +const BYTE VARCH1[] = { // clang-format off 2, 4, // width, height @@ -47,7 +47,7 @@ BYTE VARCH1[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH2[] = { +const BYTE VARCH2[] = { // clang-format off 2, 4, // width, height @@ -63,7 +63,7 @@ BYTE VARCH2[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH3[] = { +const BYTE VARCH3[] = { // clang-format off 2, 4, // width, height @@ -79,7 +79,7 @@ BYTE VARCH3[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH4[] = { +const BYTE VARCH4[] = { // clang-format off 2, 4, // width, height @@ -95,7 +95,7 @@ BYTE VARCH4[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH5[] = { +const BYTE VARCH5[] = { // clang-format off 2, 4, // width, height @@ -111,7 +111,7 @@ BYTE VARCH5[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH6[] = { +const BYTE VARCH6[] = { // clang-format off 2, 4, // width, height @@ -127,7 +127,7 @@ BYTE VARCH6[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH7[] = { +const BYTE VARCH7[] = { // clang-format off 2, 4, // width, height @@ -143,7 +143,7 @@ BYTE VARCH7[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH8[] = { +const BYTE VARCH8[] = { // clang-format off 2, 4, // width, height @@ -159,7 +159,7 @@ BYTE VARCH8[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH9[] = { +const BYTE VARCH9[] = { // clang-format off 2, 4, // width, height @@ -175,7 +175,7 @@ BYTE VARCH9[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH10[] = { +const BYTE VARCH10[] = { // clang-format off 2, 4, // width, height @@ -191,7 +191,7 @@ BYTE VARCH10[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH11[] = { +const BYTE VARCH11[] = { // clang-format off 2, 4, // width, height @@ -207,7 +207,7 @@ BYTE VARCH11[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH12[] = { +const BYTE VARCH12[] = { // clang-format off 2, 4, // width, height @@ -223,7 +223,7 @@ BYTE VARCH12[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH13[] = { +const BYTE VARCH13[] = { // clang-format off 2, 4, // width, height @@ -239,7 +239,7 @@ BYTE VARCH13[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH14[] = { +const BYTE VARCH14[] = { // clang-format off 2, 4, // width, height @@ -255,7 +255,7 @@ BYTE VARCH14[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH15[] = { +const BYTE VARCH15[] = { // clang-format off 2, 4, // width, height @@ -271,7 +271,7 @@ BYTE VARCH15[] = { // clang-format on }; /** Miniset: Arch vertical - corner. */ -BYTE VARCH16[] = { +const BYTE VARCH16[] = { // clang-format off 2, 4, // width, height @@ -287,7 +287,7 @@ BYTE VARCH16[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH17[] = { +const BYTE VARCH17[] = { // clang-format off 2, 3, // width, height @@ -301,7 +301,7 @@ BYTE VARCH17[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH18[] = { +const BYTE VARCH18[] = { // clang-format off 2, 3, // width, height @@ -315,7 +315,7 @@ BYTE VARCH18[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH19[] = { +const BYTE VARCH19[] = { // clang-format off 2, 3, // width, height @@ -329,7 +329,7 @@ BYTE VARCH19[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH20[] = { +const BYTE VARCH20[] = { // clang-format off 2, 3, // width, height @@ -343,7 +343,7 @@ BYTE VARCH20[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH21[] = { +const BYTE VARCH21[] = { // clang-format off 2, 3, // width, height @@ -357,7 +357,7 @@ BYTE VARCH21[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH22[] = { +const BYTE VARCH22[] = { // clang-format off 2, 3, // width, height @@ -371,7 +371,7 @@ BYTE VARCH22[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH23[] = { +const BYTE VARCH23[] = { // clang-format off 2, 3, // width, height @@ -385,7 +385,7 @@ BYTE VARCH23[] = { // clang-format on }; /** Miniset: Arch vertical - open wall. */ -BYTE VARCH24[] = { +const BYTE VARCH24[] = { // clang-format off 2, 3, // width, height @@ -399,7 +399,7 @@ BYTE VARCH24[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH25[] = { +const BYTE VARCH25[] = { // clang-format off 2, 4, // width, height @@ -415,7 +415,7 @@ BYTE VARCH25[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH26[] = { +const BYTE VARCH26[] = { // clang-format off 2, 4, // width, height @@ -431,7 +431,7 @@ BYTE VARCH26[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH27[] = { +const BYTE VARCH27[] = { // clang-format off 2, 4, // width, height @@ -447,7 +447,7 @@ BYTE VARCH27[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH28[] = { +const BYTE VARCH28[] = { // clang-format off 2, 4, // width, height @@ -463,7 +463,7 @@ BYTE VARCH28[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH29[] = { +const BYTE VARCH29[] = { // clang-format off 2, 4, // width, height @@ -479,7 +479,7 @@ BYTE VARCH29[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH30[] = { +const BYTE VARCH30[] = { // clang-format off 2, 4, // width, height @@ -495,7 +495,7 @@ BYTE VARCH30[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH31[] = { +const BYTE VARCH31[] = { // clang-format off 2, 4, // width, height @@ -511,7 +511,7 @@ BYTE VARCH31[] = { // clang-format on }; /** Miniset: Arch vertical. */ -BYTE VARCH32[] = { +const BYTE VARCH32[] = { // clang-format off 2, 4, // width, height @@ -527,7 +527,7 @@ BYTE VARCH32[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH33[] = { +const BYTE VARCH33[] = { // clang-format off 2, 4, // width, height @@ -543,7 +543,7 @@ BYTE VARCH33[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH34[] = { +const BYTE VARCH34[] = { // clang-format off 2, 4, // width, height @@ -559,7 +559,7 @@ BYTE VARCH34[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH35[] = { +const BYTE VARCH35[] = { // clang-format off 2, 4, // width, height @@ -575,7 +575,7 @@ BYTE VARCH35[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH36[] = { +const BYTE VARCH36[] = { // clang-format off 2, 4, // width, height @@ -591,7 +591,7 @@ BYTE VARCH36[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH37[] = { +const BYTE VARCH37[] = { // clang-format off 2, 4, // width, height @@ -607,7 +607,7 @@ BYTE VARCH37[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH38[] = { +const BYTE VARCH38[] = { // clang-format off 2, 4, // width, height @@ -623,7 +623,7 @@ BYTE VARCH38[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH39[] = { +const BYTE VARCH39[] = { // clang-format off 2, 4, // width, height @@ -639,7 +639,7 @@ BYTE VARCH39[] = { // clang-format on }; /** Miniset: Arch vertical - room west entrance. */ -BYTE VARCH40[] = { +const BYTE VARCH40[] = { // clang-format off 2, 4, // width, height @@ -655,7 +655,7 @@ BYTE VARCH40[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH1[] = { +const BYTE HARCH1[] = { // clang-format off 3, 2, // width, height @@ -667,7 +667,7 @@ BYTE HARCH1[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH2[] = { +const BYTE HARCH2[] = { // clang-format off 3, 2, // width, height @@ -679,7 +679,7 @@ BYTE HARCH2[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH3[] = { +const BYTE HARCH3[] = { // clang-format off 3, 2, // width, height @@ -691,7 +691,7 @@ BYTE HARCH3[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH4[] = { +const BYTE HARCH4[] = { // clang-format off 3, 2, // width, height @@ -703,7 +703,7 @@ BYTE HARCH4[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH5[] = { +const BYTE HARCH5[] = { // clang-format off 3, 2, // width, height @@ -715,7 +715,7 @@ BYTE HARCH5[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH6[] = { +const BYTE HARCH6[] = { // clang-format off 3, 2, // width, height @@ -727,7 +727,7 @@ BYTE HARCH6[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH7[] = { +const BYTE HARCH7[] = { // clang-format off 3, 2, // width, height @@ -739,7 +739,7 @@ BYTE HARCH7[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH8[] = { +const BYTE HARCH8[] = { // clang-format off 3, 2, // width, height @@ -751,7 +751,7 @@ BYTE HARCH8[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH9[] = { +const BYTE HARCH9[] = { // clang-format off 3, 2, // width, height @@ -763,7 +763,7 @@ BYTE HARCH9[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH10[] = { +const BYTE HARCH10[] = { // clang-format off 3, 2, // width, height @@ -775,7 +775,7 @@ BYTE HARCH10[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH11[] = { +const BYTE HARCH11[] = { // clang-format off 3, 2, // width, height @@ -787,7 +787,7 @@ BYTE HARCH11[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH12[] = { +const BYTE HARCH12[] = { // clang-format off 3, 2, // width, height @@ -799,7 +799,7 @@ BYTE HARCH12[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH13[] = { +const BYTE HARCH13[] = { // clang-format off 3, 2, // width, height @@ -811,7 +811,7 @@ BYTE HARCH13[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH14[] = { +const BYTE HARCH14[] = { // clang-format off 3, 2, // width, height @@ -823,7 +823,7 @@ BYTE HARCH14[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH15[] = { +const BYTE HARCH15[] = { // clang-format off 3, 2, // width, height @@ -835,7 +835,7 @@ BYTE HARCH15[] = { // clang-format on }; /** Miniset: Arch horizontal - north corner. */ -BYTE HARCH16[] = { +const BYTE HARCH16[] = { // clang-format off 3, 2, // width, height @@ -847,7 +847,7 @@ BYTE HARCH16[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH17[] = { +const BYTE HARCH17[] = { // clang-format off 3, 2, // width, height @@ -859,7 +859,7 @@ BYTE HARCH17[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH18[] = { +const BYTE HARCH18[] = { // clang-format off 3, 2, // width, height @@ -871,7 +871,7 @@ BYTE HARCH18[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH19[] = { +const BYTE HARCH19[] = { // clang-format off 3, 2, // width, height @@ -883,7 +883,7 @@ BYTE HARCH19[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH20[] = { +const BYTE HARCH20[] = { // clang-format off 3, 2, // width, height @@ -895,7 +895,7 @@ BYTE HARCH20[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH21[] = { +const BYTE HARCH21[] = { // clang-format off 3, 2, // width, height @@ -907,7 +907,7 @@ BYTE HARCH21[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH22[] = { +const BYTE HARCH22[] = { // clang-format off 3, 2, // width, height @@ -919,7 +919,7 @@ BYTE HARCH22[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH23[] = { +const BYTE HARCH23[] = { // clang-format off 3, 2, // width, height @@ -931,7 +931,7 @@ BYTE HARCH23[] = { // clang-format on }; /** Miniset: Arch horizontal - wall. */ -BYTE HARCH24[] = { +const BYTE HARCH24[] = { // clang-format off 3, 2, // width, height @@ -943,7 +943,7 @@ BYTE HARCH24[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH25[] = { +const BYTE HARCH25[] = { // clang-format off 3, 2, // width, height @@ -955,7 +955,7 @@ BYTE HARCH25[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH26[] = { +const BYTE HARCH26[] = { // clang-format off 3, 2, // width, height @@ -967,7 +967,7 @@ BYTE HARCH26[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH27[] = { +const BYTE HARCH27[] = { // clang-format off 3, 2, // width, height @@ -979,7 +979,7 @@ BYTE HARCH27[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH28[] = { +const BYTE HARCH28[] = { // clang-format off 3, 2, // width, height @@ -991,7 +991,7 @@ BYTE HARCH28[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH29[] = { +const BYTE HARCH29[] = { // clang-format off 3, 2, // width, height @@ -1003,7 +1003,7 @@ BYTE HARCH29[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH30[] = { +const BYTE HARCH30[] = { // clang-format off 3, 2, // width, height @@ -1015,7 +1015,7 @@ BYTE HARCH30[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH31[] = { +const BYTE HARCH31[] = { // clang-format off 3, 2, // width, height @@ -1027,7 +1027,7 @@ BYTE HARCH31[] = { // clang-format on }; /** Miniset: Arch horizontal. */ -BYTE HARCH32[] = { +const BYTE HARCH32[] = { // clang-format off 3, 2, // width, height @@ -1039,7 +1039,7 @@ BYTE HARCH32[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH33[] = { +const BYTE HARCH33[] = { // clang-format off 3, 2, // width, height @@ -1051,7 +1051,7 @@ BYTE HARCH33[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH34[] = { +const BYTE HARCH34[] = { // clang-format off 3, 2, // width, height @@ -1063,7 +1063,7 @@ BYTE HARCH34[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH35[] = { +const BYTE HARCH35[] = { // clang-format off 3, 2, // width, height @@ -1075,7 +1075,7 @@ BYTE HARCH35[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH36[] = { +const BYTE HARCH36[] = { // clang-format off 3, 2, // width, height @@ -1087,7 +1087,7 @@ BYTE HARCH36[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH37[] = { +const BYTE HARCH37[] = { // clang-format off 3, 2, // width, height @@ -1099,7 +1099,7 @@ BYTE HARCH37[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH38[] = { +const BYTE HARCH38[] = { // clang-format off 3, 2, // width, height @@ -1111,7 +1111,7 @@ BYTE HARCH38[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH39[] = { +const BYTE HARCH39[] = { // clang-format off 3, 2, // width, height @@ -1123,7 +1123,7 @@ BYTE HARCH39[] = { // clang-format on }; /** Miniset: Arch horizontal - west corner. */ -BYTE HARCH40[] = { +const BYTE HARCH40[] = { // clang-format off 3, 2, // width, height @@ -1135,7 +1135,7 @@ BYTE HARCH40[] = { // clang-format on }; /** Miniset: Stairs up. */ -BYTE USTAIRS[] = { +const BYTE USTAIRS[] = { // clang-format off 4, 4, // width, height @@ -1151,7 +1151,7 @@ BYTE USTAIRS[] = { // clang-format on }; /** Miniset: Stairs down. */ -BYTE DSTAIRS[] = { +const BYTE DSTAIRS[] = { // clang-format off 4, 4, // width, height @@ -1167,7 +1167,7 @@ BYTE DSTAIRS[] = { // clang-format on }; /** Miniset: Stairs to town. */ -BYTE WARPSTAIRS[] = { +const BYTE WARPSTAIRS[] = { // clang-format off 4, 4, // width, height @@ -1183,7 +1183,7 @@ BYTE WARPSTAIRS[] = { // clang-format on }; /** Miniset: Crumbled south pillar. */ -BYTE CRUSHCOL[] = { +const BYTE CRUSHCOL[] = { // clang-format off 3, 3, // width, height @@ -1197,7 +1197,7 @@ BYTE CRUSHCOL[] = { // clang-format on }; /** Miniset: Vertical oil spill. */ -BYTE BIG1[] = { +const BYTE BIG1[] = { // clang-format off 2, 2, // width, height @@ -1209,7 +1209,7 @@ BYTE BIG1[] = { // clang-format on }; /** Miniset: Horizontal oil spill. */ -BYTE BIG2[] = { +const BYTE BIG2[] = { // clang-format off 2, 2, // width, height @@ -1221,7 +1221,7 @@ BYTE BIG2[] = { // clang-format on }; /** Miniset: Horizontal platform. */ -BYTE BIG3[] = { +const BYTE BIG3[] = { // clang-format off 1, 2, // width, height @@ -1233,7 +1233,7 @@ BYTE BIG3[] = { // clang-format on }; /** Miniset: Vertical platform. */ -BYTE BIG4[] = { +const BYTE BIG4[] = { // clang-format off 2, 1, // width, height @@ -1243,7 +1243,7 @@ BYTE BIG4[] = { // clang-format on }; /** Miniset: Large oil spill. */ -BYTE BIG5[] = { +const BYTE BIG5[] = { // clang-format off 2, 2, // width, height @@ -1255,7 +1255,7 @@ BYTE BIG5[] = { // clang-format on }; /** Miniset: Vertical wall with debris. */ -BYTE BIG6[] = { +const BYTE BIG6[] = { // clang-format off 1, 2, // width, height @@ -1267,7 +1267,7 @@ BYTE BIG6[] = { // clang-format on }; /** Miniset: Horizontal wall with debris. */ -BYTE BIG7[] = { +const BYTE BIG7[] = { // clang-format off 2, 1, // width, height @@ -1277,7 +1277,7 @@ BYTE BIG7[] = { // clang-format on }; /** Miniset: Rock pile. */ -BYTE BIG8[] = { +const BYTE BIG8[] = { // clang-format off 2, 2, // width, height @@ -1289,7 +1289,7 @@ BYTE BIG8[] = { // clang-format on }; /** Miniset: Vertical wall collapsed. */ -BYTE BIG9[] = { +const BYTE BIG9[] = { // clang-format off 2, 2, // width, height @@ -1301,7 +1301,7 @@ BYTE BIG9[] = { // clang-format on }; /** Miniset: Horizontal wall collapsed. */ -BYTE BIG10[] = { +const BYTE BIG10[] = { // clang-format off 2, 2, // width, height @@ -1313,7 +1313,7 @@ BYTE BIG10[] = { // clang-format on }; /** Miniset: Crumbled vertical wall 1. */ -BYTE RUINS1[] = { +const BYTE RUINS1[] = { // clang-format off 1, 1, // width, height @@ -1323,7 +1323,7 @@ BYTE RUINS1[] = { // clang-format on }; /** Miniset: Crumbled vertical wall 2. */ -BYTE RUINS2[] = { +const BYTE RUINS2[] = { // clang-format off 1, 1, // width, height @@ -1333,7 +1333,7 @@ BYTE RUINS2[] = { // clang-format on }; /** Miniset: Crumbled vertical wall 3. */ -BYTE RUINS3[] = { +const BYTE RUINS3[] = { // clang-format off 1, 1, // width, height @@ -1343,7 +1343,7 @@ BYTE RUINS3[] = { // clang-format on }; /** Miniset: Crumbled horizontal wall 1. */ -BYTE RUINS4[] = { +const BYTE RUINS4[] = { // clang-format off 1, 1, // width, height @@ -1353,7 +1353,7 @@ BYTE RUINS4[] = { // clang-format on }; /** Miniset: Crumbled horizontal wall 2. */ -BYTE RUINS5[] = { +const BYTE RUINS5[] = { // clang-format off 1, 1, // width, height @@ -1363,7 +1363,7 @@ BYTE RUINS5[] = { // clang-format on }; /** Miniset: Crumbled horizontal wall 3. */ -BYTE RUINS6[] = { +const BYTE RUINS6[] = { // clang-format off 1, 1, // width, height @@ -1373,7 +1373,7 @@ BYTE RUINS6[] = { // clang-format on }; /** Miniset: Crumbled north pillar. */ -BYTE RUINS7[] = { +const BYTE RUINS7[] = { // clang-format off 1, 1, // width, height @@ -1383,7 +1383,7 @@ BYTE RUINS7[] = { // clang-format on }; /** Miniset: Bloody gib 1. */ -BYTE PANCREAS1[] = { +const BYTE PANCREAS1[] = { // clang-format off 5, 3, // width, height @@ -1397,7 +1397,7 @@ BYTE PANCREAS1[] = { // clang-format on }; /** Miniset: Bloody gib 2. */ -BYTE PANCREAS2[] = { +const BYTE PANCREAS2[] = { // clang-format off 5, 3, // width, height @@ -1411,7 +1411,7 @@ BYTE PANCREAS2[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 1. */ -BYTE CTRDOOR1[] = { +const BYTE CTRDOOR1[] = { // clang-format off 3, 3, // width, height @@ -1425,7 +1425,7 @@ BYTE CTRDOOR1[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 2. */ -BYTE CTRDOOR2[] = { +const BYTE CTRDOOR2[] = { // clang-format off 3, 3, // width, height @@ -1439,7 +1439,7 @@ BYTE CTRDOOR2[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 3. */ -BYTE CTRDOOR3[] = { +const BYTE CTRDOOR3[] = { // clang-format off 3, 3, // width, height @@ -1453,7 +1453,7 @@ BYTE CTRDOOR3[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 4. */ -BYTE CTRDOOR4[] = { +const BYTE CTRDOOR4[] = { // clang-format off 3, 3, // width, height @@ -1467,7 +1467,7 @@ BYTE CTRDOOR4[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 5. */ -BYTE CTRDOOR5[] = { +const BYTE CTRDOOR5[] = { // clang-format off 3, 3, // width, height @@ -1481,7 +1481,7 @@ BYTE CTRDOOR5[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 6. */ -BYTE CTRDOOR6[] = { +const BYTE CTRDOOR6[] = { // clang-format off 3, 3, // width, height @@ -1495,7 +1495,7 @@ BYTE CTRDOOR6[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 7. */ -BYTE CTRDOOR7[] = { +const BYTE CTRDOOR7[] = { // clang-format off 3, 3, // width, height @@ -1509,7 +1509,7 @@ BYTE CTRDOOR7[] = { // clang-format on }; /** Miniset: Move vertical doors away from west pillar 8. */ -BYTE CTRDOOR8[] = { +const BYTE CTRDOOR8[] = { // clang-format off 3, 3, // width, height @@ -1596,37 +1596,9 @@ int Patterns[100][10] = { { 4, 1, 1, 1, 1, 1, 2, 1, 1, 14 }, { 1, 1, 1, 1, 1, 1, 1, 1, 2, 8 }, { 0, 0, 0, 0, 255, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -static BOOL DRLG_L2PlaceMiniSet(BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) +}; + +static BOOL DRLG_L2PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) { int sx, sy, sw, sh, xx, yy, i, ii, numt, bailcnt; BOOL found; @@ -1712,7 +1684,7 @@ static BOOL DRLG_L2PlaceMiniSet(BYTE *miniset, int tmin, int tmax, int cx, int c return TRUE; } -static void DRLG_L2PlaceRndSet(BYTE *miniset, int rndper) +static void DRLG_L2PlaceRndSet(const BYTE *miniset, int rndper) { int sx, sy, sw, sh, xx, yy, ii, kk; BOOL found; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index be9c6d3d9..bb95003e1 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -12,8 +12,6 @@ DEVILUTION_BEGIN_NAMESPACE /** This will be true if a lava pool has been generated for the level */ BOOLEAN lavapool; -/** unused */ -int abyssx; int lockoutcnt; BOOLEAN lockout[DMAXX][DMAXY]; @@ -2691,7 +2689,6 @@ void LoadL3Dungeon(const char *sFileName, int vx, int vy) } } - abyssx = MAXDUNX; // Unused DRLG_L3Pass3(); DRLG_Init_Globals(); ViewX = vx; diff --git a/Source/engine.cpp b/Source/engine.cpp index 2821afe0e..06a68ee22 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -15,19 +15,11 @@ DEVILUTION_BEGIN_NAMESPACE -/** automap pixel color 8-bit (palette entry) */ -char gbPixelCol; -/** flip - if y < x */ -BOOL gbRotateMap; /** Seed value before the most recent call to SetRndSeed() */ int orgseed; -/** Width of sprite being blitted */ -int sgnWidth; /** Current game seed */ int sglGameSeed; static CCritSect sgMemCrit; -/** valid - if x/y are in bounds */ -BOOL gbNotInView; /** * Specifies the increment used in the Borland C/C++ pseudo-random. @@ -691,31 +683,6 @@ void ENG_set_pixel(int sx, int sy, BYTE col) *dst = col; } -/** - * @brief Set the value of a single pixel in the back buffer to that of gbPixelCol, checks bounds - * @param sx Back buffer coordinate - * @param sy Back buffer coordinate - */ -void engine_draw_pixel(int sx, int sy) -{ - BYTE *dst; - - assert(gpBuffer); - - if (gbRotateMap) { - if (gbNotInView && (sx < 0 || sx >= SCREEN_HEIGHT + SCREEN_Y || sy < SCREEN_X || sy >= SCREEN_WIDTH + SCREEN_X)) - return; - dst = &gpBuffer[sy + BUFFER_WIDTH * sx]; - } else { - if (gbNotInView && (sy < 0 || sy >= SCREEN_HEIGHT + SCREEN_Y || sx < SCREEN_X || sx >= SCREEN_WIDTH + SCREEN_X)) - return; - dst = &gpBuffer[sx + BUFFER_WIDTH * sy]; - } - - if (dst < gpBufEnd && dst > gpBufStart) - *dst = gbPixelCol; -} - /** * @brief Draw a line on the back buffer * @param x0 Back buffer coordinate @@ -1142,7 +1109,7 @@ static void Cl2BlitOutlineSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, */ static void Cl2BlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, BYTE *pTable) { - int w; + int w, spriteWidth; char width; BYTE fill; BYTE *src, *dst; @@ -1150,7 +1117,7 @@ static void Cl2BlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, in src = pRLEBytes; dst = pDecodeTo; w = nWidth; - sgnWidth = nWidth; + spriteWidth = nWidth; while (nDataSize) { width = *src++; @@ -1168,8 +1135,8 @@ static void Cl2BlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, in dst++; width--; } - if (!w) { - w = sgnWidth; + if (w == 0) { + w = spriteWidth; dst -= BUFFER_WIDTH + w; } continue; @@ -1184,8 +1151,8 @@ static void Cl2BlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, in dst++; width--; } - if (!w) { - w = sgnWidth; + if (w == 0) { + w = spriteWidth; dst -= BUFFER_WIDTH + w; } continue; @@ -1204,8 +1171,8 @@ static void Cl2BlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, in w -= width; width = 0; } - if (!w) { - w = sgnWidth; + if (w == 0) { + w = spriteWidth; dst -= BUFFER_WIDTH + w; } } diff --git a/Source/engine.h b/Source/engine.h index a6b449715..1c8e2df71 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -63,14 +63,12 @@ void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, c void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, int nWidth); void CelBlitOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); void ENG_set_pixel(int sx, int sy, BYTE col); -void engine_draw_pixel(int sx, int sy); void DrawLine(int x0, int y0, int x1, int y1, BYTE col); int GetDirection(int x1, int y1, int x2, int y2); void SetRndSeed(int s); int AdvanceRndSeed(); int GetRndSeed(); int random_(BYTE idx, int v); -void engine_debug_trap(BOOL show_cursor); BYTE *DiabloAllocPtr(DWORD dwBytes); void mem_free_dbg(void *p); BYTE *LoadFileInMem(const char *pszName, DWORD *pdwFileLen); diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 2eb84f0d3..8085c0416 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -29,40 +29,10 @@ BYTE *pSpecialCels; BYTE *pMegaTiles; BYTE *pLevelPieces; BYTE *pDungeonCels; -BYTE *pSpeedCels; -/** - * Returns the frame number of the speed CEL, an in memory decoding - * of level CEL frames, based on original frame number and light index. - * Note, given light index 0, the original frame number is returned. - */ -int SpeedFrameTbl[128][16]; /** * List of transparancy masks to use for dPieces */ char block_lvid[MAXTILES + 1]; -/** Specifies the CEL frame occurrence for each frame of the level CEL (e.g. "levels/l1data/l1.cel"). */ -int level_frame_count[MAXTILES]; -int tile_defs[MAXTILES]; -/** - * Secifies the CEL frame decoder type for each frame of the - * level CEL (e.g. "levels/l1data/l1.cel"), Indexed by frame numbers starting at 1. - * The decoder type may be one of the following. - * 0x0000 - cel.decodeType0 - * 0x1000 - cel.decodeType1 - * 0x2000 - cel.decodeType2 - * 0x3000 - cel.decodeType3 - * 0x4000 - cel.decodeType4 - * 0x5000 - cel.decodeType5 - * 0x6000 - cel.decodeType6 - */ -WORD level_frame_types[MAXTILES]; -/** - * Specifies the size of each frame of the level cel (e.g. - * "levels/l1data/l1.cel"). Indexed by frame numbers starting at 1. - */ -int level_frame_sizes[MAXTILES]; -/** Specifies the number of frames in the level cel (e.g. "levels/l1data/l1.cel"). */ -int nlevel_frames; /** * List of light blocking dPieces */ diff --git a/Source/gendung.h b/Source/gendung.h index 19d0c534e..fea5a19af 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -45,8 +45,6 @@ extern BYTE *pSpecialCels; extern BYTE *pMegaTiles; extern BYTE *pLevelPieces; extern BYTE *pDungeonCels; -extern BYTE *pSpeedCels; -extern int SpeedFrameTbl[128][16]; extern char block_lvid[MAXTILES + 1]; extern BOOLEAN nBlockTable[MAXTILES + 1]; extern BOOLEAN nSolidTable[MAXTILES + 1]; diff --git a/Source/gmenu.h b/Source/gmenu.h index 757cecce7..1c488152c 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -12,7 +12,6 @@ DEVILUTION_BEGIN_NAMESPACE extern "C" { #endif -extern void (*dword_63447C)(TMenuItem *); extern TMenuItem *sgpCurrentMenu; void gmenu_draw_pause(); diff --git a/Source/help.cpp b/Source/help.cpp index 9d3d87c77..6238f0d4e 100644 --- a/Source/help.cpp +++ b/Source/help.cpp @@ -8,9 +8,7 @@ DEVILUTION_BEGIN_NAMESPACE int help_select_line; -int unused_help; BOOL helpflag; -int displayinghelp[22]; /* check, does nothing? */ int HelpTop; const char gszSpawnHelpText[] = { @@ -447,8 +445,6 @@ const char gszHelpText[] = { void InitHelp() { helpflag = FALSE; - unused_help = 0; - displayinghelp[0] = 0; } static void DrawHelpLine(int x, int y, char *text, char color) diff --git a/Source/init.cpp b/Source/init.cpp index b0fc608a2..f7f1a0f54 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -17,7 +17,7 @@ DEVILUTION_BEGIN_NAMESPACE _SNETVERSIONDATA fileinfo; /** True if the game is the current active window */ int gbActive; -/** A handle to an unused MPQ archive. */ +/** A handle to an hellfire.mpq archive. */ HANDLE hellfire_mpq; /** The current input handler function */ WNDPROC CurrentProc; diff --git a/Source/inv.h b/Source/inv.h index ec3e85227..7ea96d254 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -23,7 +23,6 @@ void DrawInvBelt(); BOOL AutoPlace(int pnum, int ii, int sx, int sy, BOOL saveflag); BOOL SpecialAutoPlace(int pnum, int ii, int sx, int sy); BOOL GoldAutoPlace(int pnum); -int SwapItem(ItemStruct *a, ItemStruct *b); void CheckInvSwap(int pnum, BYTE bLoc, int idx, WORD wCI, int seed, BOOL bId); void inv_update_rem_item(int pnum, BYTE iv); void RemoveInvItem(int pnum, int iv); diff --git a/Source/items.cpp b/Source/items.cpp index cbe30b024..4e220cd8c 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -619,7 +619,6 @@ static void items_42390F() void InitItems() { int i; - long s; GetItemAttrs(0, IDI_GOLD, 1); golditem = item[0]; @@ -642,7 +641,7 @@ void InitItems() } if (!setlevel) { - s = AdvanceRndSeed(); /* unused */ + AdvanceRndSeed(); /* unused */ if (QuestStatus(Q_ROCK)) SpawnRock(); if (QuestStatus(Q_ANVIL)) diff --git a/Source/items.h b/Source/items.h index af6f03517..61a994ec0 100644 --- a/Source/items.h +++ b/Source/items.h @@ -22,23 +22,12 @@ typedef struct CornerStoneStruct { extern int itemactive[MAXITEMS]; extern BOOL uitemflag; extern int itemavail[MAXITEMS]; -extern ItemGetRecordStruct itemrecord[MAXITEMS]; extern ItemStruct item[MAXITEMS + 1]; extern CornerStoneStruct CornerStone; extern BOOL UniqueItemFlag[128]; extern int auricGold; extern int numitems; -int get_ring_max_value(int i); -int get_bow_max_value(int i); -int get_staff_max_value(int i); -int get_sword_max_value(int i); -int get_helm_max_value(int i); -int get_shield_max_value(int i); -int get_armor_max_value(int i); -int get_mace_max_value(int i); -int get_amulet_max_value(int i); -int get_axe_max_value(int i); void InitItemGFX(); void InitItems(); void CalcPlrItemVals(int p, BOOL Loadgfx); diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 878f0abf5..ff033c308 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -14,7 +14,9 @@ int numlights; BYTE lightradius[16][128]; BOOL dovision; int numvision; +#ifdef _DEBUG char lightmax; +#endif BOOL dolighting; BYTE lightblock[64][16][16]; int visionid; @@ -44,7 +46,7 @@ BOOL lightflag; * | 526 * +-------> x */ -char CrawlTable[2749] = { +const char CrawlTable[2749] = { 1, 0, 0, 4, @@ -408,30 +410,11 @@ char CrawlTable[2749] = { -18, -1, 18, -1, -18, 0, 18, 0 }; -/** pCrawlTable maps from circle radius to the X- and Y-coordinate deltas from the center of a circle. */ -char *pCrawlTable[19] = { - CrawlTable, - CrawlTable + 3, - CrawlTable + 12, - CrawlTable + 45, - CrawlTable + 94, - CrawlTable + 159, - CrawlTable + 240, - CrawlTable + 337, - CrawlTable + 450, - CrawlTable + 579, - CrawlTable + 724, - CrawlTable + 885, - CrawlTable + 1062, - CrawlTable + 1255, - CrawlTable + 1464, - CrawlTable + 1689, - CrawlTable + 1930, - CrawlTable + 2187, - CrawlTable + 2460 -}; -/** vCrawlTable specifies the X- Y-coordinate offsets of lighting visions. */ -BYTE vCrawlTable[23][30] = { +/* + * vCrawlTable specifies the X- Y-coordinate offsets of lighting visions. + * The last entry-pair is only for alignment. + */ +const BYTE vCrawlTable[23][30] = { // clang-format off { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0 }, { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15, 1 }, @@ -458,30 +441,9 @@ BYTE vCrawlTable[23][30] = { { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15 }, // clang-format on }; -/** unused */ -BYTE byte_49463C[18][18] = { - { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 } -}; /** RadiusAdj maps from vCrawlTable index to lighting vision radius adjustment. */ -BYTE RadiusAdj[23] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0 }; +const BYTE RadiusAdj[23] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0 }; void RotateRadius(int *x, int *y, int *dx, int *dy, int *lx, int *ly, int *bx, int *by) { diff --git a/Source/lighting.h b/Source/lighting.h index db0d4097a..67b7c97a0 100644 --- a/Source/lighting.h +++ b/Source/lighting.h @@ -32,8 +32,6 @@ extern LightListStruct VisionList[MAXVISION]; extern BYTE lightactive[MAXLIGHTS]; extern LightListStruct LightList[MAXLIGHTS]; extern int numlights; -extern BYTE lightradius[16][128]; -extern BOOL dovision; extern int numvision; extern char lightmax; extern BOOL dolighting; @@ -69,8 +67,8 @@ void lighting_color_cycling(); /* rdata */ -extern char CrawlTable[2749]; -extern BYTE vCrawlTable[23][30]; +extern const char CrawlTable[2749]; +extern const BYTE vCrawlTable[23][30]; #ifdef __cplusplus } diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 998f7ba65..fce42baf3 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -17,10 +17,10 @@ BOOL MissilePreFlag; int numchains; /** Maps from direction to X-offset. */ -int XDirAdd[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; +const int XDirAdd[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; /** Maps from direction to Y-offset. */ -int YDirAdd[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; -int CrawlNum[19] = { 0, 3, 12, 45, 94, 159, 240, 337, 450, 579, 724, 885, 1062, 1255, 1464, 1689, 1930, 2187, 2460 }; +const int YDirAdd[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; +const int CrawlNum[19] = { 0, 3, 12, 45, 94, 159, 240, 337, 450, 579, 724, 885, 1062, 1255, 1464, 1689, 1930, 2187, 2460 }; void GetDamageAmt(int i, int *mind, int *maxd) { @@ -3426,7 +3426,7 @@ void MI_Dummy(int i) void MI_Golem(int i) { int tx, ty, dp, l, m, src, k, tid; - char *ct; + const char *ct; src = missile[i]._misource; if (monster[src]._mx == 1 && !monster[src]._my) { diff --git a/Source/monster.cpp b/Source/monster.cpp index f736c4948..e24a5283b 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -71,12 +71,6 @@ int offset_x[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; /** Maps from direction to delta Y-offset. */ int offset_y[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; -/** unused */ -int rnd5[4] = { 5, 10, 15, 20 }; -int rnd10[4] = { 10, 15, 20, 30 }; -int rnd20[4] = { 20, 30, 40, 50 }; -int rnd60[4] = { 60, 70, 80, 90 }; - /** Maps from monster AI ID to monster AI function. */ void (*AiProc[])(int i) = { &MAI_Zombie, @@ -281,10 +275,13 @@ void GetLevelMTypes() } } +#ifdef _DEBUG if (monstdebug) { for (i = 0; i < debugmonsttypes; i++) AddMonsterType(DebugMonsters[i], PLACE_SCATTER); - } else { + } else +#endif + { while (nt > 0 && nummtypes < MAX_LVLMTYPES && monstimgtot < 4000) { for (i = 0; i < nt;) { diff --git a/Source/monster.h b/Source/monster.h index cb32a35f9..6f2f1df85 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -39,13 +39,7 @@ void M_GetKnockback(int i); void M_StartHit(int i, int pnum, int dam); void M_StartKill(int i, int pnum); void M_SyncStartKill(int i, int x, int y, int pnum); -BOOL M_DoStand(int i); -BOOL M_DoWalk(int i); -BOOL M_DoWalk2(int i); -BOOL M_DoWalk3(int i); -BOOL M_DoAttack(int i); void M_Teleport(int i); -BOOL M_DoGotHit(int i); void M_UpdateLeader(int i); void DoEnding(); void PrepDoEnding(); diff --git a/Source/movie.h b/Source/movie.h index f93c83a46..7dbca79de 100644 --- a/Source/movie.h +++ b/Source/movie.h @@ -16,7 +16,6 @@ extern BYTE movie_playing; extern BOOL loop_movie; void play_movie(const char *pszMovie, BOOL user_can_close); -void MovieWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); #ifdef __cplusplus } diff --git a/Source/msg.cpp b/Source/msg.cpp index 18e99da68..17cf54aa8 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -120,7 +120,7 @@ static int msg_wait_for_turns() } multi_process_network_packets(); nthread_send_and_recv_turn(0, 0); - if (nthread_has_500ms_passed(FALSE)) + if (nthread_has_500ms_passed()) nthread_recv_turns(&received); if (gbGameDestroyed) diff --git a/Source/nthread.cpp b/Source/nthread.cpp index f75a6362d..622f5a08a 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -222,10 +222,9 @@ void nthread_ignore_mutex(BOOL bStart) /** * @brief Checks if it's time for the logic to advance - * @param unused * @return True if the engine should tick */ -BOOL nthread_has_500ms_passed(BOOL unused) +BOOL nthread_has_500ms_passed() { DWORD currentTickCount; int ticksElapsed; diff --git a/Source/nthread.h b/Source/nthread.h index 7b72efea8..7bd0e6e23 100644 --- a/Source/nthread.h +++ b/Source/nthread.h @@ -17,7 +17,6 @@ extern DWORD gdwMsgLenTbl[MAX_PLRS]; extern DWORD gdwDeltaBytesSec; extern DWORD gdwTurnsInTransit; extern uintptr_t glpMsgTbl[MAX_PLRS]; -extern int turn_upper_bit; extern DWORD gdwLargestMsgSize; extern DWORD gdwNormalMsgSize; @@ -28,7 +27,7 @@ void nthread_set_turn_upper_bit(); void nthread_start(BOOL set_turn_upper_bit); void nthread_cleanup(); void nthread_ignore_mutex(BOOL bStart); -BOOL nthread_has_500ms_passed(BOOL unused); +BOOL nthread_has_500ms_passed(); #ifdef __cplusplus } diff --git a/Source/palette.cpp b/Source/palette.cpp index 71aec5a9d..45187f52b 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -47,7 +47,7 @@ void ApplyGamma(SDL_Color *dst, const SDL_Color *src, int n) force_redraw = 255; } -void SaveGamma() +static void SaveGamma() { SRegSaveValue("Diablo", "Gamma Correction", 0, gamma_correction); SRegSaveValue("Diablo", "Color Cycling", FALSE, color_cycling_enabled); diff --git a/Source/palette.h b/Source/palette.h index bee956717..5d48e9ce0 100644 --- a/Source/palette.h +++ b/Source/palette.h @@ -18,7 +18,6 @@ extern SDL_Color orig_palette[256]; extern Uint8 paletteTransparencyLookup[256][256]; void palette_update(); -void SaveGamma(); void palette_init(); void LoadPalette(const char *pszFileName); void LoadRndLvlPal(int l); diff --git a/Source/path.cpp b/Source/path.cpp index a3d82292c..d7b470f37 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -23,7 +23,6 @@ PATHNODE *pnode_ptr; PATHNODE *pnode_tblptr[MAXPATHNODES]; /** A linked list of the A* frontier, sorted by distance */ PATHNODE *path_2_nodes; -PATHNODE path_unusednodes[MAXPATHNODES]; /** For iterating over the 8 possible movement directions */ const char pathxdir[8] = { -1, -1, 1, 1, -1, 0, 1, 0 }; diff --git a/Source/pfile.h b/Source/pfile.h index d4ce23e58..26e1ef6bb 100644 --- a/Source/pfile.h +++ b/Source/pfile.h @@ -14,7 +14,6 @@ extern "C" { extern BOOL gbValidSaveFile; -void pfile_init_save_directory(); void pfile_write_hero(); BOOL pfile_create_player_description(char *dst, DWORD len); BOOL pfile_rename_hero(const char *name_1, const char *name_2); diff --git a/Source/player.cpp b/Source/player.cpp index bd92f45dd..e5b977909 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -213,8 +213,6 @@ const char *const ClassStrTbl[] = { "Rogue", "Warrior", }; -/** Unused local of PM_ChangeLightOff, originally for computing light radius. */ -BYTE fix[9] = { 0, 0, 3, 3, 3, 6, 6, 6, 8 }; void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim) { diff --git a/Source/player.h b/Source/player.h index 12dc294cf..03e471b43 100644 --- a/Source/player.h +++ b/Source/player.h @@ -26,12 +26,13 @@ void SetPlrAnims(int pnum); void ClearPlrRVars(PlayerStruct *p); void CreatePlayer(int pnum, char c); int CalcStatDiff(int pnum); +#ifdef _DEBUG void NextPlrLevel(int pnum); +#endif void AddPlrExperience(int pnum, int lvl, int exp); void AddPlrMonstExper(int lvl, int exp, char pmask); void InitPlayer(int pnum, BOOL FirstTime); void InitMultiView(); -void CheckEFlag(int pnum, BOOL flag); BOOL SolidLoc(int x, int y); void PlrClrTrans(int x, int y); void PlrDoTrans(int x, int y); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 8ac154416..5b352f059 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -57,44 +57,13 @@ DWORD sgdwCursHgtOld; bool dRendered[MAXDUNX][MAXDUNY]; -/* data */ +int frames; +BOOL frameflag; +int frameend; +int framerate; +int framestart; -/* used in 1.00 debug */ -const char *const szMonModeAssert[18] = { - "standing", - "walking (1)", - "walking (2)", - "walking (3)", - "attacking", - "getting hit", - "dying", - "attacking (special)", - "fading in", - "fading out", - "attacking (ranged)", - "standing (special)", - "attacking (special ranged)", - "delaying", - "charging", - "stoned", - "healing", - "talking" -}; - -const char *const szPlrModeAssert[12] = { - "standing", - "walking (1)", - "walking (2)", - "walking (3)", - "attacking (melee)", - "attacking (ranged)", - "blocking", - "getting hit", - "dying", - "casting a spell", - "changing levels", - "quitting" -}; +/* data */ /** * @brief Clear cursor state @@ -374,7 +343,7 @@ static void DrawManaShild(int pnum, int x, int y, bool lighting) */ static void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, int nCel, int nWidth) { - int l, frames; + int l; if ((dFlags[x][y] & BFLAG_LIT) == 0 && !plr[myplr]._pInfraFlag && leveltype != DTYPE_TOWN) { return; @@ -688,9 +657,11 @@ static void scrollrt_draw_dungeon(int sx, int sy, int dx, int dy) if (sy > 0) // check for OOB negMon = dMonster[sx][sy - 1]; +#ifdef _DEBUG if (visiondebug && bFlag & BFLAG_LIT) { CelClippedDraw(dx, dy, pSquareCel, 1, 64); } +#endif if (MissilePreFlag) { DrawMissile(sx, sy, dx, dy, TRUE); diff --git a/Source/scrollrt.h b/Source/scrollrt.h index eb1f761cb..96f90c914 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -26,14 +26,7 @@ extern int cel_foliage_active; extern int level_piece_id; extern BOOLEAN AutoMapShowItems; -extern int tileOffsetX; -extern int tileOffsetY; -extern int tileShiftX; -extern int tileShiftY; - void ClearCursor(); -void DrawMissile(int x, int y, int sx, int sy, BOOL pre); -void DrawDeadPlayer(int x, int y, int sx, int sy); void ShiftGrid(int *x, int *y, int horizontal, int vertical); int RowsCoveredByPanel(); void CalcTileOffset(int *offsetX, int *offsetY); diff --git a/Source/stores.cpp b/Source/stores.cpp index 467c0f531..f633f3fd3 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2580,20 +2580,23 @@ void S_HBuyEnter() stextvhold = stextsval; stextshold = STORE_HBUY; idx = stextsval + ((stextsel - stextup) >> 2); + if (plr[myplr]._pGold < healitem[idx]._iIvalue) { StartStore(STORE_NOMONEY); } else { plr[myplr].HoldItem = healitem[idx]; SetCursor_(plr[myplr].HoldItem._iCurs + CURSOR_FIRSTITEM); done = FALSE; - i = 0; + for (i = 0; i < NUM_INV_GRID_ELEM && !done; i++) { done = SpecialAutoPlace(myplr, i, cursW / 28, cursH / 28); } + if (done) StartStore(STORE_CONFIRM); else StartStore(STORE_NOROOM); + SetCursor_(CURSOR_HAND); } } diff --git a/Source/stores.h b/Source/stores.h index e1ea544fe..92924ed85 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -27,7 +27,6 @@ extern ItemStruct boyitem; extern ItemStruct premiumitem[SMITH_PREMIUM_ITEMS]; extern BYTE *pSTextBoxCels; extern int premiumlevel; -extern int talker; extern ItemStruct witchitem[WITCH_ITEMS]; extern int numpremium; extern ItemStruct healitem[20]; @@ -36,7 +35,6 @@ extern BYTE *pSTextSlidCels; extern BYTE *pSPentSpn2Cels; extern int boylevel; extern ItemStruct smithitem[SMITH_ITEMS]; -extern int stextdown; extern char stextflag; void InitStores(); diff --git a/Source/textdat.cpp b/Source/textdat.cpp index 1f754592b..b5da114e3 100644 --- a/Source/textdat.cpp +++ b/Source/textdat.cpp @@ -646,7 +646,5 @@ const TextDataStruct alltext[] = { { "Praedictum Otium. |", 1, 5, PS_ROGUE55 }, { "Efficio Obitus Ut Inimicus. |", 1, 5, PS_ROGUE56 }, }; -/** unused */ -const DWORD gdwAllTextEntries = 259; DEVILUTION_END_NAMESPACE diff --git a/Source/towners.cpp b/Source/towners.cpp index e8c8840ba..9aea75ea2 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -11,8 +11,6 @@ BOOL storeflag; int sgnCowMsg; int numtowners; DWORD sgdwCowClicks; -/** unused 0x6AAC28 */ -BOOL bannerflag; BOOL boyloadflag; BYTE *pCowCels; TownerStruct towner[NUM_TOWNERS]; @@ -254,13 +252,10 @@ void InitSmith() void InitBarOwner() { - int i; - - bannerflag = FALSE; // unused InitTownerInfo(numtowners, 96, TRUE, TOWN_TAVERN, 55, 62, 3, 10); InitQstSnds(numtowners); towner[numtowners]._tNData = LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", NULL); - for (i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } towner[numtowners]._tNFrames = 16;