diff options
author | David Turner | 2010-12-21 23:18:38 +0000 |
---|---|---|
committer | David Turner | 2010-12-21 23:18:38 +0000 |
commit | a87c52bdb0d66007f9a2f03777bc1da6ba361ca9 (patch) | |
tree | 5531fa0016f28d14a74430347906a2db6be4c8f4 | |
parent | 43800ebf0c9893454e7e208456acf21cbed44aae (diff) | |
download | scummvm-rg350-a87c52bdb0d66007f9a2f03777bc1da6ba361ca9.tar.gz scummvm-rg350-a87c52bdb0d66007f9a2f03777bc1da6ba361ca9.tar.bz2 scummvm-rg350-a87c52bdb0d66007f9a2f03777bc1da6ba361ca9.zip |
MOHAWK: Add Framework of getVar(), setVar() and toggleVar() to Myst Mechanical Age Script Parser.
svn-id: r54995
-rw-r--r-- | engines/mohawk/myst_stacks/mechanical.cpp | 111 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/mechanical.h | 3 |
2 files changed, 114 insertions, 0 deletions
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp index 3024136463..e1933fbc28 100644 --- a/engines/mohawk/myst_stacks/mechanical.cpp +++ b/engines/mohawk/myst_stacks/mechanical.cpp @@ -26,6 +26,7 @@ #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/mechanical.h" @@ -98,6 +99,116 @@ void MystScriptParser_Mechanical::runPersistentScripts() { opcode_209_run(); } +uint16 MystScriptParser_Mechanical::getVar(uint16 var) { +// MystVariables::Globals &globals = _vm->_saveLoad->_v->globals; + MystVariables::Mechanical &mechanical = _vm->_saveLoad->_v->mechanical; + + switch(var) { + case 0: // Sirrus's Secret Panel State + return mechanical.sirrusPanelState; + case 1: // Achenar's Secret Panel State + return mechanical.achenarPanelState; +// case 3: // Sirrus's Secret Room Crate State +// return 0; +// return 1; +// case 4: // Myst Book Room Staircase State +// return 0; // Staircase Up +// return 1; // Staircase Down +// case 5: // Fortress Position +// return 0; // Island with Code Lock +// return 1; // Island with Last Two Symbols of Code +// return 2; // Island with First Two Symbols of Code +// return 3; // No Island +// case 6: // Fortress Position - Big Cog Visible Through Doorway +// return 0; +// return 1; + case 7: // Fortress Elevator Open + if (mechanical.elevatorRotation == 4) + return 1; // Open + else + return 0; // Closed + case 10: // Fortress Staircase State + return mechanical.staircaseState; + case 11: // Fortress Elevator Rotation Position + return mechanical.elevatorRotation; +// case 12: // Fortress Elevator Rotation Cog Position +// return 0; +// return 1; +// return 2; +// return 3; +// return 4; +// return 5; +// case 15: // Code Lock Execute Button State(?) +// return 0; +// return 1; +// return 2; + case 16: // Code Lock Shape #1 - Left + case 17: // Code Lock Shape #2 + case 18: // Code Lock Shape #3 + case 19: // Code Lock Shape #4 - Right + return mechanical.codeShape[var - 16]; +// case 20: // Crystal Lit Flag - Yellow +// return 0; +// return 1; +// case 21: // Crystal Lit Flag - Green +// return 0; +// return 1; +// case 22: // Crystal Lit Flag - Red +// return 0; +// return 1; +// case 102: // Red Page Present In Age +// globals.heldPage and redPagesInBook? +// return 0; // Page Not Present +// return 1; // Page Present +// case 103: // Blue Page Present In Age +// globals.heldPage and bluePagesInBook? +// return 0; // Page Not Present +// return 1; // Page Present + default: + return MystScriptParser::getVar(var); + } +} + +void MystScriptParser_Mechanical::toggleVar(uint16 var) { +// MystVariables::Globals &globals = _vm->_saveLoad->_v->globals; + MystVariables::Mechanical &mechanical = _vm->_saveLoad->_v->mechanical; + + switch(var) { +// case 3: // Sirrus's Secret Room Crate State +// temp ^= 1; +// case 4: // Code Lock Puzzle Correct / Myst Book Room Staircase State +// temp ^= 1; + case 10: // Fortress Staircase State + mechanical.staircaseState ^= 1; + case 16: // Code Lock Shape #1 - Left + case 17: // Code Lock Shape #2 + case 18: // Code Lock Shape #3 + case 19: // Code Lock Shape #4 - Right + mechanical.codeShape[var - 16] = (mechanical.codeShape[var - 16] + 1) % 10; + break; +// case 102: // Red Page Grab/Release +// globals.heldPage? +// case 103: // Blue Page Grab/Release +// globals.heldPage? + default: + MystScriptParser::toggleVar(var); + break; + } +} + +bool MystScriptParser_Mechanical::setVarValue(uint16 var, uint16 value) { +// MystVariables::Mechanical &mechanical = _vm->_saveLoad->_v->mechanical; + bool refresh = false; + + switch (var) { + default: + refresh = MystScriptParser::setVarValue(var, value); + break; + } + + return refresh; +} + void MystScriptParser_Mechanical::opcode_104(uint16 op, uint16 var, uint16 argc, uint16 *argv) { varUnusedCheck(op, var); diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h index 0b4036853f..086986a2b2 100644 --- a/engines/mohawk/myst_stacks/mechanical.h +++ b/engines/mohawk/myst_stacks/mechanical.h @@ -47,6 +47,9 @@ public: private: void setupOpcodes(); + uint16 getVar(uint16 var); + void toggleVar(uint16 var); + bool setVarValue(uint16 var, uint16 value); void opcode_200_run(); void opcode_200_disable(); |