Emergency 20 Dokumentation  4.2.0
MainEvent06.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 
17 //[-------------------------------------------------------]
18 //[ Namespace ]
19 //[-------------------------------------------------------]
20 namespace em5
21 {
22 
23 
24  //[-------------------------------------------------------]
25  //[ Classes ]
26  //[-------------------------------------------------------]
31  class MainEvent06 : public MainEvent
32  {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Friends ]
37  //[-------------------------------------------------------]
38  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
39 
40 
41  //[-------------------------------------------------------]
42  //[ Public definitions ]
43  //[-------------------------------------------------------]
44  public:
45  static const uint32 FREEPLAY_EVENT_ID;
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public methods ]
50  //[-------------------------------------------------------]
51  public:
56  MainEvent06();
57 
62  virtual ~MainEvent06();
63 
64 
65  //[-------------------------------------------------------]
66  //[ Public virtual em5::FreeplayEvent methods ]
67  //[-------------------------------------------------------]
68  public:
69  //[-------------------------------------------------------]
70  //[ Life cycle ]
71  //[-------------------------------------------------------]
72  virtual bool onStartup() override;
73  virtual void onShutdown() override;
74  virtual void onRun() override;
75  virtual bool onSuccess(EventResult& eventResult) override;
76  virtual bool onFailure(EventResult& eventResult) override;
77 
78  //[-------------------------------------------------------]
79  //[ Points evaluation ]
80  //[-------------------------------------------------------]
81  virtual uint32 calculatePointGain(EventResult& eventResult) override;
82 
83  //[-------------------------------------------------------]
84  //[ Callbacks from observers ]
85  //[-------------------------------------------------------]
86  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
87  virtual void hintCallback(Observer& hintObserver) override;
88 
89  //[-------------------------------------------------------]
90  //[ Miscellaneous ]
91  //[-------------------------------------------------------]
92  virtual const qsf::Entity* getFocusEntity() override;
93 
94  //[-------------------------------------------------------]
95  //[ Serialize ]
96  //[-------------------------------------------------------]
97  virtual void serialize(qsf::BinarySerializer& serializer) override;
98 
99 
100  //[-------------------------------------------------------]
101  //[ Protected virtual em5::MainEvent methods ]
102  //[-------------------------------------------------------]
103  protected:
104  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
105  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
106 
107  //[-------------------------------------------------------]
108  //[ Regular update ]
109  //[-------------------------------------------------------]
110  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
111  virtual void onUpdateMusic(const qsf::Time& timePassed) override;
112 
113  virtual uint32 getEventNumber() override;
114 
115 
116  //[-------------------------------------------------------]
117  //[ Private methods ]
118  //[-------------------------------------------------------]
119  private:
120  void gatherEventEntities();
121 
122  void startObjectives();
123  void startHintObservers();
124 
125  void createSaveCraneOperatorObjective();
126  void onCraneOpSaved();
127  void onCraneOpPlacedFromDlk();
128 
129  void onTechHeliCalled();
130 
131  void startFinalCutscene(const std::string& cutscene);
132  void endFinalCutscene();
133  void checkAchievementState();
134 
135 
136  //[-------------------------------------------------------]
137  //[ Private data ]
138  //[-------------------------------------------------------]
139  private:
140  // Connected to CAMP
141 
142  float mHint01LifeEnergy; // 10%
143  float mHint02LifeEnergy; // 20%
144  float mHint03LifeEnergy; // 15%
145 
146  qsf::Time mHint04WaitTime; // 75 sec.
147  int mHint04Triggered;
148 
149  qsf::Time mHint06WaitTime; // 30 sec.
150 
151  int mHint07FireAmount; // 10
152  float mHint09ShipLifeEnergy; // 20%
153 
154  qsf::Time mHint11WaitTime; // 30 sec.
155  qsf::Time mHint11WaitTime2; // 60 sec.
156  qsf::Time mHint12WaitTime; // 90 sec.
157  qsf::Time mHint12WaitTime2; // 60 sec.
158  qsf::Time mHint13WaitTime; // 45 sec.
159  qsf::Time mHint13WaitTime2; // 60 sec.
160  qsf::Time mHint14WaitTime; // 30 sec.
161  qsf::Time mHint14WaitTime2; // 60 sec.
162 
163  qsf::Time mHint15WaitTime; // 20 sec.
164  qsf::Time mHint16WaitTime; // 3 min.
165  qsf::Time mCraneOperatorDropsWaitTime; // 6 min.
166  bool mCraneOperatorDropTimerRunning;
167 
168  // TODO(sw) Remove me, not needed anymore
169  float mHint16CraneOpLifeEnergy; // 35%
170 
171  int mFailConMaxObjDestByFire; // 15
172 
173  qsf::Time mSparkIgnitionTime01;
174  qsf::Time mSparkIgnitionTime02;
175  qsf::Time mSparkIgnitionTime03;
176  ME06SparkIgniter mIgniter01;
177  ME06SparkIgniter mIgniter02;
178  ME06SparkIgniter mIgniter03;
179 
180  bool mHint02Triggered;
181 
182  // Internal
183  std::vector<qsf::Entity*> mDrowning; // People who are drowning at the beginning
184  std::vector<qsf::Entity*> mFires; // The entities of the fire places
185  std::vector<qsf::Entity*> mBurner; // People burning ship at a certain point
186  qsf::WeakPtr<qsf::Entity> mCraneOperator; // Part of the ship that makes people on it go over board when it starts burning
187  std::vector<qsf::Entity*> mShip1Parts; // Parts from ship 1. If one of these is destroyed, the mission is over.
188  qsf::Entity* mShip2Tower; // Tower of ship 2. If this catches fire, mission is over.
189 
190  qsf::JobProxy mUpdateJobProxy;
191  qsf::Time mTimePassed;
192  qsf::Time mTimeToFall;
193 
194  qsf::MessageProxy mTechHeliCallProxy;
195  qsf::MessageProxy mCraneOpSavedMessageProxy;
196 
197  // Ending
198  bool mPlayingWinFadeOut;
199 
200 
201  //[-------------------------------------------------------]
202  //[ CAMP reflection system ]
203  //[-------------------------------------------------------]
204  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
205 
206 
207  };
208 
209 
210 //[-------------------------------------------------------]
211 //[ Namespace ]
212 //[-------------------------------------------------------]
213 } // em5
214 
215 
216 //[-------------------------------------------------------]
217 //[ CAMP reflection system ]
218 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
Job proxy class.
Definition: JobProxy.h:51
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
MainEvent06()
Default constructor.
EMERGENCY 5 main event 06 "Loading accident".
Definition: MainEvent06.h:31
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
Message listener proxy class.
Definition: MessageProxy.h:47
virtual void onRun() override
React to state change from (initial) hidden state to running state.
Reason
Definition: EventSpreadReason.h:20
ME06 has three objects that cause sparks when burning.
Definition: ME06SparkIgniter.h:49
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
virtual ~MainEvent06()
Destructor.
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 onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
#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...
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent06" unique freeplay event ID
Definition: MainEvent06.h:45
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 uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
virtual bool onStartup() override
React to startup of the freeplay event.
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
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 ...
Static CAMP main event plugin metaclass collection class.
Definition: MainEventMetaclasses.h:30
Binary serializer class.
Definition: BinarySerializer.h:35
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
virtual void onShutdown() override
React to shutdown of the freeplay event.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32