Skip to content

Commit b94fc3d

Browse files
committed
xrGame: Made third ammo type optional
1 parent 20c9be3 commit b94fc3d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/xrGame/ui/UIHudStatesWnd.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void CUIHudStatesWnd::InitFromXml(CUIXml& xml, LPCSTR path)
109109
m_ui_weapon_cur_ammo = UIHelper::CreateTextWnd(xml, "static_cur_ammo", this);
110110
m_ui_weapon_fmj_ammo = UIHelper::CreateTextWnd(xml, "static_fmj_ammo", this);
111111
m_ui_weapon_ap_ammo = UIHelper::CreateTextWnd(xml, "static_ap_ammo", this);
112-
m_ui_weapon_third_ammo = UIHelper::CreateTextWnd(xml, "static_third_ammo", this); //Alundaio: Option to display a third ammo type
112+
m_ui_weapon_third_ammo = UIHelper::CreateTextWnd(xml, "static_third_ammo", this, false); //Alundaio: Option to display a third ammo type
113113
m_fire_mode = UIHelper::CreateTextWnd(xml, "static_fire_mode", this);
114114
m_ui_grenade = UIHelper::CreateTextWnd(xml, "static_grenade", this);
115115

@@ -309,7 +309,8 @@ void CUIHudStatesWnd::UpdateActiveItemInfo(CActor* actor)
309309
m_ui_weapon_cur_ammo->Show(true);
310310
m_ui_weapon_fmj_ammo->Show(true);
311311
m_ui_weapon_ap_ammo->Show(true);
312-
m_ui_weapon_third_ammo->Show(true);
312+
if (m_ui_weapon_third_ammo)
313+
m_ui_weapon_third_ammo->Show(true);
313314

314315
m_fire_mode->Show(true);
315316
m_ui_grenade->Show(true);
@@ -326,7 +327,8 @@ void CUIHudStatesWnd::UpdateActiveItemInfo(CActor* actor)
326327

327328
m_ui_weapon_fmj_ammo->SetTextColor(color_rgba(238, 155, 23, 150));
328329
m_ui_weapon_ap_ammo->SetTextColor(color_rgba(238, 155, 23, 150));
329-
m_ui_weapon_third_ammo->SetTextColor(color_rgba(238, 155, 23, 150));
330+
if (m_ui_weapon_third_ammo)
331+
m_ui_weapon_third_ammo->SetTextColor(color_rgba(238, 155, 23, 150));
330332

331333
CWeaponMagazinedWGrenade* wpn = smart_cast<CWeaponMagazinedWGrenade*>(item);
332334
if (wpn && wpn->m_bGrenadeMode)
@@ -341,7 +343,7 @@ void CUIHudStatesWnd::UpdateActiveItemInfo(CActor* actor)
341343
m_ui_weapon_fmj_ammo->SetTextColor(color_rgba(238, 155, 23, 255));
342344
else if (wpnm->m_ammoType == 1)
343345
m_ui_weapon_ap_ammo->SetTextColor(color_rgba(238, 155, 23, 255));
344-
else if (wpnm->m_ammoType == 2)
346+
else if (wpnm->m_ammoType == 2 && m_ui_weapon_third_ammo)
345347
m_ui_weapon_third_ammo->SetTextColor(color_rgba(238, 155, 23, 255));
346348
}
347349
//-Alundaio
@@ -353,7 +355,8 @@ void CUIHudStatesWnd::UpdateActiveItemInfo(CActor* actor)
353355
m_ui_weapon_cur_ammo->Show(false);
354356
m_ui_weapon_fmj_ammo->Show(false);
355357
m_ui_weapon_ap_ammo->Show(false);
356-
m_ui_weapon_third_ammo->Show(false);
358+
if (m_ui_weapon_third_ammo)
359+
m_ui_weapon_third_ammo->Show(false);
357360
m_fire_mode->Show(false);
358361
m_ui_grenade->Show(false);
359362
}

0 commit comments

Comments
 (0)