Emergency 20 Dokumentation  4.2.0
MainEvent200.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 #include <qsf/job/JobProxy.h>
16 #include <qsf/base/WeakPtr.h>
17 #include <qsf/math/Transform.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class ParameterGroup;
26 }
27 namespace em5
28 {
29  class MedievalPreludeScreen;
30  class BlockAreaWithUnits;
31  class OrderInfo;
32  class Player;
33 }
34 
35 
36 //[-------------------------------------------------------]
37 //[ Namespace ]
38 //[-------------------------------------------------------]
39 namespace em5
40 {
41 
42 
43  //[-------------------------------------------------------]
44  //[ Classes ]
45  //[-------------------------------------------------------]
53  class MainEvent200 : public MainEvent
54  {
55 
56 
57  //[-------------------------------------------------------]
58  //[ Friends ]
59  //[-------------------------------------------------------]
60  friend class MainEventMetaclasses; // CAMP export of editable values for Game Design
61 
62 
63  //[-------------------------------------------------------]
64  //[ Public definitions ]
65  //[-------------------------------------------------------]
66  public:
67  static const uint32 FREEPLAY_EVENT_ID;
68 
70  {
71  ArsonistTargetAssigment(std::string arsonistEventTag, std::string unparsedString);
72 
73  std::string mArsonistEventTag;
75  std::vector<std::string> mTargets;
76  bool mActive;
77  };
78 
79  struct UnitPosition
80  {
83  qsf::Time mStartDelay; // Seconds before the unit starts move to start position
84  bool mIsStarted;
85  bool mCanStart;
86  };
87 
88  struct StoneThrower
89  {
92  bool mActive;
93  };
94 
95 
96  //[-------------------------------------------------------]
97  //[ Public methods ]
98  //[-------------------------------------------------------]
99  public:
104  MainEvent200();
105 
110  virtual ~MainEvent200();
111 
112 
113  //[-------------------------------------------------------]
114  //[ Public virtual em5::FreeplayEvent methods ]
115  //[-------------------------------------------------------]
116  public:
117  //[-------------------------------------------------------]
118  //[ Life cycle ]
119  //[-------------------------------------------------------]
120  virtual bool onStartup() override;
121  virtual void onShutdown() override;
122  virtual void onRun() override;
123  virtual bool onSuccess(EventResult& eventResult) override;
124  virtual bool onFailure(EventResult& eventResult) override;
125 
126  //[-------------------------------------------------------]
127  //[ Points evaluation ]
128  //[-------------------------------------------------------]
129  virtual uint32 calculatePointGain(EventResult& eventResult) override;
130 
131  //[-------------------------------------------------------]
132  //[ Callbacks from observers ]
133  //[-------------------------------------------------------]
134  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
135  virtual void hintCallback(Observer& hintObserver) override;
136 
137  //[-------------------------------------------------------]
138  //[ Miscellaneous ]
139  //[-------------------------------------------------------]
140  virtual const qsf::Entity* getFocusEntity() override;
141 
142  //[-------------------------------------------------------]
143  //[ Serialize ]
144  //[-------------------------------------------------------]
145  virtual void serialize(qsf::BinarySerializer& serializer) override;
146 
147 
148  //[-------------------------------------------------------]
149  //[ Protected virtual em5::MainEvent methods ]
150  //[-------------------------------------------------------]
151  protected:
152  virtual void onStartIntroRequest() override;
153  virtual void onIntroStart(const qsf::MessageParameters& parameters) override;
154  virtual void onIntroFinished(const qsf::MessageParameters& parameters) override;
155  virtual void onUpdateMainEvent(const qsf::Time& timePassed) override;
156  virtual void onPrologueFinished(const qsf::MessageParameters& parameters) override;
157  virtual void onUpdateMusic(const qsf::Time& timePassed) override;
158  virtual uint32 getEventNumber() override;
159  virtual std::string getCamStartEventTag() override;
160  virtual void showBriefingSupervisorMessage() override;
161 
162 
163  //[-------------------------------------------------------]
164  //[ Private methods ]
165  //[-------------------------------------------------------]
166  private:
167  void setMedievalGraphics(bool medievalMode);
168 
169  void blockInput(bool block);
170  void onMedievalPreludeScreenPlaybackFinished();
171 
172  void gatherEventEntities();
173 
174  void registerGuardsmanForPlayer();
175 
176  void setupGuardsman(qsf::Entity& entity, OrderInfo& guardsmanOrderInfo, Player& localPlayer);
177  void setupGangster(qsf::Entity& gangsterEntity, std::vector<std::string>& targets);
178 
179  void startFadeOutForFanaticStart();
180  bool updateGuardsmanSpawningFromBarracks(UnitPosition& unitPosition, qsf::Time timeElapsed);
181  void updateStoneThrower(const qsf::Time& timePassed);
182  void startSingleFanatic();
183  void startFanatics();
184  void startFleeing();
185  void startGuardsmanSupport();
186  void winall(); // Debug
187 
188  void onUpdateInfoScreen(const qsf::JobArguments& jobArguments);
189  void fadeoutComplete(const qsf::MessageParameters& parameters);
190  void onFadeoutAfterGuardsmanPlacement(const qsf::MessageParameters& parameters);
191  void onFadeInAfterGuardsmanPlacement(const qsf::MessageParameters& parameters);
192 
193  void onWitchRescued(const qsf::MessageParameters& parameters);
194  void onArrestGangster(const qsf::MessageParameters& parameters);
195  void onBringGangsterHome(const qsf::MessageParameters& parameters);
196 
197  void makeAllPersonsImmune();
198 
199  // Gangster/Arsonist assignment
200  void buildArsonistTargetAssigmentFromData();
201  void updateArsonistStarting();
202 
203  // Audio
210  void setAmbientAudio(int state);
211 
212  void activateStakeAndWellObjects(bool active);
213 
223  void onSettingsGroupPropertyChanged(const qsf::ParameterGroup& parameterGroup, uint32 propertyId);
224 
225 
226  //[-------------------------------------------------------]
227  //[ Private data ]
228  //[-------------------------------------------------------]
229  private:
230  // Setup data
231 
232  // Internal data
233  MedievalPreludeScreen* mMedievalPreludeScreen;
234  qsf::Time mTimeWaitAfterGuardsmanSpawn;
235  qsf::Time mTimeWaitFanaticActive;
236  qsf::Time mTimeWaitBlackout;
237  qsf::Time mIgniteTimeStake;
238  qsf::Time mIgniteTimeObject;
239  int mNumberArrestGangster;
240  bool mPersonsCanFlee;
241  bool mHintBurningCanTrigger;
242  bool mGuardsmanSupportCanArrive;
243  qsf::Time mTimeGuardsmanSupportArrived;
244 
245  std::vector<qsf::WeakPtr<qsf::Entity>> mPyreEntities;
246  std::vector<qsf::WeakPtr<qsf::Entity>> mFanatics;
247  std::vector<qsf::WeakPtr<qsf::Entity>> mArsonistEntities;
248  std::vector<qsf::WeakPtr<qsf::Entity>> mFleeEntities;
249  std::vector<qsf::WeakPtr<qsf::Entity>> mDespawnPointEntities;
250  std::vector<StoneThrower> mStoneThrowers;
251  qsf::WeakPtr<qsf::Entity> mRallyPoint;
252  qsf::WeakPtr<qsf::Entity> mBarracksPoint;
253  qsf::WeakPtr<qsf::Entity> mCrowdAudio;
254  qsf::WeakPtr<qsf::Entity> mCrowdAngryAudio;
255  qsf::WeakPtr<qsf::Entity> mSingleFanatic;
256 
257  BlockAreaWithUnits& mBlockAreaWithUnits;
258 
259  enum State
260  {
261  State_Intro,
262  State_SelectGuardsman,
263  State_OpenInfoScreen,
264  State_CloseInfoScreen,
265  State_WaitTillGuardsmanSpawn,
266  State_BringGuardsmanInPosition,
267  State_FadeInForFanaticStart,
268  State_FadeOutForFanaticStart,
269  State_ArrestSingleFanatic,
270  State_ArrestFanatics,
271  State_Wait_for_fadeout
272  };
273  State mCurrentState;
274 
275  std::vector<UnitPosition> mUnitPositions;
276 
277  qsf::JobProxy mRegisterOpenHelpWindowJobProxy; // Only active in specific gamestate
278  qsf::MessageProxy mRescueWitchFromPyreMessageProxy;
279  qsf::MessageProxy mArrestGangsterMessageProxy;
280  qsf::MessageProxy mBringGangsterHomeMessageProxy;
281  qsf::MessageProxy mFadingMessageProxy;
282 
283  std::vector<ArsonistTargetAssigment> mArsonistTargetAssigment;
284 
285  // Arsonist targets Fanatic
286  std::string mArsonistTargetsFanatic1;
287  std::string mArsonistTargetsFanatic2;
288  std::string mArsonistTargetsFanatic3;
289  std::string mArsonistTargetsFanatic4;
290 
291  // Arsonist targets Arsonist
292  std::string mArsonistTargetsArsonist1;
293  std::string mArsonistTargetsArsonist2;
294  std::string mArsonistTargetsArsonist3;
295  std::string mArsonistTargetsArsonist4;
296  std::string mArsonistTargetsArsonist5;
297  std::string mArsonistTargetsArsonist6;
298  std::string mArsonistTargetsArsonist7;
299  std::string mArsonistTargetsArsonist8;
300  std::string mArsonistTargetsArsonist9;
301  std::string mArsonistTargetsArsonist10;
302  std::string mArsonistTargetsArsonist11;
303  std::string mArsonistTargetsArsonist12;
304  std::string mArsonistTargetsArsonist13;
305 
306 
307  //[-------------------------------------------------------]
308  //[ CAMP reflection system ]
309  //[-------------------------------------------------------]
310  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
311 
312 
313  };
314 
315 
316 //[-------------------------------------------------------]
317 //[ Namespace ]
318 //[-------------------------------------------------------]
319 } // em5
320 
321 
322 //[-------------------------------------------------------]
323 //[ CAMP reflection system ]
324 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
virtual bool onStartup() override
React to startup of the freeplay event.
EMERGENCY 5 observer base class.
Definition: Observer.h:41
MainEvent200()
Default constructor.
Definition: FreeplayEvent.h:110
Job proxy class.
Definition: JobProxy.h:51
bool mIsStarted
Definition: MainEvent200.h:84
virtual void showBriefingSupervisorMessage() override
Shows the briefing supervisor message for the event.
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
Utility class for events when user has to block areas with his units.
Definition: BlockAreaWithUnits.h:48
Abstract parameter group class.
Definition: ParameterGroup.h:31
bool mActive
Definition: MainEvent200.h:92
EMERGENCY 5 main event base class.
Definition: MainEvent.h:48
virtual void onIntroStart(const qsf::MessageParameters &parameters) override
React to the activation of the black screen, which is the start of the intro cutscene.
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.
Order information.
Definition: OrderInfo.h:54
unsigned int uint32
Definition: PlatformTypes.h:181
qsf::WeakPtr< qsf::Entity > mUnit
Definition: MainEvent200.h:81
qsf::Time mWaitTime
Definition: MainEvent200.h:91
ArsonistTargetAssigment(std::string arsonistEventTag, std::string unparsedString)
Medieval prelude screen.
Definition: MedievalPreludeScreen.h:50
qsf::Time mStartDelay
Definition: MainEvent200.h:83
virtual void onStartIntroRequest() override
React to the intro start request; do only overwrite the default implementation if you really have to...
EMERGENCY 2017 main event 200 "Medieval Hamburg".
Definition: MainEvent200.h:53
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
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 void onShutdown() override
React to shutdown of the freeplay event.
EMERGENCY 5 player class.
Definition: Player.h:57
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Definition: MainEvent200.h:69
int mArrestedPersonTriggerValue
Definition: MainEvent200.h:74
3D transform class
Definition: Transform.h:45
Definition: PickupPersonByParamedicAction.h:21
virtual bool onSuccess(EventResult &eventResult) override
React to state change from running state to success state.
virtual void hintCallback(Observer &hintObserver) override
Handle the activation of a hint observer.
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
bool mActive
Definition: MainEvent200.h:76
virtual void onIntroFinished(const qsf::MessageParameters &parameters) override
React to the end of the intro; note that the prologue cutscene is played next.
std::vector< std::string > mTargets
Definition: MainEvent200.h:75
virtual std::string getCamStartEventTag() override
Return event tag of a start camera for the event; only necessary for main events without prologue cut...
bool mCanStart
Definition: MainEvent200.h:85
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
virtual bool onFailure(EventResult &eventResult) override
React to state change from running state to failed state.
virtual uint32 getEventNumber() override
Gets number of the main event (Is needed for the highscore management)
static const uint32 FREEPLAY_EVENT_ID
"em5::MainEvent200" unique freeplay event ID
Definition: MainEvent200.h:67
virtual ~MainEvent200()
Destructor.
qsf::WeakPtr< qsf::Entity > mEntity
Definition: MainEvent200.h:90
Definition: MainEvent200.h:88
virtual void onRun() override
React to state change from (initial) hidden state to running state.
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
virtual void onPrologueFinished(const qsf::MessageParameters &parameters) override
React to the end of the prologue.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialization using a binary serializer.
Binary serializer class.
Definition: BinarySerializer.h:35
virtual uint32 calculatePointGain(EventResult &eventResult) override
Calculate the point gain for this event.
qsf::Transform mStartTransform
Definition: MainEvent200.h:82
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: MainEvent200.h:79
std::string mArsonistEventTag
Definition: MainEvent200.h:73
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32