From bfd272a46ebae1198a489d113d0f50b9418ac202 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Mon, 29 Nov 2010 20:59:44 +0000 Subject: MOHAWK: Add a generic temp var for use by Myst scripts. svn-id: r54632 --- engines/mohawk/myst_scripts.cpp | 19 +++++++++++++++---- engines/mohawk/myst_scripts.h | 14 +++++++------- engines/mohawk/myst_scripts_myst.cpp | 6 ++---- 3 files changed, 24 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index 533bda8ba9..85c90249d7 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -217,8 +217,13 @@ MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, Myst } uint16 MystScriptParser::getVar(uint16 var) { - warning("Unimplemented var getter 0x%02x (%d)", var, var); - return _vm->_varStore->getVar(var); + switch(var) { + case 105: + return _tempVar; + default: + warning("Unimplemented var getter 0x%02x (%d)", var, var); + return _vm->_varStore->getVar(var); + } } void MystScriptParser::toggleVar(uint16 var) { @@ -227,8 +232,14 @@ void MystScriptParser::toggleVar(uint16 var) { } bool MystScriptParser::setVarValue(uint16 var, uint16 value) { - warning("Unimplemented var setter 0x%02x (%d)", var, var); - _vm->_varStore->setVar(var, value); + if (var == 105) { + if (_tempVar != value) + _tempVar = value; + } else { + warning("Unimplemented var setter 0x%02x (%d)", var, var); + _vm->_varStore->setVar(var, value); + } + return false; } diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h index 249345e2f2..c0d2ce6a70 100644 --- a/engines/mohawk/myst_scripts.h +++ b/engines/mohawk/myst_scripts.h @@ -131,20 +131,20 @@ protected: const char *desc; }; - const MystOpcode *_opcodes; - void setupOpcodes(); - MystResource *_invokingResource; uint16 _opcodeCount; + const MystOpcode *_opcodes; - static const uint8 stack_map[]; - static const uint16 start_card[]; + MystResource *_invokingResource; uint16 _savedCardId; uint16 _savedCursorId; + uint16 _tempVar; // Generic temp var used by the scripts - void varUnusedCheck(uint16 op, uint16 var); - + static const uint8 stack_map[]; + static const uint16 start_card[]; + void setupOpcodes(); + void varUnusedCheck(uint16 op, uint16 var); }; } diff --git a/engines/mohawk/myst_scripts_myst.cpp b/engines/mohawk/myst_scripts_myst.cpp index 33ce2f88f2..3020d26d15 100644 --- a/engines/mohawk/myst_scripts_myst.cpp +++ b/engines/mohawk/myst_scripts_myst.cpp @@ -2680,10 +2680,8 @@ void MystScriptParser_Myst::opcode_203(uint16 op, uint16 var, uint16 argc, uint1 break; case kMystStack: // Used for Card 4138 (Dock Forechamber Door) - if (argc == 0) { - g_opcode203Parameters.enabled = true; - } else - unknown(op, var, argc, argv); + // Set forechamber door to closed + setVarValue(105, 0); break; case kMechanicalStack: // Used for Card 6043 (Weapons Rack with Snake Box) -- cgit v1.2.3