diff options
author | David Turner | 2010-11-07 15:03:54 +0000 |
---|---|---|
committer | David Turner | 2010-11-07 15:03:54 +0000 |
commit | 3d961469fdce1e727249534d5710c1f58955bb20 (patch) | |
tree | 4d74bb59a70cf2324e5bf7239e20c9a2a730c004 /engines | |
parent | 0119a659b5352ba284a7bff0afefa4d2bf054ac3 (diff) | |
download | scummvm-rg350-3d961469fdce1e727249534d5710c1f58955bb20.tar.gz scummvm-rg350-3d961469fdce1e727249534d5710c1f58955bb20.tar.bz2 scummvm-rg350-3d961469fdce1e727249534d5710c1f58955bb20.zip |
DRACI: Added basic debugging console to engine
Since DRACI uses Debug Channels, this allows for the interactive setting of debugflags as well as providing a base for adding further debugging commands.
svn-id: r54116
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/console.cpp | 43 | ||||
-rw-r--r-- | engines/draci/console.h | 50 | ||||
-rw-r--r-- | engines/draci/draci.cpp | 10 | ||||
-rw-r--r-- | engines/draci/draci.h | 5 | ||||
-rw-r--r-- | engines/draci/module.mk | 1 |
5 files changed, 109 insertions, 0 deletions
diff --git a/engines/draci/console.cpp b/engines/draci/console.cpp new file mode 100644 index 0000000000..96e8e3ae05 --- /dev/null +++ b/engines/draci/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 "draci/console.h" +#include "draci/draci.h" + +namespace Draci { + +DraciConsole::DraciConsole(DraciEngine *vm) : GUI::Debugger(), _vm(vm) { +} + +DraciConsole::~DraciConsole() { +} + +void DraciConsole::preEnter() { +} + +void DraciConsole::postEnter() { +} + +} // End of namespace Draci diff --git a/engines/draci/console.h b/engines/draci/console.h new file mode 100644 index 0000000000..811e14e0be --- /dev/null +++ b/engines/draci/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 DRACI_CONSOLE_H +#define DRACI_CONSOLE_H + +#include "gui/debugger.h" + +namespace Draci { + +class DraciEngine; + +class DraciConsole : public GUI::Debugger { +public: + DraciConsole(DraciEngine *vm); + virtual ~DraciConsole(void); + +protected: + virtual void preEnter(); + virtual void postEnter(); + +private: + DraciEngine *_vm; +}; + +} // End of namespace Draci + +#endif diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 7a7d7b8372..d0eb511cbd 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -94,6 +94,8 @@ DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc) DebugMan.addDebugChannel(kDraciSoundDebugLevel, "sound", "Sound debug info"); DebugMan.addDebugChannel(kDraciWalkingDebugLevel, "walking", "Walking debug info"); + _console = new DraciConsole(this); + // Don't forget to register your random source g_eventRec.registerRandomSource(_rnd, "draci"); } @@ -346,6 +348,12 @@ void DraciEngine::handleEvents() { _game->inventorySwitch(event.kbd.keycode); } break; + case Common::KEYCODE_d: + if (event.kbd.hasFlags(Common::KBD_CTRL)) { + this->getDebugger()->attach(); + this->getDebugger()->onFrame(); + } + break; default: break; } @@ -399,6 +407,8 @@ DraciEngine::~DraciEngine() { // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); + + delete _console; } Common::Error DraciEngine::run() { diff --git a/engines/draci/draci.h b/engines/draci/draci.h index f2cc2ce2e7..aa6080ca05 100644 --- a/engines/draci/draci.h +++ b/engines/draci/draci.h @@ -28,6 +28,7 @@ #include "engines/engine.h" #include "common/random.h" +#include "draci/console.h" struct ADGameDescription; @@ -75,6 +76,8 @@ public: virtual Common::Error saveGameState(int slot, const char *desc); virtual bool canSaveGameStateCurrently(); + GUI::Debugger *getDebugger() { return _console; } + Screen *_screen; Mouse *_mouse; Game *_game; @@ -108,6 +111,8 @@ public: Common::RandomSource _rnd; int32 _pauseStartTime; +private: + DraciConsole *_console; }; enum { diff --git a/engines/draci/module.mk b/engines/draci/module.mk index 1f80737135..e6c9511687 100644 --- a/engines/draci/module.mk +++ b/engines/draci/module.mk @@ -3,6 +3,7 @@ MODULE := engines/draci MODULE_OBJS := \ animation.o \ barchive.o \ + console.o \ detection.o \ draci.o \ font.o \ |