XEEN: Added debug commands for changing map & position

This commit is contained in:
Paul Gilbert 2017-12-27 00:32:51 -05:00
parent f8f2058d4c
commit 073380ffb7
2 changed files with 41 additions and 0 deletions

View File

@ -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;
}
@ -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

View File

@ -39,6 +39,8 @@ private:
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);