aboutsummaryrefslogtreecommitdiff
path: root/engines/adl
diff options
context:
space:
mode:
authorWalter van Niftrik2016-12-22 16:41:15 +0100
committerWalter van Niftrik2016-12-22 16:42:04 +0100
commita1236d57820e53b07180adcf78ba7af844ca51b1 (patch)
tree8bc6484f47095fdd928607d5476c8fc14a495561 /engines/adl
parentd658f0c0b636e1253ee6d66661c332b43a020cbf (diff)
downloadscummvm-rg350-a1236d57820e53b07180adcf78ba7af844ca51b1.tar.gz
scummvm-rg350-a1236d57820e53b07180adcf78ba7af844ca51b1.tar.bz2
scummvm-rg350-a1236d57820e53b07180adcf78ba7af844ca51b1.zip
ADL: Add 'region' debug command
Diffstat (limited to 'engines/adl')
-rw-r--r--engines/adl/console.cpp43
-rw-r--r--engines/adl/console.h2
2 files changed, 40 insertions, 5 deletions
diff --git a/engines/adl/console.cpp b/engines/adl/console.cpp
index 0ac3cb8df4..e7611419e0 100644
--- a/engines/adl/console.cpp
+++ b/engines/adl/console.cpp
@@ -35,6 +35,7 @@ Console::Console(AdlEngine *engine) : GUI::Debugger() {
registerCmd("verbs", WRAP_METHOD(Console, Cmd_Verbs));
registerCmd("dump_scripts", WRAP_METHOD(Console, Cmd_DumpScripts));
registerCmd("valid_cmds", WRAP_METHOD(Console, Cmd_ValidCommands));
+ registerCmd("region", WRAP_METHOD(Console, Cmd_Region));
registerCmd("room", WRAP_METHOD(Console, Cmd_Room));
registerCmd("items", WRAP_METHOD(Console, Cmd_Items));
registerCmd("give_item", WRAP_METHOD(Console, Cmd_GiveItem));
@@ -171,6 +172,42 @@ bool Console::Cmd_DumpScripts(int argc, const char **argv) {
return true;
}
+void Console::prepareGame() {
+ _engine->clearScreen();
+ _engine->loadRoom(_engine->_state.room);
+ _engine->showRoom();
+ _engine->_display->updateTextScreen();
+ _engine->_display->updateHiResScreen();
+}
+
+bool Console::Cmd_Region(int argc, const char **argv) {
+ if (argc > 2) {
+ debugPrintf("Usage: %s [<new_region>]\n", argv[0]);
+ return true;
+ }
+
+ if (argc == 2) {
+ if (!_engine->_canRestoreNow) {
+ debugPrintf("Cannot change regions right now\n");
+ return true;
+ }
+
+ uint regionCount = _engine->_state.regions.size();
+ uint region = strtoul(argv[1], NULL, 0);
+ if (region < 1 || region > regionCount) {
+ debugPrintf("Region %u out of valid range [1, %u]\n", region, regionCount);
+ return true;
+ }
+
+ _engine->switchRegion(region);
+ prepareGame();
+ }
+
+ debugPrintf("Current region: %u\n", _engine->_state.region);
+
+ return true;
+}
+
bool Console::Cmd_Room(int argc, const char **argv) {
if (argc > 2) {
debugPrintf("Usage: %s [<new_room>]\n", argv[0]);
@@ -191,11 +228,7 @@ bool Console::Cmd_Room(int argc, const char **argv) {
}
_engine->_state.room = room;
- _engine->clearScreen();
- _engine->loadRoom(_engine->_state.room);
- _engine->showRoom();
- _engine->_display->updateTextScreen();
- _engine->_display->updateHiResScreen();
+ prepareGame();
}
debugPrintf("Current room: %u\n", _engine->_state.room);
diff --git a/engines/adl/console.h b/engines/adl/console.h
index 8b3ab6b3cf..68787e148a 100644
--- a/engines/adl/console.h
+++ b/engines/adl/console.h
@@ -48,6 +48,7 @@ private:
bool Cmd_Verbs(int argc, const char **argv);
bool Cmd_DumpScripts(int argc, const char **argv);
bool Cmd_ValidCommands(int argc, const char **argv);
+ bool Cmd_Region(int argc, const char **argv);
bool Cmd_Room(int argc, const char **argv);
bool Cmd_Items(int argc, const char **argv);
bool Cmd_GiveItem(int argc, const char **argv);
@@ -57,6 +58,7 @@ private:
void printItem(const Item &item);
void printWordMap(const Common::HashMap<Common::String, uint> &wordMap);
void dumpScripts(const Common::String &prefix = Common::String());
+ void prepareGame();
AdlEngine *_engine;
};