Skip to content

Commit

Permalink
feat: more TESForm classes and defs (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 authored Oct 28, 2023
1 parent bfaa5f6 commit f3f202d
Show file tree
Hide file tree
Showing 15 changed files with 296 additions and 34 deletions.
18 changes: 17 additions & 1 deletion CommonLibSF/include/RE/B/BGSListForm.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
#pragma once

#include "RE/B/BSTArray.h"
#include "RE/T/TESForm.h"

namespace RE
{
class BGSListForm :
public TESForm
public TESForm // 00
{
public:
SF_RTTI_VTABLE(BGSListForm);
SF_FORMTYPE(FLST);

~BGSListForm() override; // 00

// members
BSTArray<TESForm*> arrayOfForms; // 38
std::uint64_t unk48; // 48
std::uint64_t unk50; // 50
std::uint64_t unk58; // 58
std::uint64_t unk60; // 60
std::uint64_t unk68; // 68
std::uint64_t unk70; // 70
std::uint64_t unk78; // 78
BSTArray<std::uint32_t>* scriptAddedTempForms; // 80
std::uint32_t scriptAddedFormCount; // 88
};
static_assert(sizeof(BGSListForm) == 0x90);
}
20 changes: 20 additions & 0 deletions CommonLibSF/include/RE/B/BGSOutfit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

#include "RE/B/BSTArray.h"
#include "RE/T/TESForm.h"

namespace RE
{
class BGSOutfit : public TESForm
{
public:
SF_RTTI_VTABLE(BGSOutfit);
SF_FORMTYPE(OTFT);

~BGSOutfit() override; // 00

// members
BSTArray<TESForm*> outfitItems; // 38
};
static_assert(sizeof(BGSOutfit) == 0x48);
}
26 changes: 14 additions & 12 deletions CommonLibSF/include/RE/B/BGSPerk.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace RE
{
class BGSKeyword;

class BGSPerk :
public TESForm, // 00
public TESFullName, // 38
Expand All @@ -19,18 +21,18 @@ namespace RE
~BGSPerk() override; // 00

// members
std::uint16_t unk60; // 60
std::uint8_t unk62; // 62
std::uint8_t unk63; // 63
std::uint8_t unk64; // 64
std::uint64_t unk68; // 68
BSFixedStringCS unk70; // 70
BSFixedString perkIcon; // 78 - GNAM
std::uint64_t unk80; // 80
std::uint64_t unk88; // 88
std::uint64_t unk90; // 90
std::uint64_t unk98; // 98
BSTArray<void*> unkA0; // A0
std::uint16_t unk60; // 60
std::uint8_t unk62; // 62
std::uint8_t unk63; // 63
std::uint8_t unk64; // 64
BGSPerk* trainingPerk; // 68
BSFixedStringCS unk70; // 70
BSFixedString perkIcon; // 78 - GNAM
BGSKeyword* restriction; // 80
std::uint64_t unk88; // 88
std::uint64_t unk90; // 90
std::uint64_t unk98; // 98
BSTArray<void*> unkA0; // A0
};
static_assert(sizeof(BGSPerk) == 0xB0);
}
29 changes: 29 additions & 0 deletions CommonLibSF/include/RE/B/BGSTerminalMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "RE/B/BGSLocalizedString.h"
#include "RE/B/BSTArray.h"
#include "RE/T/TESForm.h"
#include "RE/T/TESFullName.h"

namespace RE
{
class BGSTerminalMenu :
public TESForm, // 00
public TESFullName // 38
{
public:
SF_RTTI_VTABLE(BGSTerminalMenu);
SF_FORMTYPE(TMLM);

~BGSTerminalMenu() override; // 00

// members
BSTArray<void*> unk48; // 48
BSTArray<void*> unk58; // 58
BGSLocalizedString unk68; // 68
std::uint64_t unk70; // 70
std::uint64_t unk78; // 78
std::uint32_t unk80; // 80
};
static_assert(sizeof(BGSTerminalMenu) == 0x88);
}
40 changes: 40 additions & 0 deletions CommonLibSF/include/RE/B/BGSVoiceType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include "RE/B/BGSEditorID.h"
#include "RE/T/TESForm.h"

namespace RE
{
class BGSKeyword;

struct VOICE_TYPE_DATA
{
public:
enum class Flag
{
kNone = 0,
kAllowDefaultDialogue = 1 << 0,
kFemale = 1 << 1
};

// members
stl::enumeration<Flag, std::uint8_t> flags; // 0
std::uint8_t unk01; // 1
};
static_assert(sizeof(VOICE_TYPE_DATA) == 0x2);

class BGSVoiceType : public TESForm
{
public:
SF_RTTI_VTABLE(BGSVoiceType);
SF_FORMTYPE(VTYP);

~BGSVoiceType() override; // 00

// members
BGSEditorID formEditorID; // 38
BGSKeyword* animationFaceArchetype; // 48
VOICE_TYPE_DATA data; // 50
};
static_assert(sizeof(BGSVoiceType) == 0x58);
}
6 changes: 6 additions & 0 deletions CommonLibSF/include/RE/IDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ namespace RE::ID
inline constexpr REL::ID GetScriptCommands{ 841467 };
}

namespace TESActorBaseData
{
inline constexpr REL::ID GetLevel{ 85868 };
inline constexpr REL::ID GetUsesLeveledTemplate{ 85873 };
}

namespace TESCellFullyLoadedEvent
{
inline constexpr REL::ID GetEventSource{ 107143 };
Expand Down
12 changes: 7 additions & 5 deletions CommonLibSF/include/RE/T/TESActorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

namespace RE
{
class TESCombatStyle;

class TESActorBase :
public TESBoundAnimObject, // 000
public TESActorBaseData, // 118
Expand All @@ -34,13 +36,13 @@ namespace RE
public:
SF_RTTI_VTABLE(TESActorBase);

~TESActorBase() override;
~TESActorBase() override; // 00

// add
virtual void Unk_82(); // 82
virtual void Unk_83(); // 83
virtual void Unk_84(); // 84
virtual void Unk_85(); // 85
virtual bool GetHasPLSpecTex() const; // 82
virtual TESCombatStyle* GetCombatStyle(); // 83
virtual void SetCombatStyle(TESCombatStyle*); // 84
virtual TESForm* GetAsForm(); // 85
};
static_assert(sizeof(TESActorBase) == 0x298);
}
55 changes: 47 additions & 8 deletions CommonLibSF/include/RE/T/TESActorBaseData.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace RE
{
class BGSVoiceType;
class TESActorBase;
class TESGlobal;
class TESLevItem;

struct alignas(0x4) ACTOR_BASE_DATA
{
Expand All @@ -30,14 +32,31 @@ namespace RE
kOppositeGenderanims = 1 << 19,
kSimpleActor = 1 << 20,
kLoopedScript = 1 << 21, // ?
kLoopedAudio = 1 << 28, // ?
kWalkStyle = 1 << 23,
kEditorDead = 1 << 25,
kLoopedAudio = 1 << 28, // ?
kIsGhost = 1 << 29,
kUnk30 = 1 << 30,
kInvulnerable = 1 << 31
};

enum class TEMPLATE_USE_FLAG
{
kNone = 0,
kTraits = 1 << 0,
kStats = 1 << 1,
kFactions = 1 << 2,
kSpells = 1 << 3,
kAIData = 1 << 4,
kAIPackages = 1 << 5,
kUnused = 1 << 6,
kBaseData = 1 << 7,
kInventory = 1 << 8,
kScript = 1 << 9,
kAIDefPackList = 1 << 10,
kAttackData = 1 << 11,
kKeywords = 1 << 12,
kCopiedTemplate = 1 << 15
};

// members
Expand All @@ -64,20 +83,40 @@ namespace RE
void InitializeDataComponent() override; // 02

// add
virtual void CopyFromTemplateForms(TESActorBase** a_forceTemplates); // 0B
virtual void Unk_0C(); // 0C
virtual void Unk_0D(); // 0D
virtual void Unk_0E(); // 0E
virtual void CopyFromTemplateForms(TESActorBase** a_forceTemplates); // 0B
[[nodiscard]] virtual bool GetIsGhost() const; // 0C
[[nodiscard]] virtual bool GetEditorDead() const; // 0D
virtual void Unk_0E(); // 0E

[[nodiscard]] constexpr bool IsEssential() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kEssential); }
[[nodiscard]] constexpr bool IsFemale() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kFemale); }
[[nodiscard]] bool IsGhost() const { return GetIsGhost(); }
[[nodiscard]] constexpr bool IsProtected() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kProtected); }
[[nodiscard]] constexpr bool IsUnique() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kUnique); }

[[nodiscard]] std::uint16_t GetLevel() const
{
using func_t = decltype(&TESActorBaseData::GetLevel);
REL::Relocation<func_t> func{ ID::TESActorBaseData::GetLevel };
return func(this);
}

[[nodiscard]] bool GetUsesLeveledTemplate(std::uint32_t a_templateUseFlag = 0xFFFFFFFF)
{
using func_t = decltype(&TESActorBaseData::GetUsesLeveledTemplate);
REL::Relocation<func_t> func{ ID::TESActorBaseData::GetUsesLeveledTemplate };
return func(this, a_templateUseFlag);
}

// members
ACTOR_BASE_DATA actorData; // 08
std::int32_t changeFlags; // 1C
BSTArray<FACTION_RANK> factions; // 20
TESForm** templateForms; // 30
std::uint64_t unk38; // 38
TESForm** unk38; // 38
TESForm* baseTemplateForm; // 40
std::uint64_t unk48; // 48
std::uint64_t unk50; // 50
TESLevItem* deathItem; // 48
TESGlobal* legendChance; // 50
TESForm* legendTemplate; // 58
BGSVoiceType* voiceType; // 60
std::uint32_t unk68; // 68
Expand Down
37 changes: 37 additions & 0 deletions CommonLibSF/include/RE/T/TESClass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once

#include "RE/B/BGSPropertySheet.h"
#include "RE/T/TESDescription.h"
#include "RE/T/TESForm.h"
#include "RE/T/TESFullName.h"
#include "RE/T/TESTexture.h"

namespace RE
{
struct CLASS_DATA
{
public:
// members
std::int32_t serviceFlags; // 0
float bleedoutDefault; // 4
};
static_assert(sizeof(CLASS_DATA) == 0x8);

class TESClass :
public TESForm, // 00
public TESFullName, // 38
public TESDescription, // 48
public TESTexture, // 60
public BGSPropertySheet // 70
{
public:
SF_RTTI_VTABLE(TESClass);
SF_FORMTYPE(CLAS);

~TESClass() override; // 00

// members
CLASS_DATA data; // 78 - DATA
};
static_assert(sizeof(TESClass) == 0x88);
}
1 change: 1 addition & 0 deletions CommonLibSF/include/RE/T/TESForm.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "RE/B/BSReflection.h"
#include "RE/F/FormTypes.h"
#include "RE/T/TESFile.h"
#include "RE/T/TESFormRefCount.h"

Expand Down
23 changes: 23 additions & 0 deletions CommonLibSF/include/RE/T/TESGlobal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include "RE/B/BGSEditorID.h"
#include "RE/T/TESForm.h"

namespace RE
{
class TESGlobal : public TESForm
{
public:
SF_RTTI_VTABLE(TESGlobal);
SF_FORMTYPE(GLOB);

~TESGlobal() override; // 00

[[nodiscard]] float GetValue() const noexcept { return value; }

// members
BGSEditorID formEditorID; // 38
float value; // 48
};
static_assert(sizeof(TESGlobal) == 0x50);
}
Loading

0 comments on commit f3f202d

Please sign in to comment.