From 2ccb5bb0251d801ef8b2fc15accbf7d421990afa Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 10:18:34 +0000 Subject: Drascula: Added debug console. Implemented a (buggy) room comand. svn-id: r49703 --- engines/drascula/console.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++ engines/drascula/console.h | 51 +++++++++++++++++++++++++++++++++++ engines/drascula/drascula.cpp | 6 +++++ engines/drascula/drascula.h | 4 +++ engines/drascula/module.mk | 1 + 5 files changed, 125 insertions(+) create mode 100755 engines/drascula/console.cpp create mode 100755 engines/drascula/console.h diff --git a/engines/drascula/console.cpp b/engines/drascula/console.cpp new file mode 100755 index 0000000000..d017468285 --- /dev/null +++ b/engines/drascula/console.cpp @@ -0,0 +1,63 @@ +/* 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 "drascula/console.h" +#include "gui/debugger.h" +#include "drascula/drascula.h" + +namespace Drascula { + +Console::Console(DrasculaEngine *vm) : GUI::Debugger(), _vm(vm) { + DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room)); +} + +Console::~Console() { +} + +void Console::preEnter() { +} + +void Console::postEnter() { +} + +bool Console::Cmd_Room(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Usage: changeCard \n"); + return true; + } + + int roomNum = atoi(argv[1]); + + _vm->loadedDifferentChapter = 0; + _vm->enterRoom(roomNum); + _vm->selectVerb(kVerbNone); + _vm->clearRoom(); + _vm->loadPic(roomNum, _vm->bgSurface, HALF_PAL); + _vm->selectionMade = 0; + + return false; +} + +} // End of namespace Drascula diff --git a/engines/drascula/console.h b/engines/drascula/console.h new file mode 100755 index 0000000000..33e2f626e4 --- /dev/null +++ b/engines/drascula/console.h @@ -0,0 +1,51 @@ +/* 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 DRASCULA_CONSOLE_H +#define DRASCULA_CONSOLE_H + +#include "gui/debugger.h" + +namespace Drascula { + +class DrasculaEngine; + +class Console : public GUI::Debugger { +public: + Console(DrasculaEngine *vm); + virtual ~Console(void); + +protected: + virtual void preEnter(); + virtual void postEnter(); + +private: + DrasculaEngine *_vm; + + bool Cmd_Room(int argc, const char **argv); +}; + +} // End of namespace Drascula +#endif diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 2c3ca63600..b16182e3e2 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -38,6 +38,7 @@ #include "sound/mixer.h" #include "drascula/drascula.h" +#include "drascula/console.h" namespace Drascula { @@ -173,6 +174,8 @@ Common::Error DrasculaEngine::run() { _lang = kEnglish; } + _console = new Console(this); + if (!loadDrasculaDat()) return Common::kUnknownError; @@ -594,6 +597,9 @@ bool DrasculaEngine::runCurrentChapter() { } else if (key == Common::KEYCODE_ESCAPE) { if (!confirmExit()) return false; + } else if (key == Common::KEYCODE_TILDE || key == Common::KEYCODE_BACKQUOTE) { + _console->attach(); + _console->onFrame(); } else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) { loadPic("alcbar.alg", bgSurface, 255); } diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 4876cf3390..aaa1a4f42a 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -317,6 +317,8 @@ static const int interf_y[] = { 51, 51, 51, 51, 83, 83, 83 }; struct RoomHandlers; +class Console; + class DrasculaEngine : public ::Engine { protected: // Engine APIs @@ -733,6 +735,8 @@ public: private: int _lang; + Console *_console; + CharInfo *_charMap; int _charMapSize; diff --git a/engines/drascula/module.mk b/engines/drascula/module.mk index a9fa257549..20fd900124 100644 --- a/engines/drascula/module.mk +++ b/engines/drascula/module.mk @@ -3,6 +3,7 @@ MODULE := engines/drascula MODULE_OBJS := \ actors.o \ animation.o \ + console.o \ converse.o \ detection.o \ drascula.o \ -- cgit v1.2.3