CommonLibSSE (powerof3)
Loading...
Searching...
No Matches
Projectile.h
Go to the documentation of this file.
1#pragma once
2
4#include "RE/B/BSAtomic.h"
8#include "RE/B/BSTList.h"
9#include "RE/B/BSTSingleton.h"
11#include "RE/F/FormTypes.h"
12#include "RE/I/ImpactResults.h"
13#include "RE/N/NiSmartPointer.h"
14#include "RE/N/NiTransform.h"
15#include "RE/T/TESObjectREFR.h"
16
17namespace RE
18{
19 class Actor;
20 class bhkCollisionObject;
21 class bhkShape;
22 class bhkSimpleShapePhantom;
23 class BGSMaterialType;
24 class BSLight;
25 class CombatController;
26 class MagicItem;
27 class QueuedFile;
28
30 {
31 public:
32 inline static constexpr auto RTTI = RTTI_Projectile;
33 inline static constexpr auto VTABLE = VTABLE_Projectile;
34
36 {
37 public:
38 // members
41 float wobble; // 28
42 };
43 static_assert(sizeof(WobbleControl) == 0x2C);
44
57
59 {
60 public:
61 // members
62 float x;
63 float z;
64 };
65 static_assert(sizeof(ProjectileRot) == 0x08);
66
68 {
69 public:
70 inline static constexpr auto RTTI = RTTI_Projectile__LaunchData;
71 inline static constexpr auto VTABLE = VTABLE_Projectile__LaunchData;
72
73 virtual ~LaunchData() = default;
74
75 LaunchData() = default;
76 LaunchData(BGSProjectile* a_bproj, Actor* a_shooter, const NiPoint3& a_origin, const ProjectileRot& a_angles);
77 LaunchData(Actor* a_shooter, const NiPoint3& a_origin, const ProjectileRot& a_angles, MagicItem* a_spell);
78 LaunchData(Actor* a_shooter, const NiPoint3& a_origin, const ProjectileRot& a_angles, TESAmmo* a_ammo, TESObjectWEAP* a_weap);
79
80 // members
88 float angleZ; // 48
89 float angleX; // 4C
90 void* unk50; // 50 - maps to Projectile unk110
92 float unk60; // 60 - maps to Projectile unk1A8
93 float unk64; // 64 - maps to Projectile unk1AC
97 std::uint32_t pad7C; // 7C
100 std::int32_t area; // 90
101 float power; // 94
102 float scale; // 98
103 bool alwaysHit; // 9C
105 bool autoAim; // 9E
106 bool chainShatter; // 9F
107 bool useOrigin; // A0
109 bool forceConeOfFire; // A2
110 };
111 static_assert(sizeof(LaunchData) == 0xA8);
112
114 {
115 public:
116 // members
122 std::int32_t damageRootNodeType; // 30
126 std::uint16_t unk44; // 44
127 std::uint16_t unk46; // 46
128 std::uint8_t unk48; // 48
129 std::uint8_t unk49; // 49
130 };
131 static_assert(sizeof(ImpactData) == 0x50);
132
133 enum class Flags
134 {
135 kNone = 0,
136 kUnk0 = 1 << 0,
137 kNotAddThreat = 1 << 1,
138 kUnk2 = 1 << 2,
139 kUnk3 = 1 << 3,
140 kIsTracer = 1 << 4,
141 kFading = 1 << 5,
142 kGravityUpdateModel = 1 << 6,
143 kUnk7 = 1 << 7,
144 kInited = 1 << 8,
145 kChainShatter = 1 << 9,
146 kUnk10 = 1 << 10,
147 kUnk11 = 1 << 11,
148 kAlwaysHit = 1 << 12,
149 kHitScan = 1 << 13,
150 kUnk14 = 1 << 14,
151 kDestroyAfterHit = 1 << 15,
152 kAddedToManager = 1 << 16,
153 kNoDamageOutsideCombat = 1 << 17,
154 kCanStartTrails = 1 << 18,
155 kAggressiveActor = 1 << 19,
157 kAutoAim = 1 << 21,
158 kProcessedImpacts = 1 << 22,
159 kUnk23 = 1 << 23,
160 kUnk24 = 1 << 24,
161 kDestroyed = 1 << 25,
162 kUnk26 = 1 << 26,
163 kUnk27 = 1 << 27,
164 kIsDual = 1 << 28,
165 kUseOrigin = 1 << 29,
166 kUnk30 = 1 << 30,
167 kMoved = 1 << 31
168 };
169
170 ~Projectile() override; // 00
171
172 // override (TESObjectREFR)
173 bool Load(TESFile* a_mod) override; // 06 - { return TESObjectREFR::Load(a_mod); }
174 void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
175 void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
176 void InitLoadGame(BGSLoadFormBuffer* a_buf) override; // 10
177 void FinishLoadGame(BGSLoadFormBuffer* a_buf) override; // 11
178 void Revert(BGSLoadFormBuffer* a_buf) override; // 12
179 bool GetAllowPromoteToPersistent() const override; // 47 - { return false; }
180 bool HasKeywordHelper(const BGSKeyword* a_keyword) const override; // 48
181 void SetActorCause(ActorCause* a_cause) override; // 50 - { actorCause = a_cause; }
182 ActorCause* GetActorCause() const override; // 51 - { return actorCause; }
184 bool DetachHavok(NiAVObject* a_obj3D) override; // 65
185 void InitHavok() override; // 66
186 NiAVObject* Load3D(bool a_backgroundLoading) override; // 6A
187 void Set3D(NiAVObject* a_object, bool a_queue3DTasks = true) override; // 6C
188 void MoveHavok(bool a_forceRec) override; // 85 - { return; }
189 void GetLinearVelocity(NiPoint3& a_velocity) const override; // 86
190 NiNode* GetFireNode() override; // 8B
191 Projectile* AsProjectile() override; // 8F - { return this; }
192 bool OnAddCellPerformQueueReference(TESObjectCELL& a_cell) const override; // 90 - { return false; }
193
194 // add
195 virtual bool IsMissileProjectile(); // A2 - { return 0; }
196 virtual bool IsGrenadeProjectile(); // A3 - { return 0; }
197 virtual bool IsFlameProjectile(); // A4 - { return 0; }
198 virtual bool IsBeamProjectile(); // A5 - { return 0; }
199 virtual void Unk_A6(void); // A6 - { return 0; }
200 virtual bool IsBarrierProjectile(); // A7 - { return 0; }
201 virtual void OnKill(); // A8 - { return; }
202 virtual void Process3D(); // A9 - { return; }
203 virtual void PostLoad3D(NiAVObject* a_root); // AA
204 virtual void UpdateImpl(float a_delta) = 0; // AB
205 virtual bool ProcessImpacts(); // AC
206 virtual void Update3D(); // AD
207 virtual void Unk_AE(void); // AE - { return 0; }
208 virtual float GetPowerSpeedMult() const; // AF - { if (unk158) return 1.0; else return unk188; } - "float GetSpeed()"?
209 virtual float GetWeaponSpeedMult() const; // B0 - { return 1.0; }
210 virtual bool GetStopMainSoundAfterImpact(); // B1 - { return 0; }
211 virtual void ReportHavokDeactivation(); // B2 - { return; }
212 virtual bool TurnOff(Actor* a_owner, bool a_noDeactivateSound); // B3
213 virtual bool IsPermanent() const; // B4 - { return TESDataHandler::GetSingleton()->IsGeneratedFormID(formID) == 0; }
214 virtual float GetGravity(); // B5 - { void* var = unk40; if ((var->unk80 >> 17) & 1) return 1.0; else return var->unk84; }
215 virtual void CleanUpPointersOnDisable(); // B6
216 virtual bool RunTargetPick(); // B7
217 virtual bool GetKillOnCollision(); // B8 - { return 1; }
218 virtual bool ShouldBeLimited(); // B9 - { return 0; }
219 virtual bool TargetsWholeBody(); // BA - { return 0; }
220 virtual std::uint32_t GetCollisionGroup(); // BB
221 virtual bhkShape* GetCollisionShape(); // BC
222 virtual void AddImpact(TESObjectREFR* a_ref, const NiPoint3& a_targetLoc, const NiPoint3& a_velocity, hkpCollidable* a_collidable, std::int32_t a_arg6, std::uint32_t a_arg7); // BD
223 virtual bool HandleHits(hkpCollidable* a_collidable); // BE
224 virtual void OnTriggerEnter(); // BF - { return; }
225 virtual void Handle3DLoaded(); // C0 - { return; }
226 virtual bool ShouldUseDesiredTarget(); // C1 - { return 0; }
227
229 float GetHeight() const;
230 float GetSpeed() const;
231
232 static ProjectileHandle* Launch(ProjectileHandle* a_result, LaunchData& a_data) noexcept;
233 static ProjectileHandle* LaunchSpell(ProjectileHandle* a_result, Actor* a_shooter, SpellItem* a_spell, const NiPoint3& a_origin, const ProjectileRot& a_angles) noexcept;
234 static ProjectileHandle* LaunchSpell(ProjectileHandle* a_result, Actor* a_shooter, SpellItem* a_spell, MagicSystem::CastingSource a_source) noexcept;
235 static ProjectileHandle* LaunchArrow(ProjectileHandle* a_result, Actor* a_shooter, TESAmmo* a_ammo, TESObjectWEAP* a_weap, const NiPoint3& a_origin, const ProjectileRot& a_angles) noexcept;
236 static ProjectileHandle* LaunchArrow(ProjectileHandle* a_result, Actor* a_shooter, TESAmmo* a_ammo, TESObjectWEAP* a_weap) noexcept;
237
238 // members
241 float unk0DC; // 0DC
242 bhkSimpleShapePhantom* unk0E0; // 0E0 - smart ptr
243 mutable BSSpinLock unk0E8; // 0E8
246 NiPointer<BSLight> light; // 108 - smart ptr
247 void* unk110; // 110 - smart ptr
253 std::uint32_t* unk140; // 140
258 std::uint32_t pad164; // 164
262 std::uint64_t unk180; // 180
263 float power; // 188
264 float speedMult; // 18C
265 float range; // 190
266 float livingTime; // 194
267 float weaponDamage; // 198
268 float transparency; // 19C - for beam disappearing
269 float explosionTimer; // 1A0
270 std::uint32_t unk1A4; // 1A4
271 float unk1A8; // 1A8 - 0.0f
272 float unk1AC; // 1AC - 0.0f
275 float distanceMoved; // 1C0
276 std::uint32_t pad_1C4; // 1C4
277 float scale; // 1C8 - for double cast model scale
279 bool unk1D0; // 1D0
280 bool unk1D1; // 1D0
281 char unk1D2[6]; // 1D2
282 };
283#ifndef SKYRIM_SUPPORT_AE
284 static_assert(sizeof(Projectile) == 0x1D8);
285#else
286 static_assert(sizeof(Projectile) == 0x1E0);
287#endif
288}
Definition EnumSet.h:9
Definition ActorCause.h:9
Definition Actor.h:133
Definition AlchemyItem.h:24
Definition BGSExplosion.h:53
Definition BGSKeyword.h:10
Definition BGSLoadFormBuffer.h:11
Definition BGSMaterialType.h:12
Definition BGSProjectile.h:79
Definition BGSSaveFormBuffer.h:8
Definition BSTList.h:10
Definition BSAtomic.h:92
Definition BSTArray.h:378
Definition CombatController.h:23
Definition EffectSetting.h:24
Definition EnchantmentItem.h:10
Definition InventoryEntryData.h:15
Definition MagicCaster.h:25
Definition MagicItem.h:30
Definition NiAVObject.h:51
Definition NiMatrix3.h:8
Definition NiNode.h:12
Definition NiPoint3.h:6
Definition NiSmartPointer.h:9
Definition NiTransform.h:9
Definition Projectile.h:46
BSTArray< WobbleControl > wobble
Definition Projectile.h:55
BSTArray< ProjectileHandle > pending
Definition Projectile.h:53
static Manager * GetSingleton()
BSTArray< ProjectileHandle > limited
Definition Projectile.h:52
BSTArray< ProjectileHandle > unlimited
Definition Projectile.h:51
BSSpinLock projectileLock
Definition Projectile.h:54
Definition Projectile.h:30
NiPointer< ActorCause > actorCause
Definition Projectile.h:248
BGSExplosion * explosion
Definition Projectile.h:255
~Projectile() override
ModelDBHandle muzzleFlashDBHandle
Definition Projectile.h:261
virtual void Handle3DLoaded()
Flags
Definition Projectile.h:134
virtual float GetPowerSpeedMult() const
float GetSpeed() const
ObjectRefHandle shooter
Definition Projectile.h:249
void InitLoadGame(BGSLoadFormBuffer *a_buf) override
static ProjectileHandle * LaunchArrow(ProjectileHandle *a_result, Actor *a_shooter, TESAmmo *a_ammo, TESObjectWEAP *a_weap) noexcept
float livingTime
Definition Projectile.h:266
bool GetAllowPromoteToPersistent() const override
NiPointer< QueuedFile > projectileDBFiles
Definition Projectile.h:260
void * unk110
Definition Projectile.h:247
ObjectRefHandle desiredTarget
Definition Projectile.h:250
virtual bool IsBarrierProjectile()
BGSProjectile * GetProjectileBase() const
virtual bool ShouldUseDesiredTarget()
float speedMult
Definition Projectile.h:264
EffectSetting * avEffect
Definition Projectile.h:259
void MoveHavok(bool a_forceRec) override
float explosionTimer
Definition Projectile.h:269
NiNode * GetFireNode() override
std::uint32_t * unk140
Definition Projectile.h:253
virtual void ReportHavokDeactivation()
float range
Definition Projectile.h:265
virtual void PostLoad3D(NiAVObject *a_root)
void LoadGame(BGSLoadFormBuffer *a_buf) override
virtual bool TargetsWholeBody()
static ProjectileHandle * LaunchSpell(ProjectileHandle *a_result, Actor *a_shooter, SpellItem *a_spell, const NiPoint3 &a_origin, const ProjectileRot &a_angles) noexcept
virtual float GetWeaponSpeedMult() const
virtual void OnTriggerEnter()
NiPoint3 linearVelocity
Definition Projectile.h:245
float distanceMoved
Definition Projectile.h:275
std::uint64_t unk180
Definition Projectile.h:262
void FinishLoadGame(BGSLoadFormBuffer *a_buf) override
virtual bool GetKillOnCollision()
virtual std::uint32_t GetCollisionGroup()
float weaponDamage
Definition Projectile.h:267
virtual float GetGravity()
bool Load(TESFile *a_mod) override
virtual bool TurnOff(Actor *a_owner, bool a_noDeactivateSound)
virtual bool GetStopMainSoundAfterImpact()
void Set3D(NiAVObject *a_object, bool a_queue3DTasks=true) override
virtual void CleanUpPointersOnDisable()
float unk1A8
Definition Projectile.h:271
NiAVObject * Load3D(bool a_backgroundLoading) override
virtual bhkShape * GetCollisionShape()
virtual bool ProcessImpacts()
std::uint32_t unk1A4
Definition Projectile.h:270
float transparency
Definition Projectile.h:268
virtual bool IsGrenadeProjectile()
virtual void Update3D()
std::uint32_t pad164
Definition Projectile.h:258
virtual void Process3D()
static constexpr auto RTTI
Definition Projectile.h:32
BSSoundHandle sndCountdown
Definition Projectile.h:252
BSSimpleList< ImpactData * > impacts
Definition Projectile.h:239
virtual bool IsPermanent() const
bool unk1D1
Definition Projectile.h:280
void SaveGame(BGSSaveFormBuffer *a_buf) override
virtual bool ShouldBeLimited()
virtual bool IsBeamProjectile()
virtual bool IsMissileProjectile()
char unk1D2[6]
Definition Projectile.h:281
NiPoint3 velocity
Definition Projectile.h:244
static ProjectileHandle * Launch(ProjectileHandle *a_result, LaunchData &a_data) noexcept
static ProjectileHandle * LaunchSpell(ProjectileHandle *a_result, Actor *a_shooter, SpellItem *a_spell, MagicSystem::CastingSource a_source) noexcept
NiPointer< BSLight > light
Definition Projectile.h:246
REX::EnumSet< Flags, std::uint32_t > flags
Definition Projectile.h:278
virtual bool HandleHits(hkpCollidable *a_collidable)
BSSpinLock unk0E8
Definition Projectile.h:243
bool OnAddCellPerformQueueReference(TESObjectCELL &a_cell) const override
bhkSimpleShapePhantom * unk0E0
Definition Projectile.h:242
virtual void Unk_A6(void)
virtual void Unk_AE(void)
float GetHeight() const
virtual bool RunTargetPick()
InventoryEntryData * unk148
Definition Projectile.h:254
static constexpr auto VTABLE
Definition Projectile.h:33
MagicSystem::CastingSource castingSource
Definition Projectile.h:257
void SetActorCause(ActorCause *a_cause) override
void InitHavok() override
bool DetachHavok(NiAVObject *a_obj3D) override
static ProjectileHandle * LaunchArrow(ProjectileHandle *a_result, Actor *a_shooter, TESAmmo *a_ammo, TESObjectWEAP *a_weap, const NiPoint3 &a_origin, const ProjectileRot &a_angles) noexcept
BSSoundHandle sndHandle
Definition Projectile.h:251
bool HasKeywordHelper(const BGSKeyword *a_keyword) const override
TESAmmo * ammoSource
Definition Projectile.h:274
virtual void AddImpact(TESObjectREFR *a_ref, const NiPoint3 &a_targetLoc, const NiPoint3 &a_velocity, hkpCollidable *a_collidable, std::int32_t a_arg6, std::uint32_t a_arg7)
void GetLinearVelocity(NiPoint3 &a_velocity) const override
MagicCaster * GetMagicCaster(MagicSystem::CastingSource a_source) override
Projectile * AsProjectile() override
float unk0DC
Definition Projectile.h:241
NiTransform unk0A8
Definition Projectile.h:240
void Revert(BGSLoadFormBuffer *a_buf) override
virtual void OnKill()
ActorCause * GetActorCause() const override
float unk1AC
Definition Projectile.h:272
virtual void UpdateImpl(float a_delta)=0
TESObjectWEAP * weaponSource
Definition Projectile.h:273
float scale
Definition Projectile.h:277
MagicItem * spell
Definition Projectile.h:256
float power
Definition Projectile.h:263
virtual bool IsFlameProjectile()
bool unk1D0
Definition Projectile.h:279
std::uint32_t pad_1C4
Definition Projectile.h:276
Definition SpellItem.h:16
Definition TESAmmo.h:50
Definition TESFile.h:17
Definition TESObjectCELL.h:115
Definition TESObjectREFR.h:114
Definition TESObjectWEAP.h:79
Definition bhkShape.h:10
Definition hkpCollidable.h:13
CastingSource
Definition MagicSystem.h:27
Definition AbsorbEffect.h:6
constexpr std::array< REL::ID, 4 > VTABLE_Projectile
Definition Offsets_VTABLE.h:12566
ImpactResult
Definition ImpactResults.h:6
constexpr REL::ID RTTI_Projectile(static_cast< std::uint64_t >(514046))
constexpr REL::ID RTTI_Projectile__LaunchData(static_cast< std::uint64_t >(684852))
constexpr std::array< REL::ID, 1 > VTABLE_Projectile__LaunchData
Definition Offsets_VTABLE.h:12568
Definition BSSoundHandle.h:10
Definition BSTSingleton.h:50
Definition Projectile.h:114
BGSMaterialType * material
Definition Projectile.h:121
std::int32_t damageRootNodeType
Definition Projectile.h:122
NiPoint3 desiredTargetLoc
Definition Projectile.h:117
REX::EnumSet< COL_LAYER, std::int32_t > collidedLayer
Definition Projectile.h:123
std::uint16_t unk46
Definition Projectile.h:127
NiPointer< bhkCollisionObject > colObj
Definition Projectile.h:120
ImpactResult impactResult
Definition Projectile.h:125
std::uint8_t unk49
Definition Projectile.h:129
ObjectRefHandle collidee
Definition Projectile.h:119
std::uint8_t unk48
Definition Projectile.h:128
NiPoint3 negativeVelocity
Definition Projectile.h:118
NiNode * damageRootNode
Definition Projectile.h:124
std::uint16_t unk44
Definition Projectile.h:126
Definition Projectile.h:68
static constexpr auto RTTI
Definition Projectile.h:70
bool chainShatter
Definition Projectile.h:106
EnchantmentItem * enchantItem
Definition Projectile.h:98
MagicItem * spell
Definition Projectile.h:95
float unk60
Definition Projectile.h:92
TESAmmo * ammoSource
Definition Projectile.h:87
virtual ~LaunchData()=default
TESObjectREFR * desiredTarget
Definition Projectile.h:91
float unk64
Definition Projectile.h:93
BGSProjectile * projectileBase
Definition Projectile.h:83
NiPoint3 origin
Definition Projectile.h:81
std::uint32_t pad7C
Definition Projectile.h:97
bool noDamageOutsideCombat
Definition Projectile.h:104
std::int32_t area
Definition Projectile.h:100
void * unk50
Definition Projectile.h:90
bool useOrigin
Definition Projectile.h:107
TESObjectWEAP * weaponSource
Definition Projectile.h:86
NiPoint3 contactNormal
Definition Projectile.h:82
LaunchData(Actor *a_shooter, const NiPoint3 &a_origin, const ProjectileRot &a_angles, MagicItem *a_spell)
float angleZ
Definition Projectile.h:88
float power
Definition Projectile.h:101
TESObjectREFR * shooter
Definition Projectile.h:84
float scale
Definition Projectile.h:102
MagicSystem::CastingSource castingSource
Definition Projectile.h:96
float angleX
Definition Projectile.h:89
CombatController * combatController
Definition Projectile.h:85
bool alwaysHit
Definition Projectile.h:103
LaunchData(Actor *a_shooter, const NiPoint3 &a_origin, const ProjectileRot &a_angles, TESAmmo *a_ammo, TESObjectWEAP *a_weap)
LaunchData(BGSProjectile *a_bproj, Actor *a_shooter, const NiPoint3 &a_origin, const ProjectileRot &a_angles)
bool forceConeOfFire
Definition Projectile.h:109
static constexpr auto VTABLE
Definition Projectile.h:71
bool deferInitialization
Definition Projectile.h:108
TESObjectCELL * parentCell
Definition Projectile.h:94
bool autoAim
Definition Projectile.h:105
AlchemyItem * poison
Definition Projectile.h:99
Definition Projectile.h:59
float z
Definition Projectile.h:63
float x
Definition Projectile.h:62
Definition Projectile.h:36
NiMatrix3 unk00
Definition Projectile.h:39
float wobble
Definition Projectile.h:41
ProjectileHandle handle
Definition Projectile.h:40