From 7e52ae2f5e3534ba0c2f425361c4a3bc51f813f4 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 13 Feb 2011 17:14:56 +0100 Subject: MOHAWK: Implement Mechanical opcodes 203 and 104, snake box --- engines/mohawk/myst_stacks/mechanical.cpp | 43 ++++++------------------------- engines/mohawk/myst_stacks/mechanical.h | 8 +++--- 2 files changed, 12 insertions(+), 39 deletions(-) (limited to 'engines') diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp index 46aade250d..c8652d4951 100644 --- a/engines/mohawk/myst_stacks/mechanical.cpp +++ b/engines/mohawk/myst_stacks/mechanical.cpp @@ -51,7 +51,7 @@ MystScriptParser_Mechanical::~MystScriptParser_Mechanical() { void MystScriptParser_Mechanical::setupOpcodes() { // "Stack-Specific" Opcodes OPCODE(100, o_throneEnablePassage); - OPCODE(104, opcode_104); + OPCODE(104, o_snakeBoxTrigger); OPCODE(105, o_fortressStaircaseMovie); OPCODE(121, opcode_121); OPCODE(122, opcode_122); @@ -70,7 +70,7 @@ void MystScriptParser_Mechanical::setupOpcodes() { OPCODE(200, o_throne_init); OPCODE(201, opcode_201); OPCODE(202, opcode_202); - OPCODE(203, opcode_203); + OPCODE(203, o_snakeBox_init); OPCODE(204, opcode_204); OPCODE(205, opcode_205); OPCODE(206, opcode_206); @@ -85,7 +85,6 @@ void MystScriptParser_Mechanical::setupOpcodes() { void MystScriptParser_Mechanical::disablePersistentScripts() { opcode_201_disable(); opcode_202_disable(); - opcode_203_disable(); opcode_204_disable(); opcode_205_disable(); opcode_206_disable(); @@ -95,7 +94,6 @@ void MystScriptParser_Mechanical::disablePersistentScripts() { void MystScriptParser_Mechanical::runPersistentScripts() { opcode_201_run(); opcode_202_run(); - opcode_203_run(); opcode_204_run(); opcode_205_run(); opcode_206_run(); @@ -227,17 +225,11 @@ void MystScriptParser_Mechanical::o_throneEnablePassage(uint16 op, uint16 var, u _vm->_resources[argv[0]]->setEnabled(getVar(var)); } -void MystScriptParser_Mechanical::opcode_104(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - varUnusedCheck(op, var); +void MystScriptParser_Mechanical::o_snakeBoxTrigger(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op); // Used on Mechanical Card 6043 (Weapons Rack with Snake Box) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op); - - // TODO: Trigger Type 6 To Play Snake Movie.. Resource #3 on card. - } else - unknown(op, var, argc, argv); - + _snakeBox->playMovie(); } void MystScriptParser_Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -437,29 +429,10 @@ void MystScriptParser_Mechanical::opcode_202(uint16 op, uint16 var, uint16 argc, unknown(op, var, argc, argv); } -static struct { - bool enabled; -} g_opcode203Parameters; - -void MystScriptParser_Mechanical::opcode_203_run() { - if (g_opcode203Parameters.enabled) { - // Used for Card 6043 (Weapons Rack with Snake Box) - // TODO: Fill in Logic for Snake Box... - } -} - -void MystScriptParser_Mechanical::opcode_203_disable() { - g_opcode203Parameters.enabled = false; -} +void MystScriptParser_Mechanical::o_snakeBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Snake box init", op); -void MystScriptParser_Mechanical::opcode_203(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - varUnusedCheck(op, var); - - // Used for Card 6043 (Weapons Rack with Snake Box) - if (argc == 0) - g_opcode203Parameters.enabled = true; - else - unknown(op, var, argc, argv); + _snakeBox = static_cast(_invokingResource); } static struct { diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h index 346699b425..345e838fc8 100644 --- a/engines/mohawk/myst_stacks/mechanical.h +++ b/engines/mohawk/myst_stacks/mechanical.h @@ -55,8 +55,6 @@ private: void opcode_201_disable(); void opcode_202_run(); void opcode_202_disable(); - void opcode_203_run(); - void opcode_203_disable(); void opcode_204_run(); void opcode_204_disable(); void opcode_205_run(); @@ -67,7 +65,7 @@ private: void opcode_209_disable(); DECLARE_OPCODE(o_throneEnablePassage); - DECLARE_OPCODE(opcode_104); + DECLARE_OPCODE(o_snakeBoxTrigger); DECLARE_OPCODE(o_fortressStaircaseMovie); DECLARE_OPCODE(opcode_121); DECLARE_OPCODE(opcode_122); @@ -85,7 +83,7 @@ private: DECLARE_OPCODE(o_throne_init); DECLARE_OPCODE(opcode_201); DECLARE_OPCODE(opcode_202); - DECLARE_OPCODE(opcode_203); + DECLARE_OPCODE(o_snakeBox_init); DECLARE_OPCODE(opcode_204); DECLARE_OPCODE(opcode_205); DECLARE_OPCODE(opcode_206); @@ -100,6 +98,8 @@ private: uint16 _fortressPosition; // 82 uint16 _crystalLit; // 130 + + MystResourceType6 *_snakeBox; // 156 }; } // End of namespace Mohawk -- cgit v1.2.3