diff options
author | Ľubomír Remák | 2018-03-22 16:08:14 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-25 23:12:01 +0200 |
commit | 63c0dac9613caef3778a4cb9765bb8b628e5a1c2 (patch) | |
tree | de47fa3b7282dc163d06b51a47cbd1d3f0a868be /engines/mutationofjb/debug.cpp | |
parent | 3928c52c0ee2a930431a807d0b4262440ab75725 (diff) | |
download | scummvm-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.cpp | 51 |
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 ¯os = 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 ¯os = 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; +} + } |