mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-08 11:01:33 +00:00
Merge 115d98470a
into ceb6d4d783
This commit is contained in:
commit
893b3084c6
2 changed files with 32 additions and 34 deletions
|
@ -400,6 +400,38 @@ void CBaseHudWeaponSelection::UserCmd_Slot10(void)
|
|||
SelectSlot( 10 );
|
||||
}
|
||||
|
||||
void ClientInstantPhysSwap()
|
||||
{
|
||||
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
if ( !pPlayer )
|
||||
return;
|
||||
|
||||
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
|
||||
if ( !pWeapon )
|
||||
return;
|
||||
|
||||
const char *strWeaponName = pWeapon->GetName();
|
||||
|
||||
if ( !Q_stricmp( strWeaponName, "weapon_physcannon" ) )
|
||||
{
|
||||
input->MakeWeaponSelection( pPlayer->GetLastWeapon() ); // back to previous weapon
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < pPlayer->WeaponCount(); ++i )
|
||||
{
|
||||
C_BaseCombatWeapon *pWeapon = pPlayer->GetWeapon( i );
|
||||
if ( pWeapon && !Q_stricmp( pWeapon->GetClassname(), "weapon_physcannon" ) ) // switch to physcannon
|
||||
{
|
||||
input->MakeWeaponSelection( pWeapon );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ConCommand cl_physswap( "phys_swap", ClientInstantPhysSwap, "Client-predicted physcannon swap for low-latency switching." );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: returns true if the CHudMenu should take slot1, etc commands
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -1038,40 +1038,6 @@ void CC_Player_TestDispatchEffect( const CCommand &args )
|
|||
|
||||
static ConCommand test_dispatcheffect("test_dispatcheffect", CC_Player_TestDispatchEffect, "Test a clientside dispatch effect.\n\tUsage: test_dispatcheffect <effect name> <distance away> <flags> <magnitude> <scale>\n\tDefaults are: <distance 1024> <flags 0> <magnitude 0> <scale 0>\n", FCVAR_CHEAT);
|
||||
|
||||
#ifdef HL2_DLL
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Quickly switch to the physics cannon, or back to previous item
|
||||
//-----------------------------------------------------------------------------
|
||||
void CC_Player_PhysSwap( void )
|
||||
{
|
||||
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
|
||||
|
||||
if ( pPlayer )
|
||||
{
|
||||
CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
|
||||
|
||||
if ( pWeapon )
|
||||
{
|
||||
// Tell the client to stop selecting weapons
|
||||
engine->ClientCommand( UTIL_GetCommandClient()->edict(), "cancelselect" );
|
||||
|
||||
const char *strWeaponName = pWeapon->GetName();
|
||||
|
||||
if ( !Q_stricmp( strWeaponName, "weapon_physcannon" ) )
|
||||
{
|
||||
PhysCannonForceDrop( pWeapon, NULL );
|
||||
pPlayer->SelectLastItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->SelectItem( "weapon_physcannon" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static ConCommand physswap("phys_swap", CC_Player_PhysSwap, "Automatically swaps the current weapon for the physcannon and back again." );
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Quickly switch to the bug bait, or back to previous item
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue