Emergency 20 Dokumentation  4.2.0
Game.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 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
15 #include <qsf_game/game/Game.h>
16 
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace qsf
25 {
26  class Map;
27  class CameraComponent;
28  class BinarySerializer;
29  class SoundTrackManager;
30  namespace logic
31  {
32  class TargetPointManager;
33  }
34  namespace game
35  {
36  class GameCounterManager;
37  class GameTimerManager;
38  }
39 }
40 namespace em5
41 {
42  class RightsManager;
43  class GameAnimation;
44  class GameSimulation;
45  class GameSessionConfiguration;
46  class CampaignDefinition;
47  class MiniMapIconRegistrationLogic;
48  class PlayerManager;
49  class SelectionManager;
50  class SelectionMarkerManager;
51  class CommandMarkerManager;
52  class OrderInfoManager;
53  class GangsterTypeManager;
54  class SpecsGroupManager;
55  class HintSystem;
56  class CutscenePlayer;
57  class OverlayManager;
58  class AiSpeedLimitFunctor;
59  class AiCollisionDetectedFunctor;
60  class AiSpecialSteeringStateCallback;
61  class MapIdentifier;
62 }
63 
64 
65 //[-------------------------------------------------------]
66 //[ Namespace ]
67 //[-------------------------------------------------------]
68 namespace em5
69 {
70 
71 
72  //[-------------------------------------------------------]
73  //[ Classes ]
74  //[-------------------------------------------------------]
80  {
81 
82 
83  //[-------------------------------------------------------]
84  //[ Public definitions ]
85  //[-------------------------------------------------------]
86  public:
87  // Specific input handlers for EM5
89 
90 
91  //[-------------------------------------------------------]
92  //[ Public methods ]
93  //[-------------------------------------------------------]
94  public:
99  Game();
100 
105  virtual ~Game();
106 
107  //[-------------------------------------------------------]
108  //[ Lifecycle ]
109  //[-------------------------------------------------------]
110  void prepareMap(qsf::Map& map, bool wasLoadedBefore);
111  void onLoadComplete();
112 
113  //[-------------------------------------------------------]
114  //[ Managers and sub-systems ]
115  //[-------------------------------------------------------]
120  inline GameSimulation& getSimulation() const;
121 
126  const qsf::Clock& getSimulationClock() const;
127 
132  inline GameAnimation& getAnimation() const;
133 
138  MiniMapIconRegistrationLogic& getMiniMapIconRegistrationLogic() const;
139 
144  inline qsf::SoundTrackManager& getSoundTrackManager() const;
145 
150  inline GameSessionConfiguration& getGameSessionConfiguration() const;
151 
156  const CampaignDefinition& getCampaignDefinitionByIndex(uint32 campaignIndex);
157 
162  const std::vector<CampaignDefinition*>& getCampaignDefinitions() const;
163 
174  uint32 getCampaignIndexByMainEventNumber(uint32 mainEventNumber) const;
175 
183  bool getMapAndCampaignInfoByMainEventNumber(uint32 mainEventNumber, MapIdentifier& outMapIdentifier, uint32& outCampaignIndex, uint32& outCampaignPhaseIndex) const;
184 
189  inline PlayerManager& getPlayerManager() const;
190 
198  inline const RightsManager& getRightsManager() const;
199 
204  inline SelectionManager& getSelectionManager() const;
205 
210  inline qsf::game::GameCounterManager& getGameCounterManager() const;
211 
216  inline qsf::game::GameTimerManager& getGameTimerManager() const;
217 
222  inline qsf::logic::TargetPointManager& getTargetPointManager() const;
223 
228  inline CutscenePlayer& getCutscenePlayer() const;
229 
234  inline OverlayManager& getOverlayManager() const;
235 
240  inline OrderInfoManager& getOrderInfoManager() const;
241 
246  inline GangsterTypeManager& getGangsterTypeManager() const;
247 
252  inline SpecsGroupManager& getSpecsGroupManager() const;
253 
258  inline HintSystem& getHintSystem() const;
259 
260  //[-------------------------------------------------------]
261  //[ Camera ]
262  //[-------------------------------------------------------]
267  qsf::CameraComponent* getMainCamera() const;
268 
273  void setMainCamera(qsf::CameraComponent* cameraComponent);
274 
275  //[-------------------------------------------------------]
276  //[ Serialization ]
277  //[-------------------------------------------------------]
282  void serialize(qsf::BinarySerializer& serializer);
283 
288  bool loadGame(const std::string& filename);
289 
294  bool saveGame(const std::string& filename);
295 
296  //[-------------------------------------------------------]
297  //[ Interaction ]
298  //[-------------------------------------------------------]
306  bool isGameInteractionBlocked() const;
307 
308 
309  //[-------------------------------------------------------]
310  //[ Protected virtual qsf::game::Game methods ]
311  //[-------------------------------------------------------]
312  protected:
313  virtual void onStartup() override;
314  virtual void onShutdown() override;
315  virtual void onUpdateGame(const qsf::Clock& realtimeClock) override;
316  virtual void onGameSpeedChange(float newGameSpeed, float oldGameSpeed) override;
317 
318 
319  //[-------------------------------------------------------]
320  //[ Private methods ]
321  //[-------------------------------------------------------]
322  private:
323  // Extracted part of the setup that is called during the initial setup and after loading
324  void startupAiSystems();
325  void shutdownAiSystems();
326 
327 
328  //[-------------------------------------------------------]
329  //[ Private data ]
330  //[-------------------------------------------------------]
331  private:
332  // Game animation and simulation
333  GameAnimation* mGameAnimation;
334  GameSimulation* mGameSimulation;
335 
336  // Music
337  qsf::SoundTrackManager* mSoundTrackManager;
338 
339  // Game session configuration
340  GameSessionConfiguration& mGameSessionConfiguration;
341 
342  // Campaign
343  std::vector<CampaignDefinition*> mCampaignDefinitions;
344 
345  // Player management
346  PlayerManager* mPlayerManager;
347  RightsManager* mRightsManager;
348  OrderInfoManager* mOrderInfoManager;
349 
350  // Entity selection and command targets
351  SelectionManager* mSelectionManager;
352  SelectionMarkerManager* mSelectionMarkerManager;
353  CommandMarkerManager* mCommandMarkerManager;
354 
355  // Other managers
356  qsf::game::GameCounterManager* mGameCounterManager;
357  qsf::game::GameTimerManager* mGameTimerManager;
358  qsf::logic::TargetPointManager* mTargetPointManager;
359  GangsterTypeManager* mGangsterTypeManager;
360  SpecsGroupManager* mSpecsGroupManager;
361  HintSystem* mHintSystem;
362  CutscenePlayer* mCutscenePlayer;
363  OverlayManager* mOverlayManager;
364 
365  // Functors to influence the AI that are passed during the init process
366  AiSpeedLimitFunctor* mSpeedLimits;
367  AiCollisionDetectedFunctor* mCollisionReaction;
368  AiSpecialSteeringStateCallback* mSpecialStateReaction;
369 
370  bool mIsGroundMapInitialized;
371 
372  qsf::MessageProxy mDestroyObjectMessageProxy;
373 
374 
375  };
376 
377 
378 //[-------------------------------------------------------]
379 //[ Namespace ]
380 //[-------------------------------------------------------]
381 } // em5
382 
383 
384 //[-------------------------------------------------------]
385 //[ Implementation ]
386 //[-------------------------------------------------------]
387 #include "em5/game/Game-inl.h"
Definition: ActionPriority.h:13
Hint system knows how to trigger hints and delegates hint calls from gameplay to GUI.
Definition: HintSystem.h:48
EMERGENCY 5 overlay manager class.
Definition: OverlayManager.h:45
Definition: OrderInfoManager.h:28
Target point manager class.
Definition: TargetPointManager.h:45
Map class.
Definition: Map.h:93
unsigned int uint32
Definition: PlatformTypes.h:181
EMERGENCY 5 campaign definition class.
Definition: CampaignDefinition.h:43
EMERGENCY 5 rights manager.
Definition: RightsManager.h:37
Clock class.
Definition: Clock.h:33
Speed limit functor for EMERGENCY 5.
Definition: AiSpeedLimitFunctor.h:48
Specs group manager class.
Definition: SpecsGroupManager.h:35
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 game class.
Definition: Game.h:79
Camera component class.
Definition: CameraComponent.h:50
Manager for gangster type definitions.
Definition: GangsterTypeManager.h:32
Message listener proxy class.
Definition: MessageProxy.h:47
Minimap registration logic.
Definition: MiniMapIconRegistrationLogic.h:48
EMERGENCY 5 player manager.
Definition: PlayerManager.h:45
EMERGENCY 5 cutscene player.
Definition: CutscenePlayer.h:47
Game base class.
Definition: Game.h:45
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
Unique instance interface.
Definition: UniqueInstance.h:34
EMERGENCY 5 selection marker manager class that cares for activation and deactivation of markers...
Definition: SelectionMarkerManager.h:47
EMERGENCY 5 map identifier class.
Definition: MapIdentifier.h:34
Example on collision detected functor for EMERGENCY 5. Currently ignores collisions.
Definition: AiCollisionDetectedFunctor.h:33
EMERGENCY 5 selection manager class.
Definition: SelectionManager.h:42
EMERGENCY 5 game session configuration.
Definition: GameSessionConfiguration.h:44
static const uint32 FIRE_SIMULATION_INPUT_HANDLER_ID
Definition: Game.h:88
EMERGENCY 5 game animation class.
Definition: GameAnimation.h:48
Game timer manager.
Definition: GameTimerManager.h:36
Sound track manager class.
Definition: SoundTrackManager.h:48
Game counter manager class.
Definition: GameCounterManager.h:51
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 game simulation class.
Definition: GameSimulation.h:51
EMERGENCY 5 command target marker manager class that cares for highlighting of possible targets...
Definition: CommandMarkerManager.h:56
Example of special state callback for EM5. Allows ignoring blocked nodes if emergency lighting is swi...
Definition: AiSpecialSteeringStateCallback.h:33