aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner2010-11-07 15:04:47 +0000
committerDavid Turner2010-11-07 15:04:47 +0000
commit1cbab9885bc7af3ee758c4ca9ce61bb9cb3e5af9 (patch)
treed5ac040fdbe6cc53f64ff60d481e09f25c9971fd
parent3d961469fdce1e727249534d5710c1f58955bb20 (diff)
downloadscummvm-rg350-1cbab9885bc7af3ee758c4ca9ce61bb9cb3e5af9.tar.gz
scummvm-rg350-1cbab9885bc7af3ee758c4ca9ce61bb9cb3e5af9.tar.bz2
scummvm-rg350-1cbab9885bc7af3ee758c4ca9ce61bb9cb3e5af9.zip
HUGO: Added basic debugging console to engine
Since HUGO uses Debug Channels, this allows for the interactive setting of debugflags as well as providing a base for adding further debugging commands. svn-id: r54117
-rw-r--r--engines/hugo/console.cpp43
-rw-r--r--engines/hugo/console.h50
-rw-r--r--engines/hugo/hugo.cpp8
-rw-r--r--engines/hugo/hugo.h5
-rw-r--r--engines/hugo/module.mk1
5 files changed, 107 insertions, 0 deletions
diff --git a/engines/hugo/console.cpp b/engines/hugo/console.cpp
new file mode 100644
index 0000000000..4c4f5934f8
--- /dev/null
+++ b/engines/hugo/console.cpp
@@ -0,0 +1,43 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "hugo/console.h"
+#include "hugo/hugo.h"
+
+namespace Hugo {
+
+HugoConsole::HugoConsole(HugoEngine *vm) : GUI::Debugger(), _vm(vm) {
+}
+
+HugoConsole::~HugoConsole() {
+}
+
+void HugoConsole::preEnter() {
+}
+
+void HugoConsole::postEnter() {
+}
+
+} // End of namespace Hugo
diff --git a/engines/hugo/console.h b/engines/hugo/console.h
new file mode 100644
index 0000000000..f6c651459e
--- /dev/null
+++ b/engines/hugo/console.h
@@ -0,0 +1,50 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef HUGO_CONSOLE_H
+#define HUGO_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Hugo {
+
+class HugoEngine;
+
+class HugoConsole : public GUI::Debugger {
+public:
+ HugoConsole(HugoEngine *vm);
+ virtual ~HugoConsole(void);
+
+protected:
+ virtual void preEnter();
+ virtual void postEnter();
+
+private:
+ HugoEngine *_vm;
+};
+
+} // End of namespace Hugo
+
+#endif
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 0893fe0447..774abc0343 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -79,6 +79,7 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy
DebugMan.addDebugChannel(kDebugInventory, "Inventory", "Inventory debug level");
DebugMan.addDebugChannel(kDebugObject, "Object", "Object debug level");
+ _console = new HugoConsole(this);
}
HugoEngine::~HugoEngine() {
@@ -144,6 +145,9 @@ HugoEngine::~HugoEngine() {
delete _screen;
delete _scheduler;
delete _file;
+
+ DebugMan.clearAllDebugChannels();
+ delete _console;
}
GameType HugoEngine::getGameType() const {
@@ -250,6 +254,10 @@ Common::Error HugoEngine::run() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
+ this->getDebugger()->attach();
+ this->getDebugger()->onFrame();
+ }
_parser->keyHandler(event.kbd.keycode, 0);
break;
case Common::EVENT_MOUSEMOVE:
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 257ccd5833..c829824638 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -28,6 +28,7 @@
#include "engines/engine.h"
#include "common/file.h"
+#include "hugo/console.h"
// This include is here temporarily while the engine is being refactored.
#include "hugo/game.h"
@@ -156,6 +157,8 @@ public:
uint16 _drop;
uint16 _numObj;
+ GUI::Debugger *getDebugger() { return _console; }
+
Common::RandomSource *_rnd;
const char *_episode;
@@ -264,6 +267,8 @@ private:
static HugoEngine *s_Engine;
+ HugoConsole *_console;
+
// The following are bit plane display overlays which mark travel boundaries,
// foreground stationary objects and baselines for those objects (used to
// determine foreground/background wrt moving objects)
diff --git a/engines/hugo/module.mk b/engines/hugo/module.mk
index 75c9f9d5e2..703a70ec1f 100644
--- a/engines/hugo/module.mk
+++ b/engines/hugo/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/hugo
MODULE_OBJS := \
+ console.o \
detection.o \
display.o \
display_v1d.o \