[Scummvm-cvs-logs] SF.net SVN: scummvm:[54934] scummvm/trunk/engines/mohawk
bgk at users.sourceforge.net
bgk at users.sourceforge.net
Thu Dec 16 17:13:50 CET 2010
Revision: 54934
http://scummvm.svn.sourceforge.net/scummvm/?rev=54934&view=rev
Author: bgk
Date: 2010-12-16 16:13:50 +0000 (Thu, 16 Dec 2010)
Log Message:
-----------
MOHAWK: Implement Myst opcodes 146, 149, 150, 150 : Minimal boiler
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
scummvm/trunk/engines/mohawk/myst_stacks/myst.h
scummvm/trunk/engines/mohawk/sound.h
Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp 2010-12-16 16:12:38 UTC (rev 54933)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp 2010-12-16 16:13:50 UTC (rev 54934)
@@ -48,6 +48,7 @@
_dockVaultState = 0;
_cabinMatchState = 2;
_matchBurning = false;
+ _treeStopped = false;
}
MystScriptParser_Myst::~MystScriptParser_Myst() {
@@ -91,12 +92,12 @@
OPCODE(141, o_circuitBreakerStartMove);
OPCODE(142, o_circuitBreakerMove);
OPCODE(143, o_circuitBreakerEndMove);
- OPCODE(146, opcode_146);
+ OPCODE(146, o_boilerIncreasePressureStart);
OPCODE(147, o_boilerLightPilot);
OPCODE(148, NOP);
- OPCODE(149, opcode_149);
- OPCODE(150, opcode_150);
- OPCODE(151, opcode_151);
+ OPCODE(149, o_boilerIncreasePressureStop);
+ OPCODE(150, o_boilerDecreasePressureStart);
+ OPCODE(151, o_boilerDecreasePressureStop);
OPCODE(158, o_rocketSoundSliderStartMove);
OPCODE(159, o_rocketSoundSliderMove);
OPCODE(160, o_rocketSoundSliderEndMove);
@@ -182,6 +183,8 @@
_libraryCombinationBookPagesTurning = false;
_clockTurningWheel = 0;
_towerRotationMapRunning = false;
+ _boilerPressureIncreasing = false;
+ _boilerPressureDecreasing = false;
opcode_212_disable();
}
@@ -209,6 +212,12 @@
if (_matchBurning)
matchBurn_run();
+ if (_boilerPressureIncreasing)
+ boilerPressureIncrease_run();
+
+ if (_boilerPressureDecreasing)
+ boilerPressureDecrease_run();
+
opcode_212_run();
}
@@ -1300,9 +1309,15 @@
_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
+void MystScriptParser_Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Boiler increase pressure start", op);
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
+ _treeStopped = true;
+ if (myst.cabinValvePosition < 25)
+ _vm->_sound->stopBackground();
+
+ _boilerPressureIncreasing = true;
}
void MystScriptParser_Myst::o_boilerLightPilot(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -1317,25 +1332,105 @@
// Put out match
_matchGoOutTime = _vm->_system->getMillis();
- // TODO: Complete. Play fire movie. Handle case where pressure is already right
+ if (myst.cabinValvePosition > 0)
+ _vm->_sound->replaceBackground(8098, 49152);
+
+ // TODO: Complete. Play movies
}
}
-void MystScriptParser_Myst::opcode_149(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4098
- // TODO: Boiler wheel clockwise mouse up
+void MystScriptParser_Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Boiler increase pressure stop", op);
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
+ _treeStopped = false;
+ _boilerPressureIncreasing = false;
+
+ if (myst.cabinPilotLightLit == 1) {
+ if (myst.cabinValvePosition > 0)
+ _vm->_sound->replaceBackground(8098, 49152);
+
+ // TODO: Play movies
+ } else {
+ if (myst.cabinValvePosition > 0)
+ _vm->_sound->replaceBackground(4098, myst.cabinValvePosition << 10);
+ }
}
-void MystScriptParser_Myst::opcode_150(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4098
- // TODO: Boiler wheel counter-clockwise mouse down
+void MystScriptParser_Myst::boilerPressureIncrease_run() {
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
+ // Allow increasing pressure if sound has stopped
+ if (!_vm->_sound->isPlaying(5098) && myst.cabinValvePosition < 25) {
+ myst.cabinValvePosition++;
+ if (myst.cabinValvePosition == 1) {
+ // TODO: Play fire movie
+
+ // Draw fire
+ _vm->redrawArea(305);
+ } else if (myst.cabinValvePosition == 25) {
+ if (myst.cabinPilotLightLit == 1)
+ _vm->_sound->replaceBackground(8098, 49152);
+ else
+ _vm->_sound->replaceBackground(4098, 25600);
+ }
+
+ // Pressure increasing sound
+ _vm->_sound->playSound(5098);
+
+ // Redraw wheel
+ _vm->redrawArea(99);
+ }
}
-void MystScriptParser_Myst::opcode_151(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4098
- // TODO: Boiler wheel counter-clockwise mouse up
+void MystScriptParser_Myst::boilerPressureDecrease_run() {
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
+ // Allow increasing pressure if sound has stopped
+ if (!_vm->_sound->isPlaying(5098) && myst.cabinValvePosition > 0) {
+ myst.cabinValvePosition--;
+ if (myst.cabinValvePosition == 0) {
+ // TODO: Play fire movie
+
+ // Draw fire
+ _vm->redrawArea(305);
+ }
+
+ // Pressure increasing sound
+ _vm->_sound->playSound(5098);
+
+ // Redraw wheel
+ _vm->redrawArea(99);
+ }
}
+void MystScriptParser_Myst::o_boilerDecreasePressureStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Boiler decrease pressure start", op);
+
+ _treeStopped = true;
+ _vm->_sound->stopBackground();
+
+ _boilerPressureDecreasing = true;
+}
+
+void MystScriptParser_Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Boiler decrease pressure stop", op);
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
+ _treeStopped = false;
+ _boilerPressureDecreasing = false;
+
+ if (myst.cabinPilotLightLit == 1) {
+ if (myst.cabinValvePosition > 0)
+ _vm->_sound->replaceBackground(8098, 49152);
+
+ // TODO: Play movies
+ } else {
+ if (myst.cabinValvePosition > 0)
+ _vm->_sound->replaceBackground(4098, myst.cabinValvePosition << 10);
+ }
+}
+
void MystScriptParser_Myst::o_rocketSoundSliderStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Rocket slider start move", op);
Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.h 2010-12-16 16:12:38 UTC (rev 54933)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.h 2010-12-16 16:13:50 UTC (rev 54934)
@@ -63,8 +63,9 @@
void libraryCombinationBook_run();
void clockWheel_run();
void matchBurn_run();
+ void boilerPressureIncrease_run();
+ void boilerPressureDecrease_run();
-
DECLARE_OPCODE(o_libraryBookPageTurnLeft);
DECLARE_OPCODE(o_libraryBookPageTurnRight);
DECLARE_OPCODE(o_fireplaceToggleButton);
@@ -97,11 +98,11 @@
DECLARE_OPCODE(o_circuitBreakerStartMove);
DECLARE_OPCODE(o_circuitBreakerMove);
DECLARE_OPCODE(o_circuitBreakerEndMove);
- DECLARE_OPCODE(opcode_146);
+ DECLARE_OPCODE(o_boilerIncreasePressureStart);
DECLARE_OPCODE(o_boilerLightPilot);
- DECLARE_OPCODE(opcode_149);
- DECLARE_OPCODE(opcode_150);
- DECLARE_OPCODE(opcode_151);
+ DECLARE_OPCODE(o_boilerIncreasePressureStop);
+ DECLARE_OPCODE(o_boilerDecreasePressureStart);
+ DECLARE_OPCODE(o_boilerDecreasePressureStop);
DECLARE_OPCODE(o_rocketSoundSliderStartMove);
DECLARE_OPCODE(o_rocketSoundSliderMove);
DECLARE_OPCODE(o_rocketSoundSliderEndMove);
@@ -215,6 +216,11 @@
uint16 _cabinMatchState; // 60
uint32 _matchGoOutTime; // 144
+ bool _boilerPressureIncreasing;
+ bool _boilerPressureDecreasing;
+
+ bool _treeStopped;
+
void generatorRedrawRocket();
void generatorButtonValue(MystResource *button, uint16 &offset, uint16 &value);
Modified: scummvm/trunk/engines/mohawk/sound.h
===================================================================
--- scummvm/trunk/engines/mohawk/sound.h 2010-12-16 16:12:38 UTC (rev 54933)
+++ scummvm/trunk/engines/mohawk/sound.h 2010-12-16 16:13:50 UTC (rev 54934)
@@ -130,7 +130,9 @@
bool isPlaying(uint16 id);
void pauseBackground() {} //TODO: implement
+ void replaceBackground(uint16 id, uint16 volume) {}
void resumeBackground() {}
+ void stopBackground() {}
// Riven-specific
void playSLST(uint16 index, uint16 card);
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