game/server/hl2/weapon_sniperrifle.cpp
bool CWeaponSniperRifle::Reload( void )
{
	CBaseCombatCharacter *pOwner = GetOwner();
	if (!pOwner)
	{
		return false;
	}
		
	if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) > 0)
	{
		int primary		= min(GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType));
		int secondary	= min(GetMaxClip2() - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType));

		if (primary > 0 || secondary > 0)
		{
			// Play reload on different channel as it happens after every fire
			// and otherwise steals channel away from fire sound
			WeaponSound(RELOAD);
			SendWeaponAnim( ACT_VM_RELOAD );

			m_flNextPrimaryAttack	= gpGlobals->curtime + SequenceDuration();

			m_bInReload = true;
		}

		return true;
	}

	return false;
}
//-----------------------------------------------------------------------------
// Purpose: Same as base reload but doesn't change the owner's next attack time. This
//			lets us zoom out while reloading. This hack is necessary because our
//			ItemPostFrame is only called when the owner's next attack time has
//			expired.
// Output : Returns true if the weapon was reloaded, false if no more ammo.
//-----------------------------------------------------------------------------
Same as base reload but doesn't change the owner's next attack time. This
lets us zoom out while reloading. This hack is necessary because our
ItemPostFrame is only called when the owner's next attack time has
expired.
Output : Returns true if the weapon was reloaded, false if no more ammo.
Same as base reload but doesn ' t change the owner ' s next attack time . This lets us zoom out while reloading . This hack is necessary because our ItemPostFrame is only called when the owner ' s next attack time has expired . Output : Returns true if the weapon was reloaded false if no more ammo .
bool CWeaponSniperRifle::Reload( void )
{
	CBaseCombatCharacter *pOwner = GetOwner();
	if (!pOwner)
	{
		return false;
	}
	if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) > 0)
	{
		int primary		= min(GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType));
		int secondary	= min(GetMaxClip2() - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType));
		if (primary > 0 || secondary > 0)
		{
			WeaponSound(RELOAD);
			SendWeaponAnim( ACT_VM_RELOAD );
			m_flNextPrimaryAttack	= gpGlobals->curtime + SequenceDuration();
			m_bInReload = true;
		}
		return true;
	}
	return false;
}
bool CWeaponSniperRifle :: Reload ( void ) { CBaseCombatCharacter * pOwner = GetOwner ( ) ; if ( ! pOwner ) { return false ; } if ( pOwner -> GetAmmoCount ( m_iPrimaryAmmoType ) > 0 ) { int primary = min ( GetMaxClip1 ( ) - m_iClip1 , pOwner -> GetAmmoCount ( m_iPrimaryAmmoType ) ) ; int secondary = min ( GetMaxClip2 ( ) - m_iClip2 , pOwner -> GetAmmoCount ( m_iSecondaryAmmoType ) ) ; if ( primary > 0 || secondary > 0 ) { WeaponSound ( RELOAD ) ; SendWeaponAnim ( ACT_VM_RELOAD ) ; m_flNextPrimaryAttack = gpGlobals -> curtime + SequenceDuration ( ) ; m_bInReload = true ; } return true ; } return false ; }
Purpose: Same as base reload but doesn't change the owner's next attack time.
Purpose : Same as base reload but doesn ' t change the owner ' s next attack time .
// Play reload on different channel as it happens after every fire // and otherwise steals channel away from fire sound