Skip to content

Commit

Permalink
feat: BGSProjectile, Projectile classes (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 authored Nov 21, 2023
1 parent 16890e5 commit 9d7f85b
Show file tree
Hide file tree
Showing 21 changed files with 833 additions and 0 deletions.
21 changes: 21 additions & 0 deletions CommonLibSF/include/RE/A/ArrowProjectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include "RE/M/MissileProjectile.h"

namespace RE
{
class AlchemyItem;

class ArrowProjectile : public MissileProjectile
{
public:
SF_RTTI_VTABLE(ArrowProjectile);
SF_FORMTYPE(PARW);

~ArrowProjectile() override; // 00

// members
AlchemyItem* poison; // 2D0
};
static_assert(sizeof(ArrowProjectile) == 0x2E0);
}
71 changes: 71 additions & 0 deletions CommonLibSF/include/RE/B/BGSBodyPartDefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#pragma once

#include "RE/B/BSFixedString.h"

namespace RE::BGSBodyPartDefs
{
struct LIMB_CATEGORIES
{
enum LIMB_CATEGORY
{
kNone = static_cast<std::underlying_type_t<LIMB_CATEGORY>>(-1),
kTorso = 0,
kBegin,
kHead,
kArm,
kLeg,

kTotal
};
};
using LIMB_CATEGORY = LIMB_CATEGORIES::LIMB_CATEGORY;

struct LIMB_ENUMS
{
enum LIMB_ENUM
{
kNone = static_cast<std::underlying_type_t<LIMB_ENUM>>(-1),
kTorso = 0,
kHead1,
kEye1,
kLookAt1,
kFlyGrab,
kHead2,
kLeftArm1,
kLeftArm2,
kRightArm1,
kRightArm2,
kLeftLeg1,
kLeftLeg2,
kLeftLeg3,
kRightLeg1,
kRightLeg2,
kRightLeg3,
kBrain,
kWeapon,
kRoot,
kCom,
kPelvis,
kCamera,
kOffsetRoot,
kLeftFoot,
kRightFoot,
kFaceTargetSource,

kTotal
};
};
using LIMB_ENUM = LIMB_ENUMS::LIMB_ENUM;

struct HitReactionData
{
public:
// members
BSFixedString chainStart; // 00
BSFixedString chainEnd; // 08
BSFixedString variableX; // 10
BSFixedString variableY; // 18
BSFixedString variableZ; // 20
};
static_assert(sizeof(HitReactionData) == 0x28);
}
14 changes: 14 additions & 0 deletions CommonLibSF/include/RE/B/BGSEquipIndex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

namespace RE
{
class BGSEquipIndex
{
public:
~BGSEquipIndex() noexcept {}

// members
std::uint32_t index; // 0
};
static_assert(sizeof(BGSEquipIndex) == 0x4);
}
109 changes: 109 additions & 0 deletions CommonLibSF/include/RE/B/BGSProjectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#pragma once

#include "RE/B/BGSDestructibleObjectForm.h"
#include "RE/B/BGSPreloadable.h"
#include "RE/T/TESBoundObject.h"
#include "RE/T/TESFullName.h"
#include "RE/T/TESModel.h"
#include "RE/W/WwiseSoundHook.h"

namespace RE
{
class BGSCollisionLayer;
class BGSCurveForm;
class BGSExplosion;
class BGSProjectile;
class BGSTextureSet;
class TESObjectLIGH;
class TESObjectWEAP;

struct BGSProjectileData // DATA
{
public:
enum class BGSProjectileFlags
{
kNone = 0,
kHitScan = 1 << 0,
kExplosion = 1 << 1,
kExplosionAltTrigger = 1 << 2,
kMuzzleFlash = 1 << 3,
kCanTurnOff = 1 << 5,
kCanPickUp = 1 << 6,
kSupersonic = 1 << 7,
kPinsLimbs = 1 << 8,
kPassSMTransparent = 1 << 9,
kDisableCombatAimCorrection = 1 << 10,
kPenetratesGeometry = 1 << 11,
kContinuousUpdate = 1 << 12,
kSeeksTarget = 1 << 13
};

enum class Type
{
kMissile = 1 << 0,
kGrenade = 1 << 1,
kBeam = 1 << 2,
kFlamethrower = 1 << 3,
kCone = 1 << 4,
kBarrier = 1 << 5,
kArrow = 1 << 6
};

// members
BSFixedString unk00; // 00
BSFixedString unk08; // 08
TESObjectLIGH* light; // 10
TESObjectLIGH* muzzleFlashLight; // 18
BGSExplosion* explosionType; // 20
TESObjectWEAP* defaultWeaponSource; // 28
BGSTextureSet* decalData; // 30
BGSCollisionLayer* collisionLayer; // 38
BGSProjectile* vatsProjectile; // 40
stl::enumeration<BGSProjectileFlags, std::uint32_t> flags; // 48
float gravity; // 4C
float speed; // 50
float range; // 54
float explosionProximity; // 58
float explosionTimer; // 5C
float muzzleFlashDuration; // 60
float fadeOutTime; // 64
float force; // 68
float coneSpread; // 6C
float collisionRadius; // 70
float lifetime; // 74
float relaunchInterval; // 78
float unk7C; // 7C
std::uint32_t unk80; // 80
stl::enumeration<Type, std::uint8_t> type; // 84
std::uint8_t unk85; // 85
float unk88; // 88
float unk8C; // 8C
float unk90; // 90
float unk94; // 94
};
static_assert(sizeof(BGSProjectileData) == 0x98);

class BGSProjectile :
public TESBoundObject, // 000
public TESFullName, // 118
public TESModel, // 128
public BGSPreloadable, // 148
public BGSDestructibleObjectForm // 150
{
public:
SF_RTTI_VTABLE(BGSProjectile);
SF_FORMTYPE(PROJ);

~BGSProjectile() override; // 00

// members
BGSProjectileData data; // 160
TESModel muzzleFlashModel; // 1F8
BGSCurveForm* curveTable; // 218
BGSAudio::WwiseSoundHook activeSoundLoop; // 220
BGSAudio::WwiseSoundHook countdownSound; // 250
BGSAudio::WwiseSoundHook deactivateSound; // 280
std::uint32_t unk2B0; // 2B0
};
static_assert(sizeof(BGSProjectile) == 0x2B8);
}
16 changes: 16 additions & 0 deletions CommonLibSF/include/RE/B/BSTSmartPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ namespace RE
static void Release(stl::not_null<T*> a_ptr) { a_ptr->DecRefCount(); }
};

template <class T>
struct TESFormPolicy
{
public:
constexpr static void Acquire(stl::not_null<T*> a_ptr) { a_ptr->IncRefCount(); }
static void Release(stl::not_null<T*> a_ptr) { a_ptr->DecRefCount(); }
};

template <class T>
struct TESFormExternalPolicy
{
public:
constexpr static void Acquire(stl::not_null<T*> a_ptr) { a_ptr->IncExternalRefCount(); }
static void Release(stl::not_null<T*> a_ptr) { a_ptr->DecExternalRefCount(); }
};

template <class T, template <class> class RefManager = BSTSmartPointerIntrusiveRefCount>
class BSTSmartPointer
{
Expand Down
30 changes: 30 additions & 0 deletions CommonLibSF/include/RE/B/BarrierProjectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "RE/P/Projectile.h"

namespace RE
{
class BarrierProjectile : public Projectile
{
public:
SF_RTTI_VTABLE(BarrierProjectile);
SF_FORMTYPE(PBAR);

struct CollisionData
{
std::uint32_t ref; // 0 - TESPointerHandle
std::uint32_t count; // 4
};
static_assert(sizeof(CollisionData) == 0x8);

~BarrierProjectile() override; // 00

// add
virtual void Unk_15D(); // 15D

// members
float width; // 280
BSTArray<CollisionData> collisionData; // 288
};
static_assert(sizeof(BarrierProjectile) == 0x2A0);
}
36 changes: 36 additions & 0 deletions CommonLibSF/include/RE/B/BeamProjectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include "RE/B/BSTEvent.h"
#include "RE/F/FormTypes.h"
#include "RE/P/Projectile.h"

namespace RE
{
class BSProceduralGeomEvent;
struct BeamProjectileImpactEvent;

class BeamProjectile :
public Projectile, // 000
public BSTEventSource<BeamProjectileImpactEvent>, // 280
public BSTEventSink<BSProceduralGeomEvent> // 2A8
{
public:
SF_RTTI_VTABLE(BeamProjectile);
SF_FORMTYPE(PBEA);

~BeamProjectile() override; // 00

// members
void* unk2B0; // 2B0 - smart ptr
std::uint64_t unk2B8; // 2B8
ProjectileLaunchData launchData; // 2C0
std::uint64_t unk3B0; // 3B0
std::uint64_t unk3C0; // 3C0
void* unk3C8; // 3C8 - smart ptr
std::uint32_t unk3D0; // 3D0
std::uint8_t unk3D4; // 3D4
std::uint8_t unk3D5; // 3D5
std::uint8_t unk3D6; // 3D6
};
static_assert(sizeof(BeamProjectile) == 0x3E0);
}
25 changes: 25 additions & 0 deletions CommonLibSF/include/RE/C/ConeProjectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include "RE/P/Projectile.h"

namespace RE
{
class ConeProjectile : public Projectile
{
public:
SF_RTTI_VTABLE(ConeProjectile);
SF_FORMTYPE(PCON);

~ConeProjectile() override; // 00

// members
stl::enumeration<ImpactResult, std::int32_t> impactResult; // 280
float environmentTimer; // 284
float coneSpreadTangent; // 288
float initialCollisionSphereRadius; // 28C
Location origin; // 290
void* collisionShape; // 2A8
BSTArray<std::int32_t> collisions; // 2B0
};
static_assert(sizeof(ConeProjectile) == 0x2C0);
}
34 changes: 34 additions & 0 deletions CommonLibSF/include/RE/E/EmitterProjectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include "RE/P/Projectile.h"

namespace RE
{
namespace Particles
{
class SystemBinding;
}

class EmitterProjectile : public Projectile
{
public:
SF_RTTI_VTABLE(EmitterProjectile);
SF_FORMTYPE(PEMI);

~EmitterProjectile() override; // 00

// members
std::int32_t unk280; // 280
BSTSmartPointer<Particles::SystemBinding> unk288; // 288
BSTSmartPointer<Particles::SystemBinding> unk290; // 290
BSTSmartPointer<Particles::SystemBinding> unk298; // 298
bool unk2A0; // 2A0
bool unk2A1; // 2A1
std::uint64_t unk2A8; // 2A8
std::uint64_t unk2B0; // 2B0
std::uint64_t unk2B8; // 2B8
std::uint64_t unk2C0; // 2C0
std::uint64_t unk2C8; // 2C8
};
static_assert(sizeof(EmitterProjectile) == 0x2D0);
}
20 changes: 20 additions & 0 deletions CommonLibSF/include/RE/F/FlameProjectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

#include "RE/P/Projectile.h"

namespace RE
{
class FlameProjectile : public Projectile
{
public:
SF_RTTI_VTABLE(FlameProjectile);
SF_FORMTYPE(PFLA);

~FlameProjectile() override; // 00

// members
float expirationTimer; // 280
float coneAngle; // 284
};
static_assert(sizeof(FlameProjectile) == 0x290);
}
Loading

0 comments on commit 9d7f85b

Please sign in to comment.