Browse Source

Debug: Insivible (#7543)

pull/7547/head
Eric Robinson 1 year ago committed by GitHub
parent
commit
f1d48d7124
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      Source/automap.cpp
  2. 1
      Source/debug.cpp
  3. 1
      Source/debug.h
  4. 5
      Source/diablo.cpp
  5. 7
      Source/lua/modules/dev/player.cpp

4
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);

1
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;

1
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;

5
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;

7
Source/lua/modules/dev/player.cpp

@ -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)
@ -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;
}

Loading…
Cancel
Save