SCUMM: Fix bug #3575444: "FT: Enemy behaviour in biker fight"

Also fixed enemy behavior along the way. No wonder it differed
from the original!
This commit is contained in:
Eugene Sandulenko 2013-04-02 00:15:57 +03:00
parent d8d5012fc7
commit 49da129e63

View File

@ -266,6 +266,8 @@ int32 Insane::enemy1handler(int32 actor1, int32 actor2, int32 probability) {
_enHdlVar[EN_ROTT2][0] = 0;
else
_enHdlVar[EN_ROTT2][0] = 1;
} else {
_enHdlVar[EN_ROTT2][0] = 1;
}
_enHdlVar[EN_ROTT2][1] = 0;
_enHdlVar[EN_ROTT2][2] = _vm->_rnd.getRandomNumber(probability * 2 - 1);
@ -310,7 +312,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 (_vm->_rnd.getRandomNumber(probability * 2 - 1) <= 1)
retval = 1;
}
@ -369,6 +371,8 @@ int32 Insane::enemy1handler(int32 actor1, int32 actor2, int32 probability) {
_actor[actor1].cursorX = 320;
else if (act1x > 280)
_actor[actor1].cursorX = -160;
else if (_actor[actor1].defunct)
_actor[actor1].cursorX = 0;
// Shift+V cheat to win the battle
if (_vm->getKeyState('V') && !_beenCheated &&
@ -410,7 +414,9 @@ int32 Insane::enemy2handler(int32 actor1, int32 actor2, int32 probability) {
_enHdlVar[EN_ROTT3][0] = 0;
else
_enHdlVar[EN_ROTT3][0] = 1;
}
} else
_enHdlVar[EN_ROTT3][0] = 1;
_enHdlVar[EN_ROTT3][1] = 0;
_enHdlVar[EN_ROTT3][2] = _vm->_rnd.getRandomNumber(probability * 2 - 1);
}
@ -453,7 +459,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 (_vm->_rnd.getRandomNumber(probability * 2 - 1) <= 1)
retval = 1;
}
@ -553,9 +559,12 @@ 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) && (_vm->_rnd.getRandomNumber(probability - 1) != 1))
_enHdlVar[EN_VULTF1][0] = 0;
else
if (act1damage - act2damage >= 30) {
if (_vm->_rnd.getRandomNumber(probability - 1) != 1)
_enHdlVar[EN_VULTF1][0] = 0;
else
_enHdlVar[EN_VULTF1][0] = 1;
} else
_enHdlVar[EN_VULTF1][0] = 1;
_enHdlVar[EN_VULTF1][1] = 0;
@ -714,7 +723,9 @@ int32 Insane::enemy4handler(int32 actor1, int32 actor2, int32 probability) {
_enHdlVar[EN_VULTM1][0] = 0;
else
_enHdlVar[EN_VULTM1][0] = 1;
}
} else
_enHdlVar[EN_VULTM1][0] = 1;
_enHdlVar[EN_VULTM1][1] = 0;
_enHdlVar[EN_VULTM1][2] = _vm->_rnd.getRandomNumber(probability * 2 - 1);
}
@ -757,7 +768,7 @@ int32 Insane::enemy4handler(int32 actor1, int32 actor2, int32 probability) {
retval = 1;
}
if (_actor[actor2].kicking) {
if (weaponMaxRange(actor2) >= dist) // that's weird but original is >=
if (weaponMaxRange(actor2) >= dist)
if (_vm->_rnd.getRandomNumber(probability * 2 - 1) <= 1)
retval = 1;
}
@ -792,12 +803,12 @@ int32 Insane::enemy4handler(int32 actor1, int32 actor2, int32 probability) {
case 3:
prepareScenePropScene(44, 0, 0);
break;
case 9:
case 9: // Original is 10 here which never happens
prepareScenePropScene(45, 0, 0);
break;
}
} else {
if (weaponMaxRange(actor2) <= dist) {
if (weaponMaxRange(actor2) >= dist) {
switch (_vm->_rnd.getRandomNumber(9)) {
case 3:
if (!_enemyState[EN_VULTM1][3]) {
@ -805,7 +816,7 @@ int32 Insane::enemy4handler(int32 actor1, int32 actor2, int32 probability) {
prepareScenePropScene(42, 0, 0);
}
break;
case 9:
case 9: // Original is 10 here which never happens
if (!_enemyState[EN_VULTM1][4]) {
_enemyState[EN_VULTM1][4] = 1;
prepareScenePropScene(43, 0, 0);
@ -901,12 +912,8 @@ int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) {
retval = 1;
} else {
if (weaponMaxRange(actor2) >= dist && _actor[actor2].weapon == INV_CHAINSAW) {
if (!_actor[actor2].kicking) {
if (_vm->_rnd.getRandomNumber(probability - 1) == 1)
retval = 1;
} else {
if (_actor[actor2].kicking || (_vm->_rnd.getRandomNumber(probability - 1) == 1))
retval = 1;
}
}
_actor[actor1].cursorX = 0;
if (_enHdlVar[EN_VULTF2][0] >= 100)
@ -944,7 +951,7 @@ int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) {
prepareScenePropScene(11, 0, 0);
_enemyState[EN_VULTF2][2] = 1;
break;
case 9:
case 9: // Original is 10
_enemyState[EN_VULTF2][1] = 1;
prepareScenePropScene(10, 0, 0);
break;
@ -969,9 +976,6 @@ int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) {
}
}
if (_actor[actor1].defunct)
_actor[actor1].cursorX = 0;
if (_actor[actor1].weapon == -1)
retval = 2;
@ -981,6 +985,8 @@ int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) {
_actor[actor1].cursorX = 320;
else if (act1x > 280)
_actor[actor1].cursorX = -160;
else if (_actor[actor1].defunct)
_actor[actor1].cursorX = 0;
_enHdlVar[EN_VULTF2][2] = _enHdlVar[EN_VULTF2][1];
_enHdlVar[EN_VULTF2][0]++;
@ -1106,10 +1112,14 @@ int32 Insane::enemy6handler(int32 actor1, int32 actor2, int32 probability) {
_actor[actor1].cursorX = 320;
else if (act1x > 280)
_actor[actor1].cursorX = -160;
else
_actor[actor1].cursorX = 00;
if (_actor[actor1].weapon == -1)
retval = 2;
_enHdlVar[EN_VULTM2][0]++;
// Shift+V cheat to win the battle
if (_vm->getKeyState('V') && !_beenCheated &&
!_actor[0].lost && !_actor[1].lost) {