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; }
void CHUDAmmo::Render() { if( g_vtHUDAmmoRender.GetFloat( ) < 1.0f ) return; bool bWeaponsEnabled = g_pClientWeaponMgr->WeaponsEnabled(); CClientWeapon* pClientWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon(); if (!pClientWeapon || !bWeaponsEnabled) return; if (!m_bDraw || pClientWeapon->GetState() == W_DESELECT) return; SetRenderState(); if (!m_bInfinite) { m_Text.Render(); } //render icon here if (m_hIconTexture) { g_pDrawPrim->SetTexture(m_hIconTexture); g_pDrawPrim->DrawPrim(&m_IconPoly,1); } }
// GRENADE PROTOTYPE WeaponState CClientWeaponMgr::GetCurrentWeaponState() const { CClientWeapon* pWpn = GetCurrentClientWeapon(); if (!pWpn) return W_INACTIVE; return pWpn->GetState(); }