diff options
author | Filippos Karapetis | 2015-01-21 14:06:13 +0200 |
---|---|---|
committer | Filippos Karapetis | 2015-01-21 14:06:13 +0200 |
commit | e66883d5cbae4d92264cd1c2b5784af79d30f152 (patch) | |
tree | 34c23f7ba44c208a42dbcff713534edb3bebe7e4 /engines/zvision | |
parent | 46fe6b64b9bac081384107192b7bcd24fbb255f5 (diff) | |
download | scummvm-rg350-e66883d5cbae4d92264cd1c2b5784af79d30f152.tar.gz scummvm-rg350-e66883d5cbae4d92264cd1c2b5784af79d30f152.tar.bz2 scummvm-rg350-e66883d5cbae4d92264cd1c2b5784af79d30f152.zip |
ZVISION: Add console commands to manipulate state flags and variables
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/core/console.cpp | 38 | ||||
-rw-r--r-- | engines/zvision/core/console.h | 2 |
2 files changed, 40 insertions, 0 deletions
diff --git a/engines/zvision/core/console.cpp b/engines/zvision/core/console.cpp index e54e986bd7..f5cacb582c 100644 --- a/engines/zvision/core/console.cpp +++ b/engines/zvision/core/console.cpp @@ -54,6 +54,8 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { registerCmd("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); registerCmd("dumpfiles", WRAP_METHOD(Console, cmdDumpFiles)); registerCmd("dumpimage", WRAP_METHOD(Console, cmdDumpImage)); + registerCmd("statevalue", WRAP_METHOD(Console, cmdStateValue)); + registerCmd("stateflag", WRAP_METHOD(Console, cmdStateFlag)); } bool Console::cmdLoadVideo(int argc, const char **argv) { @@ -329,4 +331,40 @@ bool Console::cmdDumpImage(int argc, const char **argv) { return true; } +bool Console::cmdStateValue(int argc, const char **argv) { + if (argc < 2) { + debugPrintf("Use %s <valuenum> to show the value of a state variable\n", argv[0]); + debugPrintf("Use %s <valuenum> <newvalue> to set the value of a state variable\n", argv[0]); + return true; + } + + int valueNum = atoi(argv[1]); + int newValue = (argc > 2) ? atoi(argv[2]) : -1; + + if (argc == 2) + debugPrintf("[%d] = %d\n", valueNum, _engine->getScriptManager()->getStateValue(valueNum)); + else if (argc == 3) + _engine->getScriptManager()->setStateValue(valueNum, newValue); + + return true; +} + +bool Console::cmdStateFlag(int argc, const char **argv) { + if (argc < 2) { + debugPrintf("Use %s <flagnum> to show the value of a state flag\n", argv[0]); + debugPrintf("Use %s <flagnum> <newvalue> to set the value of a state flag\n", argv[0]); + return true; + } + + int valueNum = atoi(argv[1]); + int newValue = (argc > 2) ? atoi(argv[2]) : -1; + + if (argc == 2) + debugPrintf("[%d] = %d\n", valueNum, _engine->getScriptManager()->getStateFlag(valueNum)); + else if (argc == 3) + _engine->getScriptManager()->setStateFlag(valueNum, newValue); + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/core/console.h b/engines/zvision/core/console.h index ffce87869f..ac834185a0 100644 --- a/engines/zvision/core/console.h +++ b/engines/zvision/core/console.h @@ -48,6 +48,8 @@ private: bool cmdDumpFile(int argc, const char **argv); bool cmdDumpFiles(int argc, const char **argv); bool cmdDumpImage(int argc, const char **argv); + bool cmdStateValue(int argc, const char **argv); + bool cmdStateFlag(int argc, const char **argv); }; } // End of namespace ZVision |