Emergency 20 Dokumentation  4.2.0
SwingData.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 #include <vector>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  class SwingComponent;
26 }
27 namespace qsf
28 {
29  class Entity;
30  namespace game
31  {
32  class BitStream;
33  }
34 }
35 
36 
37 //[-------------------------------------------------------]
38 //[ Namespace ]
39 //[-------------------------------------------------------]
40 namespace em5
41 {
42  namespace multiplayer
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Classes ]
48  //[-------------------------------------------------------]
53  class SwingData: public DataCacheBase
54  {
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public methods ]
59  //[-------------------------------------------------------]
60  public:
61  SwingData(const qsf::Entity& targetEntity);
62  virtual ~SwingData();
63 
64 
65  //[-------------------------------------------------------]
66  //[ Public virtual em5::multiplayer::DataCacheBase methods ]
67  //[-------------------------------------------------------]
68  public:
69  virtual bool prepareForUpdate(const qsf::Entity& targetEntity, const qsf::Clock& clock) override;
70  virtual void updateData(qsf::game::BitStream& bitStream, bool force) override;
71  virtual void setData(const qsf::game::BitStream& bitStream, const int32 receivedHostTickCount) override;
72  virtual void interpolate(qsf::Entity& targetEntity, const qsf::Clock& clock, const int32 receivedHostTickCount) override;
73 
74 
75  //[-------------------------------------------------------]
76  //[ Private data ]
77  //[-------------------------------------------------------]
78  private:
80  bool mIsActive;
81  uint8 mAnimationType; // Current value range 0-2
82  bool mAnimationTypeChanged;
83  uint8 mAnimationCylce; // Currently two values are used: 30.0f and 40.0f
84  bool mAnimationCylceChanged;
85  uint8 mAnimationIntensity; // Currently only one value is used: 4.0f
86  bool mAnimationIntensityChanged;
87  int8 mVelocitySkew; // Currently only two values are used: -0.15f, 0.15f
88  bool mVelocitySkewChanged;
89 
90  // For client side only
91  struct HistoryEntry
92  {
93  int32 tickCount;
94  bool mIsActive;
95  uint8 mAnimationType;
96  bool mAnimationTypeChanged;
97  uint8 mAnimationCylce;
98  bool mAnimationCylceChanged;
99  uint8 mAnimationIntensity;
100  bool mAnimationIntensityChanged;
101  int8 mVelocitySkew;
102  bool mVelocitySkewChanged;
103  };
104 
105  std::vector<HistoryEntry> mHistoryList;
106 
107 
108  };
109 
110 
111 //[-------------------------------------------------------]
112 //[ Namespace ]
113 //[-------------------------------------------------------]
114  } // multiplayer
115 } // em5
Definition: ActionPriority.h:13
signed char int8
Definition: PlatformTypes.h:174
virtual bool prepareForUpdate(const qsf::Entity &targetEntity, const qsf::Clock &clock) override
Prepares for an update.
EMERGENCY 5 multiplayer data cache base class.
Definition: DataCacheBase.h:48
Entity class.
Definition: Entity.h:46
SwingData(const qsf::Entity &targetEntity)
EMERGENCY 5 entity with a swing component data cache for a single entity for multiplayer.
Definition: SwingData.h:53
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.
Clock class.
Definition: Clock.h:33
Lightweight weak pointer implementation.
Definition: WeakPtr.h:133
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
Definition: PickupPersonByParamedicAction.h:21
signed int int32
Definition: PlatformTypes.h:180
virtual void setData(const qsf::game::BitStream &bitStream, const int32 receivedHostTickCount) override
Reads the data from the bit stream.
virtual void updateData(qsf::game::BitStream &bitStream, bool force) override
Updates the cache and writes any changed data to the given bit stream.
unsigned char uint8
Definition: PlatformTypes.h:175