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
This commit is contained in:
David Turner 2010-11-07 17:18:59 +00:00
parent f9d311d1ef
commit 279a760c5a
5 changed files with 106 additions and 1 deletions

43
engines/toon/console.cpp Normal file
View File

@ -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

50
engines/toon/console.h Normal file
View File

@ -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

View File

@ -4,6 +4,7 @@ MODULE_OBJS := \
anim.o \
audio.o \
character.o \
console.o \
conversation.o \
detection.o \
drew.o \

View File

@ -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() {

View File

@ -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