diff options
author | Eugene Sandulenko | 2004-02-01 05:44:18 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2004-02-01 05:44:18 +0000 |
commit | 84d8e4dca45f73a82dbb68121d46cf4de277508d (patch) | |
tree | 485d5bb0a2bd0486d2989bc7128a17b842c7921a | |
parent | 51733fbe3e44db6283aef733bd1e3fcd0c5adb48 (diff) | |
download | scummvm-rg350-84d8e4dca45f73a82dbb68121d46cf4de277508d.tar.gz scummvm-rg350-84d8e4dca45f73a82dbb68121d46cf4de277508d.tar.bz2 scummvm-rg350-84d8e4dca45f73a82dbb68121d46cf4de277508d.zip |
o Major debug of all actors code
o Road signs aligned to match original
o Fixed bug with Ben's velocity not reset with scene switch
o Removed some unused code
o Debug level increased, so console is not flooded anymore
o Rearranged those huge switch statements
I succesfully passed by all insane scenes, so FT should be completable now with
some SAUD related crashes which are easy to avoid.
svn-id: r12695
-rw-r--r-- | scumm/insane/insane.cpp | 57 | ||||
-rw-r--r-- | scumm/insane/insane.h | 3 | ||||
-rw-r--r-- | scumm/insane/insane_ben.cpp | 778 | ||||
-rw-r--r-- | scumm/insane/insane_enemy.cpp | 935 | ||||
-rw-r--r-- | scumm/insane/insane_iact.cpp | 35 | ||||
-rw-r--r-- | scumm/insane/insane_scenes.cpp | 38 |
6 files changed, 910 insertions, 936 deletions
diff --git a/scumm/insane/insane.cpp b/scumm/insane/insane.cpp index e69df9d2bd..201ae29e07 100644 --- a/scumm/insane/insane.cpp +++ b/scumm/insane/insane.cpp @@ -39,7 +39,6 @@ #include "scumm/insane/insane.h" // TODO (in no particular order): -// o Ben's velocity don't get zeroed after crash // o Road signs are not aligned properly // o SAUD complaining again // o Insane::postCase16() has workaround. Cockpit is not transparent so it is @@ -161,7 +160,7 @@ void Insane::initvars(void) { _val54d = 0; _val57d = 0; _val115_ = false; - _val121_ = false; + _roadBumps = false; _val211d = 0; _val213d = 0; _val215d = 0; @@ -622,28 +621,6 @@ void Insane::startVideo(const char *filename, int num, int argC, int frameRate, _player->play(filename, _vm->getGameDataPath()); } -int Insane::smlayer_mainLoop(void) { - // FIXME: implement - warning("stub Insane::smlayer_mainLoop"); - mainLoop(); - return 1; -} - -void Insane::smush_proc39(void) { - // FIXME: implement - warning("stub Insane::smush_proc39"); -} - -void Insane::smush_proc40(void) { - // FIXME: implement - warning("stub Insane::smush_proc40"); -} - -void Insane::smush_proc41(void) { - // FIXME: implement - warning("stub Insane::smush_proc41"); -} - void Insane::smush_warpMouse(int x, int y, int buttons) { _vm->_system->warp_mouse(x, y); } @@ -657,15 +634,15 @@ void Insane::putActors(void) { smlayer_putActor(1, 1, _actor[0].x, _actor[0].y1, _smlayer_room); } -void Insane::readState(void) { +void Insane::readState(void) { // PATCH _actor[0].inventory[INV_CHAIN] = readArray(50) != 0; _actor[0].inventory[INV_CHAINSAW] = readArray(51) != 0; _actor[0].inventory[INV_MACE] = readArray(52) != 0; _actor[0].inventory[INV_2X4] = readArray(53) != 0; _actor[0].inventory[INV_WRENCH] = readArray(54) != 0; _actor[0].inventory[INV_DUST] = readArray(55) != 0; - _actor[0].inventory[INV_HAND] = 1; // Boot - _actor[0].inventory[INV_BOOT] = 1; // Hand + _actor[0].inventory[INV_HAND] = 1; + _actor[0].inventory[INV_BOOT] = 1; _smlayer_room = readArray(320); _smlayer_room2 = readArray(321); @@ -780,7 +757,7 @@ int32 Insane::idx2Tweak(void) { } void Insane::smush_setToFinish(void) { - debug(0, "Video is set to finish"); + debug(5, "Video is set to finish"); _vm->_videoFinished = 1; } @@ -824,6 +801,8 @@ void Insane::prepareScenePropScene(int32 scenePropNum, bool arg_4, bool arg_8) { int tmp, idx = scenePropIdx[scenePropNum]; + debug(5, "Insane::prepareScenePropScene(%d, %d, %d)", scenePropNum, arg_4, arg_8); + if (!loadScenePropSounds(idx)) return; @@ -864,7 +843,7 @@ void Insane::queueSceneSwitch(int32 sceneId, byte *fluPtr, const char *filename, int32 arg_C, int32 arg_10, int32 startFrame, int32 numFrames) { int32 tmp; - debug(0, "queueSceneSwitch(%d, *, %s, %d, %d, %d, %d)", sceneId, filename, arg_C, arg_10, + debug(5, "queueSceneSwitch(%d, *, %s, %d, %d, %d, %d)", sceneId, filename, arg_C, arg_10, startFrame, numFrames); if (_needSceneSwitch || _sceneData1Loaded) return; @@ -883,7 +862,7 @@ void Insane::queueSceneSwitch(int32 sceneId, byte *fluPtr, const char *filename, } void Insane::smush_rewindCurrentSan(int arg_0, int arg_4, int arg_8) { - debug(0, "smush_rewindCurrentSan(%d, %d, %d)", arg_0, arg_4, arg_8); + debug(5, "smush_rewindCurrentSan(%d, %d, %d)", arg_0, arg_4, arg_8); _smush_setupsan2 = arg_0; smush_setupSanFile(0, 8, 0); @@ -980,7 +959,7 @@ void Insane::escapeKeyHandler(void) { if (_needSceneSwitch || _keyboardDisable) return; - debug(0, "scene: %d", _currSceneId); + debug(5, "scene: %d", _currSceneId); switch (_currSceneId) { case 1: queueSceneSwitch(1, _smush_minedrivFlu, "minedriv.san", 64, 0, _continueFrame1, 1300); @@ -1234,8 +1213,8 @@ bool Insane::smlayer_startVoice(int32 sound) { return false; } -void Insane::smlayer_soundSetPan(int32 soundid, int32 pan) { - _vm->_imuseDigital->parseScriptCmds(12, soundid, 0x700, pan, 0, 0, 0, 0); +void Insane::smlayer_soundSetPan(int32 soundId, int32 pan) { + _vm->_imuseDigital->setPan(soundId, pan); } void Insane::smlayer_soundSetPriority(int32 sound, int32 priority) { @@ -1257,7 +1236,8 @@ void Insane::smlayer_showStatusMsg(int32 arg_0, byte *renderBitmap, int32 codecp int32 pos_x, int32 pos_y, int32 arg_14, int32 arg_18, int32 flags, const char *formatString, const char *strng) { SmushFont *sf = _player->_sf[0]; - int color = 1, top = 0; + int color = 1; + int32 top = 0; char *str = NULL, *string; int len = strlen(formatString) + strlen(strng) + 16; @@ -1303,7 +1283,7 @@ void Insane::smlayer_showStatusMsg(int32 arg_0, byte *renderBitmap, int32 codecp sf->drawStringAbsolute(str, renderBitmap, _player->_width, pos_x, pos_y); break; case 1: - sf->drawStringCentered(str, renderBitmap, _player->_width, _player->_height, pos_x, MAX(pos_y, (int32)top)); + sf->drawStringCentered(str, renderBitmap, _player->_width, _player->_height, pos_x, MAX(pos_y, top)); break; default: warning("Insane::smlayer_showStatusMsg. Not handled flags: %d", flags); @@ -1361,6 +1341,7 @@ void Insane::smlayer_setActorFacing(int actornum, int actnum, int frame, int dir } const char *Insane::handleTrsTag(int32 trsId) { + debug(5, "Insane::handleTrsTag(%d)", trsId); return _player->getString(trsId); } @@ -1412,7 +1393,7 @@ void Insane::smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32 byte *tmp = fluPtr; int32 offset; - debug(0, "smush_setupSanWithFlu(%s, %d, %d, %d, %d, %lx, %d)", filename, setupsan2, + debug(5, "smush_setupSanWithFlu(%s, %d, %d, %d, %d, %lx, %d)", filename, setupsan2, step1, step2, setupsan1, fluPtr, numFrames); _smush_setupsan1 = setupsan1; @@ -1443,6 +1424,7 @@ void Insane::smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32 _smush_setupsan4 = 1; _smush_curFrame = numFrames; smush_setFrameSteps(step1, step2); + smush_warpMouse(160, 100, -1); } void Insane::smush_setupSanFromStart(const char *filename, int32 setupsan2, int32 step1, @@ -1452,6 +1434,7 @@ void Insane::smush_setupSanFromStart(const char *filename, int32 setupsan2, int3 smush_setupSanFile(filename, 8, 0); _smush_isSanFileSetup = 1; smush_setFrameSteps(step1, step2); + smush_warpMouse(160, 100, -1); } void Insane::smush_setFrameSteps(int32 step1, int32 step2) { @@ -1461,7 +1444,7 @@ void Insane::smush_setFrameSteps(int32 step1, int32 step2) { } void Insane::smush_setupSanFile(const char *filename, int32 offset, int32 contFrame) { - debug(0, "smush_setupSanFile(%s, %x, %d)", filename, offset, contFrame); + debug(5, "smush_setupSanFile(%s, %x, %d)", filename, offset, contFrame); _player->seekSan(filename, _vm->getGameDataPath(), offset, contFrame); diff --git a/scumm/insane/insane.h b/scumm/insane/insane.h index f8f03e0e35..94dc28c446 100644 --- a/scumm/insane/insane.h +++ b/scumm/insane/insane.h @@ -169,11 +169,11 @@ class Insane { bool _benHasGoggles; bool _mineCaveIsNear; bool _objectDetected; + bool _roadBumps; int32 _val32d; int32 _val54d; int32 _val57d; bool _val115_; - bool _val121_; int32 _val211d; int32 _val213d; int32 _val215d; @@ -292,7 +292,6 @@ class Insane { int32 readArray(int item); void writeArray(int item, int value); - int smlayer_mainLoop(void); void mainLoop(void); bool idx1Compare(void); bool idx2Compare(void); diff --git a/scumm/insane/insane_ben.cpp b/scumm/insane/insane_ben.cpp index 2427556fab..a270ca46c4 100644 --- a/scumm/insane/insane_ben.cpp +++ b/scumm/insane/insane_ben.cpp @@ -83,7 +83,7 @@ void Insane::turnBen(bool controllable) { if (_currEnemy == EN_TORQUE) buttons = 0; } - debug(1, "00:%d 01:%d 02:%d 03:%d", _actor[0].act[0].state, + debug(5, "00:%d 01:%d 02:%d 03:%d", _actor[0].act[0].state, _actor[0].act[1].state, _actor[0].act[2].state, _actor[0].act[3].state); actor01Reaction(buttons); actor02Reaction(buttons); @@ -504,198 +504,54 @@ void Insane::actor02Reaction(int32 buttons) { int32 tmp, tmp2; switch(_actor[0].act[2].state) { - case 106: - smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - smlayer_setActorFacing(0, 2, 29, 180); - _actor[0].act[2].state = 107; - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 107: - smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - if (_actor[0].act[2].frame >= 9) { - _actor[0].act[2].state = 1; - _actor[0].inventory[INV_MACE] = 0; - smlayer_startVoice(318); - switchBenWeapon(); - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 104: - smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - smlayer_setActorFacing(0, 2, 28, 180); - _actor[0].act[2].state = 105; - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 105: - smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - if (_actor[0].act[2].frame >= 5) { - _actor[0].act[2].state = 1; - _actor[0].inventory[INV_MACE] = 0; - smlayer_startVoice(318); - switchBenWeapon(); - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 108: - smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - smlayer_setActorFacing(0, 2, 28, 180); - _actor[0].act[2].state = 109; - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 109: + case 1: smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - if (_actor[0].act[2].frame >= 5) { - _actor[0].act[2].state = 1; - _actor[0].inventory[INV_CHAIN] = 0; // Chain - smlayer_startVoice(318); - switchBenWeapon(); - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 73: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = true; - if (_actor[0].act[2].frame >= 2 && !_kickBenProgress) { - smlayer_setActorFacing(0, 2, 19, 180); - _actor[0].act[2].state = 74; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 74: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = false; - if (_actor[0].act[2].frame >= 2) { - smlayer_setActorFacing(0, 2, 9, 180); - _actor[0].act[2].state = 1; - _actor[0].weaponClass = 2; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 79: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = true; - if (_actor[0].act[2].frame >= 2) { - smlayer_setActorFacing(0, 2, 23, 180); - _actor[0].act[2].state = 80; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 80: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = false; - if (_actor[0].act[2].frame >= 6) { - smlayer_setActorFacing(0, 2, 25, 180); - _actor[0].act[2].state = 63; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 81: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = true; - if (_actor[0].act[2].frame >= 2 && !_kickBenProgress) { - smlayer_setActorFacing(0, 2, 23, 180); - _actor[0].act[2].state = 82; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 82: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = false; - if (_actor[0].act[2].frame >= 3) { - smlayer_setActorFacing(0, 2, 26, 180); - _actor[0].act[2].state = 64; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 77: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = true; - if (_actor[0].act[2].frame >= 2) { - smlayer_setActorFacing(0, 2, 23, 180); - _actor[0].act[2].state = 78; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 78: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = false; - if (_actor[0].act[2].frame >= 5) { - smlayer_setActorFacing(0, 2, 25, 180); - _actor[0].act[2].state = 65; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 83: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 0; - _actor[0].kicking = false; - _actor[0].field_44 = true; - if (_actor[0].act[2].frame >= 2 && !_kickBenProgress) { - smlayer_setActorFacing(0, 2, 23, 180); - _actor[0].act[2].state = 84; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 84: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 0; - _actor[0].kicking = false; - _actor[0].field_44 = false; - if (_actor[0].act[2].frame >= 5) { - smlayer_setActorFacing(0, 2, 25, 180); - _actor[0].act[2].state = 66; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 75: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - _actor[0].field_44 = true; - if (_actor[0].act[2].frame >= 4 && !_kickBenProgress) { - smlayer_setActorFacing(0, 2, 23, 180); - _actor[0].act[2].state = 76; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 76: - smlayer_setActorLayer(0, 2, 6); - _actor[0].weaponClass = 1; + _actor[0].weaponClass = 2; _actor[0].kicking = false; - _actor[0].field_44 = false; - if (_actor[0].act[2].frame >= 4) { - smlayer_setActorFacing(0, 2, 25, 180); - _actor[0].act[2].state = 62; + + switch (_actor[0].tilt) { + case -3: + if (_actor[0].act[2].animTilt != -3) { + smlayer_setActorFacing(0, 2, 6, 180); + _actor[0].act[2].animTilt = -3; + } + break; + case -2: + if (_actor[0].field_8 == 48) + smlayer_setActorFacing(0, 2, 7, 180); + _actor[0].act[2].animTilt = -2; + break; + case -1: + if (_actor[0].field_8 == 46) + smlayer_setActorFacing(0, 2, 8, 180); + _actor[0].act[2].animTilt = -1; + break; + case 0: + if (_actor[0].act[2].animTilt) { + smlayer_setActorFacing(0, 2, 9, 180); + _actor[0].act[2].animTilt = 0; + } + break; + case 1: + if (_actor[0].field_8 == 49) + smlayer_setActorFacing(0, 2, 10, 180); + _actor[0].act[2].animTilt = 1; + break; + case 2: + if (_actor[0].field_8 == 51) + smlayer_setActorFacing(0, 2, 11, 180); + _actor[0].act[2].animTilt = 2; + break; + case 3: + if (_actor[0].act[2].animTilt != 3) { + smlayer_setActorFacing(0, 2, 12, 180); + _actor[0].act[2].animTilt = 3; + } + break; + default: + break; } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + _actor[0].act[2].tilt = 0; break; case 2: smlayer_setActorLayer(0, 2, 4); @@ -746,6 +602,56 @@ void Insane::actor02Reaction(int32 buttons) { case 5: smlayer_setActorLayer(0, 2, 5); break; + case 6: + smlayer_setActorLayer(0, 2, 4); + _actor[0].weaponClass = 2; + _actor[0].field_34 = 1; + _actor[0].kicking = false; + smlayer_setActorCostume(0, 2, readArray(22)); + smlayer_setActorFacing(0, 2, 19, 180); + _actor[0].act[2].state = 7; + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + smlayer_startSfx(66); + break; + case 7: + smlayer_setActorLayer(0, 2, 4); + _actor[0].weaponClass = 2; + _actor[0].field_34 = 1; + _actor[0].kicking = false; + if (_actor[0].act[2].frame >= 1) { + smlayer_setActorFacing(0, 2, 20, 180); + _actor[0].act[2].state = 8; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 8: + smlayer_setActorLayer(0, 2, 4); + _actor[0].weaponClass = 2; + _actor[0].field_34 = 1; + _actor[0].kicking = false; + if ((_actor[0].act[2].frame == 3) && (calcEnemyDamage(0, 0) == 1)) { + _actor[1].damage = weaponDamage(0); + smlayer_startSfx(64); + _actor[1].cursorX = 320; + } + if (_actor[0].act[2].frame >= 5) { + smlayer_setActorFacing(0, 2, 21, 180); + _actor[0].act[2].state = 9; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 9: + smlayer_setActorLayer(0, 2, 5); + _actor[0].weaponClass = 2; + _actor[0].field_34 = 1; + _actor[0].kicking = false; + if (_actor[0].act[2].frame >= 3) { + smlayer_setActorCostume(0, 2, readArray(12)); + _actor[0].field_34 = 2; + _actor[0].act[2].state = 1; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; case 10: smlayer_setActorLayer(0, 2, 4); _actor[0].weaponClass = 1; @@ -789,20 +695,6 @@ void Insane::actor02Reaction(int32 buttons) { } _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; - case 97: - smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 1; - _actor[0].kicking = true; - if (_actor[0].act[2].frame >= 5) { - _actor[0].act[2].room = 1; - _actor[0].act[1].room = 1; - _actor[0].act[0].room = 1; - smlayer_setActorFacing(0, 2, 21, 180); - _actor[0].act[2].state = 13; - _actor[0].x = _actor[1].x - 116; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; case 12: smlayer_setActorLayer(0, 2, 4); _actor[0].weaponClass = 1; @@ -821,9 +713,7 @@ void Insane::actor02Reaction(int32 buttons) { if (tmp == 1000) smlayer_startSfx(74); break; - case INV_WRENCH: - case INV_BOOT: - case INV_HAND: + default: if(calcEnemyDamage(1, 0) == 1) smlayer_startSfx(73); break; @@ -850,56 +740,6 @@ void Insane::actor02Reaction(int32 buttons) { } _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; - case 6: - smlayer_setActorLayer(0, 2, 4); - _actor[0].weaponClass = 2; - _actor[0].field_34 = 1; - _actor[0].kicking = false; - smlayer_setActorCostume(0, 2, readArray(22)); - smlayer_setActorFacing(0, 2, 19, 180); - _actor[0].act[2].state = 7; - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - smlayer_startSfx(66); - break; - case 7: - smlayer_setActorLayer(0, 2, 4); - _actor[0].weaponClass = 2; - _actor[0].field_34 = 1; - _actor[0].kicking = false; - if (_actor[0].act[2].frame >= 1) { - smlayer_setActorFacing(0, 2, 20, 180); - _actor[0].act[2].state = 8; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 8: - smlayer_setActorLayer(0, 2, 4); - _actor[0].weaponClass = 2; - _actor[0].field_34 = 1; - _actor[0].kicking = false; - if ((_actor[0].act[2].frame == 3) && (calcEnemyDamage(0, 0) == 1)) { - _actor[1].damage = weaponDamage(0); - smlayer_startSfx(64); - _actor[1].cursorX = 320; - } - if (_actor[0].act[2].frame >= 5) { - smlayer_setActorFacing(0, 2, 21, 180); - _actor[0].act[2].state = 9; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 9: - smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 2; - _actor[0].field_34 = 1; - _actor[0].kicking = false; - if (_actor[0].act[2].frame >= 3) { - smlayer_setActorCostume(0, 2, readArray(12)); - _actor[0].field_34 = 2; - _actor[0].act[2].state = 1; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; case 14: smlayer_setActorLayer(0, 2, 8); _actor[0].weaponClass = 1; @@ -1011,7 +851,7 @@ void Insane::actor02Reaction(int32 buttons) { break; case INV_CHAINSAW: if (_actor[1].kicking || _actor[1].field_44) - _actor[0].act[2].state = 106; + _actor[0].act[2].state = 20; else { smlayer_setActorFacing(0, 2, 20, 180); _actor[0].act[2].state = 20; @@ -1024,14 +864,14 @@ void Insane::actor02Reaction(int32 buttons) { _actor[0].act[2].state = 77; break; } + // break skipped intentionally default: - smlayer_setActorFacing(0, 2, 19, 180); - _actor[0].act[2].state = 19; + smlayer_setActorFacing(0, 2, 20, 180); + _actor[0].act[2].state = 20; break; } - smlayer_setActorFacing(0, 2, 20, 180); - _actor[0].act[2].state = 20; } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; case 20: @@ -1052,8 +892,8 @@ void Insane::actor02Reaction(int32 buttons) { smlayer_startSfx(68); break; default: - smlayer_setActorFacing(0, 2, 19, 180); - _actor[0].act[2].state = 19; + if (calcEnemyDamage(1, 0)) + smlayer_startSfx(67); break; } } else { @@ -1077,25 +917,6 @@ void Insane::actor02Reaction(int32 buttons) { } _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; - case 110: - smlayer_setActorLayer(0, 2, 4); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - smlayer_setActorFacing(0, 2, 30, 180); - _actor[0].act[2].state = 111; - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 111: - smlayer_setActorLayer(0, 2, 4); - _actor[0].weaponClass = 1; - _actor[0].kicking = false; - if (_actor[0].act[2].frame >= 7) { - smlayer_setActorFacing(0, 2, 25, 180); - _actor[0].act[2].state = 65; - _actor[0].inventory[INV_CHAIN] = 1; // Chain - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; case 22: smlayer_setActorLayer(0, 2, 6); _actor[0].weaponClass = 0; @@ -1120,15 +941,14 @@ void Insane::actor02Reaction(int32 buttons) { if (weaponBenIsEffective()) { smlayer_setActorFacing(0, 2, 22, 180); _actor[0].act[2].state = 83; + break; } - break; + // break missed intentionally default: smlayer_setActorFacing(0, 2, 20, 180); _actor[0].act[2].state = 24; break; } - smlayer_setActorFacing(0, 2, 21, 180); - _actor[0].act[2].state = 21; } _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; @@ -1192,10 +1012,6 @@ void Insane::actor02Reaction(int32 buttons) { _actor[0].kicking = true; if (_actor[0].act[2].frame >= 1) { switch (_actor[1].weapon) { - case INV_HAND: - smlayer_setActorFacing(0, 2, 20, 180); - _actor[0].act[2].state = 28; - break; case INV_CHAIN: case INV_CHAINSAW: case INV_MACE: @@ -1207,6 +1023,7 @@ void Insane::actor02Reaction(int32 buttons) { _actor[0].act[2].state = 75; break; } + // break missed intentionaly default: smlayer_setActorFacing(0, 2, 20, 180); _actor[0].act[2].state = 28; @@ -1234,8 +1051,8 @@ void Insane::actor02Reaction(int32 buttons) { if (tmp == 1000) smlayer_startSfx(71); break; - case 6: - if (!calcEnemyDamage(0, 1)) + case INV_HAND: + if (!calcEnemyDamage(1, 0)) smlayer_startSfx(70); break; default: @@ -1316,6 +1133,28 @@ void Insane::actor02Reaction(int32 buttons) { } _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; + case 34: + smlayer_setActorLayer(0, 2, 5); + _actor[0].kicking = false; + + if (!smlayer_actorNeedRedraw(0, 2)) { + setBenState(); + _actor[0].act[2].tilt = 0; + // for some reason there is no break at this + // place, so tilt gets overriden on next line + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 35: + smlayer_setActorLayer(0, 2, 5); + _actor[0].kicking = false; + + if (!smlayer_actorNeedRedraw(0, 2)) { + switchBenWeapon(); + _actor[0].act[2].tilt = 0; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; case 36: smlayer_setActorLayer(0, 2, 5); _actor[0].kicking = false; @@ -1410,28 +1249,6 @@ void Insane::actor02Reaction(int32 buttons) { _actor[0].act[2].state = 38; } break; - case 34: - smlayer_setActorLayer(0, 2, 5); - _actor[0].kicking = false; - - if (!smlayer_actorNeedRedraw(0, 2)) { - setBenState(); - _actor[0].act[2].tilt = 0; - // for some reason there is no break at this - // place, so tilt gets overriden on next line - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; - case 35: - smlayer_setActorLayer(0, 2, 5); - _actor[0].kicking = false; - - if (!smlayer_actorNeedRedraw(0, 2)) { - switchBenWeapon(); - _actor[0].act[2].tilt = 0; - } - _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - break; case 63: smlayer_setActorLayer(0, 2, 5); if (_actor[0].act[2].animTilt) { @@ -1482,54 +1299,231 @@ void Insane::actor02Reaction(int32 buttons) { _actor[0].kicking = false; _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; - case 1: + case 73: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = true; + if (_actor[0].act[2].frame >= 2 && !_kickBenProgress) { + smlayer_setActorFacing(0, 2, 19, 180); + _actor[0].act[2].state = 74; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 74: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = false; + if (_actor[0].act[2].frame >= 2) { + smlayer_setActorFacing(0, 2, 9, 180); + _actor[0].act[2].state = 1; + _actor[0].weaponClass = 2; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 75: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = true; + if (_actor[0].act[2].frame >= 4 && !_kickBenProgress) { + smlayer_setActorFacing(0, 2, 23, 180); + _actor[0].act[2].state = 76; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 76: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = false; + if (_actor[0].act[2].frame >= 4) { + smlayer_setActorFacing(0, 2, 25, 180); + _actor[0].act[2].state = 62; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 77: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = true; + if (_actor[0].act[2].frame >= 2) { + smlayer_setActorFacing(0, 2, 23, 180); + _actor[0].act[2].state = 78; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 78: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = false; + if (_actor[0].act[2].frame >= 5) { + smlayer_setActorFacing(0, 2, 25, 180); + _actor[0].act[2].state = 65; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 79: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = true; + if (_actor[0].act[2].frame >= 2) { + smlayer_setActorFacing(0, 2, 23, 180); + _actor[0].act[2].state = 80; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 80: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = false; + if (_actor[0].act[2].frame >= 6) { + smlayer_setActorFacing(0, 2, 25, 180); + _actor[0].act[2].state = 63; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 81: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = true; + if (_actor[0].act[2].frame >= 2 && !_kickBenProgress) { + smlayer_setActorFacing(0, 2, 23, 180); + _actor[0].act[2].state = 82; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 82: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + _actor[0].field_44 = false; + if (_actor[0].act[2].frame >= 3) { + smlayer_setActorFacing(0, 2, 26, 180); + _actor[0].act[2].state = 64; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 83: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 0; + _actor[0].kicking = false; + _actor[0].field_44 = true; + if (_actor[0].act[2].frame >= 2 && !_kickBenProgress) { + smlayer_setActorFacing(0, 2, 23, 180); + _actor[0].act[2].state = 84; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 84: + smlayer_setActorLayer(0, 2, 6); + _actor[0].weaponClass = 0; + _actor[0].kicking = false; + _actor[0].field_44 = false; + if (_actor[0].act[2].frame >= 5) { + smlayer_setActorFacing(0, 2, 25, 180); + _actor[0].act[2].state = 66; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 97: smlayer_setActorLayer(0, 2, 5); - _actor[0].weaponClass = 2; + _actor[0].weaponClass = 1; + _actor[0].kicking = true; + if (_actor[0].act[2].frame >= 5) { + _actor[0].act[2].room = 1; + _actor[0].act[1].room = 1; + _actor[0].act[0].room = 1; + smlayer_setActorFacing(0, 2, 21, 180); + _actor[0].act[2].state = 13; + _actor[0].x = _actor[1].x - 116; + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 104: + smlayer_setActorLayer(0, 2, 5); + _actor[0].weaponClass = 1; _actor[0].kicking = false; - - switch (_actor[0].tilt) { - case -3: - if (_actor[0].act[2].animTilt != -3) { - smlayer_setActorFacing(0, 2, 6, 180); - _actor[0].act[2].animTilt = -3; - } - break; - case -2: - if (_actor[0].field_8 == 48) - smlayer_setActorFacing(0, 2, 7, 180); - _actor[0].act[2].animTilt = -2; - break; - case -1: - if (_actor[0].field_8 == 46) - smlayer_setActorFacing(0, 2, 8, 180); - _actor[0].act[2].animTilt = -1; - break; - case 0: - if (_actor[0].act[2].animTilt) { - smlayer_setActorFacing(0, 2, 9, 180); - _actor[0].act[2].animTilt = 0; - } - break; - case 1: - if (_actor[0].field_8 == 49) - smlayer_setActorFacing(0, 2, 10, 180); - _actor[0].act[2].animTilt = 1; - break; - case 2: - if (_actor[0].field_8 == 51) - smlayer_setActorFacing(0, 2, 11, 180); - _actor[0].act[2].animTilt = 2; - break; - case 3: - if (_actor[0].act[2].animTilt != 3) { - smlayer_setActorFacing(0, 2, 12, 180); - _actor[0].act[2].animTilt = 3; - } - break; - default: - break; + smlayer_setActorFacing(0, 2, 28, 180); + _actor[0].act[2].state = 105; + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 105: + smlayer_setActorLayer(0, 2, 5); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + if (_actor[0].act[2].frame >= 5) { + _actor[0].act[2].state = 1; + _actor[0].inventory[INV_MACE] = 0; + smlayer_startVoice(318); + switchBenWeapon(); } - _actor[0].act[2].tilt = 0; + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 106: + smlayer_setActorLayer(0, 2, 5); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + smlayer_setActorFacing(0, 2, 29, 180); + _actor[0].act[2].state = 107; + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 107: + smlayer_setActorLayer(0, 2, 5); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + if (_actor[0].act[2].frame >= 9) { + _actor[0].act[2].state = 1; + _actor[0].inventory[INV_MACE] = 0; + smlayer_startVoice(318); + switchBenWeapon(); + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 108: + smlayer_setActorLayer(0, 2, 5); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + smlayer_setActorFacing(0, 2, 28, 180); + _actor[0].act[2].state = 109; + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 109: + smlayer_setActorLayer(0, 2, 5); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + if (_actor[0].act[2].frame >= 5) { + _actor[0].act[2].state = 1; + _actor[0].inventory[INV_CHAIN] = 0; // Chain + smlayer_startVoice(318); + switchBenWeapon(); + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 110: + smlayer_setActorLayer(0, 2, 4); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + smlayer_setActorFacing(0, 2, 30, 180); + _actor[0].act[2].state = 111; + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); + break; + case 111: + smlayer_setActorLayer(0, 2, 4); + _actor[0].weaponClass = 1; + _actor[0].kicking = false; + if (_actor[0].act[2].frame >= 7) { + smlayer_setActorFacing(0, 2, 25, 180); + _actor[0].act[2].state = 65; + _actor[0].inventory[INV_CHAIN] = 1; // Chain + } + _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); break; default: break; @@ -1721,10 +1715,29 @@ void Insane::actor03Reaction(int32 buttons) { int32 tmp; switch (_actor[0].act[3].state) { - case 117: - reinitActors(); - smlayer_setActorFacing(0, 3, 13, 180); - _actor[0].act[3].state = 69; + case 1: + _actor[0].field_54 = 0; + break; + case 52: + if (_actor[0].runningSound) + smlayer_stopSound(_actor[0].runningSound); + + if (_currScenePropIdx) + shutCurrentScene(); + + _actor[0].runningSound = 0; + _actor[0].defunct = 0; + _actor[0].field_54 = 0; + smlayer_setActorFacing(0, 3, 15, 180); + _actor[0].act[3].state = 53; + break; + case 53: + if (_actor[0].act[3].frame >= 2) { + smlayer_setActorFacing(0, 3, 16, 180); + _actor[0].act[3].state = 54; + } + break; + case 54: break; case 69: if (_actor[0].act[3].frame >= 2) @@ -1743,6 +1756,11 @@ void Insane::actor03Reaction(int32 buttons) { _actor[0].act[3].state = 118; } break; + case 71: + _actor[0].field_54 = 0; + if (_actor[0].act[3].frame >= 2) + _actor[0].act[3].state = 1; + break; case 72: if (_actor[0].runningSound) { if (!smlayer_isSoundRunning(_actor[0].runningSound)) { @@ -1760,39 +1778,15 @@ void Insane::actor03Reaction(int32 buttons) { } } break; + case 117: + reinitActors(); + smlayer_setActorFacing(0, 3, 13, 180); + _actor[0].act[3].state = 69; + break; case 118: smlayer_setActorFacing(0, 3, 14, 180); _actor[0].act[3].state = 71; break; - case 71: - _actor[0].field_54 = 0; - if (_actor[0].act[3].frame >= 2) - _actor[0].act[3].state = 1; - break; - case 52: - if (_actor[0].runningSound) - smlayer_stopSound(_actor[0].runningSound); - - if (_currScenePropIdx) - shutCurrentScene(); - - _actor[0].runningSound = 0; - _actor[0].defunct = 0; - _actor[0].field_54 = 0; - smlayer_setActorFacing(0, 3, 15, 180); - _actor[0].act[3].state = 53; - break; - case 53: - if (_actor[0].act[3].frame >= 2) { - smlayer_setActorFacing(0, 3, 16, 180); - _actor[0].act[3].state = 54; - } - break; - case 54: - break; - case 1: - _actor[0].field_54 = 0; - break; default: break; } diff --git a/scumm/insane/insane_enemy.cpp b/scumm/insane/insane_enemy.cpp index 510eec51f3..a119bda29b 100644 --- a/scumm/insane/insane_enemy.cpp +++ b/scumm/insane/insane_enemy.cpp @@ -166,7 +166,7 @@ int32 Insane::enemy0handler(int32 actor1, int32 actor2, int32 probability) { retval = 1; } if (_actor[actor2].kicking) { - if (weaponMaxRange(actor2) <= dist) + if (weaponMaxRange(actor2) >= dist) if (rand() % (probability * 2) <= 1) retval = 1; } @@ -330,7 +330,7 @@ int32 Insane::enemy1handler(int32 actor1, int32 actor2, int32 probability) { retval = 1; } if (_actor[actor2].kicking) { - if (weaponMaxRange(actor2) <= dist) + if (weaponMaxRange(actor2) >= dist) if (rand() % (probability * 2) <= 1) retval = 1; } @@ -474,7 +474,7 @@ int32 Insane::enemy2handler(int32 actor1, int32 actor2, int32 probability) { retval = 1; } if (_actor[actor2].kicking) { - if (weaponMaxRange(actor2) <= dist) + if (weaponMaxRange(actor2) >= dist) if (rand() % (probability * 2) <= 1) retval = 1; } @@ -575,12 +575,11 @@ int32 Insane::enemy3handler(int32 actor1, int32 actor2, int32 probability) { if (!_actor[actor1].defunct) { if (_enHdlVar[EN_VULTF1][1] > _enHdlVar[EN_VULTF1][2]) { - if (act1damage - act2damage >= 30) { - if (rand() % probability != 1) - _enHdlVar[EN_VULTF1][0] = 0; - else - _enHdlVar[EN_VULTF1][0] = 1; - } + if ((act1damage - act2damage >= 30) && (rand() % probability != 1)) + _enHdlVar[EN_VULTF1][0] = 0; + else + _enHdlVar[EN_VULTF1][0] = 1; + _enHdlVar[EN_VULTF1][1] = 0; _enHdlVar[EN_VULTF1][2] = rand() % (probability * 2); } @@ -625,12 +624,12 @@ int32 Insane::enemy3handler(int32 actor1, int32 actor2, int32 probability) { retval = 1; } else { if (_actor[actor1].kicking) - if (weaponMaxRange(actor2) <= dist) + if (weaponMaxRange(actor2) >= dist) if (rand() % probability <= 1) retval = 1; } _enHdlVar[EN_VULTF1][5] = 0; - _enHdlVar[EN_VULTF1][6] = ABS(rand() % probability) * 2; + _enHdlVar[EN_VULTF1][6] = ABS(rand() % probability) / 2; } if (_actor[actor1].weapon == -1) @@ -914,7 +913,7 @@ int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) { if (_enHdlVar[EN_VULTF2][3] >= 2 || act1damage) { _actor[actor1].damage = 10; - if (weaponMaxRange(actor2) >= dist) { + if (weaponMaxRange(actor1) <= dist) { if (act2x < act1x) _actor[actor1].cursorX = -101; else @@ -923,13 +922,13 @@ int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) { _actor[actor1].cursorX = 0; } - if (weaponMaxRange(actor1) + 20 <= dist) + if (weaponMaxRange(actor1) + 20 >= dist) if (rand() % probability == 1) retval = 1; } else { - if (weaponMaxRange(actor2) <= dist && _actor[actor2].weapon == 1) - if (_actor[actor2].kicking) { - if (rand() % probability <= 1) + if (weaponMaxRange(actor2) >= dist && _actor[actor2].weapon == INV_CHAINSAW) + if (!_actor[actor2].kicking) { + if (rand() % probability == 1) retval = 1; } else { retval = 1; @@ -1046,12 +1045,12 @@ int32 Insane::enemy6handler(int32 actor1, int32 actor2, int32 probability) { act1x = _actor[actor1].x; // esi act2x = _actor[actor2].x; // edi - if (_actor[actor2].weapon == 1) + if (_actor[actor2].weapon == INV_CHAINSAW) retval = 1; dist = ABS(act1x - act2x); - if (!_actor[actor1].defunct) { + if (_actor[actor1].defunct) { /* scenePropIdx[18] */ if (_currScenePropIdx == 50 && _currScenePropSubIdx == 3) retval = 1; @@ -1097,7 +1096,7 @@ int32 Insane::enemy6handler(int32 actor1, int32 actor2, int32 probability) { } } } else { - if (weaponMaxRange(actor1) <= dist) { + if (weaponMaxRange(actor2) >= dist) { if (act2x < act1x) _actor[actor1].cursorX = 101; else @@ -1107,9 +1106,6 @@ int32 Insane::enemy6handler(int32 actor1, int32 actor2, int32 probability) { } } - if (_actor[actor1].weapon == -1) - retval = 2; - if ((_enHdlVar[EN_VULTM2][1] == 0) && ( _actor[actor1].field_54 == 0) && (_actor[actor2].lost == 0) && @@ -1139,6 +1135,9 @@ int32 Insane::enemy6handler(int32 actor1, int32 actor2, int32 probability) { else if (act1x > 280) _actor[actor1].cursorX = -160; + if (_actor[actor1].weapon == -1) + retval = 2; + // Shift+V cheat to win the battle if (_vm->getKeyState(0x56) && !_beenCheated && !_actor[0].lost && !_actor[1].lost) { @@ -1183,7 +1182,7 @@ int32 Insane::enemy7handler(int32 actor1, int32 actor2, int32 probability) { retval = 0; act1damage = _actor[actor1].damage; // ebx - act1x = _actor[actor1].x; // ebp + act1x = _actor[actor1].x; // ebp, esi act2x = _actor[actor2].x; // edi dist = ABS(act1x - act2x); @@ -1193,26 +1192,28 @@ int32 Insane::enemy7handler(int32 actor1, int32 actor2, int32 probability) { _enHdlVar[EN_CAVEFISH][1] = 0; } else { if (!_enHdlVar[EN_CAVEFISH][2]) { - if (weaponMaxRange(actor2) - 30 <= dist) { + if (weaponMaxRange(actor2) + 30 >= dist) { if (act2x < act1x) _actor[actor1].cursorX = 101; else _actor[actor1].cursorX = -101; - } else { + } else { _actor[actor1].cursorX = 0; } + goto _labelA; } } - if (weaponMaxRange(actor1) > dist) { + if (weaponMaxRange(actor1) <= dist) { if (act2x < act1x) - _actor[actor1].cursorX = 101; - else _actor[actor1].cursorX = -101; + else + _actor[actor1].cursorX = 101; } else { _actor[actor1].cursorX = 0; } + _labelA: if (act1x > 310) _actor[actor1].cursorX = -320; else if (act1x < 10) @@ -1352,7 +1353,7 @@ void Insane::turnEnemy(bool battle) { if (battle) buttons = actionEnemy(); - debug(1, "11:%d 12:%d 13:%d 10:%d", _actor[1].act[1].state, + debug(5, "11:%d 12:%d 13:%d 10:%d", _actor[1].act[1].state, _actor[1].act[2].state, _actor[1].act[3].state, _actor[1].act[0].state); actor11Reaction(buttons); actor12Reaction(buttons); @@ -1481,7 +1482,7 @@ void Insane::actor11Reaction(int32 buttons) { void Insane::chooseEnemyWeaponAnim(int32 buttons) { // kick if ((buttons & 1) && (!_actor[0].lost)) { - if (!_kickEnemyProgress && actor0StateFlags2(_actor[1].act[2].state + _actor[1].weapon * 238)) { + if (!_kickEnemyProgress && actor0StateFlags2(_actor[1].act[2].state + _actor[1].weapon * 119)) { switch (_actor[1].weapon) { case INV_CHAIN: _actor[1].act[2].state = 10; @@ -1522,9 +1523,6 @@ void Insane::chooseEnemyWeaponAnim(int32 buttons) { _actor[1].act[2].state == 34) return; - if (!actor0StateFlags1(_actor[1].act[2].state)) - return; - switch (_actor[1].weapon) { case INV_CHAIN: case INV_CHAINSAW: @@ -1592,7 +1590,7 @@ void Insane::setEnemyState(void) { if (_currEnemy == EN_CAVEFISH) { _actor[1].weaponClass = 2; - if (!_val121_) + if (!_roadBumps) _actor[1].act[2].state = 98; else _actor[1].act[2].state = 99; @@ -1631,175 +1629,56 @@ void Insane::setEnemyState(void) { void Insane::actor12Reaction(int32 buttons) { int32 tmp, tmp2; - - switch(_actor[1].act[2].state) { - case 106: - smlayer_setActorLayer(1, 2, 5); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - smlayer_setActorFacing(1, 2, 29, 180); - _actor[1].act[2].state = 107; - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 107: - smlayer_setActorLayer(1, 2, 5); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - if (_actor[1].act[2].frame >= 8) - _actor[1].damage = _actor[1].maxdamage + 10; - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 108: - smlayer_setActorLayer(1, 2, 5); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - smlayer_setActorFacing(1, 2, 28, 180); - _actor[1].act[2].state = 109; - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 109: + switch(_actor[1].act[2].state) { + case 1: smlayer_setActorLayer(1, 2, 5); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - if (_actor[1].act[2].frame >= 6) - _actor[1].damage = _actor[1].maxdamage + 10; - - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 73: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; + _actor[1].weaponClass = 2; _actor[1].kicking = false; - _actor[1].field_44 = true; - if (_actor[1].act[2].frame >= 2 && !_kickEnemyProgress) { - smlayer_setActorFacing(1, 2, 19, 180); - _actor[1].act[2].state = 74; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 74: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = false; - if (_actor[1].act[2].frame >= 2) { - smlayer_setActorFacing(1, 2, 9, 180); - _actor[1].act[2].state = 1; - _actor[1].weaponClass = 2; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 79: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = true; - if (_actor[1].act[2].frame >= 1 && !_kickEnemyProgress) { - smlayer_setActorFacing(1, 2, 23, 180); - _actor[1].act[2].state = 80; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 80: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = false; - if (_actor[1].act[2].frame >= 6) { - smlayer_setActorFacing(1, 2, 25, 180); - _actor[1].act[2].state = 63; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 81: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = true; - if (_actor[1].act[2].frame >= 2 && !_kickEnemyProgress) { - smlayer_setActorFacing(1, 2, 23, 180); - _actor[1].act[2].state = 82; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 82: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = false; - if (_actor[1].act[2].frame >= 3) { - smlayer_setActorFacing(1, 2, 26, 180); - _actor[1].act[2].state = 64; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 77: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = true; - if (_actor[1].act[2].frame >= 1 && !_kickEnemyProgress) { - smlayer_setActorFacing(1, 2, 23, 180); - _actor[1].act[2].state = 78; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 78: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = false; - if (_actor[1].act[2].frame >= 5) { - smlayer_setActorFacing(1, 2, 25, 180); - _actor[1].act[2].state = 65; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 83: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 0; - _actor[1].kicking = false; - _actor[1].field_44 = true; - if (_actor[1].act[2].frame >= 2 && !_kickEnemyProgress) { - smlayer_setActorFacing(1, 2, 23, 180); - _actor[1].act[2].state = 84; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 84: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 0; - _actor[1].kicking = false; - _actor[1].field_44 = false; - if (_actor[1].act[2].frame >= 5) { - smlayer_setActorFacing(1, 2, 25, 180); - _actor[1].act[2].state = 66; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 75: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = true; - if (_actor[1].act[2].frame >= 4 && !_kickEnemyProgress) { - smlayer_setActorFacing(1, 2, 23, 180); - _actor[1].act[2].state = 76; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 76: - smlayer_setActorLayer(1, 2, 6); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - _actor[1].field_44 = false; - if (_actor[1].act[2].frame >= 4) { - smlayer_setActorFacing(1, 2, 25, 180); - _actor[1].act[2].state = 62; + switch (_actor[1].tilt) { + case -3: + if (_actor[1].act[2].animTilt != -3) { + smlayer_setActorFacing(1, 2, 6, 180); + _actor[1].act[2].animTilt = -3; + } + break; + case -2: + if (_actor[1].field_8 == 48) + smlayer_setActorFacing(1, 2, 7, 180); + _actor[1].act[2].animTilt = -2; + break; + case -1: + if (_actor[1].field_8 == 46) + smlayer_setActorFacing(1, 2, 8, 180); + _actor[1].act[2].animTilt = -1; + break; + case 0: + if (_actor[1].act[2].animTilt) { + smlayer_setActorFacing(1, 2, 9, 180); + _actor[1].act[2].animTilt = 0; + } + break; + case 1: + if (_actor[1].field_8 == 49) + smlayer_setActorFacing(1, 2, 10, 180); + _actor[1].act[2].animTilt = 1; + break; + case 2: + if (_actor[1].field_8 == 51) + smlayer_setActorFacing(1, 2, 11, 180); + _actor[1].act[2].animTilt = 2; + break; + case 3: + if (_actor[1].act[2].animTilt != 3) { + smlayer_setActorFacing(1, 2, 12, 180); + _actor[1].act[2].animTilt = 3; + } + break; + default: + break; } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + _actor[1].act[2].tilt = 0; break; case 2: smlayer_setActorLayer(1, 2, 4); @@ -1923,7 +1802,7 @@ void Insane::actor12Reaction(int32 buttons) { case INV_CHAINSAW: case INV_MACE: case INV_2X4: - case INV_DUST: + case INV_WRENCH: if (weaponEnemyIsEffective()) { smlayer_setActorFacing(1, 2, 22, 180); _actor[1].act[2].state = 81; @@ -1950,7 +1829,7 @@ void Insane::actor12Reaction(int32 buttons) { case INV_CHAINSAW: case INV_MACE: case INV_2X4: - case INV_DUST: + case INV_WRENCH: tmp = calcBenDamage(1, 1); if (tmp == 1) smlayer_startSfx(76); @@ -2004,6 +1883,9 @@ void Insane::actor12Reaction(int32 buttons) { if (_actor[0].kicking) { _actor[0].act[2].state = 108; _actor[1].act[2].state = 110; + } else { + smlayer_setActorFacing(1, 2, 20, 180); + _actor[1].act[2].state = 20; } break; case INV_CHAINSAW: @@ -2067,25 +1949,6 @@ void Insane::actor12Reaction(int32 buttons) { } _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); break; - case 110: - smlayer_setActorLayer(1, 2, 4); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - smlayer_setActorFacing(1, 2, 30, 180); - _actor[1].act[2].state = 111; - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 111: - smlayer_setActorLayer(1, 2, 4); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - if (_actor[1].act[2].frame >= 7) { - smlayer_setActorFacing(1, 2, 25, 180); - _actor[1].act[2].state = 65; - smlayer_setActorLayer(1, 2, 5); - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; case 22: smlayer_setActorLayer(1, 2, 4); _actor[1].weaponClass = 0; @@ -2099,15 +1962,17 @@ void Insane::actor12Reaction(int32 buttons) { smlayer_setActorLayer(1, 2, 4); _actor[1].weaponClass = 0; _actor[1].kicking = true; - if (weaponEnemyIsEffective()) { - smlayer_setActorFacing(1, 2, 22, 180); - _actor[1].act[2].state = 83; - } else { - smlayer_setActorFacing(1, 2, 20, 180); - _actor[1].act[2].state = 24; - - if (!_actor[1].field_54) - smlayer_startSfx(246); + if (_actor[1].act[2].frame >= 3) { + if (weaponEnemyIsEffective()) { + smlayer_setActorFacing(1, 2, 22, 180); + _actor[1].act[2].state = 83; + } else { + smlayer_setActorFacing(1, 2, 20, 180); + _actor[1].act[2].state = 24; + + if (!_actor[1].field_54) + smlayer_startSfx(246); + } } _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); break; @@ -2123,7 +1988,6 @@ void Insane::actor12Reaction(int32 buttons) { if (tmp == 1000) smlayer_startSfx(80); - break; smlayer_setActorFacing(1, 2, 21, 180); _actor[1].act[2].state = 25; @@ -2193,81 +2057,28 @@ void Insane::actor12Reaction(int32 buttons) { } _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); break; - case 93: - smlayer_setActorLayer(1, 2, 4); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - smlayer_setActorFacing(1, 2, 18, 180); - _actor[1].act[2].state = 94; - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 94: - smlayer_setActorLayer(1, 2, 4); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - if (_actor[1].act[2].frame >= 15) { - smlayer_setActorCostume(1, 2, readArray(44)); - smlayer_setActorFacing(1, 2, 6, 180); - _actor[1].act[2].state = 95; - _actor[1].act[0].room = 0; - _actor[1].act[1].room = 0; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 95: - smlayer_setActorLayer(1, 2, 4); - _actor[1].kicking = false; - if (_actor[1].act[2].frame >= 19) { - queueSceneSwitch(1, _smush_minedrivFlu, "minedriv.san", 64, 0, - _continueFrame1, 1300); - _actor[1].act[2].state = 96; - } - break; - case 92: + case 34: smlayer_setActorLayer(1, 2, 5); _actor[1].kicking = false; - break; - case 97: - smlayer_setActorLayer(1, 2, 25); - _actor[1].lost = true; - if (_actor[1].act[2].frame >= 18) { - writeArray(7, 1); - _enemy[EN_VULTM2].field_10 = 1; - queueSceneSwitch(12, 0, "getnitro.san", 0, 0, 0, 0); + + if (!smlayer_actorNeedRedraw(1, 2)) { + setEnemyState(); + _actor[1].act[2].tilt = 0; + // for some reason there is no break at this + // place, so tilt gets overriden on next line } - break; - case 89: - smlayer_setActorLayer(1, 2, 26); - _actor[1].weaponClass = 1; - _actor[1].kicking = false; - if (_val121_) - smlayer_setActorFacing(1, 2, 13, 180); - else - smlayer_setActorFacing(1, 2, 12, 180); - - smlayer_startSfx(100); - _actor[1].act[2].state = 90; _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); break; - case 90: - smlayer_setActorLayer(1, 2, 26); - _actor[1].weaponClass = 2; + case 35: + smlayer_setActorLayer(1, 2, 5); _actor[1].kicking = false; - if (_actor[1].act[2].frame >= 5) - if (_actor[1].x - _actor[0].x <= 125) - _actor[0].damage += 90; - - if (_actor[1].act[2].frame >= 12) { - _actor[1].kicking = false; - setEnemyState(); - smlayer_setActorLayer(1, 2, 5); + + if (!smlayer_actorNeedRedraw(1, 2)) { + switchEnemyWeapon(); + _actor[1].act[2].tilt = 0; } _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); break; - case 91: - smlayer_setActorLayer(1, 2, 26); - _actor[1].kicking = false; - break; case 36: _actor[1].lost = true; _actor[1].field_54 = 1; @@ -2314,79 +2125,6 @@ void Insane::actor12Reaction(int32 buttons) { _actor[1].act[2].state = 38; } break; - case 102: - _actor[1].lost = true; - _actor[1].cursorX = 0; - _actor[1].kicking = false; - smlayer_setActorCostume(1, 2, readArray(40)); - smlayer_setActorFacing(1, 2, 6, 180); - smlayer_setActorLayer(1, 2, 25); - _actor[1].act[2].state = 103; - case 103: - _actor[1].kicking = false; - - if (_actor[1].act[2].frame >= 18 || ((_actor[1].x < 50 || _actor[1].x > 270) && - _actor[1].act[2].frame >= 9)) { - _enemy[EN_CAVEFISH].field_10 = 1; - queueSceneSwitch(20, 0, "wr2_cvko.san", 64, 0, 0, 0); - _actor[1].act[2].state = 38; - } - break; - case 113: - _actor[1].lost = true; - _actor[1].kicking = false; - smlayer_setActorCostume(1, 2, readArray(46)); - smlayer_setActorFacing(1, 2, 6, 180); - smlayer_setActorLayer(1, 2, 25); - _actor[1].act[1].room = 0; - _actor[1].act[0].room = 0; - _actor[1].cursorX = 0; - _actor[1].act[2].state = 114; - _enemy[EN_VULTF2].field_10 = 1; - smlayer_startVoice(275); - break; - case 114: - smlayer_setActorLayer(1, 2, 25); - _actor[1].kicking = false; - - if (_actor[1].act[2].frame >= 16) { - if (_actor[1].x >= 50 && _actor[1].x <= 270) - break; - - if (_actor[1].act[2].frame < 8) - break; - - queueSceneSwitch(11, 0, _enemy[_currEnemy].filename, 64, 0, 0, 0); - _actor[1].act[2].state = 38; - } - break; - case 115: - _actor[1].lost = true; - _actor[1].kicking = false; - smlayer_setActorCostume(1, 2, readArray(47)); - smlayer_setActorFacing(1, 2, 6, 180); - smlayer_setActorLayer(1, 2, 25); - _actor[1].act[1].room = 0; - _actor[1].act[0].room = 0; - _actor[1].cursorX = 0; - _actor[1].act[2].state = 116; - smlayer_startVoice(232); - break; - case 116: - smlayer_setActorLayer(1, 2, 25); - _actor[1].kicking = false; - - if (_actor[1].act[2].frame >= 17) { - if (_actor[1].x >= 50 && _actor[1].x <= 270) - break; - - if (_actor[1].act[2].frame < 8) - break; - - queueSceneSwitch(11, 0, _enemy[_currEnemy].filename, 64, 0, 0, 0); - _actor[1].act[2].state = 38; - } - break; case 38: smlayer_setActorLayer(1, 2, 25); _actor[1].kicking = false; @@ -2404,28 +2142,6 @@ void Insane::actor12Reaction(int32 buttons) { _actor[1].act[2].state = 38; } break; - case 34: - smlayer_setActorLayer(1, 2, 5); - _actor[1].kicking = false; - - if (!smlayer_actorNeedRedraw(1, 2)) { - setEnemyState(); - _actor[1].act[2].tilt = 0; - // for some reason there is no break at this - // place, so tilt gets overriden on next line - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; - case 35: - smlayer_setActorLayer(1, 2, 5); - _actor[1].kicking = false; - - if (!smlayer_actorNeedRedraw(1, 2)) { - switchEnemyWeapon(); - _actor[1].act[2].tilt = 0; - } - _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - break; case 63: smlayer_setActorLayer(1, 2, 5); if (_actor[1].act[2].animTilt) { @@ -2466,13 +2182,222 @@ void Insane::actor12Reaction(int32 buttons) { _actor[1].kicking = false; _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); break; + case 73: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = true; + if (_actor[1].act[2].frame >= 2 && !_kickEnemyProgress) { + smlayer_setActorFacing(1, 2, 19, 180); + _actor[1].act[2].state = 74; + } + + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 74: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = false; + if (_actor[1].act[2].frame >= 2) { + smlayer_setActorFacing(1, 2, 9, 180); + _actor[1].act[2].state = 1; + _actor[1].weaponClass = 2; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 75: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = true; + if (_actor[1].act[2].frame >= 4 && !_kickEnemyProgress) { + smlayer_setActorFacing(1, 2, 23, 180); + _actor[1].act[2].state = 76; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 76: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = false; + if (_actor[1].act[2].frame >= 4) { + smlayer_setActorFacing(1, 2, 25, 180); + _actor[1].act[2].state = 62; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 77: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = true; + if (_actor[1].act[2].frame >= 1 && !_kickEnemyProgress) { + smlayer_setActorFacing(1, 2, 23, 180); + _actor[1].act[2].state = 78; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 78: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = false; + if (_actor[1].act[2].frame >= 5) { + smlayer_setActorFacing(1, 2, 25, 180); + _actor[1].act[2].state = 65; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 79: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = true; + if (_actor[1].act[2].frame >= 1 && !_kickEnemyProgress) { + smlayer_setActorFacing(1, 2, 23, 180); + _actor[1].act[2].state = 80; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 80: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = false; + if (_actor[1].act[2].frame >= 6) { + smlayer_setActorFacing(1, 2, 25, 180); + _actor[1].act[2].state = 63; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 81: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = true; + if (_actor[1].act[2].frame >= 2 && !_kickEnemyProgress) { + smlayer_setActorFacing(1, 2, 23, 180); + _actor[1].act[2].state = 82; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 82: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + _actor[1].field_44 = false; + if (_actor[1].act[2].frame >= 3) { + smlayer_setActorFacing(1, 2, 26, 180); + _actor[1].act[2].state = 64; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 83: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 0; + _actor[1].kicking = false; + _actor[1].field_44 = true; + if (_actor[1].act[2].frame >= 2 && !_kickEnemyProgress) { + smlayer_setActorFacing(1, 2, 23, 180); + _actor[1].act[2].state = 84; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 84: + smlayer_setActorLayer(1, 2, 6); + _actor[1].weaponClass = 0; + _actor[1].kicking = false; + _actor[1].field_44 = false; + if (_actor[1].act[2].frame >= 5) { + smlayer_setActorFacing(1, 2, 25, 180); + _actor[1].act[2].state = 66; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 89: + smlayer_setActorLayer(1, 2, 26); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + if (_roadBumps) + smlayer_setActorFacing(1, 2, 13, 180); + else + smlayer_setActorFacing(1, 2, 12, 180); + + smlayer_startSfx(100); + _actor[1].act[2].state = 90; + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 90: + smlayer_setActorLayer(1, 2, 26); + _actor[1].weaponClass = 2; + _actor[1].kicking = false; + if (_actor[1].act[2].frame >= 5) + if (_actor[1].x - _actor[0].x <= 125) + _actor[0].damage += 90; + + if (_actor[1].act[2].frame >= 12) { + _actor[1].kicking = false; + setEnemyState(); + smlayer_setActorLayer(1, 2, 5); + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 91: + smlayer_setActorLayer(1, 2, 26); + _actor[1].kicking = false; + break; + case 92: + smlayer_setActorLayer(1, 2, 5); + _actor[1].kicking = false; + break; + case 93: + smlayer_setActorLayer(1, 2, 4); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + smlayer_setActorFacing(1, 2, 18, 180); + _actor[1].act[2].state = 94; + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 94: + smlayer_setActorLayer(1, 2, 4); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + if (_actor[1].act[2].frame >= 15) { + smlayer_setActorCostume(1, 2, readArray(44)); + smlayer_setActorFacing(1, 2, 6, 180); + _actor[1].act[2].state = 95; + _actor[1].act[0].room = 0; + _actor[1].act[1].room = 0; + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 95: + smlayer_setActorLayer(1, 2, 4); + _actor[1].kicking = false; + if (_actor[1].act[2].frame >= 19) { + queueSceneSwitch(1, _smush_minedrivFlu, "minedriv.san", 64, 0, + _continueFrame1, 1300); + _actor[1].act[2].state = 96; + } + break; + case 97: + smlayer_setActorLayer(1, 2, 25); + _actor[1].lost = true; + if (_actor[1].act[2].frame >= 18) { + writeArray(7, 1); + _enemy[EN_VULTM2].field_10 = 1; + queueSceneSwitch(12, 0, "getnitro.san", 0, 0, 0, 0); + } + break; case 98: smlayer_setActorLayer(1, 2, 5); if (_actor[1].act[2].animTilt) { smlayer_setActorFacing(1, 2, 6, 180); _actor[1].act[2].animTilt = 0; } - if (_val121_) { + if (_roadBumps) { smlayer_setActorFacing(1, 2, 7, 180); _actor[1].act[2].state = 100; } @@ -2484,7 +2409,7 @@ void Insane::actor12Reaction(int32 buttons) { smlayer_setActorFacing(1, 2, 9, 180); _actor[1].act[2].animTilt = 0; } - if (_val121_) { + if (!_roadBumps) { smlayer_setActorFacing(1, 2, 8, 180); _actor[1].act[2].state = 101; } @@ -2506,54 +2431,126 @@ void Insane::actor12Reaction(int32 buttons) { } _actor[1].kicking = false; break; - case 1: + case 102: + _actor[1].lost = true; + _actor[1].cursorX = 0; + _actor[1].kicking = false; + smlayer_setActorCostume(1, 2, readArray(40)); + smlayer_setActorFacing(1, 2, 6, 180); + smlayer_setActorLayer(1, 2, 25); + _actor[1].act[2].state = 103; + case 103: + _actor[1].kicking = false; + + if (_actor[1].act[2].frame >= 18 || ((_actor[1].x < 50 || _actor[1].x > 270) && + _actor[1].act[2].frame >= 9)) { + _enemy[EN_CAVEFISH].field_10 = 1; + queueSceneSwitch(20, 0, "wr2_cvko.san", 64, 0, 0, 0); + _actor[1].act[2].state = 38; + } + break; + case 106: smlayer_setActorLayer(1, 2, 5); - _actor[1].weaponClass = 2; + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + smlayer_setActorFacing(1, 2, 29, 180); + _actor[1].act[2].state = 107; + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 107: + smlayer_setActorLayer(1, 2, 5); + _actor[1].weaponClass = 1; _actor[1].kicking = false; + if (_actor[1].act[2].frame >= 8) + _actor[1].damage = _actor[1].maxdamage + 10; - switch (_actor[1].tilt) { - case -3: - if (_actor[1].act[2].animTilt != -3) { - smlayer_setActorFacing(1, 2, 6, 180); - _actor[1].act[2].animTilt = -3; - } - break; - case -2: - if (_actor[1].field_8 == 48) - smlayer_setActorFacing(1, 2, 7, 180); - _actor[1].act[2].animTilt = -2; - break; - case -1: - if (_actor[1].field_8 == 46) - smlayer_setActorFacing(1, 2, 8, 180); - _actor[1].act[2].animTilt = -1; - break; - case 0: - if (_actor[1].act[2].animTilt) { - smlayer_setActorFacing(1, 2, 9, 180); - _actor[1].act[2].animTilt = 0; - } - break; - case 1: - if (_actor[1].field_8 == 49) - smlayer_setActorFacing(1, 2, 10, 180); - _actor[1].act[2].animTilt = 1; - break; - case 2: - if (_actor[1].field_8 == 51) - smlayer_setActorFacing(1, 2, 11, 180); - _actor[1].act[2].animTilt = 2; - break; - case 3: - if (_actor[1].act[2].animTilt != 3) { - smlayer_setActorFacing(1, 2, 12, 180); - _actor[1].act[2].animTilt = 3; - } - break; - default: - break; + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 108: + smlayer_setActorLayer(1, 2, 5); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + smlayer_setActorFacing(1, 2, 28, 180); + _actor[1].act[2].state = 109; + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 109: + smlayer_setActorLayer(1, 2, 5); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + if (_actor[1].act[2].frame >= 6) + _actor[1].damage = _actor[1].maxdamage + 10; + + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 110: + smlayer_setActorLayer(1, 2, 4); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + smlayer_setActorFacing(1, 2, 30, 180); + _actor[1].act[2].state = 111; + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 111: + smlayer_setActorLayer(1, 2, 4); + _actor[1].weaponClass = 1; + _actor[1].kicking = false; + if (_actor[1].act[2].frame >= 7) { + smlayer_setActorFacing(1, 2, 25, 180); + _actor[1].act[2].state = 65; + smlayer_setActorLayer(1, 2, 5); + } + _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); + break; + case 113: + _actor[1].lost = true; + _actor[1].kicking = false; + smlayer_setActorCostume(1, 2, readArray(46)); + smlayer_setActorFacing(1, 2, 6, 180); + smlayer_setActorLayer(1, 2, 25); + _actor[1].act[1].room = 0; + _actor[1].act[0].room = 0; + _actor[1].cursorX = 0; + _actor[1].act[2].state = 114; + _enemy[EN_VULTF2].field_10 = 1; + smlayer_startVoice(275); + break; + case 114: + smlayer_setActorLayer(1, 2, 25); + _actor[1].kicking = false; + + if (_actor[1].act[2].frame >= 16) { + if (_actor[1].x >= 50 && _actor[1].x <= 270) + break; + + if (_actor[1].act[2].frame < 8) + break; + + queueSceneSwitch(11, 0, _enemy[_currEnemy].filename, 64, 0, 0, 0); + _actor[1].act[2].state = 38; + } + break; + case 115: + _actor[1].lost = true; + _actor[1].kicking = false; + smlayer_setActorCostume(1, 2, readArray(47)); + smlayer_setActorFacing(1, 2, 6, 180); + smlayer_setActorLayer(1, 2, 25); + _actor[1].act[1].room = 0; + _actor[1].act[0].room = 0; + _actor[1].cursorX = 0; + _actor[1].act[2].state = 116; + smlayer_startVoice(232); + break; + case 116: + smlayer_setActorLayer(1, 2, 25); + _actor[1].kicking = false; + + if (_actor[1].act[2].frame >= 17 || ((_actor[1].x < 50 || _actor[1].x > 270) + && _actor[1].act[2].frame >= 8)) { + queueSceneSwitch(11, 0, _enemy[_currEnemy].filename, 64, 0, 0, 0); + _actor[1].act[2].state = 38; } - _actor[1].act[2].tilt = 0; break; default: break; @@ -2599,10 +2596,29 @@ void Insane::actor13Reaction(int32 buttons) { int32 tmp; switch (_actor[1].act[3].state) { - case 117: - smlayer_setActorFacing(1, 3, 13, 180); - _actor[1].field_54 = 1; - _actor[1].act[3].state = 69; + case 1: + case 54: + _actor[1].field_54 = 0; + break; + case 52: + if (_actor[1].runningSound) + smlayer_stopSound(_actor[1].runningSound); + + if (_currScenePropIdx) + shutCurrentScene(); + + _actor[1].runningSound = 0; + _actor[1].defunct = 0; + _actor[1].field_54 = 0; + smlayer_setActorFacing(1, 3, 15, 180); + _actor[1].act[3].state = 53; + break; + case 53: + _actor[1].field_54 = 0; + if (_actor[1].act[3].frame >= 2) { + smlayer_setActorFacing(1, 3, 16, 180); + _actor[1].act[3].state = 54; + } break; case 69: if (_actor[1].act[3].frame >= 2) @@ -2621,6 +2637,11 @@ void Insane::actor13Reaction(int32 buttons) { _actor[1].act[3].state = 118; } break; + case 71: + _actor[1].field_54 = 0; + if (_actor[1].act[3].frame >= 2) + _actor[1].act[3].state = 1; + break; case 72: if (_actor[1].runningSound) { if (!smlayer_isSoundRunning(_actor[1].runningSound)) { @@ -2638,39 +2659,15 @@ void Insane::actor13Reaction(int32 buttons) { } } break; + case 117: + smlayer_setActorFacing(1, 3, 13, 180); + _actor[1].field_54 = 1; + _actor[1].act[3].state = 69; + break; case 118: smlayer_setActorFacing(1, 3, 14, 180); _actor[1].act[3].state = 71; break; - case 71: - _actor[1].field_54 = 0; - if (_actor[1].act[3].frame >= 2) - _actor[1].act[3].state = 1; - break; - case 52: - if (_actor[1].runningSound) - smlayer_stopSound(_actor[1].runningSound); - - if (_currScenePropIdx) - shutCurrentScene(); - - _actor[1].runningSound = 0; - _actor[1].defunct = 0; - _actor[1].field_54 = 0; - smlayer_setActorFacing(1, 3, 15, 180); - _actor[1].act[3].state = 53; - break; - case 53: - _actor[1].field_54 = 0; - if (_actor[1].act[3].frame >= 2) { - smlayer_setActorFacing(1, 3, 16, 180); - _actor[1].act[3].state = 54; - } - break; - case 54: - case 1: - _actor[1].field_54 = 0; - break; default: break; } diff --git a/scumm/insane/insane_iact.cpp b/scumm/insane/insane_iact.cpp index 6a83e79f5c..1d5aaf099a 100644 --- a/scumm/insane/insane_iact.cpp +++ b/scumm/insane/insane_iact.cpp @@ -86,7 +86,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, } if (_val32d == -1) { - proc62(); + proc62(); //PATCH _val32d = _enemy[_currEnemy].field_34; } @@ -133,7 +133,8 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, case 6: switch (par2) { case 38: - smlayer_drawSomething(renderBitmap, codecparam, 50, 20, 3, + // left branch sign + smlayer_drawSomething(renderBitmap, codecparam, 50-19, 20-13, 3, _smush_iconsNut, 7, 0, 0); _roadLeftBranch = true; _iactSceneId = par4; @@ -142,9 +143,10 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, if (readArray(4) != 0) return; - _roadRightBranch = true; - smlayer_drawSomething(renderBitmap, codecparam, 160, 20, 3, + // right branch sign + smlayer_drawSomething(renderBitmap, codecparam, 160-19, 20-13, 3, _smush_icons2Nut, 8, 0, 0); + _roadRightBranch = true; break; case 8: if (readArray(4) == 0 || readArray(6) == 0) @@ -156,7 +158,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, break; case 25: - _val121_ = true; + _roadBumps = true; _actor[0].y1 = -_actor[0].y1; break; case 11: @@ -194,7 +196,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12, if (_val32d < 0 || _val32d > 4) if (readArray(8)) { - smlayer_drawSomething(renderBitmap, codecparam, 270, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 270-19, 20-18, 3, _smush_iconsNut, 20, 0, 0); _benHasGoggles = true; } @@ -385,7 +387,7 @@ void Insane::iactScene3(byte *renderBitmap, int32 codecparam, int32 setupsan12, smlayer_setFluPalette(_smush_roadrashRip, 0); } } else if (par1 == 25) { - _val121_ = true; + _roadBumps = true; _actor[0].y1 = -_actor[0].y1; _actor[1].y1 = -_actor[1].y1; } @@ -432,7 +434,8 @@ void Insane::iactScene4(byte *renderBitmap, int32 codecparam, int32 setupsan12, case 6: switch (par2) { case 38: - smlayer_drawSomething(renderBitmap, codecparam, 270, 20, 3, + + smlayer_drawSomething(renderBitmap, codecparam, 270-19, 20-13, 3, _smush_icons2Nut, 10, 0, 0); _roadLeftBranch = true; _iactSceneId = par4; @@ -441,9 +444,9 @@ void Insane::iactScene4(byte *renderBitmap, int32 codecparam, int32 setupsan12, if (readArray(4) != 0) return; - _roadRightBranch = true; - smlayer_drawSomething(renderBitmap, codecparam, 160, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 160-19, 20-13, 3, _smush_icons2Nut, 8, 0, 0); + _roadRightBranch = true; break; case 8: if (readArray(4) == 0 || readArray(6) == 0) @@ -459,11 +462,11 @@ void Insane::iactScene4(byte *renderBitmap, int32 codecparam, int32 setupsan12, return; _carIsBroken = true; - smlayer_drawSomething(renderBitmap, codecparam, 160, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 160-12, 20-10, 3, _smush_icons2Nut, 8, 0, 0); break; case 11: - smlayer_drawSomething(renderBitmap, codecparam, 50, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 50-19, 20-13, 3, _smush_icons2Nut, 9, 0, 0); _roadLeftBranch = true; _iactSceneId = par4; @@ -523,7 +526,7 @@ void Insane::iactScene6(byte *renderBitmap, int32 codecparam, int32 setupsan12, case 6: switch (par2) { case 38: - smlayer_drawSomething(renderBitmap, codecparam, 270, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 270-19, 20-13, 3, _smush_icons2Nut, 10, 0, 0); _roadLeftBranch = true; _iactSceneId = par4; @@ -533,7 +536,7 @@ void Insane::iactScene6(byte *renderBitmap, int32 codecparam, int32 setupsan12, return; _roadRightBranch = true; - smlayer_drawSomething(renderBitmap, codecparam, 160, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 160-19, 20-13, 3, _smush_icons2Nut, 8, 0, 0); break; case 8: @@ -550,11 +553,11 @@ void Insane::iactScene6(byte *renderBitmap, int32 codecparam, int32 setupsan12, return; _carIsBroken = true; - smlayer_drawSomething(renderBitmap, codecparam, 160, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 160-12, 20-10, 3, _smush_icons2Nut, 8, 0, 0); break; case 11: - smlayer_drawSomething(renderBitmap, codecparam, 50, 20, 3, + smlayer_drawSomething(renderBitmap, codecparam, 50-19, 20-13, 3, _smush_icons2Nut, 9, 0, 0); _roadLeftBranch = true; _iactSceneId = par4; diff --git a/scumm/insane/insane_scenes.cpp b/scumm/insane/insane_scenes.cpp index 797783681c..7fde2c1b2b 100644 --- a/scumm/insane/insane_scenes.cpp +++ b/scumm/insane/insane_scenes.cpp @@ -51,12 +51,11 @@ void Insane::runScene(int arraynum) { _currScenePropSubIdx = 0; _currTrsMsg = 0; - smush_proc41(); smush_warpMouse(160, 100, -1); putActors(); readState(); - debug(0, "INSANE Arg: %d", readArray(0)); + debug(5, "INSANE Arg: %d", readArray(0)); switch (readArray(0)) { case 1: @@ -131,9 +130,7 @@ void Insane::runScene(int arraynum) { break; } - smush_proc39(); putActors(); - smush_proc40(); _vm->_sound->pauseSounds(0); // IMUSE_Resume(); _enemy[EN_ROTT3].maxdamage = 120; @@ -167,7 +164,7 @@ void Insane::runScene(int arraynum) { } int Insane::initScene(int sceneId) { - debug(0, "initScene(%d)", sceneId); + debug(5, "initScene(%d)", sceneId); if (_needSceneSwitch) return 1; @@ -189,7 +186,7 @@ int Insane::initScene(int sceneId) { void Insane::stopSceneSounds(int sceneId) { int flag = 0; - debug(0, "stopSceneSounds(%d)", sceneId); + debug(5, "stopSceneSounds(%d)", sceneId); switch (sceneId) { case 1: @@ -267,7 +264,6 @@ void Insane::stopSceneSounds(int sceneId) { case 23: break; } - smush_proc39(); if (!flag) return; @@ -282,7 +278,7 @@ void Insane::stopSceneSounds(int sceneId) { } void Insane::shutCurrentScene(void) { - debug(0, "shutCurrentScene()"); + debug(5, "shutCurrentScene()"); _currScenePropIdx = 0; _currTrsMsg = 0; @@ -311,7 +307,7 @@ void Insane::shutCurrentScene(void) { int Insane::loadSceneData(int scene, int flag, int phase) { int retvalue = 1; - debug(0, "Insane::loadSceneData(%d, %d, %d)", scene, flag, phase); + debug(5, "Insane::loadSceneData(%d, %d, %d)", scene, flag, phase); //if (phase == 1) /// FIXME // insane_unlock(); switch (scene) { @@ -605,7 +601,7 @@ int Insane::loadSceneData(int scene, int flag, int phase) { } void Insane::setSceneCostumes(int sceneId) { - debug(0, "Insane::setSceneCostumes(%d)", sceneId); + debug(5, "Insane::setSceneCostumes(%d)", sceneId); switch (sceneId) { case 1: @@ -631,7 +627,7 @@ void Insane::setSceneCostumes(int sceneId) { return; break; case 21: - _currEnemy = EN_ROTT3; + _currEnemy = EN_ROTT3; //PATCH setEnemyCostumes(); _actor[1].y = 200; smlayer_setFluPalette(_smush_roadrashRip, 0); @@ -655,7 +651,7 @@ void Insane::setSceneCostumes(int sceneId) { void Insane::setEnemyCostumes(void) { int i; - debug(0, "setEnemyCostumes(%d)", _currEnemy); + debug(5, "setEnemyCostumes(%d)", _currEnemy); smlayer_setActorCostume(0, 2, readArray(12)); smlayer_setActorCostume(0, 0, readArray(14)); @@ -1005,7 +1001,7 @@ void Insane::postCase0(byte *renderBitmap, int32 codecparam, int32 setupsan12, if (curFrame >= maxFrame) smush_rewindCurrentSan(1088, -1, -1); - _val121_ = false; + _roadBumps = false; _roadLeftBranch = false; _roadRightBranch = false; _benHasGoggles = false; @@ -1064,7 +1060,7 @@ void Insane::postCase16(byte *renderBitmap, int32 codecparam, int32 setupsan12, smush_rewindCurrentSan(1088, -1, -1); smlayer_setFluPalette(_smush_goglpaltRip, 0); } - _val121_ = false; + _roadBumps = false; _mineCaveIsNear = false; _roadLeftBranch = false; _roadRightBranch = false; @@ -1099,7 +1095,7 @@ void Insane::postCase2(byte *renderBitmap, int32 codecparam, int32 setupsan12, if (curFrame >= maxFrame) smush_rewindCurrentSan(1088, -1, -1); - _val121_ = false; + _roadBumps = false; _roadLeftBranch = false; _roadRightBranch = false; _continueFrame = curFrame; @@ -1113,7 +1109,7 @@ void Insane::postCase20(byte *renderBitmap, int32 codecparam, int32 setupsan12, if (curFrame >= maxFrame) smush_rewindCurrentSan(1088, -1, -1); - _val121_ = false; + _roadBumps = false; _roadLeftBranch = false; _roadRightBranch = false; _continueFrame = curFrame; @@ -1331,10 +1327,12 @@ void Insane::postCase12(byte *renderBitmap, int32 codecparam, int32 setupsan12, prepareScenePropScene(16, 0, 1); break; case EN_VULTM2: - turnBen(true); - - prepareScenePropScene(18, 0, 1); - _battleScene = false; + if (_enemy[EN_VULTM2].occurences <= 1) { + turnBen(false); + prepareScenePropScene(18, 0, 1); + _battleScene = false; + } else + turnBen(true); break; case EN_TORQUE: turnBen(false); |