Пример #1
0
bool CAmmoChooser::Open()
{
	// Don't allow the chooser to be opened if we're selecting/deselecting a
	// weapon...

	CClientWeapon *pClientWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon();

	WeaponState eState = pClientWeapon->GetState();
	if (W_DESELECT == eState || W_SELECT == eState) return false;


	if (m_bIsOpen)
        return true;


	m_hAmmo = pClientWeapon->GetAmmoRecord();

	if( m_hAmmo == pClientWeapon->GetNextAvailableAmmo() )
	{
		m_hAmmo = NULL;
        m_bIsOpen = false;
        return false;
	}
    m_bIsOpen = true;

	m_AutoCloseTimer.Start(kfDelayTime);
	g_pHUDMgr->QueueUpdate(kHUDChooser);
    return true;
}
Пример #2
0
void CAmmoChooser::NextAmmo()
{
	CClientWeapon *pClientWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon();
	if ( !pClientWeapon )
	{
		return;
	}

	m_hAmmo = pClientWeapon->GetNextAvailableAmmo(m_hAmmo);

    g_pClientSoundMgr->PlayInterfaceSound((char*)g_pInterfaceResMgr->GetSoundSelect());

	m_AutoCloseTimer.Start(kfDelayTime);
	m_NextAmmoKeyDownTimer.Start(g_vtChooserAutoSwitchTime.GetFloat());
	g_pHUDMgr->QueueUpdate(kHUDChooser);
}