Emergency 20 Dokumentation  4.2.0
MainEvent04.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 MainEvent04 : 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 
50  //[-------------------------------------------------------]
51  //[ Public methods ]
52  //[-------------------------------------------------------]
53  public:
58  MainEvent04();
59 
64  virtual ~MainEvent04();
65 
66 
67  //[-------------------------------------------------------]
68  //[ Public virtual em5::FreeplayEvent methods ]
69  //[-------------------------------------------------------]
70  public:
71  //[-------------------------------------------------------]
72  //[ Life cycle ]
73  //[-------------------------------------------------------]
74  virtual bool onStartup() override;
75  virtual void onShutdown() override;
76  virtual void onRun() override;
77  virtual bool onSuccess(EventResult& eventResult) override;
78  virtual bool onFailure(EventResult& eventResult) override;
79 
80  //[-------------------------------------------------------]
81  //[ Points evaluation ]
82  //[-------------------------------------------------------]
83  virtual uint32 calculatePointGain(EventResult& eventResult) override;
84 
85  //[-------------------------------------------------------]
86  //[ Callbacks from observers ]
87  //[-------------------------------------------------------]
88  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
89  virtual void hintCallback(Observer& hintObserver) override;
90 
91  //[-------------------------------------------------------]
92  //[ Miscellaneous ]
93  //[-------------------------------------------------------]
94  virtual const qsf::Entity* getFocusEntity() override;
95 
96  //[-------------------------------------------------------]
97  //[ Serialize ]
98  //[-------------------------------------------------------]
99  virtual void serialize(qsf::BinarySerializer& serializer) override;
100 
101 
102  //[-------------------------------------------------------]
103  //[ Protected virtual em5::MainEvent methods ]
104  //[-------------------------------------------------------]
105  protected:
106  virtual void onIntroStart(const qsf::MessageParameters& parameters) override;
107  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
108  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
109 
110  //[-------------------------------------------------------]
111  //[ Regular update ]
112  //[-------------------------------------------------------]
113  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
114  virtual void onUpdateMusic(const qsf::Time& timePassed) override;
115 
116  virtual uint32 getEventNumber() override;
117 
118 
119  //[-------------------------------------------------------]
120  //[ Private methods ]
121  //[-------------------------------------------------------]
122  private:
123  void gatherEventEntities();
124 
125  void startObjectives();
126  void startHintObservers();
127 
128  void startIntroFire();
129  void startIntroDestruction();
130 
135  void gasBottleExplosion();
136 
141  void onGasBottleExlosionCutsceneEnded(const qsf::MessageParameters& parameters);
142 
147  void startGasbottleFires();
148 
153  void startBombExplosion();
154 
159  void onExplosionCutsceneEnded(const qsf::MessageParameters& parameters);
160 
165  void createDisarmBombObjective(qsf::Entity& bomb);
166 
171  void checkGasbottleExplosionCondition(const qsf::JobArguments& jobArguments);
172 
177  void carExplosionTrigger(const qsf::JobArguments& jobArguments);
178 
179 
180  //[-------------------------------------------------------]
181  //[ Private data ]
182  //[-------------------------------------------------------]
183  private:
184  // Connected to CAMP
185  qsf::Time mBombCountDownTime; // 240 sec.
186  qsf::Time mBombDefuseTime; // 10 sec.
187  qsf::Time mCarExplosionTime; // 120 sec.
188  uint32 mGasExplosionFireCount; // 5
189  qsf::Time mHint01WaitTime; // 30 sec.
190  qsf::Time mHint02WaitTime; // 30 sec.
191  qsf::Time mHint03WaitTime; // 100 sec.
192  float mHint04LifeEnergy; // 10%
193  int mHint05Injuries; // 10
194  qsf::Time mHint06WaitTime; // 45 sec.
195  qsf::Time mHint06WaitTime2; // 90 sec.
196  qsf::Time mHint06WaitTime3; // 150 sec.
197  qsf::Time mHint07WaitTime; // 10 sec.
198  qsf::Time mHint08WaitTime; // 30 sec.
199  qsf::Time mHint09WaitTime; // 90 sec.
200  qsf::Time mHint11WaitTime; // 190 sec.
201  qsf::Time mHint12WaitTime; // 90 sec.
202  float mHint13LifeEnergy; // 20%
203  qsf::Time mHint14WaitTime; // 20 sec.
204  qsf::Time mHint14WaitTime2; // 105 sec.
205  qsf::Time mHint15WaitTime; // 20 sec.
206  qsf::Time mHint16WaitTime; // 150 sec
207  int mHint17MaxFire; // 5
208  int mHint18MaxFire; // 12
209  int mHint19MaxFire; // 4
210  qsf::Time mHint19aWaitTime; // 180s
211  qsf::Time mHint20WaitTime; // 80 sec.
212 
213  // Internal
214  std::vector<qsf::Entity*> mWorkers;
215  std::vector<qsf::WeakPtr<qsf::Entity>> mCrashCars;
216  std::vector<qsf::Entity*> mCrashCarVictims;
217  std::vector<qsf::Entity*> mBlocks;
218  std::vector<qsf::Entity*> mBlockVictims;
219  qsf::Entity* mBomb2;
220 
221  std::vector<qsf::Entity*> mFires;
222  std::vector<qsf::Entity*> mDestroyIntro;
223  std::vector<qsf::Entity*> mFireGasBottle;
224 
225  qsf::JobProxy mUpdateJobProxyGasBottle;
226  qsf::JobProxy mUpdateJobProxyCivilCars;
227  qsf::MessageProxy mLivecycleProxyGasbottleStartFire;
228  qsf::MessageProxy mLivecycleProxyIntroDestroyObjects;
229  qsf::MessageProxy mCarStopBurningMessageProxy;
230  qsf::Time mUnitHint01TriggerCountdownLeftTime;
231  qsf::Time mTimePassedCars;
232 
233  // Ending
234  bool mPlayingWinFadeOut;
235  bool mStartedBombExplosionSequence;
236 
237  // Hint accessory
238  bool mHint01Triggered;
239  bool mHint02Triggered;
240  bool mHint04Triggered;
241  bool mHint07Triggered;
242  bool mHint14Triggered;
243  bool mHint17Triggered;
244  bool mHint18Triggered;
245  bool mHint20Triggered;
246  int mHint18Amount;
247  bool mHint19Triggered;
248  int mHint19Amount;
249 
250  int mFailLimitDestroyedSquadVehicles;
251  int mFailLimitInjuredPersons;
252  int mFailLimitExplodedCivilCars;
253  int mFailLimitBurningBuildings;
254  int mFailLimitBurningObjects;
255 
256 
257  //[-------------------------------------------------------]
258  //[ CAMP reflection system ]
259  //[-------------------------------------------------------]
260  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
261 
262 
263  };
264 
265 
266 //[-------------------------------------------------------]
267 //[ Namespace ]
268 //[-------------------------------------------------------]
269 } // em5
270 
271 
272 //[-------------------------------------------------------]
273 //[ CAMP reflection system ]
274 //[-------------------------------------------------------]
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.
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Job proxy class.
Definition: JobProxy.h:51
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
virtual void onShutdown() override
React to shutdown of the freeplay event.
unsigned int uint32
Definition: PlatformTypes.h:181
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 bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
virtual void onRun() override
React to state change from (initial) hidden state to running state.
virtual ~MainEvent04()
Destructor.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent01" unique freeplay event ID
Definition: MainEvent04.h:47
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
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 bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
virtual void onIntroStart(const qsf::MessageParameters &parameters) override
React to the activation of the black screen, which is the start of the intro cutscene.
EMERGENCY 5 main event 04 "Munich aircraft bomb".
Definition: MainEvent04.h:33
virtual bool onStartup() override
React to startup of the freeplay event.
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
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 void onUpdateMusic(const qsf::Time &timePassed) override
Gets called when the main event gets an update call We use here a separate update method...
virtual void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
MainEvent04()
Default constructor.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
Binary serializer class.
Definition: BinarySerializer.h:35
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32