Skip to content

Commit

Permalink
XEEN: Added debug commands for changing map & position
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 27, 2017
1 parent f8f2058 commit 073380f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
39 changes: 39 additions & 0 deletions engines/xeen/debugger.cpp
Expand Up @@ -50,6 +50,8 @@ Debugger::Debugger(XeenEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("dump", WRAP_METHOD(Debugger, cmdDump));
registerCmd("gold", WRAP_METHOD(Debugger, cmdGold));
registerCmd("gems", WRAP_METHOD(Debugger, cmdGems));
registerCmd("map", WRAP_METHOD(Debugger, cmdMap));
registerCmd("pos", WRAP_METHOD(Debugger, cmdPos));

_spellId = -1;
}
Expand Down Expand Up @@ -139,4 +141,41 @@ bool Debugger::cmdGems(int argc, const char **argv) {
return true;
}

bool Debugger::cmdMap(int argc, const char **argv) {
FileManager &files = *g_vm->_files;
Map &map = *g_vm->_map;
Party &party = *g_vm->_party;

if (argc < 2) {
debugPrintf("map mapId [ sideNum [ xp, yp ]]\n");
return true;
} else {
int mapId = strToInt(argv[1]);
bool side = argc < 3 ? g_vm->_files->_isDarkCc : strToInt(argv[2]) != 0;
int x = argc < 4 ? 8 : strToInt(argv[3]);
int y = argc < 5 ? 8 : strToInt(argv[4]);

map._loadDarkSide = side;
map.load(mapId);
party._mazePosition.x = x;
party._mazePosition.y = y;
party._mazeDirection = DIR_NORTH;
return false;
}
}

bool Debugger::cmdPos(int argc, const char **argv) {
Party &party = *g_vm->_party;

if (argc < 3) {
debugPrintf("pos xp, yp\n");
return true;
} else {
party._mazePosition.x = strToInt(argv[1]);
party._mazePosition.y = strToInt(argv[2]);
party._stepped = true;
return true;
}
}

} // End of namespace Xeen
2 changes: 2 additions & 0 deletions engines/xeen/debugger.h
Expand Up @@ -39,6 +39,8 @@ class Debugger : public GUI::Debugger {
bool cmdDump(int argc, const char **argv);
bool cmdGold(int argc, const char **argv);
bool cmdGems(int argc, const char **argv);
bool cmdMap(int argc, const char **argv);
bool cmdPos(int argc, const char **argv);
public:
Debugger(XeenEngine *vm);

Expand Down

0 comments on commit 073380f

Please sign in to comment.