mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-23 11:00:26 +02:00
Fix integer overflow in wait command that would cause infinite loop in stock scripts
It was causing a rare infinite loop in anim/stand.scr where it waits for 9999999 if the actor is unarmed and medic
This commit is contained in:
1 file changed
+7
-2
@@ -2711,12 +2711,17 @@ void ScriptThread::EventDelayThrow(Event *ev)
|
||||
|
||||
void ScriptThread::EventWait(Event *ev)
|
||||
{
|
||||
Wait((int)roundf(ev->GetFloat(1) * 1000.0f));
|
||||
float timeSeconds;
|
||||
|
||||
// Fixed in OPM
|
||||
// Clamp to make sure to not overflow when converting to integer
|
||||
timeSeconds = Q_clamp_float(ev->GetFloat(1), 0, 2000000);
|
||||
Wait((int)roundf(timeSeconds * 1000));
|
||||
}
|
||||
|
||||
void ScriptThread::EventWaitFrame(Event *ev)
|
||||
{
|
||||
Wait((int)roundf(level.frametime * 1000.0f));
|
||||
Wait((int)roundf(level.frametime * 1000));
|
||||
}
|
||||
|
||||
void ScriptThread::EventResume(Event *ev)
|
||||
|
||||
Reference in new issue
Block a user