[Scummvm-git-logs] scummvm master -> b87318805f346f966b6ad0c39def13091cdeddd4

dreammaster dreammaster at scummvm.org
Fri Sep 16 00:43:47 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b87318805f SHERLOCK: Add debugger command to alter game flags


Commit: b87318805f346f966b6ad0c39def13091cdeddd4
    https://github.com/scummvm/scummvm/commit/b87318805f346f966b6ad0c39def13091cdeddd4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-15T18:43:39-04:00

Commit Message:
SHERLOCK: Add debugger command to alter game flags

Changed paths:
    engines/sherlock/debugger.cpp
    engines/sherlock/debugger.h



diff --git a/engines/sherlock/debugger.cpp b/engines/sherlock/debugger.cpp
index 55243c4..39bc1b9 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 bcc4448..ae74690 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;





More information about the Scummvm-git-logs mailing list