Emergency 20 Dokumentation  4.2.0
MainEvent202.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 //[ Namespace ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25 
26 
27  //[-------------------------------------------------------]
28  //[ Classes ]
29  //[-------------------------------------------------------]
34  class MainEvent202 : public MainEvent
35  {
36 
37 
38  //[-------------------------------------------------------]
39  //[ Friends ]
40  //[-------------------------------------------------------]
41  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
42 
43 
44  //[-------------------------------------------------------]
45  //[ Public definitions ]
46  //[-------------------------------------------------------]
47  public:
48  static const uint32 FREEPLAY_EVENT_ID;
49 
51  {
55  };
56 
57 
58  //[-------------------------------------------------------]
59  //[ Public methods ]
60  //[-------------------------------------------------------]
61  public:
66  MainEvent202();
67 
72  virtual ~MainEvent202();
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 onIntroFinished(const qsf::MessageParameters& parameters) override;
116  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
117 
118  //[-------------------------------------------------------]
119  //[ Regular update ]
120  //[-------------------------------------------------------]
121  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
122 
123  virtual uint32 getEventNumber() override;
124  virtual std::string getCamStartEventTag() override;
125 
126 
127  //[-------------------------------------------------------]
128  //[ Private methods ]
129  //[-------------------------------------------------------]
130  private:
131  EventPhase getEventPhase() const;
132  void setEventPhase(EventPhase phase);
133 
134  void initializePhase1();
135  void deinitializePhase1();
136 
137  void initializePhase2();
138  void deinitializePhase2();
139 
140  void updatePhase1(const qsf::Time& timePassed);
141  void updatePhase2(const qsf::Time& timePassed);
142  void updateDebugMenu();
143 
144  void gatherPhase1EventEntities();
145  void gatherPhase2EventEntities();
146  void startObjectives();
147  void startHintObservers();
148  void createObjectiveFinishedObserver();
149 
150  void onPhase1EndSequenceFinished(const qsf::MessageParameters& parameters);
151  void onPoliceDogFoundObject(const qsf::MessageParameters& parameters);
152  void onRescueDogFoundPerson(const qsf::MessageParameters& parameters);
153  void onBombExploded(const qsf::MessageParameters& parameters);
154 
155  void createDisarmBombObjective(qsf::Entity& bombEntity);
156  void showBomb(uint32 bombIndex, bool show, bool fade = true);
157 
158 
159  //[-------------------------------------------------------]
160  //[ Private data ]
161  //[-------------------------------------------------------]
162  private:
163  // Settings, connected to camp
164  qsf::Time mPhaseOneTime;
165  qsf::Time mBombTimeToDefuse;
166  uint32 mNumberOfBombs;
167  uint32 mMaxDeadCivilians;
168  uint32 mMaxInjuredUnits;
169  uint32 mMaxBurningObjects;
170  qsf::Time mNewsFeed1WaitTime;
171 
172  // Internal data
173  EventPhase mEventPhase;
174  qsf::Time mPhaseOneTimeRemaining;
175  bool mExplosionCutscenePlayed;
176  bool mCanTriggerMusicLevel1;
177  std::set<uint32> mUnitActiveBomb;
178 
179  // Areas
180  qsf::WeakPtr<qsf::Entity> mAreaGaperTargetArea;
181 
182  // Marker
183  qsf::WeakPtr<qsf::Entity> mMarkerGaperTargetArea;
184 
185  // Tweets
186  qsf::WeakPtr<qsf::Entity> mTweet1Camera;
187 
188  // Units
189  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitBomb;
190  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitBombObject;
191  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitBombDecal;
192  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitPoliceDogTarget;
193  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitBurn;
194  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitInjured;
195  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitDebris;
196  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitDebrisVictim;
197  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitEscape;
198  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitTalkToPerson;
199  std::vector<qsf::WeakPtr<qsf::Entity>> mUnitPersonSpawner;
200 
201  // Positions
202  std::vector<qsf::WeakPtr<qsf::Entity>> mPositionEscapeTarget;
203 
204  // Messages
205  qsf::MessageProxy mPoliceDogFoundObjectMessageProxy;
206  qsf::MessageProxy mPoliceTalkedToPersonMessageProxy;
207  qsf::MessageProxy mRescueDogFoundPersonMessageProxy;
208  qsf::MessageProxy mSequenceFinishedMessageProxy;
209  qsf::MessageProxy mBombExplodedMessageProxy;
210 
211  // Tweet helpers
212  WarblerTweetHelper mTweet1;
213 
214 
215  //[-------------------------------------------------------]
216  //[ CAMP reflection system ]
217  //[-------------------------------------------------------]
218  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
219 
220 
221  };
222 
223 
224 //[-------------------------------------------------------]
225 //[ Namespace ]
226 //[-------------------------------------------------------]
227 } // em5
228 
229 
230 //[-------------------------------------------------------]
231 //[ CAMP reflection system ]
232 //[-------------------------------------------------------]
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 ...
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
EventPhase
Definition: MainEvent202.h:50
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
Definition: MainEvent202.h:53
unsigned int uint32
Definition: PlatformTypes.h:181
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
Definition: MainEvent202.h:54
virtual bool onStartup() override
React to startup of the freeplay event.
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
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 bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
virtual std::string getCamStartEventTag() override
Return event tag of a start camera for the event; only necessary for main events without prologue cut...
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent202" unique freeplay event ID
Definition: MainEvent202.h:48
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
virtual void onShutdown() override
React to shutdown of the freeplay event.
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 onUpdateMainEvent(const qsf::Time &timePassed) override
Gets called when the main event gets an update call We use here a separate update method...
Definition: MainEvent202.h:52
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
MainEvent202()
Default constructor.
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
virtual void hintCallbackWithMessage(Observer &hintObserver, const qsf::MessageParameters &parameters) override
virtual void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
EMERGENCY 2017 main event 202 "Bombenanschlag auf dem Oktoberfest".
Definition: MainEvent202.h:34
virtual void onRun() override
React to state change from (initial) hidden state to running state.
virtual ~MainEvent202()
Destructor.
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
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 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
Binary serializer class.
Definition: BinarySerializer.h:35
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32