Browse Source

Add "arrow" debug command

pull/2666/head^2
obligaron 5 years ago committed by Anders Jenbo
parent
commit
55d4b018ae
  1. 23
      Source/debug.cpp
  2. 23
      Source/diablo.cpp

23
Source/debug.cpp

@ -344,6 +344,28 @@ std::string DebugCmdExit(const std::string_view parameter)
return "See you again my Lord.";
}
std::string DebugCmdArrow(const std::string_view parameter)
{
auto &myPlayer = Players[MyPlayerId];
myPlayer._pIFlags &= ~ISPL_FIRE_ARROWS;
myPlayer._pIFlags &= ~ISPL_LIGHT_ARROWS;
if (parameter == "normal") {
// we removed the parameter at the top
} else if (parameter == "fire") {
myPlayer._pIFlags |= ISPL_FIRE_ARROWS;
} else if (parameter == "lightning") {
myPlayer._pIFlags |= ISPL_LIGHT_ARROWS;
} else if (parameter == "explosion") {
myPlayer._pIFlags |= (ISPL_FIRE_ARROWS | ISPL_LIGHT_ARROWS);
} else {
return "Unknown is sometimes similar to nothing (unkown effect).";
}
return "I can shoot any arrow.";
}
std::vector<DebugCmdItem> DebugCmdList = {
{ "help", "Prints help overview or help for a specific command.", "({command})", &DebugCmdHelp },
{ "give gold", "Fills the inventory with gold.", "", &DebugCmdGiveGoldCheat },
@ -362,6 +384,7 @@ std::vector<DebugCmdItem> DebugCmdList = {
{ "dropunique", "Attempts to generate unique item {name}.", "{name}", &DebugCmdGenerateUniqueItem },
{ "dropitem", "Attempts to generate item {name}.", "{name}", &DebugCmdGenerateItem },
{ "exit", "Exits the game.", "", &DebugCmdExit },
{ "arrow", "Changes arrow effect (normal, fire, lightning, explosion).", "{effect}", &DebugCmdArrow },
};
} // namespace

23
Source/diablo.cpp

@ -140,9 +140,6 @@ bool forceSpawn;
bool forceDiablo;
int sgnTimeoutCurs;
bool gbShowIntro = true;
#ifdef _DEBUG
int arrowdebug = 0;
#endif
/** To know if these things have been done when we get to the diablo_deinit() function */
bool was_archives_init = false;
/** To know if surfaces have been initialized or not */
@ -580,26 +577,6 @@ void PressChar(char vkey)
}
return;
#ifdef _DEBUG
case ')':
case '0':
if (debug_mode_key_inverted_v) {
if (arrowdebug > 2) {
arrowdebug = 0;
}
auto &myPlayer = Players[MyPlayerId];
if (arrowdebug == 0) {
myPlayer._pIFlags &= ~ISPL_FIRE_ARROWS;
myPlayer._pIFlags &= ~ISPL_LIGHT_ARROWS;
}
if (arrowdebug == 1) {
myPlayer._pIFlags |= ISPL_FIRE_ARROWS;
}
if (arrowdebug == 2) {
myPlayer._pIFlags |= ISPL_LIGHT_ARROWS;
}
arrowdebug++;
}
return;
case 'a':
if (debug_mode_key_inverted_v) {
spelldata[SPL_TELEPORT].sTownSpell = true;

Loading…
Cancel
Save