mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 21:41:03 +00:00
- 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:
parent
3299a29c44
commit
4993018520
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue