Skip to content

Commit

Permalink
Debug: Insivible (#7543)
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 authored Nov 16, 2024
1 parent 1b522fe commit f1d48d7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Source/automap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Source/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Source/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion Source/diablo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions Source/lua/modules/dev/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ sol::table LuaDevPlayerTrnModule(sol::state_view &lua)
return table;
}

std::string DebugCmdInvisible(std::optional<bool> on)
{
DebugInvisible = on.value_or(!DebugInvisible);
return StrCat("Invisible: ", DebugInvisible ? "On" : "Off");
}

} // namespace

sol::table LuaDevPlayerModule(sol::state_view &lua)
Expand All @@ -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;
}

Expand Down

0 comments on commit f1d48d7

Please sign in to comment.