2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-25 11:19:59 +01:00

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(( 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;
else con.vislines = con.showlines = refState.height;
}

View File

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

View File

@ -61,8 +61,6 @@ GNU General Public License for more details.
#define FCONTEXT_CORE_PROFILE BIT( 0 )
#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
#define VID_SCREENSHOT 0
#define VID_LEVELSHOT 1

View File

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