aboutsummaryrefslogtreecommitdiff
path: root/engines/mutationofjb/debug.cpp
diff options
context:
space:
mode:
authorĽubomír Remák2018-03-22 16:08:14 +0100
committerEugene Sandulenko2018-08-25 23:12:01 +0200
commit63c0dac9613caef3778a4cb9765bb8b628e5a1c2 (patch)
treede47fa3b7282dc163d06b51a47cbd1d3f0a868be /engines/mutationofjb/debug.cpp
parent3928c52c0ee2a930431a807d0b4262440ab75725 (diff)
downloadscummvm-rg350-63c0dac9613caef3778a4cb9765bb8b628e5a1c2.tar.gz
scummvm-rg350-63c0dac9613caef3778a4cb9765bb8b628e5a1c2.tar.bz2
scummvm-rg350-63c0dac9613caef3778a4cb9765bb8b628e5a1c2.zip
MUTATIONOFJB: Add support for macro definitions.
Diffstat (limited to 'engines/mutationofjb/debug.cpp')
-rw-r--r--engines/mutationofjb/debug.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/engines/mutationofjb/debug.cpp b/engines/mutationofjb/debug.cpp
index e6393242e2..99c4c7b70f 100644
--- a/engines/mutationofjb/debug.cpp
+++ b/engines/mutationofjb/debug.cpp
@@ -204,4 +204,55 @@ bool Console::cmd_showsection(int argc, const char **argv) {
return true;
}
+bool Console::cmd_listmacros(int argc, const char **argv) {
+ if (argc == 2) {
+ Script *script = nullptr;
+ if (strcmp(argv[1], "G") == 0) {
+ script = _vm->getGame().getGlobalScript();
+ } else if (strcmp(argv[1], "L") == 0) {
+ script = _vm->getGame().getLocalScript();
+ }
+ if (!script) {
+ debugPrintf(_("Choose 'G' (global) or 'L' (local) script.\n"));
+ } else {
+ const Macros &macros = script->getMacros();
+ for (Macros::const_iterator it = macros.begin(); it != macros.end(); ++it) {
+ debugPrintf("%s\n", it->_key.c_str());
+ }
+ }
+ } else {
+ debugPrintf(_("listmacros <G|L>\n"));
+ }
+
+ return true;
+}
+
+bool Console::cmd_showmacro(int argc, const char **argv) {
+ if (argc == 3) {
+ Script *script = nullptr;
+ if (strcmp(argv[1], "G") == 0) {
+ script = _vm->getGame().getGlobalScript();
+ } else if (strcmp(argv[1], "L") == 0) {
+ script = _vm->getGame().getLocalScript();
+ }
+ if (!script) {
+ debugPrintf(_("Choose 'G' (global) or 'L' (local) script.\n"));
+ } else {
+ const Macros &macros = script->getMacros();
+ Macros::const_iterator itMacro = macros.find(argv[2]);
+ if (itMacro != macros.end()) {
+ if (itMacro->_value) {
+ showCommands(itMacro->_value);
+ }
+ } else {
+ debugPrintf("Macro not found.\n");
+ }
+ }
+ } else {
+ debugPrintf(_("showmacro <G|L> <macroname>\n"));
+ }
+
+ return true;
+}
+
}