CommonLibVR
ActorState.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/I/IMovementState.h"
4 
5 namespace RE
6 {
7  enum class ACTOR_LIFE_STATE : std::uint32_t
8  {
9  kAlive = 0,
10  kDying = 1,
11  kDead = 2,
12  kUnconcious = 3,
13  kReanimate = 4,
14  kRecycle = 5,
15  kRestrained = 6,
16  kEssentialDown = 7,
17  kBleedout = 8
18  };
19 
20  enum class ATTACK_STATE_ENUM : std::uint32_t
21  {
22  kNone = 0,
23  kDraw = 1,
24  kSwing = 2,
25  kHit = 3,
26  kNextAttack = 4,
27  kFollowThrough = 5,
28  kBash = 6,
29  kBowDraw = 8,
30  kBowAttached = 9,
31  kBowDrawn = 10,
32  kBowReleasing = 11,
33  kBowReleased = 12,
34  kBowNextAttack = 13,
35  kBowFollowThrough = 14,
36  kFire = 15,
37  kFiring = 16,
38  kFired = 17
39  };
40 
41  enum class FLY_STATE : std::uint32_t
42  {
43  kNone = 0,
44  kTakeOff = 1,
45  kCruising = 2,
46  kHovering = 3,
47  kLanding = 4,
48  kPerching = 5,
49  kAction = 6
50  };
51 
52  enum class KNOCK_STATE_ENUM : std::uint32_t
53  {
54  kNormal = 0,
55  kExplode = 1,
56  kExplodeLeadIn = 2,
57  kOut = 3,
58  kOutLeadIn = 4,
59  kQueued = 5,
60  kGetUp = 6,
61  kDown = 7,
63  };
64 
65  enum class SIT_SLEEP_STATE : std::uint32_t
66  {
67  kNormal = 0,
68  kWantToSit = 1,
70 
71  kIsSitting = 3,
72  kRidingMount = static_cast<std::underlying_type_t<SIT_SLEEP_STATE>>(kIsSitting),
73 
74  kWantToStand = 4,
75 
76  kWantToSleep = 5,
77  kWaitingForSleepAnim = 6,
78  kIsSleeping = 7,
79  kWantToWake = 8
80  };
81 
82  enum class WEAPON_STATE : std::uint32_t
83  {
84  kSheathed = 0,
85  kWantToDraw = 1,
86  kDrawing = 2,
87  kDrawn = 3,
88  kWantToSheathe = 4,
89  kSheathing = 5
90  };
91 
92  class ActorState : public IMovementState
93  {
94  public:
95  inline static constexpr auto RTTI = RTTI_ActorState;
96  inline static constexpr auto VTABLE = VTABLE_ActorState;
97 
98  struct ActorState1
99  {
100  public:
101  // members
102  std::uint32_t movingBack: 1; // 0:00
103  std::uint32_t movingForward: 1; // 0:01
104  std::uint32_t movingRight: 1; // 0:02
105  std::uint32_t movingLeft: 1; // 0:03
106  std::uint32_t unk04: 2; // 0:04
107  std::uint32_t walking: 1; // 0:06
108  std::uint32_t running: 1; // 0:07
109  std::uint32_t sprinting: 1; // 0:08
110  std::uint32_t sneaking: 1; // 0:09
111  std::uint32_t swimming: 1; // 0:10
112  std::uint32_t unk11: 3; // 0:11
114  FLY_STATE flyState: 3; // 0:18
118  };
119  static_assert(sizeof(ActorState1) == 0x4);
120 
121  struct ActorState2
122  {
123  public:
124  // members
125  std::uint32_t talkingToPlayer: 1; // 0:00
126  std::uint32_t forceRun: 1; // 0:01
127  std::uint32_t forceSneak: 1; // 0:02
128  std::uint32_t headTracking: 1; // 0:03
129  std::uint32_t reanimating: 1; // 0:04
131  std::uint32_t wantBlocking: 1; // 0:08
132  std::uint32_t flightBlocked: 1; // 0:09
133  std::uint32_t recoil: 2; // 0:10
134  std::uint32_t allowFlying: 1; // 0:12
135  std::uint32_t staggered: 1; // 0:13
136  std::uint32_t unk14: 18; // 0:14
137  };
138  static_assert(sizeof(ActorState2) == 0x4);
139 
140  ~ActorState() override; // 00
141 
142  // override (IMovementState)
143  void Unk_01(void) override; // 01 - { return 0; }
144  void Unk_02(void) override; // 02 - { return; }
145  void Unk_03(void) override; // 03 - { return; }
146  void Unk_04(void) override; // 04 - { return; }
147  float DoGetMovementSpeed() override; // 05 - { return 0.0; }
148  float DoGetRotationSpeed() override; // 06 - { return 0.0; }
149  void Unk_07(void) override; // 07 - { return; }
150  void Unk_08(void) override; // 08 - { return 0; }
151 
152  // add
153  virtual bool DoSetSitSleepState(SIT_SLEEP_STATE a_state); // 14
154  virtual void Unk_15(void); // 15
155 
156  [[nodiscard]] ATTACK_STATE_ENUM GetAttackState() const noexcept { return actorState1.meleeAttackState; }
157  [[nodiscard]] FLY_STATE GetFlyState() const noexcept { return actorState1.flyState; }
158  [[nodiscard]] KNOCK_STATE_ENUM GetKnockState() const noexcept { return actorState1.knockState; }
159  [[nodiscard]] ACTOR_LIFE_STATE GetLifeState() const noexcept { return actorState1.lifeState; }
160  [[nodiscard]] SIT_SLEEP_STATE GetSitSleepState() const noexcept { return actorState1.sitSleepState; }
161  [[nodiscard]] WEAPON_STATE GetWeaponState() const noexcept { return actorState2.weaponState; }
162 
163  [[nodiscard]] bool IsBleedingOut() const noexcept
164  {
165  switch (GetLifeState()) {
168  return true;
169  default:
170  return false;
171  }
172  }
173 
174  [[nodiscard]] bool IsFlying() const noexcept
175  {
176  switch (GetFlyState()) {
177  case FLY_STATE::kNone:
179  return false;
180  default:
181  return true;
182  }
183  }
184 
185  [[nodiscard]] bool IsReanimated() const noexcept { return GetLifeState() == ACTOR_LIFE_STATE::kReanimate; }
186 
187  [[nodiscard]] bool IsSitting() const noexcept
188  {
189  switch (GetSitSleepState()) {
191  case SIT_SLEEP_STATE::kWantToStand:
192  return true;
193  default:
194  return false;
195  }
196  }
197 
198  [[nodiscard]] bool IsSneaking() const noexcept { return static_cast<bool>(actorState1.sneaking); }
199  [[nodiscard]] bool IsSprinting() const noexcept { return static_cast<bool>(actorState1.sprinting); }
200  [[nodiscard]] bool IsSwimming() const noexcept { return static_cast<bool>(actorState1.swimming); }
201  [[nodiscard]] bool IsUnconscious() const noexcept { return GetLifeState() == ACTOR_LIFE_STATE::kUnconcious; }
202  [[nodiscard]] bool IsWalking() const noexcept { return actorState1.walking; }
203 
204  [[nodiscard]] bool IsWeaponDrawn() const noexcept
205  {
206  switch (GetWeaponState()) {
210  return true;
211  default:
212  return false;
213  }
214  }
215 
216  // members
219  private:
220  KEEP_FOR_RE()
221  };
222  static_assert(sizeof(ActorState) == 0x10);
223 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: ActorState.h:93
WEAPON_STATE GetWeaponState() const noexcept
Definition: ActorState.h:161
virtual bool DoSetSitSleepState(SIT_SLEEP_STATE a_state)
bool IsFlying() const noexcept
Definition: ActorState.h:174
float DoGetMovementSpeed() override
ATTACK_STATE_ENUM GetAttackState() const noexcept
Definition: ActorState.h:156
bool IsWalking() const noexcept
Definition: ActorState.h:202
SIT_SLEEP_STATE GetSitSleepState() const noexcept
Definition: ActorState.h:160
FLY_STATE GetFlyState() const noexcept
Definition: ActorState.h:157
bool IsSitting() const noexcept
Definition: ActorState.h:187
ActorState2 actorState2
Definition: ActorState.h:218
void Unk_03(void) override
ACTOR_LIFE_STATE GetLifeState() const noexcept
Definition: ActorState.h:159
static constexpr auto VTABLE
Definition: ActorState.h:96
bool IsBleedingOut() const noexcept
Definition: ActorState.h:163
virtual void Unk_15(void)
ActorState1 actorState1
Definition: ActorState.h:217
KNOCK_STATE_ENUM GetKnockState() const noexcept
Definition: ActorState.h:158
bool IsWeaponDrawn() const noexcept
Definition: ActorState.h:204
void Unk_02(void) override
void Unk_08(void) override
~ActorState() override
void Unk_07(void) override
bool IsSwimming() const noexcept
Definition: ActorState.h:200
float DoGetRotationSpeed() override
void Unk_04(void) override
bool IsSprinting() const noexcept
Definition: ActorState.h:199
void Unk_01(void) override
bool IsReanimated() const noexcept
Definition: ActorState.h:185
static constexpr auto RTTI
Definition: ActorState.h:95
bool IsSneaking() const noexcept
Definition: ActorState.h:198
bool IsUnconscious() const noexcept
Definition: ActorState.h:201
Definition: IMovementState.h:10
Definition: AbsorbEffect.h:6
FLY_STATE
Definition: ActorState.h:42
ACTOR_LIFE_STATE
Definition: ActorState.h:8
SIT_SLEEP_STATE
Definition: ActorState.h:66
ATTACK_STATE_ENUM
Definition: ActorState.h:21
constexpr std::array< REL::ID, 1 > VTABLE_ActorState
Definition: Offsets_VTABLE.h:7384
@ kNone
KNOCK_STATE_ENUM
Definition: ActorState.h:53
constexpr REL::ID RTTI_ActorState(static_cast< std::uint64_t >(686793))
WEAPON_STATE
Definition: ActorState.h:83
Definition: ActorState.h:99
std::uint32_t swimming
Definition: ActorState.h:111
std::uint32_t movingForward
Definition: ActorState.h:103
std::uint32_t walking
Definition: ActorState.h:107
SIT_SLEEP_STATE sitSleepState
Definition: ActorState.h:113
std::uint32_t unk11
Definition: ActorState.h:112
FLY_STATE flyState
Definition: ActorState.h:114
std::uint32_t movingBack
Definition: ActorState.h:102
std::uint32_t running
Definition: ActorState.h:108
std::uint32_t movingRight
Definition: ActorState.h:104
std::uint32_t movingLeft
Definition: ActorState.h:105
KNOCK_STATE_ENUM knockState
Definition: ActorState.h:116
std::uint32_t sneaking
Definition: ActorState.h:110
std::uint32_t sprinting
Definition: ActorState.h:109
ATTACK_STATE_ENUM meleeAttackState
Definition: ActorState.h:117
ACTOR_LIFE_STATE lifeState
Definition: ActorState.h:115
std::uint32_t unk04
Definition: ActorState.h:106
Definition: ActorState.h:122
std::uint32_t forceRun
Definition: ActorState.h:126
std::uint32_t staggered
Definition: ActorState.h:135
std::uint32_t headTracking
Definition: ActorState.h:128
std::uint32_t talkingToPlayer
Definition: ActorState.h:125
std::uint32_t flightBlocked
Definition: ActorState.h:132
std::uint32_t wantBlocking
Definition: ActorState.h:131
std::uint32_t allowFlying
Definition: ActorState.h:134
std::uint32_t recoil
Definition: ActorState.h:133
WEAPON_STATE weaponState
Definition: ActorState.h:130
std::uint32_t forceSneak
Definition: ActorState.h:127
std::uint32_t reanimating
Definition: ActorState.h:129
std::uint32_t unk14
Definition: ActorState.h:136