CommonLibSSE NG
Loading...
Searching...
No Matches
TESAmmo.h
Go to the documentation of this file.
1#pragma once
2
7#include "RE/F/FormTypes.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
16namespace 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#ifndef ENABLE_SKYRIM_VR
45 public TESValueForm, // 0A0
46 public TESWeightForm, // 0B0
47 public BGSDestructibleObjectForm, // 0C0
48 public BGSPickupPutdownSounds, // 0D0
49 public TESDescription, // 0E8
50 public BGSKeywordForm // 0F8
51#elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
52 public TESValueForm, // 0A0
53 public BGSDestructibleObjectForm, // 0B0
54 public BGSPickupPutdownSounds, // 0C0
55 public TESDescription, // 0D8
56 public BGSKeywordForm // 0E8
57#else
58 public TESValueForm // 0A0
59#endif
60 {
61 public:
62 inline static constexpr auto RTTI = RTTI_TESAmmo;
63 inline static constexpr auto VTABLE = VTABLE_TESAmmo;
64 inline static constexpr auto FORMTYPE = FormType::Ammo;
65
67 {
68 enum RecordFlag : std::uint32_t
69 {
70 kNonPlayable = 1 << 2,
71 kDeleted = 1 << 5,
72 kIgnored = 1 << 12
73 };
74 };
75
77 {
78#define RUNTIME_DATA_CONTENT \
79 AMMO_DATA data; /* 00 - DATA */ \
80 BSFixedString shortDesc; /* 10 - ONAM */
81
83 };
84 static_assert(sizeof(RUNTIME_DATA) == 0x18);
85
86 ~TESAmmo() override; // 00
87
88 // override (TESBoundObject)
89 void InitializeData() override; // 04
90 bool Load(TESFile* a_mod) override; // 06
91 void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
92 void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
93 void InitItemImpl() override; // 13
94 bool GetPlayable() const override; // 19 - { return ~((data.flags >> 1) & 1); }
95 NiAVObject* Clone3D(TESObjectREFR* a_ref, bool a_arg3) override; // 40
96 void HandleRemoveItemFromContainer(TESObjectREFR* a_container) override; // 4E
97
98#ifndef ENABLE_SKYRIM_VR
99 // override (BGSKeywordForm)
100 [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05
101#endif
102
104 bool IsBolt();
105
106 [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
107 {
108 return REL::RelocateMember<RUNTIME_DATA>(this, 0x110, 0x100);
109 }
110
111 [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
112 {
113 return REL::RelocateMember<RUNTIME_DATA>(this, 0x110, 0x100);
114 }
115
117 {
118 return &REL::RelocateMember<BGSDestructibleObjectForm>(this, 0xC0, 0xB0);
119 }
120
121 [[nodiscard]] inline const BGSDestructibleObjectForm* AsDestructibleObjectForm() const noexcept
122 {
123 return &REL::RelocateMember<BGSDestructibleObjectForm>(this, 0xC0, 0xB0);
124 }
125
126 [[nodiscard]] inline BGSPickupPutdownSounds* AsPickupPutdownSoundsForm() noexcept
127 {
128 return &REL::RelocateMember<BGSPickupPutdownSounds>(this, 0xD0, 0xC0);
129 }
130
131 [[nodiscard]] inline const BGSPickupPutdownSounds* AsPickupPutdownSoundsForm() const noexcept
132 {
133 return &REL::RelocateMember<BGSPickupPutdownSounds>(this, 0xD0, 0xC0);
134 }
135
136 [[nodiscard]] inline TESDescription* AsDescriptionForm() noexcept
137 {
138 return &REL::RelocateMember<TESDescription>(this, 0xE8, 0xD8);
139 }
140
141 [[nodiscard]] inline const TESDescription* AsDescriptionForm() const noexcept
142 {
143 return &REL::RelocateMember<TESDescription>(this, 0xE8, 0xD8);
144 }
145
146 [[nodiscard]] inline BGSKeywordForm* AsKeywordForm() noexcept
147 {
148 return &REL::RelocateMember<BGSKeywordForm>(this, 0xF8, 0xE8);
149 }
150
151 [[nodiscard]] inline const BGSKeywordForm* AsKeywordForm() const noexcept
152 {
153 return &REL::RelocateMember<BGSKeywordForm>(this, 0xF8, 0xE8);
154 }
155
156 // members
157 RUNTIME_DATA_CONTENT // 110, 100
158 };
159#ifndef ENABLE_SKYRIM_VR
160 static_assert(sizeof(TESAmmo) == 0x128);
161#elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
162 static_assert(sizeof(TESAmmo) == 0x118);
163#endif
164}
#define RUNTIME_DATA_CONTENT
Definition Actor.h:633
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 NiAVObject.h:50
Definition TESAmmo.h:60
void InitItemImpl() override
NiAVObject * Clone3D(TESObjectREFR *a_ref, bool a_arg3) override
const BGSDestructibleObjectForm * AsDestructibleObjectForm() const noexcept
Definition TESAmmo.h:121
bool GetPlayable() const override
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition TESAmmo.h:111
static constexpr auto RTTI
Definition TESAmmo.h:62
void HandleRemoveItemFromContainer(TESObjectREFR *a_container) override
static constexpr auto VTABLE
Definition TESAmmo.h:63
bool IgnoresNormalWeaponResistance()
const BGSKeywordForm * AsKeywordForm() const noexcept
Definition TESAmmo.h:151
void SaveGame(BGSSaveFormBuffer *a_buf) override
BGSPickupPutdownSounds * AsPickupPutdownSoundsForm() noexcept
Definition TESAmmo.h:126
void InitializeData() override
BGSDestructibleObjectForm * AsDestructibleObjectForm() noexcept
Definition TESAmmo.h:116
RUNTIME_DATA & GetRuntimeData() noexcept
Definition TESAmmo.h:106
bool IsBolt()
static constexpr auto FORMTYPE
Definition TESAmmo.h:64
BGSKeyword * GetDefaultKeyword() const override
~TESAmmo() override
const TESDescription * AsDescriptionForm() const noexcept
Definition TESAmmo.h:141
TESDescription * AsDescriptionForm() noexcept
Definition TESAmmo.h:136
bool Load(TESFile *a_mod) override
BGSKeywordForm * AsKeywordForm() noexcept
Definition TESAmmo.h:146
void LoadGame(BGSLoadFormBuffer *a_buf) override
const BGSPickupPutdownSounds * AsPickupPutdownSoundsForm() const noexcept
Definition TESAmmo.h:131
Definition TESBoundObject.h:24
Definition TESDescription.h:12
Definition TESFile.h:15
Definition TESFullName.h:9
Definition TESIcon.h:8
Definition TESModelTextureSwap.h:10
Definition TESObjectREFR.h:112
Definition TESValueForm.h:8
Definition TESWeightForm.h:8
Definition PCH.h:223
Definition AbsorbEffect.h:6
constexpr std::array< REL::VariantID, 11 > VTABLE_TESAmmo
Definition Offsets_VTABLE.h:486
constexpr REL::VariantID RTTI_TESAmmo(513901, 392439, 0x1ed9708)
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:77
Definition TESAmmo.h:67
RecordFlag
Definition TESAmmo.h:69
@ kIgnored
Definition TESAmmo.h:72
@ kDeleted
Definition TESAmmo.h:71
@ kNonPlayable
Definition TESAmmo.h:70