2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-23 10:20:08 +01:00

engine: client: improve accumulating rounding error, thanks @SNMetamorph for suggestion

This commit is contained in:
Alibek Omarov 2024-06-02 13:08:53 +03:00
parent 793adadb06
commit 413a0fb2e5

View File

@ -608,10 +608,12 @@ static void CL_CreateCmd( void )
cl.frametime_remainder += accurate_ms - ms; // accumulate rounding error each frame
// add a ms if error accumulates enough
if( cl.frametime_remainder > 1.0 )
if( cl.frametime_remainder >= 1.0 )
{
cl.frametime_remainder = 0.0;
ms++;
int ms2 = (int)cl.frametime_remainder;
ms += ms2;
cl.frametime_remainder -= ms2;
}
// ms can't be negative, rely on error accumulation only if FPS > 1000