diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index aeacd5862..286f64330 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -880,6 +880,7 @@ set(SOURCES include/RE/G/GWaitCondition.h include/RE/G/GWaitable.h include/RE/G/GameSettingCollection.h + include/RE/G/GarbageCollector.h include/RE/G/GiftMenu.h include/RE/G/GlobalLocations.h include/RE/G/GlobalPaths.h @@ -1451,6 +1452,7 @@ set(SOURCES include/RE/T/TESAmmo.h include/RE/T/TESAttackDamageForm.h include/RE/T/TESBipedModelForm.h + include/RE/T/TESBookReadEvent.h include/RE/T/TESBoundAnimObject.h include/RE/T/TESBoundObject.h include/RE/T/TESCamera.h diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index cdb45802d..f1810b8ea 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -608,10 +608,10 @@ namespace RE bool RemoveSpell(SpellItem* a_spell); std::int32_t RequestDetectionLevel(Actor* a_target, DETECTION_PRIORITY a_priority = DETECTION_PRIORITY::kNormal); bool SetDefaultOutfit(BGSOutfit* a_outfit, bool a_update3D); + void SetHeading(float a_angle); // SetRotationZ void SetLifeState(ACTOR_LIFE_STATE a_lifeState); + void SetLooking(float a_angle); // SetRotationX bool SetSleepOutfit(BGSOutfit* a_outfit, bool a_update3D); - void SetRotationX(float a_angle); - void SetRotationZ(float a_angle); void StealAlarm(TESObjectREFR* a_ref, TESForm* a_object, std::int32_t a_num, std::int32_t a_total, TESForm* a_owner, bool a_allowWarning); void StopAlarmOnActor(); void StopInteractingQuick(bool a_unk02); diff --git a/include/RE/B/BSSceneGraph.h b/include/RE/B/BSSceneGraph.h index 83eaacd14..61e0fd505 100644 --- a/include/RE/B/BSSceneGraph.h +++ b/include/RE/B/BSSceneGraph.h @@ -5,6 +5,7 @@ namespace RE { class NiCamera; + class NiVisibleArray; class BSSceneGraph : public NiNode { @@ -23,12 +24,12 @@ namespace RE virtual void SetViewDistanceBasedOnFrameRate(float a_frameRate); // 40 // members - NiPointer camera; // 128 - std::uint64_t unk130; // 130 - 0x18 - bool unk138; // 138 - std::uint8_t pad139; // 139 - std::uint16_t pad13A; // 13A - float cameraFOV; // 13C + NiPointer camera; // 128 + NiVisibleArray* visArray; // 130 - 0x18 + bool menuSceneGraph; // 138 + std::uint8_t pad139; // 139 + std::uint16_t pad13A; // 13A + float cameraFOV; // 13C }; static_assert(sizeof(BSSceneGraph) == 0x140); } diff --git a/include/RE/B/BookMenu.h b/include/RE/B/BookMenu.h index 8650f730c..44a2bbf7a 100644 --- a/include/RE/B/BookMenu.h +++ b/include/RE/B/BookMenu.h @@ -13,8 +13,10 @@ namespace RE { struct BSAnimationGraphEvent; + class BSGeometry; class ExtraDataList; class NiAVObject; + class NiSourceTexture; class TESObjectBOOK; class TESObjectREFR; @@ -48,19 +50,19 @@ namespace RE static void OpenBookMenu(const BSString& a_description, const ExtraDataList* a_extraList, TESObjectREFR* a_ref, TESObjectBOOK* a_book, const NiPoint3& a_pos, const NiMatrix3& a_rot, float a_scale, bool a_useDefaultPos); // members - BSTArray bookTextures; // 50 - GPtr book; // 68 - NiPointer book3D; // 70 - std::uint32_t unk78; // 78 - std::uint32_t pad7C; // 7C - std::uint64_t unk80; // 80 - void* unk88; // 88 - smart ptr - std::uint16_t unk90; // 90 - std::uint16_t unk92; // 92 - bool closeMenu; // 94 - bool isNote; // 95 - std::uint8_t unk96; // 96 - std::uint8_t pad97; // 97 + BSTArray bookTextures; // 50 + GPtr book; // 68 + NiPointer bookModel; // 70 + std::uint32_t numRenderTargets; // 78 + std::uint32_t pad7C; // 7C + NiSourceTexture* pageTexture; // 80 + NiPointer pageTextGeo; // 88 - smart ptr + std::uint16_t unk90; // 90 + std::uint16_t startAnimating; // 92 + bool closeMenu; // 94 + bool isNote; // 95 + bool bookInitialized; // 96 + std::uint8_t pad97; // 97 }; static_assert(sizeof(BookMenu) == 0x98); } diff --git a/include/RE/C/ConcreteFormFactory.h b/include/RE/C/ConcreteFormFactory.h index 50d361b30..38a44f7e3 100644 --- a/include/RE/C/ConcreteFormFactory.h +++ b/include/RE/C/ConcreteFormFactory.h @@ -35,4 +35,13 @@ namespace RE { return static_cast*>(GetFormFactoryByType(T::FORMTYPE)); } + + template + [[nodiscard]] T* IFormFactory::Create() + { + auto factory = IFormFactory::GetConcreteFormFactoryByType(); + auto form = factory ? factory->Create() : nullptr; + + return form ? form->As() : nullptr; + } } diff --git a/include/RE/G/GarbageCollector.h b/include/RE/G/GarbageCollector.h new file mode 100644 index 000000000..78c969d94 --- /dev/null +++ b/include/RE/G/GarbageCollector.h @@ -0,0 +1,69 @@ +#pragma once + +#include "RE/B/BSAtomic.h" +#include "RE/B/BSPointerHandle.h" +#include "RE/B/BSTArray.h" +#include "RE/B/BSTEvent.h" +#include "RE/B/BSTSingleton.h" +#include "RE/N/NiSmartPointer.h" + +namespace RE +{ + class BSAnimationGraphManager; + class BSCloneReserver; + class BSTempEffect; + class BipedAnim; + class NavMesh; + class NiAVObject; + class QueuedFile; + class TESBoundObject; + class TESObjectREFR; + + struct GarbageCollection + { + public: + // members + BSSpinLock lock; // 00 + BSTArray> animations; // 08 + BSTArray baseObjects; // 20 + BSTArray objectHandles; // 38 + BSTArray> actorNodes; // 50 + BSTArray> bipedAnims; // 68 + BSTArray> tempEffects; // 80 + BSTArray> queuedFiles; // 98 + BSTArray> cloneReservers; // B0 + BSTArray> navMeshes; // C8 + bool deleting; // E0 + }; + static_assert(sizeof(GarbageCollection) == 0xE8); + + class GarbageCollector : + public BSTSingletonSDM, + public BSTEventSink + { + public: + inline static constexpr auto RTTI = RTTI_GarbageCollector; + + ~GarbageCollector() override; // 00 + + // override (BSTEventSink) + BSEventNotifyControl ProcessEvent(const PositionPlayerEvent* a_event, BSTEventSource* a_eventSource) override; // 01 + + static GarbageCollector* GetSingleton() + { + REL::Relocation singleton{ RELOCATION_ID(514180, 400329) }; + return *singleton; + } + + void Add(TESObjectREFR* a_object, bool a_removeFromCell) + { + using func_t = decltype(&GarbageCollector::Add); + REL::Relocation func{ RELOCATION_ID(35492, 36459) }; + return func(this, a_object, a_removeFromCell); + } + + // members + GarbageCollection* garbageCollection; // 10 + }; + static_assert(sizeof(GarbageCollector) == 0x18); +} diff --git a/include/RE/I/IFormFactory.h b/include/RE/I/IFormFactory.h index 721c85db5..770038810 100644 --- a/include/RE/I/IFormFactory.h +++ b/include/RE/I/IFormFactory.h @@ -40,6 +40,8 @@ namespace RE static ConcreteFormFactory* GetConcreteFormFactoryByType(); TESForm* Create(); + template + static T* Create(); }; static_assert(sizeof(IFormFactory) == 0x8); } diff --git a/include/RE/I/Inventory3DManager.h b/include/RE/I/Inventory3DManager.h index 785b7c435..2b1002a85 100644 --- a/include/RE/I/Inventory3DManager.h +++ b/include/RE/I/Inventory3DManager.h @@ -38,11 +38,13 @@ namespace RE static Inventory3DManager* GetSingleton(); - void UpdateItem3D(InventoryEntryData* a_objDesc); - void UpdateMagic3D(TESForm* a_form, std::uint32_t a_arg2); - void Clear3D(); - void Render(); + void Begin3D(INTERFACE_LIGHT_SCHEME a_scheme); + void End3D(); + void LoadInventoryItem(InventoryEntryData* a_objDesc); + void LoadInventoryItem(TESBoundObject* a_object, ExtraDataList* a_extraDataList); + void Render(); bool ToggleItemZoom(); + void UnloadInventoryItem(); // members std::uint8_t unk011; // 011 diff --git a/include/RE/M/MagicSystem.h b/include/RE/M/MagicSystem.h index 2dbb0f53a..7293e3b76 100644 --- a/include/RE/M/MagicSystem.h +++ b/include/RE/M/MagicSystem.h @@ -1,8 +1,11 @@ #pragma once +#include "RE/B/BSString.h" + namespace RE { class BGSSoundDescriptorForm; + class MagicItem; namespace MagicSystem { @@ -92,5 +95,6 @@ namespace RE const char* GetCannotCastString(CannotCastReason a_reason); float GetMagicCasterTargetUpdateInterval(); BGSSoundDescriptorForm* GetMagicFailureSound(SpellType a_type); + void GetMagicItemDescription(BSString& a_out, MagicItem* a_magicItem, const char* a_beginTagFormat, const char* a_endTagFormat); } } diff --git a/include/RE/M/MapMenu.h b/include/RE/M/MapMenu.h index 34bc99a2d..63aac68fd 100644 --- a/include/RE/M/MapMenu.h +++ b/include/RE/M/MapMenu.h @@ -64,8 +64,8 @@ namespace RE TESWorldSpace* worldSpace; // 30538 GFxValue unk30540; // 30540 std::uint32_t unk30558; // 30558 - NiPoint3 unk3055C; // 3055C - NiPoint3 unk30568; // 30568 + NiPoint3 cameraPickOrigin; // 3055C + NiPoint3 cameraPickDirection; // 30568 BSSoundHandle unk30574; // 30574 std::uint64_t unk30580; // 30580 std::uint64_t unk30588; // 30588 diff --git a/include/RE/M/MiddleHighProcessData.h b/include/RE/M/MiddleHighProcessData.h index 2bf632a17..91d18cff8 100644 --- a/include/RE/M/MiddleHighProcessData.h +++ b/include/RE/M/MiddleHighProcessData.h @@ -23,6 +23,7 @@ namespace RE class bhkCharacterController; class bhkRagdollPenetrationUtil; class BSAnimationGraphManager; + class BSCloneReserver; class BSFaceGenAnimationData; class BSFaceGenNiNode; class BSLightingShaderProperty; @@ -185,7 +186,7 @@ namespace RE InventoryEntryData* rightHand; // 260 InventoryEntryData* bothHands; // 268 NiPointer bodyPartPreload; // 270 - void* unk278; // 278 + NiPointer unk278; // 278 TESIdleForm* lastIdlePlayed; // 280 AIPerkData* perkData; // 288 std::uint32_t unk290; // 290 diff --git a/include/RE/N/NiAVObject.h b/include/RE/N/NiAVObject.h index 9dab8a967..870cb9667 100644 --- a/include/RE/N/NiAVObject.h +++ b/include/RE/N/NiAVObject.h @@ -3,6 +3,7 @@ #include "RE/B/BSFixedString.h" #include "RE/B/BSShaderMaterial.h" #include "RE/C/CollisionLayers.h" +#include "RE/H/hkpMotion.h" #include "RE/N/NiBound.h" #include "RE/N/NiObjectNET.h" #include "RE/N/NiSmartPointer.h" @@ -126,7 +127,7 @@ namespace RE void SetAppCulled(bool a_cull); void SetCollisionLayer(COL_LAYER a_collisionLayer); void SetCollisionLayerAndGroup(COL_LAYER a_collisionLayer, std::uint32_t a_group); - bool SetMotionType(std::uint32_t a_motionType, bool a_arg2 = true, bool a_arg3 = false, bool a_allowActivate = true); + bool SetMotionType(hkpMotion::MotionType a_motionType, bool a_recurse = true, bool a_force = false, bool a_allowActivate = true); bool SetProjectedUVData(const NiColorA& a_projectedUVParams, const NiColor& a_projectedUVColor, bool a_isSnow); void TintScenegraph(const NiColorA& a_color); void Update(NiUpdateData& a_data); diff --git a/include/RE/N/NiCamera.h b/include/RE/N/NiCamera.h index 326a36384..9170e196f 100644 --- a/include/RE/N/NiCamera.h +++ b/include/RE/N/NiCamera.h @@ -26,12 +26,11 @@ namespace RE void UpdateWorldBound() override; // 2F - { return; } void UpdateWorldData(NiUpdateData* a_data) override; // 30 - bool WorldPtToScreenPt3(const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance); - static bool BoundInFrustum(const NiBound& a_bound, NiCamera* a_camera); static bool NodeInFrustum(NiAVObject* a_node, NiCamera* a_camera); static bool PointInFrustum(const NiPoint3& a_point, NiCamera* a_camera, float a_radius); - + bool WindowPointToRay(std::int32_t a_x, std::int32_t a_y, NiPoint3& a_origin, NiPoint3& a_dir, float a_windowWidth, float a_windowHeight); + bool WorldPtToScreenPt3(const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance); static bool WorldPtToScreenPt3(const float a_matrix[4][4], const NiRect& a_port, const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance); // members diff --git a/include/RE/R/Renderer.h b/include/RE/R/Renderer.h index cdf42d58f..c7a0b43ad 100644 --- a/include/RE/R/Renderer.h +++ b/include/RE/R/Renderer.h @@ -75,8 +75,8 @@ namespace RE struct ScreenSize { - uint32_t width; // 00 - uint32_t height; // 04 + std::uint32_t width; // 00 + std::uint32_t height; // 04 }; static_assert(sizeof(ScreenSize) == 0x8); @@ -118,17 +118,16 @@ namespace RE [[nodiscard]] static REX::W32::ID3D11Device* GetDevice(); [[nodiscard]] static RendererWindow* GetCurrentRenderWindow(); + // members + std::uint64_t unk00; // 00 + std::uint64_t unk08; // 08 + RendererData data; // 10 + private: void Begin(std::uint32_t windowID); void Init(RendererInitOSData* a_data, ApplicationWindowProperties* a_windowProps, REX::W32::HWND a_window); void End(); void Shutdown(); - - public: - // members - std::uint64_t unk00; // 00 - std::uint64_t unk08; // 08 - RendererData data; // 10 }; } } diff --git a/include/RE/S/State.h b/include/RE/S/State.h index 0784a60d2..f59ad8aa1 100644 --- a/include/RE/S/State.h +++ b/include/RE/S/State.h @@ -1,7 +1,8 @@ #pragma once +#include "RE/B/BSTArray.h" #include "RE/N/NiSmartPointer.h" -#include "RE/N/NiTexture.h" +#include "RE/N/NiSourceTexture.h" namespace RE { @@ -17,33 +18,58 @@ namespace RE } // members - std::uint64_t unk00; // 000 - std::uint64_t unk08; // 008 - std::uint64_t unk10; // 010 - std::uint64_t unk18; // 018 - std::uint32_t unk20; // 020 - std::uint32_t screenWidth; // 024 - std::uint32_t screenHeight; // 028 - std::uint32_t frameBufferViewport[2]; // 02C - std::uint32_t unk34; // 034 - std::uint64_t unk38; // 038 - std::uint64_t unk40; // 040 - std::uint64_t unk48; // 048 - bool insideFrame; // 050 - bool letterbox; // 051 - std::uint16_t unk52; // 052 - std::uint32_t unk54; // 054 - NiPointer unk058; // 058 - black? - NiPointer defaultTextureWhite; // 060 - NiPointer defaultTextureGrey; // 068 - NiPointer defaultHeightMap; // 070 - NiPointer defaultReflectionCubeMap; // 078 - NiPointer defaultFaceDetailMap; // 080 - NiPointer defaultTexEffectMap; // 088 - NiPointer defaultTextureNormalMap; // 090 + NiPointer defaultTextureProjNoiseMap; // 000 + NiPointer defaultTextureProjDiffuseMap; // 008 + NiPointer defaultTextureProjNormalMap; // 010 + NiPointer defaultTextureProjNormalDetailMap; // 018 + std::uint32_t unk020; // 020 + std::uint32_t screenWidth; // 024 + std::uint32_t screenHeight; // 028 + std::uint32_t frameBufferViewport[2]; // 02C + std::uint32_t unk034; // 034 + std::uint32_t unk038; // 038 + std::uint32_t unk03C; // 03C + std::uint32_t unk040; // 040 + float unk044; // 044 + float unk048; // 048 + std::uint32_t frameCount; // 04C + bool insideFrame; // 050 + bool letterbox; // 051 + bool unk052; // 052 + bool compiledShaderThisFrame; // 053 + bool useEarlyZ; // 054 + bool unk055; // 055 +#ifdef SKYRIM_SUPPORT_AE + bool unk56; // 056 + bool doubleDynamicResolutionAdjustmentFrequency; // 057 + bool unk58; // 058 +#endif + NiPointer defaultTextureBlack; // 060 + NiPointer defaultTextureWhite; // 068 + NiPointer defaultTextureGrey; // 070 + NiPointer defaultHeightMap; // 078 + NiPointer defaultReflectionCubeMap; // 080 + NiPointer defaultFaceDetailMap; // 088 + NiPointer defaultTexEffectMap; // 090 + NiPointer defaultTextureNormalMap; // 098 + NiPointer defaultTextureDitherNoiseMap; // 0A0 + BSTArray cameraDataCache; // 0A8 + std::uint32_t unk0C0; // 0C0 + float haltonSequence[2][8]; // 0C4 + float dynamicResolutionWidthRatio; // 104 + float dynamicResolutionHeightRatio; // 108 + float dynamicResolutionPreviousWidthRatio; // 10C + float dynamicResolutionPreviousHeightRatio; // 110 + std::uint32_t dynamicResolutionIncreaseFrameWaited; // 114 + volatile std::int32_t dynamicResolutionLock; // 118 + bool canIncreaseDynamicResolution; // 11C + bool canDecreaseDynamicResolution; // 11D + bool canChangeDynamicResolution; // 11E }; - static_assert(offsetof(State, screenWidth) == 0x24); - static_assert(offsetof(State, frameBufferViewport) == 0x2C); - static_assert(offsetof(State, letterbox) == 0x51); +#ifdef SKYRIM_SUPPORT_AE + static_assert(sizeof(State) == 0x120); +#else + static_assert(sizeof(State) == 0x118); +#endif } } diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 3a017606b..27380a4ed 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -882,6 +882,7 @@ #include "RE/G/GWaitCondition.h" #include "RE/G/GWaitable.h" #include "RE/G/GameSettingCollection.h" +#include "RE/G/GarbageCollector.h" #include "RE/G/GiftMenu.h" #include "RE/G/GlobalLocations.h" #include "RE/G/GlobalPaths.h" @@ -1448,6 +1449,7 @@ #include "RE/T/TESAmmo.h" #include "RE/T/TESAttackDamageForm.h" #include "RE/T/TESBipedModelForm.h" +#include "RE/T/TESBookReadEvent.h" #include "RE/T/TESBoundAnimObject.h" #include "RE/T/TESBoundObject.h" #include "RE/T/TESCamera.h" diff --git a/include/RE/T/TESBookReadEvent.h b/include/RE/T/TESBookReadEvent.h new file mode 100644 index 000000000..d9c840bfe --- /dev/null +++ b/include/RE/T/TESBookReadEvent.h @@ -0,0 +1,19 @@ +#pragma once + +#include "RE/N/NiSmartPointer.h" + +namespace RE +{ + class TESObjectREFR; + + struct TESBookReadEvent + { + public: + // members + NiPointer ref; // 00 + FormID baseFormID; // 08 + std::uint16_t uniqueID; // 0C + std::uint16_t pad0E; // 0E + }; + static_assert(sizeof(TESBookReadEvent) == 0x10); +} diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index bb0abfbfb..0365eb422 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -12,6 +12,7 @@ #include "RE/E/ExtraDataList.h" #include "RE/F/FormTypes.h" #include "RE/H/hkVector4.h" +#include "RE/H/hkpMotion.h" #include "RE/I/IAnimationGraphManagerHolder.h" #include "RE/M/MagicSystem.h" #include "RE/N/NiPoint3.h" @@ -122,17 +123,6 @@ namespace RE static inline constexpr auto DEFAULT_INVENTORY_FILTER = [](TESBoundObject&) { return true; }; - enum class MotionType // hkpMotion::MotionType - { - kDynamic = 1, - kSphereInertia = 2, - kBoxInertia = 3, - kKeyframed = 4, - kFixed = 5, - kThinBoxInertia = 6, - kCharacter = 7 - }; - struct ChangeFlags { enum ChangeFlag : std::uint32_t @@ -355,6 +345,7 @@ namespace RE virtual bool Unk_A0(NiAVObject* a_node, float& a_angleX, float& a_angleZ, NiPoint3& a_pos) const; // A0 virtual void UnequipItem(std::uint64_t a_arg1, TESBoundObject* a_object); // A1 - { return; } + static ObjectRefHandle CreateReference(ObjectRefHandle& a_handleOut, FormType a_formType, bool a_addActorToProcessList); static NiPointer LookupByHandle(RefHandle a_refHandle); static bool LookupByHandle(RefHandle a_refHandle, NiPointer& a_refrOut); static TESObjectREFR* FindReferenceFor3D(NiAVObject* a_object3D); @@ -449,7 +440,7 @@ namespace RE void MoveTo(TESObjectREFR* a_target); bool MoveToNode(TESObjectREFR* a_target, const BSFixedString& a_nodeName); bool MoveToNode(TESObjectREFR* a_target, NiAVObject* a_node); - bool NameIncludes(std::string a_word); + bool NameIncludes(std::string_view a_word) const; void OpenContainer(std::int32_t a_openType) const; NiPointer PlaceObjectAtMe(TESBoundObject* a_baseToPlace, bool a_forcePersist) const; void PlayAnimation(stl::zstring a_from, stl::zstring a_to); @@ -458,9 +449,11 @@ namespace RE void SetCollision(bool a_enable); bool SetDisplayName(const BSFixedString& a_name, bool a_force); void SetEncounterZone(BGSEncounterZone* a_zone); - bool SetMotionType(MotionType a_motionType, bool a_allowActivate = true); + bool SetMotionType(hkpMotion::MotionType a_motionType, bool a_allowActivate = true); + void SetOwner(TESForm* a_owner); void SetPosition(float a_x, float a_y, float a_z); void SetPosition(NiPoint3 a_pos); + void SetTemporary(); // members OBJ_REFR data; // 40 diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index e0a6abe8b..26c6ed3a4 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -1008,6 +1008,13 @@ namespace RE return true; } + void Actor::SetHeading(float a_angle) + { + using func_t = decltype(&Actor::SetHeading); + REL::Relocation func{ RELOCATION_ID(36248, 37230) }; + return func(this, a_angle); + } + void Actor::SetLifeState(ACTOR_LIFE_STATE a_lifeState) { using func_t = decltype(&Actor::SetLifeState); @@ -1015,6 +1022,13 @@ namespace RE return func(this, a_lifeState); } + void Actor::SetLooking(float a_angle) + { + using func_t = decltype(&Actor::SetLooking); + REL::Relocation func{ RELOCATION_ID(36602, 37610) }; + return func(this, a_angle); + } + bool Actor::SetSleepOutfit(BGSOutfit* a_outfit, bool a_update3D) { const auto npc = GetActorBase(); @@ -1030,20 +1044,6 @@ namespace RE return true; } - void Actor::SetRotationX(float a_angle) - { - using func_t = decltype(&Actor::SetRotationX); - REL::Relocation func{ RELOCATION_ID(36602, 37610) }; - return func(this, a_angle); - } - - void Actor::SetRotationZ(float a_angle) - { - using func_t = decltype(&Actor::SetRotationZ); - REL::Relocation func{ RELOCATION_ID(36248, 37230) }; - return func(this, a_angle); - } - void Actor::StealAlarm(TESObjectREFR* a_ref, TESForm* a_object, std::int32_t a_num, std::int32_t a_total, TESForm* a_owner, bool a_allowWarning) { using func_t = decltype(&Actor::StealAlarm); diff --git a/src/RE/I/Inventory3DManager.cpp b/src/RE/I/Inventory3DManager.cpp index a068624a9..c55e7f827 100644 --- a/src/RE/I/Inventory3DManager.cpp +++ b/src/RE/I/Inventory3DManager.cpp @@ -8,25 +8,32 @@ namespace RE return *singleton; } - void Inventory3DManager::UpdateItem3D(InventoryEntryData* a_objDesc) + void Inventory3DManager::Begin3D(INTERFACE_LIGHT_SCHEME a_scheme) { - using func_t = decltype(&Inventory3DManager::UpdateItem3D); - REL::Relocation func{ RELOCATION_ID(50884, 51757) }; - return func(this, a_objDesc); + using func_t = decltype(&Inventory3DManager::Begin3D); + REL::Relocation func{ RELOCATION_ID(50881, 51754) }; + return func(this, a_scheme); } - void Inventory3DManager::UpdateMagic3D(TESForm* a_form, std::uint32_t a_arg2) + void Inventory3DManager::End3D() { - using func_t = decltype(&Inventory3DManager::UpdateMagic3D); - REL::Relocation func{ RELOCATION_ID(50885, 51758) }; - return func(this, a_form, a_arg2); + using func_t = decltype(&Inventory3DManager::End3D); + REL::Relocation func{ RELOCATION_ID(50883, 51756) }; + return func(this); } - void Inventory3DManager::Clear3D() + void Inventory3DManager::LoadInventoryItem(InventoryEntryData* a_objDesc) { - using func_t = decltype(&Inventory3DManager::Clear3D); - REL::Relocation func{ RELOCATION_ID(50886, 51759) }; - return func(this); + using func_t = void (*)(Inventory3DManager*, InventoryEntryData*); + REL::Relocation func{ RELOCATION_ID(50884, 51757) }; + return func(this, a_objDesc); + } + + void Inventory3DManager::LoadInventoryItem(TESBoundObject* a_object, ExtraDataList* a_extraDataList) + { + using func_t = void (*)(Inventory3DManager*, TESBoundObject*, ExtraDataList*); + REL::Relocation func{ RELOCATION_ID(50885, 51758) }; + return func(this, a_object, a_extraDataList); } void Inventory3DManager::Render() @@ -42,4 +49,11 @@ namespace RE REL::Relocation func{ RELOCATION_ID(50887, 51760) }; return func(this); } + + void Inventory3DManager::UnloadInventoryItem() + { + using func_t = decltype(&Inventory3DManager::UnloadInventoryItem); + REL::Relocation func{ RELOCATION_ID(50886, 51759) }; + return func(this); + } } diff --git a/src/RE/M/MagicSystem.cpp b/src/RE/M/MagicSystem.cpp index 49bd0d358..b4d011f11 100644 --- a/src/RE/M/MagicSystem.cpp +++ b/src/RE/M/MagicSystem.cpp @@ -1,5 +1,7 @@ #include "RE/M/MagicSystem.h" +#include "RE/M/MagicItem.h" + namespace RE { namespace MagicSystem @@ -24,5 +26,12 @@ namespace RE REL::Relocation func{ RELOCATION_ID(11286, 11411) }; return func(a_type); } + + void GetMagicItemDescription(BSString& a_out, MagicItem* a_magicItem, const char* a_beginTagFormat, const char* a_endTagFormat) + { + using func_t = decltype(&MagicSystem::GetMagicItemDescription); + REL::Relocation func{ RELOCATION_ID(11299, 11427) }; + return func(a_out, a_magicItem, a_beginTagFormat, a_endTagFormat); + } } } diff --git a/src/RE/N/NiAVObject.cpp b/src/RE/N/NiAVObject.cpp index bb0303a11..7fac6398a 100644 --- a/src/RE/N/NiAVObject.cpp +++ b/src/RE/N/NiAVObject.cpp @@ -164,11 +164,11 @@ namespace RE return func(this, a_collisionLayer, a_group); } - bool NiAVObject::SetMotionType(std::uint32_t a_motionType, bool a_arg2, bool a_arg3, bool a_allowActivate) + bool NiAVObject::SetMotionType(hkpMotion::MotionType a_motionType, bool a_recurse, bool a_force, bool a_allowActivate) { using func_t = decltype(&NiAVObject::SetMotionType); REL::Relocation func{ Offset::NiAVObject::SetMotionType }; - return func(this, a_motionType, a_arg2, a_arg3, a_allowActivate); + return func(this, a_motionType, a_recurse, a_force, a_allowActivate); } bool NiAVObject::SetProjectedUVData(const NiColorA& a_projectedUVParams, const NiColor& a_projectedUVColor, bool a_isSnow) diff --git a/src/RE/N/NiCamera.cpp b/src/RE/N/NiCamera.cpp index 18250af61..4afeabd8b 100644 --- a/src/RE/N/NiCamera.cpp +++ b/src/RE/N/NiCamera.cpp @@ -2,14 +2,9 @@ namespace RE { - bool NiCamera::WorldPtToScreenPt3(const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance) - { - return WorldPtToScreenPt3(worldToCam, port, a_point, a_xOut, a_yOut, a_zOut, a_zeroTolerance); - } - bool NiCamera::BoundInFrustum(const NiBound& a_bound, NiCamera* a_camera) { - using func_t = decltype(&BoundInFrustum); + using func_t = decltype(&NiCamera::BoundInFrustum); REL::Relocation func{ RELOCATION_ID(15671, 15899) }; return func(a_bound, a_camera); } @@ -33,9 +28,21 @@ namespace RE return BoundInFrustum(bound, a_camera); } + bool NiCamera::WindowPointToRay(std::int32_t a_x, std::int32_t a_y, NiPoint3& a_origin, NiPoint3& a_dir, float a_windowWidth, float a_windowHeight) + { + using func_t = decltype(&NiCamera::WindowPointToRay); + REL::Relocation func{ RELOCATION_ID(69263, 70630) }; + return func(this, a_x, a_y, a_origin, a_dir, a_windowWidth, a_windowHeight); + } + + bool NiCamera::WorldPtToScreenPt3(const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance) + { + return WorldPtToScreenPt3(worldToCam, port, a_point, a_xOut, a_yOut, a_zOut, a_zeroTolerance); + } + bool NiCamera::WorldPtToScreenPt3(const float a_matrix[4][4], const NiRect& a_port, const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance) { - using func_t = bool (*)(const float[4][4], const NiRect&, const NiPoint3&, float&, float&, float&, float); + using func_t = bool (*)(const float[4][4], const NiRect&, const NiPoint3&, float&, float&, float&, float); REL::Relocation func{ Offset::NiCamera::WorldPtToScreenPt3 }; return func(a_matrix, a_port, a_point, a_xOut, a_yOut, a_zOut, a_zeroTolerance); } diff --git a/src/RE/R/Renderer.cpp b/src/RE/R/Renderer.cpp index e122bce10..3bf4f1e7e 100644 --- a/src/RE/R/Renderer.cpp +++ b/src/RE/R/Renderer.cpp @@ -1,5 +1,7 @@ #include "RE/R/Renderer.h" +#include "RE/S/State.h" + namespace RE { namespace BSGraphics @@ -135,19 +137,20 @@ namespace RE REL::Relocation singleton{ RELOCATION_ID(524728, 411347) }; return *singleton; } + [[nodiscard]] ScreenSize Renderer::GetScreenSize() { - // This is a global managed by Renderer, but not part of the RendererData struct. - // We pass back the value so users are not tempted to modify this directly. - REL::Relocation singleton{ RELOCATION_ID(525002, 411483) }; - return *singleton; + const auto state = RE::BSGraphics::State::GetSingleton(); + return ScreenSize{ state->screenWidth, state->screenHeight }; } + [[nodiscard]] REX::W32::ID3D11Device* Renderer::GetDevice() { // Location is a global pointer to the device in the Renderer Data REL::Relocation device{ RELOCATION_ID(524729, 411348) }; return *device; } + [[nodiscard]] RendererWindow* Renderer::GetCurrentRenderWindow() { // Location is a global pointer to the current renderWindow (which is not necessarily at index 0 in the renderWindows array) diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index 9fa6af0f6..219efe936 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -30,6 +30,13 @@ namespace RE { + ObjectRefHandle TESObjectREFR::CreateReference(ObjectRefHandle& a_handleOut, FormType a_formType, bool a_addActorToProcessList) + { + using func_t = decltype(&TESObjectREFR::CreateReference); + REL::Relocation func{ RELOCATION_ID(19142, 19544) }; + return func(a_handleOut, a_formType, a_addActorToProcessList); + } + NiPointer TESObjectREFR::LookupByHandle(RefHandle a_refHandle) { NiPointer ref; @@ -782,12 +789,10 @@ namespace RE return true; } - bool TESObjectREFR::NameIncludes(std::string a_word) + bool TESObjectREFR::NameIncludes(std::string_view a_word) const { - auto obj = GetObjectReference(); - std::string name = obj ? obj->GetName() : ""; - - return name.find(a_word) != std::string::npos; + BSFixedString name = GetName(); + return name.contains(a_word); } void TESObjectREFR::OpenContainer(std::int32_t a_openType) const @@ -876,7 +881,7 @@ namespace RE AddChange(ChangeFlags::kEncZoneExtra); } - bool TESObjectREFR::SetMotionType(MotionType a_motionType, bool a_allowActivate) + bool TESObjectREFR::SetMotionType(hkpMotion::MotionType a_motionType, bool a_allowActivate) { auto node = Get3D(); if (!node) { @@ -884,11 +889,18 @@ namespace RE return false; } - auto result = node->SetMotionType(static_cast(a_motionType), true, false, a_allowActivate); + auto result = node->SetMotionType(a_motionType, true, false, a_allowActivate); AddChange(ChangeFlags::kHavokMoved); return result; } + void TESObjectREFR::SetOwner(TESForm* a_owner) + { + using func_t = decltype(&TESObjectREFR::SetOwner); + REL::Relocation func{ RELOCATION_ID(19793, 20198) }; + return func(this, a_owner); + } + void TESObjectREFR::SetPosition(float a_x, float a_y, float a_z) { return SetPosition(NiPoint3(a_x, a_y, a_z)); @@ -899,6 +911,13 @@ namespace RE MoveTo_Impl(ObjectRefHandle(), GetParentCell(), GetWorldspace(), a_pos, data.angle); } + void TESObjectREFR::SetTemporary() + { + using func_t = decltype(&TESObjectREFR::SetTemporary); + REL::Relocation func{ RELOCATION_ID(14485, 14642) }; + func(this); + } + InventoryChanges* TESObjectREFR::ForceInitInventoryChanges() { auto changes = MakeInventoryChanges();