From cf5295191562042542a5d351d7c12e2bea3b5458 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 1 Jul 2018 14:57:41 +0200 Subject: MOHAWK: RIVEN: Fix the credits not showing in the Polish version Fixes Trac#10589 --- engines/mohawk/riven_stack.cpp | 23 +++++++++++++++++++---- engines/mohawk/riven_stack.h | 4 ++-- engines/mohawk/riven_stacks/ospit.cpp | 8 ++++---- engines/mohawk/riven_stacks/rspit.cpp | 7 ++++++- engines/mohawk/riven_stacks/tspit.cpp | 8 ++++---- 5 files changed, 35 insertions(+), 15 deletions(-) (limited to 'engines/mohawk') diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp index 2a9fb7fbad..cecb557385 100644 --- a/engines/mohawk/riven_stack.cpp +++ b/engines/mohawk/riven_stack.cpp @@ -206,16 +206,16 @@ void RivenStack::runDemoBoundaryDialog() { dialog.runModal(); } -void RivenStack::runEndGame(uint16 videoCode, uint32 delay) { +void RivenStack::runEndGame(uint16 videoCode, uint32 delay, uint32 videoFrameCountOverride) { _vm->_sound->stopAllSLST(); RivenVideo *video = _vm->_video->openSlot(videoCode); video->enable(); video->play(); video->setLooping(false); - runCredits(videoCode, delay); + runCredits(videoCode, delay, videoFrameCountOverride); } -void RivenStack::runCredits(uint16 video, uint32 delay) { +void RivenStack::runCredits(uint16 video, uint32 delay, uint32 videoFrameCountOverride) { // Initialize our credits state _vm->_cursor->hideCursor(); _vm->_gfx->beginCredits(); @@ -223,9 +223,24 @@ void RivenStack::runCredits(uint16 video, uint32 delay) { RivenVideo *videoPtr = _vm->_video->getSlot(video); + int32 frameCount; + if (_vm->getLanguage() == Common::PL_POL && videoFrameCountOverride != 0) { + // In the Polish version, the ending videos are not encoded the same way + // as with the other languages. In the other versions, the video track + // ends after a while, but the audio track keeps going while the credits + // are shown. + // In the Polish version, the video track keeps going until the end + // of the file, but contains only white frames. This workaround stops + // displaying the video track just before the first white frame. + frameCount = videoFrameCountOverride; + } else { + frameCount = videoPtr->getFrameCount(); + } + while (!_vm->hasGameEnded() && _vm->_gfx->getCurCreditsImage() <= 320) { - if (videoPtr->getCurFrame() >= (int32)videoPtr->getFrameCount() - 1) { + if (videoPtr->getCurFrame() >= frameCount - 1) { if (nextCreditsFrameStart == 0) { + videoPtr->disable(); // Set us up to start after delay ms nextCreditsFrameStart = _vm->getTotalPlayTime() + delay; } else if (_vm->getTotalPlayTime() >= nextCreditsFrameStart) { diff --git a/engines/mohawk/riven_stack.h b/engines/mohawk/riven_stack.h index 8ab18a5f6f..671f4f9116 100644 --- a/engines/mohawk/riven_stack.h +++ b/engines/mohawk/riven_stack.h @@ -192,8 +192,8 @@ public: // Miscellaneous uint16 getComboDigit(uint32 correctCombo, uint32 digit); void runDemoBoundaryDialog(); - void runEndGame(uint16 videoCode, uint32 delay); - void runCredits(uint16 video, uint32 delay); + void runEndGame(uint16 videoCode, uint32 delay, uint32 videoFrameCountOverride); + void runCredits(uint16 video, uint32 delay, uint32 videoFrameCountOverride); void pageTurn(RivenTransition transition); bool keepTurningPages(); diff --git a/engines/mohawk/riven_stacks/ospit.cpp b/engines/mohawk/riven_stacks/ospit.cpp index beecc05ab9..d939beacba 100644 --- a/engines/mohawk/riven_stacks/ospit.cpp +++ b/engines/mohawk/riven_stacks/ospit.cpp @@ -60,11 +60,11 @@ void OSpit::xorollcredittime(const ArgumentArray &args) { uint32 gehnState = _vm->_vars["agehn"]; if (gehnState == 0) // Gehn who? - runEndGame(1, 9500); + runEndGame(1, 9500, 1225); else if (gehnState == 4) // You freed him? Are you kidding me? - runEndGame(2, 12000); + runEndGame(2, 12000, 558); else // You already spoke with Gehn. What were you thinking? - runEndGame(3, 8000); + runEndGame(3, 8000, 857); } void OSpit::xbookclick(const ArgumentArray &args) { @@ -143,7 +143,7 @@ void OSpit::xbookclick(const ArgumentArray &args) { // Run the credits from here. if (_vm->_vars["agehn"] == 3) { _vm->_scriptMan->stopAllScripts(); - runCredits(args[0], 5000); + runCredits(args[0], 5000, 0); return; } diff --git a/engines/mohawk/riven_stacks/rspit.cpp b/engines/mohawk/riven_stacks/rspit.cpp index 6d153bed67..da16499297 100644 --- a/engines/mohawk/riven_stacks/rspit.cpp +++ b/engines/mohawk/riven_stacks/rspit.cpp @@ -48,7 +48,12 @@ void RSpit::xrcredittime(const ArgumentArray &args) { // For the record, when agehn == 4, Gehn will thank you for // showing him the rebel age and then leave you to die. // Otherwise, the rebels burn the book. Epic fail either way. - runEndGame(1, 1500); + + if (_vm->_vars["agehn"] == 4) { + runEndGame(1, 1500, 712); + } else { + runEndGame(1, 1500, 0); + } } void RSpit::xrshowinventory(const ArgumentArray &args) { diff --git a/engines/mohawk/riven_stacks/tspit.cpp b/engines/mohawk/riven_stacks/tspit.cpp index 3abd0a6b43..9546d946ab 100644 --- a/engines/mohawk/riven_stacks/tspit.cpp +++ b/engines/mohawk/riven_stacks/tspit.cpp @@ -141,25 +141,25 @@ void TSpit::xtopenfissure() { // The best ending: Catherine is free, Gehn is trapped, Atrus comes to rescue you. // And now we fall back to Earth... all the way... _vm->getCard()->playMovie(8); - runEndGame(8, 5000); + runEndGame(8, 5000, 2640); } else if (_vm->_vars["agehn"] == 4) { // The ok ending: Catherine is still trapped, Gehn is trapped, Atrus comes to rescue you. // Nice going! Catherine and the islanders are all dead now! Just go back to your home... _vm->getCard()->playMovie(9); - runEndGame(9, 5000); + runEndGame(9, 5000, 2088); } else if (_vm->_vars["atrapbook"] == 1) { // The bad ending: Catherine is trapped, Gehn is free, Atrus gets shot by Gehn, // And then you get shot by Cho. Nice going! Catherine and the islanders are dead // and you have just set Gehn free from Riven, not to mention you're dead. _vm->getCard()->playMovie(10); - runEndGame(10, 5000); + runEndGame(10, 5000, 1703); } else { // The impossible ending: You don't have Catherine's journal and yet you were somehow // able to open the hatch on the telescope. The game provides an ending for those who // cheat, load a saved game with the combo, or just guess the telescope combo. Atrus // doesn't come and you just fall into the fissure. _vm->getCard()->playMovie(11); - runEndGame(11, 5000); + runEndGame(11, 5000, 0); } } -- cgit v1.2.3