diff options
| -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  | 
