From aac7d22f9690bd1c896987ca9f52c78a127f83e2 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 27 Jan 2013 17:06:53 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/osdcmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 11daecb26..2e4522b3c 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -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;