Emergency 20 Dokumentation  4.2.0
MainEvent08.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 
16 //[-------------------------------------------------------]
17 //[ Namespace ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21 
22 
23  //[-------------------------------------------------------]
24  //[ Classes ]
25  //[-------------------------------------------------------]
30  class MainEvent08 : public MainEvent
31  {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Friends ]
36  //[-------------------------------------------------------]
37  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
38 
39 
40  //[-------------------------------------------------------]
41  //[ Public definitions ]
42  //[-------------------------------------------------------]
43  public:
44  static const uint32 FREEPLAY_EVENT_ID;
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public methods ]
49  //[-------------------------------------------------------]
50  public:
55  MainEvent08();
56 
61  virtual ~MainEvent08();
62 
63 
64  //[-------------------------------------------------------]
65  //[ Public virtual em5::FreeplayEvent methods ]
66  //[-------------------------------------------------------]
67  public:
68  //[-------------------------------------------------------]
69  //[ Life cycle ]
70  //[-------------------------------------------------------]
71  virtual bool onStartup() override;
72  virtual void onShutdown() override;
73  virtual void onRun() override;
74  virtual bool onSuccess(EventResult& eventResult) override;
75  virtual bool onFailure(EventResult& eventResult) override;
76 
77  //[-------------------------------------------------------]
78  //[ Points evaluation ]
79  //[-------------------------------------------------------]
80  virtual uint32 calculatePointGain(EventResult& eventResult) override;
81 
82  //[-------------------------------------------------------]
83  //[ Callbacks from observers ]
84  //[-------------------------------------------------------]
85  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
86  virtual void hintCallback(Observer& hintObserver) override;
87 
88  //[-------------------------------------------------------]
89  //[ Miscellaneous ]
90  //[-------------------------------------------------------]
91  virtual const qsf::Entity* getFocusEntity() override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Protected virtual em5::MainEvent methods ]
96  //[-------------------------------------------------------]
97  protected:
98  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
99  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
100  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
101  virtual void onUpdateMusic(const qsf::Time& timePassed) override;
102  virtual uint32 getEventNumber() override;
103 
104 
105  //[-------------------------------------------------------]
106  //[ Private methods ]
107  //[-------------------------------------------------------]
108  private:
109  void gatherEventEntities();
110  void hurtPeopleIntro();
111 
112  void onPersonPlacedInAmbulance(); // Used for Hint06
113  void onFirstTimeDive(); // Used for Hint11
114 
115  void onPickupPersonWithHelicopter(const qsf::MessageParameters& parameters); // Used for Hint13
116  void onPersonDeath(const qsf::MessageParameters& parameters); // Used for Hint18 & Hint19
117  void onSunkenCarFound(const qsf::MessageParameters& parameters);
118  void onSunkenCarRetrieved(const qsf::MessageParameters& parameters);
119 
120  void startObjectives();
121  void defineObjectives();
122  void startHintObservers();
123 
124  void startFinalCutscene(const std::string* cutscene);
125  void endFinalCutscene();
126  bool checkAchievementConditions();
127 
128  void deactivateFireComponentsUnderWater();
129  void activateFireComponentsUnderWater();
130 
131 
132  //[-------------------------------------------------------]
133  //[ Private data ]
134  //[-------------------------------------------------------]
135  private:
136  // Connected to CAMP
137 
138  // Hint related
139 
140  float mHint02LifeEnergy;
141  bool mHint02Triggered;
142 
143  qsf::MessageProxy mDiveCommandListenerProxy;
144  float mHint03LifeEnergy;
145  float mHint03LifeEnergyNoDiver;
146  bool mHint03DiverSent;
147  bool mHint03Triggered;
148 
149  float mHint04LifeEnergy;
150  bool mHint04Triggered;
151 
152  qsf::Time mHint06WaitTime;
153  int mHint06NeededAmount;
154  int mHint06CurrentAmount;
155  qsf::MessageProxy mPersonPlacedInAmbulanceProxy; // Used for Hint06
156  bool mHint06Triggered;
157 
158  qsf::Time mHint07WaitTime;
159  bool mHint07Triggered;
160 
161  qsf::Time mHint08WaitTime;
162  bool mHint08Triggered;
163  qsf::MessageProxy mPersonPlacedInBoatProxy; // Used for Hint08
164 
165  qsf::Time mHint09WaitTime;
166  bool mHint09Triggered;
167 
168  qsf::Time mHint10WaitTime;
169  bool mHint10Triggered;
170 
171  qsf::Time mHint12WaitTime;
172  bool mHint12Triggered;
173 
174  qsf::MessageProxy mPersonFromRoofRescuedProxy;
175  qsf::Time mHint13WaitTime;
176  bool mHint13TriggeredorObsolete;
177 
178  bool mHint16Triggered;
179 
180  bool mHint17Triggered;
181 
182  qsf::MessageProxy mPeopleDyingProxy;
183  bool mHint18Triggered;
184  bool mHint19Triggered;
185 
186  // References
187  std::vector<qsf::Entity*> mEnclosed; // People trapped in sunken cars
188  std::vector<qsf::Entity*> mPeopleOnRoof; // People trapped on the roofs
189  std::vector<qsf::Entity*> mBorderBuildings; // People trapped on the roofs
190  std::vector<qsf::Entity*> mOilrigParts; // People trapped on the roofs
191  std::vector<qsf::Entity*> mEmptyDivingSpots; // Places where diver can go and search
192  std::vector<qsf::Entity*> mOccupiedDivingSpots; // Places where diver can go and search
193  qsf::Entity* mCutter; // Cutter. Needed as focus entity.
194  //std::vector<qsf::Entity*> mSunkenCars; // Cars hidden in divingspots
195  qsf::Entity* mFocusEntity;
196  std::vector<qsf::Entity*> mBurnStart; // Things that burn from the beginning
197 
198  std::vector<qsf::Entity*> mRoof1People; // People on roofs
199  std::vector<qsf::Entity*> mRoof2People; // People on roofs
200  std::vector<qsf::Entity*> mRoof3People; // People on roofs
201  std::vector<qsf::Entity*> mRoof2PeopleInjured; // People on roofs
202  std::vector<qsf::Entity*> mRoof3PeopleInjured; // People on roofs
203 
204  std::vector<uint64> mFireEntitiesUnderWater; // At the beginning, pick entities under water and in no burn layer and deactivate the fire component
205 
206  // Misc
207  int mMaximumDeaths;
208  int mSunkenCarsAmount;
209  qsf::MessageProxy mRetrieveSunkenCarsProxy;
210  qsf::MessageProxy mSunkenCarsProxy;
211  qsf::MessageProxy mSunkenCarRetrieveProxy;
212 
213 
214  //[-------------------------------------------------------]
215  //[ CAMP reflection system ]
216  //[-------------------------------------------------------]
217  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
218 
219 
220  };
221 
222 
223 //[-------------------------------------------------------]
224 //[ Namespace ]
225 //[-------------------------------------------------------]
226 } // em5
227 
228 
229 //[-------------------------------------------------------]
230 //[ CAMP reflection system ]
231 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
virtual ~MainEvent08()
Destructor.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
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 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 hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent08" unique freeplay event ID
Definition: MainEvent08.h:44
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
EMERGENCY 5 main event 08 "Flood".
Definition: MainEvent08.h:30
virtual void onShutdown() override
React to shutdown of the freeplay event.
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
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...
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
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 void onUpdateMainEvent(const qsf::Time &timePassed) override
Gets called when the main event gets an update call We use here a separate update method...
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
MainEvent08()
Default constructor.
virtual bool onStartup() override
React to startup of the freeplay event.
virtual void onRun() override
React to state change from (initial) hidden state to running state.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32