From 87730caa0298fca70c609c5d589620ea04df8830 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 25 Jan 2004 05:25:50 +0000 Subject: Fixed plenty of bugs: o Seek error. Now it seems to cover all cases o Shadows in tunnels on mineroad o Renamed some function to match functionality o bug #867555 (Problems between Mink Farm and Poyhoga) o Ben disappearing in car chase svn-id: r12586 --- scumm/insane/insane.cpp | 4 ++-- scumm/insane/insane_ben.cpp | 45 +++++++++++++++++++++--------------------- scumm/insane/insane_enemy.cpp | 30 ++++++++++++++-------------- scumm/insane/insane_iact.cpp | 8 ++++---- scumm/insane/insane_scenes.cpp | 16 +++++++++------ scumm/smush/chunk.cpp | 3 +-- scumm/smush/chunk.h | 2 +- scumm/smush/smush_player.cpp | 22 +++++++++++---------- 8 files changed, 68 insertions(+), 62 deletions(-) (limited to 'scumm') diff --git a/scumm/insane/insane.cpp b/scumm/insane/insane.cpp index def4a29646..5e0c3dbd68 100644 --- a/scumm/insane/insane.cpp +++ b/scumm/insane/insane.cpp @@ -1437,8 +1437,8 @@ void Insane::smush_setFrameSteps(int32 step1, int32 step2) { _smush_frameStep = step1; } - void Insane::smush_setupSanFile(const char *filename, int32 offset, int32 contFrame) { - debug(0, "smush_setupSanFile(%s, %x)", filename, offset); +void Insane::smush_setupSanFile(const char *filename, int32 offset, int32 contFrame) { + debug(0, "smush_setupSanFile(%s, %x, %d)", filename, offset, contFrame); _player->seekSan(filename, _vm->getGameDataPath(), offset, contFrame); diff --git a/scumm/insane/insane_ben.cpp b/scumm/insane/insane_ben.cpp index 45e4b53b74..6f81feaaa3 100644 --- a/scumm/insane/insane_ben.cpp +++ b/scumm/insane/insane_ben.cpp @@ -287,6 +287,7 @@ void Insane::mineChooseRoad(int32 buttons) { _actor[0].field_8 = 112; smlayer_setActorFacing(0, 2, 26, 180); break; + case 4: case 5: _actor[0].tilt = tmp; @@ -480,19 +481,19 @@ bool Insane::weaponBenIsEffective(void) { } int32 Insane::calcBenDamage(bool arg_0, bool arg_4) { - if ((_actor[1].x - _actor[0].x > weaponMaxRange(0)) || - (_actor[1].x - _actor[0].x < weaponMinRange(0))) + if ((_actor[1].x - _actor[0].x > weaponMaxRange(1)) || + (_actor[1].x - _actor[0].x < weaponMinRange(1))) return 0; - if (_actor[1].field_44 && arg_4) + if (_actor[0].field_44 && arg_4) return 1000; - if (!actor1StateFlags(_actor[1].act[2].state)) + if (!actor1StateFlags(_actor[0].act[2].state)) return 0; if (arg_0) { - ouchSoundEnemy(); - _actor[1].damage += weaponDamage(0); + ouchSoundBen(); + _actor[0].damage += weaponDamage(1); // PATCH } return 1; @@ -710,7 +711,7 @@ void Insane::actor02Reaction(int32 buttons) { _actor[0].weaponClass = 1; if (_actor[0].act[2].frame == 2) { if (_currEnemy != EN_CAVEFISH) { - tmp = calcBenDamage(1, 1); + tmp = calcEnemyDamage(1, 1); if (tmp == 1) smlayer_startSfx(60); if (tmp == 1000) @@ -762,7 +763,7 @@ void Insane::actor02Reaction(int32 buttons) { if (_currEnemy == EN_VULTM2) { if ((_actor[1].x - _actor[0].x <= weaponMaxRange(0)) && (_actor[1].x - _actor[0].x >= weaponMinRange(0)) && - calcBenDamage(0, 0)) { + calcEnemyDamage(0, 0)) { smlayer_setActorFacing(0, 2, 20, 180); _actor[0].act[2].state = 97; _actor[0].act[2].room = 0; @@ -814,7 +815,7 @@ void Insane::actor02Reaction(int32 buttons) { case INV_MACE: case INV_2X4: case INV_DUST: - tmp = calcBenDamage(1, 1); + tmp = calcEnemyDamage(1, 1); if (tmp == 1) smlayer_startSfx(73); if (tmp == 1000) @@ -823,7 +824,7 @@ void Insane::actor02Reaction(int32 buttons) { case INV_WRENCH: case INV_BOOT: case INV_HAND: - if(calcBenDamage(1, 0) == 1) + if(calcEnemyDamage(1, 0) == 1) smlayer_startSfx(73); break; } @@ -876,7 +877,7 @@ void Insane::actor02Reaction(int32 buttons) { _actor[0].weaponClass = 2; _actor[0].field_34 = 1; _actor[0].kicking = 0; - if ((_actor[0].act[2].frame == 3) && (calcBenDamage(0, 0) == 1)) { + if ((_actor[0].act[2].frame == 3) && (calcEnemyDamage(0, 0) == 1)) { _actor[1].damage = weaponDamage(0); smlayer_startSfx(64); _actor[1].cursorX = 320; @@ -947,14 +948,14 @@ void Insane::actor02Reaction(int32 buttons) { switch (_actor[1].weapon) { case INV_CHAIN: case INV_CHAINSAW: - tmp = calcBenDamage(1, 1); + tmp = calcEnemyDamage(1, 1); if (tmp == 1) smlayer_startSfx(76); if (tmp == 1000) smlayer_startSfx(77); break; case INV_BOOT: - calcBenDamage(0, 1); + calcEnemyDamage(0, 1); break; case INV_DUST: if ((_actor[1].x - _actor[0].x <= weaponMaxRange(0)) && @@ -964,7 +965,7 @@ void Insane::actor02Reaction(int32 buttons) { } break; default: - if (calcBenDamage(1, 0)) + if (calcEnemyDamage(1, 0)) smlayer_startSfx(76); break; } @@ -1044,7 +1045,7 @@ void Insane::actor02Reaction(int32 buttons) { case INV_MACE: case INV_2X4: case INV_BOOT: - tmp = calcBenDamage(1, 1); + tmp = calcEnemyDamage(1, 1); if (tmp == 1) smlayer_startSfx(67); if (tmp == 1000) @@ -1143,7 +1144,7 @@ void Insane::actor02Reaction(int32 buttons) { case INV_2X4: case INV_BOOT: case INV_DUST: - tmp = calcBenDamage(1, 1); + tmp = calcEnemyDamage(1, 1); if (tmp == 1) { if (_currEnemy == EN_CAVEFISH) { _actor[1].lost = 1; @@ -1156,7 +1157,7 @@ void Insane::actor02Reaction(int32 buttons) { smlayer_startSfx(80); break; default: - if (!calcBenDamage(1, 0)) + if (!calcEnemyDamage(1, 0)) smlayer_startSfx(79); break; } @@ -1227,14 +1228,14 @@ void Insane::actor02Reaction(int32 buttons) { case INV_2X4: case INV_BOOT: case INV_DUST: - tmp = calcBenDamage(1, 1); + tmp = calcEnemyDamage(1, 1); if (tmp == 1) smlayer_startSfx(70); if (tmp == 1000) smlayer_startSfx(71); break; case 6: - if (!calcBenDamage(0, 1)) + if (!calcEnemyDamage(0, 1)) smlayer_startSfx(70); break; default: @@ -1285,15 +1286,15 @@ void Insane::actor02Reaction(int32 buttons) { if (_actor[0].act[2].frame >= 5) { switch (_currEnemy) { case EN_ROTT3: - if (calcBenDamage(0, 0)) + if (calcEnemyDamage(0, 0)) _actor[1].act[2].state = 115; break; case EN_VULTF2: - if (calcBenDamage(0, 0)) + if (calcEnemyDamage(0, 0)) _actor[1].act[2].state = 113; break; default: - tmp = calcBenDamage(1, 1); + tmp = calcEnemyDamage(1, 1); if (tmp == 1) smlayer_startSfx(82); if (tmp == 1000) diff --git a/scumm/insane/insane_enemy.cpp b/scumm/insane/insane_enemy.cpp index 915da647c3..eeb2dd1903 100644 --- a/scumm/insane/insane_enemy.cpp +++ b/scumm/insane/insane_enemy.cpp @@ -1814,7 +1814,7 @@ void Insane::actor12Reaction(int32 buttons) { smlayer_setActorLayer(1, 2, 4); _actor[1].weaponClass = 1; if (_actor[1].act[2].frame >= 6) { - tmp = calcEnemyDamage(1, 1); + tmp = calcBenDamage(1, 1); if (tmp == 1) smlayer_startSfx(60); if (tmp == 1000) @@ -1878,14 +1878,14 @@ void Insane::actor12Reaction(int32 buttons) { case INV_DUST: case INV_WRENCH: case INV_BOOT: - tmp = calcEnemyDamage(1, 1); + tmp = calcBenDamage(1, 1); if (tmp == 1) smlayer_startSfx(73); if (tmp == 1000) smlayer_startSfx(74); break; case INV_HAND: - if(calcEnemyDamage(1, 0)) + if(calcBenDamage(1, 0)) smlayer_startSfx(73); break; } @@ -1951,14 +1951,14 @@ void Insane::actor12Reaction(int32 buttons) { case INV_MACE: case INV_2X4: case INV_DUST: - tmp = calcEnemyDamage(1, 1); + tmp = calcBenDamage(1, 1); if (tmp == 1) smlayer_startSfx(76); if (tmp == 1000) smlayer_startSfx(77); break; default: - calcEnemyDamage(1, 0); + calcBenDamage(1, 0); break; } smlayer_setActorFacing(1, 2, 21,180); @@ -2042,14 +2042,14 @@ void Insane::actor12Reaction(int32 buttons) { case INV_MACE: case INV_2X4: case INV_BOOT: - tmp = calcEnemyDamage(1, 1); + tmp = calcBenDamage(1, 1); if (tmp == 1) smlayer_startSfx(67); if (tmp == 1000) smlayer_startSfx(68); break; default: - calcEnemyDamage(1, 0); + calcBenDamage(1, 0); break; } smlayer_setActorFacing(1, 2, 21, 180); @@ -2116,7 +2116,7 @@ void Insane::actor12Reaction(int32 buttons) { _actor[1].weaponClass = 0; _actor[1].kicking = 1; if (_actor[1].act[2].frame >= 1) { - tmp = calcEnemyDamage(1, 1); + tmp = calcBenDamage(1, 1); if (tmp == 1) smlayer_startSfx(79); @@ -2171,7 +2171,7 @@ void Insane::actor12Reaction(int32 buttons) { _actor[1].weaponClass = 1; _actor[1].kicking = 1; if (_actor[1].act[2].frame >= 3) { - tmp = calcEnemyDamage(1, 1); + tmp = calcBenDamage(1, 1); if (tmp == 1) smlayer_startSfx(70); if (tmp == 1000) @@ -2568,19 +2568,19 @@ void Insane::actor12Reaction(int32 buttons) { } int32 Insane::calcEnemyDamage(bool arg_0, bool arg_4) { - if ((_actor[1].x - _actor[0].x > weaponMaxRange(1)) || - (_actor[1].x - _actor[0].x < weaponMinRange(1))) + if ((_actor[1].x - _actor[0].x > weaponMaxRange(0)) || + (_actor[1].x - _actor[0].x < weaponMinRange(0))) return 0; - if (_actor[0].field_44 && arg_4) + if (_actor[1].field_44 && arg_4) return 1000; - if (!actor1StateFlags(_actor[0].act[2].state)) + if (!actor1StateFlags(_actor[1].act[2].state)) return 0; if (arg_0) { - ouchSoundBen(); - _actor[0].damage += weaponDamage(1); // PATCH + ouchSoundEnemy(); + _actor[1].damage += weaponDamage(0); } return 1; diff --git a/scumm/insane/insane_iact.cpp b/scumm/insane/insane_iact.cpp index f7e4534507..42f7cc513c 100644 --- a/scumm/insane/insane_iact.cpp +++ b/scumm/insane/insane_iact.cpp @@ -75,7 +75,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, par4 = b.getWord(); // bx switch (par1) { - case 2: + case 2: // PATCH if (par3 != 1) break; @@ -121,12 +121,12 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, if (par13 > _actor[0].x || par11 < _actor[0].x) { _tiresRustle = true; _actor[0].x1 = -_actor[0].x1; - _actor[0].damage++; + _actor[0].damage++; // PATCH } if (par9 < _actor[0].x || par7 > _actor[0].x) { _tiresRustle = true; - _actor[0].damage += 4; + _actor[0].damage += 4; // PATCH } break; case 6: @@ -167,7 +167,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, par5 = b.getWord(); // si par6 = b.getWord(); // bx smlayer_setFluPalette(_smush_roadrsh3Rip, 0); - if (par5 != par6 - 1) + if (par5 == par6 - 1) smlayer_setFluPalette(_smush_roadrashRip, 0); } break; diff --git a/scumm/insane/insane_scenes.cpp b/scumm/insane/insane_scenes.cpp index 7a07884a6b..49d5540016 100644 --- a/scumm/insane/insane_scenes.cpp +++ b/scumm/insane/insane_scenes.cpp @@ -929,6 +929,9 @@ void Insane::procPostRendering(byte *renderBitmap, int32 codecparam, int32 setup case 22: postCase10(renderBitmap, codecparam, setupsan12, setupsan13, curFrame, maxFrame); break; + case 14: + postCase23(renderBitmap, codecparam, setupsan12, setupsan13, curFrame, maxFrame); + break; case 13: postCase12(renderBitmap, codecparam, setupsan12, setupsan13, curFrame, maxFrame); needMore = true; @@ -1394,13 +1397,14 @@ void Insane::postCase12(byte *renderBitmap, int32 codecparam, int32 setupsan12, void Insane::postCase23(byte *renderBitmap, int32 codecparam, int32 setupsan12, int32 setupsan13, int32 curFrame, int32 maxFrame) { if (curFrame >= maxFrame) { - if (_currSceneId == 24) + if (_currSceneId == 24) { queueSceneSwitch(21, 0, "rottfite.san", 64, 0, 0, 0); - - if (readArray(6) && readArray(4)) - queueSceneSwitch(16, 0, "limocrsh.san", 64, 0, 0, 0); - - queueSceneSwitch(5, 0, "tovista2.san", 64, 0, 0, 290); + } else { + if (readArray(6) && readArray(4)) + queueSceneSwitch(16, 0, "limocrsh.san", 64, 0, 0, 0); + else + queueSceneSwitch(5, 0, "tovista2.san", 64, 0, 0, 290); + } } _val119_ = false; _val120_ = false; diff --git a/scumm/smush/chunk.cpp b/scumm/smush/chunk.cpp index 1c4a23b49f..9962ef362e 100644 --- a/scumm/smush/chunk.cpp +++ b/scumm/smush/chunk.cpp @@ -189,8 +189,7 @@ uint32 FileChunk::getDword() { return _data->readUint32LE(); } -void FileChunk::reinit() { - _data->seek(0); +void FileChunk::reinit(uint32 offset) { _offset = 0; _type = _data->readUint32BE(); _size = _data->readUint32BE(); diff --git a/scumm/smush/chunk.h b/scumm/smush/chunk.h index 25b4a8c7a8..3e5bc59c9a 100644 --- a/scumm/smush/chunk.h +++ b/scumm/smush/chunk.h @@ -83,7 +83,7 @@ public: short getShort(); uint16 getWord(); uint32 getDword(); - void reinit(); + void reinit(uint32 offset); }; class MemoryChunk : public BaseChunk { diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index d3613d56aa..fdb3b901ce 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -292,7 +292,7 @@ void SmushPlayer::deinit() { void SmushPlayer::checkBlock(const Chunk &b, Chunk::type type_expected, uint32 min_size) { if (type_expected != b.getType()) { - error("Chunk type is different from expected : %d != %d", b.getType(), type_expected); + error("Chunk type is different from expected : %x != %x", b.getType(), type_expected); } if (min_size > b.getSize()) { error("Chunk size is inferior than minimum required size : %d < %d", b.getSize(), min_size); @@ -867,7 +867,7 @@ void SmushPlayer::parseNextFrame() { handleFrame(*sub); break; default: - error("Unknown Chunk found at %x: %d, %d", _base->tell(), sub->getType(), sub->getSize()); + error("Unknown Chunk found at %x: %x, %d", _base->tell(), sub->getType(), sub->getSize()); } delete sub; } @@ -951,24 +951,26 @@ void SmushPlayer::insanity(bool flag) { void SmushPlayer::seekSan(const char *file, const char *directory, int32 pos, int32 contFrame) { Chunk *sub; - + if (file) { if (_base) delete _base; _base = new FileChunk(file, directory); + pos = 0; } else { - _base->reinit(); + _base->reinit(pos); + debug(0, "Yup"); } - sub = _base->subBlock(); - checkBlock(*sub, TYPE_AHDR); - handleAnimHeader(*sub); - - if (pos != 8) { - _base->reinit(); + if (pos != 8 && pos) { _base->seek(pos, FileChunk::seek_start); _middleAudio = true; + } else { + _base->seek(pos, FileChunk::seek_start); + sub = _base->subBlock(); + checkBlock(*sub, TYPE_AHDR); + handleAnimHeader(*sub); } _frame = contFrame; -- cgit v1.2.3