Ejemplo n.º 1
0
	void UpdateAmmoState()
	{
		C_BaseCombatWeapon *wpn = GetActiveWeapon();
		C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();

		if (player && wpn && wpn->UsesSecondaryAmmo())
		{
			SetAmmo(player->GetAmmoCount(wpn->GetSecondaryAmmoType()));
		}

		if ( m_hCurrentActiveWeapon != wpn )
		{
			if ( wpn->UsesSecondaryAmmo() )
			{
				// we've changed to a weapon that uses secondary ammo
				g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("WeaponUsesSecondaryAmmo");
			}
			else 
			{
				// we've changed away from a weapon that uses secondary ammo
				g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("WeaponDoesNotUseSecondaryAmmo");
			}
			m_hCurrentActiveWeapon = wpn;
			
			// Get the icon we should be displaying
			m_iconSecondaryAmmo = gWR.GetAmmoIconFromWeapon( m_hCurrentActiveWeapon->GetSecondaryAmmoType() );
		}
	}
    void UpdateAmmoState()
    {
        C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
        C_BaseCombatWeapon *wpn = player ? player->GetActiveWeapon() : NULL;

        if (player && wpn && wpn->UsesSecondaryAmmo())
        {
            SetAmmo(player->GetAmmoCount(wpn->GetSecondaryAmmoType()));
        }

        if ( m_hCurrentActiveWeapon != wpn )
        {
            if ( wpn->UsesSecondaryAmmo() )
            {
                // we've changed to a weapon that uses secondary ammo
                GetClientMode()->GetViewportAnimationController()->StartAnimationSequence("WeaponUsesSecondaryAmmo");
            }
            else
            {
                // we've changed away from a weapon that uses secondary ammo
                GetClientMode()->GetViewportAnimationController()->StartAnimationSequence("WeaponDoesNotUseSecondaryAmmo");
            }
            m_hCurrentActiveWeapon = wpn;
        }
    }