[Scummvm-git-logs] scummvm master -> cf9646e72b0e6e6c8908c1e04542c447e0d4bd5d

bgK bastien.bouclet at gmail.com
Thu Aug 10 19:02:59 CEST 2017


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

Summary:
5a4400e390 MOHAWK: Riven: Stop using varargs to list hotspot names
18fe4cebe4 MOHAWK: Riven: Trigger the try to open the back rotating room door
cf9646e72b MOHAWK: Myst: Stop gears video before calling elevator on mechanical


Commit: 5a4400e390faa9a0ee27b4d7f3207253d1342a2a
    https://github.com/scummvm/scummvm/commit/5a4400e390faa9a0ee27b4d7f3207253d1342a2a
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-10T19:02:10+02:00

Commit Message:
MOHAWK: Riven: Stop using varargs to list hotspot names

One call to va_end was missing when returning early. This stuff is too
dangerous for me to use.

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 a116d88..bb7f617 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -683,41 +683,56 @@ void RivenCard::playMovie(uint16 index, bool queue) {
 }
 
 RivenScriptPtr RivenCard::onKeyAction(RivenKeyAction keyAction) {
-	RivenHotspot *directionHotspot = nullptr;
+	static const char *forwardNames[] = {
+			"forward", "forward1", "forward2", "forward3",
+			"opendoor", "openhatch", "opentrap", "opengate", "opengrate",
+			"open", "door", "drop", "go", "enterprison", "exit",
+			"forwardleft", "forwardright", nullptr
+	};
+
+	static const char *forwardLeftNames [] = { "forwardleft",              nullptr };
+	static const char *forwardRightNames[] = { "forwardright",             nullptr };
+	static const char *leftNames        [] = { "left",  "afl", "prevpage", nullptr };
+	static const char *rightNames       [] = { "right", "afr", "nextpage", nullptr };
+	static const char *backNames        [] = { "back",                     nullptr };
+	static const char *upNames          [] = { "up",                       nullptr };
+	static const char *downNames        [] = { "down",                     nullptr };
+
+	static const char **hotspotNames;
 	switch (keyAction) {
 		case kKeyActionMoveForward:
-			directionHotspot = findEnabledHotspotByName(17,
-			                        "forward", "forward1", "forward2", "forward3",
-			                        "opendoor", "openhatch", "opentrap", "opengate", "opengrate",
-			                        "open", "door", "drop", "go", "enterprison", "exit",
-			                        "forwardleft", "forwardright"
-			);
+			hotspotNames = forwardNames;
 			break;
 		case kKeyActionMoveForwardLeft:
-			directionHotspot = findEnabledHotspotByName(1, "forwardleft");
+			hotspotNames = forwardLeftNames;
 			break;
 		case kKeyActionMoveForwardRight:
-			directionHotspot = findEnabledHotspotByName(1, "forwardright");
+			hotspotNames = forwardRightNames;
 			break;
 		case kKeyActionMoveLeft:
-			directionHotspot = findEnabledHotspotByName(3, "left", "afl", "prevpage");
+			hotspotNames = leftNames;
 			break;
 		case kKeyActionMoveRight:
-			directionHotspot = findEnabledHotspotByName(3, "right", "afr", "nextpage");
+			hotspotNames = rightNames;
 			break;
 		case kKeyActionMoveBack:
-			directionHotspot = findEnabledHotspotByName(1, "back");
+			hotspotNames = backNames;
 			break;
 		case kKeyActionLookUp:
-			directionHotspot = findEnabledHotspotByName(1, "up");
+			hotspotNames = upNames;
 			break;
 		case kKeyActionLookDown:
-			directionHotspot = findEnabledHotspotByName(1, "down");
+			hotspotNames = downNames;
 			break;
 		default:
 			break;
 	}
 
+	if (!hotspotNames) {
+		return RivenScriptPtr(new RivenScript());
+	}
+
+	RivenHotspot *directionHotspot = findEnabledHotspotByName(hotspotNames);
 	if (!directionHotspot) {
 		return RivenScriptPtr(new RivenScript());
 	}
@@ -735,20 +750,14 @@ RivenScriptPtr RivenCard::onKeyAction(RivenKeyAction keyAction) {
 	return clickScript;
 }
 
-RivenHotspot *RivenCard::findEnabledHotspotByName(uint n, ...) const {
-	va_list ap;
-	va_start(ap, n);
-
-	for (uint i = 0; i < n; i++) {
-		const char *name = va_arg(ap, const char *);
-		RivenHotspot *hotspot = getHotspotByName(name, true);
+RivenHotspot *RivenCard::findEnabledHotspotByName(const char **names) const {
+	for (uint i = 0; names[i] != nullptr; i++) {
+		RivenHotspot *hotspot = getHotspotByName(names[i], true);
 		if (hotspot && hotspot->isEnabled()) {
 			return hotspot;
 		}
 	}
 
-	va_end(ap);
-
 	return nullptr;
 }
 
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index c5a5795..b11363c 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -102,7 +102,7 @@ public:
 	RivenHotspot *getHotspotByName(const Common::String &name, bool optional = false) const;
 
 	/** Find an enabled hotspot with a name matching one of the arguments */
-	RivenHotspot *findEnabledHotspotByName(uint n, ...) const;
+	RivenHotspot *findEnabledHotspotByName(const char **names) const;
 
 	/** Get the hotspot with the specified BLST id */
 	RivenHotspot *getHotspotByBlstId(const uint16 blstId) const;


Commit: 18fe4cebe4ce54ae48d4834e9e791710610826a3
    https://github.com/scummvm/scummvm/commit/18fe4cebe4ce54ae48d4834e9e791710610826a3
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-10T19:02:10+02:00

Commit Message:
MOHAWK: Riven: Trigger the try to open the back rotating room door

When using keyboard navigation

Changed paths:
    engines/mohawk/riven_card.cpp


diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index bb7f617..3aab79d 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -828,10 +828,16 @@ void RivenHotspot::applyPropertiesPatches(uint32 cardGlobalId) {
 	// change the name of the hotspot to look at the bottom of the door to
 	// "down" instead of "forwardleft". That way the keyboard navigation
 	// does not spoil that you can go below the door.
+	// Also make sure the forward keyboard action plays the try to open
+	// door animation.
 	if (cardGlobalId == 0x87ac && _blstID == 10) {
 		_nameResource = _vm->getStack()->getIdFromName(kHotspotNames, "down");
 		debugC(kRivenDebugPatches, "Applied change hotspot name to 'down' patch to card %x", cardGlobalId);
 	}
+	if (cardGlobalId == 0x87ac && _blstID == 12) {
+		_nameResource = _vm->getStack()->getIdFromName(kHotspotNames, "opendoor");
+		debugC(kRivenDebugPatches, "Applied change hotspot name to 'opendoor' patch to card %x", cardGlobalId);
+	}
 }
 
 void RivenHotspot::applyScriptPatches(uint32 cardGlobalId) {


Commit: cf9646e72b0e6e6c8908c1e04542c447e0d4bd5d
    https://github.com/scummvm/scummvm/commit/cf9646e72b0e6e6c8908c1e04542c447e0d4bd5d
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-10T19:02:10+02:00

Commit Message:
MOHAWK: Myst: Stop gears video before calling elevator on mechanical

Fixes #10108.

Changed paths:
    engines/mohawk/myst_stacks/mechanical.cpp


diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 34238f3..bd5406a 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -615,6 +615,9 @@ void Mechanical::o_fortressRotationSetPosition(uint16 var, const ArgumentsArray
 	}
 
 	_fortressPosition = (moviePosition + 900) / 1800 % 4;
+
+	// Stop the gears video so that it does not play while the elevator is going up
+	_fortressRotationGears->getVideo()->stop();
 }
 
 void Mechanical::o_mystStaircaseMovie(uint16 var, const ArgumentsArray &args) {





More information about the Scummvm-git-logs mailing list