mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-22 18:05:23 +01:00
Add "cl_autowepswitch" cvar implementation.
This commit is contained in:
parent
798120f5fb
commit
88161eac14
@ -191,6 +191,7 @@ void CHud::Init( void )
|
|||||||
m_iFOV = 0;
|
m_iFOV = 0;
|
||||||
|
|
||||||
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 );
|
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 );
|
||||||
|
CVAR_CREATE( "cl_autowepswitch", "1", FCVAR_ARCHIVE | FCVAR_USERINFO );
|
||||||
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
|
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
|
||||||
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
||||||
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
||||||
|
@ -196,6 +196,7 @@ void ClientPutInServer( edict_t *pEntity )
|
|||||||
|
|
||||||
pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||||
pPlayer->SetCustomDecalFrames( -1 ); // Assume none;
|
pPlayer->SetCustomDecalFrames( -1 ); // Assume none;
|
||||||
|
pPlayer->SetPrefsFromUserinfo( g_engfuncs.pfnGetInfoKeyBuffer( pEntity ) );
|
||||||
|
|
||||||
// Allocate a CBasePlayer for pev, and call spawn
|
// Allocate a CBasePlayer for pev, and call spawn
|
||||||
pPlayer->Spawn();
|
pPlayer->Spawn();
|
||||||
|
@ -303,6 +303,11 @@ void CGameRules::RefreshSkillData ( void )
|
|||||||
gSkillData.plrArm = GetSkillCvar( "sk_player_arm" );
|
gSkillData.plrArm = GetSkillCvar( "sk_player_arm" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameRules::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer )
|
||||||
|
{
|
||||||
|
pPlayer->SetPrefsFromUserinfo( infobuffer );
|
||||||
|
}
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
// instantiate the proper game rules object
|
// instantiate the proper game rules object
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -98,7 +98,7 @@ public:
|
|||||||
|
|
||||||
virtual BOOL AllowAutoTargetCrosshair( void ) { return TRUE; };
|
virtual BOOL AllowAutoTargetCrosshair( void ) { return TRUE; };
|
||||||
virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) { return FALSE; }; // handles the user commands; returns TRUE if command handled properly
|
virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) { return FALSE; }; // handles the user commands; returns TRUE if command handled properly
|
||||||
virtual void ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer ) {} // the player has changed userinfo; can change it now
|
virtual void ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer ); // the player has changed userinfo; can change it now
|
||||||
|
|
||||||
// Client kills/scoring
|
// Client kills/scoring
|
||||||
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled ) = 0;// how many points do I award whoever kills this player?
|
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled ) = 0;// how many points do I award whoever kills this player?
|
||||||
|
@ -319,6 +319,11 @@ BOOL CHalfLifeMultiplay::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerI
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !pPlayer->m_iAutoWepSwitch )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if( !pPlayer->m_pActiveItem->CanHolster() )
|
if( !pPlayer->m_pActiveItem->CanHolster() )
|
||||||
{
|
{
|
||||||
// can't put away the active item.
|
// can't put away the active item.
|
||||||
|
@ -2876,6 +2876,8 @@ void CBasePlayer::Spawn( void )
|
|||||||
|
|
||||||
m_flNextChatTime = gpGlobals->time;
|
m_flNextChatTime = gpGlobals->time;
|
||||||
|
|
||||||
|
m_iAutoWepSwitch = 1;
|
||||||
|
|
||||||
g_pGameRules->PlayerSpawn( this );
|
g_pGameRules->PlayerSpawn( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4158,6 +4160,18 @@ int CBasePlayer::Illumination( void )
|
|||||||
return iIllum;
|
return iIllum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBasePlayer::SetPrefsFromUserinfo( char *infobuffer )
|
||||||
|
{
|
||||||
|
const char *pszKeyVal;
|
||||||
|
|
||||||
|
pszKeyVal = g_engfuncs.pfnInfoKeyValue( infobuffer, "cl_autowepswitch" );
|
||||||
|
|
||||||
|
if( pszKeyVal[0] != '\0' )
|
||||||
|
m_iAutoWepSwitch = atoi( pszKeyVal );
|
||||||
|
else
|
||||||
|
m_iAutoWepSwitch = 1;
|
||||||
|
}
|
||||||
|
|
||||||
void CBasePlayer::EnableControl( BOOL fControl )
|
void CBasePlayer::EnableControl( BOOL fControl )
|
||||||
{
|
{
|
||||||
if( !fControl )
|
if( !fControl )
|
||||||
|
@ -312,7 +312,7 @@ public:
|
|||||||
float m_flPlayAftershock;
|
float m_flPlayAftershock;
|
||||||
float m_flNextAmmoBurn;// while charging, when to absorb another unit of player's ammo?
|
float m_flNextAmmoBurn;// while charging, when to absorb another unit of player's ammo?
|
||||||
|
|
||||||
//Player ID
|
// Player ID
|
||||||
void InitStatusBar( void );
|
void InitStatusBar( void );
|
||||||
void UpdateStatusBar( void );
|
void UpdateStatusBar( void );
|
||||||
int m_izSBarState[SBAR_END];
|
int m_izSBarState[SBAR_END];
|
||||||
@ -321,8 +321,12 @@ public:
|
|||||||
char m_SbarString0[SBAR_STRING_SIZE];
|
char m_SbarString0[SBAR_STRING_SIZE];
|
||||||
char m_SbarString1[SBAR_STRING_SIZE];
|
char m_SbarString1[SBAR_STRING_SIZE];
|
||||||
|
|
||||||
|
void SetPrefsFromUserinfo( char *infobuffer );
|
||||||
|
|
||||||
float m_flNextChatTime;
|
float m_flNextChatTime;
|
||||||
|
|
||||||
|
int m_iAutoWepSwitch;
|
||||||
|
|
||||||
Vector m_vecLastViewAngles;
|
Vector m_vecLastViewAngles;
|
||||||
|
|
||||||
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
|
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
|
||||||
|
@ -75,6 +75,11 @@ BOOL CHalfLifeRules::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !pPlayer->m_iAutoWepSwitch )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if( !pPlayer->m_pActiveItem->CanHolster() )
|
if( !pPlayer->m_pActiveItem->CanHolster() )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -357,6 +357,8 @@ void CHalfLifeTeamplay::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infob
|
|||||||
|
|
||||||
// recound stuff
|
// recound stuff
|
||||||
RecountTeams( TRUE );
|
RecountTeams( TRUE );
|
||||||
|
|
||||||
|
pPlayer->SetPrefsFromUserinfo( infobuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int gmsgDeathMsg;
|
extern int gmsgDeathMsg;
|
||||||
|
Loading…
Reference in New Issue
Block a user