aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/myst.cpp31
-rw-r--r--engines/mohawk/myst.h2
-rw-r--r--engines/mohawk/myst_areas.cpp50
-rw-r--r--engines/mohawk/myst_areas.h4
-rw-r--r--engines/mohawk/myst_saveload.cpp13
-rw-r--r--engines/mohawk/myst_saveload.h13
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp247
-rw-r--r--engines/mohawk/myst_stacks/myst.h17
8 files changed, 147 insertions, 230 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index be3a776b60..a2b3d57aa7 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -79,6 +79,7 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_curCard = 0;
_needsUpdate = false;
_curResource = -1;
+ _hoverResource = 0;
_dragResource = 0;
_gfx = NULL;
@@ -550,6 +551,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card, bool updateScreen) {
// Make sure we have the right cursor showing
_dragResource = 0;
+ _hoverResource = 0;
_curResource = -1;
checkCurrentResource();
@@ -576,30 +578,31 @@ void MohawkEngine_Myst::drawResourceRects() {
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();
}
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index d3a6a91e53..fb42938ec3 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -47,6 +47,7 @@ class MystSaveLoad;
class MystOptionsDialog;
class MystResource;
class MystResourceType8;
+class MystResourceType13;
// Engine Debug Flags
enum {
@@ -222,6 +223,7 @@ private:
void drawResourceRects();
void checkCurrentResource();
int16 _curResource;
+ MystResourceType13 *_hoverResource;
uint16 _cursorHintCount;
MystCursorHint *_cursorHints;
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 6377f3255c..d8e3fe3b9e 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -76,7 +76,7 @@ void MystResource::handleMouseUp(const Common::Point &mouse) {
}
bool MystResource::canBecomeActive() {
- return !unreachableZipDest() && (isEnabled() || (_flags & kMystUnknownFlag) || type == kMystHoverArea);
+ return !unreachableZipDest() && (isEnabled() || (_flags & kMystUnknownFlag));
}
bool MystResource::unreachableZipDest() {
@@ -319,46 +319,6 @@ void MystResourceType7::handleMouseDown(const Common::Point &mouse) {
}
}
-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 @@ MystResourceType13::MystResourceType13(MohawkEngine_Myst *vm, Common::SeekableRe
}
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) {
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index 6e84747fe4..bb7a2a3d96 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -82,8 +82,6 @@ public:
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 @@ public:
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:
diff --git a/engines/mohawk/myst_saveload.cpp b/engines/mohawk/myst_saveload.cpp
index a88c1fc763..b99d020449 100644
--- a/engines/mohawk/myst_saveload.cpp
+++ b/engines/mohawk/myst_saveload.cpp
@@ -156,7 +156,7 @@ void MystSaveLoad::syncGameState(Common::Serializer &s, bool isME) {
}
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 @@ void MystSaveLoad::syncGameState(Common::Serializer &s, bool isME) {
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 @@ void MystSaveLoad::syncGameState(Common::Serializer &s, bool isME) {
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]);
diff --git a/engines/mohawk/myst_saveload.h b/engines/mohawk/myst_saveload.h
index 62c17369ee..b8f0bd739f 100644
--- a/engines/mohawk/myst_saveload.h
+++ b/engines/mohawk/myst_saveload.h
@@ -127,7 +127,7 @@ struct MystVariables {
uint32 observatoryMarkerSwitch;
uint32 rocketshipMarkerSwitch;
uint16 greenBookOpenedBefore;
- uint16 shipState;
+ uint16 shipFloating;
uint16 cabinValvePosition;
uint16 clockTowerHourPosition;
uint16 clockTowerMinutePosition;
@@ -139,10 +139,10 @@ struct MystVariables {
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 @@ struct MystVariables {
uint16 observatoryYearTarget;
uint16 cabinSafeCombination;
uint16 treePosition;
- uint16 u4;
- uint16 u5;
+ uint32 treeLastMoveTime;
uint16 rocketSliderPosition[5];
uint16 u6;
uint16 u7;
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 55f66e265c..dfab619139 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -41,6 +41,8 @@ namespace Mohawk {
// 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 @@ MystScriptParser_Myst::MystScriptParser_Myst(MohawkEngine_Myst *vm) : MystScript
_treeAlcove = 0;
_treeStopped = false;
_treeMinPosition = 0;
- _treeLastMoveTime = _vm->_system->getMillis();
+ myst.treeLastMoveTime = _vm->_system->getMillis();
}
MystScriptParser_Myst::~MystScriptParser_Myst() {
@@ -70,7 +72,7 @@ void MystScriptParser_Myst::setupOpcodes() {
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 @@ void MystScriptParser_Myst::setupOpcodes() {
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 @@ void MystScriptParser_Myst::setupOpcodes() {
// "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 @@ void MystScriptParser_Myst::setupOpcodes() {
#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::disablePersistentScripts() {
}
void MystScriptParser_Myst::runPersistentScripts() {
- opcode_201_run();
- opcode_205_run();
opcode_212_run();
if (_towerRotationMapRunning)
@@ -279,8 +276,8 @@ uint16 MystScriptParser_Myst::getVar(uint16 var) {
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 @@ uint16 MystScriptParser_Myst::getVar(uint16 var) {
else
return 2;
case 129:
- if (myst.shipState)
+ if (myst.shipFloating)
return 5;
else
return 3;
@@ -372,6 +369,13 @@ uint16 MystScriptParser_Myst::getVar(uint16 var) {
// 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 @@ uint16 MystScriptParser_Myst::getVar(uint16 var) {
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 @@ void MystScriptParser_Myst::toggleVar(uint16 var) {
}
}
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 @@ void MystScriptParser_Myst::o_fireplaceRotation(uint16 op, uint16 var, uint16 ar
_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);
-
- uint16 soundId = argv[0];
- uint16 boxValue = 0;
- Audio::SoundHandle *handle;
-
- 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);
+void MystScriptParser_Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ uint16 soundId = argv[0];
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
- while (_vm->_mixer->isSoundHandleActive(*handle))
- _vm->_system->delayMillis(10);
+ debugC(kDebugScript, "Opcode %d: Ship Puzzle Logic", op);
+ debugC(kDebugScript, "\tsoundId: %d", soundId);
- _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::o_towerRotationEnd(uint16 op, uint16 var, uint16 arg
}
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);
+
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
- debugC(kDebugScript, "Opcode %d: Add Signed Value to Var", op);
- debugC(kDebugScript, "\tVar: %d", var);
- debugC(kDebugScript, "\tsignedValue: %d", signedValue);
+ int16 signedValue = argv[0];
+ uint16 d1 = (myst.imagerSelection / 10) % 10;
+ uint16 d2 = myst.imagerSelection % 10;
- _vm->_varStore->setVar(var, _vm->_varStore->getVar(var) + signedValue);
- } else
- unknown(op, var, argc, argv);
+ 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 @@ void MystScriptParser_Myst::o_boilerLightPilot(uint16 op, uint16 var, uint16 arg
_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 @@ void MystScriptParser_Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var,
_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 @@ void MystScriptParser_Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var,
_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_basementIncreasePressureStart(uint16 op, uint16 va
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_basementDecreasePressureStart(uint16 op, uint16 va
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 @@ void MystScriptParser_Myst::tree_run() {
|| (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 @@ void MystScriptParser_Myst::tree_run() {
// Check if alcove is accessible
treeSetAlcoveAccessible();
- _treeLastMoveTime = time;
+ myst.treeLastMoveTime = time;
}
}
}
@@ -1945,7 +1964,7 @@ void MystScriptParser_Myst::o_treePressureReleaseStart(uint16 op, uint16 var, ui
if (myst.treePosition >= 4) {
myst.cabinValvePosition = 0;
_treeMinPosition = 4;
- _treeLastMoveTime = 0;
+ myst.treeLastMoveTime = 0;
}
}
@@ -2046,24 +2065,17 @@ void MystScriptParser_Myst::matchBurn_run() {
}
}
-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,40 +2323,10 @@ void MystScriptParser_Myst::o_libraryBook_init(uint16 op, uint16 var, uint16 arg
_libraryBookSound2 = argv[3];
}
-static struct {
- uint16 lastVar105;
- uint16 soundId;
-
- 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);
+void MystScriptParser_Myst::o_courtyardBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Courtyard box init", op);
- g_opcode201Parameters.lastVar105 = var105;
- }
-}
-
-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);
+ _courtyardBoxSound = argv[0];
}
void MystScriptParser_Myst::towerRotationMap_run() {
@@ -2505,38 +2487,15 @@ void MystScriptParser_Myst::o_forechamberDoor_init(uint16 op, uint16 var, uint16
_tempVar = 0;
}
-void MystScriptParser_Myst::opcode_204(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
-
- // Used for Card 4134 and 4149 (Dock)
-}
-
-static struct {
- bool enabled;
-} g_opcode205Parameters;
+void MystScriptParser_Myst::o_shipAccess_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
-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);
diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h
index 19c7200ec7..75af64bc2c 100644
--- a/engines/mohawk/myst_stacks/myst.h
+++ b/engines/mohawk/myst_stacks/myst.h
@@ -51,11 +51,7 @@ private:
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 @@ private:
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 @@ private:
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 @@ private:
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 @@ private:
uint16 _libraryBookSound1; // 298
uint16 _libraryBookSound2; // 300
+ uint16 _courtyardBoxSound; // 302
+
uint16 _fireplaceLines[6]; // 74 to 84
uint16 _clockTurningWheel;
@@ -239,7 +237,6 @@ private:
uint16 _treeMinPosition; // 228
uint16 _treeMinAccessiblePosition; // 230
uint16 _treeMaxAccessiblePosition; // 232
- uint32 _treeLastMoveTime;
void generatorRedrawRocket();
void generatorButtonValue(MystResource *button, uint16 &offset, uint16 &value);