[Scummvm-git-logs] scummvm master -> 103602250762e31fc62c6e42e694a5ea317d295b

bgK bastien.bouclet at gmail.com
Wed Jul 19 19:11:11 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1036022507 MOHAWK: Riven: Add script patch for missing sound when entering sub


Commit: 103602250762e31fc62c6e42e694a5ea317d295b
    https://github.com/scummvm/scummvm/commit/103602250762e31fc62c6e42e694a5ea317d295b
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-07-19T19:07:57+02:00

Commit Message:
MOHAWK: Riven: Add script patch for missing sound when entering sub

Fixes #9972.

Changed paths:
    engines/mohawk/riven_card.cpp
    engines/mohawk/riven_card.h
    engines/mohawk/riven_scripts.cpp
    engines/mohawk/riven_scripts.h


diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index f387bc4..d3166f3 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 24f2c13..cfcacdb 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 3086b68..cfe6eeb 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 c3e9542..e77b9ae 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);





More information about the Scummvm-git-logs mailing list