DM: Add debug command godmode

This commit is contained in:
Bendegúz Nagy 2016-08-26 22:51:17 +02:00
parent 36395c5b26
commit 50f3cfa625
5 changed files with 2567 additions and 2503 deletions

File diff suppressed because it is too large Load Diff

View File

@ -513,6 +513,7 @@ class ChampionMan {
int16 _g410_championPendingWounds[4]; // @ G0410_ai_ChampionPendingWounds
int16 _g409_championPendingDamage[4]; // @ G0409_ai_ChampionPendingDamage
public:
Champion _gK71_champions[4]; // @ K0071_as_Champions
uint16 _g305_partyChampionCount; // @ G0305_ui_PartyChampionCount
bool _g303_partyDead; // @ G0303_B_PartyDead

View File

@ -30,6 +30,44 @@
namespace DM {
Console::Console(DM::DMEngine* vm) : _vm(vm) {}
Console::Console(DM::DMEngine* vm) : _vm(vm) {
_debugGodmodeMana = false;
_debugGodmodeHP = false;
_debugGodmodeStamina = false;
}
registerCmd("godmode", WRAP_METHOD(Console, Cmd_godmode));
}
bool Console::Cmd_godmode(int argc, const char** argv) {
if (argc < 3)
goto argumentError;
bool setFlagTo;
if (strcmp("on", argv[2]) == 0) {
setFlagTo = true;
} else if (strcmp("off", argv[2]) == 0) {
setFlagTo = false;
} else
goto argumentError;
if (strcmp("all", argv[1]) == 0) {
_debugGodmodeHP = _debugGodmodeMana = _debugGodmodeStamina = setFlagTo;
} else if (strcmp("mana", argv[1]) == 0) {
_debugGodmodeMana = setFlagTo;
} else if (strcmp("hp", argv[1]) == 0) {
_debugGodmodeHP = setFlagTo;
} else if (strcmp("stamina", argv[1]) == 0) {
_debugGodmodeStamina = setFlagTo;
} else
goto argumentError;
debugPrintf("God mode set for %s to %s\n", argv[1], argv[2]);
return true;
argumentError:
debugPrintf("Usage: %s <all/mana/hp/stamina> <on/off>\n", argv[0]);
return true;
}
}

View File

@ -36,7 +36,12 @@ class DMEngine;
class Console : public GUI::Debugger {
DMEngine *_vm;
public:
bool _debugGodmodeMana;
bool _debugGodmodeHP;
bool _debugGodmodeStamina;
explicit Console(DM::DMEngine *vm);
virtual ~Console(void) {}
bool Cmd_godmode(int argc, const char **argv);
};
}

View File

@ -367,8 +367,21 @@ void DMEngine::f2_gameloop() {
while (true) {
if (_engineShouldQuit)
return;
// DEBUG CODE
for (int16 i = 0; i < _championMan->_g305_partyChampionCount; ++i) {
Champion &champ = _championMan->_gK71_champions[i];
if (_console->_debugGodmodeHP)
champ._currHealth = champ._maxHealth;
if (_console->_debugGodmodeMana)
champ._currMana = champ._maxMana;
if (_console->_debugGodmodeStamina)
champ._currStamina = champ._maxStamina;
}
for (;;) {
if (_g327_newPartyMapIndex != kM1_mapIndexNone) {
f3_processNewPartyMap(_g327_newPartyMapIndex);
_moveSens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);