CommonLibSSE (powerof3)
TESObjectWEAP.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/A/ActorValues.h"
6 #include "RE/B/BGSEquipType.h"
7 #include "RE/B/BGSKeywordForm.h"
8 #include "RE/B/BGSMessageIcon.h"
10 #include "RE/B/BGSPreloadable.h"
11 #include "RE/F/FormTypes.h"
12 #include "RE/S/SoundLevels.h"
14 #include "RE/T/TESBoundObject.h"
15 #include "RE/T/TESDescription.h"
17 #include "RE/T/TESFullName.h"
18 #include "RE/T/TESIcon.h"
19 #include "RE/T/TESModel.h"
21 #include "RE/T/TESValueForm.h"
22 #include "RE/T/TESWeightForm.h"
23 
24 namespace RE
25 {
26  enum class WEAPONHITBEHAVIOR
27  {
28  kNormal = 0,
29  kDismemberOnly = 1,
30  kExplodeOnly = 2,
32  };
33 
35  {
36  kConstant = 0,
37  kPeriodicSquare = 1,
40  };
41 
42  struct WeaponTypes
43  {
44  enum WEAPON_TYPE : std::uint32_t
45  {
53  kBow = 7,
54  kStaff = 8,
55  kCrossbow = 9,
56 
57  kTotal = 10
58  };
59  };
61 
62  class TESObjectWEAP :
63  public TESBoundObject, // 000
64  public TESFullName, // 030
65  public TESModelTextureSwap, // 040
66  public TESIcon, // 078
67  public TESEnchantableForm, // 088
68  public TESValueForm, // 0A0
69  public TESWeightForm, // 0B0
70  public TESAttackDamageForm, // 0C0
71  public BGSDestructibleObjectForm, // 0D0
72  public BGSEquipType, // 0E0
73  public BGSPreloadable, // 0F0
74  public BGSMessageIcon, // 0F8
75  public BGSPickupPutdownSounds, // 110
76  public BGSBlockBashData, // 128
77  public BGSKeywordForm, // 140
78  public TESDescription // 158
79  {
80  public:
81  inline static constexpr auto RTTI = RTTI_TESObjectWEAP;
82  inline static constexpr auto VTABLE = VTABLE_TESObjectWEAP;
83  inline static constexpr auto FORMTYPE = FormType::Weapon;
84 
85  struct RecordFlags
86  {
87  enum RecordFlag : std::uint32_t
88  {
89  kNonPlayable = 1 << 2,
90  kHasInheritedFromTemplate = 1 << 3, // cleared on load; set by relevant processing in InitItemImpl
91  kDeleted = 1 << 5,
92  kIgnored = 1 << 12
93  };
94  };
95 
96  struct RangedData
97  {
98  public:
99  // members
100  float sightFOV; // 00
101  float fireRate; // 04 - Fallout leftover?
104  float firingRumbleDuration; // 10
105  float attackShotsPerSec; // 14 - Fallout leftover?
106  std::int8_t numProjectiles; // 18
107  std::uint8_t pad19; // 19
108  std::uint16_t pad1A; // 1A
109  };
110  static_assert(sizeof(RangedData) == 0x1C);
111 
112  struct Data // DNAM
113  {
114  public:
115  enum class Flag2
116  {
117  kNone = 0,
118  kPlayerOnly = 1 << 0,
119  kNPCsUseAmmo = 1 << 1,
120  kNoJamAfterReload = 1 << 2, // unused
121  kMinorCrime = 1 << 4,
122  kRangeFixed = 1 << 5,
123  kNotUsedInNormalCombat = 1 << 6,
124  kOverridesConditionDamage = 1 << 7,
125  kDontUse3rdPersonISAnim = 1 << 8, // unused
126  kBurstShot = 1 << 9,
127  kRumbleAlternate = 1 << 10,
128  kLongBursts = 1 << 11,
129  kNonHostile = 1 << 12,
130  kBoundWeapon = 1 << 13
131  };
132 
133  enum class AttackAnimation
134  {
135  kAttackLeft = 26,
136  kAttackRight = 32,
137  kAttack3 = 38,
138  kAttack4 = 44,
139  kAttack5 = 50,
140  kAttack7 = 62,
141  kAttack8 = 68,
142  kAttackLoop = 74,
143  kAttackSpin = 80,
144  kAttackSpin2 = 86,
145  kPlaceMine = 97,
146  kPlaceMine2 = 103,
147  kAttackThrow = 109,
148  kAttackThrow2 = 115,
149  kAttackThrow3 = 121,
150  kAttackThrow4 = 127,
151  kAttackThrow5 = 133,
152  kDefault = 255
153  };
154 
155  enum class Flag
156  {
157  kNone = 0,
159  kAutomatic = 1 << 1, // unused
160  kHasScope = 1 << 2, // unused
161  kCantDrop = 1 << 3,
162  kHideBackpack = 1 << 4, // unused
163  kEmbeddedWeapon = 1 << 5, // unused
164  kDontUseFirstPersonISAnim = 1 << 6, // unused
165  kNonPlayable = 1 << 7
166  };
167 
168  // members
170  float speed; // 08
171  float reach; // 0C
172  float minRange; // 10
173  float maxRange; // 14
174  float animationAttackMult; // 18
175  float damageToWeaponMult; // 1C - used in (unused?) condition calculations if Flag2::kOverridesConditionDamage is set
176  float staggerValue; // 20
181  std::uint8_t baseVATSToHitChance; // 32
186  std::uint8_t unk37; // 37
187  };
188  static_assert(sizeof(Data) == 0x38);
189 
190  struct CriticalData // CRDT
191  {
192  public:
193  enum Flag
194  {
195  kNone = 0,
196  kOnDeath = 1 << 0
197  };
198 
199  // members
200  float prcntMult; // 00
201  std::uint32_t pad04; // 04
203  std::uint16_t damage; // 10
205  std::uint8_t pad13; // 13
206  std::uint32_t pad14; // 14
207  };
208  static_assert(sizeof(CriticalData) == 0x18);
209 
210  struct ScopeArt
211  {
212  public:
213  // members
214  TESModel unk00; // 00 - MOD3 and friends
215  TESEffectShader* unk28; // 28 - EIDT
216  };
217  static_assert(sizeof(ScopeArt) == 0x30);
218 
219  ~TESObjectWEAP() override; // 00
220 
221  // override (TESBoundObject)
222  void InitializeData() override; // 04
223  void ClearData() override; // 05
224  bool Load(TESFile* a_mod) override; // 06
225  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
226  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
227  void InitItemImpl() override; // 13
228  TESFile* GetDescriptionOwnerFile() const override; // 14
229  bool GetPlayable() const override; // 19 - { return ~((data.flags >> 7) & 1); }
230  const char* GetObjectTypeName() const override; // 39 - { return g_animationStrings[data.animationType]; }
231 
232  // override (BGSKeywordForm)
233  [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05
234 
235  [[nodiscard]] float GetSpeed() const;
236  [[nodiscard]] float GetReach() const;
237  [[nodiscard]] float GetStagger() const;
238  [[nodiscard]] float GetMinRange() const;
239  [[nodiscard]] float GetMaxRange() const;
240  [[nodiscard]] std::uint16_t GetCritDamage() const;
242  void GetNodeName(char* a_dstBuff) const;
243  [[nodiscard]] WEAPON_TYPE GetWeaponType() const;
244  [[nodiscard]] bool IsBound() const;
245  [[nodiscard]] bool IsMelee() const;
246  [[nodiscard]] bool IsRanged() const;
247  [[nodiscard]] bool IsHandToHandMelee() const;
248  [[nodiscard]] bool IsOneHandedSword() const;
249  [[nodiscard]] bool IsOneHandedDagger() const;
250  [[nodiscard]] bool IsOneHandedAxe() const;
251  [[nodiscard]] bool IsOneHandedMace() const;
252  [[nodiscard]] bool IsTwoHandedSword() const;
253  [[nodiscard]] bool IsTwoHandedAxe() const;
254  [[nodiscard]] bool IsBow() const;
255  [[nodiscard]] bool IsStaff() const;
256  [[nodiscard]] bool IsCrossbow() const;
257 
258  // members
259  Data weaponData; // 168 - DNAM
260  CriticalData criticalData; // 1A0 - CRDT
274  std::uint32_t pad21C; // 21C
275  };
276  static_assert(sizeof(TESObjectWEAP) == 0x220);
277 }
Definition: BGSBlockBashData.h:9
Definition: BGSDestructibleObjectForm.h:61
Definition: BGSEquipType.h:9
Definition: BGSImpactDataSet.h:13
Definition: BGSKeywordForm.h:12
Definition: BGSKeyword.h:10
Definition: BGSLoadFormBuffer.h:11
Definition: BGSMessageIcon.h:9
Definition: BGSPickupPutdownSounds.h:10
Definition: BGSPreloadable.h:8
Definition: BGSSaveFormBuffer.h:8
Definition: BGSSoundDescriptorForm.h:14
Definition: NiAVObject.h:51
Definition: SpellItem.h:16
Definition: TESAttackDamageForm.h:8
Definition: TESBoundObject.h:24
Definition: TESDescription.h:12
Definition: TESEffectShader.h:182
Definition: TESEnchantableForm.h:11
Definition: TESFile.h:17
Definition: TESFullName.h:9
Definition: TESIcon.h:8
Definition: TESModelTextureSwap.h:10
Definition: TESModel.h:16
Definition: TESObjectSTAT.h:30
Definition: TESObjectWEAP.h:79
void InitItemImpl() override
bool IsRanged() const
bool IsOneHandedDagger() const
const char * GetObjectTypeName() const override
static constexpr auto RTTI
Definition: TESObjectWEAP.h:81
std::uint32_t pad21C
Definition: TESObjectWEAP.h:274
void GetNodeName(char *a_dstBuff) const
bool IsBow() const
BGSSoundDescriptorForm * attackSound2D
Definition: TESObjectWEAP.h:263
CriticalData criticalData
Definition: TESObjectWEAP.h:260
void LoadGame(BGSLoadFormBuffer *a_buf) override
bool Load(TESFile *a_mod) override
BGSKeyword * GetDefaultKeyword() const override
TESObjectSTAT * firstPersonModelObject
Definition: TESObjectWEAP.h:270
bool IsCrossbow() const
BGSSoundDescriptorForm * attackSound
Definition: TESObjectWEAP.h:262
bool IsHandToHandMelee() const
float GetMaxRange() const
float GetSpeed() const
~TESObjectWEAP() override
static constexpr auto FORMTYPE
Definition: TESObjectWEAP.h:83
void InitializeData() override
ScopeArt * scopeArt
Definition: TESObjectWEAP.h:261
BGSSoundDescriptorForm * equipSound
Definition: TESObjectWEAP.h:267
bool IsStaff() const
float GetReach() const
TESFile * GetDescriptionOwnerFile() const override
BSFixedString embeddedNode
Definition: TESObjectWEAP.h:272
REX::EnumSet< SOUND_LEVEL, std::uint32_t > soundLevel
Definition: TESObjectWEAP.h:273
bool IsOneHandedSword() const
bool IsTwoHandedAxe() const
BGSImpactDataSet * impactDataSet
Definition: TESObjectWEAP.h:269
bool IsOneHandedMace() const
bool IsOneHandedAxe() const
bool IsMelee() const
static constexpr auto VTABLE
Definition: TESObjectWEAP.h:82
TESObjectWEAP * templateWeapon
Definition: TESObjectWEAP.h:271
Data weaponData
Definition: TESObjectWEAP.h:259
float GetMinRange() const
void SaveGame(BGSSaveFormBuffer *a_buf) override
BGSSoundDescriptorForm * attackLoopSound
Definition: TESObjectWEAP.h:264
BGSSoundDescriptorForm * attackFailSound
Definition: TESObjectWEAP.h:265
BGSSoundDescriptorForm * idleSound
Definition: TESObjectWEAP.h:266
WEAPON_TYPE GetWeaponType() const
float GetStagger() const
NiAVObject * GetFireNode(NiAVObject *a_root) const
std::uint16_t GetCritDamage() const
bool IsTwoHandedSword() const
bool GetPlayable() const override
BGSSoundDescriptorForm * unequipSound
Definition: TESObjectWEAP.h:268
bool IsBound() const
void ClearData() override
Definition: TESValueForm.h:8
Definition: TESWeightForm.h:8
Definition: AbsorbEffect.h:6
WEAPON_RUMBLE_PATTERN
Definition: TESObjectWEAP.h:35
WEAPONHITBEHAVIOR
Definition: TESObjectWEAP.h:27
constexpr std::array< REL::ID, 16 > VTABLE_TESObjectWEAP
Definition: Offsets_VTABLE.h:12874
constexpr REL::ID RTTI_TESObjectWEAP(static_cast< std::uint64_t >(513916))
Definition: TESObjectWEAP.h:191
REX::EnumSet< Flag, std::uint8_t > flags
Definition: TESObjectWEAP.h:204
std::uint16_t damage
Definition: TESObjectWEAP.h:203
Flag
Definition: TESObjectWEAP.h:194
@ kOnDeath
Definition: TESObjectWEAP.h:196
@ kNone
Definition: TESObjectWEAP.h:195
std::uint32_t pad04
Definition: TESObjectWEAP.h:201
float prcntMult
Definition: TESObjectWEAP.h:200
SpellItem * effect
Definition: TESObjectWEAP.h:202
std::uint8_t pad13
Definition: TESObjectWEAP.h:205
std::uint32_t pad14
Definition: TESObjectWEAP.h:206
Definition: TESObjectWEAP.h:113
float minRange
Definition: TESObjectWEAP.h:172
float animationAttackMult
Definition: TESObjectWEAP.h:174
RangedData * rangedData
Definition: TESObjectWEAP.h:169
REX::EnumSet< AttackAnimation, std::uint8_t > attackAnimation
Definition: TESObjectWEAP.h:182
REX::EnumSet< Flag, std::uint8_t > flags
Definition: TESObjectWEAP.h:185
float staggerValue
Definition: TESObjectWEAP.h:176
REX::EnumSet< ActorValue, std::uint32_t > skill
Definition: TESObjectWEAP.h:178
REX::EnumSet< WEAPON_TYPE, std::uint8_t > animationType
Definition: TESObjectWEAP.h:184
std::uint8_t unk37
Definition: TESObjectWEAP.h:186
float maxRange
Definition: TESObjectWEAP.h:173
Flag
Definition: TESObjectWEAP.h:156
REX::EnumSet< Flag2, std::uint16_t > flags2
Definition: TESObjectWEAP.h:180
REX::EnumSet< ActorValue, std::uint32_t > resistance
Definition: TESObjectWEAP.h:179
REX::EnumSet< WEAPONHITBEHAVIOR, std::uint32_t > hitBehavior
Definition: TESObjectWEAP.h:177
Flag2
Definition: TESObjectWEAP.h:116
std::uint8_t baseVATSToHitChance
Definition: TESObjectWEAP.h:181
float reach
Definition: TESObjectWEAP.h:171
float damageToWeaponMult
Definition: TESObjectWEAP.h:175
float speed
Definition: TESObjectWEAP.h:170
REX::EnumSet< ActorValue, std::uint8_t > embeddedWeaponAV
Definition: TESObjectWEAP.h:183
AttackAnimation
Definition: TESObjectWEAP.h:134
Definition: TESObjectWEAP.h:97
float sightFOV
Definition: TESObjectWEAP.h:100
std::int8_t numProjectiles
Definition: TESObjectWEAP.h:106
std::uint8_t pad19
Definition: TESObjectWEAP.h:107
float fireRate
Definition: TESObjectWEAP.h:101
float firingRumbleRightMotorStrength
Definition: TESObjectWEAP.h:103
float firingRumbleDuration
Definition: TESObjectWEAP.h:104
std::uint16_t pad1A
Definition: TESObjectWEAP.h:108
float firingRumbleLeftMotorStrength
Definition: TESObjectWEAP.h:102
float attackShotsPerSec
Definition: TESObjectWEAP.h:105
Definition: TESObjectWEAP.h:86
RecordFlag
Definition: TESObjectWEAP.h:88
@ kIgnored
Definition: TESObjectWEAP.h:92
@ kDeleted
Definition: TESObjectWEAP.h:91
@ kHasInheritedFromTemplate
Definition: TESObjectWEAP.h:90
@ kNonPlayable
Definition: TESObjectWEAP.h:89
Definition: TESObjectWEAP.h:211
TESEffectShader * unk28
Definition: TESObjectWEAP.h:215
TESModel unk00
Definition: TESObjectWEAP.h:214
Definition: TESObjectWEAP.h:43
WEAPON_TYPE
Definition: TESObjectWEAP.h:45
@ kHandToHandMelee
Definition: TESObjectWEAP.h:46
@ kOneHandMace
Definition: TESObjectWEAP.h:50
@ kTotal
Definition: TESObjectWEAP.h:57
@ kOneHandSword
Definition: TESObjectWEAP.h:47
@ kTwoHandAxe
Definition: TESObjectWEAP.h:52
@ kTwoHandSword
Definition: TESObjectWEAP.h:51
@ kBow
Definition: TESObjectWEAP.h:53
@ kOneHandDagger
Definition: TESObjectWEAP.h:48
@ kCrossbow
Definition: TESObjectWEAP.h:55
@ kStaff
Definition: TESObjectWEAP.h:54
@ kOneHandAxe
Definition: TESObjectWEAP.h:49