Emergency 20 Dokumentation  4.2.0
TimeOfDayData.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/base/WeakPtr.h>
16 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace qsf
22 {
23  class Entity;
24  namespace game
25  {
26  class BitStream;
27  class TimeOfDayComponent;
28  }
29 }
30 
31 
32 //[-------------------------------------------------------]
33 //[ Namespace ]
34 //[-------------------------------------------------------]
35 namespace em5
36 {
37  namespace multiplayer
38  {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Classes ]
43  //[-------------------------------------------------------]
49  {
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public methods ]
54  //[-------------------------------------------------------]
55  public:
56  TimeOfDayData(const qsf::Entity& targetEntity);
57  virtual ~TimeOfDayData();
58 
59 
60  //[-------------------------------------------------------]
61  //[ Public virtual em5::multiplayer::DataCacheBase methods ]
62  //[-------------------------------------------------------]
63  public:
64  virtual bool prepareForUpdate(const qsf::Entity& targetEntity, const qsf::Clock& clock) override;
65  virtual void updateData(qsf::game::BitStream& bitStream, bool force) override;
66  virtual void setData(const qsf::game::BitStream& bitStream, const int32 receivedHostTickCount) override;
67  virtual void interpolate(qsf::Entity& targetEntity, const qsf::Clock& clock, const int32 receivedHostTickCount) override;
68 
69  uint32 packTimeOfDay(glm::vec2 time);
70  glm::vec2 unpackTimeOfDay(uint32 packedTime);
71 
72 
73  //[-------------------------------------------------------]
74  //[ Private data ]
75  //[-------------------------------------------------------]
76  private:
78  uint32 mCurrentTimeOfDay;
79  bool mTimeOfDayChanged;
80 
81  // For client side only
82  struct HistoryEntry
83  {
84  int32 tickCount;
85  glm::vec2 mCurrentTimeOfDay;
86  };
87 
88  std::vector<HistoryEntry> mHistoryList;
89 
90 
91  };
92 
93 
94 //[-------------------------------------------------------]
95 //[ Namespace ]
96 //[-------------------------------------------------------]
97  } // multiplayer
98 } // em5
Definition: ActionPriority.h:13
EMERGENCY 5 multiplayer data cache base class.
Definition: DataCacheBase.h:48
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
Clock class.
Definition: Clock.h:33
TimeOfDayData(const qsf::Entity &targetEntity)
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
glm::vec2 unpackTimeOfDay(uint32 packedTime)
Definition: PickupPersonByParamedicAction.h:21
virtual void updateData(qsf::game::BitStream &bitStream, bool force) override
Updates the cache and writes any changed data to the given bit stream.
signed int int32
Definition: PlatformTypes.h:180
virtual void interpolate(qsf::Entity &targetEntity, const qsf::Clock &clock, const int32 receivedHostTickCount) override
Does any interpolation steps needed to apply the cached data to the entity.
EMERGENCY 5 entity with a time of day component data cache for a single entity for multiplayer...
Definition: TimeOfDayData.h:48
virtual void setData(const qsf::game::BitStream &bitStream, const int32 receivedHostTickCount) override
Reads the data from the bit stream.
virtual bool prepareForUpdate(const qsf::Entity &targetEntity, const qsf::Clock &clock) override
Prepares for an update.
uint32 packTimeOfDay(glm::vec2 time)