Use nearbyintf() to when calculating g_frameDelay (when r_maxfps is changed) to get closer to the target framerate by bypassing float -> int truncation

git-svn-id: https://svn.eduke32.com/eduke32@3441 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2013-01-27 17:06:53 +00:00
parent 9bd041cb9d
commit aac7d22f96

View file

@ -1337,7 +1337,7 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
}
else if (!Bstrcasecmp(parm->name, "r_maxfps"))
{
if (r_maxfps) g_frameDelay = (1000/r_maxfps);
if (r_maxfps) g_frameDelay = (int32_t)nearbyintf(1000.f/(float)r_maxfps);
else g_frameDelay = 0;
return r;