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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Sun Dec 19 08:02:02 CET 2010


Revision: 54959
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54959&view=rev
Author:   bgk
Date:     2010-12-19 07:02:02 +0000 (Sun, 19 Dec 2010)

Log Message:
-----------
MOHAWK: Fix Myst courtyard boxes. Hover areas entering / leaving is now handled separatly from other resources since the former have to get events even when they are disabled.

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

Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst.cpp	2010-12-19 07:02:02 UTC (rev 54959)
@@ -79,6 +79,7 @@
 	_curCard = 0;
 	_needsUpdate = false;
 	_curResource = -1;
+	_hoverResource = 0;
 	_dragResource = 0;
 
 	_gfx = NULL;
@@ -550,6 +551,7 @@
 
 	// Make sure we have the right cursor showing
 	_dragResource = 0;
+	_hoverResource = 0;
 	_curResource = -1;
 	checkCurrentResource();
 
@@ -576,30 +578,31 @@
 void MohawkEngine_Myst::checkCurrentResource() {
 	// See what resource we're over
 	bool foundResource = false;
-	int16 oldResource = _curResource;
+	const Common::Point &mouse = _system->getEventManager()->getMousePos();
 
+	// Tell previous resource the mouse is no longer hovering it
+	if (_hoverResource && !_hoverResource->contains(mouse)) {
+		_hoverResource->handleMouseLeave();
+		_hoverResource = 0;
+	}
+
 	for (uint16 i = 0; i < _resources.size(); i++)
-		if (_resources[i]->canBecomeActive() &&
-				_resources[i]->contains(_system->getEventManager()->getMousePos())) {
-			if (oldResource != i) {
-				if (_resources[i]->type == kMystHoverArea)
-					_resources[i]->handleMouseEnter();
+		if (_resources[i]->contains(mouse)) {
+			if (_hoverResource != _resources[i] && _resources[i]->type == kMystHoverArea) {
+				_hoverResource = static_cast<MystResourceType13 *>(_resources[i]);
+				_hoverResource->handleMouseEnter();
 			}
 
-			_curResource = i;
-			foundResource = true;
-			break;
+			if (!foundResource && _resources[i]->canBecomeActive()) {
+				_curResource = i;
+				foundResource = true;
+			}
 		}
 
 	// Set the resource to none if we're not over any
 	if (!foundResource)
 		_curResource = -1;
 
-	// Tell previous resource the mouse is no longer hovering it
-	if (oldResource != -1 && _curResource != oldResource
-			&& _resources[oldResource]->type == kMystHoverArea)
-		_resources[oldResource]->handleMouseLeave();
-
 	checkCursorHints();
 }
 

Modified: scummvm/trunk/engines/mohawk/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst.h	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst.h	2010-12-19 07:02:02 UTC (rev 54959)
@@ -47,6 +47,7 @@
 class MystOptionsDialog;
 class MystResource;
 class MystResourceType8;
+class MystResourceType13;
 
 // Engine Debug Flags
 enum {
@@ -222,6 +223,7 @@
 	void drawResourceRects();
 	void checkCurrentResource();
 	int16 _curResource;
+	MystResourceType13 *_hoverResource;
 
 	uint16 _cursorHintCount;
 	MystCursorHint *_cursorHints;

Modified: scummvm/trunk/engines/mohawk/myst_areas.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.cpp	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst_areas.cpp	2010-12-19 07:02:02 UTC (rev 54959)
@@ -76,7 +76,7 @@
 }
 
 bool MystResource::canBecomeActive() {
-	return !unreachableZipDest() && (isEnabled() || (_flags & kMystUnknownFlag) || type == kMystHoverArea);
+	return !unreachableZipDest() && (isEnabled() || (_flags & kMystUnknownFlag));
 }
 
 bool MystResource::unreachableZipDest() {
@@ -319,46 +319,6 @@
 	}
 }
 
-void MystResourceType7::handleMouseEnter() {
-	if (_var7 == 0xFFFF) {
-		if (_numSubResources == 1)
-			_subResources[0]->handleMouseEnter();
-		else if (_numSubResources != 0)
-			warning("Type 7 Resource with _numSubResources of %d, but no control variable", _numSubResources);
-	} else {
-		uint16 varValue = _vm->_scriptParser->getVar(_var7);
-
-		if (_numSubResources == 1 && varValue != 0)
-			_subResources[0]->handleMouseEnter();
-		else if (_numSubResources != 0) {
-			if (varValue < _numSubResources)
-				_subResources[varValue]->handleMouseEnter();
-			else
-				warning("Type 7 Resource Var %d: %d exceeds number of sub resources %d", _var7, varValue, _numSubResources);
-		}
-	}
-}
-
-void MystResourceType7::handleMouseLeave() {
-	if (_var7 == 0xFFFF) {
-		if (_numSubResources == 1)
-			_subResources[0]->handleMouseLeave();
-		else if (_numSubResources != 0)
-			warning("Type 7 Resource with _numSubResources of %d, but no control variable", _numSubResources);
-	} else {
-		uint16 varValue = _vm->_scriptParser->getVar(_var7);
-
-		if (_numSubResources == 1 && varValue != 0)
-			_subResources[0]->handleMouseLeave();
-		else if (_numSubResources != 0) {
-			if (varValue < _numSubResources)
-				_subResources[varValue]->handleMouseLeave();
-			else
-				warning("Type 7 Resource Var %d: %d exceeds number of sub resources %d", _var7, varValue, _numSubResources);
-		}
-	}
-}
-
 MystResourceType8::MystResourceType8(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResourceType7(vm, rlstStream, parent) {
 	_var8 = rlstStream->readUint16LE();
 	_numSubImages = rlstStream->readUint16LE();
@@ -814,13 +774,15 @@
 }
 
 void MystResourceType13::handleMouseEnter() {
-	// Pass along the enter opcode (with no parameters) to the script parser
-	_vm->_scriptParser->runOpcode(_enterOpcode);
+	// Pass along the enter opcode to the script parser
+	// The variable to use is stored in the dest field
+	_vm->_scriptParser->runOpcode(_enterOpcode, _dest);
 }
 
 void MystResourceType13::handleMouseLeave() {
 	// Pass along the leave opcode (with no parameters) to the script parser
-	_vm->_scriptParser->runOpcode(_leaveOpcode);
+	// The variable to use is stored in the dest field
+	_vm->_scriptParser->runOpcode(_leaveOpcode, _dest);
 }
 
 void MystResourceType13::handleMouseUp(const Common::Point &mouse) {

Modified: scummvm/trunk/engines/mohawk/myst_areas.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.h	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst_areas.h	2010-12-19 07:02:02 UTC (rev 54959)
@@ -82,8 +82,6 @@
 	virtual void handleMouseUp(const Common::Point &mouse);
 	virtual void handleMouseDown(const Common::Point &mouse) {}
 	virtual void handleMouseDrag(const Common::Point &mouse) {}
-	virtual void handleMouseEnter() {}
-	virtual void handleMouseLeave() {}
 
 protected:
 	MohawkEngine_Myst *_vm;
@@ -134,8 +132,6 @@
 
 	virtual void handleMouseUp(const Common::Point &mouse);
 	virtual void handleMouseDown(const Common::Point &mouse);
-	virtual void handleMouseEnter();
-	virtual void handleMouseLeave();
 
 	MystResource *getSubResource(uint16 index) { return _subResources[index]; }
 protected:

Modified: scummvm/trunk/engines/mohawk/myst_saveload.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_saveload.cpp	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst_saveload.cpp	2010-12-19 07:02:02 UTC (rev 54959)
@@ -156,7 +156,7 @@
 	}
 
 	s.syncAsUint16LE(_v->myst.greenBookOpenedBefore);
-	s.syncAsUint16LE(_v->myst.shipState);
+	s.syncAsUint16LE(_v->myst.shipFloating);
 	s.syncAsUint16LE(_v->myst.cabinValvePosition);
 	s.syncAsUint16LE(_v->myst.clockTowerHourPosition);
 	s.syncAsUint16LE(_v->myst.clockTowerMinutePosition);
@@ -168,10 +168,10 @@
 	s.syncAsUint16LE(_v->myst.libraryBookcaseDoor);
 	s.syncAsUint16LE(_v->myst.imagerSelection);
 	s.syncAsUint16LE(_v->myst.imagerActive);
-	s.syncAsUint16LE(_v->myst.u0);
-	s.syncAsUint16LE(_v->myst.u1);
-	s.syncAsUint16LE(_v->myst.u2);
-	s.syncAsUint16LE(_v->myst.u3);
+	s.syncAsUint16LE(_v->myst.imagerWaterErased);
+	s.syncAsUint16LE(_v->myst.imagerMountainErased);
+	s.syncAsUint16LE(_v->myst.imagerAtrusErased);
+	s.syncAsUint16LE(_v->myst.imagerMarkerErased);
 	s.syncAsUint16LE(_v->myst.towerRotationAngle);
 	s.syncAsUint16LE(_v->myst.courtyardImageBoxes);
 	s.syncAsUint16LE(_v->myst.cabinPilotLightLit);
@@ -186,8 +186,7 @@
 	s.syncAsUint16LE(_v->myst.observatoryYearTarget);
 	s.syncAsUint16LE(_v->myst.cabinSafeCombination);
 	s.syncAsUint16LE(_v->myst.treePosition);
-	s.syncAsUint16LE(_v->myst.u4);
-	s.syncAsUint16LE(_v->myst.u5);
+	s.syncAsUint32LE(_v->myst.treeLastMoveTime);
 
 	for (int i = 0; i < 5; i++)
 		s.syncAsUint16LE(_v->myst.rocketSliderPosition[i]);

Modified: scummvm/trunk/engines/mohawk/myst_saveload.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_saveload.h	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst_saveload.h	2010-12-19 07:02:02 UTC (rev 54959)
@@ -127,7 +127,7 @@
 		uint32 observatoryMarkerSwitch;
 		uint32 rocketshipMarkerSwitch;
 		uint16 greenBookOpenedBefore;
-		uint16 shipState;
+		uint16 shipFloating;
 		uint16 cabinValvePosition;
 		uint16 clockTowerHourPosition;
 		uint16 clockTowerMinutePosition;
@@ -139,10 +139,10 @@
 		uint16 libraryBookcaseDoor;
 		uint16 imagerSelection;
 		uint16 imagerActive;
-		uint16 u0;
-		uint16 u1;
-		uint16 u2;
-		uint16 u3;
+		uint16 imagerWaterErased;
+		uint16 imagerMountainErased;
+		uint16 imagerAtrusErased;
+		uint16 imagerMarkerErased;
 		uint16 towerRotationAngle;
 		uint16 courtyardImageBoxes;
 		uint16 cabinPilotLightLit;
@@ -157,8 +157,7 @@
 		uint16 observatoryYearTarget;
 		uint16 cabinSafeCombination;
 		uint16 treePosition;
-		uint16 u4;
-		uint16 u5;
+		uint32 treeLastMoveTime;
 		uint16 rocketSliderPosition[5];
 		uint16 u6;
 		uint16 u7;

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-19 07:02:02 UTC (rev 54959)
@@ -41,6 +41,8 @@
 // NOTE: Credits Start Card is 10000
 
 MystScriptParser_Myst::MystScriptParser_Myst(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
 	setupOpcodes();
 
 	// Card ID preinitialized by the engine for use by opcode 18
@@ -55,7 +57,7 @@
 	_treeAlcove = 0;
 	_treeStopped = false;
 	_treeMinPosition = 0;
-	_treeLastMoveTime = _vm->_system->getMillis();
+	myst.treeLastMoveTime = _vm->_system->getMillis();
 }
 
 MystScriptParser_Myst::~MystScriptParser_Myst() {
@@ -70,7 +72,7 @@
 	OPCODE(102, o_libraryBookPageTurnRight);
 	OPCODE(103, o_fireplaceToggleButton);
 	OPCODE(104, o_fireplaceRotation);
-	OPCODE(105, opcode_105);
+	OPCODE(105, o_courtyardBoxesCheckSolution);
 	OPCODE(106, o_towerRotationStart);
 	OPCODE(107, NOP);
 	OPCODE(108, o_towerRotationEnd);
@@ -135,8 +137,8 @@
 	OPCODE(180, o_libraryCombinationBookStop);
 	OPCODE(181, NOP);
 	OPCODE(182, o_cabinMatchLight);
-	OPCODE(183, opcode_183);
-	OPCODE(184, opcode_184);
+	OPCODE(183, o_courtyardBoxEnter);
+	OPCODE(184, o_courtyardBoxLeave);
 	OPCODE(185, NOP);
 	OPCODE(186, o_clockMinuteWheelStartTurn);
 	OPCODE(187, NOP);
@@ -154,11 +156,11 @@
 
 	// "Init" Opcodes
 	OPCODE(200, o_libraryBook_init);
-	OPCODE(201, opcode_201);
+	OPCODE(201, o_courtyardBox_init);
 	OPCODE(202, o_towerRotationMap_init);
 	OPCODE(203, o_forechamberDoor_init);
-	OPCODE(204, opcode_204);
-	OPCODE(205, opcode_205);
+	OPCODE(204, o_shipAccess_init);
+	OPCODE(205, NOP);
 	OPCODE(206, opcode_206);
 	OPCODE(208, opcode_208);
 	OPCODE(209, o_libraryBookcaseTransform_init);
@@ -193,9 +195,6 @@
 #undef OPCODE
 
 void MystScriptParser_Myst::disablePersistentScripts() {
-	opcode_201_disable();
-	opcode_205_disable();
-
 	_libraryBookcaseMoving = false;
 	_generatorControlRoomRunning = false;
 	_libraryCombinationBookPagesTurning = false;
@@ -210,8 +209,6 @@
 }
 
 void MystScriptParser_Myst::runPersistentScripts() {
-	opcode_201_run();
-	opcode_205_run();
 	opcode_212_run();
 
 	if (_towerRotationMapRunning)
@@ -279,8 +276,8 @@
 		return myst.observatoryMarkerSwitch;
 	case 9: // Marker Switch Near Rocket Ship
 		return myst.rocketshipMarkerSwitch;
-	case 10: // Ship State
-		return myst.shipState;
+	case 10: // Ship Floating State
+		return myst.shipFloating;
 	case 11: // Cabin Door Open State
 		return _cabinDoorOpened;
 	case 12: // Clock tower gears bridge
@@ -313,7 +310,7 @@
 			else
 				return 2;
 		case 129:
-			if (myst.shipState)
+			if (myst.shipFloating)
 				return 5;
 			else
 				return 3;
@@ -372,6 +369,13 @@
 	//	return 0;
 	//	return 1;
 	//	return 2;
+	case 35: // Dock Forechamber Imager Control Left Digit
+		if (myst.imagerSelection > 9)
+			return myst.imagerSelection / 10 - 1;
+		else
+			return 9;
+	case 36: // Dock Forechamber Imager Control Right Digit
+		return (myst.imagerSelection - 1) % 10;
 	case 37: // Clock Tower Control Wheels Position
 		return 3 * ((myst.clockTowerMinutePosition / 5) % 3) + myst.clockTowerHourPosition % 3;
 	case 40: // Gears Open State
@@ -388,16 +392,16 @@
 		else
 			return 2;
 	case 45: // Dock Vault Imager Active On Water
-		return myst.imagerActive && myst.imagerSelection == 67;
+		return myst.imagerActive && myst.imagerSelection == 67 && !myst.imagerWaterErased;
 	case 46:
 		return bookCountPages(100);
 	case 47:
 		return bookCountPages(101);
 	case 48:
-		if (myst.shipState)
-			return 2;
-		else if (myst.dockMarkerSwitch)
+		if (myst.dockMarkerSwitch && !myst.shipFloating)
 			return 1;
+		else if (!myst.dockMarkerSwitch && myst.shipFloating)
+			return 2;
 		else
 			return 0;
 	case 49: // Generator running
@@ -562,6 +566,21 @@
 			}
 		}
 		break;
+	case 26: // Courtyard Image Box - Cross
+	case 27: // Courtyard Image Box - Leaf
+	case 28: // Courtyard Image Box - Arrow
+	case 29: // Courtyard Image Box - Eye
+	case 30: // Courtyard Image Box - Snake
+	case 31: // Courtyard Image Box - Spider
+	case 32: // Courtyard Image Box - Anchor
+	case 33: // Courtyard Image Box - Ostrich
+		{
+			uint16 mask = 0x01 << (var - 26);
+			if (myst.courtyardImageBoxes & mask)
+				myst.courtyardImageBoxes &= ~mask;
+			else
+				myst.courtyardImageBoxes |= mask;
+		}
 	case 41: // Vault white page
 		if (globals.ending != 4) {
 			if (_dockVaultState == 1) {
@@ -755,40 +774,25 @@
 		_vm->_video->playMovie(_vm->wrapMovieFilename("fpin", kMystStack), 167, 4);
 }
 
-void MystScriptParser_Myst::opcode_105(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	if (argc == 1) {
-		varUnusedCheck(op, var);
+void MystScriptParser_Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	uint16 soundId = argv[0];
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
 
-		uint16 soundId = argv[0];
-		uint16 boxValue = 0;
-		Audio::SoundHandle *handle;
+	debugC(kDebugScript, "Opcode %d: Ship Puzzle Logic", op);
+	debugC(kDebugScript, "\tsoundId: %d", soundId);
 
-		debugC(kDebugScript, "Opcode %d: Ship Puzzle Logic", op);
-		debugC(kDebugScript, "\tsoundId: %d", soundId);
-
-		// Logic for Myst Ship Box Puzzle Solution
-		for (byte i = 0; i < 8; i++)
-			boxValue |= _vm->_varStore->getVar(i + 26) ? (1 << i) : 0;
-
-		uint16 var10 = _vm->_varStore->getVar(10);
-
-		if (boxValue == 0x32 && var10 == 0) {
-			handle = _vm->_sound->replaceSound(soundId);
-
-			while (_vm->_mixer->isSoundHandleActive(*handle))
-				_vm->_system->delayMillis(10);
-
-			_vm->_varStore->setVar(10, 1);
-		} else if (boxValue != 0x32 && var10 == 1) {
-			handle = _vm->_sound->replaceSound(soundId);
-
-			while (_vm->_mixer->isSoundHandleActive(*handle))
-				_vm->_system->delayMillis(10);
-
-			_vm->_varStore->setVar(10, 0);
-		}
-	} else
-		unknown(op, var, argc, argv);
+	// Change ship state if the boxes are correctly enabled
+	if (myst.courtyardImageBoxes == 50 && !myst.shipFloating) {
+		_vm->_cursor->hideCursor();
+		myst.shipFloating = 1;
+		_vm->_sound->playSoundBlocking(soundId);
+		_vm->_cursor->showCursor();
+	} else if (myst.courtyardImageBoxes != 50 && myst.shipFloating) {
+		_vm->_cursor->hideCursor();
+		myst.shipFloating = 0;
+		_vm->_sound->playSoundBlocking(soundId);
+		_vm->_cursor->showCursor();
+	}
 }
 
 void MystScriptParser_Myst::o_towerRotationStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -839,16 +843,27 @@
 }
 
 void MystScriptParser_Myst::opcode_109(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	if (argc == 1) {
-		int16 signedValue = argv[0];
+	debugC(kDebugScript, "Opcode %d: Dock imager change selection", op);
 
-		debugC(kDebugScript, "Opcode %d: Add Signed Value to Var", op);
-		debugC(kDebugScript, "\tVar: %d", var);
-		debugC(kDebugScript, "\tsignedValue: %d", signedValue);
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
 
-		_vm->_varStore->setVar(var, _vm->_varStore->getVar(var) + signedValue);
-	} else
-		unknown(op, var, argc, argv);
+	int16 signedValue = argv[0];
+	uint16 d1 = (myst.imagerSelection / 10) % 10;
+	uint16 d2 = myst.imagerSelection % 10;
+
+	if (var == 35 && signedValue > 0 && d1 < 9)
+		d1++;
+	else if (var == 35 && signedValue < 0 && d1 > 0)
+		d1--;
+	else if (var == 36 && signedValue > 0 && d2 < 9)
+		d2++;
+	else if (var == 36 && signedValue < 0 && d2 > 0)
+		d2--;
+
+	myst.imagerSelection = 10 * d1 + d2;
+	myst.imagerActive = 0;
+
+	_vm->redrawArea(var);
 }
 
 void MystScriptParser_Myst::o_dockVaultOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -1420,7 +1435,7 @@
 			_vm->_sound->replaceBackground(8098, 49152);
 
 		if (myst.cabinValvePosition > 12)
-			_treeLastMoveTime = _vm->_system->getMillis();
+			myst.treeLastMoveTime = _vm->_system->getMillis();
 
 		// TODO: Complete. Play movies
 	}
@@ -1432,7 +1447,7 @@
 
 	_treeStopped = false;
 	_boilerPressureIncreasing = false;
-	_treeLastMoveTime = _vm->_system->getMillis();
+	myst.treeLastMoveTime = _vm->_system->getMillis();
 
 	if (myst.cabinPilotLightLit == 1) {
 		if (myst.cabinValvePosition > 0)
@@ -1507,7 +1522,7 @@
 
 	_treeStopped = false;
 	_boilerPressureDecreasing = false;
-	_treeLastMoveTime = _vm->_system->getMillis();
+	myst.treeLastMoveTime = _vm->_system->getMillis();
 
 	if (myst.cabinPilotLightLit == 1) {
 		if (myst.cabinValvePosition > 0)
@@ -1530,9 +1545,11 @@
 void MystScriptParser_Myst::o_basementIncreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Basement increase pressure stop", op);
 
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
 	_treeStopped = false;
 	_basementPressureIncreasing = false;
-	_treeLastMoveTime = _vm->_system->getMillis();
+	myst.treeLastMoveTime = _vm->_system->getMillis();
 }
 
 void MystScriptParser_Myst::basementPressureIncrease_run() {
@@ -1575,9 +1592,11 @@
 void MystScriptParser_Myst::o_basementDecreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Basement decrease pressure stop", op);
 
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
 	_treeStopped = false;
 	_basementPressureDecreasing = false;
-	_treeLastMoveTime = _vm->_system->getMillis();
+	myst.treeLastMoveTime = _vm->_system->getMillis();
 }
 
 void MystScriptParser_Myst::tree_run() {
@@ -1600,7 +1619,7 @@
 				|| (myst.treePosition > _treeMinPosition && goingDown)) {
 			uint16 delay = treeNextMoveDelay(pressure);
 			uint32 time = _vm->_system->getMillis();
-			if (delay < time - _treeLastMoveTime) {
+			if (delay < time - myst.treeLastMoveTime) {
 
 				// Tree movement
 				if (goingDown) {
@@ -1625,7 +1644,7 @@
 				// Check if alcove is accessible
 				treeSetAlcoveAccessible();
 
-				_treeLastMoveTime = time;
+				myst.treeLastMoveTime = time;
 			}
 		}
 	}
@@ -1945,7 +1964,7 @@
 	if (myst.treePosition >= 4) {
 		myst.cabinValvePosition = 0;
 		_treeMinPosition = 4;
-		_treeLastMoveTime = 0;
+		myst.treeLastMoveTime = 0;
 	}
 }
 
@@ -2046,24 +2065,17 @@
 	}
 }
 
-void MystScriptParser_Myst::opcode_183(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	if (argc == 0) {
-		// Used for Myst Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes)
-		_vm->_varStore->setVar(105, 1);
-	} else
-		unknown(op, var, argc, argv);
+void MystScriptParser_Myst::o_courtyardBoxEnter(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Mouse enters courtyard box", op);
+	_tempVar = 1;
+	_vm->_sound->playSound(_courtyardBoxSound);
+	_vm->redrawArea(var);
 }
 
-void MystScriptParser_Myst::opcode_184(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	if (argc == 0) {
-		// Used for Myst Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes)
-		_vm->_varStore->setVar(105, 0);
-	} else
-		unknown(op, var, argc, argv);
+void MystScriptParser_Myst::o_courtyardBoxLeave(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Mouse leaves courtyard box", op);
+	_tempVar = 0;
+	_vm->redrawArea(var);
 }
 
 void MystScriptParser_Myst::o_clockMinuteWheelStartTurn(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -2311,42 +2323,12 @@
 	_libraryBookSound2 = argv[3];
 }
 
-static struct {
-	uint16 lastVar105;
-	uint16 soundId;
+void MystScriptParser_Myst::o_courtyardBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Courtyard box init", op);
 
-	bool enabled;
-} g_opcode201Parameters;
-
-void MystScriptParser_Myst::opcode_201_run() {
-	if (g_opcode201Parameters.enabled) {
-		uint16 var105 = _vm->_varStore->getVar(105);
-
-		if (var105 && !g_opcode201Parameters.lastVar105)
-			_vm->_sound->replaceSound(g_opcode201Parameters.soundId);
-
-		g_opcode201Parameters.lastVar105 = var105;
-	}
+	_courtyardBoxSound = argv[0];
 }
 
-void MystScriptParser_Myst::opcode_201_disable() {
-	g_opcode201Parameters.enabled = false;
-	g_opcode201Parameters.soundId = 0;
-	g_opcode201Parameters.lastVar105 = 0;
-}
-
-void MystScriptParser_Myst::opcode_201(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	// Used for Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes)
-	if (argc == 1) {
-		g_opcode201Parameters.soundId = argv[0];
-		g_opcode201Parameters.lastVar105 = 0;
-		g_opcode201Parameters.enabled = true;
-	} else
-		unknown(op, var, argc, argv);
-}
-
 void MystScriptParser_Myst::towerRotationMap_run() {
 	if (!_towerRotationMapInitialized) {
 		_towerRotationMapInitialized = true;
@@ -2505,38 +2487,15 @@
 	_tempVar = 0;
 }
 
-void MystScriptParser_Myst::opcode_204(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser_Myst::o_shipAccess_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
 
-	// Used for Card 4134 and 4149 (Dock)
-}
-
-static struct {
-	bool enabled;
-} g_opcode205Parameters;
-
-void MystScriptParser_Myst::opcode_205_run(void) {
-	if (g_opcode205Parameters.enabled) {
-		// Used for Card 4532 (Rocketship Piano)
-		// TODO: Fill in function...
+	// Enable acces to the ship
+	if (myst.shipFloating) {
+		_invokingResource->setEnabled(true);
 	}
 }
 
-void MystScriptParser_Myst::opcode_205_disable(void) {
-	g_opcode205Parameters.enabled = false;
-}
-
-void MystScriptParser_Myst::opcode_205(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	// Used for Card 4532 (Rocketship Piano)
-
-	if (argc == 0)
-		g_opcode205Parameters.enabled = true;
-	else
-		unknown(op, var, argc, argv);
-}
-
 void MystScriptParser_Myst::opcode_206(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	varUnusedCheck(op, var);
 

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-19 02:27:09 UTC (rev 54958)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-19 07:02:02 UTC (rev 54959)
@@ -51,11 +51,7 @@
 	void toggleVar(uint16 var);
 	bool setVarValue(uint16 var, uint16 value);
 
-	void opcode_201_run();
-	void opcode_201_disable();
 	void towerRotationMap_run();
-	void opcode_205_run();
-	void opcode_205_disable();
 	void libraryBookcaseTransform_run();
 	void generatorControlRoom_run();
 	void opcode_212_run();
@@ -73,7 +69,7 @@
 	DECLARE_OPCODE(o_libraryBookPageTurnRight);
 	DECLARE_OPCODE(o_fireplaceToggleButton);
 	DECLARE_OPCODE(o_fireplaceRotation);
-	DECLARE_OPCODE(opcode_105);
+	DECLARE_OPCODE(o_courtyardBoxesCheckSolution);
 	DECLARE_OPCODE(o_towerRotationStart);
 	DECLARE_OPCODE(o_towerRotationEnd);
 	DECLARE_OPCODE(opcode_109);
@@ -133,8 +129,8 @@
 	DECLARE_OPCODE(opcode_177);
 	DECLARE_OPCODE(o_libraryCombinationBookStop);
 	DECLARE_OPCODE(o_cabinMatchLight);
-	DECLARE_OPCODE(opcode_183);
-	DECLARE_OPCODE(opcode_184);
+	DECLARE_OPCODE(o_courtyardBoxEnter);
+	DECLARE_OPCODE(o_courtyardBoxLeave);
 	DECLARE_OPCODE(o_clockMinuteWheelStartTurn);
 	DECLARE_OPCODE(o_clockWheelEndTurn);
 	DECLARE_OPCODE(o_clockHourWheelStartTurn);
@@ -149,10 +145,10 @@
 	DECLARE_OPCODE(opcode_199);
 
 	DECLARE_OPCODE(o_libraryBook_init);
-	DECLARE_OPCODE(opcode_201);
+	DECLARE_OPCODE(o_courtyardBox_init);
 	DECLARE_OPCODE(o_towerRotationMap_init);
 	DECLARE_OPCODE(o_forechamberDoor_init);
-	DECLARE_OPCODE(opcode_204);
+	DECLARE_OPCODE(o_shipAccess_init);
 	DECLARE_OPCODE(opcode_205);
 	DECLARE_OPCODE(opcode_206);
 	DECLARE_OPCODE(opcode_208);
@@ -206,6 +202,8 @@
 	uint16 _libraryBookSound1; // 298
 	uint16 _libraryBookSound2; // 300
 
+	uint16 _courtyardBoxSound; // 302
+
 	uint16 _fireplaceLines[6]; // 74 to 84
 
 	uint16 _clockTurningWheel;
@@ -239,7 +237,6 @@
 	uint16 _treeMinPosition; // 228
 	uint16 _treeMinAccessiblePosition; // 230
 	uint16 _treeMaxAccessiblePosition; // 232
-	uint32 _treeLastMoveTime;
 
 	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