Emergency 20 Dokumentation  4.2.0
BarrierTapeData.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 #include <qsf/base/WeakPtr.h>
17 
18 #include <vector>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26  class BarrierTapeComponent;
27 }
28 
29 
30 //[-------------------------------------------------------]
31 //[ Namespace ]
32 //[-------------------------------------------------------]
33 namespace em5
34 {
35  namespace multiplayer
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Classes ]
41  //[-------------------------------------------------------]
47  {
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public methods ]
52  //[-------------------------------------------------------]
53  public:
54  BarrierTapeData(const qsf::Entity& targetEntity);
55  virtual ~BarrierTapeData();
56 
57 
58  //[-------------------------------------------------------]
59  //[ Public virtual em5::multiplayer::DataCacheBase methods ]
60  //[-------------------------------------------------------]
61  public:
62  virtual bool prepareForUpdate(const qsf::Entity& targetEntity, const qsf::Clock& clock) override;
63  virtual void updateData(qsf::game::BitStream& bitStream, bool force) override;
64  virtual void setData(const qsf::game::BitStream& bitStream, const int32 receivedHostTickCount) override;
65  virtual void interpolate(qsf::Entity& targetEntity, const qsf::Clock& clock, const int32 receivedHostTickCount) override;
66 
67 
68  //[-------------------------------------------------------]
69  //[ Private data ]
70  //[-------------------------------------------------------]
71  private:
73 
74  struct PoleData
75  {
76  bool mHasPositionChanged;
77  glm::vec3 mPosition;
78  float mTransparency;
79  };
80 
81  uint32 mNumberOfPoles;
82  PoleData mPole[2];
83 
84  bool mHasTapeChanged;
85  bool mTapeExists;
86  BarrierTapeComponent::TapeConnection mTapeConnectionType;
87  uint64 mTapeConnectionPoliceEntityId;
88  float mTapeTransparency;
89 
90  bool mIsFinishedBuilding;
91  bool mIsBarrier;
92 
93  // For client side only
94  struct HistoryEntry
95  {
96  int32 tickCount;
97 
98  uint32 mNumberOfPoles;
99  PoleData mPole[2];
100 
101  bool mHasTapeChanged;
102  bool mTapeExists;
103  BarrierTapeComponent::TapeConnection mTapeConnectionType;
104  uint64 mTapeConnectionPoliceEntityId;
105  float mTapeTransparency;
106 
107  bool mIsFinishedBuilding;
108  bool mIsBarrier;
109  };
110 
111  std::vector<HistoryEntry> mHistoryList;
112 
113 
114  };
115 
116 
117 //[-------------------------------------------------------]
118 //[ Namespace ]
119 //[-------------------------------------------------------]
120  } // multiplayer
121 } // 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
EMERGENCY 5 entity with a barrier tape component data cache for a single entity for multiplayer...
Definition: BarrierTapeData.h:46
uint64_t uint64
Definition: PlatformTypes.h:184
Lightweight weak pointer implementation.
Definition: WeakPtr.h:133
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
TapeConnection
Definition: BarrierTapeComponent.h:56
virtual bool prepareForUpdate(const qsf::Entity &targetEntity, const qsf::Clock &clock) override
Prepares for an update.
signed int int32
Definition: PlatformTypes.h:180
BarrierTapeData(const qsf::Entity &targetEntity)
virtual void setData(const qsf::game::BitStream &bitStream, const int32 receivedHostTickCount) override
Reads the data from the bit stream.
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.
virtual void updateData(qsf::game::BitStream &bitStream, bool force) override
Updates the cache and writes any changed data to the given bit stream.