Browse Source

Add the latest steam changes for cl_autowepswitch cvar.

hl_urbicide
Andrey Akhmichin 4 years ago
parent
commit
2a264d2c9a
  1. 12
      dlls/multiplay_gamerules.cpp
  2. 2
      dlls/player.cpp
  3. 6
      dlls/singleplay_gamerules.cpp

12
dlls/multiplay_gamerules.cpp

@ -324,6 +324,12 @@ BOOL CHalfLifeMultiplay::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerI @@ -324,6 +324,12 @@ BOOL CHalfLifeMultiplay::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerI
return FALSE;
}
if( pPlayer->m_iAutoWepSwitch == 2
&& pPlayer->m_afButtonLast & ( IN_ATTACK | IN_ATTACK2 ) )
{
return FALSE;
}
if( !pPlayer->m_pActiveItem->CanHolster() )
{
// can't put away the active item.
@ -573,7 +579,11 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) @@ -573,7 +579,11 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer )
{
BOOL addDefault;
CBaseEntity *pWeaponEntity = NULL;
int iOldAutoWepSwitch;
iOldAutoWepSwitch = pPlayer->m_iAutoWepSwitch;
pPlayer->m_iAutoWepSwitch = 1;
pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT );
addDefault = TRUE;
@ -590,6 +600,8 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) @@ -590,6 +600,8 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer )
pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads
}
pPlayer->m_iAutoWepSwitch = iOldAutoWepSwitch;
}
//=========================================================

2
dlls/player.cpp

@ -2876,8 +2876,6 @@ void CBasePlayer::Spawn( void ) @@ -2876,8 +2876,6 @@ void CBasePlayer::Spawn( void )
m_flNextChatTime = gpGlobals->time;
m_iAutoWepSwitch = 1;
g_pGameRules->PlayerSpawn( this );
}

6
dlls/singleplay_gamerules.cpp

@ -80,6 +80,12 @@ BOOL CHalfLifeRules::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem @@ -80,6 +80,12 @@ BOOL CHalfLifeRules::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem
return FALSE;
}
if( pPlayer->m_iAutoWepSwitch == 2
&& pPlayer->m_afButtonLast & ( IN_ATTACK | IN_ATTACK2 ) )
{
return FALSE;
}
if( !pPlayer->m_pActiveItem->CanHolster() )
{
return FALSE;

Loading…
Cancel
Save