Commit a22debb3 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

engine: fix calc_smoothratio again

parent 0a5b0cf1
......@@ -320,9 +320,11 @@ extern int engineFPSLimit(void);
static inline int32_t calc_smoothratio(ClockTicks const totalclk, ClockTicks const ototalclk, int gameTicRate)
{
int const tfreq = (int)refreshfreq;
int const clk = (totalclk - ototalclk).toScale16();
int const ratio = tabledivide32_noinline(clk * tfreq, tabledivide32_noinline(timerGetClockRate() * tfreq, gameTicRate));
int const tfreq = (int)floorf(refreshfreq * 120 / timerGetClockRate());
int const clk = (totalclk - ototalclk).toScale16();
float const tics = clk * tfreq * (1.f / (65536.f * 120));
int const ratio = tabledivide32_noinline((int)(65536 * tics * gameTicRate), tfreq);
#if 0 //ndef NDEBUG
if ((unsigned)ratio > 66048)
OSD_Printf("calc_smoothratio: ratio: %d\n", ratio);
......
......@@ -1116,7 +1116,6 @@ static int osdcmd_restorestate(osdcmdptr_t UNUSED(parm))
}
#endif
#ifdef DEBUGGINGAIDS
static int osdcmd_inittimer(osdcmdptr_t parm)
{
if (parm->numparms != 1)
......@@ -1130,7 +1129,6 @@ static int osdcmd_inittimer(osdcmdptr_t parm)
OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK;
}
#endif
#if !defined NETCODE_DISABLE
static int osdcmd_name(osdcmdptr_t parm)
......@@ -1785,9 +1783,7 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("maxhealth", "maxhealth <amount>: sets the player's maximum health", osdcmd_maxhealth);
OSD_RegisterFunction("initgroupfile","initgroupfile <path>: adds a grp file into the game filesystem", osdcmd_initgroupfile);
#ifdef DEBUGGINGAIDS
OSD_RegisterFunction("inittimer","debug", osdcmd_inittimer);
#endif
OSD_RegisterFunction("locale","locale: changes the locale", osdcmd_locale);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment