diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp index de95b9ab4b5..66413dbac18 100644 --- a/engines/pink/console.cpp +++ b/engines/pink/console.cpp @@ -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 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; } diff --git a/engines/pink/console.h b/engines/pink/console.h index 9c438a890c6..73041a5719d 100644 --- a/engines/pink/console.h +++ b/engines/pink/console.h @@ -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; };