Commit 678efd58 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

engine: cap framerate to 1000 even if r_maxfps is 0

For anyone that really thinks they need more than 1000 fps, "r_maxfps -2" will revert to the previous completely unthrottled behavior.
parent a0a45f0d
......@@ -323,15 +323,14 @@ void maybe_redirect_outputs(void);
extern uint64_t g_frameDelay;
static inline uint64_t calcFrameDelay(int maxFPS)
{
uint64_t perfFreq = timerGetNanoTickRate();
switch (maxFPS)
{
case -2: return 0;
case -1: maxFPS = refreshfreq; break;
case 0: perfFreq = 0; break;
case 0: maxFPS = 1000; break;
}
return tabledivide64(perfFreq, maxFPS);
return tabledivide64(timerGetNanoTickRate(), maxFPS);
}
extern int engineFPSLimit(void);
#ifdef __cplusplus
......
......@@ -818,7 +818,7 @@ int32_t baselayer_init(void)
{ "r_novoxmips","turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 },
{ "r_rotatespriteinterp", "interpolate repeated rotatesprite calls", (void *)&r_rotatespriteinterp, CVAR_BOOL, 0, 1 },
{ "r_voxels","enable/disable automatic sprite->voxel rendering",(void *) &usevoxels, CVAR_BOOL, 0, 1 },
{ "r_maxfps", "limit the frame rate", (void *)&r_maxfps, CVAR_INT | CVAR_FUNCPTR, -1, 1000 },
{ "r_maxfps", "limit the frame rate", (void *)&r_maxfps, CVAR_INT | CVAR_FUNCPTR, -2, 1000 },
#ifdef YAX_ENABLE
{ "r_tror_nomaskpass", "enable/disable additional pass in TROR software rendering", (void *)&r_tror_nomaskpass, CVAR_BOOL, 0, 1 },
#endif
......@@ -897,7 +897,7 @@ int engineFPSLimit(void)
static uint64_t nextFrameTicks;
static uint64_t savedFrameDelay;
if (!r_maxfps)
if (r_maxfps == -2)
return true;
g_frameDelay = calcFrameDelay(r_maxfps);
......
Supports Markdown
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