From 8f350905e99d27a9e4a5428e8300511b156bf03f Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Wed, 30 Jan 2019 08:43:49 +0100 Subject: MOHAWK: RIVEN: Patch Jungle island book closing animation script Fixes #10880. --- engines/mohawk/riven_card.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++ engines/mohawk/riven_card.h | 1 + engines/mohawk/riven_scripts.h | 2 +- 3 files changed, 59 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp index 3612232b23..555688ce7e 100644 --- a/engines/mohawk/riven_card.cpp +++ b/engines/mohawk/riven_card.cpp @@ -83,6 +83,7 @@ void RivenCard::applyPatches(uint16 id) { applyPropertiesPatch22118(globalId); applyPropertiesPatchE2E(globalId); + applyPropertiesPatch1518D(globalId); } void RivenCard::applyPropertiesPatch8EB7(uint32 globalId) { @@ -410,6 +411,62 @@ void RivenCard::applyPropertiesPatchE2E(uint32 globalId) { } } +void RivenCard::applyPropertiesPatch1518D(uint32 globalId) { + // Inside Jungle Island's dome, when looking at the open book, + // stepping back from the stand and then looking at the book + // again, the book closing animation would play again. + // + // Comparing the scripts for the Jungle dome and the other domes + // shows a small portion of script is missing. + // The following patch adds it back so the jungle dome script + // matches the other domes. + // + // Added script part: + // == Script 2 == + // [...] + // type: CardEnter + // switch (jbook) { + // case 2: + // playMovieBlocking(1); + // jbook = 0; + // refreshCard(); + // break; + // } + if (globalId == 0x1518D) { + uint16 jBookVariable = _vm->getStack()->getIdFromName(kVariableNames, "jbook"); + uint16 patchData[] = { + 1, // Command count in script + kRivenCommandSwitch, + 2, // Unused + jBookVariable, + 1, // Branches count + + 2, // jbook == 2 branch + 3, // Command count in sub-script + + kRivenCommandPlayMovieBlocking, + 1, // Argument count + 1, // Video id + + kRivenCommandSetVariable, + 2, // Argument count + jBookVariable, + 0, // Variable value + + kRivenCommandRefreshCard, + 0 // Argument count + }; + + RivenScriptPtr patchScript = _vm->_scriptMan->readScriptFromData(patchData, ARRAYSIZE(patchData)); + + // Append the patch to the existing script + RivenScriptPtr loadScript = getScript(kCardEnterScript); + loadScript += patchScript; + + debugC(kRivenDebugPatches, "Applied jungle book close loop to card %x", globalId); + } +} + void RivenCard::moveHotspot(uint16 blstId, const Common::Rect &position) { RivenHotspot *hotspot = getHotspotByBlstId(blstId); if (!hotspot) { diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h index 5eae4c0179..e12b127f39 100644 --- a/engines/mohawk/riven_card.h +++ b/engines/mohawk/riven_card.h @@ -153,6 +153,7 @@ private: void loadCardWaterEffectList(uint16 id); void applyPatches(uint16 id); void applyPropertiesPatchE2E(uint32 globalId); + void applyPropertiesPatch1518D(uint32 globalId); void applyPropertiesPatch8EB7(uint32 globalId); void applyPropertiesPatch2E76(uint32 globalId); void applyPropertiesPatch22118(uint32 globalId); diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index c7c49805b1..149fb47455 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -75,7 +75,7 @@ enum RivenCommandType { kRivenCommandDisableMovie = 28, kRivenCommandDisableAllMovies = 29, kRivenCommandEnableMovie = 31, - kRivenCommandlayMovieBlocking = 32, + kRivenCommandPlayMovieBlocking = 32, kRivenCommandPlayMovie = 33, kRivenCommandStopMovie = 34, kRivenCommandUnk36 = 36, -- cgit v1.2.3