Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sp/src/game/server/hl2/weapon_pistol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ class CWeaponPulsePistol : public CWeaponPistol

virtual bool Reload( void ) { return false; } // The pulse pistol does not reload

bool DualWieldOverridesSecondary() const { return false; }

virtual int GetMaxClip2( void ) const
{
int iBase = BaseClass::GetMaxClip2();
Expand Down
37 changes: 37 additions & 0 deletions sp/src/game/shared/hl2/basehlcombatweapon_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "basehlcombatweapon_shared.h"
#if defined(EZ2) && defined(GAME_DLL)
#include "npcevent.h"
#include "in_buttons.h"
#endif

#include "hl2_player_shared.h"
Expand Down Expand Up @@ -261,6 +262,42 @@ void CBaseHLCombatWeapon::WeaponIdle( void )
}

#ifdef EZ2
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHLCombatWeapon::ItemPostFrame( void )
{
#ifdef GAME_DLL
// When dual wielding, secondary attack is synonymous with primary attack
if (IsDualWielding() && DualWieldOverridesSecondary())
{
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner != NULL )
{
if (pOwner->m_nButtons & IN_ATTACK2)
{
pOwner->m_nButtons |= IN_ATTACK;
pOwner->m_nButtons &= ~IN_ATTACK2;
}

if (pOwner->m_afButtonPressed & IN_ATTACK2)
{
pOwner->m_afButtonPressed |= IN_ATTACK;
pOwner->m_afButtonPressed &= ~IN_ATTACK2;
}

if (pOwner->m_afButtonReleased & IN_ATTACK2)
{
pOwner->m_afButtonReleased |= IN_ATTACK;
pOwner->m_afButtonReleased &= ~IN_ATTACK2;
}
}
}
#endif

BaseClass::ItemPostFrame();
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions sp/src/game/shared/hl2/basehlcombatweapon_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ class CBaseHLCombatWeapon : public CBaseCombatWeapon
//
// Dual wielding
//
virtual void ItemPostFrame( void );
virtual const char *GetViewModel( int viewmodelindex = 0 ) const;

virtual CHudTexture const *GetSpriteActive( void ) const;
virtual CHudTexture const *GetSpriteInactive( void ) const;

virtual bool CanDualWield() const { return false; }
virtual bool DualWieldOverridesSecondary() const { return true; }
bool IsDualWielding() const { return m_hLeftHandGun != NULL; }

CBaseAnimating *GetLeftHandGun() const { return m_hLeftHandGun; }
Expand Down
Loading