Browse Source

Port debug vision to a command

pull/2643/head
Anders Jenbo 5 years ago
parent
commit
4a1e4c599b
  1. 12
      Source/debug.cpp
  2. 1
      Source/debug.h
  3. 4
      Source/diablo.cpp
  4. 1
      Source/diablo.h
  5. 2
      Source/scrollrt.cpp

12
Source/debug.cpp

@ -20,6 +20,7 @@ namespace devilution {
std::optional<CelSprite> pSquareCel;
bool DebugGodMode = false;
bool DebugVision = false;
namespace {
@ -197,6 +198,14 @@ std::string DebugCmdGodMode(const std::string_view parameter)
return "You are mortal, beware of the darkness.";
}
std::string DebugCmdVision(const std::string_view parameter)
{
DebugVision = !DebugVision;
if (DebugVision)
return "You see as i do.";
return "My path is set.";
}
std::string DebugCmdLevelUp(const std::string_view parameter)
{
int levels = std::max(1, atoi(parameter.data()));
@ -265,8 +274,7 @@ std::vector<DebugCmdItem> DebugCmdList = {
void LoadDebugGFX()
{
if (visiondebug)
pSquareCel = LoadCel("Data\\Square.CEL", 64);
pSquareCel = LoadCel("Data\\Square.CEL", 64);
}
void FreeDebugGFX()

1
Source/debug.h

@ -15,6 +15,7 @@ namespace devilution {
extern std::optional<CelSprite> pSquareCel;
extern bool DebugGodMode;
extern bool DebugVision;
void FreeDebugGFX();
void LoadDebugGFX();

4
Source/diablo.cpp

@ -101,7 +101,6 @@ bool gbForceWindowed = false;
bool monstdebug = false;
_monster_id DebugMonsters[10];
int debugmonsttypes = 0;
bool visiondebug = false;
int questdebug = -1;
bool debug_mode_key_inverted_v = false;
bool debug_mode_key_i = false;
@ -858,7 +857,6 @@ void RunGameLoop(interface_mode uMsg)
#ifdef _DEBUG
printInConsole("\nDebug options:\n");
printInConsole(" %-20s %-30s\n", "-^", "Enable debug tools");
printInConsole(" %-20s %-30s\n", "-v", "Highlight visibility");
printInConsole(" %-20s %-30s\n", "-i", "Ignore network timeout");
printInConsole(" %-20s %-30s\n", "-j <##>", "Mausoleum warps to given level");
printInConsole(" %-20s %-30s\n", "-m <##>", "Add debug monster, up to 10 allowed");
@ -929,8 +927,6 @@ void DiabloParseFlags(int argc, char **argv)
questdebug = SDL_atoi(argv[++i]);
} else if (strcasecmp("-r", argv[i]) == 0) {
setseed = SDL_atoi(argv[++i]);
} else if (strcasecmp("-v", argv[i]) == 0) {
visiondebug = true;
#endif
} else {
printInConsole("%s", fmt::format(_("unrecognized option '{:s}'\n"), argv[i]).c_str());

1
Source/diablo.h

@ -105,7 +105,6 @@ extern bool gbForceWindowed;
extern bool monstdebug;
extern _monster_id DebugMonsters[10];
extern int debugmonsttypes;
extern bool visiondebug;
extern int questdebug;
extern bool debug_mode_key_inverted_v;
extern bool debug_mode_key_i;

2
Source/scrollrt.cpp

@ -824,7 +824,7 @@ void DrawDungeon(const Surface &out, int sx, int sy, int dx, int dy)
negMon = dMonster[sx][sy - 1];
#ifdef _DEBUG
if (visiondebug && (bFlag & BFLAG_LIT) != 0) {
if (DebugVision && (bFlag & BFLAG_LIT) != 0) {
CelClippedDrawTo(out, { dx, dy }, *pSquareCel, 1);
}
#endif

Loading…
Cancel
Save