From 279a760c5a833b51de3217f8eadda7cf57596532 Mon Sep 17 00:00:00 2001 From: David Turner Date: Sun, 7 Nov 2010 17:18:59 +0000 Subject: TOON: Added basic debugging console to engine Since Toon uses Debug Channels, this allows for the interactive setting of debugflags as well as providing a base for adding further debugging commands. However, the hotkey for this is currently disabled as it causes a segfault. Not sure why. svn-id: r54123 --- engines/toon/console.cpp | 43 +++++++++++++++++++++++++++++++++++++++++ engines/toon/console.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ engines/toon/module.mk | 1 + engines/toon/toon.cpp | 10 +++++++++- engines/toon/toon.h | 3 +++ 5 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 engines/toon/console.cpp create mode 100644 engines/toon/console.h (limited to 'engines/toon') diff --git a/engines/toon/console.cpp b/engines/toon/console.cpp new file mode 100644 index 0000000000..db50e28489 --- /dev/null +++ b/engines/toon/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 "toon/console.h" +#include "toon/toon.h" + +namespace Toon { + +ToonConsole::ToonConsole(ToonEngine *vm) : GUI::Debugger(), _vm(vm) { +} + +ToonConsole::~ToonConsole() { +} + +void ToonConsole::preEnter() { +} + +void ToonConsole::postEnter() { +} + +} // End of namespace Toon diff --git a/engines/toon/console.h b/engines/toon/console.h new file mode 100644 index 0000000000..40b556e633 --- /dev/null +++ b/engines/toon/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 TOON_CONSOLE_H +#define TOON_CONSOLE_H + +#include "gui/debugger.h" + +namespace Toon { + +class ToonEngine; + +class ToonConsole : public GUI::Debugger { +public: + ToonConsole(ToonEngine *vm); + virtual ~ToonConsole(void); + +protected: + virtual void preEnter(); + virtual void postEnter(); + +private: + ToonEngine *_vm; +}; + +} // End of namespace Toon + +#endif diff --git a/engines/toon/module.mk b/engines/toon/module.mk index 403408e497..7796203d00 100644 --- a/engines/toon/module.mk +++ b/engines/toon/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS := \ anim.o \ audio.o \ character.o \ + console.o \ conversation.o \ detection.o \ drew.o \ diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 3f8d0b2b5f..9ccd947977 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -239,6 +239,11 @@ void ToonEngine::parseInput() { dialog.runModal(); } } + // FIXME - Triggering Debug Console currently causes a segfault. + //if (event.kbd.keycode == Common::KEYCODE_d) { + // this->getDebugger()->attach(); + // this->getDebugger()->onFrame(); + //} } break; // Strangerke - Commented (not used) @@ -750,6 +755,8 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription) DebugMan.addDebugChannel(kDebugTools, "Tools", "Tools debug level"); DebugMan.addDebugChannel(kDebugText, "Text", "Text debug level"); + _console = new ToonConsole(this); + switch (_language) { case Common::EN_GRB: case Common::EN_USA: @@ -776,7 +783,8 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription) } ToonEngine::~ToonEngine() { - + DebugMan.clearAllDebugChannels(); + delete _console; } void ToonEngine::flushPalette() { diff --git a/engines/toon/toon.h b/engines/toon/toon.h index 299cb403b1..93cf2f168f 100644 --- a/engines/toon/toon.h +++ b/engines/toon/toon.h @@ -41,6 +41,7 @@ #include "toon/font.h" #include "toon/text.h" #include "toon/audio.h" +#include "toon/console.h" #define TOON_DAT_VER_MAJ 0 // 1 byte #define TOON_DAT_VER_MIN 3 // 1 byte @@ -417,6 +418,8 @@ protected: bool _firstFrame; bool _isDemo; bool _showConversationText; +private: + ToonConsole *_console; }; } // End of namespace Toon -- cgit v1.2.3