From 12d541468ad7650854d8f96f12a994510e8a26f4 Mon Sep 17 00:00:00 2001 From: qudix <17361645+qudix@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:53:52 -0500 Subject: [PATCH] feat: misc (#283) --- include/RE/A/Actor.h | 1 + include/RE/B/BSCoreTypes.h | 1 + include/RE/I/IAnimationGraphManagerHolder.h | 4 +++- include/RE/I/IBGSBaseFormData.h | 1 + include/RE/IDs.h | 14 +++++++++++++ include/RE/P/ProcessLists.h | 23 ++++++++++++++------- include/RE/T/TESForm.h | 2 ++ include/RE/T/TESObjectREFR.h | 2 ++ include/RE/T/TESQuest.h | 7 +++++++ src/RE/A/Actor.cpp | 7 +++++++ src/RE/T/TESObjectREFR.cpp | 14 +++++++++++++ 11 files changed, 67 insertions(+), 9 deletions(-) diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index b24a7ba6..f3aad848 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -277,6 +277,7 @@ namespace RE virtual void Unk_1A0(); // 1A0 virtual void Unk_1A1(); // 1A1 + void EvaluatePackage(bool a_immediate = false, bool a_resetAI = false); [[nodiscard]] bool IsHostileToActor(Actor* a_actor); // members diff --git a/include/RE/B/BSCoreTypes.h b/include/RE/B/BSCoreTypes.h index d0a29998..ffc97fb9 100644 --- a/include/RE/B/BSCoreTypes.h +++ b/include/RE/B/BSCoreTypes.h @@ -4,4 +4,5 @@ namespace RE { using TESFormID = std::uint32_t; using RefHandle = std::uint32_t; + using ActorHandle = std::uint32_t; } diff --git a/include/RE/I/IAnimationGraphManagerHolder.h b/include/RE/I/IAnimationGraphManagerHolder.h index f539c114..80ca46a4 100644 --- a/include/RE/I/IAnimationGraphManagerHolder.h +++ b/include/RE/I/IAnimationGraphManagerHolder.h @@ -2,9 +2,11 @@ namespace RE { - class IAnimationGraphManagerHolder + class __declspec(novtable) IAnimationGraphManagerHolder { public: + SF_RTTI(IAnimationGraphManagerHolder); + virtual ~IAnimationGraphManagerHolder(); // 00 // add diff --git a/include/RE/I/IBGSBaseFormData.h b/include/RE/I/IBGSBaseFormData.h index 584d8a48..e8a04c86 100644 --- a/include/RE/I/IBGSBaseFormData.h +++ b/include/RE/I/IBGSBaseFormData.h @@ -4,6 +4,7 @@ namespace RE { + class TESFile; class TESForm; class IBGSBaseFormData diff --git a/include/RE/IDs.h b/include/RE/IDs.h index 27a69c76..7d1e9aca 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -4,6 +4,7 @@ namespace RE::ID { namespace Actor { + inline constexpr REL::ID EvaluatePackage{ 150640 }; inline constexpr REL::ID IsHostileToActor{ 150777 }; } @@ -282,6 +283,12 @@ namespace RE::ID inline constexpr REL::ID singleton{ 865059 }; } + namespace ProcessLists + { + inline constexpr REL::ID AreHostileActorsNear{ 154040 }; + inline constexpr REL::ID Singleton{ 878338 }; + } + namespace REFR_LOCK { inline constexpr REL::ID GetLockLevel{ 84103 }; @@ -383,9 +390,11 @@ namespace RE::ID inline constexpr REL::ID AddLockChange{ 106386 }; inline constexpr REL::ID GetCalcLevel{ 107531 }; inline constexpr REL::ID GetCurrentLocation{ 106554 }; + inline constexpr REL::ID GetDistance{ 106562 }; inline constexpr REL::ID GetLinkedRef{ 107578 }; inline constexpr REL::ID GetLock{ 107581 }; inline constexpr REL::ID GetParentWorldSpace{ 106696 }; + inline constexpr REL::ID GetScale{ 106658 }; inline constexpr REL::ID GetSpaceship{ 173851 }; inline constexpr REL::ID GetSpaceshipParentDock{ 174134 }; inline constexpr REL::ID GetSpaceshipPilot{ 173834 }; @@ -398,6 +407,11 @@ namespace RE::ID inline constexpr REL::ID IsSpaceshipLanded{ 173880 }; } + namespace TESQuest + { + inline constexpr REL::ID IsStageDone{ 112585 }; + } + namespace TESWorldSpace { inline constexpr REL::ID GetLocationFromCoordinates{ 107914 }; diff --git a/include/RE/P/ProcessLists.h b/include/RE/P/ProcessLists.h index 77fe46fa..b39f8ea2 100644 --- a/include/RE/P/ProcessLists.h +++ b/include/RE/P/ProcessLists.h @@ -22,18 +22,25 @@ namespace RE [[nodiscard]] static ProcessLists* GetSingleton() { - static REL::Relocation singleton{ REL::ID(878338) }; + static REL::Relocation singleton{ ID::ProcessLists::Singleton }; return *singleton; } + [[nodiscard]] bool AreHostileActorsNear(BSScrapArray* a_hostileActors = nullptr) + { + using func_t = decltype(&ProcessLists::AreHostileActorsNear); + static REL::Relocation func{ ID::ProcessLists::AreHostileActorsNear }; + return func(this, a_hostileActors); + } + // members - std::byte pad10[0x3B]; // 010 - bool runDetection; // 044 - std::byte pad45[0x13]; // 045 - BSTArray highActorHandles; // 058 - BSTArray lowActorHandles; // 068 - BSTArray middleHighActorHandles; // 078 - BSTArray middleLowActorHandles; // 088 + std::byte pad10[0x3B]; // 010 + bool runDetection; // 044 + std::byte pad45[0x13]; // 045 + BSTArray highActorHandles; // 058 + BSTArray lowActorHandles; // 068 + BSTArray middleHighActorHandles; // 078 + BSTArray middleLowActorHandles; // 088 }; static_assert(offsetof(ProcessLists, runDetection) == 0x44); static_assert(offsetof(ProcessLists, highActorHandles) == 0x58); diff --git a/include/RE/T/TESForm.h b/include/RE/T/TESForm.h index 0ed196fa..8ebe415d 100644 --- a/include/RE/T/TESForm.h +++ b/include/RE/T/TESForm.h @@ -47,6 +47,7 @@ namespace RE { kDeleted = 1 << 5, kPersistent = 1 << 10, + kDisabled = 1 << 11, }; ~TESForm() override; // 00 @@ -219,6 +220,7 @@ namespace RE [[nodiscard]] bool IsCredits() const noexcept { return GetFormID() == 0x0000000F; } [[nodiscard]] bool IsDeleted() const noexcept { return GetFormFlags().all(FormFlags::kDeleted); } [[nodiscard]] bool IsDigiPick() const noexcept { return GetFormID() == 0x0000000A; } + [[nodiscard]] bool IsDisabled() const noexcept { return GetFormFlags().all(FormFlags::kDisabled); } [[nodiscard]] bool IsNot(FormType a_type) const noexcept { return !Is(a_type); } diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index e3b2f19f..18bbf49a 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -369,6 +369,7 @@ namespace RE [[nodiscard]] TESBoundObject* GetBaseObject() { return data.objectReference.get(); } [[nodiscard]] const TESBoundObject* GetBaseObject() const { return data.objectReference.get(); } [[nodiscard]] BGSLocation* GetCurrentLocation(); + [[nodiscard]] float GetDistance(NiPointer a_other, bool a_disabledRefs = false, bool a_ignoreWorldspace = false) const; [[nodiscard]] TESObjectREFR* GetLinkedRef(BGSKeyword* a_keyword); [[nodiscard]] REFR_LOCK* GetLock() const; [[nodiscard]] LOCK_LEVEL GetLockLevel() const; @@ -377,6 +378,7 @@ namespace RE [[nodiscard]] constexpr float GetPositionX() const noexcept { return data.location.x; } [[nodiscard]] constexpr float GetPositionY() const noexcept { return data.location.y; } [[nodiscard]] constexpr float GetPositionZ() const noexcept { return data.location.z; } + [[nodiscard]] float GetScale() const; [[nodiscard]] TESObjectREFR* GetSpaceship(bool a_arg1 = true); [[nodiscard]] TESObjectREFR* GetSpaceshipParentDock(); [[nodiscard]] Actor* GetSpaceshipPilot(); diff --git a/include/RE/T/TESQuest.h b/include/RE/T/TESQuest.h index 4622fffc..cc73db77 100644 --- a/include/RE/T/TESQuest.h +++ b/include/RE/T/TESQuest.h @@ -24,6 +24,13 @@ namespace RE ~TESQuest() override; // 00 + [[nodiscard]] bool IsStageDone(std::uint16_t a_stage) const + { + using func_t = decltype(&TESQuest::IsStageDone); + static REL::Relocation func{ ID::TESQuest::IsStageDone }; + return func(this, a_stage); + } + // members std::byte pad38[0xD6]; // 038 QUEST_DATA data; // 108 diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index 698ed155..857e48a9 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -2,6 +2,13 @@ namespace RE { + void Actor::EvaluatePackage(bool a_immediate, bool a_resetAI) + { + using func_t = decltype(&Actor::EvaluatePackage); + static REL::Relocation func{ ID::Actor::EvaluatePackage }; + return func(this, a_immediate, a_resetAI); + } + bool Actor::IsHostileToActor(Actor* a_actor) { using func_t = decltype(&Actor::IsHostileToActor); diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index 90b56756..b0b2a403 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -43,6 +43,13 @@ namespace RE return func(this); } + float TESObjectREFR::GetDistance(NiPointer a_other, bool a_disabledRefs, bool a_ignoreWorldspace) const + { + using func_t = decltype(&TESObjectREFR::GetDistance); + static REL::Relocation func{ ID::TESObjectREFR::GetDistance }; + return func(this, a_other, a_disabledRefs, a_ignoreWorldspace); + } + TESObjectREFR* TESObjectREFR::GetLinkedRef(BGSKeyword* a_keyword) { using func_t = decltype(&TESObjectREFR::GetLinkedRef); @@ -70,6 +77,13 @@ namespace RE return func(this); } + float TESObjectREFR::GetScale() const + { + using func_t = decltype(&TESObjectREFR::GetScale); + static REL::Relocation func{ ID::TESObjectREFR::GetScale }; + return func(this); + } + TESObjectREFR* TESObjectREFR::GetSpaceship(bool a_arg1) { using func_t = decltype(&TESObjectREFR::GetSpaceship);