aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2015-12-23 01:34:16 +0200
committerWillem Jan Palenstijn2015-12-23 21:43:16 +0100
commit333d55371668f25e8879300b738f75f722e110df (patch)
tree93e2a3fe0ba4d719528c1ed02e72e4fbbf482273 /engines
parentced5b677f63dcb53fc0606bf9578b1fff6981075 (diff)
downloadscummvm-rg350-333d55371668f25e8879300b738f75f722e110df.tar.gz
scummvm-rg350-333d55371668f25e8879300b738f75f722e110df.tar.bz2
scummvm-rg350-333d55371668f25e8879300b738f75f722e110df.zip
LAB: Add a console, with two new commands (scene and scene_resources)
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/console.cpp78
-rw-r--r--engines/lab/console.h45
-rw-r--r--engines/lab/eventman.cpp17
-rw-r--r--engines/lab/lab.cpp4
-rw-r--r--engines/lab/lab.h3
-rw-r--r--engines/lab/module.mk1
6 files changed, 142 insertions, 6 deletions
diff --git a/engines/lab/console.cpp b/engines/lab/console.cpp
new file mode 100644
index 0000000000..b819e1ddf8
--- /dev/null
+++ b/engines/lab/console.cpp
@@ -0,0 +1,78 @@
+/* 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 "gui/debugger.h"
+
+#include "lab/lab.h"
+#include "lab/console.h"
+#include "lab/processroom.h"
+#include "lab/resource.h"
+
+namespace Lab {
+
+Console::Console(LabEngine *vm) : GUI::Debugger(), _vm(vm) {
+ registerCmd("scene", WRAP_METHOD(Console, Cmd_Scene));
+ registerCmd("scene_resources", WRAP_METHOD(Console, Cmd_DumpSceneResources));
+}
+
+Console::~Console() {
+}
+
+bool Console::Cmd_Scene(int argc, const char **argv) {
+ if (argc != 2) {
+ const char *directions[] = { "North", "South", "East", "West" };
+ debugPrintf("Current scene is %d, direction: %s\n", _vm->_roomNum, directions[_vm->getDirection()]);
+ debugPrintf("Use %s <scene number> to change the current scene\n", argv[0]);
+ return true;
+ }
+
+ _vm->_roomNum = atoi(argv[1]);
+
+ return false;
+}
+
+bool Console::Cmd_DumpSceneResources(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Usage: %s <scene number> to dump the resources for a scene\n", argv[0]);
+ return true;
+ }
+
+ int scene = atoi(argv[1]);
+ _vm->_resource->readViews(scene);
+ RoomData *roomData = &_vm->_rooms[scene];
+ RuleList *rules = roomData->_rules;
+ const char *transitions[] = { "None", "Wipe", "ScrollWipe", "ScrollBlack", "ScrollBounce", "Transporter", "ReadFirstFrame", "ReadNextFrame" };
+ const char *ruleTypes[] = { "None", "Action", "Operate", "Go forward", "Conditions", "Turn", "Go main view", "Turn from to" };
+
+ debugPrintf("Room mesage: %s\n", roomData->_roomMsg.c_str());
+ debugPrintf("Transition: %s (%d)\n", transitions[roomData->_transitionType], roomData->_transitionType);
+
+ debugPrintf("Script:\n");
+ for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
+ debugPrintf("Rule type: %s\n", ruleTypes[rule->_ruleType]);
+
+ }
+
+ return true;
+}
+
+} // End of namespace Neverhood
diff --git a/engines/lab/console.h b/engines/lab/console.h
new file mode 100644
index 0000000000..a863e11349
--- /dev/null
+++ b/engines/lab/console.h
@@ -0,0 +1,45 @@
+/* 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.
+ *
+ */
+
+#ifndef LAB_CONSOLE_H
+#define LAB_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Lab {
+
+class LabEngine;
+
+class Console : public GUI::Debugger {
+public:
+ Console(LabEngine *vm);
+ virtual ~Console(void);
+
+private:
+ LabEngine *_vm;
+
+ bool Cmd_Scene(int argc, const char **argv);
+ bool Cmd_DumpSceneResources(int argc, const char **argv);
+};
+
+} // End of namespace Lab
+#endif
diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp
index d2cf508391..2e6561c8c7 100644
--- a/engines/lab/eventman.cpp
+++ b/engines/lab/eventman.cpp
@@ -228,15 +228,19 @@ void EventManager::processInput() {
case Common::KEYCODE_LEFTBRACKET:
_vm->changeVolume(-1);
break;
-
case Common::KEYCODE_RIGHTBRACKET:
_vm->changeVolume(1);
break;
-
case Common::KEYCODE_z:
//saveSettings();
break;
-
+ case Common::KEYCODE_d:
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+ // Open debugger console
+ _vm->_console->attach();
+ continue;
+ }
+ // Intentional fall through
default: {
int n = (_nextKeyIn + 1) % 64;
if (n != _nextKeyOut) {
@@ -251,10 +255,11 @@ void EventManager::processInput() {
default:
break;
}
-
- g_system->copyRectToScreen(_vm->_graphics->_displayBuffer, _vm->_graphics->_screenWidth, 0, 0, _vm->_graphics->_screenWidth, _vm->_graphics->_screenHeight);
- g_system->updateScreen();
}
+
+ g_system->copyRectToScreen(_vm->_graphics->_displayBuffer, _vm->_graphics->_screenWidth, 0, 0, _vm->_graphics->_screenWidth, _vm->_graphics->_screenHeight);
+ _vm->_console->onFrame();
+ g_system->updateScreen();
}
Common::KeyCode EventManager::getNextChar() {
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 52a96eb6e5..52dd4169ba 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -37,6 +37,7 @@
#include "lab/lab.h"
#include "lab/anim.h"
+#include "lab/console.h"
#include "lab/dispman.h"
#include "lab/eventman.h"
#include "lab/image.h"
@@ -83,6 +84,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_rooms = nullptr;
_tilePuzzle = nullptr;
_utils = nullptr;
+ _console = nullptr;
_journalBackImage = nullptr;
_screenImage = nullptr;
@@ -151,6 +153,7 @@ LabEngine::~LabEngine() {
delete _graphics;
delete _tilePuzzle;
delete _utils;
+ delete _console;
delete _journalBackImage;
// _screenImage->_imageData is always pointing to the current drawing buffer.
// It shouldn't be deleted there.
@@ -171,6 +174,7 @@ Common::Error LabEngine::run() {
_anim = new Anim(this);
_tilePuzzle = new TilePuzzle(this);
_utils = new Utils(this);
+ _console = new Console(this);
_journalBackImage = new Image(this);
_screenImage = new Image(this);
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index fa7f850202..ba642f5ddb 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -38,6 +38,7 @@
#include "engines/engine.h"
#include "engines/savestate.h"
+#include "lab/console.h"
#include "lab/image.h"
#include "lab/labsets.h"
@@ -171,6 +172,8 @@ public:
TextFont *_msgFont;
TilePuzzle *_tilePuzzle;
Utils *_utils;
+ Console *_console;
+ GUI::Debugger *getDebugger() { return _console; }
public:
LabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/lab/module.mk b/engines/lab/module.mk
index 6b7932a59e..a619cba6ed 100644
--- a/engines/lab/module.mk
+++ b/engines/lab/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/lab
MODULE_OBJS := \
anim.o \
+ console.o \
detection.o \
dispman.o \
engine.o \