aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/graphics.cpp30
-rw-r--r--engines/mohawk/myst_areas.cpp3
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp393
-rw-r--r--engines/mohawk/myst_stacks/myst.h29
-rw-r--r--engines/mohawk/myst_state.cpp2
5 files changed, 374 insertions, 83 deletions
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index 7f0e9a0a14..5abfb9607b 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -417,10 +417,6 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm
}
void MystGraphics::copyImageSectionToBackBuffer(uint16 image, Common::Rect src, Common::Rect dest) {
- // Clip the destination rect to the screen
- if (dest.right > _vm->_system->getWidth() || dest.bottom > _vm->_system->getHeight())
- dest.debugPrint(4, "Clipping destination rect to the screen:");
-
Graphics::Surface *surface = findImage(image)->getSurface();
// Make sure the image is bottom aligned in the dest rect
@@ -434,20 +430,30 @@ void MystGraphics::copyImageSectionToBackBuffer(uint16 image, Common::Rect src,
top += dest.height() - _viewport.height();
}
+ // Clip the destination rect to the screen
+ if (dest.right > _vm->_system->getWidth() || dest.bottom > _vm->_system->getHeight())
+ dest.debugPrint(4, "Clipping destination rect to the screen");
dest.right = CLIP<int>(dest.right, 0, _vm->_system->getWidth());
dest.bottom = CLIP<int>(dest.bottom, 0, _vm->_system->getHeight());
- debug(3, "Image Blit:");
- debug(3, "src.x: %d", src.left);
- debug(3, "src.y: %d", src.top);
- debug(3, "dest.x: %d", dest.left);
- debug(3, "dest.y: %d", dest.top);
- debug(3, "width: %d", src.width());
- debug(3, "height: %d", src.height());
-
uint16 width = MIN<int>(surface->w, dest.width());
uint16 height = MIN<int>(surface->h, dest.height());
+ // Clamp Width and Height to within src surface dimensions
+ if (src.left + width > surface->w)
+ width = surface->w - src.left;
+ if (src.top + height > surface->h)
+ height = surface->h - src.top;
+
+ debug(3, "MystGraphics::copyImageSectionToScreen()");
+ debug(3, "\tImage: %d", image);
+ debug(3, "\tsrc.left: %d", src.left);
+ debug(3, "\tsrc.top: %d", src.top);
+ debug(3, "\tdest.left: %d", dest.left);
+ debug(3, "\tdest.top: %d", dest.top);
+ debug(3, "\twidth: %d", width);
+ debug(3, "\theight: %d", height);
+
for (uint16 i = 0; i < height; i++)
memcpy(_backBuffer->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->bytesPerPixel);
}
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index d8e3fe3b9e..701e3f4884 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -658,6 +658,9 @@ MystResourceType11::MystResourceType11(MohawkEngine_Myst *vm, Common::SeekableRe
}
}
+ _stepH = 0;
+ _stepV = 0;
+
if (_stepsH) {
_stepH = (_maxH - _minH) / (_stepsH - 1);
}
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 8f591bdbd5..af0ad1f526 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -57,6 +57,7 @@ MystScriptParser_Myst::MystScriptParser_Myst(MohawkEngine_Myst *vm) :
_treeStopped = false;
_treeMinPosition = 0;
_imagerValidationStep = 0;
+ _observatoryCurrentSlider = 0;
_state.treeLastMoveTime = _vm->_system->getMillis();
}
@@ -90,10 +91,17 @@ void MystScriptParser_Myst::setupOpcodes() {
OPCODE(123, o_cabinSafeHandleMove);
OPCODE(124, o_cabinSafeHandleEndMove);
OPCODE(128, o_treePressureReleaseStart);
- OPCODE(129, opcode_129);
- OPCODE(130, opcode_130);
- OPCODE(131, opcode_131);
- OPCODE(132, opcode_132);
+ if (!observatoryIsDDMMYYYY2400()) {
+ OPCODE(129, o_observatoryMonthChangeStart);
+ OPCODE(130, o_observatoryMonthChangeStart);
+ OPCODE(131, o_observatoryDayChangeStart);
+ OPCODE(132, o_observatoryDayChangeStart);
+ } else {
+ OPCODE(129, o_observatoryDayChangeStart);
+ OPCODE(130, o_observatoryDayChangeStart);
+ OPCODE(131, o_observatoryMonthChangeStart);
+ OPCODE(132, o_observatoryMonthChangeStart);
+ }
OPCODE(133, opcode_133);
OPCODE(134, opcode_134);
OPCODE(135, opcode_135);
@@ -146,12 +154,12 @@ void MystScriptParser_Myst::setupOpcodes() {
OPCODE(189, o_clockHourWheelStartTurn);
OPCODE(190, o_libraryCombinationBookStartRight);
OPCODE(191, o_libraryCombinationBookStartLeft);
- OPCODE(192, opcode_192);
+ OPCODE(192, o_observatoryTimeChangeStart);
OPCODE(193, NOP);
- OPCODE(194, opcode_194);
- OPCODE(195, opcode_195);
- OPCODE(196, opcode_196);
- OPCODE(197, opcode_197);
+ OPCODE(194, o_observatoryChangeSettingStop);
+ OPCODE(195, o_observatoryTimeChangeStart);
+ OPCODE(196, o_observatoryYearChangeStart);
+ OPCODE(197, o_observatoryYearChangeStart);
OPCODE(198, o_dockVaultForceClose);
OPCODE(199, opcode_199);
@@ -208,6 +216,10 @@ void MystScriptParser_Myst::disablePersistentScripts() {
_imagerValidationRunning = false;
_imagerRunning = false;
_observatoryRunning = false;
+ _observatoryMonthChanging = false;
+ _observatoryDayChanging = false;
+ _observatoryYearChanging = false;
+ _observatoryTimeChanging = false;
opcode_212_disable();
}
@@ -256,6 +268,18 @@ void MystScriptParser_Myst::runPersistentScripts() {
if (_observatoryRunning)
observatory_run();
+
+ if (_observatoryMonthChanging)
+ observatoryMonthChange_run();
+
+ if (_observatoryDayChanging)
+ observatoryDayChange_run();
+
+ if (_observatoryYearChanging)
+ observatoryYearChange_run();
+
+ if (_observatoryTimeChanging)
+ observatoryTimeChange_run();
}
uint16 MystScriptParser_Myst::getVar(uint16 var) {
@@ -483,20 +507,41 @@ uint16 MystScriptParser_Myst::getVar(uint16 var) {
case 75: // Stellar Observatory Date - Day #2 (Right)
return _state.observatoryDaySetting % 10;
case 76: // Stellar Observatory Date - Year #1 (Left)
- return (_state.observatoryYearSetting >> 12) & 0x0f;
+ if (_state.observatoryYearSetting >= 1000)
+ return (_state.observatoryYearSetting / 1000) % 10;
+ else
+ return 10;
case 77: // Stellar Observatory Date - Year #2
- return (_state.observatoryYearSetting >> 8) & 0x0f;
+ if (_state.observatoryYearSetting >= 100)
+ return (_state.observatoryYearSetting / 100) % 10;
+ else
+ return 10;
case 78: // Stellar Observatory Date - Year #3
- return (_state.observatoryYearSetting >> 4) & 0x0f;
+ if (_state.observatoryYearSetting >= 10)
+ return (_state.observatoryYearSetting / 10) % 10;
+ else
+ return 10;
case 79: // Stellar Observatory Date - Year #4 (Right)
- return (_state.observatoryYearSetting >> 0) & 0x0f;
+ return (_state.observatoryYearSetting / 1) % 10;
case 80: // Stellar Observatory Hour #1 - Left ( Number 1 (0) or Blank (10))
- if (_state.observatoryTimeSetting % (12 * 60) < (10 * 60))
- return 10;
- else
- return 0;
+ if (!observatoryIsDDMMYYYY2400()) {
+ if (_state.observatoryTimeSetting % (12 * 60) < (10 * 60))
+ return 10;
+ else
+ return 1;
+ } else {
+ if (_state.observatoryTimeSetting < (10 * 60))
+ return 10;
+ else if (_state.observatoryTimeSetting < (20 * 60))
+ return 1;
+ else
+ return 2;
+ }
case 81: // Stellar Observatory Hour #2 - Right
- return ((_state.observatoryTimeSetting % (12 * 60)) / 60) % 10;
+ if (!observatoryIsDDMMYYYY2400())
+ return ((_state.observatoryTimeSetting % (12 * 60)) / 60) % 10;
+ else
+ return (_state.observatoryTimeSetting / 60) % 10;
case 82: // Stellar Observatory Minutes #1 - Left
return (_state.observatoryTimeSetting % 60) / 10;
case 83: // Stellar Observatory Minutes #2 - Right
@@ -1427,27 +1472,236 @@ void MystScriptParser_Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, uint
_vm->checkCursorHints();
}
-void MystScriptParser_Myst::opcode_129(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Month increase
+void MystScriptParser_Myst::o_observatoryMonthChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Observatory month change start", op);
+
+ _vm->_sound->pauseBackground();
+
+ if (op == 129 || op == 131) {
+ // Increase
+ if (observatoryIsDDMMYYYY2400())
+ _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(36, 0, 48, 9), Common::Rect(351, 70, 363, 79));
+ else
+ _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(0, 0, 12, 9), Common::Rect(315, 70, 327, 79));
+
+ _observatoryIncrement = -1;
+ } else {
+ // Decrease
+ if (observatoryIsDDMMYYYY2400())
+ _vm->_gfx->copyImageSectionToScreen(11097, Common::Rect(36, 0, 48, 9), Common::Rect(351, 204, 363, 213));
+ else
+ _vm->_gfx->copyImageSectionToScreen(11097, Common::Rect(0, 0, 12, 9), Common::Rect(315, 204, 327, 213));
+
+ _observatoryIncrement = 1;
+ }
+
+ // Highlight slider
+ _observatoryMonthSlider->drawConditionalDataToScreen(2);
+ _observatoryCurrentSlider = _observatoryMonthSlider;
+
+ // First increment
+ observatoryIncrementMonth(_observatoryIncrement);
+
+ // Start persistent script
+ _startTime = _vm->_system->getMillis();
+ _observatoryMonthChanging = true;
}
-void MystScriptParser_Myst::opcode_130(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Month decrease
+void MystScriptParser_Myst::observatoryIncrementMonth(int16 increment) {
+ int16 newMonth = _state.observatoryMonthSetting + increment;
+
+ if (newMonth >= 0 && newMonth <= 11) {
+ _state.observatoryMonthSetting = newMonth;
+
+ // Redraw digits
+ _vm->redrawArea(73);
+
+ // Update slider
+ _observatoryMonthSlider->setPosition(94 + 94 * _state.observatoryMonthSetting / 11);
+ _observatoryMonthSlider->restoreBackground();
+ _observatoryMonthSlider->drawConditionalDataToScreen(2);
+ _state.observatoryMonthSlider = _observatoryMonthSlider->_pos.y;
+ }
+ _vm->_sound->replaceSound(8500);
}
-void MystScriptParser_Myst::opcode_131(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Day increase
+void MystScriptParser_Myst::observatoryMonthChange_run() {
+ if (_startTime + 500 < _vm->_system->getMillis())
+ observatoryIncrementMonth(_observatoryIncrement);
}
-void MystScriptParser_Myst::opcode_132(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Day decrease
+void MystScriptParser_Myst::o_observatoryDayChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Observatory day change start", op);
+
+ _vm->_sound->pauseBackground();
+
+ if (op == 129 || op == 131) {
+ // Increase
+ if (observatoryIsDDMMYYYY2400())
+ _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(0, 0, 12, 9), Common::Rect(315, 70, 327, 79));
+ else
+ _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(36, 0, 48, 9), Common::Rect(351, 70, 363, 79));
+
+ _observatoryIncrement = -1;
+ } else {
+ // Decrease
+ if (observatoryIsDDMMYYYY2400())
+ _vm->_gfx->copyImageSectionToScreen(11097, Common::Rect(0, 0, 12, 9), Common::Rect(315, 204, 327, 213));
+ else
+ _vm->_gfx->copyImageSectionToScreen(11097, Common::Rect(36, 0, 48, 9), Common::Rect(351, 204, 363, 213));
+
+ _observatoryIncrement = 1;
+ }
+
+ // Highlight slider
+ _observatoryDaySlider->drawConditionalDataToScreen(2);
+ _observatoryCurrentSlider = _observatoryDaySlider;
+
+ // First increment
+ observatoryIncrementDay(_observatoryIncrement);
+
+ // Start persistent script
+ _startTime = _vm->_system->getMillis();
+ _observatoryDayChanging = true;
+}
+
+void MystScriptParser_Myst::observatoryIncrementDay(int16 increment) {
+ int16 newDay = _state.observatoryDaySetting + increment;
+
+ if (newDay >= 1 && newDay <= 31) {
+ _state.observatoryDaySetting = newDay;
+
+ // Redraw digits
+ _vm->redrawArea(75);
+ _vm->redrawArea(74);
+
+ // Update slider
+ _observatoryDaySlider->setPosition(91 + 3 * _state.observatoryDaySetting);
+ _observatoryDaySlider->restoreBackground();
+ _observatoryDaySlider->drawConditionalDataToScreen(2);
+ _state.observatoryDaySlider = _observatoryDaySlider->_pos.y;
+ }
+ _vm->_sound->replaceSound(8500);
+}
+
+void MystScriptParser_Myst::observatoryDayChange_run() {
+ if (_startTime + 500 < _vm->_system->getMillis())
+ observatoryIncrementDay(_observatoryIncrement);
+}
+
+void MystScriptParser_Myst::o_observatoryYearChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Observatory year change start", op);
+
+ _vm->_sound->pauseBackground();
+
+ if (op == 196) {
+ // Increase
+ _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(72, 0, 84, 9), Common::Rect(387, 70, 399, 79));
+ _observatoryIncrement = -1;
+ } else {
+ // Decrease
+ _vm->_gfx->copyImageSectionToScreen(11097, Common::Rect(72, 0, 84, 9), Common::Rect(387, 204, 399, 213));
+ _observatoryIncrement = 1;
+ }
+
+ // Highlight slider
+ _observatoryYearSlider->drawConditionalDataToScreen(2);
+ _observatoryCurrentSlider = _observatoryYearSlider;
+
+ // First increment
+ observatoryIncrementYear(_observatoryIncrement);
+
+ // Start persistent script
+ _startTime = _vm->_system->getMillis();
+ _observatoryYearChanging = true;
+}
+
+void MystScriptParser_Myst::observatoryIncrementYear(int16 increment) {
+ int16 newYear = _state.observatoryYearSetting + increment;
+
+ if (newYear >= 0 && newYear <= 9999) {
+ _state.observatoryYearSetting = newYear;
+
+ // Redraw digits
+ _vm->redrawArea(79);
+ _vm->redrawArea(78);
+ _vm->redrawArea(77);
+ _vm->redrawArea(76);
+
+ // Update slider
+ _observatoryYearSlider->setPosition(94 + 94 * _state.observatoryYearSetting / 9999);
+ _observatoryYearSlider->restoreBackground();
+ _observatoryYearSlider->drawConditionalDataToScreen(2);
+ _state.observatoryYearSlider = _observatoryYearSlider->_pos.y;
+ }
+ _vm->_sound->replaceSound(8500);
+}
+
+void MystScriptParser_Myst::observatoryYearChange_run() {
+ if (_startTime + 500 < _vm->_system->getMillis())
+ observatoryIncrementYear(_observatoryIncrement);
+}
+
+void MystScriptParser_Myst::o_observatoryTimeChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Observatory time change start", op);
+
+ _vm->_sound->pauseBackground();
+
+ if (op == 192) {
+ // Increase
+ _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(109, 0, 121, 9), Common::Rect(424, 70, 436, 79));
+ _observatoryIncrement = -1;
+ } else {
+ // Decrease
+ _vm->_gfx->copyImageSectionToScreen(11097, Common::Rect(109, 0, 121, 9), Common::Rect(424, 204, 436, 213));
+ _observatoryIncrement = 1;
+ }
+
+ // Highlight slider
+ _observatoryTimeSlider->drawConditionalDataToScreen(2);
+ _observatoryCurrentSlider = _observatoryTimeSlider;
+
+ // First increment
+ observatoryIncrementTime(_observatoryIncrement);
+
+ // Start persistent script
+ _startTime = _vm->_system->getMillis();
+ _observatoryTimeChanging = true;
+}
+
+void MystScriptParser_Myst::observatoryIncrementTime(int16 increment) {
+ int16 newTime = _state.observatoryTimeSetting + increment;
+
+ if (newTime >= 0 && newTime <= 1439) {
+ _state.observatoryTimeSetting = newTime;
+
+ // Redraw digits
+ _vm->redrawArea(80);
+ _vm->redrawArea(81);
+ _vm->redrawArea(82);
+ _vm->redrawArea(83);
+
+ // Draw AM/PM
+ if (!observatoryIsDDMMYYYY2400()) {
+ _vm->redrawArea(88);
+ }
+
+ // Update slider
+ _observatoryTimeSlider->setPosition(94 + 94 * _state.observatoryTimeSetting / 1439);
+ _observatoryTimeSlider->restoreBackground();
+ _observatoryTimeSlider->drawConditionalDataToScreen(2);
+ _state.observatoryTimeSlider = _observatoryTimeSlider->_pos.y;
+ }
+ _vm->_sound->replaceSound(8500);
+}
+
+void MystScriptParser_Myst::observatoryTimeChange_run() {
+ if (_startTime + 500 < _vm->_system->getMillis())
+ observatoryIncrementTime(_observatoryIncrement);
}
void MystScriptParser_Myst::opcode_133(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Observatory go button", op);
varUnusedCheck(op, var);
// Used on Card 4500 (Stellar Observatory Controls)
@@ -2341,29 +2595,23 @@ void MystScriptParser_Myst::libraryCombinationBook_run() {
}
}
-void MystScriptParser_Myst::opcode_192(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Time increase
-}
+void MystScriptParser_Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Observatory change setting stop", op);
-void MystScriptParser_Myst::opcode_194(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Constellation drawing
-}
-
-void MystScriptParser_Myst::opcode_195(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Time decrease
-}
-
-void MystScriptParser_Myst::opcode_196(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Year increase
-}
+ // Stop persistent scripts
+ _observatoryMonthChanging = false;
+ _observatoryDayChanging = false;
+ _observatoryYearChanging = false;
+ _observatoryTimeChanging = false;
+ _observatoryIncrement = 0;
-void MystScriptParser_Myst::opcode_197(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 4500
- // TODO: Year decrease
+ // Restore button and slider
+ _vm->_gfx->copyBackBufferToScreen(_invokingResource->getRect());
+ if (_observatoryCurrentSlider) {
+ _vm->redrawResource(_observatoryCurrentSlider);
+ _observatoryCurrentSlider = 0;
+ }
+ _vm->_sound->resumeBackground();
}
void MystScriptParser_Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -2739,8 +2987,13 @@ void MystScriptParser_Myst::o_observatory_init(uint16 op, uint16 var, uint16 arg
_observatoryNotInitialized = true;
_observatoryVisualizer = static_cast<MystResourceType8 *>(_invokingResource);
_observatoryGoButton = static_cast<MystResourceType8 *>(_vm->_resources[argv[0]]);
- _observatoryDaySlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[1]]);
- _observatoryMonthSlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[2]]);
+ if (observatoryIsDDMMYYYY2400()) {
+ _observatoryDaySlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[1]]);
+ _observatoryMonthSlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[2]]);
+ } else {
+ _observatoryMonthSlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[1]]);
+ _observatoryDaySlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[2]]);
+ }
_observatoryYearSlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[3]]);
_observatoryTimeSlider = static_cast<MystResourceType10 *>(_vm->_resources[argv[4]]);
@@ -2757,6 +3010,10 @@ void MystScriptParser_Myst::o_observatory_init(uint16 op, uint16 var, uint16 arg
_observatoryRunning = true;
}
+bool MystScriptParser_Myst::observatoryIsDDMMYYYY2400() {
+ return !(_vm->getFeatures() & GF_ME) && _vm->getLanguage() == Common::FR_FRA;
+}
+
void MystScriptParser_Myst::observatoryUpdateVisualizer(uint16 x, uint16 y) {
Common::Rect &visu0 = _observatoryVisualizer->_subImages[0].rect;
Common::Rect &visu1 = _observatoryVisualizer->_subImages[1].rect;
@@ -2793,15 +3050,27 @@ void MystScriptParser_Myst::observatory_run() {
_vm->_cursor->hideCursor();
// Make sliders "initialize"
- _vm->_sound->replaceSound(8500);
- _observatoryDaySlider->drawConditionalDataToScreen(2);
- _vm->_system->delayMillis(200);
- _vm->redrawResource(_observatoryDaySlider);
-
- _vm->_sound->replaceSound(8500);
- _observatoryMonthSlider->drawConditionalDataToScreen(2);
- _vm->_system->delayMillis(200);
- _vm->redrawResource(_observatoryMonthSlider);
+ if (observatoryIsDDMMYYYY2400()) {
+ _vm->_sound->replaceSound(8500);
+ _observatoryDaySlider->drawConditionalDataToScreen(2);
+ _vm->_system->delayMillis(200);
+ _vm->redrawResource(_observatoryDaySlider);
+
+ _vm->_sound->replaceSound(8500);
+ _observatoryMonthSlider->drawConditionalDataToScreen(2);
+ _vm->_system->delayMillis(200);
+ _vm->redrawResource(_observatoryMonthSlider);
+ } else {
+ _vm->_sound->replaceSound(8500);
+ _observatoryMonthSlider->drawConditionalDataToScreen(2);
+ _vm->_system->delayMillis(200);
+ _vm->redrawResource(_observatoryMonthSlider);
+
+ _vm->_sound->replaceSound(8500);
+ _observatoryDaySlider->drawConditionalDataToScreen(2);
+ _vm->_system->delayMillis(200);
+ _vm->redrawResource(_observatoryDaySlider);
+ }
_vm->_sound->replaceSound(8500);
_observatoryYearSlider->drawConditionalDataToScreen(2);
diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h
index 386d2b0f5d..0c70ca6db0 100644
--- a/engines/mohawk/myst_stacks/myst.h
+++ b/engines/mohawk/myst_stacks/myst.h
@@ -67,6 +67,10 @@ private:
void imagerValidation_run();
void imager_run();
void observatory_run();
+ void observatoryMonthChange_run();
+ void observatoryDayChange_run();
+ void observatoryYearChange_run();
+ void observatoryTimeChange_run();
DECLARE_OPCODE(o_libraryBookPageTurnLeft);
DECLARE_OPCODE(o_libraryBookPageTurnRight);
@@ -89,10 +93,8 @@ private:
DECLARE_OPCODE(o_cabinSafeHandleMove);
DECLARE_OPCODE(o_cabinSafeHandleEndMove);
DECLARE_OPCODE(o_treePressureReleaseStart);
- DECLARE_OPCODE(opcode_129);
- DECLARE_OPCODE(opcode_130);
- DECLARE_OPCODE(opcode_131);
- DECLARE_OPCODE(opcode_132);
+ DECLARE_OPCODE(o_observatoryMonthChangeStart);
+ DECLARE_OPCODE(o_observatoryDayChangeStart);
DECLARE_OPCODE(opcode_133);
DECLARE_OPCODE(opcode_134);
DECLARE_OPCODE(opcode_135);
@@ -139,11 +141,9 @@ private:
DECLARE_OPCODE(o_clockHourWheelStartTurn);
DECLARE_OPCODE(o_libraryCombinationBookStartRight);
DECLARE_OPCODE(o_libraryCombinationBookStartLeft);
- DECLARE_OPCODE(opcode_192);
- DECLARE_OPCODE(opcode_194);
- DECLARE_OPCODE(opcode_195);
- DECLARE_OPCODE(opcode_196);
- DECLARE_OPCODE(opcode_197);
+ DECLARE_OPCODE(o_observatoryTimeChangeStart);
+ DECLARE_OPCODE(o_observatoryChangeSettingStop);
+ DECLARE_OPCODE(o_observatoryYearChangeStart);
DECLARE_OPCODE(o_dockVaultForceClose);
DECLARE_OPCODE(opcode_199);
@@ -252,6 +252,10 @@ private:
uint16 _treeMaxAccessiblePosition; // 232
bool _observatoryRunning;
+ bool _observatoryMonthChanging;
+ bool _observatoryDayChanging;
+ bool _observatoryYearChanging;
+ bool _observatoryTimeChanging;
MystResourceType8 *_observatoryVisualizer; // 184
MystResourceType8 *_observatoryGoButton; // 188
MystResourceType10 *_observatoryDaySlider; // 192
@@ -260,6 +264,8 @@ private:
MystResourceType10 *_observatoryTimeSlider; // 204
uint32 _observatoryLastTime; // 208
bool _observatoryNotInitialized; // 212
+ int16 _observatoryIncrement; // 346
+ MystResourceType10 *_observatoryCurrentSlider; // 348
void generatorRedrawRocket();
void generatorButtonValue(MystResource *button, uint16 &offset, uint16 &value);
@@ -285,8 +291,13 @@ private:
void treeSetAlcoveAccessible();
uint32 treeNextMoveDelay(uint16 pressure);
+ bool observatoryIsDDMMYYYY2400();
void observatorySetTargetToSetting();
void observatoryUpdateVisualizer(uint16 x, uint16 y);
+ void observatoryIncrementMonth(int16 increment);
+ void observatoryIncrementDay(int16 increment);
+ void observatoryIncrementYear(int16 increment);
+ void observatoryIncrementTime(int16 increment);
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp
index 0eefe58637..e5522ac72b 100644
--- a/engines/mohawk/myst_state.cpp
+++ b/engines/mohawk/myst_state.cpp
@@ -56,6 +56,8 @@ MystGameState::MystGameState(MohawkEngine_Myst *vm, Common::SaveFileManager *sav
_myst.imagerActive = 1;
// Stellar Observatory Lights - Default to On
_myst.observatoryLights = 1;
+ // First day of month
+ _myst.observatoryDaySetting = 1;
// Stellar Observatory sliders
_myst.observatoryDaySlider = 90;
_myst.observatoryMonthSlider = 90;