From 13a8e5f822a9a77c5bee1d7f60adfdb32decfb1d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 22:29:16 -0400 Subject: TITANIC: Implement debugger with dump and room commands --- engines/titanic/titanic.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'engines/titanic/titanic.cpp') diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index e7bbd84c34..e5417c1e7d 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -29,6 +29,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "titanic/titanic.h" +#include "titanic/debugger.h" #include "titanic/carry/hose.h" #include "titanic/core/saveable_object.h" #include "titanic/game/get_lift_eye2.h" @@ -47,11 +48,13 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe : _gameDescription(gameDesc), Engine(syst), _randomSource("Titanic"), _ticksCount(0), _frameCounter(0) { g_vm = this; + _debugger = nullptr; _window = nullptr; _screenManager = nullptr; } TitanicEngine::~TitanicEngine() { + delete _debugger; delete _window; delete _screenManager; CSaveableObject::freeClassList(); @@ -79,6 +82,7 @@ void TitanicEngine::initialize() { CExitPellerator::init(); CEnterExitSecClassMiniLift::init(); + _debugger = new Debugger(this); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); @@ -108,9 +112,24 @@ Common::Error TitanicEngine::run() { } void TitanicEngine::processEvents() { - Common::Event evt; - g_system->getEventManager()->pollEvent(evt); - + Common::Event event; + g_system->getEventManager()->pollEvent(event); + + // Give time to the debugger + _debugger->onFrame(); + + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _debugger->attach(); + _debugger->onFrame(); + } + break; + + default: + break; + } } } // End of namespace Titanic -- cgit v1.2.3