aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2010-12-02 21:16:39 +0000
committerBastien Bouclet2010-12-02 21:16:39 +0000
commitbf82f16982cc6e0f5ea6069f8ec4f9fbbc38739d (patch)
treef0dffdfca701ee652ad1d28fe556f57d77bb617c /engines
parenta9388af99649cffa6301e9f31d5d80f2557a0369 (diff)
downloadscummvm-rg350-bf82f16982cc6e0f5ea6069f8ec4f9fbbc38739d.tar.gz
scummvm-rg350-bf82f16982cc6e0f5ea6069f8ec4f9fbbc38739d.tar.bz2
scummvm-rg350-bf82f16982cc6e0f5ea6069f8ec4f9fbbc38739d.zip
MOHAWK: Implement Myst opcodes 141 to 143, circuit breakers
svn-id: r54741
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp79
-rw-r--r--engines/mohawk/myst_stacks/myst.h3
2 files changed, 82 insertions, 0 deletions
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index c07047e6df..0b94b7432a 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -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 @@ void MystScriptParser_Myst::setupOpcodes() {
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 @@ void MystScriptParser_Myst::opcode_137(uint16 op, uint16 var, uint16 argc, uint1
// 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
diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h
index e3096fdd24..a64c7176dd 100644
--- a/engines/mohawk/myst_stacks/myst.h
+++ b/engines/mohawk/myst_stacks/myst.h
@@ -93,6 +93,9 @@ private:
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);