diff options
author | Bastien Bouclet | 2017-07-19 19:07:57 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-07-19 19:07:57 +0200 |
commit | 103602250762e31fc62c6e42e694a5ea317d295b (patch) | |
tree | 3ce2d3f8201703b8a0b94da37e855140dcfd8dcd /engines/mohawk | |
parent | d03475e5abbbce905d1f4914198dddcd01250ac1 (diff) | |
download | scummvm-rg350-103602250762e31fc62c6e42e694a5ea317d295b.tar.gz scummvm-rg350-103602250762e31fc62c6e42e694a5ea317d295b.tar.bz2 scummvm-rg350-103602250762e31fc62c6e42e694a5ea317d295b.zip |
MOHAWK: Riven: Add script patch for missing sound when entering sub
Fixes #9972.
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/riven_card.cpp | 11 | ||||
-rw-r--r-- | engines/mohawk/riven_card.h | 3 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.cpp | 30 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.h | 6 |
4 files changed, 42 insertions, 8 deletions
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp index f387bc450b..d3166f31fc 100644 --- a/engines/mohawk/riven_card.cpp +++ b/engines/mohawk/riven_card.cpp @@ -66,7 +66,7 @@ void RivenCard::loadCardResource(uint16 id) { // Apply script patches for this card uint32 globalId = _vm->getStack()->getCardGlobalId(id); for (uint i = 0; i < _scripts.size(); i++) { - _scripts[i].script->applyCardPatches(_vm, globalId, _scripts[i].type); + _scripts[i].script->applyCardPatches(_vm, globalId, _scripts[i].type, 0xFFFF); } delete inStream; @@ -252,8 +252,10 @@ void RivenCard::loadHotspots(uint16 id) { uint16 hotspotCount = inStream->readUint16BE(); _hotspots.resize(hotspotCount); + uint32 globalId = _vm->getStack()->getCardGlobalId(id); for (uint16 i = 0; i < hotspotCount; i++) { _hotspots[i] = new RivenHotspot(_vm, inStream); + _hotspots[i]->applyScriptPatches(globalId); } delete inStream; @@ -642,6 +644,13 @@ RivenScriptPtr RivenHotspot::getScript(uint16 scriptType) const { return RivenScriptPtr(); } + +void RivenHotspot::applyScriptPatches(uint32 cardGlobalId) { + for (uint16 i = 0; i < _scripts.size(); i++) { + _scripts[i].script->applyCardPatches(_vm, cardGlobalId, _scripts[i].type, _blstID); + } +} + bool RivenHotspot::isEnabled() const { return (_flags & kFlagEnabled) != 0; } diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h index 24f2c137e7..cfcacdb8b8 100644 --- a/engines/mohawk/riven_card.h +++ b/engines/mohawk/riven_card.h @@ -254,6 +254,9 @@ public: /** Write all of the hotspot's data to standard output */ void dump() const; + /** Apply patches to hotspot's scripts to fix bugs in the original game scripts */ + void applyScriptPatches(uint32 cardGlobalId); + private: enum { kFlagZip = 1, diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 3086b681c5..cfe6eeb861 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -249,7 +249,7 @@ const char *RivenScript::getTypeName(uint16 type) { return names[type]; } -void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId, int scriptType) { +void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId, uint16 scriptType, uint16 hotspotId) { bool shouldApplyPatches = false; // On Prison Island when pressing the dome viewer switch to close the dome, @@ -289,9 +289,31 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId, } } + // On Jungle Island when entering the submarine from the dock beside the main walkway, + // the sound of the hatch closing does not play (Bug #9972). + // This happens only in the CD version of the game. + // + // Script before patch: + // transition(16); + // switchCard(534); + // + // Script after patch: + // transition(16); + // switchCard(534); + // playSound(112, 256, 0); + if (cardGlobalId == 0x2E900 && scriptType == kMouseDownScript && hotspotId == 3 + && !(vm->getFeatures() & GF_DVD)) { + shouldApplyPatches = true; + RivenSimpleCommand::ArgumentArray arguments; + arguments.push_back(112); + arguments.push_back(256); + arguments.push_back(0); + _commands.push_back(RivenCommandPtr(new RivenSimpleCommand(vm, kRivenCommandPlaySound, arguments))); + } + if (shouldApplyPatches) { for (uint i = 0; i < _commands.size(); i++) { - _commands[i]->applyCardPatches(cardGlobalId, scriptType); + _commands[i]->applyCardPatches(cardGlobalId, scriptType, hotspotId); } } } @@ -823,9 +845,9 @@ RivenCommandType RivenSwitchCommand::getType() const { return kRivenCommandSwitch; } -void RivenSwitchCommand::applyCardPatches(uint32 globalId, int scriptType) { +void RivenSwitchCommand::applyCardPatches(uint32 globalId, int scriptType, uint16 hotspotId) { for (uint i = 0; i < _branches.size(); i++) { - _branches[i].script->applyCardPatches(_vm, globalId, scriptType); + _branches[i].script->applyCardPatches(_vm, globalId, scriptType, hotspotId); } } diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index c3e95427c1..e77b9ae2d9 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -129,7 +129,7 @@ public: void dumpScript(byte tabs); /** Apply patches to card script to fix bugs in the original game scripts */ - void applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId, int scriptType); + void applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId, uint16 scriptType, uint16 hotspotId); /** Append the commands of the other script to this script */ RivenScript &operator+=(const RivenScript &other); @@ -257,7 +257,7 @@ public: virtual RivenCommandType getType() const = 0; /** Apply card patches for the command's sub-scripts */ - virtual void applyCardPatches(uint32 globalId, int scriptType) {} + virtual void applyCardPatches(uint32 globalId, int scriptType, uint16 hotspotId) {} protected: MohawkEngine_Riven *_vm; @@ -356,7 +356,7 @@ public: virtual void dump(byte tabs) override; virtual void execute() override; virtual RivenCommandType getType() const override; - virtual void applyCardPatches(uint32 globalId, int scriptType) override; + virtual void applyCardPatches(uint32 globalId, int scriptType, uint16 hotspotId) override; private: RivenSwitchCommand(MohawkEngine_Riven *vm); |