- fixed everlasting fast projectile after hitting ceiling

Without the test for ceiling hit fast projectile could enter its Death state every tick infinitely

https://forum.zdoom.org/viewtopic.php?t=63023
This commit is contained in:
alexey.lysiuk 2018-12-31 12:18:36 +02:00 committed by Christoph Oelckers
parent 6c168d88e4
commit 4a9947eaa1

View file

@ -82,7 +82,13 @@ class FastProjectile : Actor
} }
// Handle movement // Handle movement
if (Vel != (0, 0, 0) || (pos.Z != floorz)) bool ismoved = Vel != (0, 0, 0)
// Check Z position set during previous tick.
// It should be strictly equal to the argument of SetZ() function.
|| ( (pos.Z != floorz ) /* Did it hit the floor? */
&& (pos.Z != ceilingz - Height) /* Did it hit the ceiling? */ );
if (ismoved)
{ {
// force some lateral movement so that collision detection works as intended. // force some lateral movement so that collision detection works as intended.
if (bMissile && Vel.X == 0 && Vel.Y == 0 && !IsZeroDamage()) if (bMissile && Vel.X == 0 && Vel.Y == 0 && !IsZeroDamage())