[Scummvm-cvs-logs] scummvm master -> e66883d5cbae4d92264cd1c2b5784af79d30f152

bluegr bluegr at gmail.com
Wed Jan 21 13:07:30 CET 2015


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:
e66883d5cb ZVISION: Add console commands to manipulate state flags and variables


Commit: e66883d5cbae4d92264cd1c2b5784af79d30f152
    https://github.com/scummvm/scummvm/commit/e66883d5cbae4d92264cd1c2b5784af79d30f152
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-01-21T14:06:13+02:00

Commit Message:
ZVISION: Add console commands to manipulate state flags and variables

Changed paths:
    engines/zvision/core/console.cpp
    engines/zvision/core/console.h



diff --git a/engines/zvision/core/console.cpp b/engines/zvision/core/console.cpp
index e54e986..f5cacb5 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 ffce878..ac83418 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






More information about the Scummvm-git-logs mailing list