aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/console.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/pink/console.cpp')
-rw-r--r--engines/pink/console.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp
new file mode 100644
index 0000000000..de95b9ab4b
--- /dev/null
+++ b/engines/pink/console.cpp
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pink/console.h"
+#include "pink/pink.h"
+
+namespace Pink {
+
+Console::Console(PinkEngine *vm)
+ : _vm(vm) {
+ registerCmd("listModules", WRAP_METHOD(Console, Cmd_ListModules));
+ registerCmd("goToModule", WRAP_METHOD(Console, Cmd_GoToModule));
+}
+
+bool Console::Cmd_ListModules(int argc, const char **argv) {
+ const Array<NamedObject*> modules = _vm->_modules;
+ for (uint i = 0; i < modules.size(); ++i) {
+ debugPrintf("%d.%s\n", i, modules[i]->getName().c_str());
+ }
+ return true;
+}
+
+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");
+ return true;
+ }
+ const Array<NamedObject*> modules = _vm->_modules;
+ for (uint i = 0; i < modules.size(); ++i) {
+ if (modules[i]->getName() == argv[1]) {
+ _vm->initModule(argv[1], "", nullptr);
+ return true;
+ }
+ }
+ debugPrintf("Module %s doesn't exist", argv[1]);
+ return true;
+}
+
+} // End of namespace Pink