diff options
author | Eugene Sandulenko | 2019-11-10 11:46:18 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-13 22:07:08 +0100 |
commit | 6116ed3a250ec0e6facb97164c4f21de722e22f6 (patch) | |
tree | 896bbf420681fbe674c4912cf748f95a79a80880 /engines | |
parent | 6827277eb0937b6a3fe050f7df17ed1fd8fc91e1 (diff) | |
download | scummvm-rg350-6116ed3a250ec0e6facb97164c4f21de722e22f6.tar.gz scummvm-rg350-6116ed3a250ec0e6facb97164c4f21de722e22f6.tar.bz2 scummvm-rg350-6116ed3a250ec0e6facb97164c4f21de722e22f6.zip |
GRIFFON: Added 'nodamage' console command
Diffstat (limited to 'engines')
-rw-r--r-- | engines/griffon/combat.cpp | 8 | ||||
-rw-r--r-- | engines/griffon/console.cpp | 27 | ||||
-rw-r--r-- | engines/griffon/console.h | 9 |
3 files changed, 37 insertions, 7 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp index aad5ddb325..ebd5876eb4 100644 --- a/engines/griffon/combat.cpp +++ b/engines/griffon/combat.cpp @@ -515,7 +515,7 @@ void GriffonEngine::checkHit() { ps *= 0.75; float damage = (float)_player.swordDamage * (1.0 + RND() * 1.0) * _player.attackStrength / 100.0 * ps; - if (_console->_godMode) + if (_console->_godMode == kGodModeAll) damage = 1000; if (ABS(_player.attackStrength - 100) < kEpsilon) @@ -1012,8 +1012,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { void GriffonEngine::damagePlayer(int damage) { char line[256]; - if (!_console->_godMode) - _player.hp -= damage; + if (_console->_godMode != kGodModeNone) + damage = 0; + + _player.hp -= damage; if (_player.hp < 0) _player.hp = 0; diff --git a/engines/griffon/console.cpp b/engines/griffon/console.cpp index f8c51f7a94..4ceb3f8044 100644 --- a/engines/griffon/console.cpp +++ b/engines/griffon/console.cpp @@ -27,8 +27,9 @@ namespace Griffon { Console::Console() { - _godMode = false; + _godMode = kGodModeNone; registerCmd("godmode", WRAP_METHOD(Console, Cmd_godMode)); + registerCmd("nodamage", WRAP_METHOD(Console, Cmd_noDamage)); } bool Console::Cmd_godMode(int argc, const char** argv) { @@ -38,8 +39,28 @@ bool Console::Cmd_godMode(int argc, const char** argv) { return true; } - _godMode ^= true; - debugPrintf("God mode is now %s\n", _godMode ? "Enabled" : "Disabled"); + if (_godMode != kGodModeNone) + _godMode = kGodModeNone; + else + _godMode = kGodModeAll; + + debugPrintf("God mode is now %s\n", _godMode == kGodModeAll ? "Invincibility/Damage" : "Disabled"); + return true; +} + +bool Console::Cmd_noDamage(int argc, const char** argv) { + if (argc != 1) { + debugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Enables/Disables invincibility\n"); + return true; + } + + if (_godMode != kGodModeNone) + _godMode = kGodModeNone; + else + _godMode = kGodModeNoDamage; + + debugPrintf("God mode is now %s\n", _godMode ? "Invincibility" : "Disabled"); return true; } diff --git a/engines/griffon/console.h b/engines/griffon/console.h index 4709b7e7f9..471c414477 100644 --- a/engines/griffon/console.h +++ b/engines/griffon/console.h @@ -27,14 +27,21 @@ namespace Griffon { +enum { + kGodModeNone = 0, + kGodModeAll = 1, + kGodModeNoDamage = 2 +}; + class Console : public GUI::Debugger { public: - bool _godMode; + int _godMode; explicit Console(); virtual ~Console(void) {} bool Cmd_godMode(int argc, const char** argv); + bool Cmd_noDamage(int argc, const char** argv); }; } |