aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhiterandrek2018-06-21 12:12:02 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commita8cbdba16f466ba5503f981ebe5d6f079b31dd9b (patch)
tree342b6087fc76caf2d9949ebc137b5b8c393c1a5b
parentd0f0f4185746fc2b5020dbf0adc0103ce589f848 (diff)
downloadscummvm-rg350-a8cbdba16f466ba5503f981ebe5d6f079b31dd9b.tar.gz
scummvm-rg350-a8cbdba16f466ba5503f981ebe5d6f079b31dd9b.tar.bz2
scummvm-rg350-a8cbdba16f466ba5503f981ebe5d6f079b31dd9b.zip
PINK: added commands to Console
-rw-r--r--engines/pink/console.cpp59
-rw-r--r--engines/pink/console.h9
-rw-r--r--engines/pink/module.mk1
-rw-r--r--engines/pink/pink.cpp7
-rw-r--r--engines/pink/pink.h2
5 files changed, 76 insertions, 2 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
diff --git a/engines/pink/console.h b/engines/pink/console.h
index bad3441203..9c438a890c 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -31,9 +31,16 @@ class PinkEngine;
class Console : public GUI::Debugger {
public:
- Console(PinkEngine *vm) {}
+ Console(PinkEngine *vm);
virtual ~Console(void) {}
+
+private:
+ bool Cmd_ListModules(int argc, const char **argv);
+ bool Cmd_GoToModule(int argc, const char **argv);
+
+private:
+ PinkEngine *_vm;
};
} // End of namespace Pink
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 9c2215a6c9..002159aac7 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS = \
archive.o \
audio_info_mgr.o \
cel_decoder.o \
+ console.o \
cursor_mgr.o \
detection.o \
director.o \
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index a91c4f4d24..50e8e53af9 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -126,7 +126,12 @@ Common::Error Pink::PinkEngine::run() {
_actor->onRightButtonClick(event.mouse);
break;
case Common::EVENT_KEYDOWN:
- _actor->onKeyboardButtonClick(event.kbd.keycode);
+ if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
+ _console->attach();
+ _console->onFrame();
+ } else {
+ _actor->onKeyboardButtonClick(event.kbd.keycode);
+ }
break;
default:
break;
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index f0225823eb..23ae8987cf 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -93,6 +93,8 @@ public:
Common::Error saveGameState(int slot, const Common::String &desc) override;
bool canSaveGameStateCurrently() override;
+ friend class Console;
+
protected:
virtual void pauseEngineIntern(bool pause) override;