Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug: Insivible #7543

Merged
merged 3 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading