Emergency 20 Dokumentation  4.2.0
MainEvent204.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 //[-------------------------------------------------------]
15 
16 #include <qsf/job/JobProxy.h>
17 #include <qsf/base/WeakPtr.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  class GangsterWithWaypointReachedCallback;
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Classes ]
38  //[-------------------------------------------------------]
43  class MainEvent204 : public MainEvent
44  {
45 
46 
47  //[-------------------------------------------------------]
48  //[ Friends ]
49  //[-------------------------------------------------------]
50  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
51 
52 
53  //[-------------------------------------------------------]
54  //[ Public definitions ]
55  //[-------------------------------------------------------]
56  public:
57  static const uint32 FREEPLAY_EVENT_ID;
58 
60  {
66  };
67 
68 
69  //[-------------------------------------------------------]
70  //[ Public methods ]
71  //[-------------------------------------------------------]
72  public:
77  MainEvent204();
78 
83  virtual ~MainEvent204();
84 
85 
86  //[-------------------------------------------------------]
87  //[ Public virtual em5::FreeplayEvent methods ]
88  //[-------------------------------------------------------]
89  public:
90  //[-------------------------------------------------------]
91  //[ Life cycle ]
92  //[-------------------------------------------------------]
93  virtual bool onStartup() override;
94  virtual void onShutdown() override;
95  virtual void onRun() override;
96  virtual bool onSuccess(EventResult& eventResult) override;
97  virtual bool onFailure(EventResult& eventResult) override;
98 
99  //[-------------------------------------------------------]
100  //[ Points evaluation ]
101  //[-------------------------------------------------------]
102  virtual uint32 calculatePointGain(EventResult& eventResult) override;
103 
104  //[-------------------------------------------------------]
105  //[ Callbacks from observers ]
106  //[-------------------------------------------------------]
107  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
108  virtual void hintCallback(Observer& hintObserver) override;
109  virtual void hintCallbackWithMessage(Observer& hintObserver, const qsf::MessageParameters& parameters) override;
110 
111  //[-------------------------------------------------------]
112  //[ Miscellaneous ]
113  //[-------------------------------------------------------]
114  virtual const qsf::Entity* getFocusEntity() override;
115 
116  //[-------------------------------------------------------]
117  //[ Serialize ]
118  //[-------------------------------------------------------]
119  virtual void serialize(qsf::BinarySerializer& serializer) override;
120 
121 
122  //[-------------------------------------------------------]
123  //[ Protected virtual em5::MainEvent methods ]
124  //[-------------------------------------------------------]
125  protected:
126  virtual void onIntroStart(const qsf::MessageParameters& parameters) override;
127  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
128  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
129 
130  //[-------------------------------------------------------]
131  //[ Regular update ]
132  //[-------------------------------------------------------]
133  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
134 
135  virtual uint32 getEventNumber() override;
136  virtual std::string getCamStartEventTag() override;
137 
138 
139  //[-------------------------------------------------------]
140  //[ Private methods ]
141  //[-------------------------------------------------------]
142  private:
143  void setEventPhase(EventPhase phase);
144 
145  void initializePhase1();
146  void deinitializePhase1();
147  void gatherPhase1EventEntities();
148  void updatePhase1();
149 
150  void initializePhase2();
151  void deinitializePhase2();
152  void gatherPhase2EventEntities();
153  void updatePhase2();
154 
155  void playPhase3IntroSequence();
156  void initializePhase3();
157  void deinitializePhase3();
158  void gatherPhase3EventEntities();
159  void updatePhase3();
160 
161  void updateDebugMenu();
162 
163  void startObjectives();
164  void startHintObservers();
165 
166  void makePersonsBuriedUnderDebris(const std::vector<qsf::WeakPtr<qsf::Entity>>& personEntities, const std::vector<qsf::WeakPtr<qsf::Entity>>& debrisEntities, uint32 rescueObjectiveTypeId);
167  void makeVehicleWreck(qsf::Entity& entity);
168  void makeVehicleWrecksWithPeopleInside(const std::vector<qsf::WeakPtr<qsf::Entity>>& vehicleEntities, const std::vector<qsf::WeakPtr<qsf::Entity>>& personEntities, uint32 rescueObjectiveTypeId, uint32 cutObjectiveTypeId = qsf::getUninitialized<uint32>(), bool canBeTowed = true);
169 
170  void enableBrokenOverheadLineEffect(bool state);
171 
172  void checkTriggerPhase3IntroSequence();
173 
174  void onEboxRepaired(const qsf::MessageParameters& parameters);
175  void onGaperVictimInjured(const qsf::MessageParameters& parameters, int32 terroristIndex);
176  void onGangsterReachedWaypoint(GangsterWithWaypointReachedCallback* gangsterLogic);
177 
178  void onPhase2TriggerGameTimerFinished(const qsf::MessageParameters& parameters);
179  void onPhase2TweetTriggerGameTimerFinished(const qsf::MessageParameters& parameters);
180  void onPhase3IntroSequenceFinished(const qsf::MessageParameters& parameters);
181  void onPhase3DissolveCloudGameTimerFinished(const qsf::MessageParameters& parameters);
182 
183 
184  //[-------------------------------------------------------]
185  //[ Private data ]
186  //[-------------------------------------------------------]
187  private:
188  // Settings, connected to camp
189  std::string mGangsterLogic;
190  qsf::Time mPhase2TriggerWaitTime;
191  qsf::Time mPhase3BombCloudDissolveWaitTime;
192  uint32 mMaxDeadPersons;
193  uint32 mMaxDeadUnits;
194  uint32 mMaxBurningObjects;
195  uint32 mMaxNewlyContaminatedPersons;
196  qsf::Time mNewsFeed3WaitTime;
197 
198 
199  // Internal data
200  EventPhase mEventPhase;
201 
202  // - Units
203  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP1Burn;
204  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP1Injure;
205  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP1Car;
206  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP1CarCut;
207  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP1CarCutVictim;
208  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP2Terrorist;
209  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP2Victim;
210  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP2Car;
211  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3Debris;
212  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3DebrisVictim;
213  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3ElectricShocker;
214  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3ElectricEbox;
215  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3DebrisSmall;
216  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3DebrisSmallVictim;
217  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3Burn;
218  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3Injure;
219  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3Car;
220  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3CarCut;
221  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3CarCutVictim;
222  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3Train;
223  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3TrainVictim;
224  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitP3BuryingTree;
225  qsf::WeakPtr<qsf::Entity> mUnitP3BombCloud;
226 
227  // - Positions
228  std::vector<qsf::WeakPtr<qsf::Entity>> mPositionP2TerroristDestination;
229  std::vector<qsf::WeakPtr<qsf::Entity>> mPositionP2GaperDestination;
230 
231  // - Sounds
232  qsf::WeakPtr<qsf::Entity> mSoundElectricShocker;
233 
234  // - Tweets
235  qsf::WeakPtr<qsf::Entity> mTweet1UnitGaper;
236 
237  // Message proxies
238  qsf::MessageProxy mEboxRepairedMessageProxy;
239  qsf::MessageProxy mGameTimerMessageProxy;
240  qsf::MessageProxy mSequenceFinishedMessageProxy;
241  std::vector<qsf::MessageProxy> mGaperVictimInjuredMessageProxy;
242 
243  // Tweet helpers
244  WarblerTweetHelper mTweet1;
245  WarblerTweetHelper mTweet2;
246  WarblerTweetHelper mTweet3;
247 
248 
249  //[-------------------------------------------------------]
250  //[ CAMP reflection system ]
251  //[-------------------------------------------------------]
252  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
253 
254 
255  };
256 
257 
258 //[-------------------------------------------------------]
259 //[ Namespace ]
260 //[-------------------------------------------------------]
261 } // em5
262 
263 
264 //[-------------------------------------------------------]
265 //[ CAMP reflection system ]
266 //[-------------------------------------------------------]
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent204" unique freeplay event ID
Definition: MainEvent204.h:57
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
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 onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
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
EventPhase
Definition: MainEvent204.h:59
MainEvent204()
Default constructor.
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 ~MainEvent204()
Destructor.
Definition: MainEvent204.h:62
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual void onIntroStart(const qsf::MessageParameters &parameters) override
React to the activation of the black screen, which is the start of the intro cutscene.
Definition: MainEvent204.h:61
Definition: MainEvent204.h:65
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 serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
Helper class for warbler tweets.
Definition: WarblerTweetHelper.h:41
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
signed int int32
Definition: PlatformTypes.h:180
Definition: MainEvent204.h:64
virtual bool onStartup() override
React to startup of the freeplay event.
Game logic for gangster type used in ME204 Emergency 2017 campaign event.
Definition: GangsterWithWaypointReachedCallback.h:30
Definition: MainEvent204.h:63
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
virtual void hintCallbackWithMessage(Observer &hintObserver, const qsf::MessageParameters &parameters) override
virtual void onShutdown() override
React to shutdown of the freeplay event.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual void onRun() override
React to state change from (initial) hidden state to running state.
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 2017 main event 204 "Schmutzige Bombe in Straßenbahn".
Definition: MainEvent204.h:43
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
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.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32