- fixed: Actor velocity requires an upper limit to prevent uncontrolled accumulation, as can happen when multiple exploding and pushable objects overlap. The value 5000 was chosen because it is high enough to not occur under regular circumstances and small enough to prevent severe slowdowns. In the old fixed point code the lack of such a check just caused random overflows.

This commit is contained in:
Christoph Oelckers 2016-08-31 09:18:59 +02:00
parent 3299a29c44
commit 4993018520

View file

@ -1806,6 +1806,11 @@ double P_XYMovement (AActor *mo, DVector2 scroll)
mo->Vel.X *= fac;
mo->Vel.Y *= fac;
}
const double VELOCITY_THRESHOLD = 5000; // don't let it move faster than this. Fixed point overflowed at 32768 but that's too much to make this safe.
if (mo->Vel.LengthSquared() >= VELOCITY_THRESHOLD*VELOCITY_THRESHOLD)
{
mo->Vel.MakeResize(VELOCITY_THRESHOLD);
}
move = mo->Vel;
// [RH] Carrying sectors didn't work with low speeds in BOOM. This is
// because BOOM relied on the speed being fast enough to accumulate