From bc983b82af0aa705a702cfeb6e748fbec7c0df67 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Mon, 11 Nov 2019 18:31:07 +0100 Subject: MOHAWK: MYST: Loop the flyby movies and allow skipping using left click Fixes #10599. --- engines/mohawk/myst.cpp | 36 ++++++++++++++++++++++++++++++++++-- engines/mohawk/myst.h | 1 + 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'engines/mohawk') diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index b2d04e1dd5..9d1a1e12a2 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -284,6 +284,7 @@ void MohawkEngine_Myst::playFlybyMovie(MystStack stack) { // Play Flyby Entry Movie on Masterpiece Edition. const char *flyby = nullptr; + bool looping = true; switch (stack) { case kSeleniticStack: @@ -295,8 +296,10 @@ void MohawkEngine_Myst::playFlybyMovie(MystStack stack) { // Myst Flyby Movie not used in Original Masterpiece Edition Engine // We play it when first arriving on Myst, and if the user has chosen so. case kMystStack: - if (ConfMan.getBool("playmystflyby")) + if (ConfMan.getBool("playmystflyby")) { flyby = "myst flyby"; + looping = false; + } break; case kMechanicalStack: flyby = "mech age flyby"; @@ -321,7 +324,36 @@ void MohawkEngine_Myst::playFlybyMovie(MystStack stack) { } video->center(); - waitUntilMovieEnds(video); + playSkippableMovie(video, looping); +} + +void MohawkEngine_Myst::playSkippableMovie(const VideoEntryPtr &video, bool looping) { + _waitingOnBlockingOperation = true; + + video->setLooping(true); + + _cursor->setCursor(_mainCursor); + + while ((looping || !video->endOfVideo()) && !shouldQuit()) { + doFrame(); + + // Allow skipping + if (_escapePressed) { + _escapePressed = false; + break; + } + + if (_mouseClicked) { + _mouseClicked = false; + break; + } + } + + _cursor->setCursor(0); + + // Ensure it's removed + _video->removeEntry(video); + _waitingOnBlockingOperation = false; } void MohawkEngine_Myst::waitUntilMovieEnds(const VideoEntryPtr &video) { diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 27fa3005ad..22e6982e1e 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -172,6 +172,7 @@ public: VideoEntryPtr findVideo(const Common::String &name, MystStack stack); void playMovieBlocking(const Common::String &name, MystStack stack, uint16 x, uint16 y); void playFlybyMovie(MystStack stack); + void playSkippableMovie(const VideoEntryPtr &video, bool looping); void waitUntilMovieEnds(const VideoEntryPtr &video); Common::String selectLocalizedMovieFilename(const Common::String &movieName); -- cgit v1.2.3