mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-09 12:22:51 +00:00
PINK: add commands to list and set game variables
This commit is contained in:
parent
a8cbdba16f
commit
9e920d9349
@ -29,6 +29,9 @@ Console::Console(PinkEngine *vm)
|
||||
: _vm(vm) {
|
||||
registerCmd("listModules", WRAP_METHOD(Console, Cmd_ListModules));
|
||||
registerCmd("goToModule", WRAP_METHOD(Console, Cmd_GoToModule));
|
||||
|
||||
registerCmd("listGameVars", WRAP_METHOD(Console, Cmd_ListGameVars));
|
||||
registerCmd("setGameVar", WRAP_METHOD(Console, Cmd_SetGameVar));
|
||||
}
|
||||
|
||||
bool Console::Cmd_ListModules(int argc, const char **argv) {
|
||||
@ -42,7 +45,7 @@ bool Console::Cmd_ListModules(int argc, const char **argv) {
|
||||
bool Console::Cmd_GoToModule(int argc, const char **argv) {
|
||||
if (argc != 2) {
|
||||
debugPrintf("Usage: %s moduleName\n", argv[0]);
|
||||
debugPrintf("Module may not work properly because of Game vars");
|
||||
debugPrintf("Module may not work properly because of Game vars\n");
|
||||
return true;
|
||||
}
|
||||
const Array<NamedObject*> modules = _vm->_modules;
|
||||
@ -52,7 +55,24 @@ bool Console::Cmd_GoToModule(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
debugPrintf("Module %s doesn't exist", argv[1]);
|
||||
debugPrintf("Module %s doesn't exist\n", argv[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Console::Cmd_ListGameVars(int argc, const char **argv) {
|
||||
const StringMap &vars = _vm->_variables;
|
||||
for (StringMap::const_iterator it = vars.begin(); it != vars.end() ; ++it) {
|
||||
debugPrintf("%s %s \n", it->_key.c_str(), it->_value.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Console::Cmd_SetGameVar(int argc, const char **argv) {
|
||||
if (argc != 3) {
|
||||
debugPrintf("Usage: %s varName value\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
_vm->_variables[argv[1]] = argv[2];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,9 @@ private:
|
||||
bool Cmd_ListModules(int argc, const char **argv);
|
||||
bool Cmd_GoToModule(int argc, const char **argv);
|
||||
|
||||
bool Cmd_ListGameVars(int argc, const char **argv);
|
||||
bool Cmd_SetGameVar(int argc, const char **argv);
|
||||
|
||||
private:
|
||||
PinkEngine *_vm;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user