mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2025-01-31 04:30:39 +00:00
Added cvar r_maxfps_autoset to allow disabling of automatic framerate capping.
Moved call to CL_SetFramerateCap() to UpdateVideoRef(). Future-proofed CL_SetFramerateCap() for higher refresh rates.
This commit is contained in:
parent
70759acf65
commit
37eb683714
6 changed files with 31 additions and 13 deletions
|
@ -64,6 +64,7 @@ cvar_t *cl_maxfps;
|
|||
cvar_t *cl_async;
|
||||
cvar_t *net_maxfps;
|
||||
cvar_t *r_maxfps;
|
||||
cvar_t *r_maxfps_autoset;
|
||||
#endif
|
||||
|
||||
cvar_t *cl_sleep;
|
||||
|
@ -1957,6 +1958,8 @@ void CL_InitLocal (void)
|
|||
Cvar_SetDescription ("net_maxfps", "Framerate cap for network frames when cl_async (asynchronous frames) is set to 1.");
|
||||
r_maxfps = Cvar_Get ("r_maxfps", "125", 0);
|
||||
Cvar_SetDescription ("r_maxfps", "Framerate cap for video frames when cl_async (asynchronous frames) is set to 1.");
|
||||
r_maxfps_autoset = Cvar_Get ("r_maxfps_autoset", "1", CVAR_ARCHIVE);
|
||||
Cvar_SetDescription ("r_maxfps_autoset", "Enables automatic setting of framerate cap (r_maxfps) based on refresh rate. Does nothing when refresh rate is left at default.");
|
||||
#endif
|
||||
|
||||
cl_sleep = Cvar_Get ("cl_sleep", "1", 0);
|
||||
|
@ -2221,11 +2224,6 @@ void CL_InitLocal (void)
|
|||
Cmd_AddCommand ("weapnext", NULL);
|
||||
Cmd_AddCommand ("weapprev", NULL);
|
||||
|
||||
#ifdef CLIENT_SPLIT_NETFRAME
|
||||
// auto-set r_maxfps based on r_displayrefresh
|
||||
CL_SetFramerateCap ();
|
||||
#endif // CLIENT_SPLIT_NETFRAME
|
||||
|
||||
// Chat Ignore from R1Q2/Q2Pro
|
||||
// Init list pointers
|
||||
cl_chatNickIgnores.next = NULL;
|
||||
|
@ -2356,15 +2354,23 @@ Does nothing if r_displayrefresh is not set.
|
|||
void CL_SetFramerateCap (void)
|
||||
{
|
||||
int displayFreq = Cvar_VariableInteger("r_displayrefresh");
|
||||
cvar_t *autoSet = Cvar_Get ("r_maxfps_autoset", "1", CVAR_ARCHIVE);
|
||||
|
||||
if (!autoSet->integer)
|
||||
return;
|
||||
|
||||
// if no refresh set, leave framerate cap at default
|
||||
if (displayFreq <= 0) {
|
||||
// Cvar_SetInteger ("r_maxfps", 125); // 8ms frame interval
|
||||
return;
|
||||
}
|
||||
|
||||
// isn't 250 fps enough for any display?
|
||||
if (displayFreq > 200)
|
||||
|
||||
// surely refresh rates will never go over 500Hz, right?
|
||||
if (displayFreq > 334)
|
||||
Cvar_SetInteger ("r_maxfps", 500); // 2ms frame interval
|
||||
else if (displayFreq > 250)
|
||||
Cvar_SetInteger ("r_maxfps", 334); // 3ms frame interval
|
||||
else if (displayFreq > 200)
|
||||
Cvar_SetInteger ("r_maxfps", 250); // 4ms frame interval
|
||||
else if (displayFreq > 167)
|
||||
Cvar_SetInteger ("r_maxfps", 200); // 5ms frame interval
|
||||
|
|
|
@ -7,6 +7,7 @@ Changes as of v0.20 update 8:
|
|||
- Added 160Hz and 240Hz refresh rates.
|
||||
|
||||
- Added automatic setting of r_maxfps based on refresh rate set in video menu (r_displayrefresh).
|
||||
This can be disabled by setting the cvar r_maxfps_autoset to 0.
|
||||
|
||||
- Added support for triple-monitor surround modes via custom resolutions. Monitors must be bound as a single logical display.
|
||||
Keeps all menu/HUD elements on the center screen, set the cvar scr_surroundlayout to 0 to disable this.
|
||||
|
|
|
@ -348,6 +348,12 @@ qboolean VID_LoadRefresh( char *name )
|
|||
setegid(getgid());
|
||||
|
||||
Com_Printf( "------------------------------------\n");
|
||||
|
||||
#ifdef CLIENT_SPLIT_NETFRAME
|
||||
// auto-set r_maxfps based on r_displayrefresh
|
||||
CL_SetFramerateCap ();
|
||||
#endif // CLIENT_SPLIT_NETFRAME
|
||||
|
||||
reflib_active = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -145,11 +145,6 @@ static void prepareVideoRefresh( void )
|
|||
Cvar_Set( "vid_ref", "gl" );
|
||||
Cvar_Set( "gl_driver", "opengl32" );
|
||||
|
||||
#ifdef CLIENT_SPLIT_NETFRAME
|
||||
// auto-set r_maxfps based on r_displayrefresh
|
||||
CL_SetFramerateCap ();
|
||||
#endif // CLIENT_SPLIT_NETFRAME
|
||||
|
||||
// tell them they're modified so they refresh
|
||||
vid_ref->modified = true;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,11 @@ void UpdateVideoRef (void)
|
|||
|
||||
Com_Printf( "------------------------------------\n");
|
||||
|
||||
#ifdef CLIENT_SPLIT_NETFRAME
|
||||
// auto-set r_maxfps based on r_displayrefresh
|
||||
CL_SetFramerateCap ();
|
||||
#endif // CLIENT_SPLIT_NETFRAME
|
||||
|
||||
kmgl_active = true;
|
||||
//==========================
|
||||
}
|
||||
|
|
|
@ -666,6 +666,11 @@ void UpdateVideoRef (void)
|
|||
|
||||
Com_Printf( "------------------------------------\n");
|
||||
|
||||
#ifdef CLIENT_SPLIT_NETFRAME
|
||||
// auto-set r_maxfps based on r_displayrefresh
|
||||
CL_SetFramerateCap ();
|
||||
#endif // CLIENT_SPLIT_NETFRAME
|
||||
|
||||
kmgl_active = true;
|
||||
//==========================
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue