Fixed infinite loop with zero height fast projectile

https://forum.zdoom.org/viewtopic.php?t=60019
This commit is contained in:
alexey.lysiuk 2018-03-30 12:49:35 +03:00
parent a6738fd139
commit 84e9017a5f
1 changed files with 9 additions and 1 deletions

View File

@ -66,13 +66,21 @@ class FastProjectile : Actor
int count = 8; int count = 8;
if (radius > 0) if (radius > 0)
{ {
while ( abs(Vel.X) >= radius * count || abs(Vel.Y) >= radius * count || abs(Vel.Z) >= height * count) while (abs(Vel.X) >= radius * count || abs(Vel.Y) >= radius * count)
{ {
// we need to take smaller steps. // we need to take smaller steps.
count += count; count += count;
} }
} }
if (height > 0)
{
while (abs(Vel.Z) >= height * count)
{
count += count;
}
}
// Handle movement // Handle movement
if (Vel != (0, 0, 0) || (pos.Z != floorz)) if (Vel != (0, 0, 0) || (pos.Z != floorz))
{ {