Emergency 20 Dokumentation  4.2.0
MiniMapIconRegistrationLogic.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
15 
17 #include <qsf/math/Color4.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  class CommandableComponent;
26  class MiniMapRenderer;
27 }
28 namespace qsf
29 {
30  class Entity;
31 }
32 
33 
34 //[-------------------------------------------------------]
35 //[ Namespace ]
36 //[-------------------------------------------------------]
37 namespace em5
38 {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Classes ]
43  //[-------------------------------------------------------]
49  {
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public static methods ]
54  //[-------------------------------------------------------]
55  public:
56  static uint64 getHeadquarterEntityId();
57  static MiniMapIconType translateCommandableMiniMapIconType(const qsf::StringHash& commandableMiniMapIconType);
58 
59 
60  //[-------------------------------------------------------]
61  //[ Public methods ]
62  //[-------------------------------------------------------]
63  public:
66 
71  void onStartup();
72 
77  void onShutdown();
78 
79  void setPathVisualizationEntityId(uint64 entityId);
80 
81  void registerPolygon(uint64 entityId, const qsf::Color4& color);
82  void registerPolygon(uint64 entityId, const qsf::Color4& color, const std::vector<glm::vec3>& vertices);
83  void registerCirclePolygon(uint64 entityId, float radius, uint32 points, const qsf::Color4& color, bool updatePosition = false) const;
84  void unregisterPolygon(uint64 entityId);
85 
86  void registerIcon(uint64 entityId, MiniMapIconType minimapIconType, bool onlyForLocalPlayer = false) const;
87  void registerEventIcon(uint64 entityId) const;
88  void registerHighlightIcon(const glm::vec3& worldPosition) const;
89  void registerHighlightIcon(uint64 entityId) const;
90  void registerBombIcon(uint64 entityId) const;
91  void registerGangsterIcon(uint64 entityId) const;
92  void registerSearchIcon(uint64 entityId) const;
93  void unregisterIcon(uint64 entityId, bool onlyForLocalPlayer = false) const;
94  void unregisterIcon(const qsf::Entity& entity, bool onlyForLocalPlayer = false) const;
95  void registerUnitIcon(qsf::Entity& entity) const;
96  void showAllHarborIcons(bool show);
97 
98  void registerPingByWorldPosition(const glm::vec3& worldPosition, bool cyclesAnimation = true, bool playSound = true);
99 
100 
101  //[-------------------------------------------------------]
102  //[ Private methods ]
103  //[-------------------------------------------------------]
104  private:
105  // Calls to this method are replicated to the multiplyer clients through qsf::Message
106  void addIcon(uint64 entityId, MiniMapIconType iconType, float scaleOrMaxSize) const;
107  // Calls to this method are replicated to the multiplyer clients through qsf::Message
108  void addCirclePolygon(uint64 entityId, float radius, uint32 points, const qsf::Color4& color, bool updatePosition) const;
109  // Calls to this method are replicated to the multiplyer clients through qsf::Message
110  void removeIcon(uint64 entityId) const;
111 
112  // Calls to this method are only applied locally
113  bool addIconLocally(uint64 entityId, MiniMapIconType type, float scaleOrMaxSize) const;
114  // Calls to this method are only applied locally
115  void addCirclePolygonLocally(uint64 entityId, float radius, uint32 points, const qsf::Color4& color, bool updatePosition) const;
116  // Calls to this method are only applied locally
117  void removeIconLocally(uint64 entityId) const;
118 
119  CommandableComponent* checkUnit(qsf::Entity& unitEntity) const;
120  bool checkFire(qsf::Entity* fireEntity) const;
121  bool checkIsHiddenPerson(qsf::Entity* entity) const;
122  bool checkInjuredPerson(qsf::Entity* entity) const;
123 
124  void onSpawnUnit(const qsf::MessageParameters& parameters);
125  void onStartFire(const qsf::MessageParameters& parameters);
126  void onStopFire(const qsf::MessageParameters& parameters);
127  void onPersonGetsRescuedFromCar(const qsf::MessageParameters& parameters);
128  void onPlacePersonOnPolice(const qsf::MessageParameters& parameters);
129  void onEntityHidden(const qsf::MessageParameters& parameters);
130  void onFindHiddenPerson(const qsf::MessageParameters& parameters);
131  void onFindHiddenPersonWithSEKDrone(const qsf::MessageParameters& parameters);
132  void onSelectionChange(const qsf::MessageParameters& parameters);
133 
138  void onAddIcon(const qsf::MessageParameters& parameters);
139 
144  void onAddCirclePolygon(const qsf::MessageParameters& parameters);
145 
150  void onRemoveCirclePolygon(const qsf::MessageParameters& parameters);
151 
156  void onRemoveIcon(const qsf::MessageParameters& parameters);
157 
158 
159  //[-------------------------------------------------------]
160  //[ Private data ]
161  //[-------------------------------------------------------]
162  private:
163  bool mShowAllHarborIcons;
164  MiniMapRenderer* mMiniMapRenderer;
165  qsf::MessageProxy mMessageProxySpawnUnit;
166  qsf::MessageProxy mMessageProxyDespawnUnit;
167  qsf::MessageProxy mMessageProxyEnterVehicle;
168  qsf::MessageProxy mMessageProxyEnterBuilding;
169  qsf::MessageProxy mMessageProxyExitBuilding;
170  qsf::MessageProxy mMessageProxyStartFire;
171  qsf::MessageProxy mMessageProxyStopFire;
172  qsf::MessageProxy mMessageProxyDestroyedVehicle;
173  qsf::MessageProxy mMessageProxyPersonGetsRescuedFromCar;
174  qsf::MessageProxy mMessageProxyGangsterEscaped;
175  qsf::MessageProxy mMessageProxyPlacedInPolice;
176  qsf::MessageProxy mMessageProxyFindHiddenPerson;
177  qsf::MessageProxy mMessageProxyFindHiddenPersonWithSEKDrone;
178  qsf::MessageProxy mMessageProxyPickedUpByTowCar;
179  qsf::MessageProxy mMessageProxyLoadVehicleToTransporter;
180  qsf::MessageProxy mMessageProxyUnLoadVehicleFromTransporter;
181  qsf::MessageProxy mMessageProxyPickupPersonByParamedic;
182  qsf::MessageProxy mMessageProxyArrestGangster;
183  qsf::MessageProxy mMessageProxyOnSelectionChange;
184  qsf::MessageProxy mMessageProxyMinimapAddIcon;
185  qsf::MessageProxy mMessageProxyMinimapAddCirclePolygon;
186  qsf::MessageProxy mMessageProxyMinimapRemoveCirclePolygon;
187  qsf::MessageProxy mMessageProxyMinimapRemoveIcon;
188 
189 
190  };
191 
192 
193 //[-------------------------------------------------------]
194 //[ Namespace ]
195 //[-------------------------------------------------------]
196 } // em5
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
Minimap rendering class.
Definition: MiniMapRenderer.h:105
Color class with red, green, blue and alpha component.
Definition: Color4.h:39
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
Minimap registration logic.
Definition: MiniMapIconRegistrationLogic.h:48
uint64_t uint64
Definition: PlatformTypes.h:184
Definition: PickupPersonByParamedicAction.h:21
MiniMapIconType
Definition: MiniMapIcons.h:26
Compile time string hash class.
Definition: StringHash.h:59
Commandable component class.
Definition: CommandableComponent.h:46