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

bgK bastien.bouclet at gmail.com
Sun Jun 24 16:50:08 CEST 2018


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:
f5e26d22b2 MOHAWK: MYST: Turn FortressRotation into a Direction enum


Commit: f5e26d22b2023359e1e7ad63fa016e1075a43b79
    https://github.com/scummvm/scummvm/commit/f5e26d22b2023359e1e7ad63fa016e1075a43b79
Author: David Fioramonti (dafioram at gmail.com)
Date: 2018-06-24T16:49:56+02:00

Commit Message:
MOHAWK: MYST: Turn FortressRotation into a Direction enum

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


diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 2481ca6..226be6b 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -56,7 +56,7 @@ Mechanical::Mechanical(MohawkEngine_Myst *vm) :
 	_crystalLit = 0;
 
 	_mystStaircaseState = false;
-	_fortressPosition = 0;
+	_fortressDirection = kSouth;
 	_gearsWereRunning = false;
 
 	_fortressRotationShortMovieWorkaround = false;
@@ -183,9 +183,9 @@ uint16 Mechanical::getVar(uint16 var) {
 	case 4: // Myst Book Room Staircase State
 		return _mystStaircaseState;
 	case 5: // Fortress Position
-		return _fortressPosition;
+		return _fortressDirection;
 	case 6: // Fortress Position - Big Cog Visible Through Doorway
-		return _fortressPosition == 0;
+		return _fortressDirection == kSouth;
 	case 7: // Fortress Elevator Open
 		if (_state.elevatorRotation == 4)
 			return 1; // Open
@@ -645,7 +645,7 @@ void Mechanical::o_fortressRotationSetPosition(uint16 var, const ArgumentsArray
 		moviePosition += 3600 * _fortressRotationShortMovieCount;
 	}
 
-	_fortressPosition = (moviePosition + 900) / 1800 % 4;
+	_fortressDirection = (moviePosition + 900) / 1800 % 4;
 
 	// Stop the gears video so that it does not play while the elevator is going up
 	_fortressRotationGears->getVideo()->stop();
@@ -803,17 +803,17 @@ void Mechanical::fortressRotation_run() {
 		_gearsWereRunning = true;
 	} else if (_gearsWereRunning) {
 		// The fortress has stopped. Set its new position
-		_fortressPosition = (moviePosition + 900) / 1800 % 4;
+		_fortressDirection = (moviePosition + 900) / 1800 % 4;
 
 		gears->setRate(0);
 
 		if (!_fortressRotationShortMovieWorkaround) {
-			gears->seek(Audio::Timestamp(0, 1800 * _fortressPosition, 600));
+			gears->seek(Audio::Timestamp(0, 1800 * _fortressDirection, 600));
 		} else {
-			gears->seek(Audio::Timestamp(0, 1800 * (_fortressPosition % 2), 600));
+			gears->seek(Audio::Timestamp(0, 1800 * (_fortressDirection % 2), 600));
 		}
 
-		_vm->playSoundBlocking(_fortressRotationSounds[_fortressPosition]);
+		_vm->playSoundBlocking(_fortressRotationSounds[_fortressDirection]);
 
 		_gearsWereRunning = false;
 	}
@@ -824,7 +824,7 @@ void Mechanical::o_fortressRotation_init(uint16 var, const ArgumentsArray &args)
 
 	VideoEntryPtr gears = _fortressRotationGears->playMovie();
 	gears->setLooping(true);
-	gears->seek(Audio::Timestamp(0, 1800 * _fortressPosition, 600));
+	gears->seek(Audio::Timestamp(0, 1800 * _fortressDirection, 600));
 	gears->setRate(0);
 
 	_fortressRotationSounds[0] = args[0];
diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h
index 52cd7e7..6b3ff40 100644
--- a/engines/mohawk/myst_stacks/mechanical.h
+++ b/engines/mohawk/myst_stacks/mechanical.h
@@ -57,6 +57,13 @@ private:
 	void fortressRotation_run();
 	void fortressSimulation_run();
 
+	enum Direction {
+		kSouth = 0, // Starting Island with Myst linking book
+		kEast  = 1, // Island with right half of code
+		kNorth = 2, // Island with left half of code
+		kWest  = 3  // No island, just water
+	};
+
 	DECLARE_OPCODE(o_throneEnablePassage);
 	DECLARE_OPCODE(o_birdCrankStart);
 	DECLARE_OPCODE(o_birdCrankStop);
@@ -80,7 +87,7 @@ private:
 	DECLARE_OPCODE(o_elevatorWindowMovie);
 	DECLARE_OPCODE(o_elevatorGoMiddle);
 	DECLARE_OPCODE(o_elevatorTopMovie);
-	DECLARE_OPCODE(o_fortressRotationSetPosition);
+	DECLARE_OPCODE(o_fortressRotationSetPosition); // Rotator control button (above elevator) has been pressed
 	DECLARE_OPCODE(o_mystStaircaseMovie);
 	DECLARE_OPCODE(o_elevatorWaitTimeout);
 	DECLARE_OPCODE(o_crystalEnterYellow);
@@ -107,7 +114,7 @@ private:
 	bool _gearsWereRunning;
 	uint16 _fortressRotationSpeed; // 78
 	uint16 _fortressRotationBrake; // 80
-	uint16 _fortressPosition; // 82
+	uint16 _fortressDirection; // 82
 	uint16 _fortressRotationSounds[4]; // 86 to 92
 	MystAreaVideo *_fortressRotationGears; // 172
 





More information about the Scummvm-git-logs mailing list