diff options
author | Max Horn | 2008-09-01 17:52:50 +0000 |
---|---|---|
committer | Max Horn | 2008-09-01 17:52:50 +0000 |
commit | 91df44f8f6448e9adad901cd675926335d84b9db (patch) | |
tree | 72149b8d7b8702a546f455132b7a320c8eb3539d | |
parent | 7953312bc666a32ba274e4e2e1fc513a5e36762c (diff) | |
parent | 852bc9dbb750b9995d31e70f4158c97d3758c46f (diff) | |
download | scummvm-rg350-91df44f8f6448e9adad901cd675926335d84b9db.tar.gz scummvm-rg350-91df44f8f6448e9adad901cd675926335d84b9db.tar.bz2 scummvm-rg350-91df44f8f6448e9adad901cd675926335d84b9db.zip |
Merging more of the GSoC 2008 RTL branch: KYRA
svn-id: r34246
-rw-r--r-- | engines/kyra/detection.cpp | 14 | ||||
-rw-r--r-- | engines/kyra/gui.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/gui_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/gui_lok.cpp | 16 | ||||
-rw-r--r-- | engines/kyra/gui_mr.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/gui_v2.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/kyra_hof.cpp | 9 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.cpp | 29 | ||||
-rw-r--r-- | engines/kyra/kyra_mr.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 9 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 5 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 36 | ||||
-rw-r--r-- | engines/kyra/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/saveload_lok.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/scene_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/scene_mr.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/script_mr.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/sequences_hof.cpp | 22 | ||||
-rw-r--r-- | engines/kyra/sequences_lok.cpp | 17 | ||||
-rw-r--r-- | engines/kyra/sprites.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/text.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/text_hof.cpp | 12 | ||||
-rw-r--r-- | engines/kyra/text_lok.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/text_mr.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/vqa.cpp | 3 |
27 files changed, 103 insertions, 125 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 47bdbbb559..e3006f3180 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -1064,11 +1064,19 @@ public: return "The Legend of Kyrandia (C) Westwood Studios"; } - bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; - - SaveStateList listSaves(const char *target) const; + virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; + virtual SaveStateList listSaves(const char *target) const; }; +bool KyraMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsListSaves) || + (f == kSupportsDirectLoad) || + (f == kSupportsDeleteSave); +} + bool KyraMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { const KYRAGameDescription *gd = (const KYRAGameDescription *)desc; bool res = true; diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index 96ea233025..8a5a4dfc91 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -378,9 +378,6 @@ bool MainMenu::getInput() { while (_system->getEventManager()->pollEvent(event)) { switch (event.type) { - case Common::EVENT_QUIT: - _vm->quitGame(); - break; case Common::EVENT_LBUTTONUP: return true; default: diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp index fb2aa24e1e..0d7b4d973d 100644 --- a/engines/kyra/gui_hof.cpp +++ b/engines/kyra/gui_hof.cpp @@ -514,7 +514,7 @@ void KyraEngine_HoF::bookLoop() { showBookPage(); _bookShown = true; - while (_bookShown && !_quitFlag) { + while (_bookShown && !quit()) { checkInput(buttonList); removeInputTop(); diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index ca1c94e215..4d13512751 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -34,7 +34,6 @@ #include "common/config-manager.h" #include "common/savefile.h" -#include "common/events.h" #include "common/system.h" #include "graphics/scaler.h" @@ -471,7 +470,7 @@ int GUI_LoK::buttonMenuCallback(Button *caller) { updateAllMenuButtons(); } - while (_displayMenu && !_vm->_quitFlag) { + while (_displayMenu && !_vm->quit()) { Common::Point mouse = _vm->getMousePos(); processHighlights(_menu[_toplevelMenu], mouse.x, mouse.y); processButtonList(_menuButtonList, 0, 0); @@ -496,9 +495,6 @@ void GUI_LoK::getInput() { _mouseWheel = 0; while (_vm->_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_QUIT: - _vm->quitGame(); - break; case Common::EVENT_LBUTTONDOWN: _vm->_mousePressFlag = true; break; @@ -594,7 +590,7 @@ int GUI_LoK::saveGameMenu(Button *button) { _displaySubMenu = true; _cancelSubMenu = false; - while (_displaySubMenu && !_vm->_quitFlag) { + while (_displaySubMenu && !_vm->quit()) { getInput(); Common::Point mouse = _vm->getMousePos(); processHighlights(_menu[2], mouse.x, mouse.y); @@ -643,7 +639,7 @@ int GUI_LoK::loadGameMenu(Button *button) { _vm->_gameToLoad = -1; - while (_displaySubMenu && !_vm->_quitFlag) { + while (_displaySubMenu && !_vm->quit()) { getInput(); Common::Point mouse = _vm->getMousePos(); processHighlights(_menu[2], mouse.x, mouse.y); @@ -731,7 +727,7 @@ int GUI_LoK::saveGame(Button *button) { } redrawTextfield(); - while (_displaySubMenu && !_vm->_quitFlag) { + while (_displaySubMenu && !_vm->quit()) { getInput(); updateSavegameString(); Common::Point mouse = _vm->getMousePos(); @@ -811,7 +807,7 @@ bool GUI_LoK::quitConfirm(const char *str) { _displaySubMenu = true; _cancelSubMenu = true; - while (_displaySubMenu && !_vm->_quitFlag) { + while (_displaySubMenu && !_vm->quit()) { getInput(); Common::Point mouse = _vm->getMousePos(); processHighlights(_menu[1], mouse.x, mouse.y); @@ -877,7 +873,7 @@ int GUI_LoK::gameControlsMenu(Button *button) { _displaySubMenu = true; _cancelSubMenu = false; - while (_displaySubMenu && !_vm->_quitFlag) { + while (_displaySubMenu && !_vm->quit()) { getInput(); Common::Point mouse = _vm->getMousePos(); processHighlights(_menu[5], mouse.x, mouse.y); diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp index 7a84d7093a..11e6f6f1f4 100644 --- a/engines/kyra/gui_mr.cpp +++ b/engines/kyra/gui_mr.cpp @@ -870,7 +870,7 @@ void KyraEngine_MR::processAlbum() { albumNewPage(); _album.running = true; - while (_album.running && !_quitFlag) { + while (_album.running && !quit()) { updateInput(); checkInput(buttonList); removeInputTop(); diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 2ef1109183..077e49ebcf 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -832,13 +832,9 @@ void GUI_v2::checkTextfieldInput() { int keys = 0; while (_vm->_eventMan->pollEvent(event) && running) { switch (event.type) { - case Common::EVENT_QUIT: - _vm->_quitFlag = true; - break; - case Common::EVENT_KEYDOWN: if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) - _vm->_quitFlag = true; + _vm->quitGame(); else _keyPressed = event.kbd; running = false; diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 2f8f2674e4..086d8d6913 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -325,7 +325,7 @@ int KyraEngine_HoF::go() { seq_playSequences(kSequenceFunters, kSequenceFrash); } - return 0; + return _eventMan->shouldRTL(); } void KyraEngine_HoF::startup() { @@ -454,9 +454,8 @@ void KyraEngine_HoF::startup() { void KyraEngine_HoF::runLoop() { _screen->updateScreen(); - _quitFlag = false; _runFlag = true; - while (!_quitFlag && _runFlag) { + while (!quit() && _runFlag) { if (_deathHandler >= 0) { removeHandItem(); delay(5); @@ -1626,7 +1625,7 @@ void KyraEngine_HoF::loadInvWsa(const char *filename, int run, int delayTime, in _invWsa.timer = _system->getMillis(); if (run) { - while (_invWsa.running && !skipFlag() && !_quitFlag) { + while (_invWsa.running && !skipFlag() && !quit()) { update(); _system->delayMillis(10); } @@ -2000,7 +1999,7 @@ void KyraEngine_HoF::playTim(const char *filename) { return; _tim->resetFinishedFlag(); - while (!_quitFlag && !_tim->finished()) { + while (!quit() && !_tim->finished()) { _tim->exec(tim, 0); if (_chatText) updateWithText(); diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index 3d228210b9..b6c874339c 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -26,7 +26,6 @@ #include "kyra/kyra_lok.h" #include "common/file.h" -#include "common/events.h" #include "common/system.h" #include "common/savefile.h" @@ -119,8 +118,12 @@ KyraEngine_LoK::~KyraEngine_LoK() { delete[] _characterList; + delete[] _roomTable; + delete[] _movFacingTable; + delete[] _defaultShapeTable; + delete[] _gui->_scrollUpButton.data0ShapePtr; delete[] _gui->_scrollUpButton.data1ShapePtr; delete[] _gui->_scrollUpButton.data2ShapePtr; @@ -300,8 +303,8 @@ int KyraEngine_LoK::go() { if (_gameToLoad == -1) { setGameFlag(0xEF); seq_intro(); - if (_quitFlag) - return 0; + if (quit()) + return _eventMan->shouldRTL(); if (_skipIntroFlag && _abortIntroFlag) resetGameFlag(0xEF); } @@ -309,7 +312,7 @@ int KyraEngine_LoK::go() { resetGameFlag(0xEF); mainLoop(); } - return 0; + return _eventMan->shouldRTL(); } @@ -399,7 +402,7 @@ void KyraEngine_LoK::startup() { void KyraEngine_LoK::mainLoop() { debugC(9, kDebugLevelMain, "KyraEngine_LoK::mainLoop()"); - while (!_quitFlag) { + while (!quit()) { int32 frameTime = (int32)_system->getMillis(); _skipFlag = false; @@ -444,7 +447,7 @@ void KyraEngine_LoK::mainLoop() { } void KyraEngine_LoK::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) { - while (_system->getMillis() < timestamp && !_quitFlag) { + while (_system->getMillis() < timestamp && !quit()) { if (updateTimers) _timer->update(); @@ -476,7 +479,7 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { if (event.kbd.keycode == 'd') _debugger->attach(); else if (event.kbd.keycode == 'q') - _quitFlag = true; + quitGame(); } 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) { @@ -488,9 +491,6 @@ 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,27 +529,24 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE)) _skipFlag = false; - if (amount > 0 && !_skipFlag && !_quitFlag) + if (amount > 0 && !_skipFlag && !quit()) _system->delayMillis(10); if (_skipFlag) _sound->voiceStop(); - } while (!_skipFlag && _system->getMillis() < start + amount && !_quitFlag); + } while (!_skipFlag && _system->getMillis() < start + amount && !quit()); } void KyraEngine_LoK::waitForEvent() { bool finished = false; Common::Event event; - while (!finished && !_quitFlag) { + while (!finished && !quit()) { 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; diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index 9b9549b778..5bc843d8a8 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -263,7 +263,7 @@ int KyraEngine_MR::go() { running = false; } - while (running && !_quitFlag) { + while (running && !quit()) { _screen->_curPage = 0; _screen->clearPage(0); @@ -272,14 +272,14 @@ int KyraEngine_MR::go() { // XXX playMenuAudioFile(); - for (int i = 0; i < 64 && !_quitFlag; ++i) { + for (int i = 0; i < 64 && !quit(); ++i) { uint32 nextRun = _system->getMillis() + 3 * _tickLength; _menuAnim->displayFrame(i, 0); _screen->updateScreen(); delayUntil(nextRun); } - for (int i = 64; i > 29 && !_quitFlag; --i) { + for (int i = 64; i > 29 && !quit(); --i) { uint32 nextRun = _system->getMillis() + 3 * _tickLength; _menuAnim->displayFrame(i, 0); _screen->updateScreen(); @@ -324,7 +324,7 @@ int KyraEngine_MR::go() { if (_showOutro) playVQA("CREDITS"); - return 0; + return _eventMan->shouldRTL(); } void KyraEngine_MR::initMainMenu() { @@ -1001,7 +1001,7 @@ void KyraEngine_MR::runLoop() { _eventList.clear(); _runFlag = true; - while (_runFlag && !_quitFlag) { + while (_runFlag && !quit()) { if (_deathHandler >= 0) { removeHandItem(); delay(5); diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index bc46d8e1f5..f3014911fc 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -52,8 +52,6 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) _gameSpeed = 60; _tickLength = (uint8)(1000.0 / _gameSpeed); - _quitFlag = false; - _speechFile = ""; _trackMap = 0; _trackMapSize = 0; @@ -202,7 +200,10 @@ KyraEngine_v1::~KyraEngine_v1() { void KyraEngine_v1::quitGame() { debugC(9, kDebugLevelMain, "KyraEngine_v1::quitGame()"); - _quitFlag = true; + Common::Event event; + + event.type = Common::EVENT_QUIT; + _eventMan->pushEvent(event); // Nothing to do here } @@ -240,7 +241,7 @@ int KyraEngine_v1::resetGameFlag(int flag) { } void KyraEngine_v1::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) { - while (_system->getMillis() < timestamp && !_quitFlag) { + while (_system->getMillis() < timestamp && !quit()) { if (timestamp - _system->getMillis() >= 10) delay(10, update, isMainLoop); } diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 438d625503..761724fa2f 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -118,8 +118,6 @@ public: virtual void pauseEngineIntern(bool pause); - bool quit() const { return _quitFlag; } - uint8 game() const { return _flags.gameID; } const GameFlags &gameFlags() const { return _flags; } @@ -178,9 +176,6 @@ protected: virtual int go() = 0; virtual int init(); - // quit Handling - bool _quitFlag; - // intern Resource *_res; Sound *_sound; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 4e1bf38991..e9ed91b539 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -159,7 +159,7 @@ void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) { if (amount > 0) _system->delayMillis(amount > 10 ? 10 : amount); - } while (!skipFlag() && _system->getMillis() < start + amount && !_quitFlag); + } while (!skipFlag() && _system->getMillis() < start + amount && !quit()); } int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) { @@ -238,15 +238,11 @@ void KyraEngine_v2::updateInput() { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_QUIT: - _quitFlag = true; - break; - case Common::EVENT_KEYDOWN: if (event.kbd.keycode == '.' || event.kbd.keycode == Common::KEYCODE_ESCAPE) _eventList.push_back(Event(event, true)); else if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) - _quitFlag = true; + quitGame(); else _eventList.push_back(event); break; diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 6624dd91ea..b9cb7bcc0b 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -183,15 +183,11 @@ void LoLEngine::updateInput() { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_QUIT: - _quitFlag = true; - break; - case Common::EVENT_KEYDOWN: if (event.kbd.keycode == '.' || event.kbd.keycode == Common::KEYCODE_ESCAPE) _eventList.push_back(Event(event, true)); else if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) - _quitFlag = true; + quitGame(); else _eventList.push_back(event); break; @@ -307,7 +303,7 @@ void LoLEngine::showIntro() { _screen->hideMouse(); uint32 palNextFadeStep = 0; - while (!_tim->finished() && !_quitFlag && !skipFlag()) { + while (!_tim->finished() && !quit() && !skipFlag()) { updateInput(); _tim->exec(intro, false); _screen->checkedPageUpdate(8, 4); @@ -385,14 +381,14 @@ int LoLEngine::chooseCharacter() { _screen->fadePalette(_screen->getPalette(0), 30, 0); bool kingIntro = true; - while (!_quitFlag) { + while (!quit()) { if (kingIntro) kingSelectionIntro(); if (_charSelection < 0) processCharacterSelection(); - if (_quitFlag) + if (quit()) break; if (_charSelection == 100) { @@ -413,11 +409,11 @@ int LoLEngine::chooseCharacter() { } } - if (_quitFlag) + if (quit()) return -1; uint32 waitTime = _system->getMillis() + 420 * _tickLength; - while (waitTime > _system->getMillis() && !skipFlag() && !_quitFlag) { + while (waitTime > _system->getMillis() && !skipFlag() && !quit()) { updateInput(); _system->delayMillis(10); } @@ -449,7 +445,7 @@ void LoLEngine::kingSelectionIntro() { _chargenWSA->setDrawPage(0); int index = 4; - while (_sound->voiceIsPlaying("KING01") && _charSelection == -1 && !_quitFlag && !skipFlag()) { + while (_sound->voiceIsPlaying("KING01") && _charSelection == -1 && !quit() && !skipFlag()) { index = MAX(index, 4); _chargenWSA->displayFrame(_chargenFrameTable[index], 0, 0, 0); @@ -460,7 +456,7 @@ void LoLEngine::kingSelectionIntro() { _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 7 * _tickLength; - while (waitEnd > _system->getMillis() && _charSelection == -1 && !_quitFlag && !skipFlag()) { + while (waitEnd > _system->getMillis() && _charSelection == -1 && !quit() && !skipFlag()) { _charSelection = getCharSelection(); _system->delayMillis(10); } @@ -491,7 +487,7 @@ void LoLEngine::kingSelectionReminder() { _chargenWSA->setDrawPage(0); int index = 0; - while (_sound->voiceIsPlaying("KING02") && _charSelection == -1 && !_quitFlag && index < 15) { + while (_sound->voiceIsPlaying("KING02") && _charSelection == -1 && !quit() && index < 15) { _chargenWSA->displayFrame(_chargenFrameTable[index+9], 0, 0, 0); _screen->copyRegion(_selectionPosTable[_reminderChar1IdxTable[index]*2+0], _selectionPosTable[_reminderChar1IdxTable[index]*2+1], _charPreviews[0].x, _charPreviews[0].y, 32, 32, 4, 0); _screen->copyRegion(_selectionPosTable[_reminderChar2IdxTable[index]*2+0], _selectionPosTable[_reminderChar2IdxTable[index]*2+1], _charPreviews[1].x, _charPreviews[1].y, 32, 32, 4, 0); @@ -500,7 +496,7 @@ void LoLEngine::kingSelectionReminder() { _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 8 * _tickLength; - while (waitEnd > _system->getMillis() && !_quitFlag) { + while (waitEnd > _system->getMillis() && !quit()) { _charSelection = getCharSelection(); _system->delayMillis(10); } @@ -521,14 +517,14 @@ void LoLEngine::kingSelectionOutro() { _chargenWSA->setDrawPage(0); int index = 0; - while (_sound->voiceIsPlaying("KING03") && !_quitFlag && !skipFlag()) { + while (_sound->voiceIsPlaying("KING03") && !quit() && !skipFlag()) { index = MAX(index, 4); _chargenWSA->displayFrame(_chargenFrameTable[index], 0, 0, 0); _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 8 * _tickLength; - while (waitEnd > _system->getMillis() && !_quitFlag && !skipFlag()) { + while (waitEnd > _system->getMillis() && !quit() && !skipFlag()) { updateInput(); _system->delayMillis(10); } @@ -547,10 +543,10 @@ void LoLEngine::processCharacterSelection() { debugC(9, kDebugLevelMain, "LoLEngine::processCharacterSelection()"); _charSelection = -1; - while (!_quitFlag && _charSelection == -1) { + while (!quit() && _charSelection == -1) { uint32 nextKingMessage = _system->getMillis() + 900 * _tickLength; - while (nextKingMessage > _system->getMillis() && _charSelection == -1 && !_quitFlag) { + while (nextKingMessage > _system->getMillis() && _charSelection == -1 && !quit()) { updateSelectionAnims(); _charSelection = getCharSelection(); _system->delayMillis(10); @@ -669,12 +665,12 @@ void LoLEngine::selectionCharInfoIntro(char *file) { int index = 0; file[4] = '0'; - while (_charSelectionInfoResult == -1 && !_quitFlag) { + while (_charSelectionInfoResult == -1 && !quit()) { if (!_sound->voicePlay(file)) break; int i = 0; - while (_sound->voiceIsPlaying(file) && _charSelectionInfoResult == -1 && !_quitFlag) { + while (_sound->voiceIsPlaying(file) && _charSelectionInfoResult == -1 && !quit()) { _screen->drawShape(0, _screen->getPtrToShape(_screen->getCPagePtr(9), _charInfoFrameTable[i]), 11, 130, 0, 0); _screen->updateScreen(); diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index debf0623ac..da0fd731da 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -178,7 +178,7 @@ Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filena Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const { debugC(9, kDebugLevelMain, "KyraEngine_v1::openSaveForWriting('%s', '%s', %p)", filename, saveName, (const void *)thumbnail); - if (_quitFlag) + if (quit()) return 0; Common::WriteStream *out = 0; diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp index f734ffd5d9..257d762ce8 100644 --- a/engines/kyra/saveload_lok.cpp +++ b/engines/kyra/saveload_lok.cpp @@ -221,7 +221,7 @@ void KyraEngine_LoK::loadGame(const char *fileName) { void KyraEngine_LoK::saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumb) { debugC(9, kDebugLevelMain, "KyraEngine_LoK::saveGame('%s', '%s', %p)", fileName, saveName, (const void *)thumb); - if (_quitFlag) + if (quit()) return; Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp index 62df683ea2..08df7b064e 100644 --- a/engines/kyra/scene_hof.cpp +++ b/engines/kyra/scene_hof.cpp @@ -277,7 +277,7 @@ int KyraEngine_HoF::trySceneChange(int *moveTable, int unk1, int updateChar) { int changedScene = 0; const int *moveTableStart = moveTable; _unk4 = 0; - while (running && !_quitFlag) { + while (running && !quit()) { if (*moveTable >= 0 && *moveTable <= 7) { _mainCharacter.facing = getOppositeFacingDirection(*moveTable); unkFlag = true; diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index 53c0cb5380..ad4ce63b6c 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -654,7 +654,7 @@ int KyraEngine_MR::trySceneChange(int *moveTable, int unk1, int updateChar) { const int *moveTableStart = moveTable; _unk4 = 0; - while (running && !_quitFlag) { + while (running && !quit()) { if (*moveTable >= 0 && *moveTable <= 7) { _mainCharacter.facing = getOppositeFacingDirection(*moveTable); unkFlag = true; diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp index cf2d2aceb1..dad870a5f4 100644 --- a/engines/kyra/script_mr.cpp +++ b/engines/kyra/script_mr.cpp @@ -786,7 +786,7 @@ int KyraEngine_MR::o3_daggerWarning(EMCState *script) { _screen->_curPage = curPageBackUp; _screen->showMouse(); - while (!_quitFlag) { + while (!quit()) { int keys = checkInput(0); removeInputTop(); diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 3cd319fe77..7915a33996 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -75,7 +75,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _seqEndTime = 0; _menuChoice = 0; - for (int seqNum = startSeq; seqNum <= endSeq && !((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice); seqNum++) { + for (int seqNum = startSeq; seqNum <= endSeq && !((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice); seqNum++) { _screen->clearPage(0); _screen->clearPage(8); memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300); @@ -131,7 +131,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { seq_sequenceCommand(cseq.startupCommand); - if (!((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { + if (!((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice)) { _screen->copyPage(2, 0); _screen->updateScreen(); } @@ -165,7 +165,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _seqWsaCurrentFrame = cseq.startFrame; bool loop = true; - while (loop && !((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { + while (loop && !((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice)) { _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; if (_seqWsa || !cb) @@ -189,16 +189,16 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { seq_processWSAs(); seq_processText(); - if ((_seqWsa || !cb) && !((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { + if ((_seqWsa || !cb) && !((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice)) { _screen->copyPage(2, 0); _screen->updateScreen(); } bool loop2 = true; - while (loop2 && !((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { + while (loop2 && !((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice)) { if (_seqWsa) { seq_processText(); - if (!((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { + if (!((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice)) { _screen->copyPage(2, 0); _screen->updateScreen(); } @@ -230,7 +230,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { } else { _seqFrameDelay = cseq.frameDelay; _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; - while (!((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { + while (!((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice)) { _seqSubFrameStartTime = _system->getMillis(); seq_processWSAs(); if (cb) @@ -262,7 +262,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { dl = ct; _seqEndTime = _system->getMillis() + dl; - while (!((skipFlag() && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { + while (!((skipFlag() && allowSkip) || quit() || (_abortIntroFlag && allowSkip) || _menuChoice)) { _seqSubFrameStartTime = _system->getMillis(); seq_processWSAs(); @@ -2267,7 +2267,7 @@ void KyraEngine_HoF::seq_loadNestedSequence(int wsaNum, int seqNum) { void KyraEngine_HoF::seq_nestedSequenceFrame(int command, int wsaNum) { int xa = 0, ya = 0; command--; - if (!_activeWSA[wsaNum].movie || skipFlag() || _quitFlag || _abortIntroFlag) + if (!_activeWSA[wsaNum].movie || skipFlag() || quit() || _abortIntroFlag) return; switch (command) { @@ -2467,7 +2467,7 @@ bool KyraEngine_HoF::seq_processNextSubFrame(int wsaNum) { void KyraEngine_HoF::seq_printCreditsString(uint16 strIndex, int x, int y, const uint8 *colorMap, uint8 textcolor) { uint8 colormap[16]; - if (skipFlag() || _quitFlag || _abortIntroFlag || _menuChoice) + if (skipFlag() || quit() || _abortIntroFlag || _menuChoice) return; memset(&_screen->getPalette(0)[0x2fa], 0x3f, 6); @@ -2957,7 +2957,7 @@ void KyraEngine_HoF::seq_makeBookAppear() { ++_invWsa.curFrame; - if (_invWsa.curFrame >= _invWsa.lastFrame && !_quitFlag) + if (_invWsa.curFrame >= _invWsa.lastFrame && !quit()) break; switch (_invWsa.curFrame) { diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index 3a497a258f..77cfbed2d0 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -34,7 +34,6 @@ #include "kyra/text.h" #include "kyra/timer.h" -#include "common/events.h" #include "common/system.h" #include "common/savefile.h" @@ -164,7 +163,7 @@ void KyraEngine_LoK::seq_introLogos() { _screen->updateScreen(); _screen->fadeFromBlack(); - if (_seq->playSequence(_seq_WestwoodLogo, _skipFlag) || _quitFlag) { + if (_seq->playSequence(_seq_WestwoodLogo, _skipFlag) || quit()) { _screen->fadeToBlack(); _screen->clearPage(0); return; @@ -176,14 +175,14 @@ void KyraEngine_LoK::seq_introLogos() { _screen->setScreenPalette(_screen->_currentPalette); } - if ((_seq->playSequence(_seq_KyrandiaLogo, _skipFlag) && !seq_skipSequence()) || _quitFlag) { + if ((_seq->playSequence(_seq_KyrandiaLogo, _skipFlag) && !seq_skipSequence()) || quit()) { _screen->fadeToBlack(); _screen->clearPage(0); return; } _screen->fillRect(0, 179, 319, 199, 0); - if (_quitFlag) + if (quit()) return; if (_flags.platform == Common::kPlatformAmiga) { @@ -223,10 +222,10 @@ void KyraEngine_LoK::seq_introLogos() { oldDistance = distance; delay(10); - } while (!doneFlag && !_quitFlag && !_abortIntroFlag); + } while (!doneFlag && !quit() && !_abortIntroFlag); } - if (_quitFlag) + if (quit()) return; _seq->playSequence(_seq_Forest, true); @@ -1030,7 +1029,7 @@ void KyraEngine_LoK::seq_brandonToStone() { void KyraEngine_LoK::seq_playEnding() { debugC(9, kDebugLevelMain, "KyraEngine_LoK::seq_playEnding()"); - if (_quitFlag) + if (quit()) return; _screen->hideMouse(); _screen->_curPage = 0; @@ -1186,8 +1185,8 @@ void KyraEngine_LoK::seq_playCredits() { case Common::EVENT_KEYDOWN: finished = true; break; + case Common::EVENT_RTL: case Common::EVENT_QUIT: - quitGame(); finished = true; break; default: @@ -1211,7 +1210,7 @@ void KyraEngine_LoK::seq_playCredits() { bool KyraEngine_LoK::seq_skipSequence() const { debugC(9, kDebugLevelMain, "KyraEngine_LoK::seq_skipSequence()"); - return _quitFlag || _abortIntroFlag; + return quit() || _abortIntroFlag; } int KyraEngine_LoK::handleMalcolmFlag() { diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp index 34c2986f25..05074d20b1 100644 --- a/engines/kyra/sprites.cpp +++ b/engines/kyra/sprites.cpp @@ -28,7 +28,6 @@ #include "common/stream.h" #include "common/util.h" #include "common/system.h" -#include "common/events.h" #include "kyra/screen.h" #include "kyra/kyra_lok.h" #include "kyra/sprites.h" diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 7464df049a..9156fa7e9c 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -920,6 +920,7 @@ void StaticResource::freePaletteTable(void *&ptr, int &size) { uint8 **data = (uint8**)ptr; while (size--) delete[] data[size]; + delete[] data; ptr = 0; size = 0; } diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp index f8eb10a85e..eecb617942 100644 --- a/engines/kyra/text.cpp +++ b/engines/kyra/text.cpp @@ -29,7 +29,6 @@ #include "kyra/screen.h" #include "kyra/text.h" -#include "common/events.h" #include "common/system.h" #include "common/endian.h" diff --git a/engines/kyra/text_hof.cpp b/engines/kyra/text_hof.cpp index dd587c5112..b94b8a6258 100644 --- a/engines/kyra/text_hof.cpp +++ b/engines/kyra/text_hof.cpp @@ -335,7 +335,7 @@ void KyraEngine_HoF::objectChatWaitToFinish() { const uint32 endTime = _chatEndTime; resetSkipFlag(); - while (running && !_quitFlag) { + while (running && !quit()) { if (!_emc->isValid(&_chatScriptState)) _emc->start(&_chatScriptState, 1); @@ -353,7 +353,7 @@ void KyraEngine_HoF::objectChatWaitToFinish() { uint32 nextFrame = _system->getMillis() + delayTime * _tickLength; - while (_system->getMillis() < nextFrame && !_quitFlag) { + while (_system->getMillis() < nextFrame && !quit()) { updateWithText(); const uint32 curTime = _system->getMillis(); @@ -593,7 +593,7 @@ void KyraEngine_HoF::initTalkObject(int index) { if (_currentTalkSections.STATim) { _tim->resetFinishedFlag(); - while (!_quitFlag && !_tim->finished()) { + while (!quit() && !_tim->finished()) { _tim->exec(_currentTalkSections.STATim, false); if (_chatText) updateWithText(); @@ -609,7 +609,7 @@ void KyraEngine_HoF::deinitTalkObject(int index) { if (_currentTalkSections.ENDTim) { _tim->resetFinishedFlag(); - while (!_quitFlag && !_tim->finished()) { + while (!quit() && !_tim->finished()) { _tim->exec(_currentTalkSections.ENDTim, false); if (_chatText) updateWithText(); @@ -647,10 +647,10 @@ void KyraEngine_HoF::npcChatSequence(const char *str, int objectId, int vocHigh, _chatVocHigh = _chatVocLow = -1; } - while (((textEnabled() && _chatEndTime > _system->getMillis()) || (speechEnabled() && snd_voiceIsPlaying())) && !(_quitFlag || skipFlag())) { + while (((textEnabled() && _chatEndTime > _system->getMillis()) || (speechEnabled() && snd_voiceIsPlaying())) && !(quit() || skipFlag())) { if ((!speechEnabled() && chatAnimEndTime > _system->getMillis()) || (speechEnabled() && snd_voiceIsPlaying())) { _tim->resetFinishedFlag(); - while (!_tim->finished() && !skipFlag() && !_quitFlag) { + while (!_tim->finished() && !skipFlag() && !quit()) { if (_currentTalkSections.TLKTim) _tim->exec(_currentTalkSections.TLKTim, false); else diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp index f6b0407a75..150ec59a23 100644 --- a/engines/kyra/text_lok.cpp +++ b/engines/kyra/text_lok.cpp @@ -120,8 +120,8 @@ void KyraEngine_LoK::waitForChatToFinish(int vocFile, int16 chatDuration, const if (event.kbd.keycode == '.') _skipFlag = true; break; + case Common::EVENT_RTL: case Common::EVENT_QUIT: - quitGame(); runLoop = false; break; case Common::EVENT_LBUTTONDOWN: diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp index 16c56da099..be306ceec1 100644 --- a/engines/kyra/text_mr.cpp +++ b/engines/kyra/text_mr.cpp @@ -349,7 +349,7 @@ void KyraEngine_MR::objectChatWaitToFinish() { const uint32 endTime = _chatEndTime; resetSkipFlag(); - while (running && !_quitFlag) { + while (running && !quit()) { if (!_emc->isValid(&_chatScriptState)) _emc->start(&_chatScriptState, 1); @@ -367,7 +367,7 @@ void KyraEngine_MR::objectChatWaitToFinish() { uint32 nextFrame = _system->getMillis() + delayTime * _tickLength; - while (_system->getMillis() < nextFrame && !_quitFlag) { + while (_system->getMillis() < nextFrame && !quit()) { updateWithText(); const uint32 curTime = _system->getMillis(); @@ -419,7 +419,7 @@ void KyraEngine_MR::badConscienceChatWaitToFinish() { uint32 nextFrame = _system->getMillis() + _rnd.getRandomNumberRng(4, 8) * _tickLength; int frame = _badConscienceFrameTable[_badConscienceAnim+24]; - while (running && !_quitFlag) { + while (running && !quit()) { if (nextFrame < _system->getMillis()) { ++frame; if (_badConscienceFrameTable[_badConscienceAnim+32] < frame) @@ -477,7 +477,7 @@ void KyraEngine_MR::goodConscienceChatWaitToFinish() { uint32 nextFrame = _system->getMillis() + _rnd.getRandomNumberRng(3, 6) * _tickLength; int frame = _goodConscienceFrameTable[_goodConscienceAnim+15]; - while (running && !_quitFlag) { + while (running && !quit()) { if (nextFrame < _system->getMillis()) { ++frame; if (_goodConscienceFrameTable[_goodConscienceAnim+20] < frame) @@ -597,7 +597,7 @@ void KyraEngine_MR::albumChatWaitToFinish() { uint32 nextFrame = 0; int frame = 12; - while (running && !_quitFlag) { + while (running && !quit()) { if (nextFrame < _system->getMillis()) { ++frame; if (frame > 22) diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index 3d18f27c7e..c55c573ea3 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -32,7 +32,6 @@ // The jung2.vqa movie does work, but only thanks to a grotesque hack. -#include "common/events.h" #include "common/system.h" #include "sound/audiostream.h" #include "sound/mixer.h" @@ -671,8 +670,8 @@ void VQAMovie::play() { if (event.kbd.ascii == 27) return; break; + case Common::EVENT_RTL: case Common::EVENT_QUIT: - _vm->quitGame(); return; default: break; |