[Scummvm-git-logs] scummvm master -> 57218bb38dfd9804866927b73a71f55059469d10

bgK bastien.bouclet at gmail.com
Fri Mar 8 06:42:52 CET 2019


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:
57218bb38d MOHAWK: RIVEN: Fix using the jundle ladder without lowering it


Commit: 57218bb38dfd9804866927b73a71f55059469d10
    https://github.com/scummvm/scummvm/commit/57218bb38dfd9804866927b73a71f55059469d10
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-03-08T06:29:52+01:00

Commit Message:
MOHAWK: RIVEN: Fix using the jundle ladder without lowering it

It was possible to bypass lowering the ladder when using keyboard
navigation. This is fixed using a game script patch to ensure the
hotspot for getting down the ladder is disabled when appropriate.

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


diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 9026f2e..db83305 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -73,7 +73,11 @@ void RivenCard::loadCardResource(uint16 id) {
 void RivenCard::applyPatches(uint16 id) {
 	uint32 globalId = _vm->getStack()->getCardGlobalId(id);
 
-	applyPropertiesPatch8EB7(globalId);
+	if (globalId == 0x2A3BC) {
+		applyPropertiesPatch8EB7(globalId, "jladder", 3);
+	} else if (globalId == 0x8EB7) {
+		applyPropertiesPatch8EB7(globalId, "jgate", 3);
+	}
 	applyPropertiesPatch2E76(globalId);
 
 	// Apply script patches
@@ -86,7 +90,7 @@ void RivenCard::applyPatches(uint16 id) {
 	applyPropertiesPatch1518D(globalId);
 }
 
-void RivenCard::applyPropertiesPatch8EB7(uint32 globalId) {
+void RivenCard::applyPropertiesPatch8EB7(uint32 globalId, const Common::String &var, uint16 hotspotId) {
 	// On Jungle Island on the back side of the "beetle" gate, the forward hotspot
 	// is always enabled, preventing keyboard navigation from automatically opening
 	// the gate.
@@ -109,48 +113,47 @@ void RivenCard::applyPropertiesPatch8EB7(uint32 globalId) {
 	// case 1:
 	//     activateBLST(5);
 	//     break;
-	if (globalId == 0x8EB7) {
-		HotspotEnableRecord forwardEnabled;
-		forwardEnabled.index = _hotspotEnableList.back().index + 1;
-		forwardEnabled.hotspotId = 3;
-		forwardEnabled.enabled = 1;
-		_hotspotEnableList.push_back(forwardEnabled);
-
-		HotspotEnableRecord forwardDisabled;
-		forwardDisabled.index = _hotspotEnableList.back().index + 1;
-		forwardDisabled.hotspotId = 3;
-		forwardDisabled.enabled = 0;
-		_hotspotEnableList.push_back(forwardDisabled);
-
-		uint16 jGateVariable = _vm->getStack()->getIdFromName(kVariableNames, "jgate");
-		uint16 patchData[] = {
-				1, // Command count in script
-				kRivenCommandSwitch,
-				2, // Unused
-				jGateVariable,
-				2, // Branches count
 
-				0, // jgate == 0 branch (gate closed)
-				1, // Command count in sub-script
-				kRivenCommandActivateBLST,
-				1, // Argument count
-				forwardDisabled.index,
+	HotspotEnableRecord forwardEnabled;
+	forwardEnabled.index = _hotspotEnableList.back().index + 1;
+	forwardEnabled.hotspotId = hotspotId;
+	forwardEnabled.enabled = 1;
+	_hotspotEnableList.push_back(forwardEnabled);
 
-				1, // jgate == 1 branch (gate open)
-				1, // Command count in sub-script
-				kRivenCommandActivateBLST,
-				1, // Argument count
-				forwardEnabled.index
-		};
+	HotspotEnableRecord forwardDisabled;
+	forwardDisabled.index = _hotspotEnableList.back().index + 1;
+	forwardDisabled.hotspotId = hotspotId;
+	forwardDisabled.enabled = 0;
+	_hotspotEnableList.push_back(forwardDisabled);
 
-		RivenScriptPtr patchScript = _vm->_scriptMan->readScriptFromData(patchData, ARRAYSIZE(patchData));
+	uint16 jGateVariable = _vm->getStack()->getIdFromName(kVariableNames, var);
+	uint16 patchData[] = {
+			1, // Command count in script
+			kRivenCommandSwitch,
+			2, // Unused
+			jGateVariable,
+			2, // Branches count
+
+			0, // jgate == 0 branch (gate closed)
+			1, // Command count in sub-script
+			kRivenCommandActivateBLST,
+			1, // Argument count
+			forwardDisabled.index,
+
+			1, // jgate == 1 branch (gate open)
+			1, // Command count in sub-script
+			kRivenCommandActivateBLST,
+			1, // Argument count
+			forwardEnabled.index
+	};
 
-		// Append the patch to the existing script
-		RivenScriptPtr loadScript = getScript(kCardLoadScript);
-		loadScript += patchScript;
+	RivenScriptPtr patchScript = _vm->_scriptMan->readScriptFromData(patchData, ARRAYSIZE(patchData));
 
-		debugC(kRivenDebugPatches, "Applied fix always enabled forward hotspot in card %x", globalId);
-	}
+	// Append the patch to the existing script
+	RivenScriptPtr loadScript = getScript(kCardLoadScript);
+	loadScript += patchScript;
+
+	debugC(kRivenDebugPatches, "Applied fix always enabled forward hotspot in card %x", globalId);
 }
 
 void RivenCard::applyPropertiesPatch2E76(uint32 globalId) {
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index e12b127..c092f59 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -154,7 +154,7 @@ private:
 	void applyPatches(uint16 id);
 	void applyPropertiesPatchE2E(uint32 globalId);
 	void applyPropertiesPatch1518D(uint32 globalId);
-	void applyPropertiesPatch8EB7(uint32 globalId);
+	void applyPropertiesPatch8EB7(uint32 globalId, const Common::String &var, uint16 hotspotId);
 	void applyPropertiesPatch2E76(uint32 globalId);
 	void applyPropertiesPatch22118(uint32 globalId);
 	void setCurrentCardVariable();





More information about the Scummvm-git-logs mailing list