Emergency 20 Dokumentation  4.2.0
MainEvent303.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  //[-------------------------------------------------------]
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  MainEvent303();
56 
61  virtual ~MainEvent303();
62 
63 
64  //[-------------------------------------------------------]
65  //[ Public virtual em5::FreeplayEvent methods ]
66  //[-------------------------------------------------------]
67  public:
68  //[-------------------------------------------------------]
69  //[ Lifecycle ]
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  //[ Timers ]
90  //[-------------------------------------------------------]
91  virtual void onTimerTriggered(uint32 timerId) override;
92 
93  //[-------------------------------------------------------]
94  //[ Miscellaneous ]
95  //[-------------------------------------------------------]
96  virtual const qsf::Entity* getFocusEntity() override;
97 
98  //[-------------------------------------------------------]
99  //[ Serialize ]
100  //[-------------------------------------------------------]
101  virtual void serialize(qsf::BinarySerializer& serializer) override;
102 
103 
104  //[-------------------------------------------------------]
105  //[ Protected virtual em5::MainEvent methods ]
106  //[-------------------------------------------------------]
107  protected:
108  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
109  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
110  virtual uint32 getEventNumber() override;
111 
112 
113  //[-------------------------------------------------------]
114  //[ Private definitions ]
115  //[-------------------------------------------------------]
116  private:
117  enum class Cutscene
118  {
119  NONE,
120  CAR_DROP,
121  FIRE_02, // There is no FIRE_01 any more, BOOM is the replacement
122  BOOM
123  };
124 
125 
126  //[-------------------------------------------------------]
127  //[ Private methods ]
128  //[-------------------------------------------------------]
129  private:
130  void setupScene();
131  void startObjectives();
132 
133  void startCameraFlight(Cutscene cutscene);
134  void startSequence(Cutscene cutscene);
135 
136  void onCameraFlightStopped(const qsf::MessageParameters& parameters);
137  void onCutsceneEventDivingSpot(const qsf::MessageParameters& parameters);
138  void onCutsceneEventBurn(const qsf::MessageParameters& parameters);
139  void onCutsceneEventDestroy(const qsf::MessageParameters& parameters);
140  void onCutsceneEnd(const qsf::MessageParameters& parameters);
141 
142  void onCutVehicle(const qsf::MessageParameters& parameters);
143  void onEntityLiftedByCrane(const qsf::MessageParameters& parameters);
144  void onEntityPlacedByCrane(const qsf::MessageParameters& parameters);
145  void onBuriedFound(const qsf::MessageParameters& parameters);
146  void onDivingSpotEntitySpawned(const qsf::MessageParameters& parameters);
147 
148  void setDivingSpotActive(qsf::Entity& entity, bool active);
149 
150 
151  //[-------------------------------------------------------]
152  //[ Private data ]
153  //[-------------------------------------------------------]
154  private:
155  // Connected to CAMP
156  qsf::Time mTimeUntilCarDrop;
157  qsf::Time mTimeUntilFire02;
158  qsf::Time mTimeUntilBoom;
159  qsf::Time mTimeForHint05;
160 
161  // Internal
162  qsf::WeakPtr<qsf::Entity> mStartCameraCarDrop;
163  qsf::WeakPtr<qsf::Entity> mStartCameraFire02;
164  qsf::WeakPtr<qsf::Entity> mStartCameraBoom;
165  qsf::WeakPtr<qsf::Entity> mCraneBlock;
166  qsf::WeakPtr<qsf::Entity> mDivingSpot;
167  qsf::WeakPtr<qsf::Entity> mSpawnedSunkenCar;
168  qsf::WeakPtr<qsf::Entity> mAreaEvacuate;
169  std::vector<qsf::WeakPtr<qsf::Entity>> mPersonsToFindByDog;
170 
171  qsf::MessageProxy mCameraFlightStoppedMessageProxy;
172  qsf::MessageProxy mCutsceneEventDivingSpotMessageProxy;
173  qsf::MessageProxy mCutsceneEventBurnMessageProxy;
174  qsf::MessageProxy mCutsceneEventDestroyMessageProxy;
175  qsf::MessageProxy mCutsceneEndMessageProxy;
176  qsf::MessageProxy mCutRoadVehicleProxy;
177  qsf::MessageProxy mLiftWithCraneProxy;
178  qsf::MessageProxy mPlaceByCraneProxy;
179  qsf::MessageProxy mBuriedFoundMessageProxy;
180  qsf::MessageProxy mDivingSpotEntitySpawnProxy;
181 
182  Cutscene mPlayingCutscene;
183  std::deque<Cutscene> mCutsceneQueue;
184  uint32 mCutscenesPlayed;
185 
186  struct Evacuate
187  {
189  bool mIsInsideArea = false;
190  };
191  std::vector<Evacuate> mPersonsToEvacuate;
192 
193 
194  //[-------------------------------------------------------]
195  //[ CAMP reflection system ]
196  //[-------------------------------------------------------]
197  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
198 
199 
200  };
201 
202 
203 //[-------------------------------------------------------]
204 //[ Namespace ]
205 //[-------------------------------------------------------]
206 } // em5
207 
208 
209 //[-------------------------------------------------------]
210 //[ CAMP reflection system ]
211 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
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.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
Message listener proxy class.
Definition: MessageProxy.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 ...
Reason
Definition: EventSpreadReason.h:20
virtual void onShutdown() override
React to shutdown of the freeplay event.
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 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
EMERGENCY 20 years edition mission base class.
Definition: Em20MainEventBase.h:30
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
virtual void onTimerTriggered(uint32 timerId) override
virtual bool onStartup() override
React to startup of the freeplay event.
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
MainEvent303()
Default constructor.
virtual void onRun() override
React to state change from (initial) hidden state to running state.
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent303" unique freeplay event ID
Definition: MainEvent303.h:44
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
virtual ~MainEvent303()
Destructor.
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 20 years edition mission 03 "Hurricane".
Definition: MainEvent303.h:30
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.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32