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
This commit is contained in:
David Turner 2010-11-07 15:04:47 +00:00
parent 3d961469fd
commit 1cbab9885b
5 changed files with 107 additions and 0 deletions

43
engines/hugo/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 "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

50
engines/hugo/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 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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
MODULE := engines/hugo
MODULE_OBJS := \
console.o \
detection.o \
display.o \
display_v1d.o \