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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Tue Dec 14 07:42:00 CET 2010


Revision: 54905
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54905&view=rev
Author:   bgk
Date:     2010-12-14 06:42:00 +0000 (Tue, 14 Dec 2010)

Log Message:
-----------
MOHAWK: Implement Myst opcodes 122 to 124 : Cabin safe handle

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	2010-12-14 03:14:11 UTC (rev 54904)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-14 06:42:00 UTC (rev 54905)
@@ -46,6 +46,7 @@
 	_savedCardId = 4329;
 	_libraryBookcaseChanged = false;
 	_dockVaultState = 0;
+	_cabinMatchboxState = 2;
 }
 
 MystScriptParser_Myst::~MystScriptParser_Myst() {
@@ -74,8 +75,9 @@
 	OPCODE(119, opcode_119);
 	OPCODE(120, o_generatorButtonPressed);
 	OPCODE(121, o_cabinSafeChangeDigit);
-	OPCODE(122, opcode_122);
-	OPCODE(123, opcode_123);
+	OPCODE(122, o_cabinSafeHandleStartMove);
+	OPCODE(123, o_cabinSafeHandleMove);
+	OPCODE(124, o_cabinSafeHandleEndMove);
 	OPCODE(129, opcode_129);
 	OPCODE(130, opcode_130);
 	OPCODE(131, opcode_131);
@@ -369,6 +371,8 @@
 		return (myst.cabinSafeCombination / 10) % 10;
 	case 69: // Cabin Safe Lock Number #3 - Right
 		return myst.cabinSafeCombination % 10;
+	case 70: // Cabin Safe Matchbox State
+		return _cabinMatchboxState;
 	case 93: // Breaker nearest Generator Room Blown
 		return myst.generatorBreakers == 1;
 	case 94: // Breaker nearest Rocket Ship Blown
@@ -503,6 +507,12 @@
 			refresh = true;
 		}
 		break;
+	case 70: // Cabin Safe Matchbox State
+		if (_cabinMatchboxState != value) {
+			_cabinMatchboxState = value;
+			refresh = true;
+		}
+		break;
 	case 302: // Green Book Opened Before Flag
 		myst.greenBookOpenedBefore = value;
 		break;
@@ -1083,16 +1093,64 @@
 	_vm->redrawArea(var);
 }
 
-void MystScriptParser_Myst::opcode_122(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+void MystScriptParser_Myst::o_cabinSafeHandleStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Cabin safe handle start move", op);
+
 	// Used on Card 4100
-	// TODO: Mouse down on handle
+	MystResourceType12 *handle = static_cast<MystResourceType12 *>(_invokingResource);
+	handle->drawFrame(0);
+	_vm->_cursor->setCursor(700);
+	_tempVar = 0;
 }
 
-void MystScriptParser_Myst::opcode_123(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+void MystScriptParser_Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Cabin safe handle move", op);
+
 	// Used on Card 4100
-	// TODO: Mouse drag on handle
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+	MystResourceType12 *handle = static_cast<MystResourceType12 *>(_invokingResource);
+
+	// Make the handle follow the mouse
+	int16 maxStep = handle->getStepsV() - 1;
+    Common::Rect rect = handle->getRect();
+    int16 step = ((_vm->_mouse.y - rect.top) * handle->getStepsV()) / rect.height();
+	step = CLIP<uint16>(step, 0, maxStep);
+
+	handle->drawFrame(step);
+
+	if (step == maxStep) {
+		// Sound not played yet
+		if (_tempVar == 0) {
+			uint16 soundId = handle->getList2(0);
+			if (soundId)
+				_vm->_sound->playSound(soundId);
+		}
+		// Combination is right
+		if (myst.cabinSafeCombination == 724) {
+			uint16 soundId = handle->getList2(1);
+			if (soundId)
+				_vm->_sound->playSound(soundId);
+
+			_vm->changeToCard(4103, false);
+
+			Common::Rect screenRect = Common::Rect(544, 333);
+			_vm->_gfx->runTransition(0, screenRect, 2, 5);
+		}
+		_tempVar = 1;
+	} else {
+		_tempVar = 0;
+	}
 }
 
+void MystScriptParser_Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Cabin safe handle end move", op);
+
+	// Used on Card 4100
+	MystResourceType12 *handle = static_cast<MystResourceType12 *>(_invokingResource);
+	handle->drawFrame(0);
+	_vm->checkCursorHints();
+}
+
 void MystScriptParser_Myst::opcode_129(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	// Used on Card 4500
 	// TODO: Month increase

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-14 03:14:11 UTC (rev 54904)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-14 06:42:00 UTC (rev 54905)
@@ -81,8 +81,9 @@
 	DECLARE_OPCODE(opcode_119);
 	DECLARE_OPCODE(o_generatorButtonPressed);
 	DECLARE_OPCODE(o_cabinSafeChangeDigit);
-	DECLARE_OPCODE(opcode_122);
-	DECLARE_OPCODE(opcode_123);
+	DECLARE_OPCODE(o_cabinSafeHandleStartMove);
+	DECLARE_OPCODE(o_cabinSafeHandleMove);
+	DECLARE_OPCODE(o_cabinSafeHandleEndMove);
 	DECLARE_OPCODE(opcode_129);
 	DECLARE_OPCODE(opcode_130);
 	DECLARE_OPCODE(opcode_131);
@@ -210,6 +211,7 @@
 	bool _towerRotationOverSpot; // 136
 
 	uint16 _cabinDoorOpened; // 56
+	uint16 _cabinMatchboxState; // 60
 
 	void generatorRedrawRocket();
 	void generatorButtonValue(MystResource *button, uint16 &offset, uint16 &value);


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