diff --git a/binaries/data/mods/public/gui/session/minimap_panel.xml b/binaries/data/mods/public/gui/session/minimap_panel.xml
index ae8d207..f0639f9 100644
a
|
b
|
|
19 | 19 | <action on="MouseLeftRelease">if (g_HasIdleWorker) Engine.GetGUIObjectByName("idleOverlay").sprite = "stretched:session/minimap-idle-highlight.png";</action> |
20 | 20 | </object> |
21 | 21 | </object> |
| 22 | |
| 23 | <!-- select option --> |
| 24 | <object size="5 5 80 80"> |
| 25 | <object type="button" |
| 26 | name="selectButton" |
| 27 | tooltip_style="sessionToolTip" |
| 28 | > |
| 29 | <action on="Press">Engine.GetGUIObjectByName("minimapDetailsPanel").hidden = !Engine.GetGUIObjectByName("minimapDetailsPanel").hidden</action> |
| 30 | </object> |
| 31 | </object> |
| 32 | |
22 | 33 | <!-- Minimap --> |
23 | 34 | <object name="minimap" |
24 | 35 | type="minimap" z="20" |
… |
… |
|
29 | 40 | <!-- Overlays --> |
30 | 41 | <object name="minimapOverlay" size="4 4 100%-4 100%-4" type="image" sprite="stretched:session/minimap_circle_modern.png" ghost="true"/> |
31 | 42 | <object name="idleOverlay" z="100" size="100%-125 100%-125 100%-5 100%-5" type="image" sprite="stretched:session/minimap-idle.png" ghost="true"/> |
| 43 | |
| 44 | <object |
| 45 | name="minimapDetailsPanel" |
| 46 | size="0 100%-400 212 100%-212" |
| 47 | type="image" |
| 48 | sprite="supplementalDetailsPanel" |
| 49 | hidden="true" |
| 50 | > |
| 51 | <object name="minimapLayerResourcesCheckbox" size="0 0 100% 20" type="checkbox" style="ModernTickBox" checked="true"> |
| 52 | <action on="Press">Engine.GetGUIObjectByName("minimap").show_resources = !Engine.GetGUIObjectByName("minimap").show_resources;</action> |
| 53 | </object> |
| 54 | <object name="minimapLayerResourcesLabel" size="20 0 100%-20 20" type="text" style="ModernLabelText" text_align="left"> |
| 55 | <translatableAttribute id="caption">Resources</translatableAttribute> |
| 56 | </object> |
| 57 | <object name="minimapLayerResourcesSoloButton" size="100%-20 0 100% 20" type="image" sprite="iconInfoWhite"/><!-- TODO: add a magnifying glass sprite or something --> |
| 58 | |
| 59 | <object name="minimapLayerUnitsCheckbox" size="0 24 100% 44" type="checkbox" style="ModernTickBox" checked="true"> |
| 60 | <action on="Press">Engine.GetGUIObjectByName("minimap").show_units = !Engine.GetGUIObjectByName("minimap").show_units;</action> |
| 61 | </object> |
| 62 | <object name="minimapLayerUnitsLabel" size="20 24 100%-20 44" type="text" style="ModernLabelText" text_align="left"> |
| 63 | <translatableAttribute id="caption">Units</translatableAttribute> |
| 64 | </object> |
| 65 | <object name="minimapLayerUnitsSoloButton" size="100%-20 24 100% 44" type="image" sprite="iconInfoWhite"/><!-- TODO: add a magnifying glass sprite or something --> |
| 66 | </object> |
| 67 | |
32 | 68 | </object> |
diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp
index d15f150..c71fbc0 100644
a
|
b
|
CMiniMap::CMiniMap() :
|
70 | 70 | AddSetting(GUIST_CColor, "fov_wedge_color"); |
71 | 71 | AddSetting(GUIST_CStrW, "tooltip"); |
72 | 72 | AddSetting(GUIST_CStr, "tooltip_style"); |
| 73 | |
| 74 | AddSetting(GUIST_bool, "show_resources"); |
| 75 | AddSetting(GUIST_bool, "show_units"); |
| 76 | |
| 77 | GUI<bool>::SetSetting(this, "show_resources", true); |
| 78 | GUI<bool>::SetSetting(this, "show_units", true); |
| 79 | |
| 80 | GUI<bool>::GetSetting(this, "show_units", m_ShowUnits); |
| 81 | GUI<bool>::GetSetting(this, "show_resources", m_ShowResources); |
73 | 82 | m_Clicking = false; |
74 | 83 | m_MouseHovering = false; |
75 | 84 | |
… |
… |
void CMiniMap::HandleMessage(SGUIMessage& Message)
|
143 | 152 | { |
144 | 153 | switch (Message.type) |
145 | 154 | { |
| 155 | case GUIM_SETTINGS_UPDATED: |
| 156 | GUI<bool>::GetSetting(this, "show_units", m_ShowUnits); |
| 157 | GUI<bool>::GetSetting(this, "show_resources", m_ShowResources); |
| 158 | break; |
146 | 159 | case GUIM_MOUSE_PRESS_LEFT: |
147 | 160 | if (m_MouseHovering) |
148 | 161 | { |
… |
… |
void CMiniMap::Draw()
|
529 | 542 | for (CSimulation2::InterfaceList::const_iterator it = ents.begin(); it != ents.end(); ++it) |
530 | 543 | { |
531 | 544 | ICmpMinimap* cmpMinimap = static_cast<ICmpMinimap*>(it->second); |
| 545 | if (!cmpMinimap->ShouldRender(m_ShowResources, m_ShowUnits)) |
| 546 | continue; |
532 | 547 | if (cmpMinimap->GetRenderData(v.r, v.g, v.b, posX, posZ)) |
533 | 548 | { |
534 | 549 | ICmpRangeManager::ELosVisibility vis = cmpRangeManager->GetLosVisibility(it->first, g_Game->GetSimulation2()->GetSimContext().GetCurrentDisplayedPlayer()); |
diff --git a/source/gui/MiniMap.h b/source/gui/MiniMap.h
index 17f76c5..804b839 100644
a
|
b
|
protected:
|
107 | 107 | double m_HalfBlinkDuration; |
108 | 108 | double m_NextBlinkTime; |
109 | 109 | bool m_BlinkState; |
| 110 | |
| 111 | // activate/deactivate layers |
| 112 | bool m_ShowResources; |
| 113 | bool m_ShowUnits; |
110 | 114 | }; |
111 | 115 | |
112 | 116 | #endif // INCLUDED_MINIMAP |
diff --git a/source/simulation2/components/CCmpMinimap.cpp b/source/simulation2/components/CCmpMinimap.cpp
index 045573d..a1cc126 100644
a
|
b
|
public:
|
45 | 45 | |
46 | 46 | u8 m_R, m_G, m_B; // static template state if m_UsePlayerColor false; dynamic state if true |
47 | 47 | |
| 48 | enum Type: u8 |
| 49 | { |
| 50 | FOOD, |
| 51 | WOOD, |
| 52 | STONE, |
| 53 | METAL, |
| 54 | STRUCTURE, |
| 55 | SETTLEMENT, |
| 56 | UNIT, |
| 57 | SUPPORT, |
| 58 | HERO |
| 59 | }; |
| 60 | |
48 | 61 | // Dynamic state: |
49 | 62 | |
50 | 63 | bool m_Active; |
51 | 64 | entity_pos_t m_X, m_Z; // cache the latest position for more efficient rendering; only valid when m_Active true |
52 | 65 | |
| 66 | Type m_Type; |
| 67 | |
53 | 68 | // Not serialized (based on renderer timing): |
54 | 69 | // TODO: eventually ping state should be serialized and tied into simulation time, but currently lag causes too many problems |
55 | 70 | double m_PingEndTime; |
… |
… |
public:
|
108 | 123 | m_G = 0; |
109 | 124 | m_B = 255; |
110 | 125 | } |
| 126 | CStr type = paramNode.GetChild("Type").ToUTF8(); |
| 127 | if (type == "food" || type == "wood" || type == "stone" || type=="metal") |
| 128 | m_Type = Type::FOOD; |
| 129 | else |
| 130 | m_Type = Type::HERO; |
| 131 | std::cout << m_Type << std::endl; |
111 | 132 | } |
112 | 133 | |
113 | 134 | virtual void Deinit() |
… |
… |
public:
|
220 | 241 | return true; |
221 | 242 | } |
222 | 243 | |
| 244 | virtual bool ShouldRender(bool showResources, bool showUnits) |
| 245 | { |
| 246 | if (m_Type == Type::FOOD && !showResources) |
| 247 | return false; |
| 248 | else if (m_Type != Type::FOOD && !showUnits) |
| 249 | return false; |
| 250 | return true; |
| 251 | } |
| 252 | |
223 | 253 | virtual bool CheckPing(double currentTime, double pingDuration) |
224 | 254 | { |
225 | 255 | if (!m_Active || !m_IsPinging) |
diff --git a/source/simulation2/components/ICmpMinimap.h b/source/simulation2/components/ICmpMinimap.h
index 2cfeab3..9b38936 100644
a
|
b
|
public:
|
35 | 35 | */ |
36 | 36 | virtual bool GetRenderData(u8& r, u8& g, u8& b, entity_pos_t& x, entity_pos_t& z) = 0; |
37 | 37 | |
| 38 | virtual bool ShouldRender(bool showResources, bool showUnits) = 0; |
| 39 | |
38 | 40 | /** |
39 | 41 | * Return true if entity is actively pinging based on the current time |
40 | 42 | */ |