diff options
Diffstat (limited to 'engines/kyra/lol.cpp')
-rw-r--r-- | engines/kyra/lol.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index b9cb7bcc0b..6624dd91ea 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -183,11 +183,15 @@ 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) - quitGame(); + _quitFlag = true; else _eventList.push_back(event); break; @@ -303,7 +307,7 @@ void LoLEngine::showIntro() { _screen->hideMouse(); uint32 palNextFadeStep = 0; - while (!_tim->finished() && !quit() && !skipFlag()) { + while (!_tim->finished() && !_quitFlag && !skipFlag()) { updateInput(); _tim->exec(intro, false); _screen->checkedPageUpdate(8, 4); @@ -381,14 +385,14 @@ int LoLEngine::chooseCharacter() { _screen->fadePalette(_screen->getPalette(0), 30, 0); bool kingIntro = true; - while (!quit()) { + while (!_quitFlag) { if (kingIntro) kingSelectionIntro(); if (_charSelection < 0) processCharacterSelection(); - if (quit()) + if (_quitFlag) break; if (_charSelection == 100) { @@ -409,11 +413,11 @@ int LoLEngine::chooseCharacter() { } } - if (quit()) + if (_quitFlag) return -1; uint32 waitTime = _system->getMillis() + 420 * _tickLength; - while (waitTime > _system->getMillis() && !skipFlag() && !quit()) { + while (waitTime > _system->getMillis() && !skipFlag() && !_quitFlag) { updateInput(); _system->delayMillis(10); } @@ -445,7 +449,7 @@ void LoLEngine::kingSelectionIntro() { _chargenWSA->setDrawPage(0); int index = 4; - while (_sound->voiceIsPlaying("KING01") && _charSelection == -1 && !quit() && !skipFlag()) { + while (_sound->voiceIsPlaying("KING01") && _charSelection == -1 && !_quitFlag && !skipFlag()) { index = MAX(index, 4); _chargenWSA->displayFrame(_chargenFrameTable[index], 0, 0, 0); @@ -456,7 +460,7 @@ void LoLEngine::kingSelectionIntro() { _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 7 * _tickLength; - while (waitEnd > _system->getMillis() && _charSelection == -1 && !quit() && !skipFlag()) { + while (waitEnd > _system->getMillis() && _charSelection == -1 && !_quitFlag && !skipFlag()) { _charSelection = getCharSelection(); _system->delayMillis(10); } @@ -487,7 +491,7 @@ void LoLEngine::kingSelectionReminder() { _chargenWSA->setDrawPage(0); int index = 0; - while (_sound->voiceIsPlaying("KING02") && _charSelection == -1 && !quit() && index < 15) { + while (_sound->voiceIsPlaying("KING02") && _charSelection == -1 && !_quitFlag && 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); @@ -496,7 +500,7 @@ void LoLEngine::kingSelectionReminder() { _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 8 * _tickLength; - while (waitEnd > _system->getMillis() && !quit()) { + while (waitEnd > _system->getMillis() && !_quitFlag) { _charSelection = getCharSelection(); _system->delayMillis(10); } @@ -517,14 +521,14 @@ void LoLEngine::kingSelectionOutro() { _chargenWSA->setDrawPage(0); int index = 0; - while (_sound->voiceIsPlaying("KING03") && !quit() && !skipFlag()) { + while (_sound->voiceIsPlaying("KING03") && !_quitFlag && !skipFlag()) { index = MAX(index, 4); _chargenWSA->displayFrame(_chargenFrameTable[index], 0, 0, 0); _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 8 * _tickLength; - while (waitEnd > _system->getMillis() && !quit() && !skipFlag()) { + while (waitEnd > _system->getMillis() && !_quitFlag && !skipFlag()) { updateInput(); _system->delayMillis(10); } @@ -543,10 +547,10 @@ void LoLEngine::processCharacterSelection() { debugC(9, kDebugLevelMain, "LoLEngine::processCharacterSelection()"); _charSelection = -1; - while (!quit() && _charSelection == -1) { + while (!_quitFlag && _charSelection == -1) { uint32 nextKingMessage = _system->getMillis() + 900 * _tickLength; - while (nextKingMessage > _system->getMillis() && _charSelection == -1 && !quit()) { + while (nextKingMessage > _system->getMillis() && _charSelection == -1 && !_quitFlag) { updateSelectionAnims(); _charSelection = getCharSelection(); _system->delayMillis(10); @@ -665,12 +669,12 @@ void LoLEngine::selectionCharInfoIntro(char *file) { int index = 0; file[4] = '0'; - while (_charSelectionInfoResult == -1 && !quit()) { + while (_charSelectionInfoResult == -1 && !_quitFlag) { if (!_sound->voicePlay(file)) break; int i = 0; - while (_sound->voiceIsPlaying(file) && _charSelectionInfoResult == -1 && !quit()) { + while (_sound->voiceIsPlaying(file) && _charSelectionInfoResult == -1 && !_quitFlag) { _screen->drawShape(0, _screen->getPtrToShape(_screen->getCPagePtr(9), _charInfoFrameTable[i]), 11, 130, 0, 0); _screen->updateScreen(); |