diff --git a/src/xrGame/UIZoneMap.cpp b/src/xrGame/UIZoneMap.cpp index 28110b9523d..77c5f951ef9 100644 --- a/src/xrGame/UIZoneMap.cpp +++ b/src/xrGame/UIZoneMap.cpp @@ -18,8 +18,14 @@ #include "ui/UIInventoryUtilities.h" ////////////////////////////////////////////////////////////////////////// -CUIZoneMap::CUIZoneMap() : m_current_map_idx(u8(-1)), visible(true) {} +CUIZoneMap::CUIZoneMap() : m_current_map_idx(u8(-1)), visible(true) +{ + m_clock_wnd = nullptr; + m_pointerDistanceText = nullptr; +} + CUIZoneMap::~CUIZoneMap() {} + void CUIZoneMap::Init() { CUIXml uiXml; @@ -29,7 +35,12 @@ void CUIZoneMap::Init() CUIXmlInit::InitWindow(uiXml, "minimap:level_frame", 0, &m_clipFrame); CUIXmlInit::InitStatic(uiXml, "minimap:center", 0, &m_center); - m_clock_wnd = UIHelper::CreateStatic(uiXml, "minimap:clock_wnd", &m_background); + m_clock_wnd = UIHelper::CreateStatic(uiXml, "minimap:clock_wnd", &m_background, false); + + if (IsGameTypeSingle()) + { + m_pointerDistanceText = UIHelper::CreateStatic(uiXml, "minimap:background:dist_text", &m_background, false); + } m_activeMap = new CUIMiniMap(); m_clipFrame.AttachChild(m_activeMap); @@ -75,9 +86,12 @@ void CUIZoneMap::Init() rel_pos.mul(m_background.GetWndSize()); m_compass.SetWndPos(rel_pos); - rel_pos = m_clock_wnd->GetWndPos(); - rel_pos.mul(m_background.GetWndSize()); - m_clock_wnd->SetWndPos(rel_pos); + if (m_clock_wnd) + { + rel_pos = m_clock_wnd->GetWndPos(); + rel_pos.mul(m_background.GetWndSize()); + m_clock_wnd->SetWndPos(rel_pos); + } if (IsGameTypeSingle()) { @@ -129,8 +143,11 @@ void CUIZoneMap::Update() Device.vCameraDirection.getHP(h, p); SetHeading(-h); - m_clock_wnd->TextItemControl()->SetText( - InventoryUtilities::GetGameTimeAsString(InventoryUtilities::etpTimeToMinutes).c_str()); + if (m_clock_wnd) + { + m_clock_wnd->TextItemControl()->SetText( + InventoryUtilities::GetGameTimeAsString(InventoryUtilities::etpTimeToMinutes).c_str()); + } } void CUIZoneMap::SetHeading(float angle) @@ -144,6 +161,20 @@ void CUIZoneMap::UpdateRadar(Fvector pos) m_clipFrame.Update(); m_background.Update(); m_activeMap->SetActivePoint(pos); + + if (m_pointerDistanceText) + { + if (m_activeMap->GetPointerDistance() > 0.5f) + { + string64 str; + xr_sprintf(str, "%.0f m", m_activeMap->GetPointerDistance()); + m_pointerDistanceText->SetText(str); + } + else + { + m_pointerDistanceText->SetText(""); + } + } } bool CUIZoneMap::ZoomIn() { return true; } diff --git a/src/xrGame/UIZoneMap.h b/src/xrGame/UIZoneMap.h index 11ff7cdb0e8..6a8609ddabd 100644 --- a/src/xrGame/UIZoneMap.h +++ b/src/xrGame/UIZoneMap.h @@ -18,6 +18,7 @@ class CUIZoneMap CUIStatic m_center; CUIStatic m_compass; CUIWindow m_clipFrame; + CUIStatic* m_pointerDistanceText; CUIStatic m_Counter; CUITextWnd m_Counter_text; u8 m_current_map_idx;