CommonLibVR
TESAmmo.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BGSKeywordForm.h"
5 #include "RE/B/BGSMessageIcon.h"
7 #include "RE/F/FormTypes.h"
8 #include "RE/T/TESBoundObject.h"
9 #include "RE/T/TESDescription.h"
10 #include "RE/T/TESFullName.h"
11 #include "RE/T/TESIcon.h"
13 #include "RE/T/TESValueForm.h"
14 #include "RE/T/TESWeightForm.h"
15 
16 namespace RE
17 {
18  struct AMMO_DATA // DATA
19  {
20  public:
21  enum class Flag
22  {
23  kNone = 0,
25  kNonPlayable = 1 << 1,
26  kNonBolt = 1 << 2
27  };
28 
29  // members
32  std::uint8_t pa09; // 09
33  std::uint16_t pa0A; // 0A
34  float damage; // 0C
35  };
36  static_assert(sizeof(AMMO_DATA) == 0x10);
37 
38  class TESAmmo :
39  public TESBoundObject, // 000
40  public TESFullName, // 030
41  public TESModelTextureSwap, // 040
42  public TESIcon, // 078
43  public BGSMessageIcon, // 088
44  public TESValueForm, // 0A0
45 #ifndef SKYRIMVR
46  public TESWeightForm, // 0B0
47 #endif
48  public BGSDestructibleObjectForm, // 0C0
49  public BGSPickupPutdownSounds, // 0D0
50  public TESDescription, // 0E8
51  public BGSKeywordForm // 0F8
52  {
53  public:
54  inline static constexpr auto RTTI = RTTI_TESAmmo;
55  inline static constexpr auto VTABLE = VTABLE_TESAmmo;
56  inline static constexpr auto FORMTYPE = FormType::Ammo;
57 
58  struct RecordFlags
59  {
60  enum RecordFlag : std::uint32_t
61  {
62  kNonPlayable = 1 << 2,
63  kDeleted = 1 << 5,
64  kIgnored = 1 << 12
65  };
66  };
67 
68  ~TESAmmo() override; // 00
69 
70  // override (TESBoundObject)
71  void InitializeData() override; // 04
72  bool Load(TESFile* a_mod) override; // 06
73  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
74  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
75  void InitItemImpl() override; // 13
76  bool GetPlayable() const override; // 19 - { return ~((data.flags >> 1) & 1); }
77  NiAVObject* Clone3D(TESObjectREFR* a_ref, bool a_arg3) override; // 40
78  void HandleRemoveItemFromContainer(TESObjectREFR* a_container) override; // 4E
79 
80  // override (BGSKeywordForm)
81  [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05
82 
84  bool IsBolt();
85 
86  // members
87  AMMO_DATA data; // 110 - DATA
88  BSFixedString shortDesc; // 120 - ONAM
89  private:
90  KEEP_FOR_RE()
91  };
92 #ifndef SKYRIMVR
93  static_assert(sizeof(TESAmmo) == 0x128);
94 #else
95  static_assert(sizeof(TESAmmo) == 0x118);
96 #endif
97 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: BGSDestructibleObjectForm.h:61
Definition: BGSKeywordForm.h:12
Definition: BGSKeyword.h:10
Definition: BGSLoadFormBuffer.h:11
Definition: BGSMessageIcon.h:9
Definition: BGSPickupPutdownSounds.h:10
Definition: BGSProjectile.h:79
Definition: BGSSaveFormBuffer.h:8
Definition: NiAVObject.h:57
Definition: TESAmmo.h:52
void InitItemImpl() override
bool GetPlayable() const override
static constexpr auto RTTI
Definition: TESAmmo.h:54
BSFixedString shortDesc
Definition: TESAmmo.h:88
void HandleRemoveItemFromContainer(TESObjectREFR *a_container) override
static constexpr auto VTABLE
Definition: TESAmmo.h:55
bool IgnoresNormalWeaponResistance()
void SaveGame(BGSSaveFormBuffer *a_buf) override
NiAVObject * Clone3D(TESObjectREFR *a_ref, bool a_arg3) override
void InitializeData() override
BGSKeyword * GetDefaultKeyword() const override
bool IsBolt()
static constexpr auto FORMTYPE
Definition: TESAmmo.h:56
~TESAmmo() override
AMMO_DATA data
Definition: TESAmmo.h:87
bool Load(TESFile *a_mod) override
void LoadGame(BGSLoadFormBuffer *a_buf) override
Definition: TESBoundObject.h:26
Definition: TESDescription.h:12
Definition: TESFile.h:17
Definition: TESFullName.h:9
Definition: TESIcon.h:8
Definition: TESModelTextureSwap.h:10
Definition: TESObjectREFR.h:113
Definition: TESValueForm.h:8
Definition: TESWeightForm.h:8
Definition: AbsorbEffect.h:6
constexpr std::array< REL::ID, 11 > VTABLE_TESAmmo
Definition: Offsets_VTABLE.h:12802
constexpr REL::ID RTTI_TESAmmo(static_cast< std::uint64_t >(513901))
Definition: TESAmmo.h:19
BGSProjectile * projectile
Definition: TESAmmo.h:30
Flag
Definition: TESAmmo.h:22
stl::enumeration< Flag, std::uint8_t > flags
Definition: TESAmmo.h:31
std::uint16_t pa0A
Definition: TESAmmo.h:33
float damage
Definition: TESAmmo.h:34
std::uint8_t pa09
Definition: TESAmmo.h:32
Definition: TESAmmo.h:59
RecordFlag
Definition: TESAmmo.h:61
@ kIgnored
Definition: TESAmmo.h:64
@ kDeleted
Definition: TESAmmo.h:63
@ kNonPlayable
Definition: TESAmmo.h:62