Emergency 20 Dokumentation  4.2.0
FreeplayGameMode.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 #include "em5/map/MapIdentifier.h"
16 
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class Map;
26 }
27 namespace em5
28 {
29  class MapIdentifier;
30  class Player;
31 }
32 
33 
34 //[-------------------------------------------------------]
35 //[ Namespace ]
36 //[-------------------------------------------------------]
37 namespace em5
38 {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Classes ]
43  //[-------------------------------------------------------]
49  {
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public methods ]
54  //[-------------------------------------------------------]
55  public:
61 
66  virtual ~FreeplayGameMode();
67 
72  void toggleWorldEventPhase();
73 
78  void toggleSeasonalEvent(const std::string& seasonalEventIdentifier, bool show);
79 
80 
81  //[-------------------------------------------------------]
82  //[ Public virtual em5::GameMode methods ]
83  //[-------------------------------------------------------]
84  public:
85  virtual std::string getGameModeAsString() const override;
86  virtual void startup() override;
87  virtual void shutdown() override;
88  virtual void onGameLoaded() override;
89  virtual void updateGameMode(qsf::Time timePassed) override;
90  virtual void onSendGameModeSignal(const std::string& gameModeSignal) override;
91 
92 
93  //[-------------------------------------------------------]
94  //[ Protected virtual em5::FreeplayGameMode methods ]
95  //[-------------------------------------------------------]
96  protected:
97  virtual void onEventSucceeded(const qsf::MessageParameters& parameters);
98  virtual void onEventFailed(const qsf::MessageParameters& parameters);
99  virtual void onReceiveObjectivePoints(const qsf::MessageParameters& parameters);
100  // Gets called, when through a successful event some points should be added to players point "pool"
101  virtual void onSetPointGain(const FreeplayEvent::EventResult& eventResult, int32 pointGain);
102  virtual void onEventCompleted(const qsf::MessageParameters& parameters);
103  virtual void onFirstEventCompleted();
104  virtual std::string getIntroVideo(uint32 index);
105 
106 
107  //[-------------------------------------------------------]
108  //[ Protected methods ]
109  //[-------------------------------------------------------]
110  protected:
111  bool setupEventPool(const std::string& postfix = "", bool allowFallback = true);
112  bool setupFixedEventPool();
113  void setupUnitPool(const Player* player = nullptr);
114  void setupMessageHandler();
115 
116  void updateEventGenerator(const qsf::Time& timePassed);
117  void setupWorldEvents(const qsf::Map& map, bool showHint);
118  void cleanupWorldEvents(const qsf::Map& map);
119  void setupFreeplay();
120 
121  bool startIntroVideo(uint32 index);
122 
127  void resetEventLimit();
128 
129 
130  //[-------------------------------------------------------]
131  //[ Private methods ]
132  //[-------------------------------------------------------]
133  private:
134  void eventSucceeded(const qsf::MessageParameters& parameters);
135  void eventFailed(const qsf::MessageParameters& parameters);
136  void onCutsceneFinished(const qsf::MessageParameters&);
137  void onEventFinished();
138 
139 
140  //[-------------------------------------------------------]
141  //[ Protected data ]
142  //[-------------------------------------------------------]
143  protected:
148 
149 
150  //[-------------------------------------------------------]
151  //[ Private data ]
152  //[-------------------------------------------------------]
153  private:
154  qsf::Time mWorldEventWaitTime;
155  qsf::Time mWorldEventWaitAfterEndTime;
156  float mWorldEventTriggerChance;
157 
158  // Messages proxies
159  qsf::MessageProxy mMessageEventSucceeded;
160  qsf::MessageProxy mMessageEventFailed;
161  qsf::MessageProxy mMessageReciveObjectivePoints;
162 
163  // Intro
164  uint32 mIntroVideoIndex;
165 
166 
167  //[-------------------------------------------------------]
168  //[ CAMP reflection system ]
169  //[-------------------------------------------------------]
170  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
171 
172 
173  };
174 
175 
176 //[-------------------------------------------------------]
177 //[ Namespace ]
178 //[-------------------------------------------------------]
179 } // em5
180 
181 
182 //[-------------------------------------------------------]
183 //[ CAMP reflection system ]
184 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Definition: FreeplayEvent.h:110
qsf::MessageProxy mCutsceneMessageProxy
Definition: FreeplayGameMode.h:147
Message parameters class.
Definition: MessageParameters.h:34
Map class.
Definition: Map.h:93
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
MapIdentifier mMapIdentifier
The current map.
Definition: FreeplayGameMode.h:144
EMERGENCY 5 player class.
Definition: Player.h:57
Definition: PickupPersonByParamedicAction.h:21
bool mFirstEventCompleted
Definition: FreeplayGameMode.h:146
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
EMERGENCY 5 map identifier class.
Definition: MapIdentifier.h:34
signed int int32
Definition: PlatformTypes.h:180
bool mIsPlayingIntro
Definition: FreeplayGameMode.h:145
EMERGENCY 5 freeplay game mode.
Definition: FreeplayGameMode.h:48
EMERGENCY 5 game mode base class.
Definition: GameMode.h:31
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32