diff options
Diffstat (limited to 'engines/kyra/kyra_lok.cpp')
-rw-r--r-- | engines/kyra/kyra_lok.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index 2ce8af4a81..3d228210b9 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -26,6 +26,7 @@ #include "kyra/kyra_lok.h" #include "common/file.h" +#include "common/events.h" #include "common/system.h" #include "common/savefile.h" @@ -118,12 +119,8 @@ KyraEngine_LoK::~KyraEngine_LoK() { delete[] _characterList; - delete[] _roomTable; - delete[] _movFacingTable; - delete[] _defaultShapeTable; - delete[] _gui->_scrollUpButton.data0ShapePtr; delete[] _gui->_scrollUpButton.data1ShapePtr; delete[] _gui->_scrollUpButton.data2ShapePtr; @@ -303,8 +300,8 @@ int KyraEngine_LoK::go() { if (_gameToLoad == -1) { setGameFlag(0xEF); seq_intro(); - if (quit()) - return _eventMan->shouldRTL(); + if (_quitFlag) + return 0; if (_skipIntroFlag && _abortIntroFlag) resetGameFlag(0xEF); } @@ -312,7 +309,7 @@ int KyraEngine_LoK::go() { resetGameFlag(0xEF); mainLoop(); } - return _eventMan->shouldRTL(); + return 0; } @@ -391,7 +388,7 @@ void KyraEngine_LoK::startup() { _gui->buttonMenuCallback(0); _menuDirectlyToLoad = false; } else - saveGame(getSavegameFilename(0), "New game"); + saveGame(getSavegameFilename(0), "New game", 0); } else { _screen->setFont(Screen::FID_8_FNT); loadGame(getSavegameFilename(_gameToLoad)); @@ -402,7 +399,7 @@ void KyraEngine_LoK::startup() { void KyraEngine_LoK::mainLoop() { debugC(9, kDebugLevelMain, "KyraEngine_LoK::mainLoop()"); - while (!quit()) { + while (!_quitFlag) { int32 frameTime = (int32)_system->getMillis(); _skipFlag = false; @@ -447,7 +444,7 @@ void KyraEngine_LoK::mainLoop() { } void KyraEngine_LoK::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) { - while (_system->getMillis() < timestamp && !quit()) { + while (_system->getMillis() < timestamp && !_quitFlag) { if (updateTimers) _timer->update(); @@ -473,13 +470,13 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { else { char savegameName[14]; sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0'); - saveGame(saveLoadSlot, savegameName); + saveGame(saveLoadSlot, savegameName, 0); } } else if (event.kbd.flags == Common::KBD_CTRL) { if (event.kbd.keycode == 'd') _debugger->attach(); else if (event.kbd.keycode == 'q') - quitGame(); + _quitFlag = true; } else if (event.kbd.keycode == '.') { _skipFlag = true; } else if (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_SPACE || event.kbd.keycode == Common::KEYCODE_ESCAPE) { @@ -491,6 +488,9 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { case Common::EVENT_MOUSEMOVE: _animator->_updateScreen = true; break; + case Common::EVENT_QUIT: + quitGame(); + break; case Common::EVENT_LBUTTONDOWN: _mousePressFlag = true; break; @@ -529,24 +529,27 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE)) _skipFlag = false; - if (amount > 0 && !_skipFlag && !quit()) + if (amount > 0 && !_skipFlag && !_quitFlag) _system->delayMillis(10); if (_skipFlag) _sound->voiceStop(); - } while (!_skipFlag && _system->getMillis() < start + amount && !quit()); + } while (!_skipFlag && _system->getMillis() < start + amount && !_quitFlag); } void KyraEngine_LoK::waitForEvent() { bool finished = false; Common::Event event; - while (!finished && !quit()) { + while (!finished && !_quitFlag) { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: finished = true; break; + case Common::EVENT_QUIT: + quitGame(); + break; case Common::EVENT_LBUTTONDOWN: finished = true; _skipFlag = true; |