Emergency 20 Dokumentation  4.2.0
MainEvent203.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 //[-------------------------------------------------------]
14 
15 #include <qsf/job/JobProxy.h>
16 #include <qsf/base/WeakPtr.h>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
33  class MainEvent203 : public MainEvent
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Friends ]
39  //[-------------------------------------------------------]
40  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public definitions ]
45  //[-------------------------------------------------------]
46  public:
47  static const uint32 FREEPLAY_EVENT_ID;
48 
49  // For matching gangster and waypoints
51  {
52  bool loop;
55  };
56 
57 
58  //[-------------------------------------------------------]
59  //[ Public methods ]
60  //[-------------------------------------------------------]
61  public:
66  MainEvent203();
67 
72  virtual ~MainEvent203();
73 
74 
75  //[-------------------------------------------------------]
76  //[ Public virtual em5::FreeplayEvent methods ]
77  //[-------------------------------------------------------]
78  public:
79  //[-------------------------------------------------------]
80  //[ Life cycle ]
81  //[-------------------------------------------------------]
82  virtual bool onStartup() override;
83  virtual void onShutdown() override;
84  virtual void onRun() override;
85  virtual bool onSuccess(EventResult& eventResult) override;
86  virtual bool onFailure(EventResult& eventResult) override;
87 
88  //[-------------------------------------------------------]
89  //[ Points evaluation ]
90  //[-------------------------------------------------------]
91  virtual uint32 calculatePointGain(EventResult& eventResult) override;
92 
93  //[-------------------------------------------------------]
94  //[ Callbacks from observers ]
95  //[-------------------------------------------------------]
96  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
97  virtual void hintCallback(Observer& hintObserver) override;
98  virtual void hintCallbackWithMessage(Observer& hintObserver, const qsf::MessageParameters& parameters) override;
99 
100  //[-------------------------------------------------------]
101  //[ Miscellaneous ]
102  //[-------------------------------------------------------]
103  virtual const qsf::Entity* getFocusEntity() override;
104 
105  //[-------------------------------------------------------]
106  //[ Serialize ]
107  //[-------------------------------------------------------]
108  virtual void serialize(qsf::BinarySerializer& serializer) override;
109 
110 
111  //[-------------------------------------------------------]
112  //[ Protected virtual em5::MainEvent methods ]
113  //[-------------------------------------------------------]
114  protected:
115  virtual void onIntroStart(const qsf::MessageParameters& parameters) override;
116  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
117  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
118 
119  //[-------------------------------------------------------]
120  //[ Regular update ]
121  //[-------------------------------------------------------]
122  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
123 
124  virtual uint32 getEventNumber() override;
125  virtual std::string getCamStartEventTag() override;
126 
127 
128  //[-------------------------------------------------------]
129  //[ Private methods ]
130  //[-------------------------------------------------------]
131  private:
132  void gatherEventEntities();
133  void startObjectives();
134  void startHintObservers();
135 
136  void startHouseExplosion();
137  void onHouseExplosionDelay();
138  void showSparkleEffect(bool active);
139  void startFoundGangsterInBushes();
140  void showHiddenTerrorists(bool active);
141 
142  void onBuriedFound(const qsf::MessageParameters& parameters);
143  void onGunShot(const qsf::MessageParameters& parameters);
144  void onEboxRepaired(const qsf::MessageParameters& parameters);
145  void onTookPersonOutside(const qsf::MessageParameters& parameters);
146 
147  void patrolOnPath(qsf::Entity& personEntity, qsf::Entity& pathEntity, bool runToTarget);
148  void startPatroling();
149  void startPatroling(qsf::Entity& gangster, bool runToTarget);
150 
151  bool checkCollisionForWarningAreaById(qsf::Entity& unitentity, int index);
152  void activateWarningArea(int warningAreaIndex, bool active);
153  void activateGangsterOnRoof(int houseIndex);
154  qsf::Entity* getWarningAreaById(int warningAreaIndex);
155  void setupGangster(qsf::Entity& gangster);
156  void setupTerroristHouse(qsf::Entity& terroristHouse);
157 
158 
159  //[-------------------------------------------------------]
160  //[ Private data ]
161  //[-------------------------------------------------------]
162  private:
163  // Setup
164  float mPersonInjuredRange;
165 
166  // Settings, connected to camp
167  qsf::Time mHint01WaitTime;
168  qsf::Time mHint02WaitTime;
169  int mMaxDeadCivilians;
170  int mMaxDeadUnitPerson;
171  int mMaxBurningObjects;
172 
173  // Internal data
174  qsf::WeakPtr<qsf::Entity> mTerroristHouse1;
175  qsf::WeakPtr<qsf::Entity> mTerroristHouse2;
176  qsf::WeakPtr<qsf::Entity> mTerroristHouse3;
177  qsf::WeakPtr<qsf::Entity> mTerroristHouseStartExplosion;
178  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristHouses;
179  std::vector<qsf::WeakPtr<qsf::Entity>> mExplosionStartBurnings;
180  std::vector<qsf::WeakPtr<qsf::Entity>> mExplosionDropPositions;
181  std::vector<qsf::WeakPtr<qsf::Entity>> mExplosionDebris;
182  std::vector<qsf::WeakPtr<qsf::Entity>> mExplosionDebrisPerson;
183  qsf::WeakPtr<qsf::Entity> mToxicCloud;
184  qsf::WeakPtr<qsf::Entity> mEboxEntity;
185  std::vector<qsf::WeakPtr<qsf::Entity>> mEboxSparkle;
186  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristsHidden;
187  std::vector<qsf::WeakPtr<qsf::Entity>> mTerrorists;
188  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristsInhouse;
189  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristsOnHouse;
190  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristsDeco;
191  std::vector<qsf::WeakPtr<qsf::Entity>> mWarningArea;
192  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristsWithKneeingAnimation; // Redundant to other lists, just give them animation at start
193  std::vector<qsf::WeakPtr<qsf::Entity>> mTerroristsWithManipulatingAnimation; // Redundant to other lists, just give them animation at start
194  qsf::WeakPtr<qsf::Entity> mDummyContainerEntity; // Generated Entity, used to "hide" policeman via explosion
195  qsf::WeakPtr<qsf::Entity> mTweetCameraEntity;
196  qsf::WeakPtr<qsf::Entity> mTweetPersonEntity;
197 
198  // For gangster movement
199  // Some of the gangsters above has event tags for movement. The tags have identifier for patrol ways
200  // The patrol waypoints also have numbers for a 1:1 matching of gangster to waypoint
201  std::vector<qsf::WeakPtr<qsf::Entity>> mPatrolLoop; // Gangster Entities with the order to loop the movement for his waypoint
202  std::vector<qsf::WeakPtr<qsf::Entity>> mPatrolSingle; // Gangster Entities with the order to walk the waypoints and stay there
203  std::vector<qsf::WeakPtr<qsf::Entity>> mPatrolWayPoint; // Waypoints
204  qsf::WeakPtr<qsf::Entity> mPatrolHiddenWaypointEntity; // Waypoints for hidden gangster
205 
206  std::vector<GangsterWaypointData> mGangsterWaypointData;
207 
208  bool mHouseExplosionStarted;
209  bool mHouseExplosionDelayFinished;
210  qsf::Time mHouseExplosionDelayTimer;
211  bool mEboxRepaired;
212  bool mFoundGangsterInBushes;
213  qsf::Time mHiddenGangsterAttackTime;
214  bool mHiddenGangsterAttacked;
215 
216  bool mWarningAreaHidden1;
217  bool mWarningAreaHidden2;
218  bool mWarningAreaHidden3;
219  std::vector<uint64> mAttackedBuildings;
220 
221  qsf::MessageProxy mBuriedFoundMessageProxy;
222  qsf::MessageProxy mEboxRepairedProxy;
223  qsf::MessageProxy mAttackedBuildingsProxy;
224 
225  bool mCanPlayHint01;
226  bool mCanPlayHint02;
227 
228  // Music level 1 is active if the gangster recognize the player units. Triggers only once
229  bool mCanTriggerMusicLevel1;
230  qsf::MessageProxy mGunShotMessageProxy;
231 
232 
233  //[-------------------------------------------------------]
234  //[ CAMP reflection system ]
235  //[-------------------------------------------------------]
236  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
237 
238 
239  };
240 
241 
242 //[-------------------------------------------------------]
243 //[ Namespace ]
244 //[-------------------------------------------------------]
245 } // em5
246 
247 
248 //[-------------------------------------------------------]
249 //[ CAMP reflection system ]
250 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual bool onStartup() override
React to startup of the freeplay event.
qsf::WeakPtr< qsf::Entity > person
Definition: MainEvent203.h:53
virtual void hintCallbackWithMessage(Observer &hintObserver, const qsf::MessageParameters &parameters) override
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
virtual bool addEntityToEvent(qsf::Entity &targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override
React to adding to an entity to this event, i.e. setting the event ID for the entity.
virtual void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
MainEvent203()
Default constructor.
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual void onShutdown() override
React to shutdown of the freeplay event.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
Definition: MainEvent203.h:50
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent203" unique freeplay event ID
Definition: MainEvent203.h:47
virtual const qsf::Entity * getFocusEntity() override
Get an event entity that is currently crucial for this event This is the entity which gets the focus ...
virtual std::string getCamStartEventTag() override
Return event tag of a start camera for the event; only necessary for main events without prologue cut...
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
virtual void onIntroStart(const qsf::MessageParameters &parameters) override
React to the activation of the black screen, which is the start of the intro cutscene.
virtual void onRun() override
React to state change from (initial) hidden state to running state.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 2017 main event 203 "Ausheben einer Terrorzelle".
Definition: MainEvent203.h:33
qsf::WeakPtr< qsf::Entity > waypoint
Definition: MainEvent203.h:54
bool loop
Definition: MainEvent203.h:52
virtual void onUpdateMainEvent(const qsf::Time &timePassed) override
Gets called when the main event gets an update call We use here a separate update method...
virtual ~MainEvent203()
Destructor.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32