Browse Source

Remove debug command line argument -^ (Enable debug tools) and added

scrollview debug command
pull/2891/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
f9192d2312
  1. 11
      Source/debug.cpp
  2. 1
      Source/debug.h
  3. 18
      Source/diablo.cpp
  4. 1
      Source/diablo.h
  5. 6
      Source/player.cpp

11
Source/debug.cpp

@ -34,6 +34,7 @@ bool DebugGodMode = false;
bool DebugVision = false;
bool DebugGrid = false;
std::unordered_map<int, Point> DebugCoordsMap;
bool DebugScrollViewEnabled = false;
namespace {
@ -621,6 +622,15 @@ std::string DebugCmdShowTileData(const string_view parameter)
return "Special powers activated.";
}
std::string DebugCmdScrollView(const string_view parameter)
{
DebugScrollViewEnabled = !DebugScrollViewEnabled;
if (DebugScrollViewEnabled)
return "You can see as far as an eagle.";
InitMultiView();
return "If you want to see the world, you need to explore it yourself.";
}
std::vector<DebugCmdItem> DebugCmdList = {
{ "help", "Prints help overview or help for a specific command.", "({command})", &DebugCmdHelp },
{ "give gold", "Fills the inventory with gold.", "", &DebugCmdGiveGoldCheat },
@ -646,6 +656,7 @@ std::vector<DebugCmdItem> DebugCmdList = {
{ "seedinfo", "Show seed infos for current level.", "", &DebugCmdLevelSeed },
{ "spawn", "Spawns monster {name}.", "({count}) {name}", &DebugCmdSpawnMonster },
{ "tiledata", "Toggles showing tile data {name} (leave name empty to see a list).", "{name}", &DebugCmdShowTileData },
{ "scrollview", "Toggles scroll view feature (with shift+mouse).", "", &DebugCmdScrollView },
};
} // namespace

1
Source/debug.h

@ -21,6 +21,7 @@ extern bool DebugGodMode;
extern bool DebugVision;
extern bool DebugGrid;
extern std::unordered_map<int, Point> DebugCoordsMap;
extern bool DebugScrollViewEnabled;
void FreeDebugGFX();
void LoadDebugGFX();

18
Source/diablo.cpp

@ -101,7 +101,6 @@ std::array<Keymapper::ActionIndex, 4> quickSpellActionIndexes;
bool gbForceWindowed = false;
#ifdef _DEBUG
bool debug_mode_key_inverted_v = false;
bool debug_mode_key_i = false;
std::vector<std::string> DebugCmdsFromCommandLine;
#endif
@ -584,13 +583,11 @@ void PressChar(char vkey)
return;
case 'T':
case 't':
if (debug_mode_key_inverted_v) {
auto &myPlayer = Players[MyPlayerId];
sprintf(tempstr, "PX = %i PY = %i", myPlayer.position.tile.x, myPlayer.position.tile.y);
NetSendCmdString(1 << MyPlayerId, tempstr);
sprintf(tempstr, "CX = %i CY = %i DP = %i", cursPosition.x, cursPosition.y, dungeon[cursPosition.x][cursPosition.y]);
NetSendCmdString(1 << MyPlayerId, tempstr);
}
auto &myPlayer = Players[MyPlayerId];
sprintf(tempstr, "PX = %i PY = %i", myPlayer.position.tile.x, myPlayer.position.tile.y);
NetSendCmdString(1 << MyPlayerId, tempstr);
sprintf(tempstr, "CX = %i CY = %i DP = %i", cursPosition.x, cursPosition.y, dungeon[cursPosition.x][cursPosition.y]);
NetSendCmdString(1 << MyPlayerId, tempstr);
return;
#endif
}
@ -812,7 +809,6 @@ void RunGameLoop(interface_mode uMsg)
printInConsole(" %-20s %-30s\n", /* TRANSLATORS: Commandline Option */ "--nestart", _("Use alternate nest palette"));
#ifdef _DEBUG
printInConsole("\nDebug options:\n");
printInConsole(" %-20s %-30s\n", "-^", "Enable debug tools");
printInConsole(" %-20s %-30s\n", "-i", "Ignore network timeout");
printInConsole(" %-20s %-30s\n", "+<internal command>", "Pass commands to the engine");
#endif
@ -871,8 +867,6 @@ void DiabloParseFlags(int argc, char **argv)
} else if (strcasecmp("--verbose", argv[i]) == 0) {
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
#ifdef _DEBUG
} else if (strcasecmp("-^", argv[i]) == 0) {
debug_mode_key_inverted_v = true;
} else if (strcasecmp("-i", argv[i]) == 0) {
debug_mode_key_i = true;
} else if (argv[i][0] == '+') {
@ -1201,7 +1195,7 @@ void GameLogic()
gGameLogicStep = GameLogicStep::None;
#ifdef _DEBUG
if (debug_mode_key_inverted_v && GetAsyncKeyState(DVL_VK_SHIFT)) {
if (DebugScrollViewEnabled && GetAsyncKeyState(DVL_VK_SHIFT)) {
ScrollView();
}
#endif

1
Source/diablo.h

@ -106,7 +106,6 @@ void diablo_color_cyc_logic();
extern Keymapper keymapper;
extern bool gbForceWindowed;
#ifdef _DEBUG
extern bool debug_mode_key_inverted_v;
extern bool debug_mode_key_i;
#endif

6
Source/player.cpp

@ -2776,12 +2776,6 @@ void InitPlayer(Player &player, bool firstTime)
player._pAblSpells = GetSpellBitmask(SPL_BLODBOIL);
}
#ifdef _DEBUG
if (debug_mode_key_inverted_v && firstTime) {
player._pMemSpells = SPL_INVALID;
}
#endif
player._pNextExper = ExpLvlsTbl[player._pLevel];
player._pInvincible = false;

Loading…
Cancel
Save