From f93facaf45ba4eedb9f443c18c90892e06d9889b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 4 Jan 2013 02:27:56 +0100 Subject: TOLTECS: Make aborting movies more reliable Before, the main updateInput() might swallow attempts at aborting movies. Now all events are handled by the movie player's own handleInput(). As a side effect, it's no longer necessary to check if a movie is playing before removing subtitles when pressing space. --- engines/toltecs/movie.cpp | 12 +++++++++--- engines/toltecs/toltecs.cpp | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'engines/toltecs') diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp index 576890f703..45711ad983 100644 --- a/engines/toltecs/movie.cpp +++ b/engines/toltecs/movie.cpp @@ -100,8 +100,9 @@ void MoviePlayer::playMovie(uint resIndex) { byte *chunkBuffer = NULL; uint32 chunkBufferSize = 0; uint32 frame = 0; + bool abortMovie = false; - while (_chunkCount--) { + while (_chunkCount-- && !abortMovie) { byte chunkType = _vm->_arc->readByte(); uint32 chunkSize = _vm->_arc->readUint32LE(); @@ -137,7 +138,8 @@ void MoviePlayer::playMovie(uint resIndex) { if (_vm->_screen->_shakeActive && _vm->_screen->updateShakeScreen()) { _vm->_screen->_fullRefresh = true; } - _vm->updateInput(); + if (!handleInput()) + abortMovie = true; _vm->drawScreen(); // Note: drawScreen() calls delayMillis() } @@ -181,7 +183,7 @@ void MoviePlayer::playMovie(uint resIndex) { } if (!handleInput()) - break; + abortMovie = true; } delete[] chunkBuffer; @@ -274,6 +276,10 @@ bool MoviePlayer::handleInput() { case Common::EVENT_KEYDOWN: if (event.kbd.keycode == Common::KEYCODE_ESCAPE) return false; + if (event.kbd.keycode == Common::KEYCODE_F10) { + // TODO: The original would bring up a stripped down + // main menu dialog, without the save/restore options. + } break; case Common::EVENT_LBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index 0e71bd88f9..f6a2dfed9d 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -340,7 +340,7 @@ void ToltecsEngine::updateInput() { break; case Common::KEYCODE_SPACE: // Skip current dialog line, if a dialog is active - if (!_moviePlayer->isPlaying() && _screen->getTalkTextDuration() > 0) { + if (_screen->getTalkTextDuration() > 0) { _sound->stopSpeech(); _screen->finishTalkTextItems(); _keyState.reset(); // event consumed -- cgit v1.2.3