mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-18 11:00:33 +00:00
engine: fix framerate being capped to 60FPS with vsync, remove vid_displayfrequency cvar. Never sleep with vsync or timedemo, for accuracy
This commit is contained in:
parent
f469b56b93
commit
d13f7f06e4
@ -21,7 +21,6 @@ GNU General Public License for more details.
|
||||
#include "platform/platform.h"
|
||||
|
||||
#define WINDOW_NAME XASH_ENGINE_NAME " Window" // Half-Life
|
||||
convar_t *vid_displayfrequency;
|
||||
convar_t *vid_fullscreen;
|
||||
convar_t *vid_mode;
|
||||
convar_t *vid_brightness;
|
||||
@ -181,7 +180,6 @@ void VID_Init( void )
|
||||
|
||||
vid_gamma = Cvar_Get( "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
||||
vid_brightness = Cvar_Get( "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
||||
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen refresh rate" );
|
||||
vid_fullscreen = Cvar_Get( "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscreen mode" );
|
||||
vid_mode = Cvar_Get( "vid_mode", "0", FCVAR_RENDERINFO, "current video mode index (used just for storage)" );
|
||||
vid_highdpi = Cvar_Get( "vid_highdpi", "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
||||
|
@ -31,7 +31,6 @@ extern glwstate_t glw_state;
|
||||
#define VID_MIN_WIDTH 320
|
||||
|
||||
extern convar_t *vid_fullscreen;
|
||||
extern convar_t *vid_displayfrequency;
|
||||
extern convar_t *vid_highdpi;
|
||||
extern convar_t *vid_rotate;
|
||||
extern convar_t *vid_scale;
|
||||
|
@ -159,7 +159,6 @@ extern convar_t *scr_download;
|
||||
extern convar_t *cmd_scripting;
|
||||
extern convar_t *sv_maxclients;
|
||||
extern convar_t *cl_allow_levelshots;
|
||||
extern convar_t *vid_displayfrequency;
|
||||
extern convar_t host_developer;
|
||||
extern convar_t *host_limitlocal;
|
||||
extern convar_t *host_framerate;
|
||||
|
@ -276,6 +276,13 @@ void Host_CheckSleep( void )
|
||||
{
|
||||
int sleeptime = host_sleeptime->value;
|
||||
|
||||
#ifndef XASH_DEDICATED
|
||||
// never sleep in timedemo for benchmarking purposes
|
||||
// also don't sleep with vsync for less lag
|
||||
if( CL_IsTimeDemo( ) || CVAR_TO_BOOL( gl_vsync ))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if( Host_IsDedicated() )
|
||||
{
|
||||
// let the dedicated server some sleep
|
||||
@ -597,24 +604,16 @@ double Host_CalcFPS( void )
|
||||
}
|
||||
else if( Host_IsLocalGame( ))
|
||||
{
|
||||
fps = host_maxfps->value;
|
||||
if( !CVAR_TO_BOOL( gl_vsync ))
|
||||
fps = host_maxfps->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
fps = host_maxfps->value;
|
||||
if( fps == 0.0 ) fps = MAX_FPS;
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||
}
|
||||
|
||||
// probably left part of this condition is redundant :-)
|
||||
if( host.type != HOST_DEDICATED && Host_IsLocalGame( ) && !CL_IsTimeDemo( ))
|
||||
{
|
||||
// ajdust fps for vertical synchronization
|
||||
if( CVAR_TO_BOOL( gl_vsync ))
|
||||
if( !CVAR_TO_BOOL( gl_vsync ))
|
||||
{
|
||||
if( vid_displayfrequency->value != 0.0f )
|
||||
fps = vid_displayfrequency->value;
|
||||
else fps = 60.0; // default
|
||||
fps = host_maxfps->value;
|
||||
if( fps == 0.0 ) fps = MAX_FPS;
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user