Example #1
0
void CUIHudStatesWnd::UpdateActiveItemInfo( CActor* actor )
{
	PIItem item = actor->inventory().ActiveItem();
	if ( item )
	{
		if(m_b_force_update)
		{
			if(item->cast_weapon())
				item->cast_weapon()->ForceUpdateAmmo();
			m_b_force_update		= false;
		}

		item->GetBriefInfo			( m_item_info );

//		UIWeaponBack.SetText		( str_name.c_str() );
		m_fire_mode->SetText		( m_item_info.fire_mode.c_str() );
		SetAmmoIcon					( m_item_info.icon.c_str() );
		
		m_ui_weapon_cur_ammo->Show	( true );
		m_ui_weapon_fmj_ammo->Show	( true );
		m_ui_weapon_ap_ammo->Show	( true );
		m_fire_mode->Show			( true );
		m_ui_grenade->Show			( true );

		m_ui_weapon_cur_ammo->SetText	( m_item_info.cur_ammo.c_str() );
		m_ui_weapon_fmj_ammo->SetText	( m_item_info.fmj_ammo.c_str() );
		m_ui_weapon_ap_ammo->SetText	( m_item_info.ap_ammo.c_str() );
		
		m_ui_grenade->SetText	( m_item_info.grenade.c_str() );

		CWeaponMagazinedWGrenade* wpn = smart_cast<CWeaponMagazinedWGrenade*>(item);
		if(wpn && wpn->m_bGrenadeMode)
		{
			m_ui_weapon_fmj_ammo->SetTextColor(color_rgba(238,155,23,150));
			m_ui_grenade->SetTextColor(color_rgba(238,155,23,255));
		}
		else
		{
			m_ui_weapon_fmj_ammo->SetTextColor(color_rgba(238,155,23,255));
			m_ui_grenade->SetTextColor(color_rgba(238,155,23,150));
		}
	}
	else
	{
		m_ui_weapon_icon->Show		( false );

		m_ui_weapon_cur_ammo->Show	( false );
		m_ui_weapon_fmj_ammo->Show	( false );
		m_ui_weapon_ap_ammo->Show	( false );
		m_fire_mode->Show			( false );
		m_ui_grenade->Show			( false );
	}
}