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.
This commit is contained in:
Bastien Bouclet 2019-01-25 21:02:02 +01:00
parent 0607e8c7a7
commit 2b9242c8ea
4 changed files with 10 additions and 7 deletions

View File

@ -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<FMV>();
movie->requestPlayback();

View File

@ -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) {

View File

@ -212,6 +212,7 @@ private:
// TODO: Generalize to all screen changes
bool _shouldGoBackToPreviousScreen;
Common::String _shouldPlayFmv;
Graphics::Surface *_gameWindowThumbnail;
};

View File

@ -159,13 +159,13 @@ void StarkEngine::mainLoop() {
break;
}
StarkUserInterface->doQueuedScreenChange();
if (StarkResourceProvider->hasLocationChangeRequest()) {
StarkGlobal->setNormalSpeed();
StarkResourceProvider->performLocationChange();
}
StarkUserInterface->doQueuedScreenChange();
updateDisplayScene();
// Swap buffers