aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner2010-11-08 12:22:58 +0000
committerDavid Turner2010-11-08 12:22:58 +0000
commitcb734285a50af24dd0453ab292855f038e936acf (patch)
tree87444882f6157870e16c0d16c325b841ea79a098
parentc76f0c6c022766a2db7e96e3e68260d3b9bd7a25 (diff)
downloadscummvm-rg350-cb734285a50af24dd0453ab292855f038e936acf.tar.gz
scummvm-rg350-cb734285a50af24dd0453ab292855f038e936acf.tar.bz2
scummvm-rg350-cb734285a50af24dd0453ab292855f038e936acf.zip
SWORD1: Added basic debugging console to engine
SWORD1 does not currently use Debug Channels, but this does provide a base for adding them along with any other debugging commands. svn-id: r54140
-rw-r--r--engines/sword1/console.cpp43
-rw-r--r--engines/sword1/console.h50
-rw-r--r--engines/sword1/module.mk1
-rw-r--r--engines/sword1/sword1.cpp10
-rw-r--r--engines/sword1/sword1.h5
5 files changed, 109 insertions, 0 deletions
diff --git a/engines/sword1/console.cpp b/engines/sword1/console.cpp
new file mode 100644
index 0000000000..7a1c087dd5
--- /dev/null
+++ b/engines/sword1/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 "sword1/console.h"
+#include "sword1/sword1.h"
+
+namespace Sword1 {
+
+SwordConsole::SwordConsole(SwordEngine *vm) : GUI::Debugger(), _vm(vm) {
+}
+
+SwordConsole::~SwordConsole() {
+}
+
+void SwordConsole::preEnter() {
+}
+
+void SwordConsole::postEnter() {
+}
+
+} // End of namespace Sword
diff --git a/engines/sword1/console.h b/engines/sword1/console.h
new file mode 100644
index 0000000000..09d197363e
--- /dev/null
+++ b/engines/sword1/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 SWORD1_CONSOLE_H
+#define SWORD1_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Sword1 {
+
+class SwordEngine;
+
+class SwordConsole : public GUI::Debugger {
+public:
+ SwordConsole(SwordEngine *vm);
+ virtual ~SwordConsole(void);
+
+protected:
+ virtual void preEnter();
+ virtual void postEnter();
+
+private:
+ SwordEngine *_vm;
+};
+
+} // End of namespace Sword1
+
+#endif
diff --git a/engines/sword1/module.mk b/engines/sword1/module.mk
index 1dbff19464..a19fcbfab9 100644
--- a/engines/sword1/module.mk
+++ b/engines/sword1/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/sword1
MODULE_OBJS := \
animation.o \
+ console.o \
control.o \
debug.o \
detection.o \
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index ba1f77f896..0dcadeca2a 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -66,6 +66,8 @@ SwordEngine::SwordEngine(OSystem *syst)
SearchMan.addSubDirectoryMatching(gameDataDir, "smackshi");
SearchMan.addSubDirectoryMatching(gameDataDir, "english");//PSX Demo
SearchMan.addSubDirectoryMatching(gameDataDir, "italian");//PSX Demo
+
+ _console = new SwordConsole(this);
}
SwordEngine::~SwordEngine() {
@@ -78,6 +80,7 @@ SwordEngine::~SwordEngine() {
delete _mouse;
delete _objectMan;
delete _resMan;
+ delete _console;
}
Common::Error SwordEngine::init() {
@@ -678,6 +681,13 @@ uint8 SwordEngine::mainLoop() {
if (retCode == CONTROL_NOTHING_DONE)
_screen->fullRefresh();
}
+
+ // Check for Debugger Activation
+ if (_keyPressed.hasFlags(Common::KBD_CTRL) && _keyPressed.keycode == Common::KEYCODE_d) {
+ this->getDebugger()->attach();
+ this->getDebugger()->onFrame();
+ }
+
_mouseState = 0;
_keyPressed.reset();
} while ((Logic::_scriptVars[SCREEN] == Logic::_scriptVars[NEW_SCREEN]) && (retCode == 0) && (!shouldQuit()));
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index f4e60e9fa3..592d2da6f4 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -30,6 +30,7 @@
#include "common/events.h"
#include "common/util.h"
#include "sword1/sworddefs.h"
+#include "sword1/console.h"
/**
* This is the namespace of the Sword1 engine.
@@ -106,6 +107,8 @@ protected:
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
+ GUI::Debugger *getDebugger() { return _console; }
+
Common::Error loadGameState(int slot);
bool canLoadGameStateCurrently();
Common::Error saveGameState(int slot, const char *desc);
@@ -121,6 +124,8 @@ private:
void reinitRes(); //Reinits the resources after a GMM load
+ SwordConsole *_console;
+
uint8 mainLoop();
Common::Point _mouseCoord;