From c58dac40daa0096ffd6ba888bce1115d12152a52 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Wed, 22 Nov 2023 01:27:02 +0530 Subject: [PATCH] feat: `TESLeveledList` and related classes (#228) --- .../include/RE/B/BGSLevGenericBaseForm.h | 22 ++++++ CommonLibSF/include/RE/B/BGSLevPackIn.h | 23 ++++++ CommonLibSF/include/RE/B/BGSLevSpaceCell.h | 19 +++++ .../RE/T/TESImageSpaceModifiableForm.h | 24 ++++++ CommonLibSF/include/RE/T/TESLevCharacter.h | 21 +++++ CommonLibSF/include/RE/T/TESLevItem.h | 23 ++++++ CommonLibSF/include/RE/T/TESLevSpell.h | 19 +++++ CommonLibSF/include/RE/T/TESLeveledList.h | 77 +++++++++++++++++++ 8 files changed, 228 insertions(+) create mode 100644 CommonLibSF/include/RE/B/BGSLevGenericBaseForm.h create mode 100644 CommonLibSF/include/RE/B/BGSLevPackIn.h create mode 100644 CommonLibSF/include/RE/B/BGSLevSpaceCell.h create mode 100644 CommonLibSF/include/RE/T/TESImageSpaceModifiableForm.h create mode 100644 CommonLibSF/include/RE/T/TESLevCharacter.h create mode 100644 CommonLibSF/include/RE/T/TESLevItem.h create mode 100644 CommonLibSF/include/RE/T/TESLevSpell.h create mode 100644 CommonLibSF/include/RE/T/TESLeveledList.h diff --git a/CommonLibSF/include/RE/B/BGSLevGenericBaseForm.h b/CommonLibSF/include/RE/B/BGSLevGenericBaseForm.h new file mode 100644 index 00000000..72f51c89 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSLevGenericBaseForm.h @@ -0,0 +1,22 @@ +#pragma once + +#include "RE/B/BGSForcedLocRefType.h" +#include "RE/B/BGSModelMaterialSwap.h" +#include "RE/T/TESBoundAnimObject.h" +#include "RE/T/TESLeveledList.h" + +namespace RE +{ + class BGSLevGenericBaseForm : + public TESBoundAnimObject, // 000 + public TESLeveledList, // 118 + public BGSModelMaterialSwap // 178 + { + public: + SF_RTTI_VTABLE(BGSLevGenericBaseForm); + SF_FORMTYPE(LVLB); + + ~BGSLevGenericBaseForm() override; // 00 + }; + static_assert(sizeof(BGSLevGenericBaseForm) == 0x1A0); +} diff --git a/CommonLibSF/include/RE/B/BGSLevPackIn.h b/CommonLibSF/include/RE/B/BGSLevPackIn.h new file mode 100644 index 00000000..2590e0c0 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSLevPackIn.h @@ -0,0 +1,23 @@ +#pragma once + +#include "RE/B/BGSForcedLocRefType.h" +#include "RE/B/BGSModelMaterialSwap.h" +#include "RE/T/TESBoundAnimObject.h" +#include "RE/T/TESLeveledList.h" + +namespace RE +{ + class BGSLevPackIn : + public TESBoundAnimObject, // 000 + public TESLeveledList, // 118 + public BGSModelMaterialSwap, // 178 + public BGSForcedLocRefType // 1A0 + { + public: + SF_RTTI_VTABLE(BGSLevPackIn); + SF_FORMTYPE(LVLP); + + ~BGSLevPackIn() override; // 00 + }; + static_assert(sizeof(BGSLevPackIn) == 0x1B8); +} diff --git a/CommonLibSF/include/RE/B/BGSLevSpaceCell.h b/CommonLibSF/include/RE/B/BGSLevSpaceCell.h new file mode 100644 index 00000000..d35e8047 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSLevSpaceCell.h @@ -0,0 +1,19 @@ +#pragma once + +#include "RE/T/TESForm.h" +#include "RE/T/TESLeveledList.h" + +namespace RE +{ + class BGSLevSpaceCell : + public TESForm, // 00 + public TESLeveledList // 38 + { + public: + SF_RTTI_VTABLE(BGSLevSpaceCell); + SF_FORMTYPE(LVSC); + + ~BGSLevSpaceCell() override; // 00 + }; + static_assert(sizeof(BGSLevSpaceCell) == 0x98); +} diff --git a/CommonLibSF/include/RE/T/TESImageSpaceModifiableForm.h b/CommonLibSF/include/RE/T/TESImageSpaceModifiableForm.h new file mode 100644 index 00000000..60703e16 --- /dev/null +++ b/CommonLibSF/include/RE/T/TESImageSpaceModifiableForm.h @@ -0,0 +1,24 @@ +#pragma once + +#include "RE/B/BaseFormComponent.h" + +namespace RE +{ + class TESImageSpaceModifier; + + class TESImageSpaceModifiableForm : public BaseFormComponent + { + public: + SF_RTTI_VTABLE(TESImageSpaceModifiableForm); + + ~TESImageSpaceModifiableForm() override; // 00 + + // override (BaseFormComponent) + const BSFixedString& GetFormComponentType() const override; // 01 - { return "TESImageSpaceModifiableForm_Component"; } + void InitializeDataComponent() override; // 02 - { return; } + + // members + TESImageSpaceModifier* imageSpaceModifying; // 08 - MNAM + }; + static_assert(sizeof(TESImageSpaceModifiableForm) == 0x10); +} diff --git a/CommonLibSF/include/RE/T/TESLevCharacter.h b/CommonLibSF/include/RE/T/TESLevCharacter.h new file mode 100644 index 00000000..91f701fd --- /dev/null +++ b/CommonLibSF/include/RE/T/TESLevCharacter.h @@ -0,0 +1,21 @@ +#pragma once + +#include "RE/B/BGSModelMaterialSwap.h" +#include "RE/T/TESBoundAnimObject.h" +#include "RE/T/TESLeveledList.h" + +namespace RE +{ + class TESLevCharacter : + public TESBoundAnimObject, // 000 + public TESLeveledList, // 118 + public BGSModelMaterialSwap // 178 + { + public: + SF_RTTI_VTABLE(TESLevCharacter); + SF_FORMTYPE(LVLN); + + ~TESLevCharacter() override; // 00 + }; + static_assert(sizeof(TESLevCharacter) == 0x1A0); +} diff --git a/CommonLibSF/include/RE/T/TESLevItem.h b/CommonLibSF/include/RE/T/TESLevItem.h new file mode 100644 index 00000000..0f4480a3 --- /dev/null +++ b/CommonLibSF/include/RE/T/TESLevItem.h @@ -0,0 +1,23 @@ +#pragma once + +#include "RE/B/BGSForcedLocRefType.h" +#include "RE/B/BGSModelMaterialSwap.h" +#include "RE/T/TESBoundObject.h" +#include "RE/T/TESLeveledList.h" + +namespace RE +{ + class TESLevItem : + public TESBoundObject, // 000 + public TESLeveledList, // 118 + public BGSModelMaterialSwap, // 178 + public BGSForcedLocRefType // 1A0 + { + public: + SF_RTTI_VTABLE(TESLevItem); + SF_FORMTYPE(LVLI); + + ~TESLevItem() override; // 00 + }; + static_assert(sizeof(TESLevItem) == 0x1B8); +} diff --git a/CommonLibSF/include/RE/T/TESLevSpell.h b/CommonLibSF/include/RE/T/TESLevSpell.h new file mode 100644 index 00000000..dbfddedc --- /dev/null +++ b/CommonLibSF/include/RE/T/TESLevSpell.h @@ -0,0 +1,19 @@ +#pragma once + +#include "RE/T/TESBoundObject.h" +#include "RE/T/TESLeveledList.h" + +namespace RE +{ + class TESLevSpell : + public TESBoundObject, // 000 + public TESLeveledList // 118 + { + public: + SF_RTTI_VTABLE(TESLevSpell); + SF_FORMTYPE(LVSP); + + ~TESLevSpell() override; // 00 + }; + static_assert(sizeof(TESLevSpell) == 0x178); +} diff --git a/CommonLibSF/include/RE/T/TESLeveledList.h b/CommonLibSF/include/RE/T/TESLeveledList.h new file mode 100644 index 00000000..e622c1b0 --- /dev/null +++ b/CommonLibSF/include/RE/T/TESLeveledList.h @@ -0,0 +1,77 @@ +#pragma once + +#include "RE/B/BGSTypedFormValuePair.h" +#include "RE/B/BSTArray.h" +#include "RE/B/BSTTuple3.h" +#include "RE/B/BaseFormComponent.h" +#include "RE/F/FormTypes.h" +#include "RE/T/TESCondition.h" + +namespace RE +{ + class BGSCurveForm; + class BGSBiome; + class ContainerItemExtra; + class TESForm; + class TESGlobal; + + struct LEVELED_OBJECT + { + public: + // members + TESForm* form; // 00 + ContainerItemExtra* itemExtra; // 08 + TESCondition* conditions; // 10 + std::uint16_t count; // 18 + std::uint16_t level; // 1A + std::uint8_t unk1C; // 1C + std::uint8_t unk1D; // 1D + }; + static_assert(sizeof(LEVELED_OBJECT) == 0x20); + + class TESLeveledList : public BaseFormComponent + { + public: + SF_RTTI_VTABLE(TESLeveledList); + + enum Flag : std::uint8_t // LVLF + { + kCalculateFromAllLevelsLTOrEqPCLevel = 1 << 0, + kCalculateForEachItemInCount = 1 << 1, + kUseAll = 1 << 2, + kSpecialLoot = 1 << 3 + }; + + ~TESLeveledList() override; // 00 + + // override (BaseFormComponent) + const BSFixedString& GetFormComponentType() const override; // 01 - { return "TESLeveledList_Component"; } + void InitializeDataComponent() override; // 02 + + // add + virtual std::int32_t GetMaxLevelDifference(); // 0B + virtual bool GetCanHoldForm(TESForm* a_form); // 0C + virtual void Unk_0D(); // 0D + virtual void Unk_0E(); // 0E + virtual void Unk_0F(); // 0F + virtual bool GetCanContainFormsOfType(FormType a_type) const = 0; // 10 + + // members + TESCondition conditions; // 08 + TESGlobal* chanceGlobal; // 10 + BGSBiome* biome; // 20 ?? + TESForm* unk28; // 28 + BSTArray>* keywordChances; // 30 + LEVELED_OBJECT* leveledLists; // 38 + LEVELED_OBJECT** scriptAddedLists; // 40 + std::int8_t scriptListCount; // 48 + std::uint32_t unk4C; // 4C + stl::enumeration flags; // 50 + std::uint8_t unk51; // 51 + std::int8_t baseListCount; // 52 + std::uint8_t unk53; // 53 + std::uint8_t unk54; // 54 + BSFixedString overrideName; // 58 + }; + static_assert(sizeof(TESLeveledList) == 0x60); +}