diff options
| -rw-r--r-- | engines/cryo/cryo.cpp | 11 | ||||
| -rw-r--r-- | engines/cryo/cryo.h | 7 | ||||
| -rw-r--r-- | engines/cryo/cryolib.cpp | 7 | ||||
| -rw-r--r-- | engines/cryo/debugger.cpp | 47 | ||||
| -rw-r--r-- | engines/cryo/debugger.h | 47 | ||||
| -rw-r--r-- | engines/cryo/eden.cpp | 14 | ||||
| -rw-r--r-- | engines/cryo/module.mk | 1 |
7 files changed, 119 insertions, 15 deletions
diff --git a/engines/cryo/cryo.cpp b/engines/cryo/cryo.cpp index df16f8af1f..be7c5d779e 100644 --- a/engines/cryo/cryo.cpp +++ b/engines/cryo/cryo.cpp @@ -40,7 +40,7 @@ namespace Cryo { CryoEngine *g_ed = nullptr; -CryoEngine::CryoEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _console(nullptr) { +CryoEngine::CryoEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { // Put your engine in a sane state, but do nothing big yet; // in particular, do not load data from files; rather, if you // need to do such things, do them from run(). @@ -58,11 +58,13 @@ CryoEngine::CryoEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engin // Don't forget to register your random source _rnd = new Common::RandomSource("cryo"); + _debugger = nullptr; + _game = nullptr; _video = nullptr; _screenView = nullptr; - debug("CryoEngine::CryoEngine"); + _showHotspots = false; g_ed = this; } @@ -75,6 +77,7 @@ CryoEngine::~CryoEngine() { delete _game; delete _video; delete _screenView; + delete _debugger; // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); @@ -84,6 +87,7 @@ Common::Error CryoEngine::run() { _game = new EdenGame(this); _video = new HnmPlayer(this); _screenView = new View(this, 320, 200); + _debugger = new Debugger(this); ///// CLTimer _timerTicks = 0; // incremented in realtime @@ -92,9 +96,6 @@ Common::Error CryoEngine::run() { initGraphics(320, 200, false); _screen.create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); - // Create debugger console. It requires GFX to be initialized - _console = new Console(this); - // Additional setup. debug("CryoEngine::init"); diff --git a/engines/cryo/cryo.h b/engines/cryo/cryo.h index 0d3618921d..89bb4f0c04 100644 --- a/engines/cryo/cryo.h +++ b/engines/cryo/cryo.h @@ -37,6 +37,7 @@ #include "cryo/eden.h" #include "cryo/video.h" +#include "cryo/debugger.h" namespace Cryo { @@ -69,10 +70,13 @@ public: Graphics::Surface _screen; EdenGame *_game; HnmPlayer *_video; + Debugger *_debugger; View *_screenView; volatile int32 _timerTicks; + bool _showHotspots; + void pollEvents(); bool isScanCodeDown(int16 scancode); @@ -81,9 +85,6 @@ public: void getMousePosition(int16 *x, int16 *y); void setMousePosition(int16 x, int16 y); bool isMouseButtonDown(); - -private: - Console *_console; }; extern CryoEngine *g_ed; diff --git a/engines/cryo/cryolib.cpp b/engines/cryo/cryolib.cpp index e328417633..5b6befd697 100644 --- a/engines/cryo/cryolib.cpp +++ b/engines/cryo/cryolib.cpp @@ -274,7 +274,12 @@ void CryoEngine::pollEvents() { return; case Common::EVENT_KEYDOWN: - // _keyState[(byte)toupper(event.kbd.ascii)] = true; + // Check for debugger + if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _debugger->attach(); + _debugger->onFrame(); + } return; case Common::EVENT_KEYUP: // _keyState[(byte)toupper(event.kbd.ascii)] = false; diff --git a/engines/cryo/debugger.cpp b/engines/cryo/debugger.cpp new file mode 100644 index 0000000000..11a3fb9ec2 --- /dev/null +++ b/engines/cryo/debugger.cpp @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#include "common/coroutines.h" +#include "cryo/debugger.h" +#include "cryo/cryo.h" + +namespace Cryo { + +Debugger::Debugger(CryoEngine *vm) : GUI::Debugger(), _vm(vm) { + registerCmd("showHotspots", WRAP_METHOD(Debugger, Cmd_ShowHotspots)); +} + +/** + * This command enables/disables hotspot display + */ +bool Debugger::Cmd_ShowHotspots(int argc, const char **argv) { + if (argc != 1) { + debugPrintf("Usage: %s\n", argv[0]); + return true; + } + + _vm->_showHotspots ^= 1; + + return false; +} + +} // End of namespace Cryo diff --git a/engines/cryo/debugger.h b/engines/cryo/debugger.h new file mode 100644 index 0000000000..bb3ad808ff --- /dev/null +++ b/engines/cryo/debugger.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef CRYO_DEBUGGER_H +#define CRYO_DEBUGGER_H + +#include "common/scummsys.h" +#include "gui/debugger.h" + +namespace Cryo { + +class CryoEngine; + +class Debugger : public GUI::Debugger { +private: + CryoEngine *_vm; + +public: + Debugger(CryoEngine *vm); + virtual ~Debugger() {} + +protected: + bool Cmd_ShowHotspots(int argc, const char **argv); +}; + +} // End of namespace Cryo + +#endif diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 2c075c69f3..3b608b5eed 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -5380,12 +5380,14 @@ void EdenGame::displaySingleRoom(Room *room) { x += _globals->_roomBaseX; ex += _globals->_roomBaseX; debug("add hotspot at %3d:%3d - %3d:%3d, action = %d", x, y, ex, ey, b0); -#ifdef EDEN_DEBUG - for (int iii = x; iii < ex; iii++) - _mainViewBuf[y * 640 + iii] = _mainViewBuf[ey * 640 + iii] = (iii % 2) ? 0 : 255; - for (int iii = y; iii < ey; iii++) - _mainViewBuf[iii * 640 + x] = _mainViewBuf[iii * 640 + ex] = (iii % 2) ? 0 : 255; -#endif + + if (_vm->_showHotspots) { + for (int iii = x; iii < ex; iii++) + _mainViewBuf[y * 640 + iii] = _mainViewBuf[ey * 640 + iii] = (iii % 2) ? 0 : 255; + for (int iii = y; iii < ey; iii++) + _mainViewBuf[iii * 640 + x] = _mainViewBuf[iii * 640 + ex] = (iii % 2) ? 0 : 255; + } + icon->sx = x; icon->sy = y; icon->ex = ex; diff --git a/engines/cryo/module.mk b/engines/cryo/module.mk index b82a7a182d..d0eae378b7 100644 --- a/engines/cryo/module.mk +++ b/engines/cryo/module.mk @@ -3,6 +3,7 @@ MODULE := engines/cryo MODULE_OBJS = \ cryo.o \ cryolib.o \ + debugger.o \ detection.o \ eden.o \ sound.o \ |
