CommonLibSSE NG
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 
97  struct ActorState1
98  {
99  public:
100  // members
101  std::uint32_t movingBack: 1; // 0:00
102  std::uint32_t movingForward: 1; // 0:01
103  std::uint32_t movingRight: 1; // 0:02
104  std::uint32_t movingLeft: 1; // 0:03
105  std::uint32_t unk04: 2; // 0:04
106  std::uint32_t walking: 1; // 0:06
107  std::uint32_t running: 1; // 0:07
108  std::uint32_t sprinting: 1; // 0:08
109  std::uint32_t sneaking: 1; // 0:09
110  std::uint32_t swimming: 1; // 0:10
111  std::uint32_t unk11: 3; // 0:11
113  FLY_STATE flyState: 3; // 0:18
117  };
118  static_assert(sizeof(ActorState1) == 0x4);
119 
120  struct ActorState2
121  {
122  public:
123  // members
124  std::uint32_t talkingToPlayer: 1; // 0:00
125  std::uint32_t forceRun: 1; // 0:01
126  std::uint32_t forceSneak: 1; // 0:02
127  std::uint32_t headTracking: 1; // 0:03
128  std::uint32_t reanimating: 1; // 0:04
130  std::uint32_t wantBlocking: 1; // 0:08
131  std::uint32_t flightBlocked: 1; // 0:09
132  std::uint32_t recoil: 2; // 0:10
133  std::uint32_t allowFlying: 1; // 0:12
134  std::uint32_t staggered: 1; // 0:13
135  std::uint32_t unk14: 18; // 0:14
136  };
137  static_assert(sizeof(ActorState2) == 0x4);
138 
139  ~ActorState() override; // 00
140 
141  // override (IMovementState)
142  void Unk_01(void) override; // 01 - { return 0; }
143  void Unk_02(void) override; // 02 - { return; }
144  void Unk_03(void) override; // 03 - { return; }
145  void Unk_04(void) override; // 04 - { return; }
146  float DoGetMovementSpeed() override; // 05 - { return 0.0; }
147  float DoGetRotationSpeed() override; // 06 - { return 0.0; }
148  void Unk_07(void) override; // 07 - { return; }
149  void Unk_08(void) override; // 08 - { return 0; }
150 
151  // add
152  virtual void Unk_14(void); // 14
153  virtual void Unk_15(void); // 15
154 
155  [[nodiscard]] ATTACK_STATE_ENUM GetAttackState() const noexcept { return actorState1.meleeAttackState; }
156  [[nodiscard]] FLY_STATE GetFlyState() const noexcept { return actorState1.flyState; }
157  [[nodiscard]] KNOCK_STATE_ENUM GetKnockState() const noexcept { return actorState1.knockState; }
158  [[nodiscard]] ACTOR_LIFE_STATE GetLifeState() const noexcept { return actorState1.lifeState; }
159  [[nodiscard]] SIT_SLEEP_STATE GetSitSleepState() const noexcept { return actorState1.sitSleepState; }
160  [[nodiscard]] WEAPON_STATE GetWeaponState() const noexcept { return actorState2.weaponState; }
161 
162  [[nodiscard]] bool IsBleedingOut() const noexcept
163  {
164  switch (GetLifeState()) {
167  return true;
168  default:
169  return false;
170  }
171  }
172 
173  [[nodiscard]] bool IsFlying() const noexcept
174  {
175  switch (GetFlyState()) {
176  case FLY_STATE::kNone:
178  return false;
179  default:
180  return true;
181  }
182  }
183 
184  [[nodiscard]] bool IsSneaking() const noexcept { return static_cast<bool>(actorState1.sneaking); }
185  [[nodiscard]] bool IsSprinting() const noexcept { return static_cast<bool>(actorState1.sprinting); }
186  [[nodiscard]] bool IsSwimming() const noexcept { return static_cast<bool>(actorState1.swimming); }
187  [[nodiscard]] bool IsUnconscious() const noexcept { return GetLifeState() == ACTOR_LIFE_STATE::kUnconcious; }
188  [[nodiscard]] bool IsWalking() const noexcept { return actorState1.walking; }
189 
190  [[nodiscard]] bool IsWeaponDrawn() const noexcept
191  {
192  switch (GetWeaponState()) {
196  return true;
197  default:
198  return false;
199  }
200  }
201 
202  // members
205  };
206  static_assert(sizeof(ActorState) == 0x10);
207 }
Definition: ActorState.h:93
WEAPON_STATE GetWeaponState() const noexcept
Definition: ActorState.h:160
bool IsFlying() const noexcept
Definition: ActorState.h:173
virtual void Unk_14(void)
float DoGetMovementSpeed() override
ATTACK_STATE_ENUM GetAttackState() const noexcept
Definition: ActorState.h:155
bool IsWalking() const noexcept
Definition: ActorState.h:188
SIT_SLEEP_STATE GetSitSleepState() const noexcept
Definition: ActorState.h:159
FLY_STATE GetFlyState() const noexcept
Definition: ActorState.h:156
ActorState2 actorState2
Definition: ActorState.h:204
void Unk_03(void) override
ACTOR_LIFE_STATE GetLifeState() const noexcept
Definition: ActorState.h:158
bool IsBleedingOut() const noexcept
Definition: ActorState.h:162
virtual void Unk_15(void)
ActorState1 actorState1
Definition: ActorState.h:203
KNOCK_STATE_ENUM GetKnockState() const noexcept
Definition: ActorState.h:157
bool IsWeaponDrawn() const noexcept
Definition: ActorState.h:190
void Unk_02(void) override
void Unk_08(void) override
~ActorState() override
void Unk_07(void) override
bool IsSwimming() const noexcept
Definition: ActorState.h:186
float DoGetRotationSpeed() override
void Unk_04(void) override
bool IsSprinting() const noexcept
Definition: ActorState.h:185
void Unk_01(void) override
static constexpr auto RTTI
Definition: ActorState.h:95
bool IsSneaking() const noexcept
Definition: ActorState.h:184
bool IsUnconscious() const noexcept
Definition: ActorState.h:187
Definition: IMovementState.h:10
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_ActorState(686793, 394643, 0x1f057f8)
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
KNOCK_STATE_ENUM
Definition: ActorState.h:53
WEAPON_STATE
Definition: ActorState.h:83
Definition: ActorState.h:98
std::uint32_t swimming
Definition: ActorState.h:110
std::uint32_t movingForward
Definition: ActorState.h:102
std::uint32_t walking
Definition: ActorState.h:106
SIT_SLEEP_STATE sitSleepState
Definition: ActorState.h:112
std::uint32_t unk11
Definition: ActorState.h:111
FLY_STATE flyState
Definition: ActorState.h:113
std::uint32_t movingBack
Definition: ActorState.h:101
std::uint32_t running
Definition: ActorState.h:107
std::uint32_t movingRight
Definition: ActorState.h:103
std::uint32_t movingLeft
Definition: ActorState.h:104
KNOCK_STATE_ENUM knockState
Definition: ActorState.h:115
std::uint32_t sneaking
Definition: ActorState.h:109
std::uint32_t sprinting
Definition: ActorState.h:108
ATTACK_STATE_ENUM meleeAttackState
Definition: ActorState.h:116
ACTOR_LIFE_STATE lifeState
Definition: ActorState.h:114
std::uint32_t unk04
Definition: ActorState.h:105
Definition: ActorState.h:121
std::uint32_t forceRun
Definition: ActorState.h:125
std::uint32_t staggered
Definition: ActorState.h:134
std::uint32_t headTracking
Definition: ActorState.h:127
std::uint32_t talkingToPlayer
Definition: ActorState.h:124
std::uint32_t flightBlocked
Definition: ActorState.h:131
std::uint32_t wantBlocking
Definition: ActorState.h:130
std::uint32_t allowFlying
Definition: ActorState.h:133
std::uint32_t recoil
Definition: ActorState.h:132
WEAPON_STATE weaponState
Definition: ActorState.h:129
std::uint32_t forceSneak
Definition: ActorState.h:126
std::uint32_t reanimating
Definition: ActorState.h:128
std::uint32_t unk14
Definition: ActorState.h:135