engine: client: improve accumulating rounding error, thanks @SNMetamorph for suggestion
This commit is contained in:
parent
793adadb06
commit
413a0fb2e5
1 changed files with 5 additions and 3 deletions
|
@ -608,10 +608,12 @@ static void CL_CreateCmd( void )
|
||||||
cl.frametime_remainder += accurate_ms - ms; // accumulate rounding error each frame
|
cl.frametime_remainder += accurate_ms - ms; // accumulate rounding error each frame
|
||||||
|
|
||||||
// add a ms if error accumulates enough
|
// add a ms if error accumulates enough
|
||||||
if( cl.frametime_remainder > 1.0 )
|
if( cl.frametime_remainder >= 1.0 )
|
||||||
{
|
{
|
||||||
cl.frametime_remainder = 0.0;
|
int ms2 = (int)cl.frametime_remainder;
|
||||||
ms++;
|
|
||||||
|
ms += ms2;
|
||||||
|
cl.frametime_remainder -= ms2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ms can't be negative, rely on error accumulation only if FPS > 1000
|
// ms can't be negative, rely on error accumulation only if FPS > 1000
|
||||||
|
|
Loading…
Add table
Reference in a new issue