aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-15 18:43:39 -0400
committerPaul Gilbert2016-09-15 18:43:39 -0400
commitb87318805f346f966b6ad0c39def13091cdeddd4 (patch)
tree0b106980bcb2928ff693d2cccddcdf59608923d2
parent66b9de0cba1d4a58fab5f9f31e9e4e626bbf44eb (diff)
downloadscummvm-rg350-b87318805f346f966b6ad0c39def13091cdeddd4.tar.gz
scummvm-rg350-b87318805f346f966b6ad0c39def13091cdeddd4.tar.bz2
scummvm-rg350-b87318805f346f966b6ad0c39def13091cdeddd4.zip
SHERLOCK: Add debugger command to alter game flags
-rw-r--r--engines/sherlock/debugger.cpp23
-rw-r--r--engines/sherlock/debugger.h5
2 files changed, 28 insertions, 0 deletions
diff --git a/engines/sherlock/debugger.cpp b/engines/sherlock/debugger.cpp
index 55243c4bc7..39bc1b90ab 100644
--- a/engines/sherlock/debugger.cpp
+++ b/engines/sherlock/debugger.cpp
@@ -47,6 +47,7 @@ Debugger::Debugger(SherlockEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("listfiles", WRAP_METHOD(Debugger, cmdListFiles));
registerCmd("dumpfile", WRAP_METHOD(Debugger, cmdDumpFile));
registerCmd("locations", WRAP_METHOD(Debugger, cmdLocations));
+ registerCmd("flag", WRAP_METHOD(Debugger, cmdFlag));
}
void Debugger::postEnter() {
@@ -159,5 +160,27 @@ bool Debugger::cmdLocations(int argc, const char **argv) {
return false;
}
+bool Debugger::cmdFlag(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("Format: flag <number> [set | clear | toggle]\n");
+ } else {
+ int flagNum = strToInt(argv[1]);
+
+ if (argc == 2) {
+ debugPrintf("Flag %d is %s\n", flagNum, _vm->_flags[flagNum] ? "Set" : "Clear");
+ } else {
+ if (!strcmp(argv[2], "set"))
+ _vm->_flags[flagNum] = true;
+ else if (!strcmp(argv[2], "clear"))
+ _vm->_flags[flagNum] = false;
+ else if (!strcmp(argv[2], "toggle"))
+ _vm->_flags[flagNum] = !_vm->_flags[flagNum];
+
+ debugPrintf("Flag %d is now %s\n", flagNum, _vm->_flags[flagNum] ? "Set" : "Clear");
+ }
+ }
+
+ return true;
+}
} // End of namespace Sherlock
diff --git a/engines/sherlock/debugger.h b/engines/sherlock/debugger.h
index bcc4448c32..ae74690bed 100644
--- a/engines/sherlock/debugger.h
+++ b/engines/sherlock/debugger.h
@@ -68,6 +68,11 @@ private:
* Show all locations on the map
*/
bool cmdLocations(int argc, const char **argv);
+
+ /**
+ * Get or set the value of a flag
+ */
+ bool cmdFlag(int argc, const char **argv);
protected:
SherlockEngine *_vm;
Common::String _3doPlayMovieFile;