Skip to content

Commit

Permalink
XEEN: Added intangible debugger command
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Mar 30, 2018
1 parent 09f67c8 commit 60fdd3d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
11 changes: 8 additions & 3 deletions engines/xeen/debugger.cpp
Expand Up @@ -45,7 +45,7 @@ static int strToInt(const char *s) {
/*------------------------------------------------------------------------*/

Debugger::Debugger(XeenEngine *vm) : GUI::Debugger(), _vm(vm),
_invincible(false) {
_spellId(-1), _invincible(false), _intangible(false) {
registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
registerCmd("spell", WRAP_METHOD(Debugger, cmdSpell));
registerCmd("spells", WRAP_METHOD(Debugger, cmdSpells));
Expand All @@ -55,8 +55,7 @@ Debugger::Debugger(XeenEngine *vm) : GUI::Debugger(), _vm(vm),
registerCmd("map", WRAP_METHOD(Debugger, cmdMap));
registerCmd("pos", WRAP_METHOD(Debugger, cmdPos));
registerCmd("invincible", WRAP_METHOD(Debugger, cmdInvincible));

_spellId = -1;
registerCmd("intangible", WRAP_METHOD(Debugger, cmdIntangible));
}

void Debugger::update() {
Expand Down Expand Up @@ -201,4 +200,10 @@ bool Debugger::cmdInvincible(int argc, const char **argv) {
return true;
}

bool Debugger::cmdIntangible(int argc, const char **argv) {
_intangible = (argc < 2) || strcmp(argv[1], "off");
debugPrintf("Intangibility is %s\n", _intangible ? "on" : "off");
return true;
}

} // End of namespace Xeen
6 changes: 6 additions & 0 deletions engines/xeen/debugger.h
Expand Up @@ -74,8 +74,14 @@ class Debugger : public GUI::Debugger {
* Flags whether to make the party invincible
*/
bool cmdInvincible(int argc, const char **argv);

/**
* Flags whether to make the party invincible
*/
bool cmdIntangible(int argc, const char **argv);
public:
bool _invincible;
bool _intangible;
public:
Debugger(XeenEngine *vm);

Expand Down
4 changes: 4 additions & 0 deletions engines/xeen/interface.cpp
Expand Up @@ -895,6 +895,7 @@ void Interface::startFalling(bool flag) {
}

bool Interface::checkMoveDirection(int key) {
Debugger &debugger = *g_vm->_debugger;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Sound &sound = *_vm->_sound;
Expand All @@ -920,6 +921,9 @@ bool Interface::checkMoveDirection(int key) {
int startSurfaceId = map._currentSurfaceId;
int surfaceId;

if (debugger._intangible)
return true;

if (map._isOutdoors) {
party._mazeDirection = dir;

Expand Down

0 comments on commit 60fdd3d

Please sign in to comment.