diff options
Diffstat (limited to 'engines/cine/script_os.cpp')
-rw-r--r-- | engines/cine/script_os.cpp | 106 |
1 files changed, 46 insertions, 60 deletions
diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp index 1f5ea2b838..319fca5d3c 100644 --- a/engines/cine/script_os.cpp +++ b/engines/cine/script_os.cpp @@ -45,8 +45,8 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o1_addObjectParam, "bbw" }, { &FWScript::o1_subObjectParam, "bbw" }, /* 04 */ - { &FWScript::o1_add2ObjectParam, "bbw" }, - { &FWScript::o1_sub2ObjectParam, "bbw" }, + { &FWScript::o1_mulObjectParam, "bbw" }, + { &FWScript::o1_divObjectParam, "bbw" }, { &FWScript::o1_compareObjectParam, "bbw" }, { &FWScript::o1_setupObject, "bwwww" }, /* 08 */ @@ -73,7 +73,7 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o1_loadMask4, "b" }, { &FWScript::o1_unloadMask4, "b" }, { &FWScript::o1_addSpriteFilledToBgList, "b" }, - { &FWScript::o1_op1B, "" }, + { &FWScript::o1_op1B, "" }, /* TODO: Name this opcode properly. */ /* 1C */ { 0, 0 }, { &FWScript::o1_label, "l" }, @@ -116,7 +116,7 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o1_loadAnim, "s" }, /* 3C */ { &FWScript::o1_loadBg, "s" }, - { &FWScript::o1_loadCt, "s" }, + { &FWScript::o2_loadCt, "s" }, { 0, 0 }, { &FWScript::o2_loadPart, "s" }, /* 40 */ @@ -173,7 +173,7 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o1_setDefaultMenuColor, "b" }, { &FWScript::o1_allowPlayerInput, "" }, { &FWScript::o1_disallowPlayerInput, "" }, - { &FWScript::o1_changeDataDisk, "b" }, + { &FWScript::o1_changeDataDisk, "b" }, /* Same as opcodes 0x95 and 0xA9. */ /* 6C */ { 0, 0 }, { &FWScript::o1_loadMusic, "s" }, @@ -181,9 +181,9 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o1_fadeOutMusic, "" }, /* 70 */ { &FWScript::o1_stopSample, "" }, - { &FWScript::o1_op71, "bw" }, - { &FWScript::o1_op72, "wbw" }, - { &FWScript::o1_op72, "wbw" }, + { &FWScript::o1_op71, "bw" }, /* TODO: Name this opcode properly. */ + { &FWScript::o1_op72, "wbw" }, /* Same as opcode 0x73. TODO: Name this opcode properly. */ + { &FWScript::o1_op72, "wbw" }, /* Same as opcode 0x72. */ /* 74 */ { 0, 0 }, { 0, 0 }, @@ -193,7 +193,7 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o2_playSampleAlt, "bbwbww" }, { &FWScript::o1_disableSystemMenu, "b" }, { &FWScript::o1_loadMask5, "b" }, - { &FWScript::o1_unloadMask5, "b" }, + { &FWScript::o1_unloadMask5, "b" }, /* Last opcode used by Future Wars. */ /* 7C */ { 0, 0 }, { 0, 0 }, @@ -201,8 +201,8 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o2_addSeqListElement, "bbbbwww" }, /* 80 */ { &FWScript::o2_removeSeq, "bb" }, - { &FWScript::o2_op81, "" }, - { &FWScript::o2_op82, "bbw" }, + { &FWScript::o2_op81, "" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_op82, "bbwwb" }, /* TODO: Name this opcode properly. */ { &FWScript::o2_isSeqRunning, "bb" }, /* 84 */ { &FWScript::o2_gotoIfSupNearest, "b" }, @@ -216,7 +216,7 @@ const Opcode OSScript::_opcodeTable[] = { { &FWScript::o2_startObjectScript, "b" }, /* 8C */ { &FWScript::o2_stopObjectScript, "b" }, - { &FWScript::o2_op8D, "wwwwwwww" }, + { &FWScript::o2_op8D, "wwwwwwww" }, /* TODO: Name this opcode properly. */ { &FWScript::o2_addBackground, "bs" }, { &FWScript::o2_removeBackground, "b" }, /* 90 */ @@ -226,32 +226,32 @@ const Opcode OSScript::_opcodeTable[] = { { 0, 0 }, /* 94 */ { 0, 0 }, - { &FWScript::o1_changeDataDisk, "b" }, + { &FWScript::o1_changeDataDisk, "b" }, /* Same as opcodes 0x6B and 0xA9. */ { 0, 0 }, { 0, 0 }, /* 98 */ { 0, 0 }, { 0, 0 }, - { &FWScript::o2_wasZoneChecked, "" }, - { &FWScript::o2_op9B, "wwwwwwww" }, + { &FWScript::o2_wasZoneChecked, "b" }, + { &FWScript::o2_op9B, "wwwwwwww" }, /* TODO: Name this opcode properly. */ /* 9C */ - { &FWScript::o2_op9C, "wwww" }, + { &FWScript::o2_op9C, "wwww" }, /* TODO: Name this opcode properly. */ { &FWScript::o2_useBgScroll, "b" }, { &FWScript::o2_setAdditionalBgVScroll, "c" }, - { &FWScript::o2_op9F, "ww" }, + { &FWScript::o2_op9F, "ww" }, /* TODO: Name this opcode properly. */ /* A0 */ - { &FWScript::o2_addGfxElementA0, "ww" }, - { &FWScript::o2_removeGfxElementA0, "ww" }, - { &FWScript::o2_opA2, "ww" }, - { &FWScript::o2_opA3, "ww" }, + { &FWScript::o2_addGfxElementA0, "ww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_removeGfxElementA0, "ww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_opA2, "ww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_opA3, "ww" }, /* TODO: Name this opcode properly. */ /* A4 */ - { &FWScript::o2_loadMask22, "b" }, - { &FWScript::o2_unloadMask22, "b" }, + { &FWScript::o2_loadMask22, "b" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_unloadMask22, "b" }, /* TODO: Name this opcode properly. */ { 0, 0 }, { 0, 0 }, /* A8 */ { 0, 0 }, - { &FWScript::o1_changeDataDisk, "b" } + { &FWScript::o1_changeDataDisk, "b" } /* Same as opcodes 0x6B and 0x95. */ }; const unsigned int OSScript::_numOpcodes = ARRAYSIZE(OSScript::_opcodeTable); @@ -365,6 +365,14 @@ FWScript *OSScriptInfo::create(const RawObjectScript &script, int16 index, const // OPERATION STEALTH opcodes // ------------------------------------------------------------------------ +int FWScript::o2_loadCt() { + const char *param = getNextString(); + + debugC(5, kCineDebugScript, "Line: %d: loadCt(\"%s\")", _line, param); + loadCtOS(param); + return 0; +} + int FWScript::o2_loadPart() { const char *param = getNextString(); @@ -447,7 +455,9 @@ int FWScript::o2_op82() { byte a = getNextByte(); byte b = getNextByte(); uint16 c = getNextWord(); - warning("STUB: o2_op82(%x, %x, %x)", a, b, c); + uint16 d = getNextWord(); + byte e = getNextByte(); + warning("STUB: o2_op82(%x, %x, %x, %x, %x)", a, b, c, d, e); return 0; } @@ -615,20 +625,7 @@ int FWScript::o2_removeBackground() { debugC(5, kCineDebugScript, "Line: %d: removeBackground(%d)", _line, param); - if (additionalBgTable[param]) { - free(additionalBgTable[param]); - additionalBgTable[param] = NULL; - } - - if (currentAdditionalBgIdx == param) { - currentAdditionalBgIdx = 0; - } - - if (currentAdditionalBgIdx2 == param) { - currentAdditionalBgIdx2 = 0; - } - - strcpy(currentBgName[param], ""); + renderer->removeBg(param); return 0; } @@ -644,29 +641,20 @@ int FWScript::o2_loadAbs() { int FWScript::o2_loadBg() { byte param = getNextByte(); - assert(param <= 8); + assert(param < 9); debugC(5, kCineDebugScript, "Line: %d: useBg(%d)", _line, param); - if (additionalBgTable[param]) { - currentAdditionalBgIdx = param; - if (param == 8) { - newColorMode = 3; - } else { - newColorMode = bgColorMode + 1; - } - //if (_screenNeedFadeOut == 0) { - // adBgVar1 = 1; - //} - fadeRequired = true; - } + renderer->selectBg(param); return 0; } -/*! \todo Implement this instruction +/*! \todo Check the current implementation for correctness */ int FWScript::o2_wasZoneChecked() { - warning("STUB: o2_wasZoneChecked()"); + byte param = getNextByte(); + _compare = (param < 16 && zoneData[param]); + debugC(5, kCineDebugScript, "Line: %d: o2_wasZoneChecked(%d)", _line, param); return 0; } @@ -699,13 +687,11 @@ int FWScript::o2_op9C() { int FWScript::o2_useBgScroll() { byte param = getNextByte(); - assert(param <= 8); + assert(param < 9); debugC(5, kCineDebugScript, "Line: %d: useBgScroll(%d)", _line, param); - if (additionalBgTable[param]) { - currentAdditionalBgIdx2 = param; - } + renderer->selectScrollBg(param); return 0; } @@ -716,12 +702,12 @@ int FWScript::o2_setAdditionalBgVScroll() { byte param2 = getNextByte(); debugC(5, kCineDebugScript, "Line: %d: additionalBgVScroll = var[%d]", _line, param2); - additionalBgVScroll = _localVars[param2]; + renderer->setScroll(_localVars[param2]); } else { uint16 param2 = getNextWord(); debugC(5, kCineDebugScript, "Line: %d: additionalBgVScroll = %d", _line, param2); - additionalBgVScroll = param2; + renderer->setScroll(param2); } return 0; } |