aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2018-04-02 08:00:59 +0200
committerBastien Bouclet2018-04-02 08:00:59 +0200
commit235893fb44ca8c9d9f29c12db8ae289431ed7e41 (patch)
tree3fd7709f404378a3476cc2f9f6994630aba87357
parent807a8b6cc79f560bcdf054449d254c3b90cd603a (diff)
downloadscummvm-rg350-235893fb44ca8c9d9f29c12db8ae289431ed7e41.tar.gz
scummvm-rg350-235893fb44ca8c9d9f29c12db8ae289431ed7e41.tar.bz2
scummvm-rg350-235893fb44ca8c9d9f29c12db8ae289431ed7e41.zip
MOHAWK: MYST: Implement opcodes 178 and 179
Used when turning pages in the library. Some versions of the game appear to use them. Fixes #10474.
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp44
-rw-r--r--engines/mohawk/myst_stacks/myst.h6
2 files changed, 50 insertions, 0 deletions
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 764fb04eda..c9f09982e1 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -51,6 +51,8 @@ Myst::Myst(MohawkEngine_Myst *vm) :
_towerRotationOverSpot = false;
_libraryBookcaseChanged = false;
+ _libraryBookPagesTurning = false;
+ _libraryCombinationBookPagesTurning = false;
_dockVaultState = 0;
_cabinDoorOpened = 0;
@@ -184,6 +186,8 @@ void Myst::setupOpcodes() {
REGISTER_OPCODE(175, Myst, o_observatoryYearSliderEndMove);
REGISTER_OPCODE(176, Myst, o_observatoryTimeSliderStartMove);
REGISTER_OPCODE(177, Myst, o_observatoryTimeSliderEndMove);
+ REGISTER_OPCODE(178, Myst, o_libraryBookPageTurnStartLeft);
+ REGISTER_OPCODE(179, Myst, o_libraryBookPageTurnStartRight);
REGISTER_OPCODE(180, Myst, o_libraryCombinationBookStop);
REGISTER_OPCODE(181, Myst, NOP);
REGISTER_OPCODE(182, Myst, o_cabinMatchLight);
@@ -246,6 +250,7 @@ void Myst::setupOpcodes() {
void Myst::disablePersistentScripts() {
_libraryBookcaseMoving = false;
_generatorControlRoomRunning = false;
+ _libraryBookPagesTurning = false;
_libraryCombinationBookPagesTurning = false;
_clockTurningWheel = 0;
_towerRotationMapRunning = false;
@@ -277,6 +282,9 @@ void Myst::runPersistentScripts() {
if (_libraryCombinationBookPagesTurning)
libraryCombinationBook_run();
+ if (_libraryBookPagesTurning)
+ libraryBook_run();
+
if (_libraryBookcaseMoving)
libraryBookcaseTransform_run();
@@ -847,6 +855,10 @@ uint16 Myst::bookCountPages(uint16 var) {
}
void Myst::o_libraryBookPageTurnLeft(uint16 var, const ArgumentsArray &args) {
+ libraryBookPageTurnLeft();
+}
+
+void Myst::libraryBookPageTurnLeft() {
if (_libraryBookPage - 1 >= 0) {
_libraryBookPage--;
@@ -861,6 +873,10 @@ void Myst::o_libraryBookPageTurnLeft(uint16 var, const ArgumentsArray &args) {
}
void Myst::o_libraryBookPageTurnRight(uint16 var, const ArgumentsArray &args) {
+ libraryBookPageTurnRight();
+}
+
+void Myst::libraryBookPageTurnRight() {
if (_libraryBookPage + 1 < _libraryBookNumPages) {
_libraryBookPage++;
@@ -2540,7 +2556,35 @@ void Myst::observatoryUpdateTime() {
}
}
+void Myst::o_libraryBookPageTurnStartLeft(uint16 var, const ArgumentsArray &args) {
+ _tempVar = -1;
+ libraryBookPageTurnLeft();
+ _startTime = _vm->_system->getMillis();
+ _libraryBookPagesTurning = true;
+}
+
+void Myst::o_libraryBookPageTurnStartRight(uint16 var, const ArgumentsArray &args) {
+ _tempVar = 1;
+ libraryBookPageTurnRight();
+ _startTime = _vm->_system->getMillis();
+ _libraryBookPagesTurning = true;
+}
+
+void Myst::libraryBook_run() {
+ uint32 time = _vm->_system->getMillis();
+ if (time >= _startTime + 500) {
+ if (_tempVar > 0) {
+ libraryBookPageTurnRight();
+ _startTime = time;
+ } else if (_tempVar < 0) {
+ libraryBookPageTurnLeft();
+ _startTime = time;
+ }
+ }
+}
+
void Myst::o_libraryCombinationBookStop(uint16 var, const ArgumentsArray &args) {
+ _libraryBookPagesTurning = false;
_libraryCombinationBookPagesTurning = false;
}
diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h
index 2cffb39ac3..a74366f17c 100644
--- a/engines/mohawk/myst_stacks/myst.h
+++ b/engines/mohawk/myst_stacks/myst.h
@@ -55,6 +55,7 @@ protected:
virtual void libraryBookcaseTransform_run();
void generatorControlRoom_run();
void libraryCombinationBook_run();
+ void libraryBook_run();
void clockWheel_run();
void matchBurn_run();
void boilerPressureIncrease_run();
@@ -137,6 +138,8 @@ protected:
DECLARE_OPCODE(o_observatoryYearSliderEndMove);
DECLARE_OPCODE(o_observatoryTimeSliderStartMove);
DECLARE_OPCODE(o_observatoryTimeSliderEndMove);
+ DECLARE_OPCODE(o_libraryBookPageTurnStartLeft);
+ DECLARE_OPCODE(o_libraryBookPageTurnStartRight);
DECLARE_OPCODE(o_libraryCombinationBookStop);
DECLARE_OPCODE(o_cabinMatchLight);
DECLARE_OPCODE(o_courtyardBoxEnter);
@@ -207,6 +210,7 @@ protected:
uint16 _rocketLeverPosition; // 296
VideoEntryPtr _rocketLinkBook; // 268
+ bool _libraryBookPagesTurning;
bool _libraryCombinationBookPagesTurning;
int16 _libraryBookPage; // 86
uint16 _libraryBookNumPages; // 88
@@ -309,6 +313,8 @@ protected:
uint16 rocketSliderGetSound(uint16 pos);
void rocketCheckSolution();
+ void libraryBookPageTurnLeft();
+ void libraryBookPageTurnRight();
void libraryCombinationBookTurnRight();
void libraryCombinationBookTurnLeft();