From f1d48d7124ea955c772c9e25a0d5d36fcba6e9ab Mon Sep 17 00:00:00 2001 From: Eric Robinson <68359262+kphoenix137@users.noreply.github.com> Date: Sat, 16 Nov 2024 12:26:59 -0500 Subject: [PATCH] Debug: Insivible (#7543) --- Source/automap.cpp | 4 ++++ Source/debug.cpp | 1 + Source/debug.h | 1 + Source/diablo.cpp | 5 ++++- Source/lua/modules/dev/player.cpp | 7 +++++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index 5ba4a8d32..491a7846a 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -1475,6 +1475,10 @@ void DrawAutomapText(const Surface &out) linePosition.y += 15; DrawString(out, "God Mode", linePosition, debugTextOptions); } + if (DebugInvisible) { + linePosition.y += 15; + DrawString(out, "Invisible", linePosition, debugTextOptions); + } if (DisableLighting) { linePosition.y += 15; DrawString(out, "Fullbright", linePosition, debugTextOptions); diff --git a/Source/debug.cpp b/Source/debug.cpp index ec3761fdf..6f7978ec5 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -30,6 +30,7 @@ std::string TestMapPath; OptionalOwnedClxSpriteList pSquareCel; bool DebugToggle = false; bool DebugGodMode = false; +bool DebugInvisible = false; bool DebugVision = false; bool DebugPath = false; bool DebugGrid = false; diff --git a/Source/debug.h b/Source/debug.h index 7b27aa097..e6218ac79 100644 --- a/Source/debug.h +++ b/Source/debug.h @@ -20,6 +20,7 @@ extern std::string TestMapPath; extern OptionalOwnedClxSpriteList pSquareCel; extern bool DebugToggle; extern bool DebugGodMode; +extern bool DebugInvisible; extern bool DebugVision; extern bool DebugPath; extern bool DebugGrid; diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 7615268c7..ea8ad252d 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1440,7 +1440,10 @@ void GameLogic() } if (leveltype != DTYPE_TOWN) { gGameLogicStep = GameLogicStep::ProcessMonsters; - ProcessMonsters(); +#ifdef _DEBUG + if (!DebugInvisible) +#endif + ProcessMonsters(); gGameLogicStep = GameLogicStep::ProcessObjects; ProcessObjects(); gGameLogicStep = GameLogicStep::ProcessMissiles; diff --git a/Source/lua/modules/dev/player.cpp b/Source/lua/modules/dev/player.cpp index 31d870a49..8bea5d50f 100644 --- a/Source/lua/modules/dev/player.cpp +++ b/Source/lua/modules/dev/player.cpp @@ -90,6 +90,12 @@ sol::table LuaDevPlayerTrnModule(sol::state_view &lua) return table; } +std::string DebugCmdInvisible(std::optional on) +{ + DebugInvisible = on.value_or(!DebugInvisible); + return StrCat("Invisible: ", DebugInvisible ? "On" : "Off"); +} + } // namespace sol::table LuaDevPlayerModule(sol::state_view &lua) @@ -102,6 +108,7 @@ sol::table LuaDevPlayerModule(sol::state_view &lua) SetDocumented(table, "spells", "", "Adjust player spells.", LuaDevPlayerSpellsModule(lua)); SetDocumented(table, "stats", "", "Adjust player stats (Strength, HP, etc).", LuaDevPlayerStatsModule(lua)); SetDocumented(table, "trn", "", "Set player TRN to '${name}.trn'", LuaDevPlayerTrnModule(lua)); + SetDocumented(table, "invisible", "(on: boolean = nil)", "Toggle invisibility.", &DebugCmdInvisible); return table; }