[Scummvm-cvs-logs] SF.net SVN: scummvm:[55308] scummvm/trunk/engines/mohawk/myst_stacks

bgk at users.sourceforge.net bgk at users.sourceforge.net
Tue Jan 18 20:17:26 CET 2011


Revision: 55308
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55308&view=rev
Author:   bgk
Date:     2011-01-18 19:17:24 +0000 (Tue, 18 Jan 2011)

Log Message:
-----------
MOHAWK: Add gulls and butterflies to Myst

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/myst.h

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2011-01-18 18:26:33 UTC (rev 55307)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2011-01-18 19:17:24 UTC (rev 55308)
@@ -58,6 +58,7 @@
 	_treeMinPosition = 0;
 	_imagerValidationStep = 0;
 	_observatoryCurrentSlider = 0;
+	_butterfliesMoviePlayed = false;
 	_state.treeLastMoveTime = _vm->_system->getMillis();
 }
 
@@ -177,22 +178,22 @@
 	OPCODE(203, o_forechamberDoor_init);
 	OPCODE(204, o_shipAccess_init);
 	OPCODE(205, NOP);
-	OPCODE(206, opcode_206);
+	OPCODE(206, o_butterflies_init);
 	OPCODE(208, o_imager_init);
 	OPCODE(209, o_libraryBookcaseTransform_init);
 	OPCODE(210, o_generatorControlRoom_init);
 	OPCODE(211, o_fireplace_init);
 	OPCODE(212, o_clockGears_init);
-	OPCODE(213, opcode_213);
+	OPCODE(213, o_gulls1_init);
 	OPCODE(214, o_observatory_init);
-	OPCODE(215, opcode_215);
+	OPCODE(215, o_gulls2_init);
 	OPCODE(216, o_treeCard_init);
 	OPCODE(217, o_treeEntry_init);
 	OPCODE(218, opcode_218);
 	OPCODE(219, o_rocketSliders_init);
 	OPCODE(220, o_rocketLinkVideo_init);
 	OPCODE(221, o_greenBook_init);
-	OPCODE(222, opcode_222);
+	OPCODE(222, o_gulls3_init);
 
 	// "Exit" Opcodes
 	OPCODE(300, o_bookAddSpecialPage_exit);
@@ -229,6 +230,9 @@
 	_observatoryTimeChanging = false;
 	_greenBookRunning = false;
 	_clockLeverPulled = false;
+	_gullsFlying1 = false;
+	_gullsFlying2 = false;
+	_gullsFlying3 = false;
 }
 
 void MystScriptParser_Myst::runPersistentScripts() {
@@ -291,6 +295,15 @@
 
 	if (_clockLeverPulled)
 		clockGears_run();
+
+	if (_gullsFlying1)
+		gullsFly1_run();
+
+	if (_gullsFlying2)
+		gullsFly2_run();
+
+	if (_gullsFlying3)
+		gullsFly3_run();
 }
 
 uint16 MystScriptParser_Myst::getVar(uint16 var) {
@@ -2988,7 +3001,7 @@
 }
 
 void MystScriptParser_Myst::clockResetWeight() {
-	// Set video bounds
+	// Set video bounds, weight going up
 	_clockWeightVideo = _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack) , 124, 0);
 	_vm->_video->setVideoBounds(_clockWeightVideo,
 			Graphics::VideoTimestamp(2214 * 2 - _clockWeightPosition, 600),
@@ -3004,7 +3017,7 @@
 	static const uint16 x[] = { 224, 224, 224 };
 	static const uint16 y[] = { 49, 82, 109 };
 
-	// Set video bounds
+	// Set video bounds, gears going to 3
 	uint16 gearPosition = _clockGearsPositions[gear] - 1;
 	if (gearPosition != 2) {
 		_clockGearsVideos[gear] = _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename(videos[gear], kMystStack), x[gear], y[gear]);
@@ -3213,11 +3226,16 @@
 	}
 }
 
-void MystScriptParser_Myst::opcode_206(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser_Myst::o_butterflies_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Butterflies movie init", op);
 
 	// Used for Card 4256 (Butterfly Movie Activation)
-	// TODO: Implement Logic...
+	if (!_butterfliesMoviePlayed) {
+		MystResourceType6 *butterflies = static_cast<MystResourceType6 *>(_invokingResource);
+		butterflies->playMovie();
+
+		_butterfliesMoviePlayed = true;
+	}
 }
 
 void MystScriptParser_Myst::o_imager_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -3309,17 +3327,35 @@
 	}
 }
 
-void MystScriptParser_Myst::opcode_213(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser_Myst::o_gulls1_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Gulls init", op);
 
-	// Used for Card 4524 (Dockside Facing Towards Ship)
-	if (argc == 0) {
-		// TODO: Implement Code...
-		// Code for Gull Videos?
-	} else
-		unknown(op, var, argc, argv);
+	if (!_state.shipFloating) {
+		_gullsNextTime = _vm->_system->getMillis() + 2000;
+		_gullsFlying1 = true;
+	}
 }
 
+void MystScriptParser_Myst::gullsFly1_run() {
+	static const char* gulls[] = { "birds1", "birds2", "birds3" };
+	uint32 time = _vm->_system->getMillis();
+
+	if (time > _gullsNextTime) {
+		uint16 video = _vm->_rnd->getRandomNumber(3);
+		if (video != 3) {
+			uint16 x = 0;
+			if (_vm->_rnd->getRandomBit())
+				x = _vm->_rnd->getRandomNumber(110);
+			else
+				x = _vm->_rnd->getRandomNumber(160) + 260;
+
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename(gulls[video], kMystStack), x, 0);
+
+			_gullsNextTime = time + _vm->_rnd->getRandomNumber(16667) + 13334;
+		}
+	}
+}
+
 void MystScriptParser_Myst::o_observatory_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Stellar observatory init", op);
 
@@ -3443,21 +3479,29 @@
 	}
 }
 
-void MystScriptParser_Myst::opcode_215(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser_Myst::o_gulls2_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Gulls init", op);
 
-	// Used for Card 4134 (Dock Facing Marker Switch)
-	// TODO: Fill in logic for Gull Videos.
-	//       may be offset and overlap and need video update to all these
-	//       to run in sequence with opcode215_run() process...
-	if (false) {
-		// All birds(x) videos are 120x48 and played in top right corner of card
-		_vm->_video->playMovie(_vm->wrapMovieFilename("birds1", kMystStack), 544 - 120 - 1, 0);
-		_vm->_video->playMovie(_vm->wrapMovieFilename("birds2", kMystStack), 544 - 120 - 1, 0);
-		_vm->_video->playMovie(_vm->wrapMovieFilename("birds3", kMystStack), 544 - 120 - 1, 0);
+	if (!_state.shipFloating) {
+		_gullsNextTime = _vm->_system->getMillis() + 2000;
+		_gullsFlying2 = true;
 	}
 }
 
+void MystScriptParser_Myst::gullsFly2_run() {
+	static const char* gulls[] = { "birds1", "birds2", "birds3" };
+	uint32 time = _vm->_system->getMillis();
+
+	if (time > _gullsNextTime) {
+		uint16 video = _vm->_rnd->getRandomNumber(3);
+		if (video != 3) {
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename(gulls[video], kMystStack), 424, 0);
+
+			_gullsNextTime = time + _vm->_rnd->getRandomNumber(16667) + 13334;
+		}
+	}
+}
+
 void MystScriptParser_Myst::o_treeCard_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Enter tree card", op);
 
@@ -3561,16 +3605,31 @@
 	}
 }
 
-void MystScriptParser_Myst::opcode_222(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser_Myst::o_gulls3_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Gulls init", op);
 
-	// Used for Card 4141 (Myst Dock Facing Sea)
-	if (argc == 0) {
-		// TODO: Logic for Gull Videos?
-	} else
-		unknown(op, var, argc, argv);
+	if (!_state.shipFloating) {
+		_gullsNextTime = _vm->_system->getMillis() + 2000;
+		_gullsFlying3 = true;
+	}
 }
 
+void MystScriptParser_Myst::gullsFly3_run() {
+	static const char* gulls[] = { "birds1", "birds2", "birds3" };
+	uint32 time = _vm->_system->getMillis();
+
+	if (time > _gullsNextTime) {
+		uint16 video = _vm->_rnd->getRandomNumber(3);
+		if (video != 3) {
+			uint16 x = _vm->_rnd->getRandomNumber(280) + 135;
+
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename(gulls[video], kMystStack), x, 0);
+
+			_gullsNextTime = time + _vm->_rnd->getRandomNumber(16667) + 13334;
+		}
+	}
+}
+
 void MystScriptParser_Myst::o_bookAddSpecialPage_exit(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Book Exit Function", op);
 

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2011-01-18 18:26:33 UTC (rev 55307)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2011-01-18 19:17:24 UTC (rev 55308)
@@ -72,6 +72,9 @@
 	void observatoryTimeChange_run();
 	void greenBook_run();
 	void clockGears_run();
+	void gullsFly1_run();
+	void gullsFly2_run();
+	void gullsFly3_run();
 
 	DECLARE_OPCODE(o_libraryBookPageTurnLeft);
 	DECLARE_OPCODE(o_libraryBookPageTurnRight);
@@ -160,22 +163,22 @@
 	DECLARE_OPCODE(o_towerRotationMap_init);
 	DECLARE_OPCODE(o_forechamberDoor_init);
 	DECLARE_OPCODE(o_shipAccess_init);
-	DECLARE_OPCODE(opcode_206);
+	DECLARE_OPCODE(o_butterflies_init);
 	DECLARE_OPCODE(o_imager_init);
 	DECLARE_OPCODE(o_libraryBookcaseTransform_init);
 	DECLARE_OPCODE(o_generatorControlRoom_init);
 	DECLARE_OPCODE(o_fireplace_init);
 	DECLARE_OPCODE(o_clockGears_init);
-	DECLARE_OPCODE(opcode_213);
+	DECLARE_OPCODE(o_gulls1_init);
 	DECLARE_OPCODE(o_observatory_init);
-	DECLARE_OPCODE(opcode_215);
+	DECLARE_OPCODE(o_gulls2_init);
 	DECLARE_OPCODE(o_treeCard_init);
 	DECLARE_OPCODE(o_treeEntry_init);
 	DECLARE_OPCODE(opcode_218);
 	DECLARE_OPCODE(o_rocketSliders_init);
 	DECLARE_OPCODE(o_rocketLinkVideo_init);
 	DECLARE_OPCODE(o_greenBook_init);
-	DECLARE_OPCODE(opcode_222);
+	DECLARE_OPCODE(o_gulls3_init);
 
 	DECLARE_OPCODE(o_bookAddSpecialPage_exit);
 	DECLARE_OPCODE(o_treeCard_exit);
@@ -202,6 +205,13 @@
 	uint16 _libraryBookNumPages; // 88
 	uint16 _libraryBookBaseImage; // 90
 
+	bool _butterfliesMoviePlayed; // 100
+
+	bool _gullsFlying1;
+	bool _gullsFlying2;
+	bool _gullsFlying3;
+	uint32 _gullsNextTime; // 216
+
 	bool _libraryBookcaseMoving;
 	MystResourceType6 *_libraryBookcaseMovie; // 104
 	uint16 _libraryBookcaseSoundId; // 284


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list