From 2b9242c8ea0c54832235d5c07e666ab54c15ff4b Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Fri, 25 Jan 2019 21:02:02 +0100 Subject: [PATCH] STARK: Delay playing FMVs until all the location change scripts are done This ensures no sound is started by the scripts after the game has already been paused. In-game sounds no longer play during FMVs. --- engines/stark/resources/command.cpp | 2 -- engines/stark/services/userinterface.cpp | 10 +++++++--- engines/stark/services/userinterface.h | 1 + engines/stark/stark.cpp | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/engines/stark/resources/command.cpp b/engines/stark/resources/command.cpp index 638f286dc2f..67c313e5faa 100644 --- a/engines/stark/resources/command.cpp +++ b/engines/stark/resources/command.cpp @@ -965,8 +965,6 @@ Command *Command::opFullMotionVideoPlay(Script *script, const ResourceReference Location *location = current->getLocation(); location->resetAnimationBlending(); - // TODO: Pause the engine while the video is playing - FMV *movie = movieRef.resolve(); movie->requestPlayback(); diff --git a/engines/stark/services/userinterface.cpp b/engines/stark/services/userinterface.cpp index 8169e8ad453..9196222e943 100644 --- a/engines/stark/services/userinterface.cpp +++ b/engines/stark/services/userinterface.cpp @@ -192,9 +192,7 @@ void UserInterface::selectInventoryItem(int16 itemIndex) { } void UserInterface::requestFMVPlayback(const Common::String &name) { - changeScreen(Screen::kScreenFMV); - - _fmvScreen->play(name); + _shouldPlayFmv = name; } void UserInterface::onFMVStopped() { @@ -436,6 +434,12 @@ void UserInterface::doQueuedScreenChange() { backPrevScreen(); _shouldGoBackToPreviousScreen = false; } + + if (!_shouldPlayFmv.empty()) { + changeScreen(Screen::kScreenFMV); + _fmvScreen->play(_shouldPlayFmv); + _shouldPlayFmv.clear(); + } } void UserInterface::handleKeyPress(const Common::KeyState &keyState) { diff --git a/engines/stark/services/userinterface.h b/engines/stark/services/userinterface.h index b9e9e6a1649..a997e54601d 100644 --- a/engines/stark/services/userinterface.h +++ b/engines/stark/services/userinterface.h @@ -212,6 +212,7 @@ private: // TODO: Generalize to all screen changes bool _shouldGoBackToPreviousScreen; + Common::String _shouldPlayFmv; Graphics::Surface *_gameWindowThumbnail; }; diff --git a/engines/stark/stark.cpp b/engines/stark/stark.cpp index 7195c9e6572..0b634a27524 100644 --- a/engines/stark/stark.cpp +++ b/engines/stark/stark.cpp @@ -159,13 +159,13 @@ void StarkEngine::mainLoop() { break; } - StarkUserInterface->doQueuedScreenChange(); - if (StarkResourceProvider->hasLocationChangeRequest()) { StarkGlobal->setNormalSpeed(); StarkResourceProvider->performLocationChange(); } + StarkUserInterface->doQueuedScreenChange(); + updateDisplayScene(); // Swap buffers