diff --git a/CommonLibSF/include/RE/A/Actor.h b/CommonLibSF/include/RE/A/Actor.h index c8cf3dcd..d6034b2b 100644 --- a/CommonLibSF/include/RE/A/Actor.h +++ b/CommonLibSF/include/RE/A/Actor.h @@ -2,14 +2,17 @@ #include "RE/A/AIProcess.h" #include "RE/A/ActorState.h" +#include "RE/A/ActorValueStorage.h" #include "RE/I/IMovementStateStore.h" #include "RE/I/IStoreAnimationActions.h" #include "RE/M/MagicTarget.h" +#include "RE/P/PerkRankData.h" #include "RE/T/TESObjectREFR.h" namespace RE { class AIProcess; + class BGSPerk; class CombatController; class CombatGroup; class MovementMessageUpdateRequestImmediate; @@ -24,7 +27,6 @@ namespace RE struct BSMovementDataChangedEvent; struct BSNavmeshChangeEvent; struct BSSubGraphActivationUpdate; - struct Perks; namespace PerkValueEvents { @@ -45,6 +47,15 @@ namespace RE kTotal }; + struct Perks + { + public: + // members + BSTArray* perkRanks; // 00 + BSTArray unk10; // 08 + }; + static_assert(sizeof(Perks) == 0x18); + class Actor : public TESObjectREFR, // 000 public MagicTarget, // 110 @@ -265,6 +276,8 @@ namespace RE virtual void Unk_1A0(); // 1A0 virtual void Unk_1A1(); // 1A1 + [[nodiscard]] bool IsHostileToActor(Actor* a_actor); + // members stl::enumeration boolBits; // 240 std::uint32_t unk244; // 244 @@ -278,11 +291,7 @@ namespace RE std::uint64_t unk280; // 280 CombatController* combatController; // 288 std::uint64_t unk290; // 290 - std::uint64_t unk298; // 298 - std::uint64_t unk2A0; // 2A0 - std::uint64_t unk2A8; // 2A8 - std::uint64_t unk2B0; // 2B0 - std::uint64_t unk2B8; // 2B8 + ActorValueStorage avStorage; // 298 std::uint64_t unk2C0; // 2C0 stl::enumeration criticalStage; // 2C8 std::uint32_t dialogueItemTarget; // 2CC - TESPointerHandle @@ -290,7 +299,8 @@ namespace RE std::uint32_t myKiller; // 2D4 - TESPointerHandle std::uint64_t unk2D8; // 2D8 std::uint64_t unk2E0; // 2E0 - std::uint64_t unk2E8; // 2E8 + std::uint32_t actionValue; // 2E8 + float timerOnAction; // 2EC std::uint64_t unk2F0; // 2F0 std::uint32_t intimidateBribeDayStamp; // 2F8 std::uint32_t unk2FC; // 2FC @@ -313,8 +323,9 @@ namespace RE std::uint64_t unk380; // 380 TESRace* race; // 388 Perks* perks; // 390 - std::uint64_t unk398; // 398 - std::uint64_t unk3A0; // 3A0 + std::uint32_t unk398; // 398 + mutable BSReadWriteLock perkArrayLock; // 39C + std::uint32_t unk3A4; // 394 stl::enumeration boolFlags; // 3A8 stl::enumeration boolFlags2; // 3AC std::uint64_t unk3B0; // 3B0 diff --git a/CommonLibSF/include/RE/A/ActorValueStorage.h b/CommonLibSF/include/RE/A/ActorValueStorage.h new file mode 100644 index 00000000..0c3f5497 --- /dev/null +++ b/CommonLibSF/include/RE/A/ActorValueStorage.h @@ -0,0 +1,25 @@ +#pragma once + +#include "RE/B/BSTArray.h" +#include "RE/B/BSLock.h" + +namespace RE +{ + struct Modifiers + { + public: + // members + float modifiers[3]; // 0 + }; + static_assert(sizeof(Modifiers) == 0xC); + + class ActorValueStorage + { + public: + // members + BSTArray baseValues; // 00 - BSTTuple + BSTArray modifiers; // 10 - BSTTuple + BSReadWriteLock avLock; // 20 + }; + static_assert(sizeof(ActorValueStorage) == 0x28); +} diff --git a/CommonLibSF/include/RE/B/BGSInventoryList.h b/CommonLibSF/include/RE/B/BGSInventoryList.h new file mode 100644 index 00000000..5f918e57 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSInventoryList.h @@ -0,0 +1,29 @@ +#pragma once + +#include "RE/B/BSTArray.h" +#include "RE/B/BSTEvent.h" + +namespace RE +{ + class BGSInventoryItem; + + namespace BGSInventoryListEvent + { + struct Event; + } + + class BGSInventoryList : + public BSTEventSource // 00 + { + public: + SF_RTTI_VTABLE(BGSInventoryList); + + ~BGSInventoryList() override; // 00 + + // members + BSTArray data; // 28 + std::uint32_t ownerHandle; // 38 + float cachedWeight; // 3C + }; + static_assert(sizeof(BGSInventoryList) == 0x40); +} diff --git a/CommonLibSF/include/RE/P/PlayerCharacter.h b/CommonLibSF/include/RE/P/PlayerCharacter.h index 4e5816bd..b470a447 100644 --- a/CommonLibSF/include/RE/P/PlayerCharacter.h +++ b/CommonLibSF/include/RE/P/PlayerCharacter.h @@ -65,16 +65,9 @@ namespace RE virtual void Unk_1A4(); // 1A4 virtual void Unk_1A5(); // 1A5 - [[nodiscard]] static PlayerCharacter* GetSingleton() - { - static REL::Relocation singleton{ REL::ID(865059) }; - return *singleton; - } + [[nodiscard]] static PlayerCharacter* GetSingleton(); - bool IsInChargen() - { - return *(stl::adjust_pointer(this, 0xF24)); - } + bool IsInChargen(); // members std::uint64_t unk0670; // 0670 @@ -361,7 +354,7 @@ namespace RE std::uint64_t unk0F38; // 0F38 std::uint64_t unk0F40; // 0F40 std::uint64_t unk0F48; // 0F48 - TESObjectREFR* crosshairRef; // 0F50 NiPointer? + TESObjectREFR* crosshairRef; // 0F50 - NiPointer? std::uint64_t unk0F58; // 0F58 std::uint64_t unk0F60; // 0F60 std::uint64_t unk0F68; // 0F68 diff --git a/CommonLibSF/include/RE/T/TESObjectREFR.h b/CommonLibSF/include/RE/T/TESObjectREFR.h index 3ed6be1b..6da51ece 100644 --- a/CommonLibSF/include/RE/T/TESObjectREFR.h +++ b/CommonLibSF/include/RE/T/TESObjectREFR.h @@ -1,12 +1,15 @@ #pragma once #include "RE/A/ActorValueOwner.h" +#include "RE/B/BGSInventoryList.h" +#include "RE/B/BSLock.h" #include "RE/B/BSTEvent.h" #include "RE/I/IAnimationGraphManagerHolder.h" #include "RE/I/IKeywordFormBase.h" #include "RE/I/IMovementInterface.h" #include "RE/I/IPostAnimationChannelUpdateFunctor.h" #include "RE/N/NiPoint3.h" +#include "RE/N/NiSmartPointer.h" #include "RE/T/TESHandleForm.h" namespace RE @@ -16,23 +19,20 @@ namespace RE class BGSScene; class BSAnimationGraphEvent; class BSTransformDeltaEvent; + class NiAVObject; class TESBoundObject; class TESModel; class TESObjectCELL; class TESRace; class TESTopicInfo; class TESWorldSpace; + class TESWaterForm; namespace ActorValueEvents { struct ActorValueChangedEvent; } - namespace BGSInventoryListEvent - { - struct Event; - } - class IMovementProcessMessageInterface : public IMovementInterface // 00 { @@ -48,12 +48,26 @@ namespace RE { public: // members - NiPoint3A angle; // 00 - NiPoint3A location; // 10 - TESBoundObject* objectReference; // 20 + NiPoint3A angle; // 00 + NiPoint3A location; // 10 + NiPointer objectReference; // 20 - ref counted in SetObjectReference vfunc }; static_assert(sizeof(OBJ_REFR) == 0x30); + struct LOADED_REF_DATA + { + public: + // members + void* handleList; // 00 - TODO + NiPointer data3D; // 08 + TESWaterForm* currentWaterType; // 10 + float relevantWaterHeight; // 18 + float cachedRadius; // 1C + std::uint32_t flags; // 20 + std::uint16_t underwaterCount; // 24 + }; + static_assert(sizeof(LOADED_REF_DATA) == 0x28); + class TESObjectREFR : public TESHandleForm, // 00 public BSTEventSink, // 38 @@ -222,7 +236,7 @@ namespace RE virtual void Unk_F4(); // 0F4 virtual void Unk_F5(); // 0F5 virtual void Unk_F6(); // 0F6 - virtual void Unk_F7(); // 0F7 + virtual void SetObjectReference(TESBoundObject* a_object, bool a_clearData); // 0F7 virtual void Unk_F8(); // 0F8 virtual void Unk_F9(); // 0F9 virtual void Unk_FA(); // 0FA @@ -284,8 +298,8 @@ namespace RE [[nodiscard]] constexpr float GetAngleX() const { return data.angle.x; } [[nodiscard]] constexpr float GetAngleY() const { return data.angle.y; } [[nodiscard]] constexpr float GetAngleZ() const { return data.angle.z; } - [[nodiscard]] TESBoundObject* GetBaseObject() { return data.objectReference; } - [[nodiscard]] const TESBoundObject* GetBaseObject() const { return data.objectReference; }; + [[nodiscard]] TESBoundObject* GetBaseObject() { return data.objectReference.get(); } + [[nodiscard]] const TESBoundObject* GetBaseObject() const { return data.objectReference.get(); } [[nodiscard]] BGSLocation* GetCurrentLocation(); [[nodiscard]] TESObjectREFR* GetLinkedRef(BGSKeyword* a_keyword); [[nodiscard]] TESWorldSpace* GetParentWorldSpace(); @@ -304,17 +318,17 @@ namespace RE [[nodiscard]] bool IsSpaceshipLanded(); // members - OBJ_REFR data; // 0A0 - std::uint64_t unkD0; // 0D0 - std::uint64_t unkD8; // 0D8 - TESObjectCELL* parentCell; // 0E0 - void* loadedData; // 0E8 - std::uint64_t unkF0; // 0F0 - std::uint64_t extraDataList; // 0F8 - std::uint64_t unk100; // 100 - std::uint16_t scale; // 108 - std::uint8_t unk10A; // 10A - std::uint8_t unk10B; // 10B + OBJ_REFR data; // 0A0 + BGSInventoryList* inventoryList; // 0D0 - this + lock is one struct? + mutable BSReadWriteLock inventoryListLock; // 0D8 + TESObjectCELL* parentCell; // 0E0 + LOADED_REF_DATA* loadedData; // 0E8 - same as above + mutable BSReadWriteLock loadedDataLock; // 0F0 + std::uint64_t extraDataList; // 0F8 + BGSLocalizedString unk100; // 100 - empty? + std::uint16_t scale; // 108 + bool unk10A; // 10A + std::uint8_t flags; // 10B }; static_assert(sizeof(TESObjectREFR) == 0x110); } diff --git a/CommonLibSF/src/RE/A/Actor.cpp b/CommonLibSF/src/RE/A/Actor.cpp new file mode 100644 index 00000000..676c781a --- /dev/null +++ b/CommonLibSF/src/RE/A/Actor.cpp @@ -0,0 +1,11 @@ +#include "RE/A/Actor.h" + +namespace RE +{ + bool Actor::IsHostileToActor(Actor* a_actor) + { + using func_t = decltype(&Actor::IsHostileToActor); + REL::Relocation func{ REL::ID(150777) }; + return func(this, a_actor); + } +} diff --git a/CommonLibSF/src/RE/P/PlayerCharacter.cpp b/CommonLibSF/src/RE/P/PlayerCharacter.cpp new file mode 100644 index 00000000..d8f08f2e --- /dev/null +++ b/CommonLibSF/src/RE/P/PlayerCharacter.cpp @@ -0,0 +1,15 @@ +#include "RE/P/PlayerCharacter.h" + +namespace RE +{ + PlayerCharacter* PlayerCharacter::GetSingleton() + { + static REL::Relocation singleton{ REL::ID(865059) }; + return *singleton; + } + + bool PlayerCharacter::IsInChargen() + { + return *(stl::adjust_pointer(this, 0xF24)); + } +}