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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Thu Dec 2 22:16:39 CET 2010


Revision: 54741
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54741&view=rev
Author:   bgk
Date:     2010-12-02 21:16:39 +0000 (Thu, 02 Dec 2010)

Log Message:
-----------
MOHAWK: Implement Myst opcodes 141 to 143, circuit breakers

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-02 21:15:47 UTC (rev 54740)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-02 21:16:39 UTC (rev 54741)
@@ -23,9 +23,11 @@
  *
  */
 
+#include "mohawk/cursors.h"
 #include "mohawk/myst.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
+#include "mohawk/myst_saveload.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/myst.h"
@@ -78,6 +80,9 @@
 	OPCODE(135, opcode_135);
 	OPCODE(136, opcode_136);
 	OPCODE(137, opcode_137);
+	OPCODE(141, o_circuitBreakerStartMove);
+	OPCODE(142, o_circuitBreakerMove);
+	OPCODE(143, o_circuitBreakerEndMove);
 	OPCODE(146, opcode_146);
 	OPCODE(147, opcode_147);
 	OPCODE(149, opcode_149);
@@ -612,6 +617,80 @@
 	// TODO: Time slider movement
 }
 
+void MystScriptParser_Myst::o_circuitBreakerStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Circuit breaker start move", op);
+
+	MystResourceType12 *breaker = static_cast<MystResourceType12 *>(_invokingResource);
+	breaker->drawFrame(0);
+	_vm->_cursor->setCursor(700);
+	_tempVar = 0;
+}
+
+void MystScriptParser_Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Circuit breaker move", op);
+
+	uint16 *mystVars = _vm->_saveLoad->_v->myst_vars;
+	MystResourceType12 *breaker = static_cast<MystResourceType12 *>(_invokingResource);
+
+	int16 maxStep = breaker->getStepsV() - 1;
+	int16 step = ((_vm->_mouse.y - 80) * breaker->getStepsV()) / 65;
+
+	if (step > maxStep)
+		step = maxStep;
+	else if (step < 0)
+		step = 0;
+
+	breaker->drawFrame(step);
+
+	if (_tempVar != step) {
+		_tempVar = step;
+
+		// Breaker switched
+		if (step == maxStep) {
+
+			// Choose breaker
+			if (breaker->getType8Var() == 93) {
+
+				// Voltage is still too high or not broken
+				if (mystVars[17] > 59 || mystVars[15] != 1) {
+					uint16 soundId = breaker->getList2(1);
+					if (soundId)
+						_vm->_sound->playSound(soundId);
+				} else {
+					uint16 soundId = breaker->getList2(0);
+					if (soundId)
+						_vm->_sound->playSound(soundId);
+
+					// Reset breaker state
+					mystVars[15] = 0;
+				}
+			} else {
+				// Voltage is still too high or not broken
+				if (mystVars[17] > 59 || mystVars[15] != 2) {
+					uint16 soundId = breaker->getList2(1);
+					if (soundId)
+						_vm->_sound->playSound(soundId);
+				} else {
+					uint16 soundId = breaker->getList2(0);
+					if (soundId)
+						_vm->_sound->playSound(soundId);
+
+					// Reset breaker state
+					mystVars[15] = 0;
+				}
+			}
+		}
+	}
+}
+
+void MystScriptParser_Myst::o_circuitBreakerEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Circuit breaker end move", op);
+
+	MystResourceType12 *breaker = static_cast<MystResourceType12 *>(_invokingResource);
+	_vm->redrawArea(breaker->getType8Var());
+	_vm->checkCursorHints();
+}
+
 void MystScriptParser_Myst::opcode_146(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	// Used on Card 4098
 	// TODO: Boiler wheel clockwise mouse down

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-02 21:15:47 UTC (rev 54740)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-02 21:16:39 UTC (rev 54741)
@@ -93,6 +93,9 @@
 	DECLARE_OPCODE(opcode_135);
 	DECLARE_OPCODE(opcode_136);
 	DECLARE_OPCODE(opcode_137);
+	DECLARE_OPCODE(o_circuitBreakerStartMove);
+	DECLARE_OPCODE(o_circuitBreakerMove);
+	DECLARE_OPCODE(o_circuitBreakerEndMove);
 	DECLARE_OPCODE(opcode_146);
 	DECLARE_OPCODE(opcode_147);
 	DECLARE_OPCODE(opcode_149);


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