engine: swap Cvar_VariableInteger and simple integer checks for performance

This commit is contained in:
Alibek Omarov 2024-10-16 06:57:46 +03:00
parent cc0f12ed26
commit 0b59fa9416
4 changed files with 7 additions and 9 deletions

View file

@ -1941,7 +1941,7 @@ void Con_DrawConsole( void )
{ {
if( !cl_allow_levelshots.value && !cls.timedemo ) if( !cl_allow_levelshots.value && !cls.timedemo )
{ {
if(( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )) && cls.key_dest != key_console ) if( cls.key_dest != key_console && ( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )))
con.vislines = con.showlines = 0; con.vislines = con.showlines = 0;
else con.vislines = con.showlines = refState.height; else con.vislines = con.showlines = refState.height;
} }

View file

@ -1214,13 +1214,13 @@ void Cmd_Unlink( int group )
cmd_t **prev; cmd_t **prev;
int count = 0; int count = 0;
if( Cvar_VariableInteger( "host_gameloaded" ) && FBitSet( group, CMD_SERVERDLL )) if( FBitSet( group, CMD_SERVERDLL ) && Cvar_VariableInteger( "host_gameloaded" ))
return; return;
if( Cvar_VariableInteger( "host_clientloaded" ) && FBitSet( group, CMD_CLIENTDLL )) if( FBitSet( group, CMD_CLIENTDLL ) && Cvar_VariableInteger( "host_clientloaded" ))
return; return;
if( Cvar_VariableInteger( "host_gameuiloaded" ) && FBitSet( group, CMD_GAMEUIDLL )) if( FBitSet( group, CMD_GAMEUIDLL ) && Cvar_VariableInteger( "host_gameuiloaded" ))
return; return;
prev = &cmd_functions; prev = &cmd_functions;

View file

@ -61,8 +61,6 @@ GNU General Public License for more details.
#define FCONTEXT_CORE_PROFILE BIT( 0 ) #define FCONTEXT_CORE_PROFILE BIT( 0 )
#define FCONTEXT_DEBUG_ARB BIT( 1 ) #define FCONTEXT_DEBUG_ARB BIT( 1 )
#define FCVAR_READ_ONLY (1<<17) // cannot be set by user at all, and can't be requested by CvarGetPointer from game dlls
// screenshot types // screenshot types
#define VID_SCREENSHOT 0 #define VID_SCREENSHOT 0
#define VID_LEVELSHOT 1 #define VID_LEVELSHOT 1

View file

@ -1992,7 +1992,7 @@ static qboolean SV_Noclip_f( sv_client_t *cl )
{ {
edict_t *pEntity = cl->edict; edict_t *pEntity = cl->edict;
if( !Cvar_VariableInteger( "sv_cheats" ) || sv.background ) if( sv.background || !Cvar_VariableInteger( "sv_cheats" ))
return true; return true;
if( pEntity->v.movetype != MOVETYPE_NOCLIP ) if( pEntity->v.movetype != MOVETYPE_NOCLIP )
@ -2018,7 +2018,7 @@ static qboolean SV_Godmode_f( sv_client_t *cl )
{ {
edict_t *pEntity = cl->edict; edict_t *pEntity = cl->edict;
if( !Cvar_VariableInteger( "sv_cheats" ) || sv.background ) if( sv.background || !Cvar_VariableInteger( "sv_cheats" ))
return true; return true;
pEntity->v.flags = pEntity->v.flags ^ FL_GODMODE; pEntity->v.flags = pEntity->v.flags ^ FL_GODMODE;
@ -2039,7 +2039,7 @@ static qboolean SV_Notarget_f( sv_client_t *cl )
{ {
edict_t *pEntity = cl->edict; edict_t *pEntity = cl->edict;
if( !Cvar_VariableInteger( "sv_cheats" ) || sv.background ) if( sv.background || !Cvar_VariableInteger( "sv_cheats" ))
return true; return true;
pEntity->v.flags = pEntity->v.flags ^ FL_NOTARGET; pEntity->v.flags = pEntity->v.flags ^ FL_NOTARGET;