From 327042c2e51e8ef11a7143cd638d2e100c40e397 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 19 Feb 2021 21:29:38 +0100 Subject: [PATCH] Strip out debug features from the release builds leveldebug and lightmax still remains --- Source/all.h | 2 ++ Source/debug.cpp | 2 -- Source/debug.h | 4 +--- Source/diablo.cpp | 6 +++++- Source/diablo.h | 2 +- Source/gendung.cpp | 13 ++++++++----- Source/lighting.cpp | 2 -- Source/monster.cpp | 2 ++ 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Source/all.h b/Source/all.h index 947203b54..a1facf110 100644 --- a/Source/all.h +++ b/Source/all.h @@ -25,7 +25,9 @@ #include "control.h" #include "cursor.h" #include "dead.h" +#ifdef _DEBUG #include "debug.h" +#endif #include "diablo.h" #include "doom.h" #include "drlg_l1.h" diff --git a/Source/debug.cpp b/Source/debug.cpp index 3451a20db..8e8f83b15 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -9,7 +9,6 @@ DEVILUTION_BEGIN_NAMESPACE #ifdef _DEBUG BOOL update_seed_check = FALSE; -#endif #define DEBUGSEEDS 4096 int seed_index; @@ -48,7 +47,6 @@ void CheckDungeonClear() } } -#ifdef _DEBUG void GiveGoldCheat() { int i, ni; diff --git a/Source/debug.h b/Source/debug.h index 8ca19fe57..f096c66da 100644 --- a/Source/debug.h +++ b/Source/debug.h @@ -14,10 +14,9 @@ extern "C" { extern BYTE *pSquareCel; -void LoadDebugGFX(); void FreeDebugGFX(); void CheckDungeonClear(); -#ifdef _DEBUG +void LoadDebugGFX(); void GiveGoldCheat(); void TakeGoldCheat(); void MaxSpellsCheat(); @@ -26,7 +25,6 @@ void PrintDebugPlayer(BOOL bNextPlayer); void PrintDebugQuest(); void GetDebugMonster(); void NextDebugMonster(); -#endif #ifdef __cplusplus } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index c2077ff4d..8a58903c0 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -57,12 +57,12 @@ Options sgOptions; */ BOOL fullscreen = TRUE; bool gbShowIntro = true; +BOOL leveldebug; #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; @@ -241,7 +241,9 @@ static void start_game(unsigned int uMsg) cineflag = FALSE; InitCursor(); InitLightTable(); +#ifdef _DEBUG LoadDebugGFX(); +#endif assert(ghMainWnd); music_stop(); ShowProgress(uMsg); @@ -268,7 +270,9 @@ static void free_game() FreeItemGFX(); FreeCursor(); FreeLightTable(); +#ifdef _DEBUG FreeDebugGFX(); +#endif FreeGameMem(); } diff --git a/Source/diablo.h b/Source/diablo.h index f5fa5ed23..77cd1497f 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -62,12 +62,12 @@ void LoadOptions(); /* rdata */ extern BOOL fullscreen; +extern BOOL leveldebug; #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; diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 8085c0416..cc33bd120 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -592,11 +592,14 @@ BOOL SkipThemeRoom(int x, int y) void InitLevels() { - if (!leveldebug) { - currlevel = 0; - leveltype = DTYPE_TOWN; - setlevel = FALSE; - } +#ifdef _DEBUG + if (leveldebug) + return; +#endif + + currlevel = 0; + leveltype = DTYPE_TOWN; + setlevel = FALSE; } DEVILUTION_END_NAMESPACE diff --git a/Source/lighting.cpp b/Source/lighting.cpp index ff033c308..da1743f16 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -14,9 +14,7 @@ int numlights; BYTE lightradius[16][128]; BOOL dovision; int numvision; -#ifdef _DEBUG char lightmax; -#endif BOOL dolighting; BYTE lightblock[64][16][16]; int visionid; diff --git a/Source/monster.cpp b/Source/monster.cpp index e24a5283b..58d793757 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1106,8 +1106,10 @@ void InitMonsters() int scattertypes[NUM_MTYPES]; numscattypes = 0; +#ifdef _DEBUG if (gbIsMultiplayer) CheckDungeonClear(); +#endif if (!setlevel) { AddMonster(1, 0, 0, 0, FALSE); AddMonster(1, 0, 0, 0, FALSE);