diff options
author | Kari Salminen | 2008-05-30 10:43:21 +0000 |
---|---|---|
committer | Kari Salminen | 2008-05-30 10:43:21 +0000 |
commit | 94d1e7effbe22291964202c903f5fe1d8c0f53ea (patch) | |
tree | 3163091112f3450e30e5026c36894f48b0636b37 /engines | |
parent | db0af96fa05b943fccff4c3a88426aab8d22736a (diff) | |
download | scummvm-rg350-94d1e7effbe22291964202c903f5fe1d8c0f53ea.tar.gz scummvm-rg350-94d1e7effbe22291964202c903f5fe1d8c0f53ea.tar.bz2 scummvm-rg350-94d1e7effbe22291964202c903f5fe1d8c0f53ea.zip |
Implemented opcodes 0x04 (o1_mulObjectParam) and 0x05 (o1_divObjectParam).
svn-id: r32393
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/script.h | 4 | ||||
-rw-r--r-- | engines/cine/script_fw.cpp | 41 | ||||
-rw-r--r-- | engines/cine/script_os.cpp | 4 |
3 files changed, 29 insertions, 20 deletions
diff --git a/engines/cine/script.h b/engines/cine/script.h index 23bb179ee5..eeac0e8809 100644 --- a/engines/cine/script.h +++ b/engines/cine/script.h @@ -155,8 +155,8 @@ protected: int o1_getObjectParam(); int o1_addObjectParam(); int o1_subObjectParam(); - int o1_add2ObjectParam(); - int o1_sub2ObjectParam(); + int o1_mulObjectParam(); + int o1_divObjectParam(); int o1_compareObjectParam(); int o1_setupObject(); int o1_checkCollision(); diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index 4f6749517e..6b9538e25d 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -49,8 +49,8 @@ const Opcode FWScript::_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 */ @@ -803,23 +803,32 @@ int FWScript::o1_subObjectParam() { return 0; } -/*! \todo Implement this instruction - */ -int FWScript::o1_add2ObjectParam() { - uint16 a = getNextByte(); - uint16 b = getNextByte(); - uint16 c = getNextWord(); - warning("STUB: o1_add2ObjectParam(%x, %x, %x)", a, b, c); +int FWScript::o1_mulObjectParam() { + byte objIdx = getNextByte(); + byte paramIdx = getNextByte(); + int16 newValue = getNextWord(); + + debugC(5, kCineDebugScript, "Line: %d: mulObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _line, objIdx, paramIdx, newValue); + + // FIXME? In PC versions of Future Wars and Operation Stealth the multiplication is done unsigned. + // (16b x 16b -> 32b, taking only 16 LSBs). The question is, does it really matter? + int16 currentValue = getObjectParam(objIdx, paramIdx); + modifyObjectParam(objIdx, paramIdx, currentValue * newValue); return 0; } -/*! \todo Implement this instruction - */ -int FWScript::o1_sub2ObjectParam() { - uint16 a = getNextByte(); - uint16 b = getNextByte(); - uint16 c = getNextWord(); - warning("STUB: o1_sub2ObjectParam(%x, %x, %x)", a, b, c); +int FWScript::o1_divObjectParam() { + byte objIdx = getNextByte(); + byte paramIdx = getNextByte(); + int16 newValue = getNextWord(); + + debugC(5, kCineDebugScript, "Line: %d: divObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _line, objIdx, paramIdx, newValue); + + // In PC versions of Future Wars and Operation Stealth the division is done signed. + // Dividend is first sign extended from 16 bits to 32 bits and then divided by the + // 16 bit divider using signed division. Only 16 LSBs of the quotient are saved. + int16 currentValue = getObjectParam(objIdx, paramIdx); + modifyObjectParam(objIdx, paramIdx, currentValue / newValue); return 0; } diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp index 7c88e3ffe3..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 */ |