Possibly fix crashes when targeting more than 8 enemies

This commit is contained in:
Lwmte 2023-11-09 13:17:06 +01:00
parent fab3191974
commit fd6ec29065
2 changed files with 6 additions and 2 deletions

View file

@ -12,7 +12,8 @@ Version 1.2
* Fix TR1 bear various original AI issues.
* Fix TR2 knife thrower AI.
* Fix TR2 doberman crashing the game when killed by explosive weapons.
* Fix exploding enemies sometimes crashing the game.
* Fix random crashes when killing exploding enemies.
* Fix random crashes in battle with more than 8 enemies.
* Fix volume change in settings not affecting voice track.
* Fix several lighting bugs.
* Fix double drawing additive faces.

View file

@ -927,8 +927,11 @@ void FindNewTarget(ItemInfo& laraItem, const WeaponInfo& weaponInfo)
orient.x <= weaponInfo.LockOrientConstraint.second.x &&
orient.y <= weaponInfo.LockOrientConstraint.second.y)
{
if (targetCount >= player.TARGET_COUNT_MAX - 1)
break;
player.TargetList[targetCount] = &item;
++targetCount;
targetCount++;
if (distance < closestDistance &&
abs(orient.y) < (closestHeadingAngle + ANGLE(15.0f)))