QUEEN: Refactor to use Engine debugger

This commit is contained in:
Paul Gilbert 2020-02-08 22:41:39 -08:00 committed by Filippos Karapetis
parent edcf6b9112
commit 7243eaf907
4 changed files with 9 additions and 22 deletions

View File

@ -54,7 +54,7 @@ Input::Input(Common::Language language, OSystem *system) :
_system(system), _eventMan(system->getEventManager()), _fastMode(false),
_keyVerb(VERB_NONE), _cutawayRunning(false), _canQuit(false),
_cutawayQuit(false), _dialogueRunning(false), _talkQuit(false),
_quickSave(false), _quickLoad(false), _debugger(false), _inKey(Common::KEYCODE_INVALID),
_quickSave(false), _quickLoad(false), _inKey(Common::KEYCODE_INVALID),
_mouseButton(0), _idleTime(0) {
switch (language) {
@ -99,9 +99,7 @@ void Input::delay(uint amount) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_d) {
_debugger = true;
} else if (event.kbd.keycode == Common::KEYCODE_f) {
if (event.kbd.keycode == Common::KEYCODE_f) {
_fastMode = !_fastMode;
}
} else {

View File

@ -73,8 +73,6 @@ public:
void quickSaveReset() { _quickSave = false; }
bool quickLoad() const { return _quickLoad; }
void quickLoadReset() { _quickLoad = false; }
bool debugger() const { return _debugger; }
void debuggerReset() { _debugger = false; }
bool fastMode() const { return _fastMode; }
void fastMode(bool fm) { _fastMode = fm; }
@ -123,9 +121,6 @@ private:
//! set if quickload requested
bool _quickLoad;
//! set if debugger requested
bool _debugger;
//! set by delay();
Common::KeyCode _inKey;

View File

@ -50,7 +50,10 @@
namespace Queen {
QueenEngine::QueenEngine(OSystem *syst)
: Engine(syst), _gameStarted(false), _debugger(0), randomizer("queen") {
: Engine(syst), _bam(nullptr), _bankMan(nullptr), _command(nullptr), _debugger(nullptr),
_display(nullptr), _graphics(nullptr), _grid(nullptr), _input(nullptr), _logic(nullptr),
_sound(nullptr), _resource(nullptr), _walk(nullptr), _gameStarted(false),
randomizer("queen") {
}
QueenEngine::~QueenEngine() {
@ -58,7 +61,6 @@ QueenEngine::~QueenEngine() {
delete _resource;
delete _bankMan;
delete _command;
delete _debugger;
delete _display;
delete _graphics;
delete _grid;
@ -66,6 +68,7 @@ QueenEngine::~QueenEngine() {
delete _logic;
delete _sound;
delete _walk;
//_debugger is deleted by Engine
}
void QueenEngine::registerDefaultSettings() {
@ -124,8 +127,6 @@ void QueenEngine::writeOptionSettings() {
}
void QueenEngine::update(bool checkPlayerInput) {
_debugger->onFrame();
_graphics->update(_logic->currentRoom());
_logic->update();
@ -143,10 +144,7 @@ void QueenEngine::update(bool checkPlayerInput) {
_display->update(joe->active, joe->x, joe->y);
_input->checkKeys();
if (_input->debugger()) {
_input->debuggerReset();
_debugger->attach();
}
if (canLoadOrSave()) {
if (_input->quickSave()) {
_input->quickSaveReset();
@ -311,10 +309,6 @@ void QueenEngine::findGameStateDescriptions(char descriptions[100][32]) {
}
}
GUI::Debugger *QueenEngine::getDebugger() {
return _debugger;
}
bool Queen::QueenEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsRTL) ||
@ -332,6 +326,7 @@ Common::Error QueenEngine::run() {
_bankMan = new BankManager(_resource);
_command = new Command(this);
_debugger = new Debugger(this);
setDebugger(_debugger);
_display = new Display(this, _system);
_graphics = new Graphics(this);
_grid = new Grid(this);

View File

@ -120,7 +120,6 @@ protected:
// Engine APIs
Common::Error run() override;
GUI::Debugger *getDebugger() override;
bool hasFeature(EngineFeature f) const override;
void syncSoundSettings() override;