From 80a2384b74044ba69fe859c6ca4b9f890e154b83 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Mon, 4 Dec 2023 06:00:11 -0600 Subject: [PATCH 1/6] Add RE::BGSEntryPointFunctionDataSpellItem Needed for complete implementation of perkentry point patch in Scrambled Bugs port --- .../RE/B/BGSEntryPointFunctionDataSpellItem.h | 25 +++++++++++++++++++ include/RE/Skyrim.h | 1 + 2 files changed, 26 insertions(+) create mode 100644 include/RE/B/BGSEntryPointFunctionDataSpellItem.h diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h new file mode 100644 index 000000000..9a8401af9 --- /dev/null +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -0,0 +1,25 @@ +#pragma once + +#include "RE/B/BGSEntryPointFunctionData.h" + +namespace RE +{ + class SpellItem; + + class BGSEntryPointFunctionDataSpellItem : public BGSEntryPointFunctionData + { + public: + // Override + virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 + + // Override (BGSEntryPointFunctionData) + [[nodiscard]] virtual ENTRY_POINT_FUNCTION_DATA GetType() const override; // 1 + virtual bool LoadImpl(TESFile* a_mod) override; // 2 + virtual void InitItem(TESForm* a_form) override; // 3 + + // Member variables + SpellItem* spell; // 8 + }; + static_assert(offsetof(BGSEntryPointFunctionDataSpellItem, spell) == 0x8); + static_assert(sizeof(BGSEntryPointFunctionDataSpellItem) == 0x10); +} diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 6e0bddf22..8cc917b0e 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -98,6 +98,7 @@ #include "RE/B/BGSEntryPointFunctionData.h" #include "RE/B/BGSEntryPointFunctionDataActivateChoice.h" #include "RE/B/BGSEntryPointFunctionDataOneValue.h" +#include "RE/B/BGSEntryPointFunctionDataSpellItem.h" #include "RE/B/BGSEntryPointFunctionDataText.h" #include "RE/B/BGSEntryPointPerkEntry.h" #include "RE/B/BGSEquipSlot.h" From 66932455ca768f91e58c3f2474587df36807066d Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Thu, 14 Dec 2023 02:58:43 -0600 Subject: [PATCH 2/6] Add RE for FindMaxMagnitudeVisitor --- cmake/sourcelist.cmake | 2 ++ include/RE/F/FindMaxMagnitudeVisitor.h | 28 ++++++++++++++++++++++++++ include/RE/Skyrim.h | 1 + src/RE/F/FindMaxMagnitudeVisitor.cpp | 13 ++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 include/RE/F/FindMaxMagnitudeVisitor.h create mode 100644 src/RE/F/FindMaxMagnitudeVisitor.cpp diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 88c09ccb5..355fa6dfc 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -709,6 +709,7 @@ set(SOURCES include/RE/F/FavoritesMenu.h include/RE/F/FightReactions.h include/RE/F/FileID.h + include/RE/F/FindMaxMagnitudeVisitor.h include/RE/F/FirstPersonState.h include/RE/F/FixedStrings.h include/RE/F/FlameProjectile.h @@ -1754,6 +1755,7 @@ set(SOURCES src/RE/E/ExtraSoul.cpp src/RE/E/ExtraTextDisplayData.cpp src/RE/E/ExtraUniqueID.cpp + src/RE/F/FindMaxMagnitudeVisitor.cpp src/RE/F/FormTypes.cpp src/RE/F/FxDelegate.cpp src/RE/F/FxDelegateArgs.cpp diff --git a/include/RE/F/FindMaxMagnitudeVisitor.h b/include/RE/F/FindMaxMagnitudeVisitor.h new file mode 100644 index 000000000..d4692f2c4 --- /dev/null +++ b/include/RE/F/FindMaxMagnitudeVisitor.h @@ -0,0 +1,28 @@ +#pragma once + +#include "RE/M/MagicTarget.h" + +namespace RE +{ + class ActiveEffect; + + class FindMaxMagnitudeVisitor : + public MagicTarget::ForEachActiveEffectVisitor + { + public: + inline static constexpr auto RTTI = RTTI_FindMaxMagnitudeVisitor; + inline static constexpr auto VTABLE = VTABLE_FindMaxMagnitudeVisitor; + + virtual ~FindMaxMagnitudeVisitor(){}; // 00 + + // add + virtual BSContainer::ForEachResult Accept(ActiveEffect* a_effect) override; // 01 + + // Member variables + ActiveEffect* activeEffect{ nullptr }; // 8 + float maxMagnitude{ -1.0F }; // 10 + }; + static_assert(sizeof(FindMaxMagnitudeVisitor) == 0x18); + + +} // namespace RE diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 8cc917b0e..2f57d7c90 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -712,6 +712,7 @@ #include "RE/F/FavoritesMenu.h" #include "RE/F/FightReactions.h" #include "RE/F/FileID.h" +#include "RE/F/FindMaxMagnitudeVisitor.h" #include "RE/F/FirstPersonState.h" #include "RE/F/FixedStrings.h" #include "RE/F/FlameProjectile.h" diff --git a/src/RE/F/FindMaxMagnitudeVisitor.cpp b/src/RE/F/FindMaxMagnitudeVisitor.cpp new file mode 100644 index 000000000..a54740349 --- /dev/null +++ b/src/RE/F/FindMaxMagnitudeVisitor.cpp @@ -0,0 +1,13 @@ +#pragma once + +#include "RE/F/FindMaxMagnitudeVisitor.h" + +namespace RE +{ + BSContainer::ForEachResult FindMaxMagnitudeVisitor::Accept(ActiveEffect* a_effect) + { + using func_t = decltype(&FindMaxMagnitudeVisitor::Accept); + REL::Relocation func{ reinterpret_cast(RELOCATION_ID(257550, 205805).address())[0x1] }; // AE address/ID untested + return func(this, a_effect); + } +} // namespace RE From 27db265efc034365dc82ef03c16bee76253cd975 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Thu, 14 Dec 2023 03:24:52 -0600 Subject: [PATCH 3/6] Add missed sourcelist.cmake line from prior RE --- cmake/sourcelist.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 355fa6dfc..f95c17a30 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -95,6 +95,7 @@ set(SOURCES include/RE/B/BGSEntryPointFunctionData.h include/RE/B/BGSEntryPointFunctionDataActivateChoice.h include/RE/B/BGSEntryPointFunctionDataOneValue.h + include/RE/B/BGSEntryPointFunctionDataSpellItem.h include/RE/B/BGSEntryPointFunctionDataText.h include/RE/B/BGSEntryPointPerkEntry.h include/RE/B/BGSEquipSlot.h From 5011d573c04d2253c47dc18f6e00c99191e7c5f8 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Thu, 14 Dec 2023 23:50:17 -0600 Subject: [PATCH 4/6] Label maximumWardPower for RE::MiddleHighProcessData --- include/RE/M/MiddleHighProcessData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/M/MiddleHighProcessData.h b/include/RE/M/MiddleHighProcessData.h index ffcf6316b..dd1be6302 100644 --- a/include/RE/M/MiddleHighProcessData.h +++ b/include/RE/M/MiddleHighProcessData.h @@ -199,7 +199,7 @@ namespace RE float unk2B0; // 2B0 float bleedoutRate; // 2B4 float unk2B8; // 2B8 - float unk2BC; // 2BC + float maximumWardPower; // 2BC float unk2C0; // 2C0 float torchEvaluationTimer; // 2C4 float alphaMult; // 2C8 From faeb437b11b7a5b7d82811be972a6f543d930167 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Tue, 19 Dec 2023 11:46:53 -0600 Subject: [PATCH 5/6] Add RTTI and VTABLE variables to BGSEntryPointFunctionDataSpellItem --- include/RE/B/BGSEntryPointFunctionDataSpellItem.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h index 9a8401af9..df1206587 100644 --- a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -9,6 +9,8 @@ namespace RE class BGSEntryPointFunctionDataSpellItem : public BGSEntryPointFunctionData { public: + inline static constexpr auto RTTI = RTTI_BGSEntryPointFunctionDataSpellItem; + inline static constexpr auto VTABLE = VTABLE_BGSEntryPointFunctionDataSpellItem; // Override virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 From c627db459065d47bd3f369aad3d5356975afb69f Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Tue, 19 Dec 2023 11:50:34 -0600 Subject: [PATCH 6/6] Adapt BGSEntryPointFunctionDataSpellItem to PO3 branch version of BGSEntryPointFunctionData instead of Alandtse branch version --- include/RE/B/BGSEntryPointFunctionDataSpellItem.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h index df1206587..1eaf64c16 100644 --- a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -15,9 +15,9 @@ namespace RE virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 // Override (BGSEntryPointFunctionData) - [[nodiscard]] virtual ENTRY_POINT_FUNCTION_DATA GetType() const override; // 1 - virtual bool LoadImpl(TESFile* a_mod) override; // 2 - virtual void InitItem(TESForm* a_form) override; // 3 + [[nodiscard]] virtual FunctionType GetType() const override; // 1 + virtual bool LoadFunctionData(TESFile* a_mod) override; // 2 + virtual void ResolveForms(TESFile* a_form) override; // 3 // Member variables SpellItem* spell; // 8