From 0de58c76cdea57b6c6e444f701197c35484b4002 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Mon, 27 Apr 2026 18:05:48 -0500 Subject: [PATCH 1/9] feat: havok misc --- include/RE/B/BSHavok.h | 50 +++++ include/RE/B/BSShaderResourceManager.h | 74 +++++++ include/RE/B/BSSoundHandle.h | 99 ++++++++- include/RE/B/BSVisit.h | 19 +- include/RE/B/BSXFlags.h | 63 ++++++ include/RE/B/bhkCharacterController.h | 2 +- include/RE/B/bhkNPCollisionObject.h | 16 +- include/RE/B/bhkNPCollisionObjectBase.h | 11 + include/RE/B/bhkPhysicsSystem.h | 1 + include/RE/B/bhkUtilFunctions.h | 12 +- include/RE/B/bhkWorld.h | 2 +- include/RE/E/EXTERIOR_DATA.h | 30 +++ include/RE/Fallout.h | 56 ++++- include/RE/G/GridCellArray.h | 60 ++--- include/RE/H/hkAabb.h | 2 +- include/RE/H/hkAabb16.h | 15 ++ include/RE/H/hkArray.h | 179 ++++++++++++--- include/RE/H/hkBaseObject.h | 3 + include/RE/H/hkBitField.h | 1 + include/RE/H/hkBlockStream.h | 3 + include/RE/H/hkContainerHeapAllocator.h | 20 +- include/RE/H/hkCriticalSection.h | 48 +++- include/RE/H/hkEnum.h | 2 +- include/RE/H/hkFreeListArray.h | 38 ++++ include/RE/H/hkHalf.h | 10 + include/RE/H/hkHandle.h | 6 +- include/RE/H/hkHardwareInfo.h | 26 +++ include/RE/H/hkIntSpaceUtil.h | 12 +- include/RE/H/hkLifoAllocator.h | 53 +++++ include/RE/H/hkLocalArray.h | 35 +++ include/RE/H/hkMap.h | 32 +-- include/RE/H/hkMatrix3.h | 30 +++ include/RE/H/hkMemoryAllocator.h | 30 +-- include/RE/H/hkMemoryRouter.h | 48 ++++ include/RE/H/hkMemorySystem.h | 60 +++++ include/RE/H/hkMonitorStream.h | 44 ++++ include/RE/H/hkMultiMap.h | 31 +++ include/RE/H/hkProcessContext.h | 29 +++ include/RE/H/hkProcessFactory.h | 31 +++ include/RE/H/hkQsTransformf.h | 12 +- .../RE/H/{hkQuaternionf.h => hkQuaternion.h} | 2 + include/RE/H/hkRefPtr.h | 75 ++++++- include/RE/H/hkReferencedObject.h | 32 ++- include/RE/H/hkRelArray.h | 40 ++++ include/RE/H/hkRotation.h | 16 ++ include/RE/H/hkSignal.h | 46 ++-- include/RE/H/hkSlot.h | 4 +- include/RE/H/hkStepInfo.h | 8 +- include/RE/H/hkStopwatch.h | 20 +- include/RE/H/hkStridedVertices.h | 40 ++++ include/RE/H/hkStringPtr.h | 53 +++++ include/RE/H/hkTransform.h | 19 ++ include/RE/H/hkVector4.h | 50 +++++ include/RE/H/hkVector4f.h | 12 - include/RE/H/hkVisualDebugger.h | 82 +++++++ include/RE/H/hkVtableClassRegistry.h | 20 ++ include/RE/H/hkcdRay.h | 2 +- include/RE/H/hkcdRayQueryFlags.h | 2 +- include/RE/H/hknpActivation.h | 11 + include/RE/H/hknpAllHitsCollector.h | 8 +- include/RE/H/hknpBody.h | 47 ++++ include/RE/H/hknpBodyCinfo.h | 40 ++++ include/RE/H/hknpBodyQualityId.h | 13 ++ include/RE/H/hknpCharacterContext.h | 35 +-- include/RE/H/hknpCharacterState.h | 5 +- include/RE/H/hknpCharacterSurfaceInfo.h | 9 +- include/RE/H/hknpClosestHitCollector.h | 28 +++ .../H/hknpClosestUniqueBodyIdHitCollector.h | 2 +- include/RE/H/hknpCollisionFlags.h | 50 +++++ include/RE/H/hknpCollisionQuery.h | 6 +- include/RE/H/hknpCollisionQueryCollector.h | 4 +- include/RE/H/hknpCollisionResult.h | 26 +-- include/RE/H/hknpCompositeShape.h | 20 ++ include/RE/H/hknpCompoundShape.h | 30 +++ include/RE/H/hknpConstraintId.h | 13 ++ include/RE/H/hknpConstraintManager.h | 21 +- include/RE/H/hknpConvexPolytopeShape.h | 29 +++ include/RE/H/hknpConvexShape.h | 77 +++++++ include/RE/H/hknpDefaultViewerColorScheme.h | 31 +++ include/RE/H/hknpDynamicCompoundShape.h | 20 ++ include/RE/H/hknpMaterialId.h | 4 +- include/RE/H/hknpMotionCinfo.h | 43 ++++ include/RE/H/hknpMotionManager.h | 22 +- include/RE/H/hknpPhysicsSystem.h | 53 +++++ include/RE/H/hknpPhysicsSystemData.h | 39 ++++ include/RE/H/hknpProcessContext.h | 51 +++++ include/RE/H/hknpQueryFilterData.h | 6 +- include/RE/H/hknpRayCastQuery.h | 6 +- include/RE/H/hknpShape.h | 30 ++- include/RE/H/hknpShapeInstance.h | 22 ++ include/RE/H/hknpShapeInstanceId.h | 13 ++ include/RE/H/hknpShapeManager.h | 14 +- include/RE/H/hknpShapeSignals.h | 4 +- include/RE/H/hknpSolverInfo.h | 62 +++--- include/RE/H/hknpSparseCompactMap.h | 19 ++ include/RE/H/hknpSphereShape.h | 22 ++ include/RE/H/hknpThreadSafetyCheck.h | 6 +- include/RE/H/hknpUniqueBodyIdHitCollector.h | 4 +- include/RE/H/hknpViewerColorScheme.h | 19 ++ include/RE/H/hknpWorld.h | 27 ++- include/RE/H/hknpWorldCinfo.h | 2 +- include/RE/H/hknpWorldSignals.h | 58 ++--- include/RE/I/IRendererResourceManager.h | 89 ++++++++ include/RE/IDs.h | 116 ++++++++++ include/RE/N/NiAVObject.h | 33 ++- include/RE/N/NiBinaryExtraData.h | 52 +++++ include/RE/N/NiBooleanExtraData.h | 49 +++++ include/RE/N/NiCollisionObject.h | 5 + include/RE/N/NiColor.h | 30 ++- include/RE/N/NiColorExtraData.h | 55 +++++ include/RE/N/NiExtraData.h | 12 +- include/RE/N/NiExtraDataContainer.h | 24 +- include/RE/N/NiFloatExtraData.h | 49 +++++ include/RE/N/NiIntegerExtraData.h | 49 +++++ include/RE/N/NiMatrix3.h | 24 +- include/RE/N/NiObject.h | 8 +- include/RE/N/NiObjectNET.h | 19 +- include/RE/N/NiPoint.h | 186 ++++++++-------- include/RE/N/NiRTTI.h | 8 +- include/RE/N/NiStringExtraData.h | 34 ++- include/RE/N/NiTransform.h | 18 +- include/RE/P/PlayerCamera.h | 16 +- include/RE/T/TES.h | 12 +- include/RE/T/TESObjectCELL.h | 70 +++--- include/RE/T/TESObjectREFR.h | 56 +++-- include/RE/T/TESWorldSpace.h | 126 +++++------ include/RE/T/TrapData.h | 2 +- src/RE/B/BSVisit.cpp | 78 ++++--- src/RE/H/hkMatrix3.cpp | 73 ++++++ src/RE/H/hkTransform.cpp | 8 + src/RE/H/hkVector4.cpp | 181 +++++++++++++++ src/RE/N/NiAVObject.cpp | 8 +- src/RE/N/NiExtraData.cpp | 27 +++ src/RE/N/NiExtraDataContainer.cpp | 58 +++++ src/RE/N/NiMatrix3.cpp | 78 +++---- src/RE/N/NiObjectNET.cpp | 76 ++++++- src/RE/N/NiPoint.cpp | 208 +++++++++--------- src/RE/N/NiTransform.cpp | 22 +- src/RE/T/TES.cpp | 92 ++++++++ src/RE/T/TESObjectCELL.cpp | 29 +++ 140 files changed, 4147 insertions(+), 802 deletions(-) create mode 100644 include/RE/B/BSHavok.h create mode 100644 include/RE/B/BSShaderResourceManager.h create mode 100644 include/RE/B/BSXFlags.h create mode 100644 include/RE/E/EXTERIOR_DATA.h create mode 100644 include/RE/H/hkAabb16.h create mode 100644 include/RE/H/hkFreeListArray.h create mode 100644 include/RE/H/hkHalf.h create mode 100644 include/RE/H/hkHardwareInfo.h create mode 100644 include/RE/H/hkLifoAllocator.h create mode 100644 include/RE/H/hkLocalArray.h create mode 100644 include/RE/H/hkMatrix3.h create mode 100644 include/RE/H/hkMemoryRouter.h create mode 100644 include/RE/H/hkMemorySystem.h create mode 100644 include/RE/H/hkMonitorStream.h create mode 100644 include/RE/H/hkMultiMap.h create mode 100644 include/RE/H/hkProcessContext.h create mode 100644 include/RE/H/hkProcessFactory.h rename include/RE/H/{hkQuaternionf.h => hkQuaternion.h} (80%) create mode 100644 include/RE/H/hkRelArray.h create mode 100644 include/RE/H/hkRotation.h create mode 100644 include/RE/H/hkStridedVertices.h create mode 100644 include/RE/H/hkStringPtr.h create mode 100644 include/RE/H/hkTransform.h create mode 100644 include/RE/H/hkVector4.h delete mode 100644 include/RE/H/hkVector4f.h create mode 100644 include/RE/H/hkVisualDebugger.h create mode 100644 include/RE/H/hkVtableClassRegistry.h create mode 100644 include/RE/H/hknpActivation.h create mode 100644 include/RE/H/hknpBody.h create mode 100644 include/RE/H/hknpBodyCinfo.h create mode 100644 include/RE/H/hknpBodyQualityId.h create mode 100644 include/RE/H/hknpClosestHitCollector.h create mode 100644 include/RE/H/hknpCollisionFlags.h create mode 100644 include/RE/H/hknpCompositeShape.h create mode 100644 include/RE/H/hknpCompoundShape.h create mode 100644 include/RE/H/hknpConstraintId.h create mode 100644 include/RE/H/hknpConvexPolytopeShape.h create mode 100644 include/RE/H/hknpConvexShape.h create mode 100644 include/RE/H/hknpDefaultViewerColorScheme.h create mode 100644 include/RE/H/hknpDynamicCompoundShape.h create mode 100644 include/RE/H/hknpMotionCinfo.h create mode 100644 include/RE/H/hknpPhysicsSystem.h create mode 100644 include/RE/H/hknpPhysicsSystemData.h create mode 100644 include/RE/H/hknpProcessContext.h create mode 100644 include/RE/H/hknpShapeInstance.h create mode 100644 include/RE/H/hknpShapeInstanceId.h create mode 100644 include/RE/H/hknpSparseCompactMap.h create mode 100644 include/RE/H/hknpSphereShape.h create mode 100644 include/RE/H/hknpViewerColorScheme.h create mode 100644 include/RE/I/IRendererResourceManager.h create mode 100644 include/RE/N/NiBinaryExtraData.h create mode 100644 include/RE/N/NiBooleanExtraData.h create mode 100644 include/RE/N/NiColorExtraData.h create mode 100644 include/RE/N/NiFloatExtraData.h create mode 100644 include/RE/N/NiIntegerExtraData.h create mode 100644 src/RE/H/hkMatrix3.cpp create mode 100644 src/RE/H/hkTransform.cpp create mode 100644 src/RE/H/hkVector4.cpp create mode 100644 src/RE/N/NiExtraData.cpp create mode 100644 src/RE/N/NiExtraDataContainer.cpp create mode 100644 src/RE/T/TES.cpp diff --git a/include/RE/B/BSHavok.h b/include/RE/B/BSHavok.h new file mode 100644 index 00000000..1320b803 --- /dev/null +++ b/include/RE/B/BSHavok.h @@ -0,0 +1,50 @@ +#pragma once + +#include "RE/N/NiTransform.h" +#include "RE/H/hkTransform.h" + +namespace RE +{ + constexpr auto HK_TO_BS_SCALE{ 69.99125F }; + constexpr auto BS_TO_HK_SCALE{ 0.0142875F }; + + template + constexpr T1 HK_TO_NI(const T2& a_hk) noexcept + { + if constexpr (std::is_same_v && std::is_same_v) { + return NiPoint3(a_hk.x, a_hk.y, a_hk.z) * HK_TO_BS_SCALE; + } else if constexpr (std::is_same_v && std::is_same_v) { + return NiPoint3A(a_hk.x, a_hk.y, a_hk.z) * HK_TO_BS_SCALE; + } else if constexpr (std::is_same_v && std::is_same_v) { + return NiPoint4(a_hk.x, a_hk.y, a_hk.z, a_hk.w) * HK_TO_BS_SCALE; + } else if constexpr (std::is_same_v && (std::is_same_v || std::is_same_v)) { + NiMatrix3 ni; + ni[0] = { a_hk[0][0], a_hk[1][0], a_hk[2][0], 0.0F }; + ni[1] = { a_hk[0][1], a_hk[1][1], a_hk[2][1], 0.0F }; + ni[2] = { a_hk[0][2], a_hk[1][2], a_hk[2][2], 0.0F }; + return ni; + } else if constexpr (std::is_same_v && std::is_same_v) { + return NiTransform(HK_TO_NI(a_hk.rotation), HK_TO_NI(a_hk.translation)); + } + } + + template + constexpr T1 NI_TO_HK(const T2& a_ni) noexcept + { + if constexpr (std::is_same_v && std::is_same_v) { + return hkVector4f(a_ni.x, a_ni.y, a_ni.z, 0.0F) * BS_TO_HK_SCALE; + } else if constexpr (std::is_same_v && std::is_same_v) { + return hkVector4f(a_ni.x, a_ni.y, a_ni.z, 0.0F) * BS_TO_HK_SCALE; + } else if constexpr (std::is_same_v && std::is_same_v) { + return hkVector4f(a_ni.x, a_ni.y, a_ni.z, a_ni.w) * BS_TO_HK_SCALE; + } else if constexpr ((std::is_same_v || std::is_same_v) && std::is_same_v) { + hkMatrix3f hk; + hk[0] = { a_ni[0][0], a_ni[1][0], a_ni[2][0], 0.0F }; + hk[1] = { a_ni[0][1], a_ni[1][1], a_ni[2][1], 0.0F }; + hk[2] = { a_ni[0][2], a_ni[1][2], a_ni[2][2], 0.0F }; + return hk; + } else if constexpr (std::is_same_v && std::is_same_v) { + return hkTransform(NI_TO_HK(a_ni.rotate), NI_TO_HK(a_ni.translate)); + } + } +} diff --git a/include/RE/B/BSShaderResourceManager.h b/include/RE/B/BSShaderResourceManager.h new file mode 100644 index 00000000..77f2373c --- /dev/null +++ b/include/RE/B/BSShaderResourceManager.h @@ -0,0 +1,74 @@ +#pragma once + +#include "RE/I/IRendererResourceManager.h" + +namespace RE +{ + class __declspec(novtable) BSShaderResourceManager : + public IRendererResourceManager + { + public: + static constexpr auto RTTI{ RTTI::BSShaderResourceManager }; + static constexpr auto VTABLE{ VTABLE::BSShaderResourceManager }; + + virtual ~BSShaderResourceManager(); + + virtual BSTriShape* CreateTriShape(std::uint32_t a_numTriangles, std::uint16_t* a_indices, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords0, NiColorA* a_texCoords1, NiPoint3* a_normals, NiPoint3* a_binormals, NiPoint3* a_tangents, NiColorA* a_colors, NiColorA* a_skinBoneWeights, std::uint8_t* a_skinBoneIndices, NiColorA* a_landscapeData1, NiColorA* a_landscapeData2, float* a_eyeData, bool a_generatePositionData) override; + virtual BSTriShape* CreateTriShape(std::uint32_t a_numTriangles, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords, NiColorA* a_colors, std::uint16_t* a_indices) override; + virtual void* CreateTriShape(NiStream* a_stream, std::uint64_t a_vertexDesc, std::uint32_t a_vertexCount, std::uint32_t a_indexCount, char** a_dynamicData) override; + virtual void* CreateTriShapeRendererData(void* a_vertexBuffer, std::uint64_t a_vertexDesc, std::uint16_t* a_indices, std::uint32_t a_indexCount) override; + virtual BSSubIndexTriShape* CreateSubIndexTriShape(std::uint32_t a_numTriangles, std::uint32_t a_numSegments, std::uint16_t* a_indices, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords0, NiColorA* a_texCoords1, NiPoint3* a_normals, NiPoint3* a_binormals, NiPoint3* a_tangents, NiColorA* a_colors, NiColorA* a_skinBoneWeights, std::uint8_t* a_skinBoneIndices, NiColorA* a_landscapeData1, NiColorA* a_landscapeData2, float* a_eyeData) override; + virtual void IncRefTriShape(void* a_rendererData) override; + virtual void DecRefTriShape(void* a_rendererData) override; + virtual BSDynamicTriShape* CreateDynamicTriShape(std::uint32_t a_dynamicFlags, std::uint32_t a_numTriangles, std::uint16_t* a_indices, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords0, NiColorA* a_texCoords1, NiPoint3* a_normals, NiPoint3* a_binormals, NiPoint3* a_tangents, NiColorA* a_colors, NiColorA* a_skinBoneWeights, std::uint8_t* a_skinBoneIndices, NiColorA* a_landscapeData1, NiColorA* a_landscapeData2, float* a_eyeData) override; + virtual BSDynamicTriShape* CreateDynamicTriShape(std::uint32_t, std::uint32_t, std::uint32_t, NiPoint3*, NiPoint2*, NiColorA*, std::uint16_t*) override; + virtual void IncRefDynamicTriShape(void* a_rendererData) override; + virtual void DecRefDynamicTriShape(void* a_rendererData) override; + virtual void ConvertBSTriShapeToBSDynamicTriShape(NiNode* a_root, NiDefaultAVObjectPalette* a_objectPalette) override; + virtual void ApplyMaterials(NiAVObject* a_root) override; + virtual void SetTriShapeStreamDynamicFlags(std::uint32_t) override; + virtual void* CreateParticleShape() override; + virtual void IncRefParticleShape(void* a_rendererData) override; + virtual void DecRefParticleShape(void* a_rendererData) override; + virtual BSLines* CreateLineShape(std::uint32_t a_numLines, std::uint16_t* a_indices, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords0, NiColorA* a_texCoords1, NiPoint3* a_normals, NiPoint3* a_binormals, NiPoint3* a_tangents, NiColorA* a_colors, NiColorA* a_skinBoneWeights, std::uint8_t* a_skinBoneIndices, NiColorA* a_landscapeData1, NiColorA* a_landscapeData2, float* a_eyeData) override; + virtual BSDynamicLines* CreateDynamicLineShape(std::uint32_t, std::uint32_t, std::uint32_t, NiPoint3*, NiPoint2*, NiColorA*, std::uint16_t*) override; + virtual void* CreateDynamicLineShape(NiStream*, std::uint64_t, std::uint32_t, std::uint32_t) override; + virtual BSDynamicLines* CreateDynamicLineShape(std::uint32_t, std::uint32_t, std::uint16_t*, std::uint32_t, NiPoint3*, NiPoint2*, NiColorA*, NiPoint3*, NiPoint3*, NiPoint3*, NiColorA*, NiColorA*, std::uint8_t*, NiColorA*, NiColorA*, float*) override; + virtual void IncRefLines(void* a_rendererData) override; + virtual void DecRefLines(void* a_rendererData) override; + virtual void IncRefDynamicLines(void* a_rendererData) override; + virtual void DecRefDynamicLines(void* a_rendererData) override; + virtual void LoadTexture(NiTexture* apTexture) override; + virtual void CreateStreamingTexture(NiTexture* a_texture, const void* a_userDataIn, void* a_userDataOut) override; + virtual bool ReadStreamingTextureData(NiTexture* a_texture, void* a_userDataIn) override; + virtual bool CreateStreamingTextureArraySlice(NiTexture* a_texture, const void* a_userDataIn, void* a_userDataOut, std::uint32_t a_slice) override; + virtual bool ReadStreamingTextureDataToArraySlice(NiTexture* a_texture, void* a_userDataIn, std::uint32_t a_slice) override; + virtual void FinishStreamingTexture(NiTexture* a_texture) override; + virtual void IncRefTexture(BSGraphics::Texture* a_rendererData) override; + virtual void DecRefTexture(BSGraphics::Texture* a_rendererData) override; + virtual void GetTextureWidthHeight(NiTexture* a_texture, std::uint32_t* a_width, std::uint32_t* a_height) override; + virtual std::uint32_t GetTextureFormat(NiTexture* a_texture) override; + virtual bool UpdateTextureToDesiredMipLevel(NiTexture* a_texture, std::uint32_t*) override; + virtual void LoadUpgradeTextureData(NiTexture* a_texture) override; + virtual bool UpdateStreamingTextureToDesiredMipLevel(NiTexture* a_texture, std::uint32_t*, void*, void*) override; + virtual void FinishStreamingTextureUpgade(NiTexture* a_texture) override; + virtual void* CreateVertexBuffer(std::uint32_t* a_dataSize, void* a_data, std::uint32_t a_stride, std::uint64_t) override; + virtual void DecRefVertexBuffer(void* a_rendererData) override; + virtual NiShadeProperty* CreateDefaultEffectShaderProperty(bool a_vertexColors, bool a_skinned) override; + virtual BSMeshLODTriShape* CreateMeshLODTriShape(std::uint32_t*, std::uint32_t, std::uint64_t, std::uint32_t, std::uint32_t, void*) override; + virtual BSMeshLODTriShape* CreateMeshLODTriShape(BSTriShape*, std::uint32_t*, std::uint32_t) override; + virtual std::uint32_t UpdateIndexBufferForInstancing(BSMultiStreamInstanceTriShape*, std::uint32_t) override; + virtual bool FindIntersectionsTriShapeFastPath(const NiPoint3*, const NiPoint3*, NiPick*, BSTriShape*) override; + virtual void CreateTangentSpace(std::uint32_t, std::uint16_t*, std::uint32_t, NiPoint3*, NiPoint2*, NiPoint3*, NiPoint3*, NiPoint3*) override; + virtual float GetShaderFrameCount() override; + virtual float GetShaderTimerDelta() override; + virtual void GetFadeNodeSettings(FadeNodeSettings* a_skinned) override; + virtual void GetCameraVectors(NiPoint3* a_up, NiPoint3* a_right, NiPoint3* a_direction) override; + + static inline BSShaderResourceManager* GetSingleton() + { + static REL::Relocation ptr{ ID::BSShaderResourceManager::Singleton }; + return *ptr; + } + }; +} diff --git a/include/RE/B/BSSoundHandle.h b/include/RE/B/BSSoundHandle.h index 626724c0..67340b96 100644 --- a/include/RE/B/BSSoundHandle.h +++ b/include/RE/B/BSSoundHandle.h @@ -3,6 +3,8 @@ namespace RE { class BSISoundOutputModel; + class NiAVObject; + class NiPoint3; class BSSoundHandle { @@ -25,6 +27,13 @@ namespace RE kEnvSlow = 0x3 }; + void ClearFollowedObject() + { + using func_t = decltype(&BSSoundHandle::ClearFollowedObject); + static REL::Relocation func{ ID::BSSoundHandle::ClearFollowedObject }; + func(this); + } + bool FadeInPlay(std::uint16_t a_milliseconds) { using func_t = decltype(&BSSoundHandle::FadeInPlay); @@ -39,6 +48,34 @@ namespace RE return func(this, a_milliseconds); } + bool FadeTo(const std::uint16_t a_targetAttenuation, const std::uint16_t a_milliseconds) + { + using func_t = decltype(&BSSoundHandle::FadeTo); + static REL::Relocation func{ ID::BSSoundHandle::FadeTo }; + return func(this, a_targetAttenuation, a_milliseconds); + } + + std::uint64_t GetDuration() + { + using func_t = decltype(&BSSoundHandle::GetDuration); + static REL::Relocation func{ ID::BSSoundHandle::GetDuration }; + return func(this); + } + + bool IsEnvelopeLoop() + { + using func_t = decltype(&BSSoundHandle::IsEnvelopeLoop); + static REL::Relocation func{ ID::BSSoundHandle::IsEnvelopeLoop }; + return func(this); + } + + bool IsPaused() + { + using func_t = decltype(&BSSoundHandle::IsPaused); + static REL::Relocation func{ ID::BSSoundHandle::IsPaused }; + return func(this); + } + bool IsPlaying() const { using func_t = decltype(&BSSoundHandle::IsPlaying); @@ -46,6 +83,20 @@ namespace RE return func(this); } + bool IsValid() + { + using func_t = decltype(&BSSoundHandle::IsValid); + static REL::Relocation func{ ID::BSSoundHandle::IsValid }; + return func(this); + } + + bool Pause() + { + using func_t = decltype(&BSSoundHandle::Pause); + static REL::Relocation func{ ID::BSSoundHandle::Pause }; + return func(this); + } + bool Play() { using func_t = decltype(&BSSoundHandle::Play); @@ -53,6 +104,34 @@ namespace RE return func(this); } + bool PlayAfter(const std::uint64_t a_delay) + { + using func_t = decltype(&BSSoundHandle::PlayAfter); + static REL::Relocation func{ ID::BSSoundHandle::PlayAfter }; + return func(this, a_delay); + } + + bool SetFrequency(const float a_frequency) + { + using func_t = decltype(&BSSoundHandle::SetFrequency); + static REL::Relocation func{ ID::BSSoundHandle::SetFrequency }; + return func(this, a_frequency); + } + + bool SetFrequencyVariance(const std::uint8_t a_variance) + { + using func_t = decltype(&BSSoundHandle::SetFrequencyVariance); + static REL::Relocation func{ ID::BSSoundHandle::SetFrequencyVariance }; + return func(this, a_variance); + } + + void SetObjectToFollow(const NiAVObject* a_object) + { + using func_t = decltype(&BSSoundHandle::SetObjectToFollow); + static REL::Relocation func{ ID::BSSoundHandle::SetObjectToFollow }; + func(this, a_object); + } + bool SetOutputModel(const BSISoundOutputModel* a_outputModel) { using func_t = decltype(&BSSoundHandle::SetOutputModel); @@ -60,6 +139,20 @@ namespace RE return func(this, a_outputModel); } + bool SetPosition(const NiPoint3& a_position) + { + using func_t = decltype(&BSSoundHandle::SetPosition); + static REL::Relocation func{ ID::BSSoundHandle::SetPosition }; + return func(this, a_position); + } + + bool SetStaticAttenuation(const std::uint16_t a_attenuation) + { + using func_t = decltype(&BSSoundHandle::SetStaticAttenuation); + static REL::Relocation func{ ID::BSSoundHandle::SetStaticAttenuation }; + return func(this, a_attenuation); + } + bool Stop() { using func_t = decltype(&BSSoundHandle::Stop); @@ -68,9 +161,9 @@ namespace RE } // members - std::uint32_t soundID; // 0 - bool assumeSuccess; // 4 - std::int8_t state; // 5 + std::uint32_t soundID; // 0x0 + bool assumeSuccess; // 0x4 + std::uint8_t state; // 0x5 }; static_assert(sizeof(BSSoundHandle) == 0x8); } diff --git a/include/RE/B/BSVisit.h b/include/RE/B/BSVisit.h index c7ca6dea..562c00d7 100644 --- a/include/RE/B/BSVisit.h +++ b/include/RE/B/BSVisit.h @@ -2,19 +2,20 @@ namespace RE { - class bhkNiCollisionObject; + class bhkNPCollisionObject; class BSGeometry; class NiAVObject; - namespace BSVisit + enum class BSVisitControl { - enum class BSVisitControl - { - kContinue = 0x0, - kStop = 0x1 - }; + kContinue = 0x0, + kStop = 0x1 + }; - BSVisitControl TraverseScenegraphGeometries(NiAVObject* a_object, std::function a_func); - BSVisitControl TraverseScenegraphObjects(NiAVObject* a_object, std::function a_func); + namespace BSVisit + { + BSVisitControl TraverseScenegraphGeometries(const NiAVObject* a_object, std::function a_func); + BSVisitControl TraverseScenegraphObjects(const NiAVObject* a_object, std::function a_func); + BSVisitControl TraverseScenegraphCollision(const NiAVObject* a_object, std::function a_func); } } diff --git a/include/RE/B/BSXFlags.h b/include/RE/B/BSXFlags.h new file mode 100644 index 00000000..ab5c7af6 --- /dev/null +++ b/include/RE/B/BSXFlags.h @@ -0,0 +1,63 @@ +#pragma once + +#include "RE/N/NiIntegerExtraData.h" +#include "RE/N/NiObjectNET.h" + +namespace RE +{ + class __declspec(novtable) BSXFlags : + public NiIntegerExtraData + { + public: + static constexpr auto RTTI{ RTTI::BSXFlags }; + static constexpr auto VTABLE{ VTABLE::BSXFlags }; + static constexpr auto Ni_RTTI{ Ni_RTTI::BSXFlags }; + + enum class Flag : std::int32_t + { + kNone = 0, + kAnimated = 1 << 0, + kHavok = 1 << 1, + kRagdoll = 1 << 2, + kComplex = 1 << 3, + kAddon = 1 << 4, + kEditorMarker = 1 << 5, + kDynamic = 1 << 6, + kArticulated = 1 << 7, + kNeedsTransformUpdate = 1 << 8, + kExternalEmit = 1 << 9, + kMagicShaderParticles = 1 << 10, + kLights = 1 << 11, + kBreakable = 1 << 12, + kSearchedBreakable = 1 << 13 + }; + + BSXFlags() : + NiIntegerExtraData("BSX", 0) + { + REX::EMPLACE_VTABLE(this); + } + + BSXFlags(const REX::TEnumSet a_value) : + NiIntegerExtraData("BSX", a_value.underlying()) + { + REX::EMPLACE_VTABLE(this); + } + + REX::TEnumSet GetFlags() const + { + return static_cast(value); + } + + void SetFlags(const REX::TEnumSet a_value) + { + value = a_value.underlying(); + } + + static BSXFlags* Find(NiObjectNET* a_object) + { + return a_object ? a_object->GetExtraData("BSX") : nullptr; + } + }; + static_assert(sizeof(BSXFlags) == 0x20); +} diff --git a/include/RE/B/bhkCharacterController.h b/include/RE/B/bhkCharacterController.h index 55355571..0632cf98 100644 --- a/include/RE/B/bhkCharacterController.h +++ b/include/RE/B/bhkCharacterController.h @@ -6,7 +6,7 @@ #include "RE/B/bhkNPCollisionObjectUnlinked.h" #include "RE/H/hkRefPtr.h" #include "RE/H/hkStepInfo.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpCharacterContext.h" #include "RE/H/hknpCharacterState.h" #include "RE/H/hknpCharacterSurfaceInfo.h" diff --git a/include/RE/B/bhkNPCollisionObject.h b/include/RE/B/bhkNPCollisionObject.h index 43022fa0..b34e5843 100644 --- a/include/RE/B/bhkNPCollisionObject.h +++ b/include/RE/B/bhkNPCollisionObject.h @@ -28,6 +28,13 @@ namespace RE virtual void RemoveFromWorld(); // 2F virtual bool SetCollisionFilterInfo(CFilter a_filterInfo); // 30 + static bhkNPCollisionObject* CreateObject() + { + using func_t = decltype(&bhkNPCollisionObject::CreateObject); + static REL::Relocation func{ ID::bhkNPCollisionObject::CreateObject }; + func(); + } + void CopyMembers(bhkNPCollisionObject* a_dest, NiCloningProcess& a_cloningProcess) { using func_t = decltype(&bhkNPCollisionObject::CopyMembers); @@ -49,9 +56,9 @@ namespace RE return func(this, a_id); } - bhkPhysicsSystem* GetPhysicsSystem() + NiPointer GetPhysicsSystem() const { - return system.get(); + return system; } hknpShape* GetShape() @@ -75,6 +82,11 @@ namespace RE func(this, a_type); } + void SetPhysicsSystem(NiPointer a_system) + { + system = a_system; + } + bool SetTransform(hkTransformf& a_transform) { using func_t = decltype(&bhkNPCollisionObject::SetTransform); diff --git a/include/RE/B/bhkNPCollisionObjectBase.h b/include/RE/B/bhkNPCollisionObjectBase.h index b115f1e0..f0b24ca3 100644 --- a/include/RE/B/bhkNPCollisionObjectBase.h +++ b/include/RE/B/bhkNPCollisionObjectBase.h @@ -20,6 +20,17 @@ namespace RE kRot = 0x2 }; + enum class Flag : std::uint16_t + { + kNotifyPos = 0x4, + kSetLocalPos = 0x8, + kUseVelPos = 0x20, + kResetPos = 0x40, + kSyncOnUpdate = 0x80, + kAnimTargeted = 0x400, + kDismemberedLimb = 0x800, + }; + // add virtual void LockMotionImpl() = 0; // 2C diff --git a/include/RE/B/bhkPhysicsSystem.h b/include/RE/B/bhkPhysicsSystem.h index 771d7f90..625e54e2 100644 --- a/include/RE/B/bhkPhysicsSystem.h +++ b/include/RE/B/bhkPhysicsSystem.h @@ -2,6 +2,7 @@ #include "RE/B/BSTArray.h" #include "RE/H/hkArray.h" +#include "RE/H/hkLocalArray.h" #include "RE/H/hkRefPtr.h" #include "RE/N/NiObject.h" diff --git a/include/RE/B/bhkUtilFunctions.h b/include/RE/B/bhkUtilFunctions.h index 0f86f236..2d0ffa18 100644 --- a/include/RE/B/bhkUtilFunctions.h +++ b/include/RE/B/bhkUtilFunctions.h @@ -1,17 +1,27 @@ #pragma once +#include "RE/H/hknpBodyId.h" + namespace RE { class bhkNPCollisionObject; + class hknpBSWorld; class NiAVObject; namespace bhkUtilFunctions { - inline bhkNPCollisionObject* FindFirstCollisionObject(NiAVObject* a_object) + inline bhkNPCollisionObject* FindFirstCollisionObject(const NiAVObject* a_object) { using func_t = decltype(&bhkUtilFunctions::FindFirstCollisionObject); static REL::Relocation func{ ID::bhkUtilFunctions::FindFirstCollisionObject }; return func(a_object); } + + inline NiAVObject* GetAVObjectFromBodyID(const hknpBSWorld* a_world, const hknpBodyId a_bodyID) + { + using func_t = decltype(&bhkUtilFunctions::GetAVObjectFromBodyID); + static REL::Relocation func{ ID::bhkUtilFunctions::GetAVObjectFromBodyID }; + return func(a_world, a_bodyID); + } } } diff --git a/include/RE/B/bhkWorld.h b/include/RE/B/bhkWorld.h index c125a361..24d29d10 100644 --- a/include/RE/B/bhkWorld.h +++ b/include/RE/B/bhkWorld.h @@ -5,7 +5,7 @@ #include "RE/B/bhkCharProxyManager.h" #include "RE/B/bhkCharRigidBodyManager.h" #include "RE/H/hkRefPtr.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpWorld.h" #include "RE/N/NiObject.h" diff --git a/include/RE/E/EXTERIOR_DATA.h b/include/RE/E/EXTERIOR_DATA.h new file mode 100644 index 00000000..af1bb909 --- /dev/null +++ b/include/RE/E/EXTERIOR_DATA.h @@ -0,0 +1,30 @@ +#pragma once + +namespace RE +{ + class BGSTerrainVisibilityData; + + class EXTERIOR_DATA + { + public: + enum class LandHideFlag : std::uint8_t + { + kNone = 0, + kQuad1 = 1 << 0, + kQuad2 = 1 << 1, + kQuad3 = 1 << 2, + kQuad4 = 1 << 3 + }; + + // members + std::int32_t cellX; // 0x00 + std::int32_t cellY; // 0x04 + std::uint8_t* maxHeightData; // 0x08 + BGSTerrainVisibilityData* lodVisData; // 0x10 + float maxHeight; // 0x18 + float worldX; // 0x1C + float worldY; // 0x20 + REX::TEnumSet landHideFlags; // 0x24 + }; + static_assert(sizeof(EXTERIOR_DATA) == 0x28); +} diff --git a/include/RE/Fallout.h b/include/RE/Fallout.h index 29d90854..aaeec1ab 100644 --- a/include/RE/Fallout.h +++ b/include/RE/Fallout.h @@ -275,6 +275,7 @@ #include "RE/B/BSGeometry.h" #include "RE/B/BSGraphics.h" #include "RE/B/BSHandleRefObject.h" +#include "RE/B/BSHavok.h" #include "RE/B/BSIAudioEffectChain.h" #include "RE/B/BSIMusicTrack.h" #include "RE/B/BSIMusicType.h" @@ -441,6 +442,7 @@ #include "RE/B/BSShaderMaterial.h" #include "RE/B/BSShaderProperty.h" #include "RE/B/BSShaderPropertyLightData.h" +#include "RE/B/BSShaderResourceManager.h" #include "RE/B/BSShaderTechniqueIDMap.h" #include "RE/B/BSShaderTextureSet.h" #include "RE/B/BSShaderUtil.h" @@ -499,6 +501,7 @@ #include "RE/B/BSUtilityShader.h" #include "RE/B/BSVisit.h" #include "RE/B/BSWaterShaderMaterial.h" +#include "RE/B/BSXFlags.h" #include "RE/B/BS_BUTTON_CODE.h" #include "RE/B/BarrierProjectile.h" #include "RE/B/BarterMenu.h" @@ -629,6 +632,7 @@ #include "RE/E/ENUM_FORM_ID.h" #include "RE/E/ENUM_LOD_MULT.h" #include "RE/E/EQUIP_TYPE.h" +#include "RE/E/EXTERIOR_DATA.h" #include "RE/E/EXTRA_DATA_TYPE.h" #include "RE/E/EaseOutInterpolator.h" #include "RE/E/EffectArchetypes.h" @@ -732,6 +736,7 @@ #include "RE/H/hclTriangleBuffer.h" #include "RE/H/hclVectorBuffer.h" #include "RE/H/hkAabb.h" +#include "RE/H/hkAabb16.h" #include "RE/H/hkArray.h" #include "RE/H/hkBaseObject.h" #include "RE/H/hkBitField.h" @@ -742,56 +747,97 @@ #include "RE/H/hkCriticalSection.h" #include "RE/H/hkEnum.h" #include "RE/H/hkFlags.h" +#include "RE/H/hkFreeListArray.h" +#include "RE/H/hkHalf.h" #include "RE/H/hkHandle.h" +#include "RE/H/hkHardwareInfo.h" #include "RE/H/hkIntSpaceUtil.h" +#include "RE/H/hkLifoAllocator.h" +#include "RE/H/hkLocalArray.h" #include "RE/H/hkMap.h" +#include "RE/H/hkMatrix3.h" #include "RE/H/hkMemoryAllocator.h" +#include "RE/H/hkMemoryRouter.h" +#include "RE/H/hkMemorySystem.h" +#include "RE/H/hkMonitorStream.h" +#include "RE/H/hkMultiMap.h" #include "RE/H/hkPadSpu.h" +#include "RE/H/hkProcessContext.h" +#include "RE/H/hkProcessFactory.h" #include "RE/H/hkPtrAndInt.h" #include "RE/H/hkQsTransformf.h" -#include "RE/H/hkQuaternionf.h" +#include "RE/H/hkQuaternion.h" #include "RE/H/hkRefPtr.h" #include "RE/H/hkReferencedObject.h" +#include "RE/H/hkRelArray.h" #include "RE/H/hkResult.h" #include "RE/H/hkResultEnum.h" +#include "RE/H/hkRotation.h" #include "RE/H/hkSignal.h" #include "RE/H/hkSimdFloat32.h" #include "RE/H/hkSlot.h" #include "RE/H/hkStepInfo.h" #include "RE/H/hkStopwatch.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkStridedVertices.h" +#include "RE/H/hkStringPtr.h" +#include "RE/H/hkTransform.h" +#include "RE/H/hkVector4.h" +#include "RE/H/hkVisualDebugger.h" +#include "RE/H/hkVtableClassRegistry.h" #include "RE/H/hkcdRay.h" #include "RE/H/hkcdRayQueryFlags.h" +#include "RE/H/hknpActivation.h" #include "RE/H/hknpAllHitsCollector.h" #include "RE/H/hknpBSWorld.h" +#include "RE/H/hknpBody.h" +#include "RE/H/hknpBodyCinfo.h" #include "RE/H/hknpBodyId.h" #include "RE/H/hknpBodyManager.h" +#include "RE/H/hknpBodyQualityId.h" #include "RE/H/hknpCharacterContext.h" #include "RE/H/hknpCharacterState.h" #include "RE/H/hknpCharacterSurfaceInfo.h" +#include "RE/H/hknpClosestHitCollector.h" #include "RE/H/hknpClosestUniqueBodyIdHitCollector.h" #include "RE/H/hknpCollisionDispatchType.h" +#include "RE/H/hknpCollisionFlags.h" #include "RE/H/hknpCollisionQuery.h" #include "RE/H/hknpCollisionQueryCollector.h" #include "RE/H/hknpCollisionQueryType.h" #include "RE/H/hknpCollisionResult.h" +#include "RE/H/hknpCompositeShape.h" +#include "RE/H/hknpCompoundShape.h" +#include "RE/H/hknpConstraintId.h" #include "RE/H/hknpConstraintIdDiscriminant.h" #include "RE/H/hknpConstraintManager.h" #include "RE/H/hknpContactSolverType.h" +#include "RE/H/hknpConvexPolytopeShape.h" +#include "RE/H/hknpConvexShape.h" +#include "RE/H/hknpDefaultViewerColorScheme.h" +#include "RE/H/hknpDynamicCompoundShape.h" #include "RE/H/hknpMaterialId.h" +#include "RE/H/hknpMotionCinfo.h" #include "RE/H/hknpMotionId.h" #include "RE/H/hknpMotionManager.h" #include "RE/H/hknpMotionPropertiesId.h" +#include "RE/H/hknpPhysicsSystem.h" +#include "RE/H/hknpPhysicsSystemData.h" +#include "RE/H/hknpProcessContext.h" #include "RE/H/hknpQueryFilterData.h" #include "RE/H/hknpRayCastQuery.h" #include "RE/H/hknpRayCastQueryResult.h" #include "RE/H/hknpShape.h" +#include "RE/H/hknpShapeInstance.h" +#include "RE/H/hknpShapeInstanceId.h" #include "RE/H/hknpShapeManager.h" #include "RE/H/hknpShapeSignals.h" #include "RE/H/hknpShapeType.h" #include "RE/H/hknpSolverInfo.h" +#include "RE/H/hknpSparseCompactMap.h" +#include "RE/H/hknpSphereShape.h" #include "RE/H/hknpThreadSafetyCheck.h" #include "RE/H/hknpUniqueBodyIdHitCollector.h" +#include "RE/H/hknpViewerColorScheme.h" #include "RE/H/hknpWorld.h" #include "RE/H/hknpWorldCinfo.h" #include "RE/H/hknpWorldSignals.h" @@ -821,6 +867,7 @@ #include "RE/I/IPathFollowerState.h" #include "RE/I/IPipboyThrottledValue.h" #include "RE/I/IPostAnimationChannelUpdateFunctor.h" +#include "RE/I/IRendererResourceManager.h" #include "RE/I/ITEM_CHANGE_FILTER.h" #include "RE/I/ITEM_REMOVE_REASON.h" #include "RE/I/IUIMessageData.h" @@ -929,20 +976,25 @@ #include "RE/N/NiAlphaProperty.h" #include "RE/N/NiBackToFrontAccumulator.h" #include "RE/N/NiBillboardNode.h" +#include "RE/N/NiBinaryExtraData.h" #include "RE/N/NiBinaryStream.h" +#include "RE/N/NiBooleanExtraData.h" #include "RE/N/NiBound.h" #include "RE/N/NiCamera.h" #include "RE/N/NiCloningProcess.h" #include "RE/N/NiCollisionObject.h" #include "RE/N/NiColor.h" +#include "RE/N/NiColorExtraData.h" #include "RE/N/NiControllerManager.h" #include "RE/N/NiControllerSequence.h" #include "RE/N/NiCullingProcess.h" #include "RE/N/NiExtraData.h" #include "RE/N/NiExtraDataContainer.h" #include "RE/N/NiFile.h" +#include "RE/N/NiFloatExtraData.h" #include "RE/N/NiFrustum.h" #include "RE/N/NiFrustumPlanes.h" +#include "RE/N/NiIntegerExtraData.h" #include "RE/N/NiLight.h" #include "RE/N/NiMatrix3.h" #include "RE/N/NiMemManager.h" diff --git a/include/RE/G/GridCellArray.h b/include/RE/G/GridCellArray.h index 10f2a913..14aefbbe 100644 --- a/include/RE/G/GridCellArray.h +++ b/include/RE/G/GridCellArray.h @@ -2,12 +2,11 @@ #include "RE/B/BSTArray.h" #include "RE/G/GridArray.h" +#include "RE/G/GridCell.h" #include "RE/N/NiPoint.h" namespace RE { - class GridCell; - class __declspec(novtable) GridCellArray : public GridArray // 00 { @@ -15,34 +14,34 @@ namespace RE static constexpr auto RTTI{ RTTI::GridCellArray }; static constexpr auto VTABLE{ VTABLE::GridCellArray }; - class QueuedAttatch + class QueuedAttach { private: - enum class ProgressiveAttatchState : std::int32_t - { - kToWorld = 0x0, - kModels = 0x1, - kRegisterCombinedObjectVisibility = 0x2, - kAttatchDone = 0x3 - }; + enum class ProgressiveAttachState : std::int32_t + { + kWorld = 0, + kModels = 1, + kRegisterCombinedObjectVisibility = 2, + kDone = 3, + }; public: // members - TESObjectCELL* cell; // 00 - ProgressiveAttatchState attatchState; // 08 + TESObjectCELL* cell; // 00 + ProgressiveAttachState attachState; // 08 }; - static_assert(sizeof(QueuedAttatch) == 0x10); + static_assert(sizeof(QueuedAttach) == 0x10); class QueuedDetach { private: - enum class ProgressiveDetachState : std::int32_t - { - PROGRESSIVE_DETATCH_ACTORS_NEXT = 0x0, - PROGRESSIVE_DETATCH_REFS_NEXT = 0x1, - PROGRESSIVE_DETATCH_COMBINED_ART_NEXT = 0x2, - PROGRESSIVE_DETATCH_DONE = 0x3 - }; + enum class ProgressiveDetachState : std::int32_t + { + kActorsNext = 0, + kRefsNext = 1, + kCombinedArtNext = 2, + kDone = 3, + }; public: // members @@ -51,7 +50,7 @@ namespace RE }; static_assert(sizeof(QueuedDetach) == 0x10); - class AutoDisableQueuedCellAttatchDetach + class AutoDisableQueuedCellAttachDetach { public: // members @@ -68,20 +67,25 @@ namespace RE void MoveItem(std::uint32_t a_fromX, std::uint32_t a_fromY, std::uint32_t a_toX, std::uint32_t a_toY) override; // 07 void SwapItem(std::uint32_t a_fromX, std::uint32_t a_fromY, std::uint32_t a_toX, std::uint32_t a_toY) override; // 08 - GridCell* Get(std::uint32_t a_x, std::uint32_t a_y) + GridCell* Get(std::uint32_t a_x, std::uint32_t a_y) const { using func_t = decltype(&GridCellArray::Get); static REL::Relocation func{ ID::GridCellArray::Get }; return func(this, a_x, a_y); } + TESObjectCELL* GetCell(const std::uint32_t a_x, const std::uint32_t a_y) const noexcept + { + return Get(a_x, a_y)->cell; + }; + // members - GridCell* gridCell; - std::uint32_t cellAttachDetatchQueueDisabled; - BSTArray queuedAttach; - BSTArray queuedDetach; - NiPoint3 worldCenter; - bool landAttached; + GridCell* gridCell; // 0x18 - (memory allocated using 0x8 * numGrids * numGrids) + std::uint32_t cellAttachDetachQueueDisabled; // 0x20 + BSTArray queuedAttach; // 0x28 + BSTArray queuedDetach; // 0x40 + NiPoint3 worldCenter; // 0x58 + bool landAttached; // 0x64 }; static_assert(sizeof(GridCellArray) == 0x68); } diff --git a/include/RE/H/hkAabb.h b/include/RE/H/hkAabb.h index a085f005..1d72dd42 100644 --- a/include/RE/H/hkAabb.h +++ b/include/RE/H/hkAabb.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" namespace RE { diff --git a/include/RE/H/hkAabb16.h b/include/RE/H/hkAabb16.h new file mode 100644 index 00000000..c1628932 --- /dev/null +++ b/include/RE/H/hkAabb16.h @@ -0,0 +1,15 @@ +#pragma once + +namespace RE +{ + class hkAabb16 + { + public: + // members + std::uint16_t min[3]; + std::uint16_t key; + std::uint16_t max[3]; + std::uint16_t key1; + }; + static_assert(sizeof(hkAabb16) == 0x10); +} diff --git a/include/RE/H/hkArray.h b/include/RE/H/hkArray.h index 94bc5580..8d89166d 100644 --- a/include/RE/H/hkArray.h +++ b/include/RE/H/hkArray.h @@ -8,50 +8,173 @@ namespace RE class hkArrayBase { public: - // members - T* data; // 00 - std::int32_t size; // 08 - std::int32_t capacityAndFlags; // 0C + using reference = T&; + using const_reference = const T&; + using iterator = T*; + using const_iterator = const T*; + + hkArrayBase() = default; + + hkArrayBase(T* a_ptr, std::int32_t a_size, std::int32_t a_capacity) : + m_data(a_ptr), m_size(a_size), m_capacityAndFlags(a_capacity | kDontDeallocateFlag) + {} + + reference operator[](std::int32_t a_pos) + { + assert(a_pos >= 0 && a_pos < size()); + return data()[a_pos]; + } + + const_reference operator[](std::int32_t a_pos) const + { + assert(a_pos >= 0 && a_pos < size()); + return data()[a_pos]; + } + + T* data() + { + return m_data; + } + + const T* data() const + { + return m_data; + } + + reference front() + { + return operator[](0); + } + + const_reference front() const + { + return operator[](0); + } + + reference back() + { + return operator[](size() - 1); + } + + const_reference back() const + { + return operator[](size() - 1); + } + + iterator begin() + { + return empty() ? iterator{} : std::addressof(data()[0]); + } + + const_iterator begin() const + { + return empty() ? const_iterator{} : std::addressof(data()[0]); + } + + const_iterator cbegin() const + { + return begin(); + } + + iterator end() + { + return empty() ? iterator{} : std::addressof(data()[size()]); + } + + const_iterator end() const + { + return empty() ? const_iterator{} : std::addressof(data()[size()]); + } + + const_iterator cend() const + { + return end(); + } + + bool empty() const + { + return size() == 0; + } + + std::int32_t size() const noexcept + { + return m_size; + } + + std::int32_t capacity() const noexcept + { + return m_capacityAndFlags & kCapacityMask; + } + + void push_back(const T& a_value) + { + if (size() == capacity()) + reserve(size() == 0 ? 1 : static_cast(std::ceil(size() * GROWTH_FACTOR))); + + m_data[m_size++] = a_value; + } + + void reserve(const std::int32_t a_newCap) + { + assert(a_newCap <= kCapacityMask); + if (a_newCap <= capacity()) { + return; + } + + auto allocator = hkContainerHeapAllocator::GetSingleton(); + std::int32_t newSize = a_newCap * sizeof(T); + T* newMem = static_cast(allocator->BufAlloc(newSize)); + std::memset(newMem, 0, newSize); + if (m_data) { + std::int32_t oldSize = size() * sizeof(T); + std::memcpy(newMem, m_data, oldSize); + if ((m_capacityAndFlags & kDontDeallocateFlag) == 0) { + allocator->BufFree(m_data, oldSize); + } + } + + m_data = newMem; + m_capacityAndFlags &= ~kCapacityMask; + m_capacityAndFlags |= a_newCap & kCapacityMask; + } + + enum : std::int32_t + { + kCapacityMask = std::int32_t(0x3FFFFFFF), + kFlagMask = std::int32_t(0xC0000000), + kDontDeallocateFlag = std::int32_t(0x80000000), + kForceSigned = std::int32_t(0xFFFFFFFF) + }; + + inline static constexpr float GROWTH_FACTOR = 1.5; // NOT PART OF NATIVE TYPE + + T* m_data{ nullptr }; // 00 + std::int32_t m_size{ 0 }; // 08 + std::int32_t m_capacityAndFlags{ kDontDeallocateFlag }; // 0C }; - static_assert(sizeof(hkArrayBase) == 0x10); template class hkArray : - public hkArrayBase + public hkArrayBase // 00 { public: }; - static_assert(sizeof(hkArray) == 0x10); - template + template class hkInplaceArray : - public hkArray + public hkArray // 00 { public: - // members - T storage[N]; // 10 + T m_storage[N]; // 10 }; - static_assert(sizeof(hkInplaceArray) == 0x30); - template + template class hkInplaceArrayAligned16 : public hkArray { public: - // members - std::byte padding[0x10]; // 10 - std::uint8_t storage[sizeof(T) * N]; // 20 - }; - static_assert(sizeof(hkInplaceArrayAligned16) == 0xE0); - - template - class hkLocalArray : - public hkArray - { - public: - // members - T* localMemory; // 10 - std::int32_t initialCapacity; // 18 + std::int32_t m_padding; // 10 + alignas(0x10) std::byte m_storage[sizeof(T) * N]; // 20 }; - static_assert(sizeof(hkLocalArray) == 0x20); + static_assert(sizeof(hkInplaceArrayAligned16) == 0xE0); } diff --git a/include/RE/H/hkBaseObject.h b/include/RE/H/hkBaseObject.h index 4f893394..cd02c54d 100644 --- a/include/RE/H/hkBaseObject.h +++ b/include/RE/H/hkBaseObject.h @@ -5,6 +5,9 @@ namespace RE class hkBaseObject { public: + inline static constexpr auto RTTI{ RTTI::hkBaseObject }; + inline static constexpr auto VTABLE{ VTABLE::hkBaseObject }; + // add virtual ~hkBaseObject(); // 00 virtual void __first_virtual_table_function__(); // 01 diff --git a/include/RE/H/hkBitField.h b/include/RE/H/hkBitField.h index c0917af7..d2dd893b 100644 --- a/include/RE/H/hkBitField.h +++ b/include/RE/H/hkBitField.h @@ -1,6 +1,7 @@ #pragma once #include "RE/H/hkArray.h" +#include "RE/H/hkLocalArray.h" namespace RE { diff --git a/include/RE/H/hkBlockStream.h b/include/RE/H/hkBlockStream.h index 744ee0cf..113db46e 100644 --- a/include/RE/H/hkBlockStream.h +++ b/include/RE/H/hkBlockStream.h @@ -9,6 +9,9 @@ namespace RE public hkBlockStreamBase::Stream { public: + class Consumer; + class Modifier; + class Reader; class Writer; }; static_assert(sizeof(hkBlockStream) == 0x100); diff --git a/include/RE/H/hkContainerHeapAllocator.h b/include/RE/H/hkContainerHeapAllocator.h index 1393ed49..d33a13d0 100644 --- a/include/RE/H/hkContainerHeapAllocator.h +++ b/include/RE/H/hkContainerHeapAllocator.h @@ -7,12 +7,30 @@ namespace RE class hkContainerHeapAllocator { public: - class Allocator : + class __declspec(novtable) Allocator : public hkMemoryAllocator { public: + static constexpr auto RTTI{ RTTI::hkContainerHeapAllocator__Allocator }; + static constexpr auto VTABLE{ VTABLE::hkContainerHeapAllocator__Allocator }; + + ~Allocator() override; + + // override (hkMemoryAllocator) + virtual void* BlockAlloc(std::int32_t a_numBytes) override; // 01 + virtual void BlockFree(void* a_ptr, std::int32_t a_numBytes) override; // 02 + virtual void* BufAlloc(std::int32_t& a_reqNumBytesInOut) override; // 03 + virtual void BufFree(void* a_ptr, std::int32_t a_numBytes) override; // 04 + virtual void GetMemoryStatistics(MemoryStatistics& a_usage) const override; // 08 + virtual std::int32_t GetAllocatedSize(const void* a_obj, std::int32_t a_numBytes) const override; // 09 }; static_assert(sizeof(Allocator) == 0x08); + + [[nodiscard]] static Allocator* GetSingleton() + { + static REL::Relocation singleton{ ID::hkContainerHeapAllocator::Singleton }; + return singleton.get(); + } }; static_assert(std::is_empty_v); } diff --git a/include/RE/H/hkCriticalSection.h b/include/RE/H/hkCriticalSection.h index 0925884f..c0b7fadd 100644 --- a/include/RE/H/hkCriticalSection.h +++ b/include/RE/H/hkCriticalSection.h @@ -1,12 +1,54 @@ #pragma once +#include "RE/H/hkHardwareInfo.h" + namespace RE { class hkCriticalSection { public: - // members - REX::W32::CRITICAL_SECTION section; // 00 + hkCriticalSection(std::int32_t a_spinCount = 0) + { + if (a_spinCount == 0) + a_spinCount = 1000 * hkHardwareInfo::CalcNumHardwareThreads(); + + REX::W32::InitializeCriticalSectionAndSpinCount(&m_section, a_spinCount); + } + + ~hkCriticalSection() + { + REX::W32::DeleteCriticalSection(&m_section); + } + + void Enter() + { + REX::W32::EnterCriticalSection(&m_section); + } + + void Leave() + { + REX::W32::LeaveCriticalSection(&m_section); + } + + protected: + REX::W32::CRITICAL_SECTION m_section; + }; + + class hkCriticalSectionLock + { + public: + hkCriticalSectionLock(hkCriticalSection* a_section) + { + m_section = a_section; + m_section->Enter(); + } + + ~hkCriticalSectionLock() + { + m_section->Leave(); + } + + protected: + hkCriticalSection* m_section; }; - static_assert(sizeof(hkCriticalSection) == 0x28); } diff --git a/include/RE/H/hkEnum.h b/include/RE/H/hkEnum.h index d016062a..11503dc4 100644 --- a/include/RE/H/hkEnum.h +++ b/include/RE/H/hkEnum.h @@ -3,5 +3,5 @@ namespace RE { template - using hkEnum = REX::TEnumSet; + using hkEnum = REX::TEnum; } diff --git a/include/RE/H/hkFreeListArray.h b/include/RE/H/hkFreeListArray.h new file mode 100644 index 00000000..d4b85068 --- /dev/null +++ b/include/RE/H/hkFreeListArray.h @@ -0,0 +1,38 @@ +#pragma once + +#include "RE/H/hkArray.h" + +namespace RE +{ + template + struct hkDefaultFreeListArrayOperations + { + inline static void SetEmpty(T& a_element, std::uint32_t a_next) + { + (std::uint32_t&)a_element = a_next; + } + + inline static std::uint32_t GetNext(const T& a_element) + { + return (std::uint32_t&)a_element; + } + }; + + template + struct hkFreeListArrayElement + { + T m_pod; + }; + + template > + class hkFreeListArray + { + public: + + private: + // members + hkArray> m_elements; + std::int32_t m_firstFree; + }; + static_assert(sizeof(hkFreeListArray) == 0x18); +} diff --git a/include/RE/H/hkHalf.h b/include/RE/H/hkHalf.h new file mode 100644 index 00000000..2b2bb686 --- /dev/null +++ b/include/RE/H/hkHalf.h @@ -0,0 +1,10 @@ +#pragma once + +namespace RE +{ + class hkHalf + { + public: + std::int16_t value; + }; +} diff --git a/include/RE/H/hkHandle.h b/include/RE/H/hkHandle.h index ae3a7673..0e62b421 100644 --- a/include/RE/H/hkHandle.h +++ b/include/RE/H/hkHandle.h @@ -2,12 +2,14 @@ namespace RE { - template + template class hkHandle { public: + ~hkHandle() noexcept {} // intentional + // members - T value; // 00 + T value; // 0x00 }; static_assert(sizeof(hkHandle) == 0x01); } diff --git a/include/RE/H/hkHardwareInfo.h b/include/RE/H/hkHardwareInfo.h new file mode 100644 index 00000000..74fa41c9 --- /dev/null +++ b/include/RE/H/hkHardwareInfo.h @@ -0,0 +1,26 @@ +#pragma once + +#include "RE/H/hkReferencedObject.h" + +namespace RE +{ + class __declspec(novtable) hkHardwareInfo : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkHardwareInfo }; + inline static constexpr auto VTABLE{ VTABLE::hkHardwareInfo }; + + inline static std::int32_t CalcNumHardwareThreads() + { + using func_t = decltype(&hkHardwareInfo::CalcNumHardwareThreads); + static REL::Relocation func{ ID::hkHardwareInfo::CalcNumHardwareThreads }; + return func(); + } + + // members + std::int32_t numHardwareThreads; + std::uint32_t cpuFeatures; + }; + static_assert(sizeof(hkHardwareInfo) == 0x18); +} diff --git a/include/RE/H/hkIntSpaceUtil.h b/include/RE/H/hkIntSpaceUtil.h index f875a63e..5be72f59 100644 --- a/include/RE/H/hkIntSpaceUtil.h +++ b/include/RE/H/hkIntSpaceUtil.h @@ -1,7 +1,7 @@ #pragma once #include "RE/H/hkAabb.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" namespace RE { @@ -9,11 +9,11 @@ namespace RE { public: // members - hkVector4f bitOffsetLow; // 00 - hkVector4f bitOffsetHigh; // 10 - hkVector4f bitScale; // 20 - hkVector4f bitScaleInv; // 30 - hkAabb aabb; // 40 + hkVector4f bitOffsetLow; // 0x00 + hkVector4f bitOffsetHigh; // 0x10 + hkVector4f bitScale; // 0x20 + hkVector4f bitScaleInv; // 0x30 + hkAabb aabb; // 0x40 }; static_assert(sizeof(hkIntSpaceUtil) == 0x60); } diff --git a/include/RE/H/hkLifoAllocator.h b/include/RE/H/hkLifoAllocator.h new file mode 100644 index 00000000..0b7da41a --- /dev/null +++ b/include/RE/H/hkLifoAllocator.h @@ -0,0 +1,53 @@ +#pragma once + +#include "RE/H/hkMemoryAllocator.h" + +namespace RE +{ + class __declspec(novtable) hkLifoAllocator : + public hkMemoryAllocator // 00 + { + public: + static constexpr auto RTTI{ RTTI::hkLifoAllocator }; + static constexpr auto VTABLE{ VTABLE::hkLifoAllocator }; + + class Implementation; + + hkLifoAllocator() { REX::EMPLACE_VTABLE(this); } + + // override (hkMemoryAllocator) + void* BlockAlloc(std::int32_t a_numBytesIn) override; // 01 + void BlockFree(void* a_ptr, std::int32_t a_numBytesIn) override; // 02 + void* BufAlloc(std::int32_t& a_reqNumBytesInOut) override; // 03 + void BufFree(void* a_ptr, std::int32_t a_numBytes) override; // 04 + void* BufRealloc(void* a_old, std::int32_t a_oldNumBytes, std::int32_t& a_reqNumBytesInOut) override; // 05 + void GetMemoryStatistics(MemoryStatistics& a_stats) const override; // 08 + std::int32_t GetAllocatedSize(const void* a_obj, std::int32_t a_numBytes) const override; // 09 + + void Init(hkMemoryAllocator* a_slabAllocator, hkMemoryAllocator* a_largeAllocator, hkMemoryAllocator* a_internalAllocator) + { + using func_t = decltype(&hkLifoAllocator::Init); + static REL::Relocation func{ REL::ID(1417289) }; + return func(this, a_slabAllocator, a_largeAllocator, a_internalAllocator); + } + + void Quit(hkMemoryAllocator** a_allocators) + { + using func_t = decltype(&hkLifoAllocator::Quit); + static REL::Relocation func{ REL::ID(1058127) }; + return func(this, a_allocators); + } + + // members + Implementation* impl{ nullptr }; // 0x08 + const std::int32_t slabSize{ 0x8000 }; // 0x10 + void* cur{ nullptr }; // 0x18 + void* end{ nullptr }; // 0x20 + void* firstNonLifoEnd{ nullptr }; // 0x28 + void* cachedEmptySlab{ nullptr }; // 0x30 + hkMemoryAllocator* slabAllocator{ nullptr }; // 0x38 + hkMemoryAllocator* largeAllocator{ nullptr }; // 0x40 + hkMemoryAllocator* internalAllocator{ nullptr }; // 0x48 + }; + static_assert(sizeof(hkLifoAllocator) == 0x50); +} diff --git a/include/RE/H/hkLocalArray.h b/include/RE/H/hkLocalArray.h new file mode 100644 index 00000000..7c9f7aec --- /dev/null +++ b/include/RE/H/hkLocalArray.h @@ -0,0 +1,35 @@ +#pragma once + +#include "RE/H/hkArray.h" + +namespace RE +{ + template + class hkLocalArray : + public hkArray + { + public: + hkLocalArray(std::int32_t a_capacity) : + m_initialCapacity(a_capacity) + { + this->m_capacityAndFlags = a_capacity | hkArray::kDontDeallocateFlag; + m_localMemory = this->data; + } + + ~hkLocalArray() + { + if (!WasReallocated()) + hkArray::clear(); + + hkDeallocateStack(m_localMemory, m_initialCapacity); + } + + hkBool WasReallocated() const + { + return m_localMemory != this->m_data; + } + + T* m_localMemory; + std::int32_t m_initialCapacity; + }; +} diff --git a/include/RE/H/hkMap.h b/include/RE/H/hkMap.h index 9c590e9a..193c8156 100644 --- a/include/RE/H/hkMap.h +++ b/include/RE/H/hkMap.h @@ -24,9 +24,9 @@ namespace RE }; // members - Pair* elem; // 00 - std::int32_t numElems; // 08 - std::int32_t hashMod; // 0C + Pair* elem; // 00 + std::int32_t elemCount; // 08 - high bits are flags + std::int32_t hashMod; // 0C - capacity - 1 }; static_assert(sizeof(hkMapBase) == 0x10); @@ -46,30 +46,4 @@ namespace RE hkMap, Allocator> map; // 10 }; static_assert(sizeof(hkPointerMap) == 0x10); - - template - struct hkMultiMapOperations - {}; - - template <> - struct hkMultiMapOperations - {}; - - template , class A = hkContainerHeapAllocator> - class hkMultiMap - { - public: - struct Pair - { - // members - K key; // 00 - V value; // ?? - }; - - // members - Pair* elem; // 00 - std::int32_t elemCount; // 08 - high bits are flags - std::int32_t hashMod; // 10 - capacity - 1 - }; - static_assert(sizeof(hkMultiMap) == 0x10); } diff --git a/include/RE/H/hkMatrix3.h b/include/RE/H/hkMatrix3.h new file mode 100644 index 00000000..1931358e --- /dev/null +++ b/include/RE/H/hkMatrix3.h @@ -0,0 +1,30 @@ +#pragma once + +#include "RE/H/hkVector4.h" + +namespace RE +{ + class hkMatrix3f + { + public: + constexpr hkMatrix3f() noexcept = default; + constexpr hkMatrix3f(const hkVector4f& a_vec0, const hkVector4f& a_vec1, const hkVector4f& a_vec2) noexcept; + constexpr hkMatrix3f( + float a_x0, float a_y0, float a_z0, float a_w0, + float a_x1, float a_y1, float a_z1, float a_w1, + float a_x2, float a_y2, float a_z2, float a_w2) noexcept; + + constexpr hkVector4f& operator[](std::size_t a_pos) noexcept; + constexpr const hkVector4f& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const hkMatrix3f& a_rhs) const noexcept; + constexpr bool operator!=(const hkMatrix3f& a_rhs) const noexcept; + constexpr hkMatrix3f operator*(const hkMatrix3f& a_rhs) const noexcept; + constexpr hkMatrix3f operator*(float a_scalar) const noexcept; + + // members + hkVector4f col[3]; // 00 + }; + static_assert(sizeof(hkMatrix3f) == 0x30); + + using hkMatrix3 = hkMatrix3f; +} diff --git a/include/RE/H/hkMemoryAllocator.h b/include/RE/H/hkMemoryAllocator.h index c99637fd..8564d4a9 100644 --- a/include/RE/H/hkMemoryAllocator.h +++ b/include/RE/H/hkMemoryAllocator.h @@ -2,25 +2,29 @@ namespace RE { - class hkMemoryAllocator + class __declspec(novtable) hkMemoryAllocator { public: + static constexpr auto RTTI{ RTTI::hkMemoryAllocator }; + static constexpr auto VTABLE{ VTABLE::hkMemoryAllocator }; + class ExtendedInterface; class MemoryStatistics; + virtual ~hkMemoryAllocator() = default; // 00 + // add - virtual ~hkMemoryAllocator(); // 00 - virtual void* blockAlloc(std::int32_t); // 01 - virtual void blockFree(void*, std::int32_t); // 02 - virtual void* bufAlloc(std::int32_t*); // 03 - virtual void bufFree(void*, std::int32_t); // 04 - virtual void* bufRealloc(void*, std::int32_t, std::int32_t*); // 05 - virtual void blockAllocBatch(void**, std::int32_t, std::int32_t); // 06 - virtual void blockFreeBatch(void**, std::int32_t, std::int32_t); // 07 - virtual void getMemoryStatistics(MemoryStatistics*); // 08 - virtual void getAllocatedSize(const void*, std::int32_t); // 09 - virtual std::int32_t resetPeakMemoryStatistics(); // 0A - virtual ExtendedInterface* getExtendedInterface(); // 0B + virtual void* BlockAlloc(std::int32_t a_numBytesIn) = 0; // 01 + virtual void BlockFree(void* a_ptr, std::int32_t a_numBytesIn) = 0; // 02 + virtual void* BufAlloc(std::int32_t& a_reqNumBytesInOut) { return BlockAlloc(a_reqNumBytesInOut); } // 03 + virtual void BufFree(void* a_ptr, std::int32_t a_numBytes) { BlockFree(a_ptr, a_numBytes); } // 04 + virtual void* BufRealloc(void* a_old, std::int32_t a_oldNumBytes, std::int32_t& a_reqNumBytesInOut); // 05 + virtual void BlockAllocBatch(void** a_ptrsOut, std::int32_t a_numPtrs, std::int32_t a_blockSize); // 06 + virtual void BlockFreeBatch(void** a_ptrsIn, std::int32_t a_numPtrs, std::int32_t a_blockSize); // 07 + virtual void GetMemoryStatistics(MemoryStatistics& a_stats) const = 0; // 08 + virtual std::int32_t GetAllocatedSize(const void* a_obj, std::int32_t a_numBytes) const = 0; // 09 + virtual void ResetPeakMemoryStatistics() { return; } // 0A + virtual ExtendedInterface* GetExtendedInterface() { return nullptr; } // 0B }; static_assert(sizeof(hkMemoryAllocator) == 0x08); } diff --git a/include/RE/H/hkMemoryRouter.h b/include/RE/H/hkMemoryRouter.h new file mode 100644 index 00000000..8071c5ff --- /dev/null +++ b/include/RE/H/hkMemoryRouter.h @@ -0,0 +1,48 @@ +#pragma once + +#include "RE/H/hkLifoAllocator.h" + +namespace RE +{ + class hkMemoryAllocator; + + class hkMemoryRouter + { + public: + using Allocator = hkMemoryAllocator; + using Stack = hkLifoAllocator; + + [[nodiscard]] static hkMemoryRouter& GetInstance() + { + return *GetInstancePtr(); + } + + [[nodiscard]] static hkMemoryRouter* GetInstancePtr() + { + static REL::Relocation slotID{ ID::hkMemoryRouter::tlsSlotID }; + return static_cast(REX::W32::TlsGetValue(*slotID)); + } + + static void ReplaceInstance(hkMemoryRouter* a_router) + { + static REL::Relocation slotID{ ID::hkMemoryRouter::tlsSlotID }; + REX::W32::TlsSetValue(*slotID, a_router); + } + + void SetDebug(Allocator* a_val) noexcept { debug = a_val; } + void SetHeap(Allocator* a_val) noexcept { heap = a_val; } + void SetSolver(Allocator* a_val) noexcept { solver = a_val; } + void SetTemp(Allocator* a_val) noexcept { temp = a_val; } + [[nodiscard]] Stack& GetStack() noexcept { return stack; } + + // members + Stack stack; // 0x00 + hkMemoryAllocator* temp{ nullptr }; // 0x50 + hkMemoryAllocator* heap{ nullptr }; // 0x58 + hkMemoryAllocator* debug{ nullptr }; // 0x60 + hkMemoryAllocator* solver{ nullptr }; // 0x68 + void* userData{ nullptr }; // 0x70 + std::uint32_t refObjLocalStore{ 0 }; // 0x78 + }; + static_assert(sizeof(hkMemoryRouter) == 0x80); +} diff --git a/include/RE/H/hkMemorySystem.h b/include/RE/H/hkMemorySystem.h new file mode 100644 index 00000000..c140312e --- /dev/null +++ b/include/RE/H/hkMemorySystem.h @@ -0,0 +1,60 @@ +#pragma once + +#include "RE/H/hkFlags.h" +#include "RE/H/hkMemoryRouter.h" +#include "RE/H/hkResult.h" + +namespace RE +{ + class hkDebugMemorySystem; + class hkMemoryAllocator; + class hkMemorySnapshot; + class hkOstream; + + class __declspec(novtable) hkMemorySystem + { + public: + static constexpr auto RTTI{ RTTI::hkMemorySystem }; + static constexpr auto VTABLE{ VTABLE::hkMemorySystem }; + + using MemoryWalkCallback = void(void* a_start, std::size_t a_size, bool a_allocated, std::int32_t a_pool, void* a_param); + + enum class FlagBits + { + kPersistent = 1, + kTemporary, + kAll, + + kRouter = kPersistent, + kFrame = kTemporary + }; + + struct MemoryStatistics; + struct FrameInfo; + + virtual ~hkMemorySystem() = default; // 00 + + // add + virtual hkMemoryRouter* MainInit(const FrameInfo& a_info, hkFlags a_flags) = 0; // 01 + virtual hkResult MainQuit(hkFlags a_flags) = 0; // 02 + virtual void ThreadInit(hkMemoryRouter& a_router, const char* a_name, hkFlags a_flags) = 0; // 03 + virtual void ThreadQuit(hkMemoryRouter& a_router, hkFlags a_flags) = 0; // 04 + virtual hkResult GetHeapSoftLimit([[maybe_unused]] std::int32_t a_numBytes) { return { hkResultEnum::kFailure }; } // 05 + virtual std::int32_t GetHeapSoftLimit() const { return -1; } // 06 + virtual bool SolverCanAllocSingleBlock([[maybe_unused]] std::int32_t a_numBytes) { return true; } // 07 + virtual bool HeapCanAllocTotal([[maybe_unused]] std::int32_t a_numBytes) { return true; } // 08 + virtual void PrintStatistics(hkOstream& a_ostr) const = 0; // 09 + virtual void GetMemoryStatistics(MemoryStatistics&) = 0; // 0A + virtual hkMemoryAllocator* GetUncachedLockedHeapAllocator() = 0; // 0B + virtual void GarbageCollectThread([[maybe_unused]] hkMemoryRouter& a_router) { return; } // 0C + virtual void GarbageCollectShared() { return; } // 0D + virtual void GarbageCollect(); // 0E + virtual void AdvanceFrame() { return; } // 0F + virtual hkDebugMemorySystem* GetDebugInterface() { return nullptr; } // 10 + virtual hkResult GetMemorySnapshot([[maybe_unused]] hkMemorySnapshot& a_snapshot) const { return { hkResultEnum::kFailure }; } // 11 + virtual hkResult GetAllocationCallStack([[maybe_unused]] const void* a_ptr, [[maybe_unused]] std::uint64_t* a_callStack, [[maybe_unused]] std::int32_t& a_stackSize, [[maybe_unused]] std::size_t& a_allocSize) { return { hkResultEnum::kFailure }; } // 12 + virtual void SetHeapScrubValues([[maybe_unused]] std::uint32_t a_allocValue, [[maybe_unused]] std::uint32_t a_freeValue) { return; } // 13 + virtual std::uint32_t IsOk() const { return 1; } // 14 + }; + static_assert(sizeof(hkMemorySystem) == 0x8); +} diff --git a/include/RE/H/hkMonitorStream.h b/include/RE/H/hkMonitorStream.h new file mode 100644 index 00000000..b829856a --- /dev/null +++ b/include/RE/H/hkMonitorStream.h @@ -0,0 +1,44 @@ +#pragma once + +#include "RE/H/hkBool.h" +#include "RE/H/hkPadSpu.h" + +namespace RE +{ + class hkMonitorStream + { + public: + inline static hkMonitorStream* GetSingleton() + { + static REL::Relocation slotID{ ID::hkMonitorStream::tlsSlotID }; + return static_cast(REX::W32::TlsGetValue(*slotID)); + } + + void Clear() + { + using func_t = decltype(&hkMonitorStream::Clear); + static REL::Relocation func{ ID::hkMonitorStream::Clear }; + func(this); + } + + void Reset() + { + end = start; + } + + void Resize(const std::int32_t a_newSize) + { + using func_t = decltype(&hkMonitorStream::Resize); + static REL::Relocation func{ ID::hkMonitorStream::Resize }; + func(this, a_newSize); + } + + // members + hkPadSpu start; // 0x00 + hkPadSpu end; // 0x08 + hkPadSpu capacity; // 0x10 + hkPadSpu capacityMinus16; // 0x18 + hkBool isBufferAllocatedOnTheHeap; // 0x20 + }; + static_assert(sizeof(hkMonitorStream) == 0x28); +} diff --git a/include/RE/H/hkMultiMap.h b/include/RE/H/hkMultiMap.h new file mode 100644 index 00000000..5a94d0ba --- /dev/null +++ b/include/RE/H/hkMultiMap.h @@ -0,0 +1,31 @@ +#pragma once + +#include "RE/H/hkContainerHeapAllocator.h" + +namespace RE +{ + template + struct hkMultiMapOperations + {}; + + template <> + struct hkMultiMapOperations + {}; + + template , class A = hkContainerHeapAllocator> + class hkMultiMap + { + public: + struct Pair + { + K key; + V value; + }; + + // members + Pair* elem; // 0x00 + std::int32_t elemCount; // 0x08 - high bits are flags + std::int32_t hashMod; // 0x10 - capacity - 1 + }; + static_assert(sizeof(hkMultiMap) == 0x10); +} diff --git a/include/RE/H/hkProcessContext.h b/include/RE/H/hkProcessContext.h new file mode 100644 index 00000000..6993a225 --- /dev/null +++ b/include/RE/H/hkProcessContext.h @@ -0,0 +1,29 @@ +#pragma once + +#include "RE/H/hkArray.h" + +namespace RE +{ + class hkVisualDebugger; + + class hkProcessContext + { + public: + hkProcessContext() = default; + + virtual ~hkProcessContext() = default; + + virtual const char* GetType() = 0; + + virtual void SetOwner(hkVisualDebugger* a_owner) + { + owner = a_owner; + } + + // members + hkVisualDebugger* owner{ nullptr }; // 0x08 + hkInplaceArray monitorStreamBegins; // 0x10 + hkInplaceArray monitorStreamEnds; // 0x50 + }; + static_assert(sizeof(hkProcessContext) == 0x90); +} diff --git a/include/RE/H/hkProcessFactory.h b/include/RE/H/hkProcessFactory.h new file mode 100644 index 00000000..735db6f8 --- /dev/null +++ b/include/RE/H/hkProcessFactory.h @@ -0,0 +1,31 @@ +#pragma once + +#include "RE/H/hkArray.h" +#include "RE/H/hkReferencedObject.h" + +namespace RE +{ + class hkProcess; + class hkProcessContext; + + class __declspec(novtable) hkProcessFactory : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkProcessFactory }; + inline static constexpr auto VTABLE{ VTABLE::hkProcessFactory }; + + inline static hkProcessFactory* GetSingleton() + { + static REL::Relocation singleton{ ID::hkProcessFactory::Singleton }; + return singleton.get(); + } + + hkProcess* CreateProcess(const char* a_name, hkArray& a_contexts) + { + using func_t = decltype(&hkProcessFactory::CreateProcess); + static REL::Relocation func{ ID::hkProcessFactory::CreateProcess }; + return func(this, a_name, a_contexts); + } + }; +} diff --git a/include/RE/H/hkQsTransformf.h b/include/RE/H/hkQsTransformf.h index 649e9eff..965d6add 100644 --- a/include/RE/H/hkQsTransformf.h +++ b/include/RE/H/hkQsTransformf.h @@ -1,7 +1,7 @@ #pragma once -#include "RE/H/hkQuaternionf.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkQuaternion.h" +#include "RE/H/hkVector4.h" namespace RE { @@ -9,9 +9,11 @@ namespace RE { public: // members - hkVector4f translation; // 00 - hkQuaternionf rotation; // 10 - hkVector4f scale; // 20 + hkVector4f translation; // 0x00 + hkQuaternionf rotation; // 0x10 + hkVector4f scale; // 0x20 }; static_assert(sizeof(hkQsTransformf) == 0x30); + + using hkQsTransform = hkQsTransformf; } diff --git a/include/RE/H/hkQuaternionf.h b/include/RE/H/hkQuaternion.h similarity index 80% rename from include/RE/H/hkQuaternionf.h rename to include/RE/H/hkQuaternion.h index 2033850c..97cf024f 100644 --- a/include/RE/H/hkQuaternionf.h +++ b/include/RE/H/hkQuaternion.h @@ -9,4 +9,6 @@ namespace RE hkVector4f vec; // 00 }; static_assert(sizeof(hkQuaternionf) == 0x10); + + using hkQuaternion = hkQuaternionf; } diff --git a/include/RE/H/hkRefPtr.h b/include/RE/H/hkRefPtr.h index 7ea6cdd8..b1ede507 100644 --- a/include/RE/H/hkRefPtr.h +++ b/include/RE/H/hkRefPtr.h @@ -1,13 +1,82 @@ #pragma once +#include "RE/H/hkReferencedObject.h" + namespace RE { template class hkRefPtr { public: - // members - T* ptr; // 00 + hkRefPtr() = default; + + hkRefPtr(std::nullptr_t) noexcept {}; + + hkRefPtr(T* a_ptr) : + m_ptr(a_ptr) + { + TryAddReference(); + } + + hkRefPtr(const hkRefPtr& a_other) : + m_ptr(a_other.m_ptr) + { + TryAddReference(); + } + + ~hkRefPtr() noexcept + { + TryRemoveReference(); + } + + hkRefPtr& operator=(T* a_ptr) + { + if (m_ptr != a_ptr) { + TryRemoveReference(); + m_ptr = a_ptr; + TryAddReference(); + } + + return *this; + } + + public: + T* get() const noexcept { return m_ptr; } + + public: + T& operator*() const noexcept + { + assert(static_cast(*this)); + return *m_ptr; + } + + T* operator->() const noexcept + { + assert(static_cast(*this)); + return m_ptr; + } + + explicit operator bool() const noexcept + { + return m_ptr != nullptr; + } + + private: + void TryAddReference() + { + if (m_ptr) + reinterpret_cast(m_ptr)->AddReference(); + } + + void TryRemoveReference() + { + if (m_ptr) { + reinterpret_cast(m_ptr)->RemoveReference(); + m_ptr = nullptr; + } + } + + private: + T* m_ptr{ nullptr }; }; - static_assert(sizeof(hkRefPtr) == 0x08); } diff --git a/include/RE/H/hkReferencedObject.h b/include/RE/H/hkReferencedObject.h index b1019373..8814ea9e 100644 --- a/include/RE/H/hkReferencedObject.h +++ b/include/RE/H/hkReferencedObject.h @@ -4,12 +4,40 @@ namespace RE { + class hkClass; + class hkReferencedObject : - public hkBaseObject + public hkBaseObject // 0x00 { public: + inline static constexpr auto RTTI{ RTTI::hkReferencedObject }; + inline static constexpr auto VTABLE{ VTABLE::hkReferencedObject }; + + hkReferencedObject() + { + REX::EMPLACE_VTABLE(this); + } + + // add + virtual const hkClass* GetClassType() const { return nullptr; } // 02 + virtual void DeleteThisReferencedObject() const { delete this; } // 03 + + void AddReference() + { + using func_t = decltype(&hkReferencedObject::AddReference); + static REL::Relocation func{ ID::hkReferencedObject::AddReference }; + func(this); + } + + void RemoveReference() + { + using func_t = decltype(&hkReferencedObject::RemoveReference); + static REL::Relocation func{ ID::hkReferencedObject::RemoveReference }; + func(this); + } + // members - std::uint32_t memSizeAndRefCount; // 08 + std::uint32_t memSizeAndRefCount; // 0x08 }; static_assert(sizeof(hkReferencedObject) == 0x10); } diff --git a/include/RE/H/hkRelArray.h b/include/RE/H/hkRelArray.h new file mode 100644 index 00000000..56c23179 --- /dev/null +++ b/include/RE/H/hkRelArray.h @@ -0,0 +1,40 @@ +#pragma once + +namespace RE +{ + template + class hkRelArray + { + public: + hkRelArray(){}; + + T& operator[](const std::int32_t a_index) + { + assert(a_index >= 0); + assert(a_index < m_size); + return reinterpret_cast(reinterpret_cast(this) + m_offset)[a_index]; + } + + const T& operator[](const std::int32_t a_index) const + { + assert(a_index >= 0); + assert(a_index < m_size); + return reinterpret_cast(reinterpret_cast(this) + m_offset)[a_index]; + } + + T* begin() + { + return reinterpret_cast(reinterpret_cast(this) + m_offset); + } + + const T* begin() const + { + return reinterpret_cast(reinterpret_cast(this) + m_offset); + } + + protected: + std::uint16_t m_size; // 0x00 + std::uint16_t m_offset; // 0x02 + }; + static_assert(sizeof(hkRelArray) == 0x4); +} diff --git a/include/RE/H/hkRotation.h b/include/RE/H/hkRotation.h new file mode 100644 index 00000000..14a695c9 --- /dev/null +++ b/include/RE/H/hkRotation.h @@ -0,0 +1,16 @@ +#pragma once + +#include "RE/H/hkMatrix3.h" + +namespace RE +{ + class hkRotationf : + public hkMatrix3f + { + public: + constexpr hkRotationf() noexcept = default; + + using hkMatrix3f::hkMatrix3f; + }; + static_assert(sizeof(hkRotationf) == 0x30); +} diff --git a/include/RE/H/hkSignal.h b/include/RE/H/hkSignal.h index bec7febb..6b82e002 100644 --- a/include/RE/H/hkSignal.h +++ b/include/RE/H/hkSignal.h @@ -13,34 +13,26 @@ namespace RE }; static_assert(sizeof(hkSignal) == 0x08); - class hkSignal0 : - public hkSignal - { - public: - }; - static_assert(sizeof(hkSignal0) == 0x08); + struct hkSignal0 : hkSignal + {}; - template - class hkSignal1 : - public hkSignal - { - public: - }; - static_assert(sizeof(hkSignal1) == 0x08); + template + struct hkSignal1 : hkSignal + {}; - template - class hkSignal2 : - public hkSignal - { - public: - }; - static_assert(sizeof(hkSignal2) == 0x08); + template + struct hkSignal2 : hkSignal + {}; - template - class hkSignal3 : - public hkSignal - { - public: - }; - static_assert(sizeof(hkSignal3) == 0x08); + template + struct hkSignal3 : hkSignal + {}; + + template + struct hkSignal4 : hkSignal + {}; + + template + struct hkSignal5 : hkSignal + {}; } diff --git a/include/RE/H/hkSlot.h b/include/RE/H/hkSlot.h index 287eaddb..2209fc95 100644 --- a/include/RE/H/hkSlot.h +++ b/include/RE/H/hkSlot.h @@ -15,8 +15,8 @@ namespace RE virtual std::uint32_t matchMethod(const void*, std::int32_t); // 01 // members - hkPtrAndInt next; // 08 - void* object; // 10 + hkPtrAndInt next; // 0x08 + void* object; // 0x10 }; static_assert(sizeof(hkSlot) == 0x18); } diff --git a/include/RE/H/hkStepInfo.h b/include/RE/H/hkStepInfo.h index 91f43c8b..36211274 100644 --- a/include/RE/H/hkStepInfo.h +++ b/include/RE/H/hkStepInfo.h @@ -8,10 +8,10 @@ namespace RE { public: // members - hkPadSpu startTime; // 00 - hkPadSpu endTime; // 04 - hkPadSpu deltaTime; // 08 - hkPadSpu invDeltaTime; // 0C + hkPadSpu startTime; // 0x00 + hkPadSpu endTime; // 0x04 + hkPadSpu deltaTime; // 0x08 + hkPadSpu invDeltaTime; // 0x0C }; static_assert(sizeof(hkStepInfo) == 0x10); } diff --git a/include/RE/H/hkStopwatch.h b/include/RE/H/hkStopwatch.h index a94968ed..853fecfe 100644 --- a/include/RE/H/hkStopwatch.h +++ b/include/RE/H/hkStopwatch.h @@ -2,17 +2,19 @@ namespace RE { - class __declspec(novtable) hkStopWatch + class hkStopwatch { public: + hkStopwatch() = default; + // members - std::int64_t ticksAtStart; // 00 - std::int64_t ticksTotal; // 08 - std::int64_t ticksAtSplit; // 10 - std::int64_t splitTotal; // 18 - hkBool runningFlag; // 20 - std::int32_t numTimings; // 24 - const char* name; // 28 + std::int64_t ticksAtStart{ 0 }; // 0x00 + std::int64_t ticksTotal{ 0 }; // 0x08 + std::int64_t ticksAtSplit{ 0 }; // 0x10 + std::int64_t splitTotal{ 0 }; // 0x18 + hkBool runningFlag{ false }; // 0x20 + std::int32_t numTimings{ 0 }; // 0x24 + const char* name{ nullptr }; // 0x28 }; - static_assert(sizeof(hkStopWatch) == 0x30); + static_assert(sizeof(hkStopwatch) == 0x30); } diff --git a/include/RE/H/hkStridedVertices.h b/include/RE/H/hkStridedVertices.h new file mode 100644 index 00000000..324b6518 --- /dev/null +++ b/include/RE/H/hkStridedVertices.h @@ -0,0 +1,40 @@ +#pragma once + +#include "RE/H/hkArray.h" +#include "RE/H/hkVector4.h" + +namespace RE +{ + class hkStridedVertices + { + public: + constexpr hkStridedVertices() = default; + + template + constexpr hkStridedVertices(const T* a_vertices, const std::int32_t a_numVertices) + { + static_assert(sizeof(T) > sizeof(float)); + vertices = (const float*)vertices; + numVertices = a_numVertices; + striding = sizeof(T); + } + + hkStridedVertices(const hkArrayBase& a_vertices) + { + vertices = (const float*)a_vertices.begin(); + numVertices = a_vertices.size(); + striding = sizeof(hkVector4); + } + + constexpr std::int32_t size() const + { + return numVertices; + } + + // members + const float* vertices{ nullptr }; // 0x00 + std::int32_t numVertices{ 0 }; // 0x08 + std::int32_t striding{ 0 }; // 0x0C - sizeof(T) + }; + static_assert(sizeof(hkStridedVertices) == 0x10); +} diff --git a/include/RE/H/hkStringPtr.h b/include/RE/H/hkStringPtr.h new file mode 100644 index 00000000..8a49592e --- /dev/null +++ b/include/RE/H/hkStringPtr.h @@ -0,0 +1,53 @@ +#pragma once + +namespace RE +{ + class hkStringPtr + { + public: + using size_type = std::int32_t; + + hkStringPtr() = default; + + hkStringPtr(const char* a_data) + { + using func_t = std::add_pointer_t; + static REL::Relocation func{ ID::hkStringPtr::ctor }; + func(this, a_data); + } + + const char* data() const noexcept + { + return reinterpret_cast(reinterpret_cast(m_data) & ~kManaged); + } + + const char* c_str() const noexcept + { + return data(); + } + + bool empty() const noexcept + { + return !m_data || m_data[0] == '\0'; + } + + size_type size() const + { + return static_cast(std::strlen(data())); + } + + size_type length() const + { + return size(); + } + + protected: + enum : std::int32_t + { + kManaged = 1 << 0 + }; + + const char* m_data{ nullptr }; // 0 + }; + static_assert(sizeof(hkStringPtr) == 0x8); +} diff --git a/include/RE/H/hkTransform.h b/include/RE/H/hkTransform.h new file mode 100644 index 00000000..2e79dad6 --- /dev/null +++ b/include/RE/H/hkTransform.h @@ -0,0 +1,19 @@ +#pragma once + +#include "RE/H/hkRotation.h" + +namespace RE +{ + class hkTransformf + { + public: + constexpr hkTransformf() noexcept = default; + constexpr hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept; + + // members + hkRotationf rotation; + hkVector4f translation; + }; + + using hkTransform = hkTransformf; +} diff --git a/include/RE/H/hkVector4.h b/include/RE/H/hkVector4.h new file mode 100644 index 00000000..b2816530 --- /dev/null +++ b/include/RE/H/hkVector4.h @@ -0,0 +1,50 @@ +#pragma once + +namespace RE +{ + class __declspec(align(16)) hkVector4f + { + public: + static const hkVector4f ZERO; + + constexpr hkVector4f() noexcept = default; + constexpr hkVector4f(float a_x, float a_y, float a_z, float a_w) noexcept; + + constexpr float& operator[](std::size_t a_pos) noexcept; + constexpr const float& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const hkVector4f& a_rhs) const noexcept; + constexpr bool operator!=(const hkVector4f& a_rhs) const noexcept; + constexpr bool operator<(const hkVector4f& a_rhs) const noexcept; + constexpr bool operator>(const hkVector4f& a_rhs) const noexcept; + constexpr hkVector4f operator+(const hkVector4f& a_rhs) const noexcept; + constexpr hkVector4f operator-(const hkVector4f& a_rhs) const noexcept; + constexpr hkVector4f operator*(const hkVector4f& a_rhs) const noexcept; + constexpr hkVector4f operator/(const hkVector4f& a_rhs) const noexcept; + constexpr hkVector4f operator*(float a_scalar) const noexcept; + constexpr hkVector4f operator/(float a_scalar) const noexcept; + constexpr hkVector4f operator-() const noexcept; + constexpr hkVector4f& operator+=(const hkVector4f& a_rhs) noexcept; + constexpr hkVector4f& operator-=(const hkVector4f& a_rhs) noexcept; + constexpr hkVector4f& operator*=(const hkVector4f& a_rhs) noexcept; + constexpr hkVector4f& operator/=(const hkVector4f& a_rhs) noexcept; + constexpr hkVector4f& operator+=(float a_scalar) noexcept; + constexpr hkVector4f& operator-=(float a_scalar) noexcept; + constexpr hkVector4f& operator*=(float a_scalar) noexcept; + constexpr hkVector4f& operator/=(float a_scalar) noexcept; + + constexpr float Dot(const hkVector4f& v) const; + + hkVector4f GetNormalized() const; + float Length() const; + hkVector4f& Normalize(); + + // members + float x{ 0.0F }; + float y{ 0.0F }; + float z{ 0.0F }; + float w{ 0.0F }; + }; + static_assert(sizeof(hkVector4f) == 0x10); + + using hkVector4 = hkVector4f; +}; diff --git a/include/RE/H/hkVector4f.h b/include/RE/H/hkVector4f.h deleted file mode 100644 index 06ea142c..00000000 --- a/include/RE/H/hkVector4f.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -namespace RE -{ - class hkVector4f - { - public: - // members - __m128 quad; // 00 - }; - static_assert(sizeof(hkVector4f) == 0x10); -} diff --git a/include/RE/H/hkVisualDebugger.h b/include/RE/H/hkVisualDebugger.h new file mode 100644 index 00000000..6263426f --- /dev/null +++ b/include/RE/H/hkVisualDebugger.h @@ -0,0 +1,82 @@ +#pragma once + +#include "RE/H/hkArray.h" +#include "RE/H/hkBool.h" +#include "RE/H/hkReferencedObject.h" +#include "RE/H/hkStopwatch.h" + +namespace RE +{ + class hkClass; + class hkProcessContext; + class hkSocket; + class hkStringPtr; + class hkVisualDebuggerClient; + class hkVisualDebuggerTrackedObject; + class hkVtableClassRegistry; + + class hkVisualDebugger : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkVisualDebugger }; + inline static constexpr auto VTABLE{ VTABLE::hkVisualDebugger }; + + using TrackCallback = void (*)(void*, const hkClass*, hkBool, std::uint64_t, void*); + + hkVisualDebugger(const hkArray& a_contexts, const hkVtableClassRegistry* a_classReg = nullptr) + { + using func_t = void (*)(hkVisualDebugger*, const hkArray&, const hkVtableClassRegistry*); + static REL::Relocation func{ ID::hkVisualDebugger::ctor }; + func(this, a_contexts, a_classReg); + } + + // add + virtual void Step(float a_frameTime) {} // 04 + virtual void PollForNewClients() {} // 05 + + void AddContext(hkProcessContext* a_context) + { + using func_t = decltype(&hkVisualDebugger::AddContext); + static REL::Relocation func{ ID::hkVisualDebugger::AddContext }; + func(this, a_context); + } + + void AddDefaultProcess(const char* a_name) + { + using func_t = decltype(&hkVisualDebugger::AddDefaultProcess); + static REL::Relocation func{ ID::hkVisualDebugger::AddDefaultProcess }; + func(this, a_name); + } + + void Serve(const std::uint32_t a_port = 25001) + { + using func_t = decltype(&hkVisualDebugger::Serve); + static REL::Relocation func{ ID::hkVisualDebugger::Serve }; + func(this, a_port); + } + + void Shutdown() + { + using func_t = decltype(&hkVisualDebugger::Shutdown); + static REL::Relocation func{ ID::hkVisualDebugger::Shutdown }; + func(this); + } + + // members + hkSocket* server; // 0x10 + bool suppressPollForNewClients; // 0x18 + hkArray clients; // 0x20 + hkArray contexts; // 0x30 + hkArray trackedObjects; // 0x40 + hkArray trackCallbacks; // 0x50 + hkArray trackCallbackHandles; // 0x60 + const hkVtableClassRegistry* classReg; // 0x70 + hkArray defaultProcesses; // 0x78 + hkArray requiredProcesses; // 0x88 + hkBool timingFrame; // 0x98 + hkStopwatch frameTimer; // 0xA0 + hkBool overrideFrameTimeIfZero; // 0xD0 + }; + static_assert(sizeof(hkVisualDebugger) == 0xD8); +} diff --git a/include/RE/H/hkVtableClassRegistry.h b/include/RE/H/hkVtableClassRegistry.h new file mode 100644 index 00000000..d6a0d802 --- /dev/null +++ b/include/RE/H/hkVtableClassRegistry.h @@ -0,0 +1,20 @@ +#pragma once + +#include "RE/H/hkReferencedObject.h" + +namespace RE +{ + class hkVtableClassRegistry : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkVtableClassRegistry }; + inline static constexpr auto VTABLE{ VTABLE::hkVtableClassRegistry }; + + inline static hkVtableClassRegistry* GetSingleton() + { + static REL::Relocation singleton{ ID::hkVtableClassRegistry::Singleton }; + return singleton.get(); + } + }; +} diff --git a/include/RE/H/hkcdRay.h b/include/RE/H/hkcdRay.h index ed5c7fc4..3cab5c0f 100644 --- a/include/RE/H/hkcdRay.h +++ b/include/RE/H/hkcdRay.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" namespace RE { diff --git a/include/RE/H/hkcdRayQueryFlags.h b/include/RE/H/hkcdRayQueryFlags.h index 2d967d78..ab4e2124 100644 --- a/include/RE/H/hkcdRayQueryFlags.h +++ b/include/RE/H/hkcdRayQueryFlags.h @@ -11,7 +11,7 @@ namespace RE kDisableBackFacingTriangleHits = 0x1, kDisableFrontFacingTriangleHits = 0x2, kEnableInsideHits = 0x4, - kEnableExtraTriangleBevelplanes = 0x8 + kEnableExtraTriangleBevelPlanes = 0x8 }; }; static_assert(std::is_empty_v); diff --git a/include/RE/H/hknpActivation.h b/include/RE/H/hknpActivation.h new file mode 100644 index 00000000..d5ce035c --- /dev/null +++ b/include/RE/H/hknpActivation.h @@ -0,0 +1,11 @@ +#pragma once + +#include "RE/B/BGSEntryPoint.h" + +namespace RE +{ + struct hknpActivationMode + { + using Enum = BGSEntryPoint::ENTRY_POINT; + }; +} diff --git a/include/RE/H/hknpAllHitsCollector.h b/include/RE/H/hknpAllHitsCollector.h index 014c2f0e..351c1e3f 100644 --- a/include/RE/H/hknpAllHitsCollector.h +++ b/include/RE/H/hknpAllHitsCollector.h @@ -7,7 +7,7 @@ namespace RE { class __declspec(novtable) hknpAllHitsCollector : - public hknpCollisionQueryCollector // 000 + public hknpCollisionQueryCollector // 0x000 { public: static constexpr auto RTTI{ RTTI::hknpAllHitsCollector }; @@ -16,8 +16,8 @@ namespace RE hknpAllHitsCollector() { REX::EMPLACE_VTABLE(this); - hits.data = (hknpCollisionResult*)((uintptr_t)this + 0x30); - hits.capacityAndFlags = 0x8000000A; + hits.m_data = (hknpCollisionResult*)((uintptr_t)this + 0x30); + hits.m_capacityAndFlags = 0x8000000A; } // override (hknpCollisionQueryCollector) @@ -28,7 +28,7 @@ namespace RE const hknpCollisionResult* GetHits() const override; // 05 // members - hkInplaceArray hits; // 020 + hkInplaceArray hits; // 0x020 }; static_assert(sizeof(hknpAllHitsCollector) == 0x3F0); } diff --git a/include/RE/H/hknpBody.h b/include/RE/H/hknpBody.h new file mode 100644 index 00000000..00616d37 --- /dev/null +++ b/include/RE/H/hknpBody.h @@ -0,0 +1,47 @@ +#pragma once + +#include "RE/H/hkAabb16.h" +#include "RE/H/hkHalf.h" +#include "RE/H/hkTransform.h" +#include "RE/H/hknpBodyId.h" +#include "RE/H/hknpBodyQualityId.h" +#include "RE/H/hknpCollisionFlags.h" +#include "RE/H/hknpMaterialId.h" +#include "RE/H/hknpMotionId.h" + +namespace RE +{ + class hknpShape; + + class hknpBody + { + public: + enum class SpuFlagsEnum : std::int32_t + { + kForceNarrowPhasePPU = 0x1 + }; + + // members + hkTransform transform; // 0x00 + hknpCollisionFlags flags; // 0x40 + std::uint32_t collisionFilterInfo; // 0x44 + const hknpShape* shape; // 0x48 + hkAabb16 aabb; // 0x50 + hknpBodyId id; // 0x60 + hknpBodyId nextAttachedBodyId; // 0x64 + hknpMotionId motionId; // 0x68 + std::uint32_t broadPhaseId; // 0x6C + hknpMaterialId materialId; // 0x70 + hknpBodyQualityId qualityId; // 0x72 + std::uint8_t timAngle; // 0x73 + std::uint16_t maxTimDistance; // 0x74 + std::uint16_t maxContactDistance; // 0x76 + std::uint32_t indexIntoActiveListOrDeactivatedIslandId; // 0x78 + hkHalf radiusOfComCenteredBoundingSphere; // 0x7C + hkFlags spuFlags; // 0x7E + std::uint8_t shapeSizeDiv16; // 0x7F + std::uint16_t motionToBodyRotation[4]; // 0x80 - hkPackedUnitVector<4> + std::uint64_t userData; // 0x88 + }; + static_assert(sizeof(hknpBody) == 0x90); +} diff --git a/include/RE/H/hknpBodyCinfo.h b/include/RE/H/hknpBodyCinfo.h new file mode 100644 index 00000000..7f7f0c7f --- /dev/null +++ b/include/RE/H/hknpBodyCinfo.h @@ -0,0 +1,40 @@ +#pragma once + +#include "RE/H/hkQuaternion.h" +#include "RE/H/hkRefPtr.h" +#include "RE/H/hkStringPtr.h" +#include "RE/H/hkVector4.h" +#include "RE/H/hknpBody.h" + +namespace RE +{ + class hkLocalFrame; + + class hknpBodyCinfo + { + public: + hknpBodyCinfo() + { + using func_t = void (*)(hknpBodyCinfo*); + static REL::Relocation func{ ID::hknpBodyCinfo::ctor }; + func(this); + } + + // members + const hknpShape* shape; // 0x00 + hknpBodyId reservedBodyId; // 0x08 + hknpMotionId motionId; // 0x0C + hknpBodyQualityId qualityId; // 0x10 + hknpMaterialId materialId; // 0x12 + std::uint32_t collisionFilterInfo; // 0x14 + hknpCollisionFlags flags; // 0x18 + float collisionLookAheadDistance; // 0x1C + hkStringPtr name; // 0x20 + std::uint64_t userData; // 0x28 + hkVector4f position; // 0x30 + hkQuaternionf orientation; // 0x40 + hkFlags spuFlags; // 0x50 + hkRefPtr localFrame; // 0x58 + }; + static_assert(sizeof(hknpBodyCinfo) == 0x60); +} diff --git a/include/RE/H/hknpBodyQualityId.h b/include/RE/H/hknpBodyQualityId.h new file mode 100644 index 00000000..342f2085 --- /dev/null +++ b/include/RE/H/hknpBodyQualityId.h @@ -0,0 +1,13 @@ +#pragma once + +#include "RE/H/hkHandle.h" + +namespace RE +{ + struct hknpBodyQualityIdBaseDiscriminant; + + struct hknpBodyQualityId : + public hkHandle + {}; + static_assert(sizeof(hknpBodyQualityId) == 0x1); +} diff --git a/include/RE/H/hknpCharacterContext.h b/include/RE/H/hknpCharacterContext.h index 663c007c..714fe5c6 100644 --- a/include/RE/H/hknpCharacterContext.h +++ b/include/RE/H/hknpCharacterContext.h @@ -2,7 +2,7 @@ #include "RE/H/hkBool.h" #include "RE/H/hkReferencedObject.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpCharacterState.h" namespace RE @@ -13,24 +13,27 @@ namespace RE public hkReferencedObject { public: - enum class CharacterType + static constexpr auto RTTI{ RTTI::hknpCharacterContext }; + static constexpr auto VTABLE{ VTABLE::hknpCharacterContext }; + + enum class CharacterType : std::int32_t { - kCharacter_Proxy = 0x0, - kCharacter_RigidBody = 0x1 + kProxy = 0x0, + kRigidBody = 0x1 }; - CharacterType characterType; // 10 - const hknpCharacterStateManager* stateManager; // 18 - hknpCharacterState::hknpCharacterStateType currentState; // 20 - hknpCharacterState::hknpCharacterStateType previousState; // 24 - hkBool filterEnable; // 28 - float maxLinearAcceleration; // 2C - float maxLinearSpeed; // 30 - float gain; // 34 - std::byte pad38[0x04]; // 38 - hkVector4f previousSurfaceVelocity; // 40 - std::int32_t numUpdatesInCurrentState; // 50 - std::byte pad54[0x0C]; // 54 + CharacterType characterType; // 0x10 + const hknpCharacterStateManager* stateManager; // 0x18 + hknpCharacterState::hknpCharacterStateType currentState; // 0x20 + hknpCharacterState::hknpCharacterStateType previousState; // 0x24 + hkBool filterEnable; // 0x28 + float maxLinearAcceleration; // 0x2C + float maxLinearSpeed; // 0x30 + float gain; // 0x34 + std::byte pad38[0x04]; // 0x38 + hkVector4f previousSurfaceVelocity; // 0x40 + std::int32_t numUpdatesInCurrentState; // 0x50 + std::byte pad54[0x0C]; // 0x54 }; static_assert(sizeof(hknpCharacterContext) == 0x60); } diff --git a/include/RE/H/hknpCharacterState.h b/include/RE/H/hknpCharacterState.h index 5afc4f9a..699177be 100644 --- a/include/RE/H/hknpCharacterState.h +++ b/include/RE/H/hknpCharacterState.h @@ -4,10 +4,13 @@ namespace RE { - class hknpCharacterState : + class __declspec(novtable) hknpCharacterState : public hkReferencedObject { public: + static constexpr auto RTTI{ RTTI::hknpCharacterState }; + static constexpr auto VTABLE{ VTABLE::hknpCharacterState }; + enum class hknpCharacterStateType { kOnGround = 0x0, diff --git a/include/RE/H/hknpCharacterSurfaceInfo.h b/include/RE/H/hknpCharacterSurfaceInfo.h index b721ca52..a5be8ade 100644 --- a/include/RE/H/hknpCharacterSurfaceInfo.h +++ b/include/RE/H/hknpCharacterSurfaceInfo.h @@ -2,14 +2,19 @@ #include "RE/H/hkBool.h" #include "RE/H/hkEnum.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" namespace RE { class hknpCharacterSurfaceInfo { public: - enum class SupportedState; + enum class SupportedState + { + kUnsupported, + kSliding, + kSupported + }; // members hkBool isSurfaceDynamic; // 00 diff --git a/include/RE/H/hknpClosestHitCollector.h b/include/RE/H/hknpClosestHitCollector.h new file mode 100644 index 00000000..ccc2a043 --- /dev/null +++ b/include/RE/H/hknpClosestHitCollector.h @@ -0,0 +1,28 @@ +#pragma once + +#include "RE/H/hkArray.h" +#include "RE/H/hknpCollisionQueryCollector.h" +#include "RE/H/hknpCollisionResult.h" + +namespace RE +{ + class __declspec(novtable) hknpClosestHitCollector : + public hknpCollisionQueryCollector // 0x000 + { + public: + static constexpr auto RTTI{ RTTI::hknpClosestHitCollector }; + static constexpr auto VTABLE{ VTABLE::hknpClosestHitCollector }; + + // override (hknpCollisionQueryCollector) + void Reset() override; // 01 + void AddHit(const hknpCollisionResult&) override; // 02 + bool HasHit() const override; // 03 + std::int32_t GetNumHits() const override; // 04 + const hknpCollisionResult* GetHits() const override; // 05 + + // members + hknpCollisionResult result; // 0x20 + bool hasHit; // 0x80 + }; + static_assert(sizeof(hknpClosestHitCollector) == 0x90); +} diff --git a/include/RE/H/hknpClosestUniqueBodyIdHitCollector.h b/include/RE/H/hknpClosestUniqueBodyIdHitCollector.h index d73263b7..cabf3061 100644 --- a/include/RE/H/hknpClosestUniqueBodyIdHitCollector.h +++ b/include/RE/H/hknpClosestUniqueBodyIdHitCollector.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpUniqueBodyIdHitCollector.h" namespace RE diff --git a/include/RE/H/hknpCollisionFlags.h b/include/RE/H/hknpCollisionFlags.h new file mode 100644 index 00000000..f5d0098d --- /dev/null +++ b/include/RE/H/hknpCollisionFlags.h @@ -0,0 +1,50 @@ +#pragma once + +#include "RE/H/hkFlags.h" + +namespace RE +{ + enum class hknpCollisionFlagsEnum : std::int32_t + { + kIsStatic = 0x1, + kIsDynamic = 0x2, + kIsKeyframed = 0x4, + kIsActive = 0x8, + kDontCollide = 0x100, + kDontBuildContactJacobians = 0x200, + kRaiseTriggerEvents = 0x10, + kRaiseManifoldStatusEvents = 0x20, + kRaiseManifoldProcessedEvents = 0x40, + kRaiseContactImpulseEvents = 0x80, + kEnableRestitution = 0x100000, + kEnableTriggerModifier = 0x200000, + kEnableImpulseClipping = 0x400000, + kEnableMassChanger = 0x800000, + kEnableSoftContacts = 0x1000000, + kEnableSurfaceVelocity = 0x2000000, + kTempRebuildCollisionCaches = 0x400, + kTempDropNewCvxCvxCollisions = 0x800, + kTempBodyOrAABBIsModified = 0x1000, + kTempRebuildContactCaches = 0x2000, + kIsNonRuntime = 0x4000, + kIsBreakable = 0x8000, + kUserFlag0 = 0x10000, + kUserFlag1 = 0x20000, + kUserFlag2 = 0x40000, + kUserFlag3 = 0x80000, + kUserFlag4 = 0x4000000, + kUserFlag5 = 0x8000000, + kUserFlag6 = 0x10000000, + kMaskInternalBodyFlags = 0xF, + kMaskTempFlags = 0x3C00, + kMaskAutoMaterialFlags = 0x3F00000, + kMaskAllFlags = static_cast(0xFFFFFFFF), + }; + + struct hknpCollisionFlags : + public hkFlags + { + using enum hknpCollisionFlagsEnum; + }; + static_assert(sizeof(hknpCollisionFlags) == 0x4); +} diff --git a/include/RE/H/hknpCollisionQuery.h b/include/RE/H/hknpCollisionQuery.h index f9ead015..1944b0a2 100644 --- a/include/RE/H/hknpCollisionQuery.h +++ b/include/RE/H/hknpCollisionQuery.h @@ -10,9 +10,9 @@ namespace RE { public: // members - hkPadSpu filter; // 00 - hknpQueryFilterData filterData; // 08 - std::uint8_t levelOfDetail; // 18 + hkPadSpu filter; // 0x00 + hknpQueryFilterData filterData; // 0x08 + std::uint8_t levelOfDetail; // 0x18 }; static_assert(sizeof(hknpCollisionQuery) == 0x20); } diff --git a/include/RE/H/hknpCollisionQueryCollector.h b/include/RE/H/hknpCollisionQueryCollector.h index 52f76333..ada628d0 100644 --- a/include/RE/H/hknpCollisionQueryCollector.h +++ b/include/RE/H/hknpCollisionQueryCollector.h @@ -22,8 +22,8 @@ namespace RE virtual const hknpCollisionResult* GetHits() const = 0; // 05 // members - std::int32_t hints; // 08 - hkSimdFloat32 earlyOutThreshold; // 10 + std::int32_t hints; // 0x08 + hkSimdFloat32 earlyOutThreshold; // 0x10 }; static_assert(sizeof(hknpCollisionQueryCollector) == 0x20); } diff --git a/include/RE/H/hknpCollisionResult.h b/include/RE/H/hknpCollisionResult.h index 22f8a1f3..a9ac64be 100644 --- a/include/RE/H/hknpCollisionResult.h +++ b/include/RE/H/hknpCollisionResult.h @@ -2,7 +2,7 @@ #include "RE/C/CFilter.h" #include "RE/H/hkPadSpu.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpBodyId.h" #include "RE/H/hknpCollisionQueryType.h" #include "RE/H/hknpMaterialId.h" @@ -16,22 +16,22 @@ namespace RE { public: // members - hknpBodyId bodyId; // 00 - hknpMaterialId shapeMaterialId; // 04 - hkPadSpu shapeKey; // 08 - hkPadSpu shapeCollisionFilterInfo; // 0C - hkPadSpu shapeUserData; // 10 + hknpBodyId bodyId; // 0x00 + hknpMaterialId shapeMaterialId; // 0x04 + hkPadSpu shapeKey; // 0x08 + hkPadSpu shapeCollisionFilterInfo; // 0x0C + hkPadSpu shapeUserData; // 0x10 }; static_assert(sizeof(BodyInfo) == 0x18); // members - hkVector4f position; // 00 - hkVector4f normal; // 10 - hkPadSpu fraction; // 20 - BodyInfo queryBodyInfo; // 28 - BodyInfo hitBodyInfo; // 40 - hknpCollisionQueryType::Enum queryType; // 58 - hkPadSpu hitResult; // 5C + hkVector4f position; // 0x00 + hkVector4f normal; // 0x10 + hkPadSpu fraction; // 0x20 + BodyInfo queryBodyInfo; // 0x28 + BodyInfo hitBodyInfo; // 0x40 + hknpCollisionQueryType::Enum queryType; // 0x58 + hkPadSpu hitResult; // 0x5C }; static_assert(sizeof(hknpCollisionResult) == 0x60); } diff --git a/include/RE/H/hknpCompositeShape.h b/include/RE/H/hknpCompositeShape.h new file mode 100644 index 00000000..85408c7c --- /dev/null +++ b/include/RE/H/hknpCompositeShape.h @@ -0,0 +1,20 @@ +#pragma once + +#include "RE/H/hknpShape.h" +#include "RE/H/hknpSparseCompactMap.h" + +namespace RE +{ + class __declspec(novtable) hknpCompositeShape : + public hknpShape + { + public: + static constexpr auto RTTI{ RTTI::hknpCompositeShape }; + static constexpr auto VTABLE{ VTABLE::hknpCompositeShape }; + + // members + hknpSparseCompactMap edgeWeldingMap; // 0x30 + std::uint32_t shapeTagCodecInfo; // 0x58 + }; + static_assert(sizeof(hknpCompositeShape) == 0x60); +} diff --git a/include/RE/H/hknpCompoundShape.h b/include/RE/H/hknpCompoundShape.h new file mode 100644 index 00000000..be3eb52c --- /dev/null +++ b/include/RE/H/hknpCompoundShape.h @@ -0,0 +1,30 @@ +#pragma once + +#include "RE/H/hkAabb.h" +#include "RE/H/hkBool.h" +#include "RE/H/hkFreeListArray.h" +#include "RE/H/hknpCompositeShape.h" +#include "RE/H/hknpShapeInstance.h" +#include "RE/H/hknpShapeInstanceId.h" + +namespace RE +{ + class __declspec(novtable) hknpCompoundShape : + public hknpCompositeShape + { + public: + static constexpr auto RTTI{ RTTI::hknpCompoundShape }; + static constexpr auto VTABLE{ VTABLE::hknpCompoundShape }; + + // add + virtual bool UpdateAabb() = 0; // 1E + virtual void GetInstanceAabb(hknpShapeInstanceId a_id, hkAabb& a_out) const = 0; // 1F + + // members + hkFreeListArray instances; // 0x60 + hkAabb aabb; // 0x80 + hkBool isMutable; // 0xA0 + std::byte mutationSignals[0x10]; // 0xA1 - hknpShapeSignals + }; + static_assert(sizeof(hknpCompoundShape) == 0xC0); +} diff --git a/include/RE/H/hknpConstraintId.h b/include/RE/H/hknpConstraintId.h new file mode 100644 index 00000000..c6c42f35 --- /dev/null +++ b/include/RE/H/hknpConstraintId.h @@ -0,0 +1,13 @@ +#pragma once + +#include "RE/H/hkHandle.h" + +namespace RE +{ + struct hknpConstraintIdBaseDiscriminant; + + struct hknpConstraintId : + public hkHandle + {}; + static_assert(sizeof(hknpConstraintId) == 0x4); +} diff --git a/include/RE/H/hknpConstraintManager.h b/include/RE/H/hknpConstraintManager.h index 3fe8577b..11ff37eb 100644 --- a/include/RE/H/hknpConstraintManager.h +++ b/include/RE/H/hknpConstraintManager.h @@ -1,8 +1,7 @@ #pragma once #include "RE/H/hkBool.h" -#include "RE/H/hkHandle.h" -#include "RE/H/hknpConstraintIdDiscriminant.h" +#include "RE/H/hknpConstraintId.h" namespace RE { @@ -13,15 +12,15 @@ namespace RE { public: // members - hknpWorld* world; // 00 - hknpConstraint* constraintBuffer; // 08 - std::uint32_t capacity; // 10 - hkBool constraintBufferIsUserOwned; // 14 - hkHandle firstDestroyedConstraintId; // 18 - hkHandle firstFreeConstraintId; // 1C - std::uint32_t numAllocatedConstraints; // 20 - std::uint32_t numDestroyedConstraints; // 24 - hkHandle peakConstraintId; // 28 + hknpWorld* world; // 0x00 + hknpConstraint* constraintBuffer; // 0x08 + std::uint32_t capacity; // 0x10 + hkBool constraintBufferIsUserOwned; // 0x14 + hknpConstraintId firstDestroyedConstraintId; // 0x18 + hknpConstraintId firstFreeConstraintId; // 0x1C + std::uint32_t numAllocatedConstraints; // 0x20 + std::uint32_t numDestroyedConstraints; // 0x24 + hknpConstraintId peakConstraintId; // 0x28 }; static_assert(sizeof(hknpConstraintManager) == 0x30); } diff --git a/include/RE/H/hknpConvexPolytopeShape.h b/include/RE/H/hknpConvexPolytopeShape.h new file mode 100644 index 00000000..635b44a2 --- /dev/null +++ b/include/RE/H/hknpConvexPolytopeShape.h @@ -0,0 +1,29 @@ +#pragma once + +#include "RE/H/hknpConvexShape.h" + +namespace RE +{ + class hkVector4f; + + class __declspec(novtable) hknpConvexPolytopeShape : + public hknpConvexShape + { + public: + inline static constexpr auto RTTI{ RTTI::hknpConvexPolytopeShape }; + inline static constexpr auto VTABLE{ VTABLE::hknpConvexPolytopeShape }; + + struct Face + { + std::uint16_t firstIndex; + std::uint8_t numIndices; + std::uint8_t minHalfAngle; + }; + + // members + hkRelArray planes; // 0x40 + hkRelArray faces; // 0x44 + hkRelArray indices; // 0x48 + }; + static_assert(sizeof(hknpConvexPolytopeShape) == 0x50); +} diff --git a/include/RE/H/hknpConvexShape.h b/include/RE/H/hknpConvexShape.h new file mode 100644 index 00000000..7b3e19dc --- /dev/null +++ b/include/RE/H/hknpConvexShape.h @@ -0,0 +1,77 @@ +#pragma once + +#include "RE/H/hkRelArray.h" +#include "RE/H/hknpShape.h" + +namespace RE +{ + class hkAabb; + class hkStridedVertices; + class hkTransformf; + class hkVector4f; + class hkcdVertex; + + class __declspec(novtable) hknpConvexShape : + public hknpShape + { + public: + static constexpr auto RTTI{ RTTI::hknpConvexShape }; + static constexpr auto VTABLE{ VTABLE::hknpConvexShape }; + + struct BuildConfig + { + float simplificationTolerance{ 0.0099999998f }; // 0x00 + bool shrinkByRadius{ true }; // 0x04 + float featurePreservationFactor{ 0.0f }; // 0x08 + bool buildFaces{ true }; // 0x0C + bool buildMassProperties{ false }; // 0x0D + MassConfig massConfig; // 0x10 + hkTransformf* extraTransform{ nullptr }; // 0x20 + std::uint32_t sizeOfBaseClass{ 80 }; // 0x28 + std::uint32_t maxNumVertices{ 252 }; // 0x2C + bool checkForDegenerateFaces{ false }; // 0x30 + bool verbose{ false }; // 0x31 + }; + static_assert(sizeof(BuildConfig) == 0x38); + + static hknpConvexShape* CreateFromAabb(const hkAabb& a_aabb, const float a_radius, const BuildConfig& a_config) + { + using func_t = decltype(&hknpConvexShape::CreateFromAabb); + static REL::Relocation func{ ID::hknpConvexShape::CreateFromAabb }; + return func(a_aabb, a_radius, a_config); + } + + static hknpConvexShape* CreateFromCylinder(const hkVector4f& a_halfExtent, const std::int32_t a_numVertices, const float a_radius, const BuildConfig& a_config) + { + using func_t = decltype(&hknpConvexShape::CreateFromCylinder); + static REL::Relocation func{ ID::hknpConvexShape::CreateFromCylinder }; + return func(a_halfExtent, a_numVertices, a_radius, a_config); + } + + static hknpConvexShape* CreateFromHalfExtents(const hkVector4f& a_halfExtent, const float a_radius, const BuildConfig& a_config) + { + using func_t = decltype(&hknpConvexShape::CreateFromHalfExtents); + static REL::Relocation func{ ID::hknpConvexShape::CreateFromHalfExtents }; + return func(a_halfExtent, a_radius, a_config); + } + + static hknpConvexShape* CreateFromIndexedVertices(const hkVector4f* a_vertexBuffer, const std::uint16_t* a_indexBuffer, std::int32_t a_numVertices, const float a_radius, const BuildConfig& a_config) + { + using func_t = decltype(&hknpConvexShape::CreateFromIndexedVertices); + static REL::Relocation func{ ID::hknpConvexShape::CreateFromIndexedVertices }; + return func(a_vertexBuffer, a_indexBuffer, a_numVertices, a_radius, a_config); + } + + static hknpConvexShape* CreateFromVertices(const hkStridedVertices& a_vertices, const float a_radius, const BuildConfig& a_config) + { + using func_t = decltype(&hknpConvexShape::CreateFromVertices); + static REL::Relocation func{ ID::hknpConvexShape::CreateFromVertices }; + return func(a_vertices, a_radius, a_config); + } + + // members + hkRelArray vertices; // 0x30 + std::byte pad34[0x0C]; // 0x34 + }; + static_assert(sizeof(hknpConvexShape) == 0x40); +} diff --git a/include/RE/H/hknpDefaultViewerColorScheme.h b/include/RE/H/hknpDefaultViewerColorScheme.h new file mode 100644 index 00000000..994c9471 --- /dev/null +++ b/include/RE/H/hknpDefaultViewerColorScheme.h @@ -0,0 +1,31 @@ +#pragma once + +#include "RE/H/hknpViewerColorScheme.h" + +namespace RE +{ + class hknpDefaultViewerColorScheme : + public hknpViewerColorScheme + { + public: + hknpDefaultViewerColorScheme() = default; + + virtual std::uint32_t GetBodyColor(const hknpWorld&, hknpBodyId, hknpViewer*) override + { + return staticBodyColor; // TODO: Get color based on body flags + } + + virtual bool IsBodyVisible(const hknpWorld&, hknpBodyId, hknpViewer*) override + { + return true; // TODO: err...? + } + + // members + std::uint32_t staticBodyColor{ 0xFF999999 }; // 0x08 + std::uint32_t dynamicBodyColor{ 0xFFFFB300 }; // 0x0C + std::uint32_t keyframedBodyColor{ 0xFF800080 }; // 0x10 + std::uint32_t triggerColor{ 0x4400FF00 }; // 0x14 + std::uint32_t dontCollideColor{ 0x66FFFF00 }; // 0x18 + }; + static_assert(sizeof(hknpDefaultViewerColorScheme) == 0x20); +} diff --git a/include/RE/H/hknpDynamicCompoundShape.h b/include/RE/H/hknpDynamicCompoundShape.h new file mode 100644 index 00000000..9fb87b3e --- /dev/null +++ b/include/RE/H/hknpDynamicCompoundShape.h @@ -0,0 +1,20 @@ +#pragma once + +#include "RE/H/hknpCompoundShape.h" + +namespace RE +{ + class hknpDynamicCompoundShapeData; + + class __declspec(novtable) hknpDynamicCompoundShape : + public hknpCompoundShape + { + public: + static constexpr auto RTTI{ RTTI::hknpDynamicCompoundShape }; + static constexpr auto VTABLE{ VTABLE::hknpDynamicCompoundShape }; + + // members + hknpDynamicCompoundShapeData* boundingVolumeData; // 0xC0 + }; + static_assert(sizeof(hknpDynamicCompoundShape) == 0xD0); +} diff --git a/include/RE/H/hknpMaterialId.h b/include/RE/H/hknpMaterialId.h index 41136b16..52cafe58 100644 --- a/include/RE/H/hknpMaterialId.h +++ b/include/RE/H/hknpMaterialId.h @@ -11,9 +11,9 @@ namespace RE static_assert(std::is_empty_v); class hknpMaterialId : - public hkHandle + public hkHandle { public: }; - static_assert(sizeof(hknpMaterialId) == 0x04); + static_assert(sizeof(hknpMaterialId) == 0x02); } diff --git a/include/RE/H/hknpMotionCinfo.h b/include/RE/H/hknpMotionCinfo.h new file mode 100644 index 00000000..e407bb2e --- /dev/null +++ b/include/RE/H/hknpMotionCinfo.h @@ -0,0 +1,43 @@ +#pragma once + +#include "RE/H/hkQuaternion.h" +#include "RE/H/hkVector4.h" +#include "RE/H/hknpMotionPropertiesId.h" + +namespace RE +{ + class hkLocalFrame; + class hknpBodyCinfo; + + class hknpMotionCinfo + { + public: + hknpMotionCinfo() + { + using func_t = void (*)(hknpMotionCinfo*); + static REL::Relocation func{ ID::hknpMotionCinfo::ctor }; + func(this); + } + + void InitializeAsKeyFramed(hknpBodyCinfo* a_cInfos, std::uint32_t a_cInfosNum) + { + using func_t = decltype(&hknpMotionCinfo::InitializeAsKeyFramed); + static REL::Relocation func{ ID::hknpMotionCinfo::InitializeAsKeyFramed }; + func(this, a_cInfos, a_cInfosNum); + } + + // members + hknpMotionPropertiesId motionPropertiesId; // 0x00 + hkBool enableDeactivation; // 0x02 + float inverseMass; // 0x04 + float massFactor; // 0x08 + float maxLinearAccelerationDistancePerStep; // 0x0C + float maxRotationToPreventTunneling; // 0x10 + hkVector4f inverseInertiaLocal; // 0x20 + hkVector4f centerOfMassWorld; // 0x30 + hkQuaternionf orientation; // 0x40 + hkVector4f linearVelocity; // 0x50 + hkVector4f angularVelocity; // 0x60 + }; + static_assert(sizeof(hknpMotionCinfo) == 0x70); +} diff --git a/include/RE/H/hknpMotionManager.h b/include/RE/H/hknpMotionManager.h index f7616b2e..c392e653 100644 --- a/include/RE/H/hknpMotionManager.h +++ b/include/RE/H/hknpMotionManager.h @@ -16,21 +16,21 @@ namespace RE { public: // members - hkArray solverIdToMotionId; // 10 + hkArray solverIdToMotionId; // 0x00 }; static_assert(sizeof(CellData) == 0x10); // members - hknpBodyManager* m_bodyManager; // 00 - hkArray m_motions; // 08 - hkBool m_motionBufferIsUserOwned; // 18 - hknpMotionId m_firstFreeMotionId; // 1C - hknpMotionId m_firstMarkedMotionId; // 20 - std::uint32_t m_numAllocatedMotions; // 24 - std::uint32_t m_numMarkedMotions; // 28 - std::uint32_t m_peakMotionIndex; // 2C - hkArray m_activeMotionGrid; // 30 - hkBool m_isLocked; // 40 + hknpBodyManager* m_bodyManager; // 0x00 + hkArray m_motions; // 0x08 + hkBool m_motionBufferIsUserOwned; // 0x18 + hknpMotionId m_firstFreeMotionId; // 0x1C + hknpMotionId m_firstMarkedMotionId; // 0x20 + std::uint32_t m_numAllocatedMotions; // 0x24 + std::uint32_t m_numMarkedMotions; // 0x28 + std::uint32_t m_peakMotionIndex; // 0x2C + hkArray m_activeMotionGrid; // 0x30 + hkBool m_isLocked; // 0x40 }; static_assert(sizeof(hknpMotionManager) == 0x48); } diff --git a/include/RE/H/hknpPhysicsSystem.h b/include/RE/H/hknpPhysicsSystem.h new file mode 100644 index 00000000..6adcdc5b --- /dev/null +++ b/include/RE/H/hknpPhysicsSystem.h @@ -0,0 +1,53 @@ +#pragma once + +#include "RE/H/hkArray.h" +#include "RE/H/hkRefPtr.h" +#include "RE/H/hkReferencedObject.h" +#include "RE/H/hknpActivation.h" +#include "RE/H/hknpBodyId.h" +#include "RE/H/hknpConstraintId.h" +#include "RE/H/hknpWorld.h" + +namespace RE +{ + class hknpPhysicsSystemData; + + class __declspec(novtable) hknpPhysicsSystem : + public hkReferencedObject + { + public: + static constexpr auto RTTI{ RTTI::hknpPhysicsSystem }; + static constexpr auto VTABLE{ VTABLE::hknpPhysicsSystem }; + + enum class Flags : std::int32_t + { + CLONE_POWERABLE_CONSTRAINT_DATAS = 0x1, + FORCE_EXPORTABLE_CONSTRAINTS = 0x2, + CREATE_CONSTRAINTS = 0x4, + DEFAULT_FLAGS = 0x5, + }; + + virtual ~hknpPhysicsSystem(); // 00 + + void AddToWorld(hknpWorld::AdditionMode a_additionMode, hkFlags a_additionFlags, hknpActivationMode::Enum a_constraintActivationMode) + { + using func_t = decltype(&hknpPhysicsSystem::AddToWorld); + static REL::Relocation func{ ID::hknpPhysicsSystem::AddToWorld }; + func(this, a_additionMode, a_additionFlags, a_constraintActivationMode); + } + + void RemoveFromWorld() + { + using func_t = decltype(&hknpPhysicsSystem::RemoveFromWorld); + static REL::Relocation func{ ID::hknpPhysicsSystem::RemoveFromWorld }; + func(this); + } + + // members + hkRefPtr data; // 0x10 + hkRefPtr world; // 0x18 + hkArray bodyIds; // 0x20 + hkArray constraintIds; // 0x30 + }; + static_assert(sizeof(hknpPhysicsSystem) == 0x40); +} diff --git a/include/RE/H/hknpPhysicsSystemData.h b/include/RE/H/hknpPhysicsSystemData.h new file mode 100644 index 00000000..440b1e72 --- /dev/null +++ b/include/RE/H/hknpPhysicsSystemData.h @@ -0,0 +1,39 @@ +#pragma once + +#include "RE/H/hkArray.h" +#include "RE/H/hkRefPtr.h" +#include "RE/H/hkReferencedObject.h" +#include "RE/H/hkStringPtr.h" +#include "RE/H/hknpBodyId.h" +#include "RE/H/hknpConstraintId.h" + +namespace RE +{ + class hknpBodyCinfo; + class hknpConstraintCinfo; + class hknpMaterial; + class hknpMotionCinfo; + class hknpMotionProperties; + + class __declspec(novtable) hknpPhysicsSystemData : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hknpPhysicsSystemData }; + inline static constexpr auto VTABLE{ VTABLE::hknpPhysicsSystemData }; + + hknpPhysicsSystemData() { REX::EMPLACE_VTABLE(this); } + + virtual ~hknpPhysicsSystemData(); // 00 + + // members + hkArray materials; // 0x10 + hkArray motionProperties; // 0x20 + hkArray motionCinfos; // 0x30 + hkArray bodyCinfos; // 0x40 + hkArray constraintCinfos; // 0x50 + hkArray> referencedObjects; // 0x60 + hkStringPtr name; // 0x70 + }; + static_assert(sizeof(hknpPhysicsSystemData) == 0x78); +} diff --git a/include/RE/H/hknpProcessContext.h b/include/RE/H/hknpProcessContext.h new file mode 100644 index 00000000..e69ce4d4 --- /dev/null +++ b/include/RE/H/hknpProcessContext.h @@ -0,0 +1,51 @@ +#pragma once + +#include "RE/H/hkProcessContext.h" +#include "RE/H/hkReferencedObject.h" +#include "RE/H/hknpDefaultViewerColorScheme.h" + +namespace RE +{ + class hknpProcessContextListener; + class hknpWorld; + class hkTaskQueue; + + class hknpProcessContext : + public hkReferencedObject, + public hkProcessContext + { + public: + hknpProcessContext() = default; + + virtual const char* GetType() override + { + return "Physics"; + } + + void AddWorld(hknpWorld* a_world) + { + for (auto world : worlds) { + if (world == a_world) + return; + } + + worlds.push_back(a_world); + } + + void SetColorScheme(hknpViewerColorScheme* a_colorScheme) + { + if (a_colorScheme) + colorScheme = a_colorScheme; + else + colorScheme = &defaultColorScheme; + } + + // members + hkArray worlds; // 0xA0 + hkArray addListeners; // 0xB0 + hknpViewerColorScheme* colorScheme{ &defaultColorScheme }; // 0xC0 + hknpDefaultViewerColorScheme defaultColorScheme; // 0xC8 + hkTaskQueue* taskQueue{ nullptr }; // 0xE8 + }; + static_assert(sizeof(hknpProcessContext) == 0xF0); +} diff --git a/include/RE/H/hknpQueryFilterData.h b/include/RE/H/hknpQueryFilterData.h index 5c14c935..d46555ff 100644 --- a/include/RE/H/hknpQueryFilterData.h +++ b/include/RE/H/hknpQueryFilterData.h @@ -9,9 +9,9 @@ namespace RE { public: // members - hknpMaterialId materialId; // 00 - hkPadSpu collisionFilterInfo; // 04 - hkPadSpu userData; // 08 + hknpMaterialId materialId; // 0x00 + hkPadSpu collisionFilterInfo; // 0x04 + hkPadSpu userData; // 0x08 }; static_assert(sizeof(hknpQueryFilterData) == 0x10); } diff --git a/include/RE/H/hknpRayCastQuery.h b/include/RE/H/hknpRayCastQuery.h index a98f0874..b64ffd63 100644 --- a/include/RE/H/hknpRayCastQuery.h +++ b/include/RE/H/hknpRayCastQuery.h @@ -12,9 +12,9 @@ namespace RE { public: // members - hkcdRay ray; // 20 - hkFlags flags; // 50 - std::byte pad54[0x0C]; // 54 + hkcdRay ray; // 0x20 + hkFlags flags; // 0x50 + std::byte pad54[0x0C]; // 0x54 }; static_assert(sizeof(hknpRayCastQuery) == 0x60); } diff --git a/include/RE/H/hknpShape.h b/include/RE/H/hknpShape.h index 3e4313a4..dcbfe754 100644 --- a/include/RE/H/hknpShape.h +++ b/include/RE/H/hknpShape.h @@ -5,7 +5,7 @@ #include "RE/H/hkFlags.h" #include "RE/H/hkReferencedObject.h" #include "RE/H/hkResult.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpCollisionDispatchType.h" #include "RE/H/hknpShapeType.h" @@ -63,9 +63,23 @@ namespace RE kIsQuadShape = 1u << 12 }; + struct MassConfig + { + enum class Quality : std::int32_t + { + kLow = 0, + kMedium = 1, + kHigh = 2 + }; + + Quality quality{ Quality::kHigh }; + float inertiaFactor{ 1.5f }; + float massOrNegativeDensity{ -1.0f }; + }; + static_assert(sizeof(MassConfig) == 0xC); + struct BuildSurfaceGeometryConfig; struct GetShapeKeysConfig; - struct MassConfig; struct SdfContactPoint; struct SdfQuery; @@ -98,12 +112,12 @@ namespace RE virtual void CheckConsistency() const; // 1D // members - hkFlags flags; // 10 - std::uint8_t numShapeKeyBits; // 12 - hkEnum dispatchType; // 13 - float convexRadius; // 14 - std::uintptr_t userData; // 18 - hkRefCountedProperties* properties; // 20 + hkFlags flags; // 0x10 + std::uint8_t numShapeKeyBits; // 0x12 + hkEnum dispatchType; // 0x13 + float convexRadius; // 0x14 + std::uintptr_t userData; // 0x18 + hkRefCountedProperties* properties; // 0x20 }; static_assert(sizeof(hknpShape) == 0x30); } diff --git a/include/RE/H/hknpShapeInstance.h b/include/RE/H/hknpShapeInstance.h new file mode 100644 index 00000000..9af28a17 --- /dev/null +++ b/include/RE/H/hknpShapeInstance.h @@ -0,0 +1,22 @@ +#pragma once + +#include "RE/H/hkRefPtr.h" +#include "RE/H/hkTransform.h" + +namespace RE +{ + class hknpShape; + + class hknpShapeInstance + { + public: + // members + hkTransformf transform; // 0x00 + hkVector4f scale; // 0x40 + hkRefPtr shape; // 0x50 + std::uint16_t shapeTag; // 0x58 + std::uint16_t destructionTag; // 0x5A + std::uint8_t padding[30]; // 0x5C + }; + static_assert(sizeof(hknpShapeInstance) == 0x80); +} diff --git a/include/RE/H/hknpShapeInstanceId.h b/include/RE/H/hknpShapeInstanceId.h new file mode 100644 index 00000000..63c76aeb --- /dev/null +++ b/include/RE/H/hknpShapeInstanceId.h @@ -0,0 +1,13 @@ +#pragma once + +#include "RE/H/hkHandle.h" + +namespace RE +{ + struct hknpShapeInstanceIdDiscriminant; + + struct hknpShapeInstanceId : + public hkHandle + {}; + static_assert(sizeof(hknpShapeInstanceId) == 0x2); +} diff --git a/include/RE/H/hknpShapeManager.h b/include/RE/H/hknpShapeManager.h index b8f42f8f..75cafdbb 100644 --- a/include/RE/H/hknpShapeManager.h +++ b/include/RE/H/hknpShapeManager.h @@ -17,17 +17,17 @@ namespace RE { public: // members - hknpShapeManager* shapeManager; // 00 - const hknpShape* shape; // 08 - hkArray bodyIds; // 10 - hkFlags mutations; // 20 + hknpShapeManager* shapeManager; // 0x00 + const hknpShape* shape; // 0x08 + hkArray bodyIds; // 0x10 + hkFlags mutations; // 0x20 }; static_assert(sizeof(MutableShapeInfo) == 0x28); // members - hkArray mutableShapeInfos; // 00 - hkArray freeMutableShapeInfos; // 10 - hkBool isAnyShapeMutated; // 20 + hkArray mutableShapeInfos; // 0x00 + hkArray freeMutableShapeInfos; // 0x10 + hkBool isAnyShapeMutated; // 0x20 }; static_assert(sizeof(hknpShapeManager) == 0x28); } diff --git a/include/RE/H/hknpShapeSignals.h b/include/RE/H/hknpShapeSignals.h index 18677e01..6983c84d 100644 --- a/include/RE/H/hknpShapeSignals.h +++ b/include/RE/H/hknpShapeSignals.h @@ -29,8 +29,8 @@ namespace RE static_assert(sizeof(ShapeMutatedSignal) == 0x08); // members - ShapeMutatedSignal shapeMutated; // 00 - ShapeDestroyedSignal shapeDestroyed; // 08 + ShapeMutatedSignal shapeMutated; // 0x00 + ShapeDestroyedSignal shapeDestroyed; // 0x08 }; static_assert(sizeof(hknpShapeSignals) == 0x10); } diff --git a/include/RE/H/hknpSolverInfo.h b/include/RE/H/hknpSolverInfo.h index 835ee7fe..56cd1d44 100644 --- a/include/RE/H/hknpSolverInfo.h +++ b/include/RE/H/hknpSolverInfo.h @@ -1,7 +1,7 @@ #pragma once #include "RE/H/hkSimdFloat32.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" namespace RE { @@ -9,36 +9,36 @@ namespace RE { public: // members - float tau; // 000 - float frictionTau; // 004 - hkSimdFloat32 damping; // 010 - hkSimdFloat32 deltaTime; // 020 - hkSimdFloat32 invDeltaTime; // 030 - hkSimdFloat32 subStepDeltaTime; // 040 - hkSimdFloat32 subStepInvDeltaTime; // 050 - hkSimdFloat32 distanceToLinearTim; // 060 - hkSimdFloat32 linearTimToDistance; // 070 - hkSimdFloat32 collisionTolerance; // 080 - hkSimdFloat32 unitScale; // 090 - hkSimdFloat32 collisionAccuracy; // 0A0 - float maxApproachSpeedForHighQualitySolver; // 0B0 - std::int32_t numSteps; // 0B4 - float invNumSteps; // 0B8 - std::int32_t numMicroSteps; // 0BC - float invNumMicroSteps; // 0C0 - float nominalGravityLength; // 0C4 - float expectedDeltaTime; // 0C8 - std::uint32_t stepSolveCount; // 0CC - hkVector4f globalAccelerationPerSubStep; // 0D0 - hkVector4f globalAccelerationPerStep; // 0E0 - hkVector4f integrateVelocityFactor; // 0F0 - hkVector4f invIntegrateVelocityFactor; // 100 - hkSimdFloat32 rhsFactor; // 110 - hkSimdFloat32 frictionRhsFactor; // 120 - float dampDivTau; // 130 - float tauDivDamp; // 134 - float dampDivFrictionTau; // 138 - float frictionTauDivDamp; // 13C + float tau; // 0x000 + float frictionTau; // 0x004 + hkSimdFloat32 damping; // 0x010 + hkSimdFloat32 deltaTime; // 0x020 + hkSimdFloat32 invDeltaTime; // 0x030 + hkSimdFloat32 subStepDeltaTime; // 0x040 + hkSimdFloat32 subStepInvDeltaTime; // 0x050 + hkSimdFloat32 distanceToLinearTim; // 0x060 + hkSimdFloat32 linearTimToDistance; // 0x070 + hkSimdFloat32 collisionTolerance; // 0x080 + hkSimdFloat32 unitScale; // 0x090 + hkSimdFloat32 collisionAccuracy; // 0x0A0 + float maxApproachSpeedForHighQualitySolver; // 0x0B0 + std::int32_t numSteps; // 0x0B4 + float invNumSteps; // 0x0B8 + std::int32_t numMicroSteps; // 0x0BC + float invNumMicroSteps; // 0x0C0 + float nominalGravityLength; // 0x0C4 + float expectedDeltaTime; // 0x0C8 + std::uint32_t stepSolveCount; // 0x0CC + hkVector4f globalAccelerationPerSubStep; // 0x0D0 + hkVector4f globalAccelerationPerStep; // 0x0E0 + hkVector4f integrateVelocityFactor; // 0x0F0 + hkVector4f invIntegrateVelocityFactor; // 0x100 + hkSimdFloat32 rhsFactor; // 0x110 + hkSimdFloat32 frictionRhsFactor; // 0x120 + float dampDivTau; // 0x130 + float tauDivDamp; // 0x134 + float dampDivFrictionTau; // 0x138 + float frictionTauDivDamp; // 0x13C }; static_assert(sizeof(hknpSolverInfo) == 0x140); } diff --git a/include/RE/H/hknpSparseCompactMap.h b/include/RE/H/hknpSparseCompactMap.h new file mode 100644 index 00000000..f792f42f --- /dev/null +++ b/include/RE/H/hknpSparseCompactMap.h @@ -0,0 +1,19 @@ +#pragma once + +#include "RE/H/hkArray.h" + +namespace RE +{ + template + class hknpSparseCompactMap + { + public: + + private: + std::uint32_t m_secondaryKeyMask; + std::uint32_t m_sencondaryKeyBits; + hkArray m_primaryKeyToIndex; + hkArray m_valueAndSecondaryKeys; + }; + static_assert(sizeof(hknpSparseCompactMap) == 0x28); +} diff --git a/include/RE/H/hknpSphereShape.h b/include/RE/H/hknpSphereShape.h new file mode 100644 index 00000000..a8288aa5 --- /dev/null +++ b/include/RE/H/hknpSphereShape.h @@ -0,0 +1,22 @@ +#pragma once + +#include "RE/H/hknpConvexShape.h" + +namespace RE +{ + class __declspec(novtable) hknpSphereShape : + public hknpConvexShape + { + public: + static constexpr auto RTTI{ RTTI::hknpSphereShape }; + static constexpr auto VTABLE{ VTABLE::hknpSphereShape }; + + static hknpSphereShape* CreateSphereShape(const hkVector4f& a_center, float a_radius) + { + using func_t = decltype(&hknpSphereShape::CreateSphereShape); + static REL::Relocation func{ ID::hknpSphereShape::CreateSphereShape }; + return func(a_center, a_radius); + } + }; + static_assert(sizeof(hknpSphereShape) == 0x40); +} diff --git a/include/RE/H/hknpThreadSafetyCheck.h b/include/RE/H/hknpThreadSafetyCheck.h index 850b036e..2d3d126a 100644 --- a/include/RE/H/hknpThreadSafetyCheck.h +++ b/include/RE/H/hknpThreadSafetyCheck.h @@ -19,9 +19,9 @@ namespace RE static_assert(sizeof(State) == 0x04); // members - State state; // 00 - hkCriticalSection criticalSection; // 08 - hkBool enabled; // 30 + State state; // 0x00 + hkCriticalSection criticalSection; // 0x08 + hkBool enabled; // 0x30 }; static_assert(sizeof(hknpThreadSafetyCheck) == 0x38); } diff --git a/include/RE/H/hknpUniqueBodyIdHitCollector.h b/include/RE/H/hknpUniqueBodyIdHitCollector.h index 77899e36..1ed98faf 100644 --- a/include/RE/H/hknpUniqueBodyIdHitCollector.h +++ b/include/RE/H/hknpUniqueBodyIdHitCollector.h @@ -8,14 +8,14 @@ namespace RE class hknpBSWorld; class __declspec(novtable) hknpUniqueBodyIdHitCollector : - public hknpAllHitsCollector // 000 + public hknpAllHitsCollector // 0x000 { public: static constexpr auto RTTI{ RTTI::hknpUniqueBodyIdHitCollector }; static constexpr auto VTABLE{ VTABLE::hknpUniqueBodyIdHitCollector }; // members - hkRefPtr latentWorld; // 3F0 + hkRefPtr latentWorld; // 0x3F0 }; static_assert(sizeof(hknpUniqueBodyIdHitCollector) == 0x400); } diff --git a/include/RE/H/hknpViewerColorScheme.h b/include/RE/H/hknpViewerColorScheme.h new file mode 100644 index 00000000..bc73d1e9 --- /dev/null +++ b/include/RE/H/hknpViewerColorScheme.h @@ -0,0 +1,19 @@ +#pragma once + +#include "RE/H/hknpBodyId.h" + +namespace RE +{ + class hknpWorld; + class hknpViewer; + + class hknpViewerColorScheme + { + public: + virtual ~hknpViewerColorScheme() = default; + + virtual std::uint32_t GetBodyColor(const hknpWorld&, hknpBodyId, hknpViewer*) = 0; + virtual bool IsBodyVisible(const hknpWorld&, hknpBodyId, hknpViewer*) = 0; + }; + static_assert(sizeof(hknpViewerColorScheme) == 0x8); +} diff --git a/include/RE/H/hknpWorld.h b/include/RE/H/hknpWorld.h index 845f3782..319996f5 100644 --- a/include/RE/H/hknpWorld.h +++ b/include/RE/H/hknpWorld.h @@ -9,7 +9,7 @@ #include "RE/H/hkRefPtr.h" #include "RE/H/hkReferencedObject.h" #include "RE/H/hkSimdFloat32.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpBodyManager.h" #include "RE/H/hknpConstraintManager.h" #include "RE/H/hknpContactSolverType.h" @@ -71,6 +71,31 @@ namespace RE kPostSolve = 40 }; + using AdditionFlagsEnum = hkcdRayQueryFlags::Enum; + using LeavingBroadPhaseBehavior = hknpWorldCinfo::LeavingBroadPhaseBehavior; + using SimulationType = hknpWorldCinfo::SimulationType; + + void AddBodies(hknpBodyId* a_ids, std::uint32_t a_idCount, AdditionMode a_additionMode, hkFlags a_additionFlags) + { + using func_t = decltype(&hknpWorld::AddBodies); + static REL::Relocation func{ ID::hknpWorld::AddBodies }; + func(this, a_ids, a_idCount, a_additionMode, a_additionFlags); + } + + hknpBodyId& CreateBody(hknpBodyId& a_id, const hknpBodyCinfo& a_cInfo, AdditionMode a_additionMode, hkFlags a_additionFlags) + { + using func_t = decltype(&hknpWorld::CreateBody); + static REL::Relocation func{ ID::hknpWorld::CreateBody }; + return func(this, a_id, a_cInfo, a_additionMode, a_additionFlags); + } + + hknpMotionId& CreateMotion(hknpMotionId& a_id, const hknpMotionCinfo& a_cInfo) + { + using func_t = decltype(&hknpWorld::CreateMotion); + static REL::Relocation func{ ID::hknpWorld::CreateMotion }; + return func(this, a_id, a_cInfo); + } + // members hknpBodyManager bodyManager; // 010 hknpMotionManager motionManager; // 0D8 diff --git a/include/RE/H/hknpWorldCinfo.h b/include/RE/H/hknpWorldCinfo.h index c15b8bc0..886137ba 100644 --- a/include/RE/H/hknpWorldCinfo.h +++ b/include/RE/H/hknpWorldCinfo.h @@ -4,7 +4,7 @@ #include "RE/H/hkBool.h" #include "RE/H/hkEnum.h" #include "RE/H/hkRefPtr.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" #include "RE/H/hknpContactSolverType.h" namespace RE diff --git a/include/RE/H/hknpWorldSignals.h b/include/RE/H/hknpWorldSignals.h index 76292b68..6ada3deb 100644 --- a/include/RE/H/hknpWorldSignals.h +++ b/include/RE/H/hknpWorldSignals.h @@ -229,35 +229,35 @@ namespace RE static_assert(sizeof(PostSolveSignal) == 0x08); // members - WorldDestroyedSignal worldDestroyed; // 00 - WorldShiftedSignal worldShifted; // 08 - BodyBufferFullSignal bodyBufferFull; // 10 - BodyBufferChangedSignal bodyBufferChanged; // 18 - BodyCreatedSignal bodyCreated; // 20 - BodyAddedSignal bodyAdded; // 28 - BodyRemovedSignal bodyRemoved; // 30 - BodyDestroyedSignal bodyDestroyed; // 38 - MotionBufferFullSignal motionBufferFull; // 40 - MotionBufferChangedSignal motionBufferChanged; // 48 - MotionCreatedSignal motionCreated; // 50 - MotionDestroyedSignal motionDestroyed; // 58 - StaticBodyMovedSignal staticBodyMoved; // 60 - BodySwitchStaticDynamicSignal bodySwitchStaticDynamic; // 68 - BodyAttachToCompoundSignal bodyAttached; // 70 - BodyDetachToCompoundSignal bodyDetached; // 78 - BodyShapeSetSignal bodyShapeChanged; // 80 - BodyChangedSignal bodyChanged; // 88 - ConstraintBufferFullSignal constraintBufferFull; // 90 - ConstraintBufferChangedSignal constraintBufferChanged; // 98 - ConstraintCreatedSignal constraintCreated; // A0 - ConstraintDestroyedSignal constraintDestroyed; // A8 - ConstraintEnabledSignal constraintEnabled; // B0 - ConstraintDisabledSignal constraintDisabled; // B8 - ImmediateConstraintAddedSignal immediateConstraintAdded; // C0 - PreCollideSignal preCollide; // C8 - PostCollideSignal postCollide; // D0 - PreSolveSignal preSolve; // D8 - PostSolveSignal postSolve; // E0 + WorldDestroyedSignal worldDestroyed; // 0x00 + WorldShiftedSignal worldShifted; // 0x08 + BodyBufferFullSignal bodyBufferFull; // 0x10 + BodyBufferChangedSignal bodyBufferChanged; // 0x18 + BodyCreatedSignal bodyCreated; // 0x20 + BodyAddedSignal bodyAdded; // 0x28 + BodyRemovedSignal bodyRemoved; // 0x30 + BodyDestroyedSignal bodyDestroyed; // 0x38 + MotionBufferFullSignal motionBufferFull; // 0x40 + MotionBufferChangedSignal motionBufferChanged; // 0x48 + MotionCreatedSignal motionCreated; // 0x50 + MotionDestroyedSignal motionDestroyed; // 0x58 + StaticBodyMovedSignal staticBodyMoved; // 0x60 + BodySwitchStaticDynamicSignal bodySwitchStaticDynamic; // 0x68 + BodyAttachToCompoundSignal bodyAttached; // 0x70 + BodyDetachToCompoundSignal bodyDetached; // 0x78 + BodyShapeSetSignal bodyShapeChanged; // 0x80 + BodyChangedSignal bodyChanged; // 0x88 + ConstraintBufferFullSignal constraintBufferFull; // 0x90 + ConstraintBufferChangedSignal constraintBufferChanged; // 0x98 + ConstraintCreatedSignal constraintCreated; // 0xA0 + ConstraintDestroyedSignal constraintDestroyed; // 0xA8 + ConstraintEnabledSignal constraintEnabled; // 0xB0 + ConstraintDisabledSignal constraintDisabled; // 0xB8 + ImmediateConstraintAddedSignal immediateConstraintAdded; // 0xC0 + PreCollideSignal preCollide; // 0xC8 + PostCollideSignal postCollide; // 0xD0 + PreSolveSignal preSolve; // 0xD8 + PostSolveSignal postSolve; // 0xE0 }; static_assert(sizeof(hknpWorldSignals) == 0xE8); } diff --git a/include/RE/I/IRendererResourceManager.h b/include/RE/I/IRendererResourceManager.h new file mode 100644 index 00000000..1f786061 --- /dev/null +++ b/include/RE/I/IRendererResourceManager.h @@ -0,0 +1,89 @@ +#pragma once + +#include "RE/N/NiPoint.h" + +namespace RE +{ + class BSDynamicLines; + class BSDynamicTriShape; + class BSLines; + class BSMeshLODTriShape; + class BSMultiStreamInstanceTriShape; + class BSSubIndexTriShape; + class BSTriShape; + class FadeNodeSettings; + class NiAVObject; + class NiColorA; + class NiDefaultAVObjectPalette; + class NiNode; + class NiPick; + class NiShadeProperty; + class NiStream; + class NiTexture; + + namespace BSGraphics + { + class Texture; + } + + class __declspec(novtable) IRendererResourceManager + { + public: + static constexpr auto RTTI{ RTTI::IRendererResourceManager }; + static constexpr auto VTABLE{ VTABLE::IRendererResourceManager }; + + virtual ~IRendererResourceManager(); + + virtual BSTriShape* CreateTriShape(std::uint32_t a_numTriangles, std::uint16_t* a_indices, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords0, NiColorA* a_texCoords1, NiPoint3* a_normals, NiPoint3* a_binormals, NiPoint3* a_tangents, NiColorA* a_colors, NiColorA* a_skinBoneWeights, std::uint8_t* a_skinBoneIndices, NiColorA* a_landscapeData1, NiColorA* a_landscapeData2, float* a_eyeData, bool a_generatePositionData) = 0; + virtual BSTriShape* CreateTriShape(std::uint32_t a_numTriangles, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords, NiColorA* a_colors, std::uint16_t* a_indices) = 0; + virtual void* CreateTriShape(NiStream* a_stream, std::uint64_t a_vertexDesc, std::uint32_t a_vertexCount, std::uint32_t a_indexCount, char** a_dynamicData) = 0; + virtual void* CreateTriShapeRendererData(void* a_vertexBuffer, std::uint64_t a_vertexDesc, std::uint16_t* a_indices, std::uint32_t a_indexCount) = 0; + virtual BSSubIndexTriShape* CreateSubIndexTriShape(std::uint32_t a_numTriangles, std::uint32_t a_numSegments, std::uint16_t* a_indices, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords0, NiColorA* a_texCoords1, NiPoint3* a_normals, NiPoint3* a_binormals, NiPoint3* a_tangents, NiColorA* a_colors, NiColorA* a_skinBoneWeights, std::uint8_t* a_skinBoneIndices, NiColorA* a_landscapeData1, NiColorA* a_landscapeData2, float* a_eyeData) = 0; + virtual void IncRefTriShape(void* a_rendererData) = 0; + virtual void DecRefTriShape(void* a_rendererData) = 0; + virtual BSDynamicTriShape* CreateDynamicTriShape(std::uint32_t a_dynamicFlags, std::uint32_t a_numTriangles, std::uint16_t* a_indices, std::uint32_t a_numVertices, NiPoint3* a_positions, NiPoint2* a_texCoords0, NiColorA* a_texCoords1, NiPoint3* a_normals, NiPoint3* a_binormals, NiPoint3* a_tangents, NiColorA* a_colors, NiColorA* a_skinBoneWeights, std::uint8_t* a_skinBoneIndices, NiColorA* a_landscapeData1, NiColorA* a_landscapeData2, float* a_eyeData) = 0; + virtual BSDynamicTriShape* CreateDynamicTriShape(std::uint32_t, std::uint32_t, std::uint32_t, NiPoint3*, NiPoint2*, NiColorA*, std::uint16_t*) = 0; + virtual void IncRefDynamicTriShape(void* a_rendererData) = 0; + virtual void DecRefDynamicTriShape(void* a_rendererData) = 0; + virtual void ConvertBSTriShapeToBSDynamicTriShape(NiNode* a_root, NiDefaultAVObjectPalette* a_objectPalette) = 0; + virtual void ApplyMaterials(NiAVObject* a_root) = 0; + virtual void SetTriShapeStreamDynamicFlags(std::uint32_t) = 0; + virtual void* CreateParticleShape() = 0; + virtual void IncRefParticleShape(void* a_rendererData) = 0; + virtual void DecRefParticleShape(void* a_rendererData) = 0; + virtual BSLines* CreateLineShape(std::uint32_t, std::uint16_t*, std::uint32_t, NiPoint3*, NiPoint2*, NiColorA*, NiPoint3*, NiPoint3*, NiPoint3*, NiColorA*, NiColorA*, std::uint8_t*, NiColorA*, NiColorA*, float*) = 0; + virtual BSDynamicLines* CreateDynamicLineShape(std::uint32_t, std::uint32_t, std::uint32_t, NiPoint3*, NiPoint2*, NiColorA*, std::uint16_t*) = 0; + virtual void* CreateDynamicLineShape(NiStream*, std::uint64_t, std::uint32_t, std::uint32_t) = 0; + virtual BSDynamicLines* CreateDynamicLineShape(std::uint32_t, std::uint32_t, std::uint16_t*, std::uint32_t, NiPoint3*, NiPoint2*, NiColorA*, NiPoint3*, NiPoint3*, NiPoint3*, NiColorA*, NiColorA*, std::uint8_t*, NiColorA*, NiColorA*, float*) = 0; + virtual void IncRefLines(void* a_rendererData) = 0; + virtual void DecRefLines(void* a_rendererData) = 0; + virtual void IncRefDynamicLines(void* a_rendererData) = 0; + virtual void DecRefDynamicLines(void* a_rendererData) = 0; + virtual void LoadTexture(NiTexture* apTexture) = 0; + virtual void CreateStreamingTexture(NiTexture* a_texture, const void* a_userDataIn, void* a_userDataOut) = 0; + virtual bool ReadStreamingTextureData(NiTexture* a_texture, void* a_userDataIn) = 0; + virtual bool CreateStreamingTextureArraySlice(NiTexture* a_texture, const void* a_userDataIn, void* a_userDataOut, std::uint32_t a_slice) = 0; + virtual bool ReadStreamingTextureDataToArraySlice(NiTexture* a_texture, void* a_userDataIn, std::uint32_t a_slice) = 0; + virtual void FinishStreamingTexture(NiTexture* a_texture) = 0; + virtual void IncRefTexture(BSGraphics::Texture* a_rendererData) = 0; + virtual void DecRefTexture(BSGraphics::Texture* a_rendererData) = 0; + virtual void GetTextureWidthHeight(NiTexture* a_texture, std::uint32_t* a_width, std::uint32_t* a_height) = 0; + virtual std::uint32_t GetTextureFormat(NiTexture* a_texture) = 0; + virtual bool UpdateTextureToDesiredMipLevel(NiTexture* a_texture, std::uint32_t*) = 0; + virtual void LoadUpgradeTextureData(NiTexture* a_texture) = 0; + virtual bool UpdateStreamingTextureToDesiredMipLevel(NiTexture* a_texture, std::uint32_t*, void*, void*) = 0; + virtual void FinishStreamingTextureUpgade(NiTexture* a_texture) = 0; + virtual void* CreateVertexBuffer(std::uint32_t* a_dataSize, void* a_data, std::uint32_t a_stride, std::uint64_t) = 0; + virtual void DecRefVertexBuffer(void* a_rendererData) = 0; + virtual NiShadeProperty* CreateDefaultEffectShaderProperty(bool a_vertexColors, bool a_skinned) = 0; + virtual BSMeshLODTriShape* CreateMeshLODTriShape(std::uint32_t*, std::uint32_t, std::uint64_t, std::uint32_t, std::uint32_t, void*) = 0; + virtual BSMeshLODTriShape* CreateMeshLODTriShape(BSTriShape*, std::uint32_t*, std::uint32_t) = 0; + virtual std::uint32_t UpdateIndexBufferForInstancing(BSMultiStreamInstanceTriShape*, std::uint32_t) = 0; + virtual bool FindIntersectionsTriShapeFastPath(const NiPoint3*, const NiPoint3*, NiPick*, BSTriShape*) = 0; + virtual void CreateTangentSpace(std::uint32_t, std::uint16_t*, std::uint32_t, NiPoint3*, NiPoint2*, NiPoint3*, NiPoint3*, NiPoint3*) = 0; + virtual float GetShaderFrameCount() = 0; + virtual float GetShaderTimerDelta() = 0; + virtual void GetFadeNodeSettings(FadeNodeSettings* a_skinned) = 0; + virtual void GetCameraVectors(NiPoint3* a_up, NiPoint3* a_right, NiPoint3* a_direction) = 0; + }; +} diff --git a/include/RE/IDs.h b/include/RE/IDs.h index 6742dfc2..b76d2d59 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -422,6 +422,7 @@ namespace RE::ID namespace bhkNPCollisionObject { + inline constexpr REL::ID CreateObject{ 2277912 }; inline constexpr REL::ID CopyMembers{ 2277907 }; inline constexpr REL::ID GetBody{ 2277926 }; inline constexpr REL::ID GetBodyId{ 2277928 }; @@ -432,6 +433,11 @@ namespace RE::ID inline constexpr REL::ID Getbhk{ 2277919 }; } + namespace hknpBodyCinfo + { + inline constexpr REL::ID ctor{ 2255967 }; + } + namespace bhkPhysicsSystem { inline constexpr REL::ID ctor{ 2278008 }; @@ -456,6 +462,7 @@ namespace RE::ID namespace bhkUtilFunctions { inline constexpr REL::ID FindFirstCollisionObject{ 2278093 }; + inline constexpr REL::ID GetAVObjectFromBodyID{ 2278085 }; } namespace bhkWorld @@ -713,6 +720,11 @@ namespace RE::ID inline constexpr REL::ID SetMaterial{ 2316285 }; } + namespace BSShaderResourceManager + { + inline constexpr REL::ID Singleton{ 2703483 }; + } + namespace BSShaderTextureSet { inline constexpr REL::ID CreateObject{ 2316324 }; @@ -725,11 +737,24 @@ namespace RE::ID namespace BSSoundHandle { + inline constexpr REL::ID ClearFollowedObject{ 2267067 }; inline constexpr REL::ID FadeInPlay{ 2267075 }; inline constexpr REL::ID FadeOutAndRelease{ 2267076 }; + inline constexpr REL::ID FadeTo{ 2267074 }; + inline constexpr REL::ID GetDuration{ 2267062 }; + inline constexpr REL::ID IsEnvelopeLoop{ 2267051 }; + inline constexpr REL::ID IsPaused{ 2267047 }; inline constexpr REL::ID IsPlaying{ 2267046 }; + inline constexpr REL::ID IsValid{ 2267048 }; + inline constexpr REL::ID Pause{ 2267044 }; inline constexpr REL::ID Play{ 2276042 }; + inline constexpr REL::ID PlayAfter{ 2267043 }; + inline constexpr REL::ID SetFrequency{ 2267059 }; + inline constexpr REL::ID SetFrequencyVariance{ 2267060 }; + inline constexpr REL::ID SetObjectToFollow{ 2267066 }; inline constexpr REL::ID SetOutputModel{ 2267053 }; + inline constexpr REL::ID SetPosition{ 2267064 }; + inline constexpr REL::ID SetStaticAttenuation{ 2267061 }; inline constexpr REL::ID Stop{ 2267045 }; } @@ -1064,6 +1089,92 @@ namespace RE::ID inline constexpr REL::ID Get{ 2194566 }; } + namespace hkContainerHeapAllocator + { + inline constexpr REL::ID Singleton{ 2665426 }; + } + + namespace hkHardwareInfo + { + inline constexpr REL::ID CalcNumHardwareThreads{ 2260765 }; + } + + namespace hkMemoryRouter + { + inline constexpr REL::ID tlsSlotID{ 878080 }; + } + + namespace hkMonitorStream + { + inline constexpr REL::ID tlsSlotID{ 2702743 }; + inline constexpr REL::ID Clear{ 2257312 }; + inline constexpr REL::ID Resize{ 2257310 }; + } + + namespace hknpConvexShape + { + inline constexpr REL::ID CreateFromAabb{ 2257125 }; + inline constexpr REL::ID CreateFromCylinder{ 2257126 }; + inline constexpr REL::ID CreateFromHalfExtents{ 2257124 }; + inline constexpr REL::ID CreateFromIndexedVertices{ 2257123 }; + inline constexpr REL::ID CreateFromVertices{ 2257122 }; + } + + namespace hknpMotionCinfo + { + inline constexpr REL::ID ctor{ 2258369 }; + inline constexpr REL::ID InitializeAsKeyFramed{ 2258373 }; + } + + namespace hknpPhysicsSystem + { + inline constexpr REL::ID AddToWorld{ 2255984 }; + inline constexpr REL::ID RemoveFromWorld{ 2255985 }; + } + + namespace hknpSphereShape + { + inline constexpr REL::ID CreateSphereShape{ 2256377 }; + } + + namespace hknpWorld + { + inline constexpr REL::ID AddBodies{ 2255681 }; + inline constexpr REL::ID CreateBody{ 2255680 }; + inline constexpr REL::ID CreateMotion{ 2255688 }; + } + + namespace hkProcessFactory + { + inline constexpr REL::ID Singleton{ 2702978 }; + inline constexpr REL::ID CreateProcess{ 2263377 }; + } + + namespace hkReferencedObject + { + inline constexpr REL::ID AddReference{ 2259213 }; + inline constexpr REL::ID RemoveReference{ 2195747 }; + } + + namespace hkStringPtr + { + inline constexpr REL::ID ctor{ 2255573 }; + } + + namespace hkVisualDebugger + { + inline constexpr REL::ID ctor{ 2263295 }; + inline constexpr REL::ID AddContext{ 2263313 }; + inline constexpr REL::ID AddDefaultProcess{ 2263302 }; + inline constexpr REL::ID Serve{ 2263296 }; + inline constexpr REL::ID Shutdown{ 2263300 }; + } + + namespace hkVtableClassRegistry + { + inline constexpr REL::ID Singleton{ 2702926 }; + } + namespace HolotapeMenu { inline constexpr REL::ID ShowHolotapeInPipboy{ 2224028 }; @@ -1573,6 +1684,7 @@ namespace RE::ID namespace PlayerCamera { inline constexpr REL::ID Singleton{ 4796065 }; + inline constexpr REL::ID GetCameraPosition{ 2248334 }; inline constexpr REL::ID PopState{ 2248424 }; inline constexpr REL::ID PushState{ 2248422 }; inline constexpr REL::ID ToggleFreeCameraMode{ 2248368 }; @@ -2028,6 +2140,10 @@ namespace RE::ID inline constexpr REL::ID FindReferenceFor3D{ 2201082 }; inline constexpr REL::ID GetCurrentLocation{ 2201163 }; inline constexpr REL::ID GetDisplayFullName{ 2201126 }; + inline constexpr REL::ID GetDistanceFromPoint{ 2201172 }; + inline constexpr REL::ID GetDistanceFromReference{ 2201174 }; + inline constexpr REL::ID GetDistanceSqFromPoint{ 2201173 }; + inline constexpr REL::ID GetDistanceSqFromReference{ 2201175 }; inline constexpr REL::ID GetEditorDead{ 2200781 }; inline constexpr REL::ID GetOwner{ 2202616 }; inline constexpr REL::ID GetGoldAmount{ 2200923 }; diff --git a/include/RE/N/NiAVObject.h b/include/RE/N/NiAVObject.h index bef30380..ff8f3de4 100644 --- a/include/RE/N/NiAVObject.h +++ b/include/RE/N/NiAVObject.h @@ -19,6 +19,8 @@ namespace RE public NiObjectNET // 000 { public: + F4_HEAP_REDEFINE_ALIGNED_NEW(NiAVObject); + static constexpr auto RTTI{ RTTI::NiAVObject }; static constexpr auto VTABLE{ VTABLE::NiAVObject }; static constexpr auto Ni_RTTI{ Ni_RTTI::NiAVObject }; @@ -46,14 +48,29 @@ namespace RE virtual void PostAttachUpdate(); // 38 virtual void OnVisible([[maybe_unused]] NiCullingProcess& a_culler) { return; } // 39 - F4_HEAP_REDEFINE_ALIGNED_NEW(NiAVObject); - - [[nodiscard]] bool GetAppCulled() const noexcept { return flags.flags & 1; } - [[nodiscard]] std::uint64_t GetFlags() const noexcept { return flags.flags; } - [[nodiscard]] bool ShadowCaster() const noexcept { return ~(flags.flags >> 40) & 1; } - void CullGeometry(bool a_cull); - void CullNode(bool a_cull); - void Update(NiUpdateData& a_data); + bool GetAppCulled() const noexcept { return flags.flags & 1; } + NiPointer GetCollisionObject() const noexcept { return collisionObject; } + std::uint64_t GetFlags() const noexcept { return flags.flags; } + const NiMatrix3& GetLocalRotate() const noexcept { return local.rotate; } + float GetLocalScale() const noexcept { return local.scale; } + const NiTransform& GetLocalTransform() const noexcept { return local; } + const NiPoint3& GetLocalTranslate() const noexcept { return local.translate; } + const NiMatrix3& GetWorldRotate() const noexcept { return world.rotate; } + float GetWorldScale() const noexcept { return world.scale; } + const NiTransform& GetWorldTransform() const noexcept { return world; } + const NiPoint3& GetWorldTranslate() const noexcept { return world.translate; } + void SetLocalRotate(const NiMatrix3& a_rotate) noexcept { local.rotate = a_rotate; } + void SetLocalScale(float a_scale) noexcept { local.scale = a_scale; } + void SetLocalTransform(const NiTransform& a_transform) noexcept { local = a_transform; } + void SetLocalTranslate(const NiPoint3& a_translate) noexcept { local.translate = a_translate; } + void SetWorldRotate(const NiMatrix3& a_rotate) noexcept { world.rotate = a_rotate; } + void SetWorldScale(float a_scale) noexcept { world.scale = a_scale; } + void SetWorldTransform(const NiTransform& a_transform) noexcept { world = a_transform; } + void SetWorldTranslate(const NiPoint3& a_translate) noexcept { world.translate = a_translate; } + bool ShadowCaster() const noexcept { return ~(flags.flags >> 40) & 1; } + void CullGeometry(bool a_cull); + void CullNode(bool a_cull); + void Update(NiUpdateData& a_data); // members NiNode* parent{ nullptr }; // 027 diff --git a/include/RE/N/NiBinaryExtraData.h b/include/RE/N/NiBinaryExtraData.h new file mode 100644 index 00000000..5d666047 --- /dev/null +++ b/include/RE/N/NiBinaryExtraData.h @@ -0,0 +1,52 @@ +#pragma once + +#include "RE/N/NiExtraData.h" + +namespace RE +{ + class __declspec(novtable) NiBinaryExtraData : + public NiExtraData + { + public: + static constexpr auto RTTI{ RTTI::NiBinaryExtraData }; + static constexpr auto VTABLE{ VTABLE::NiBinaryExtraData }; + static constexpr auto Ni_RTTI{ Ni_RTTI::NiBinaryExtraData }; + + NiBinaryExtraData() : + NiExtraData() + { + REX::EMPLACE_VTABLE(this); + } + + NiBinaryExtraData(void* a_value, const std::uint32_t a_size) : + NiExtraData(), value(a_value), size(a_size) + { + REX::EMPLACE_VTABLE(this); + } + + NiBinaryExtraData(const BSFixedString& a_name, void* a_value, const std::uint32_t a_size) : + NiExtraData(a_name), value(a_value), size(a_size) + { + REX::EMPLACE_VTABLE(this); + } + + public: + void GetValue(void** a_value, std::uint32_t* a_size) const + { + *a_value = value; + *a_size = size; + } + + void SetValue(void* a_value, const std::uint32_t a_size) + { + value = a_value; + size = a_size; + } + + protected: + // members + void* value{ nullptr }; // 0x18 + std::uint32_t size{ 0 }; // 0x20 + }; + static_assert(sizeof(NiBinaryExtraData) == 0x28); +} diff --git a/include/RE/N/NiBooleanExtraData.h b/include/RE/N/NiBooleanExtraData.h new file mode 100644 index 00000000..bd9b3cdb --- /dev/null +++ b/include/RE/N/NiBooleanExtraData.h @@ -0,0 +1,49 @@ +#pragma once + +#include "RE/N/NiExtraData.h" + +namespace RE +{ + class __declspec(novtable) NiBooleanExtraData : + public NiExtraData + { + public: + static constexpr auto RTTI{ RTTI::NiBooleanExtraData }; + static constexpr auto VTABLE{ VTABLE::NiBooleanExtraData }; + static constexpr auto Ni_RTTI{ Ni_RTTI::NiBooleanExtraData }; + + NiBooleanExtraData() : + NiExtraData() + { + REX::EMPLACE_VTABLE(this); + } + + NiBooleanExtraData(const bool a_value) : + NiExtraData(), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + NiBooleanExtraData(const BSFixedString& a_name, const bool a_value) : + NiExtraData(a_name), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + public: + bool GetValue() const + { + return value; + } + + void SetValue(const bool a_value) + { + value = a_value; + } + + protected: + // members + bool value{ 0 }; // 0x18 + }; + static_assert(sizeof(NiBooleanExtraData) == 0x20); +} diff --git a/include/RE/N/NiCollisionObject.h b/include/RE/N/NiCollisionObject.h index 0436ee07..4f819603 100644 --- a/include/RE/N/NiCollisionObject.h +++ b/include/RE/N/NiCollisionObject.h @@ -21,6 +21,11 @@ namespace RE virtual void Initialize([[maybe_unused]] void* a_data) { return; } // 2A virtual void Convert([[maybe_unused]] std::uint32_t a_version, [[maybe_unused]] void* a_data) { return; } // 2B + NiAVObject* GetSceneGraphObject() const + { + return sceneObject; + } + // members NiAVObject* sceneObject; // 10 }; diff --git a/include/RE/N/NiColor.h b/include/RE/N/NiColor.h index 745872f5..74fce338 100644 --- a/include/RE/N/NiColor.h +++ b/include/RE/N/NiColor.h @@ -5,21 +5,37 @@ namespace RE class NiColor { public: + constexpr NiColor() = default; + + constexpr NiColor(const float a_red, const float a_green, const float a_blue) : + r(a_red), g(a_green), b(a_blue) + {} + // members - float r; // 0 - float g; // 4 - float b; // 8 + float r{ 0 }; // 0x0 + float g{ 0 }; // 0x4 + float b{ 0 }; // 0x8 }; static_assert(sizeof(NiColor) == 0xC); class NiColorA { public: + constexpr NiColorA() = default; + + constexpr NiColorA(const float a_red, const float a_green, const float a_blue, const float a_alpha) : + r(a_red), g(a_green), b(a_blue), a(a_alpha) + {} + + constexpr NiColorA(const NiColor& a_color) : + r(a_color.r), g(a_color.g), b(a_color.b) + {} + // members - float r; // 0 - float g; // 4 - float b; // 8 - float a; // C + float r{ 0 }; // 0x0 + float g{ 0 }; // 0x4 + float b{ 0 }; // 0x8 + float a{ 0 }; // 0xC }; static_assert(sizeof(NiColorA) == 0x10); } diff --git a/include/RE/N/NiColorExtraData.h b/include/RE/N/NiColorExtraData.h new file mode 100644 index 00000000..86866785 --- /dev/null +++ b/include/RE/N/NiColorExtraData.h @@ -0,0 +1,55 @@ +#pragma once + +#include "RE/N/NiColor.h" +#include "RE/N/NiExtraData.h" + +namespace RE +{ + class __declspec(novtable) NiColorExtraData : + public NiExtraData + { + public: + static constexpr auto RTTI{ RTTI::NiColorExtraData }; + static constexpr auto VTABLE{ VTABLE::NiColorExtraData }; + static constexpr auto Ni_RTTI{ Ni_RTTI::NiColorExtraData }; + + NiColorExtraData() : + NiExtraData() + { + REX::EMPLACE_VTABLE(this); + } + + NiColorExtraData(const NiColorA& a_value) : + NiExtraData(), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + NiColorExtraData(const BSFixedString& a_name, const NiColorA& a_value) : + NiExtraData(a_name), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + public: + const NiColorA& GetValue() const + { + return value; + } + + void SetValue(const NiColor& a_value) + { + value = a_value; + } + + void SetValue(const NiColorA& a_value) + { + value = a_value; + } + + protected: + // members + NiColorA value; // 0x18 + }; + static_assert(sizeof(NiColorExtraData) == 0x28); +} diff --git a/include/RE/N/NiExtraData.h b/include/RE/N/NiExtraData.h index 68dc68b0..05570020 100644 --- a/include/RE/N/NiExtraData.h +++ b/include/RE/N/NiExtraData.h @@ -6,21 +6,29 @@ namespace RE { class __declspec(novtable) NiExtraData : - public NiObject // 00 + public NiObject // 0x00 { public: static constexpr auto RTTI{ RTTI::NiExtraData }; static constexpr auto VTABLE{ VTABLE::NiExtraData }; static constexpr auto Ni_RTTI{ Ni_RTTI::NiExtraData }; + NiExtraData(); + NiExtraData(const BSFixedString& a_name); + + virtual ~NiExtraData(); // 00 + // add virtual bool KeepForExport() const { return false; } // 28 virtual bool KeepForExporterOnly() const { return false; } // 29 virtual bool IsStreamable() const { return true; } // 2A virtual bool IsCloneable() const { return true; } // 2B + const BSFixedString& GetName() const; + void SetName(const BSFixedString& a_name); + // members - BSFixedString name; // 10 + BSFixedString name; // 0x10 }; static_assert(sizeof(NiExtraData) == 0x18); } diff --git a/include/RE/N/NiExtraDataContainer.h b/include/RE/N/NiExtraDataContainer.h index d4db9019..cfa9d3eb 100644 --- a/include/RE/N/NiExtraDataContainer.h +++ b/include/RE/N/NiExtraDataContainer.h @@ -1,16 +1,34 @@ #pragma once +#include "RE/B/BSFixedString.h" #include "RE/B/BSSpinLock.h" #include "RE/B/BSTArray.h" +#include "RE/N/NiPointer.h" namespace RE { class NiExtraData; - class NiExtraDataContainer : - public BSTArray + class NiExtraDataContainer { public: - BSAutoLock lock; + NiExtraDataContainer(const std::uint32_t a_count); + + void Add(NiExtraData* a_extra); + NiExtraData* FindExtra(const BSFixedString& a_key) const; + std::int32_t FindIndex(const BSFixedString& a_key) const; + std::uint32_t GetSize() const; + bool RemoveExtra(const BSFixedString& a_key); + + template + T* FindExtra(const BSFixedString& a_key) const + { + return static_cast(FindExtra(a_key)); + } + + // members + BSTArray> extra; + mutable BSReadWriteLock lock; }; + static_assert(sizeof(NiExtraDataContainer) == 0x20); } diff --git a/include/RE/N/NiFloatExtraData.h b/include/RE/N/NiFloatExtraData.h new file mode 100644 index 00000000..80a58789 --- /dev/null +++ b/include/RE/N/NiFloatExtraData.h @@ -0,0 +1,49 @@ +#pragma once + +#include "RE/N/NiExtraData.h" + +namespace RE +{ + class __declspec(novtable) NiFloatExtraData : + public NiExtraData + { + public: + static constexpr auto RTTI{ RTTI::NiFloatExtraData }; + static constexpr auto VTABLE{ VTABLE::NiFloatExtraData }; + static constexpr auto Ni_RTTI{ Ni_RTTI::NiFloatExtraData }; + + NiFloatExtraData() : + NiExtraData() + { + REX::EMPLACE_VTABLE(this); + } + + NiFloatExtraData(const float a_value) : + NiExtraData(), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + NiFloatExtraData(const BSFixedString& a_name, const float a_value) : + NiExtraData(a_name), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + public: + float GetValue() const + { + return value; + } + + void SetValue(const float a_value) + { + value = a_value; + } + + protected: + // members + float value{ 0 }; // 0x18 + }; + static_assert(sizeof(NiIntegerExtraData) == 0x20); +} diff --git a/include/RE/N/NiIntegerExtraData.h b/include/RE/N/NiIntegerExtraData.h new file mode 100644 index 00000000..6e1b0b6d --- /dev/null +++ b/include/RE/N/NiIntegerExtraData.h @@ -0,0 +1,49 @@ +#pragma once + +#include "RE/N/NiExtraData.h" + +namespace RE +{ + class __declspec(novtable) NiIntegerExtraData : + public NiExtraData + { + public: + static constexpr auto RTTI{ RTTI::NiIntegerExtraData }; + static constexpr auto VTABLE{ VTABLE::NiIntegerExtraData }; + static constexpr auto Ni_RTTI{ Ni_RTTI::NiIntegerExtraData }; + + NiIntegerExtraData() : + NiExtraData() + { + REX::EMPLACE_VTABLE(this); + } + + NiIntegerExtraData(const std::int32_t a_value) : + NiExtraData(), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + NiIntegerExtraData(const BSFixedString& a_name, const std::int32_t a_value) : + NiExtraData(a_name), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + public: + std::int32_t GetValue() const + { + return value; + } + + void SetValue(const std::int32_t a_value) + { + value = a_value; + } + + protected: + // members + std::int32_t value{ 0 }; // 0x18 + }; + static_assert(sizeof(NiIntegerExtraData) == 0x20); +} diff --git a/include/RE/N/NiMatrix3.h b/include/RE/N/NiMatrix3.h index 200bf51d..fdbf86ea 100644 --- a/include/RE/N/NiMatrix3.h +++ b/include/RE/N/NiMatrix3.h @@ -10,23 +10,23 @@ namespace RE static const NiMatrix3 ZERO; static const NiMatrix3 IDENTITY; - NiMatrix3() noexcept = default; - NiMatrix3(const NiPoint4& a_point0, const NiPoint4& a_point1, const NiPoint4& a_point2) noexcept; - NiMatrix3( + constexpr NiMatrix3() noexcept = default; + constexpr NiMatrix3(const NiPoint4& a_point0, const NiPoint4& a_point1, const NiPoint4& a_point2) noexcept; + constexpr NiMatrix3( float a_x0, float a_y0, float a_z0, float a_w0, float a_x1, float a_y1, float a_z1, float a_w1, float a_x2, float a_y2, float a_z2, float a_w2) noexcept; - NiPoint4& operator[](std::size_t a_pos) noexcept; - const NiPoint4& operator[](std::size_t a_pos) const noexcept; - bool operator==(const NiMatrix3& a_rhs) const noexcept; - bool operator!=(const NiMatrix3& a_rhs) const noexcept; - NiMatrix3 operator*(const NiMatrix3& a_rhs) const noexcept; - NiMatrix3 operator*(float a_scalar) const noexcept; - NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint4& operator[](std::size_t a_pos) noexcept; + constexpr const NiPoint4& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const NiMatrix3& a_rhs) const noexcept; + constexpr bool operator!=(const NiMatrix3& a_rhs) const noexcept; + constexpr NiMatrix3 operator*(const NiMatrix3& a_rhs) const noexcept; + constexpr NiMatrix3 operator*(float a_scalar) const noexcept; + constexpr NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; - void MakeIdentity() noexcept; - NiMatrix3 Transpose() const noexcept; + constexpr void MakeIdentity() noexcept; + constexpr NiMatrix3 Transpose() const noexcept; bool ToEulerAnglesXYZ(NiPoint3& a_point) const; bool ToEulerAnglesXYZ(float& a_x, float& a_y, float& a_z) const; diff --git a/include/RE/N/NiObject.h b/include/RE/N/NiObject.h index 8d47ec56..5d12e232 100644 --- a/include/RE/N/NiObject.h +++ b/include/RE/N/NiObject.h @@ -44,7 +44,7 @@ namespace RE virtual ~NiObject() = default; // NOLINT(modernize-use-override) 00 // add - virtual const NiRTTI* GetRTTI() const; // 02 + virtual const NiRTTI* GetRTTI() const { return nullptr; } // 02 virtual NiNode* IsNode() { return nullptr; } // 04 virtual const NiNode* IsNode() const { return nullptr; } // 03 virtual NiSwitchNode* IsSwitchNode() { return nullptr; } // 05 @@ -71,10 +71,10 @@ namespace RE virtual NiObject* CreateClone([[maybe_unused]] NiCloningProcess& a_cloneData) { return nullptr; } // 1A virtual void LoadBinary([[maybe_unused]] NiStream& a_stream) { return; } // 1B virtual void LinkObject([[maybe_unused]] NiStream& a_stream) { return; } // 1C - virtual bool RegisterStreamables(NiStream& a_stream); // 1D + virtual bool RegisterStreamables(NiStream& a_stream) { return false; } // 1D virtual void SaveBinary([[maybe_unused]] NiStream& a_stream) { return; } // 1E - virtual bool IsEqual(NiObject* a_object); // 1F - virtual void ProcessClone(NiCloningProcess& a_cloning); // 20 + virtual bool IsEqual(NiObject* a_object) { return false; } // 1F + virtual void ProcessClone(NiCloningProcess& a_cloning) {} // 20 virtual void PostLinkObject([[maybe_unused]] NiStream& a_stream) { return; } // 21 virtual bool StreamCanSkip() { return false; } // 22 virtual const NiRTTI* GetStreamableRTTI() { return GetRTTI(); } // 23 diff --git a/include/RE/N/NiObjectNET.h b/include/RE/N/NiObjectNET.h index a74c65ec..f3be2109 100644 --- a/include/RE/N/NiObjectNET.h +++ b/include/RE/N/NiObjectNET.h @@ -1,7 +1,6 @@ #pragma once #include "RE/B/BSFixedString.h" -#include "RE/N/NiExtraData.h" #include "RE/N/NiExtraDataContainer.h" #include "RE/N/NiObject.h" #include "RE/N/NiPointer.h" @@ -9,6 +8,8 @@ namespace RE { + class NiExtraData; + class __declspec(novtable) NiObjectNET : public NiObject // 00 { @@ -29,8 +30,20 @@ namespace RE F4_HEAP_REDEFINE_NEW(NiObjectNET); - [[nodiscard]] NiExtraData* GetExtraData(BSFixedString a_key) const noexcept; - [[nodiscard]] std::string_view GetName() const { return name; } + bool AddExtraData(const BSFixedString& a_key, NiExtraData* a_extra); + bool AddExtraData(NiExtraData* a_extra); + NiExtraData* GetExtraData(const BSFixedString& a_key) const; + std::uint16_t GetExtraDataSize() const; + const BSFixedString& GetName() const { return name; } + bool HasExtraData(const BSFixedString& a_key) const; + bool InsertExtraData(NiExtraData* a_extra); + bool RemoveExtraData(const BSFixedString& a_key); + + template + T* GetExtraData(const BSFixedString& a_key) const + { + return static_cast(GetExtraData(a_key)); + } // members BSFixedString name{ "" }; // 10 diff --git a/include/RE/N/NiPoint.h b/include/RE/N/NiPoint.h index c768a7a4..c2af9faa 100644 --- a/include/RE/N/NiPoint.h +++ b/include/RE/N/NiPoint.h @@ -6,31 +6,34 @@ namespace RE { public: static const NiPoint2 ZERO; - - NiPoint2() noexcept = default; - NiPoint2(float a_x, float a_y) noexcept; - - float& operator[](std::size_t a_pos) noexcept; - const float& operator[](std::size_t a_pos) const noexcept; - bool operator==(const NiPoint2& a_rhs) const noexcept; - bool operator!=(const NiPoint2& a_rhs) const noexcept; - bool operator<(const NiPoint2& a_rhs) const noexcept; - bool operator>(const NiPoint2& a_rhs) const noexcept; - NiPoint2 operator+(const NiPoint2& a_rhs) const noexcept; - NiPoint2 operator-(const NiPoint2& a_rhs) const noexcept; - NiPoint2 operator*(const NiPoint2& a_rhs) const noexcept; - NiPoint2 operator/(const NiPoint2& a_rhs) const noexcept; - NiPoint2 operator*(float a_scalar) const noexcept; - NiPoint2 operator/(float a_scalar) const noexcept; - NiPoint2 operator-() const noexcept; - NiPoint2& operator+=(const NiPoint2& a_rhs) noexcept; - NiPoint2& operator-=(const NiPoint2& a_rhs) noexcept; - NiPoint2& operator*=(const NiPoint2& a_rhs) noexcept; - NiPoint2& operator/=(const NiPoint2& a_rhs) noexcept; - NiPoint2& operator+=(float a_scalar) noexcept; - NiPoint2& operator-=(float a_scalar) noexcept; - NiPoint2& operator*=(float a_scalar) noexcept; - NiPoint2& operator/=(float a_scalar) noexcept; + static const NiPoint2 UNIT; + static const NiPoint2 UNIT_X; + static const NiPoint2 UNIT_Y; + + constexpr NiPoint2() noexcept = default; + constexpr NiPoint2(float a_x, float a_y) noexcept; + + constexpr float& operator[](std::size_t a_pos) noexcept; + constexpr const float& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const NiPoint2& a_rhs) const noexcept; + constexpr bool operator!=(const NiPoint2& a_rhs) const noexcept; + constexpr bool operator<(const NiPoint2& a_rhs) const noexcept; + constexpr bool operator>(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator+(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator-(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator*(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator/(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator*(float a_scalar) const noexcept; + constexpr NiPoint2 operator/(float a_scalar) const noexcept; + constexpr NiPoint2 operator-() const noexcept; + constexpr NiPoint2& operator+=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator-=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator*=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator/=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator+=(float a_scalar) noexcept; + constexpr NiPoint2& operator-=(float a_scalar) noexcept; + constexpr NiPoint2& operator*=(float a_scalar) noexcept; + constexpr NiPoint2& operator/=(float a_scalar) noexcept; // members float x{ 0.0F }; // 00 @@ -45,42 +48,47 @@ namespace RE { public: static const NiPoint3 ZERO; - - NiPoint3() noexcept = default; - NiPoint3(const NiPoint2& a_point) noexcept; - NiPoint3(float a_x, float a_y, float a_z) noexcept; - - float& operator[](std::size_t a_pos) noexcept; - const float& operator[](std::size_t a_pos) const noexcept; - bool operator==(const NiPoint3& a_rhs) const noexcept; - bool operator!=(const NiPoint3& a_rhs) const noexcept; - bool operator<(const NiPoint3& a_rhs) const noexcept; - bool operator>(const NiPoint3& a_rhs) const noexcept; - NiPoint3 operator+(const NiPoint3& a_rhs) const noexcept; - NiPoint3 operator-(const NiPoint3& a_rhs) const noexcept; - NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; - NiPoint3 operator/(const NiPoint3& a_rhs) const noexcept; - NiPoint3 operator*(float a_scalar) const noexcept; - NiPoint3 operator/(float a_scalar) const noexcept; - NiPoint3 operator-() const noexcept; - NiPoint3& operator+=(const NiPoint3& a_rhs) noexcept; - NiPoint3& operator-=(const NiPoint3& a_rhs) noexcept; - NiPoint3& operator*=(const NiPoint3& a_rhs) noexcept; - NiPoint3& operator/=(const NiPoint3& a_rhs) noexcept; - NiPoint3& operator+=(float a_scalar) noexcept; - NiPoint3& operator-=(float a_scalar) noexcept; - NiPoint3& operator*=(float a_scalar) noexcept; - NiPoint3& operator/=(float a_scalar) noexcept; - - [[nodiscard]] NiPoint3 Cross(const NiPoint3& a_point) const noexcept; - [[nodiscard]] float Dot(const NiPoint3& a_point) const noexcept; - [[nodiscard]] float GetDistance(const NiPoint3& a_point) const noexcept; - [[nodiscard]] float GetSquaredDistance(const NiPoint3& a_point) const noexcept; - [[nodiscard]] float GetZAngleFromVector() const; - [[nodiscard]] float Length() const noexcept; - [[nodiscard]] float SqrLength() const noexcept; - [[nodiscard]] NiPoint3 UnitCross(const NiPoint3& a_point) const noexcept; - float Unitize() noexcept; + static const NiPoint3 UNIT; + static const NiPoint3 UNIT_X; + static const NiPoint3 UNIT_Y; + static const NiPoint3 UNIT_Z; + + constexpr NiPoint3() noexcept = default; + constexpr NiPoint3(const NiPoint2& a_point) noexcept; + constexpr NiPoint3(float a_x, float a_y, float a_z) noexcept; + + constexpr float& operator[](std::size_t a_pos) noexcept; + constexpr const float& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const NiPoint3& a_rhs) const noexcept; + constexpr bool operator!=(const NiPoint3& a_rhs) const noexcept; + constexpr bool operator<(const NiPoint3& a_rhs) const noexcept; + constexpr bool operator>(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator+(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator-(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator/(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator*(float a_scalar) const noexcept; + constexpr NiPoint3 operator/(float a_scalar) const noexcept; + constexpr NiPoint3 operator-() const noexcept; + constexpr NiPoint3& operator+=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator-=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator*=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator/=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator+=(float a_scalar) noexcept; + constexpr NiPoint3& operator-=(float a_scalar) noexcept; + constexpr NiPoint3& operator*=(float a_scalar) noexcept; + constexpr NiPoint3& operator/=(float a_scalar) noexcept; + + constexpr NiPoint3 Cross(const NiPoint3& a_point) const noexcept; + constexpr float Dot(const NiPoint3& a_point) const noexcept; + constexpr float GetSquaredDistance(const NiPoint3& a_point) const noexcept; + constexpr float SqrLength() const noexcept; + + float GetDistance(const NiPoint3& a_point) const noexcept; + float GetZAngleFromVector() const; + float Length() const noexcept; + NiPoint3 UnitCross(const NiPoint3& a_point) const noexcept; + float Unitize() noexcept; // members float x{ 0.0F }; // 00 @@ -94,6 +102,10 @@ namespace RE { public: static const NiPoint3A ZERO; + static const NiPoint3A UNIT; + static const NiPoint3A UNIT_X; + static const NiPoint3A UNIT_Y; + static const NiPoint3A UNIT_Z; using NiPoint3::NiPoint3; }; @@ -111,32 +123,32 @@ namespace RE static const NiPoint4 IDENTITY2; static const NiPoint4 IDENTITY3; - NiPoint4() noexcept = default; - NiPoint4(const NiPoint2& a_point) noexcept; - NiPoint4(const NiPoint3& a_point) noexcept; - NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept; - - float& operator[](std::size_t a_pos) noexcept; - const float& operator[](std::size_t a_pos) const noexcept; - bool operator==(const NiPoint4& a_rhs) const noexcept; - bool operator!=(const NiPoint4& a_rhs) const noexcept; - bool operator<(const NiPoint4& a_rhs) const noexcept; - bool operator>(const NiPoint4& a_rhs) const noexcept; - NiPoint4 operator+(const NiPoint4& a_rhs) const noexcept; - NiPoint4 operator-(const NiPoint4& a_rhs) const noexcept; - NiPoint4 operator*(const NiPoint4& a_rhs) const noexcept; - NiPoint4 operator/(const NiPoint4& a_rhs) const noexcept; - NiPoint4 operator*(float a_scalar) const noexcept; - NiPoint4 operator/(float a_scalar) const noexcept; - NiPoint4 operator-() const noexcept; - NiPoint4& operator+=(const NiPoint4& a_rhs) noexcept; - NiPoint4& operator-=(const NiPoint4& a_rhs) noexcept; - NiPoint4& operator*=(const NiPoint4& a_rhs) noexcept; - NiPoint4& operator/=(const NiPoint4& a_rhs) noexcept; - NiPoint4& operator+=(float a_scalar) noexcept; - NiPoint4& operator-=(float a_scalar) noexcept; - NiPoint4& operator*=(float a_scalar) noexcept; - NiPoint4& operator/=(float a_scalar) noexcept; + constexpr NiPoint4() noexcept = default; + constexpr NiPoint4(const NiPoint2& a_point) noexcept; + constexpr NiPoint4(const NiPoint3& a_point) noexcept; + constexpr NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept; + + constexpr float& operator[](std::size_t a_pos) noexcept; + constexpr const float& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const NiPoint4& a_rhs) const noexcept; + constexpr bool operator!=(const NiPoint4& a_rhs) const noexcept; + constexpr bool operator<(const NiPoint4& a_rhs) const noexcept; + constexpr bool operator>(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator+(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator-(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator*(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator/(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator*(float a_scalar) const noexcept; + constexpr NiPoint4 operator/(float a_scalar) const noexcept; + constexpr NiPoint4 operator-() const noexcept; + constexpr NiPoint4& operator+=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator-=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator*=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator/=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator+=(float a_scalar) noexcept; + constexpr NiPoint4& operator-=(float a_scalar) noexcept; + constexpr NiPoint4& operator*=(float a_scalar) noexcept; + constexpr NiPoint4& operator/=(float a_scalar) noexcept; // members float x{ 0.0F }; // 00 diff --git a/include/RE/N/NiRTTI.h b/include/RE/N/NiRTTI.h index 48b7f4c1..7d4593eb 100644 --- a/include/RE/N/NiRTTI.h +++ b/include/RE/N/NiRTTI.h @@ -5,6 +5,10 @@ namespace RE class NiRTTI { public: + NiRTTI(const char* a_name, const NiRTTI* a_baseRTTI) : + name(a_name), baseRTTI(a_baseRTTI) + {} + [[nodiscard]] constexpr const char* GetName() const noexcept { return name; } [[nodiscard]] constexpr const NiRTTI* GetBaseRTTI() const noexcept { return baseRTTI; } @@ -19,8 +23,8 @@ namespace RE } // members - const char* name; // 00 - NiRTTI* baseRTTI; // 08 + const char* name; // 00 + const NiRTTI* baseRTTI; // 08 }; static_assert(sizeof(NiRTTI) == 0x10); diff --git a/include/RE/N/NiStringExtraData.h b/include/RE/N/NiStringExtraData.h index 87ffc27a..3c128fac 100644 --- a/include/RE/N/NiStringExtraData.h +++ b/include/RE/N/NiStringExtraData.h @@ -4,7 +4,7 @@ namespace RE { - class NiStringExtraData : + class __declspec(novtable) NiStringExtraData : public NiExtraData { public: @@ -12,8 +12,38 @@ namespace RE static constexpr auto VTABLE{ VTABLE::NiStringExtraData }; static constexpr auto Ni_RTTI{ Ni_RTTI::NiStringExtraData }; + NiStringExtraData() : + NiExtraData() + { + REX::EMPLACE_VTABLE(this); + } + + NiStringExtraData(const BSFixedString& a_value) : + NiExtraData(), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + NiStringExtraData(const BSFixedString& a_name, const BSFixedString& a_value) : + NiExtraData(a_name), value(a_value) + { + REX::EMPLACE_VTABLE(this); + } + + public: + const BSFixedString& GetValue() const + { + return value; + } + + void SetValue(const BSFixedString& a_value) + { + value = a_value; + } + + protected: // members - BSFixedString data; // 18 + BSFixedString value; // 0x18 }; static_assert(sizeof(NiStringExtraData) == 0x20); } diff --git a/include/RE/N/NiTransform.h b/include/RE/N/NiTransform.h index f4cfa419..cc5c0d3b 100644 --- a/include/RE/N/NiTransform.h +++ b/include/RE/N/NiTransform.h @@ -11,17 +11,17 @@ namespace RE static const NiTransform ZERO; static const NiTransform IDENTITY; - NiTransform() noexcept = default; - NiTransform(const NiMatrix3& a_rotate, const NiPoint3& a_translate, const float a_scale) noexcept; + constexpr NiTransform() noexcept = default; + constexpr NiTransform(const NiMatrix3& a_rotation, const NiPoint3& a_translation, const float a_scale = 1.0F) noexcept; - bool operator==(const NiTransform& a_rhs) const noexcept; - bool operator!=(const NiTransform& a_rhs) const noexcept; - NiTransform operator*(const NiTransform& a_rhs) const noexcept; - NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; + constexpr bool operator==(const NiTransform& a_rhs) const noexcept; + constexpr bool operator!=(const NiTransform& a_rhs) const noexcept; + constexpr NiTransform operator*(const NiTransform& a_rhs) const noexcept; + constexpr NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; - NiTransform Invert() const noexcept; - NiTransform& MakeIdentity() noexcept; - NiTransform& MakeInvert() noexcept; + constexpr NiTransform Invert() const noexcept; + constexpr NiTransform& MakeIdentity() noexcept; + constexpr NiTransform& MakeInvert() noexcept; // members NiMatrix3 rotate; // 00 diff --git a/include/RE/P/PlayerCamera.h b/include/RE/P/PlayerCamera.h index b4897106..1fab69d0 100644 --- a/include/RE/P/PlayerCamera.h +++ b/include/RE/P/PlayerCamera.h @@ -38,6 +38,18 @@ namespace RE return *singleton; } + [[nodiscard]] BSTSmartPointer GetCameraCurrentState() const + { + return currentState; + } + + bool GetCameraPosition(NiPoint3& a_position, bool a_addPlayerPos) const + { + using func_t = decltype(&PlayerCamera::GetCameraPosition); + static REL::Relocation func{ ID::PlayerCamera::GetCameraPosition }; + return func(this, a_position, a_addPlayerPos); + } + [[nodiscard]] BSTSmartPointer GetState(CameraState a_state) const { return cameraStates[a_state]; @@ -71,7 +83,7 @@ namespace RE return func(this, a_freezeTime); } - void SetState(TESCameraState* a_newstate) const + void SetState(TESCameraState* a_newstate) { using func_t = decltype(&PlayerCamera::SetState); static REL::Relocation func{ ID::PlayerCamera::SetState }; @@ -99,7 +111,7 @@ namespace RE return func(this); } - bool QCameraEquals(CameraState a_state) + bool QCameraEquals(CameraState a_state) const { using func_t = decltype(&PlayerCamera::QCameraEquals); static REL::Relocation func{ ID::PlayerCamera::QCameraEquals }; diff --git a/include/RE/T/TES.h b/include/RE/T/TES.h index 936c17e4..9993fa99 100644 --- a/include/RE/T/TES.h +++ b/include/RE/T/TES.h @@ -1,5 +1,6 @@ #pragma once +#include "RE/B/BSContainer.h" #include "RE/B/BSSimpleList.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTEvent.h" @@ -17,10 +18,15 @@ namespace RE class NiDirectionalLight; class NiFogProperty; class NiNode; + class NiPoint3; class NiTexture; class PositionPlayerEvent; class QueuedFile; class Sky; + class TESObjectCELL; + class TESObjectREFR; + class TESRegion; + class TESWorldSpace; namespace BSResource::Archive2 { @@ -97,6 +103,10 @@ namespace RE return *singleton; } + void ForEachReference(std::function a_callback); + void ForEachReferenceInRange(const NiPoint3& a_origin, const float a_radius, std::function a_callback); + void ForEachReferenceInRange(const TESObjectREFR* a_ref, const float a_radius, std::function a_callback); + // members GridDistantArray* gridDistant; // 010 GridCellArray* gridCells; // 018 @@ -143,7 +153,7 @@ namespace RE NiPointer bloodDecalPreload1; // 100 NiPointer preloadedForms; // 108 NiPointer preloadedDefaultModels; // 110 - TES::ParticleObjectCache* particleCacheHead; // 118 + ParticleObjectCache* particleCacheHead; // 118 std::uint32_t placeableWaterCount; // 120 NavMeshInfoMap* navMeshInfoMap; // 128 NiPointer loadedAreaBound; // 130 diff --git a/include/RE/T/TESObjectCELL.h b/include/RE/T/TESObjectCELL.h index 1e5e8665..d814f8a8 100644 --- a/include/RE/T/TESObjectCELL.h +++ b/include/RE/T/TESObjectCELL.h @@ -1,5 +1,6 @@ #pragma once +#include "RE/B/BSContainer.h" #include "RE/B/BSSpinLock.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTHashMap.h" @@ -18,6 +19,7 @@ namespace RE class LOADED_CELL_DATA; class NavMeshArray; class NiAVObject; + class NiPoint3; class TESRegionList; namespace BGSWaterCollisionManager @@ -27,15 +29,15 @@ namespace RE } class __declspec(novtable) TESObjectCELL : - public TESForm, // 00 - public TESFullName // 20 + public TESForm, // 0x00 + public TESFullName // 0x20 { public: static constexpr auto RTTI{ RTTI::TESObjectCELL }; static constexpr auto VTABLE{ VTABLE::TESObjectCELL }; static constexpr auto FORM_ID{ ENUM_FORM_ID::kCELL }; - enum class CELL_STATE + enum class CELL_STATE : std::uint8_t { kNotLoaded = 0x0, kUnloading = 0x1, @@ -100,6 +102,12 @@ namespace RE kSoundMarker = 0x1 }; + union CELL_DATA + { + EXTERIOR_DATA* exterior; // XCLC + INTERIOR_DATA* interior; // XCLL + }; + class RENDER_DATA { public: @@ -211,44 +219,44 @@ namespace RE return func(this); } + EXTERIOR_DATA* GetCoordinates() const; [[nodiscard]] TESWaterForm* GetWaterType() const noexcept; [[nodiscard]] bool HasWater() const noexcept { return cellFlags.all(Flag::kHasWater); } + [[nodiscard]] bool IsAttached() const noexcept { return cellState == CELL_STATE::kAttached; } [[nodiscard]] bool IsExterior() const noexcept { return !IsInterior(); } [[nodiscard]] bool IsInterior() const noexcept { return cellFlags.all(Flag::kInterior); } + void ForEachReference(std::function a_callback); + void ForEachReferenceInRange(const NiPoint3& a_origin, float a_radius, std::function a_callback); + // members - BSSpinLock grassCreateLock; // 30 - BSSpinLock grassTaskLock; // 38 - REX::TEnumSet cellFlags; // 40 - std::uint16_t cellGameFlags; // 42 - REX::TEnumSet cellState; // 44 - bool autoWaterLoaded; // 45 - bool cellDetached; // 46 - BSTSmartPointer extraList; // 48 - union - { - void* cellData; - EXTERIOR_DATA* cellDataExterior; - INTERIOR_DATA* cellDataInterior; - }; // 50 - TESObjectLAND* cellLand; // 58 - float waterHeight; // 60 - NavMeshArray* navMeshes; // 68 - BSTArray> references; // 70 - BSTSmartPointer autoWater; // 77 - BSTSet> waterSet; // 80 - BSSpinLock spinLock; // C0 + BSSpinLock grassCreateLock; // 0x30 + BSSpinLock grassTaskLock; // 0x38 + REX::TEnumSet cellFlags; // 0x40 + std::uint16_t cellGameFlags; // 0x42 + CELL_STATE cellState; // 0x44 + bool autoWaterLoaded; // 0x45 + bool cellDetached; // 0x46 + BSTSmartPointer extraList; // 0x48 + CELL_DATA cellData; // 0x50 + TESObjectLAND* cellLand; // 0x58 + float waterHeight; // 0x60 + NavMeshArray* navMeshes; // 0x68 + BSTArray> references; // 0x70 + BSTSmartPointer autoWater; // 0x77 + BSTSet> waterSet; // 0x80 + BSSpinLock spinLock; // 0xC0 union { TESWorldSpace* worldSpace; std::uint32_t tempDataOffset; - }; // C8 - LOADED_CELL_DATA* loadedData; // D0 - BGSLightingTemplate* lightingTemplate; // D8 - void* visibilityData; // E0 - TODO - std::uint32_t rootVisibilityCellID; // E8 - std::uint16_t visCalcDate; // EC - std::uint16_t preCombineDate; // F0 + }; // 0xC8 + LOADED_CELL_DATA* loadedData; // 0xD0 + BGSLightingTemplate* lightingTemplate; // 0xD8 + void* visibilityData; // 0xE0 - TODO + std::uint32_t rootVisibilityCellID; // 0xE8 + std::uint16_t visCalcDate; // 0xEC + std::uint16_t preCombineDate; // 0xF0 }; static_assert(sizeof(TESObjectCELL) == 0xF0); } diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index f0b8d587..d1cac33d 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -87,20 +87,20 @@ namespace RE class RemoveItemData { public: - RemoveItemData(TESForm* a_form, std::int32_t a_count) : - RemoveItemData(a_form->As(), a_count) - {} - RemoveItemData(TESBoundObject* a_object, std::int32_t a_count) : object(a_object), count(a_count) {} + RemoveItemData(TESForm* a_form, std::int32_t a_count) : + RemoveItemData(a_form->As(), a_count) + {} + // members BSTSmallArray stackData; // 00 TESBoundObject* object{ nullptr }; // 20 std::int32_t count{ 0 }; // 28 ITEM_REMOVE_REASON reason{ ITEM_REMOVE_REASON::kNone }; // 2C - TESObjectREFR* a_otherContainer{ nullptr }; // 30 + TESObjectREFR* otherContainer{ nullptr }; // 30 const NiPoint3* dropLoc{ nullptr }; // 38 const NiPoint3* rotate{ nullptr }; // 40 }; @@ -330,7 +330,35 @@ namespace RE return func(this); } - bool GetEditorDead() const + [[nodiscard]] float GetDistanceFromPoint(const NiPoint3& a_point) const + { + using func_t = decltype(&TESObjectREFR::GetDistanceFromPoint); + static REL::Relocation func{ ID::TESObjectREFR::GetDistanceFromPoint }; + return func(this, a_point); + } + + [[nodiscard]] float GetDistanceFromReference(const TESObjectREFR* a_ref, bool a_disabled, bool a_sameSpace) const + { + using func_t = decltype(&TESObjectREFR::GetDistanceFromReference); + static REL::Relocation func{ ID::TESObjectREFR::GetDistanceFromReference }; + return func(this, a_ref, a_disabled, a_sameSpace); + } + + [[nodiscard]] float GetDistanceSqFromPoint(const NiPoint3& a_point) const + { + using func_t = decltype(&TESObjectREFR::GetDistanceSqFromPoint); + static REL::Relocation func{ ID::TESObjectREFR::GetDistanceSqFromPoint }; + return func(this, a_point); + } + + [[nodiscard]] float GetDistanceSqFromReference(const TESObjectREFR* a_ref, bool a_disabled, bool a_sameSpace, bool a_diffZHeight) const + { + using func_t = decltype(&TESObjectREFR::GetDistanceSqFromReference); + static REL::Relocation func{ ID::TESObjectREFR::GetDistanceSqFromReference }; + return func(this, a_ref, a_disabled, a_sameSpace, a_diffZHeight); + } + + [[nodiscard]] bool GetEditorDead() const { using func_t = decltype(&TESObjectREFR::GetEditorDead); static REL::Relocation func{ ID::TESObjectREFR::GetEditorDead }; @@ -565,14 +593,14 @@ namespace RE } // members - TESObjectCELL* parentCell; // 0B8 - OBJ_REFR data; // 0C0 - LOADED_REF_DATA* loadedData; // 0F0 - BGSInventoryList* inventoryList; // 0F8 - BSTSmartPointer extraList; // 100 - std::uint16_t refScale; // 018 - std::int8_t modelState; // 10A - bool predestroyed; // 10B + TESObjectCELL* parentCell; // 0x0B8 + OBJ_REFR data; // 0x0C0 + LOADED_REF_DATA* loadedData; // 0x0F0 + BGSInventoryList* inventoryList; // 0x0F8 + BSTSmartPointer extraList; // 0x100 + std::uint16_t refScale; // 0x018 + std::int8_t modelState; // 0x10A + bool predestroyed; // 0x10B }; static_assert(sizeof(TESObjectREFR) == 0x110); } diff --git a/include/RE/T/TESWorldSpace.h b/include/RE/T/TESWorldSpace.h index 51e35117..60b46f21 100644 --- a/include/RE/T/TESWorldSpace.h +++ b/include/RE/T/TESWorldSpace.h @@ -23,9 +23,9 @@ namespace RE class NiNode; class __declspec(novtable) TESWorldSpace : - public TESForm, // 000 - public TESFullName, // 020 - public TESTexture // 030 + public TESForm, // 0x000 + public TESFullName, // 0x020 + public TESTexture // 0x030 { public: static constexpr auto RTTI{ RTTI::TESWorldSpace }; @@ -47,8 +47,8 @@ namespace RE { public: // members - std::int16_t x; // 0 - std::int16_t y; // 2 + std::int16_t x; // 0x0 + std::int16_t y; // 0x2 }; static_assert(sizeof(ShortPoint) == 0x4); @@ -56,11 +56,11 @@ namespace RE { public: // members - std::uint32_t* cellFileOffsets; // 00 - std::uint32_t* cellFileSizes; // 08 - NiPoint2 offsetMinCoords; // 10 - NiPoint2 offsetMaxCoords; // 18 - std::uint32_t fileOffset; // 20 + std::uint32_t* cellFileOffsets; // 0x00 + std::uint32_t* cellFileSizes; // 0x08 + NiPoint2 offsetMinCoords; // 0x10 + NiPoint2 offsetMaxCoords; // 0x18 + std::uint32_t fileOffset; // 0x20 }; static_assert(sizeof(OFFSET_DATA) == 0x28); @@ -69,6 +69,13 @@ namespace RE return parentUseFlags.all(a_flags) ? parentWorld : nullptr; } + [[nodiscard]] TESObjectCELL* GetSkyCell() const + { + using func_t = decltype(&TESWorldSpace::GetSkyCell); + static REL::Relocation func{ ID::TESWorldSpace::GetSkyCell }; + return func(this); + } + [[nodiscard]] TESWaterForm* GetWaterType() const noexcept { auto root = this; @@ -84,60 +91,53 @@ namespace RE } } - [[nodiscard]] TESObjectCELL* GetSkyCell() - { - using func_t = decltype(&TESWorldSpace::GetSkyCell); - static REL::Relocation func{ ID::TESWorldSpace::GetSkyCell }; - return func(this); - } - // members - BSTHashMap cellMap; // 040 - TESObjectCELL* persistentCell; // 070 - BGSTerrainManager* terrainManager; // 078 - TESClimate* climate; // 080 - std::int8_t flags; // 088 - REX::TEnumSet parentUseFlags; // 08A - std::int8_t worldFlags; // 08C - ShortPoint fixedCenter; // 08E - BSTHashMap>*> fixedPersistentRefMap; // 098 - BSTArray> mobilePersistentRefs; // 0C8 - BSTHashMap*> overlappedMultiboundMap; // 0E0 - TESObjectCELL* skyCell; // 110 - BSTHashMap locationMap; // 118 - BSTArray teleportDoorCache; // 148 - NiPointer portalGraph; // 160 - BSTHashMap>* multiboundRefMap; // 168 - BSTHashMap* refMultiboundMap; // 170 - NiPointer multiboundNode; // 178 - NiPointer portalSharedNode; // 180 - TESWorldSpace* parentWorld; // 188 - BGSLightingTemplate* lightingTemplate; // 190 - TESWaterForm* worldWater; // 198 - TESWaterForm* lodWater; // 1A0 - float lodWaterHeight; // 1A8 - WORLD_MAP_DATA worldMapData; // 1AC - WORLD_MAP_OFFSET_DATA worldMapOffsetData; // 1BC - BGSMusicType* musicType; // 1D0 - NiPoint2 minimumCoords; // 1D8 - NiPoint2 maximumCoords; // 1E0 - NiTMap offsetDataMap; // 1E8 - BSString editorID; // 208 - float defaultLandHeight; // 218 - float defaultWaterHeight; // 21C - float distantLODMult; // 220 - BGSEncounterZone* encounterZone; // 228 - BGSLocation* location; // 230 - TESTexture canopyShadowTexture; // 238 - TESTexture waterEnvMap; // 248 - BGSLargeRefData largeRefData; // 258 - float northRotation; // 2B8 - std::int8_t lvlDataCellStartX; // 2BC - std::int8_t lvlDataCellStartY; // 2BD - std::int8_t lvlDataCellWidthX; // 2BE - std::int8_t lvlDataCellWidthY; // 2BF - std::int8_t* lvlDataCellA; // 2C0 - std::int8_t* maxHeightData; // 2C8 + BSTHashMap cellMap; // 0x040 + TESObjectCELL* persistentCell; // 0x070 + BGSTerrainManager* terrainManager; // 0x078 + TESClimate* climate; // 0x080 + std::int8_t flags; // 0x088 + REX::TEnumSet parentUseFlags; // 0x08A + std::int8_t worldFlags; // 0x08C + ShortPoint fixedCenter; // 0x08E + BSTHashMap>*> fixedPersistentRefMap; // 0x098 + BSTArray> mobilePersistentRefs; // 0x0C8 + BSTHashMap*> overlappedMultiboundMap; // 0x0E0 + TESObjectCELL* skyCell; // 0x110 + BSTHashMap locationMap; // 0x118 + BSTArray teleportDoorCache; // 0x148 + NiPointer portalGraph; // 0x160 + BSTHashMap>* multiboundRefMap; // 0x168 + BSTHashMap* refMultiboundMap; // 0x170 + NiPointer multiboundNode; // 0x178 + NiPointer portalSharedNode; // 0x180 + TESWorldSpace* parentWorld; // 0x188 + BGSLightingTemplate* lightingTemplate; // 0x190 + TESWaterForm* worldWater; // 0x198 + TESWaterForm* lodWater; // 0x1A0 + float lodWaterHeight; // 0x1A8 + WORLD_MAP_DATA worldMapData; // 0x1AC + WORLD_MAP_OFFSET_DATA worldMapOffsetData; // 0x1BC + BGSMusicType* musicType; // 0x1D0 + NiPoint2 minimumCoords; // 0x1D8 + NiPoint2 maximumCoords; // 0x1E0 + NiTMap offsetDataMap; // 0x1E8 + BSString editorID; // 0x208 + float defaultLandHeight; // 0x218 + float defaultWaterHeight; // 0x21C + float distantLODMult; // 0x220 + BGSEncounterZone* encounterZone; // 0x228 + BGSLocation* location; // 0x230 + TESTexture canopyShadowTexture; // 0x238 + TESTexture waterEnvMap; // 0x248 + BGSLargeRefData largeRefData; // 0x258 + float northRotation; // 0x2B8 + std::int8_t lvlDataCellStartX; // 0x2BC + std::int8_t lvlDataCellStartY; // 0x2BD + std::int8_t lvlDataCellWidthX; // 0x2BE + std::int8_t lvlDataCellWidthY; // 0x2BF + std::int8_t* lvlDataCellA; // 0x2C0 + std::int8_t* maxHeightData; // 0x2C8 }; static_assert(sizeof(TESWorldSpace) == 0x2D0); } diff --git a/include/RE/T/TrapData.h b/include/RE/T/TrapData.h index f2345053..1c42084a 100644 --- a/include/RE/T/TrapData.h +++ b/include/RE/T/TrapData.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSPointerHandle.h" -#include "RE/H/hkVector4f.h" +#include "RE/H/hkVector4.h" namespace RE { diff --git a/src/RE/B/BSVisit.cpp b/src/RE/B/BSVisit.cpp index aafdb10c..f1d82cbd 100644 --- a/src/RE/B/BSVisit.cpp +++ b/src/RE/B/BSVisit.cpp @@ -3,58 +3,64 @@ #include "RE/N/NiAVObject.h" #include "RE/N/NiNode.h" -namespace RE +namespace RE::BSVisit { - namespace BSVisit + BSVisitControl TraverseScenegraphGeometries(NiAVObject* a_object, std::function a_func) { - BSVisitControl TraverseScenegraphGeometries(NiAVObject* a_object, std::function a_func) - { - if (!a_object) { - return BSVisitControl::kContinue; - } - - auto geom = a_object->IsGeometry(); - if (geom) { + if (a_object) { + if (auto geom = a_object->IsGeometry()) return a_func(geom); - } - auto result = BSVisitControl::kContinue; - auto node = a_object->IsNode(); - if (node) { - for (auto& child : node->children) { - result = TraverseScenegraphGeometries(child.get(), a_func); - if (result == BSVisitControl::kStop) { - break; + if (const auto node = a_object->IsNode()) { + for (const auto& child : node->children) { + if (TraverseScenegraphGeometries(child.get(), a_func) == BSVisitControl::kStop) { + return BSVisitControl::kStop; } } } - - return result; } - BSVisitControl TraverseScenegraphObjects(NiAVObject* a_object, std::function a_func) - { - if (!a_object) { - return BSVisitControl::kContinue; - } + return BSVisitControl::kContinue; + } + + BSVisitControl TraverseScenegraphObjects(NiAVObject* a_object, std::function a_func) + { + if (a_object) { + if (a_func(a_object) == BSVisitControl::kStop) + return BSVisitControl::kStop; - auto result = a_func(a_object); - if (result == BSVisitControl::kStop) { - return result; + if (const auto node = a_object->IsNode()) { + for (const auto& child : node->children) { + if (TraverseScenegraphObjects(child.get(), a_func) == BSVisitControl::kStop) { + return BSVisitControl::kStop; + } + } } + } - result = BSVisitControl::kContinue; - auto node = a_object->IsNode(); - if (node) { - for (auto& child : node->children) { - result = TraverseScenegraphObjects(child.get(), a_func); - if (result == BSVisitControl::kStop) { - break; + return BSVisitControl::kContinue; + } + + BSVisitControl TraverseScenegraphCollision(const NiAVObject* a_object, std::function a_func) + { + if (a_object) { + if (const auto collision = a_object->GetCollisionObject()) { + if (const auto collisionNP = collision->IsbhkNPCollisionObject()) { + if (a_func(collisionNP) == BSVisitControl::kStop) { + return BSVisitControl::kStop; } } } - return result; + if (const auto node = a_object->IsNode()) { + for (const auto& child : node->children) { + if (TraverseScenegraphCollision(child.get(), a_func) == BSVisitControl::kStop) { + return BSVisitControl::kStop; + } + } + } } + + return BSVisitControl::kContinue; } } diff --git a/src/RE/H/hkMatrix3.cpp b/src/RE/H/hkMatrix3.cpp new file mode 100644 index 00000000..e8b3a7ee --- /dev/null +++ b/src/RE/H/hkMatrix3.cpp @@ -0,0 +1,73 @@ +#include "RE/H/hkMatrix3.h" + +namespace RE +{ + constexpr hkMatrix3f::hkMatrix3f(const hkVector4f& a_vec0, const hkVector4f& a_vec1, const hkVector4f& a_vec2) noexcept + { + col[0] = a_vec0; + col[1] = a_vec1; + col[2] = a_vec2; + } + + constexpr hkMatrix3f::hkMatrix3f( + float a_x0, float a_y0, float a_z0, float a_w0, + float a_x1, float a_y1, float a_z1, float a_w1, + float a_x2, float a_y2, float a_z2, float a_w2) noexcept + { + col[0] = { a_x0, a_y0, a_z0, a_w0 }; + col[1] = { a_x1, a_y1, a_z1, a_w1 }; + col[2] = { a_x2, a_y2, a_z2, a_w2 }; + } + + constexpr hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 3); + return col[a_pos]; + } + + constexpr const hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 3); + return col[a_pos]; + } + + constexpr bool hkMatrix3f::operator==(const hkMatrix3f& a_rhs) const noexcept + { + return (col[0] == a_rhs[0]) && (col[1] == a_rhs[1]) && (col[2] == a_rhs[2]); + } + + constexpr bool hkMatrix3f::operator!=(const hkMatrix3f& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr hkMatrix3f hkMatrix3f::operator*(const hkMatrix3f& a_rhs) const noexcept + { + hkMatrix3f result; + result[0][0] = col[0][0] * a_rhs[0][0] + col[0][1] * a_rhs[1][0] + col[0][2] * a_rhs[2][0]; + result[1][0] = col[1][0] * a_rhs[0][0] + col[1][1] * a_rhs[1][0] + col[1][2] * a_rhs[2][0]; + result[2][0] = col[2][0] * a_rhs[0][0] + col[2][1] * a_rhs[1][0] + col[2][2] * a_rhs[2][0]; + result[0][1] = col[0][0] * a_rhs[0][1] + col[0][1] * a_rhs[1][1] + col[0][2] * a_rhs[2][1]; + result[1][1] = col[1][0] * a_rhs[0][1] + col[1][1] * a_rhs[1][1] + col[1][2] * a_rhs[2][1]; + result[2][1] = col[2][0] * a_rhs[0][1] + col[2][1] * a_rhs[1][1] + col[2][2] * a_rhs[2][1]; + result[0][2] = col[0][0] * a_rhs[0][2] + col[0][1] * a_rhs[1][2] + col[0][2] * a_rhs[2][2]; + result[1][2] = col[1][0] * a_rhs[0][2] + col[1][1] * a_rhs[1][2] + col[1][2] * a_rhs[2][2]; + result[2][2] = col[2][0] * a_rhs[0][2] + col[2][1] * a_rhs[1][2] + col[2][2] * a_rhs[2][2]; + return result; + } + + constexpr hkMatrix3f hkMatrix3f::operator*(float a_scalar) const noexcept + { + hkMatrix3f result; + result[0][0] = col[0][0] * a_scalar; + result[0][1] = col[0][1] * a_scalar; + result[0][2] = col[0][2] * a_scalar; + result[1][0] = col[1][0] * a_scalar; + result[1][1] = col[1][1] * a_scalar; + result[1][2] = col[1][2] * a_scalar; + result[2][0] = col[2][0] * a_scalar; + result[2][1] = col[2][1] * a_scalar; + result[2][2] = col[2][2] * a_scalar; + return result; + } +} diff --git a/src/RE/H/hkTransform.cpp b/src/RE/H/hkTransform.cpp new file mode 100644 index 00000000..97b2455a --- /dev/null +++ b/src/RE/H/hkTransform.cpp @@ -0,0 +1,8 @@ +#include "RE/H/hkTransform.h" + +namespace RE +{ + constexpr hkTransformf::hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept : + rotation(a_rotation), translation(a_translation) + {} +} diff --git a/src/RE/H/hkVector4.cpp b/src/RE/H/hkVector4.cpp new file mode 100644 index 00000000..da845a2a --- /dev/null +++ b/src/RE/H/hkVector4.cpp @@ -0,0 +1,181 @@ +#include "RE/H/hkVector4.h" + +namespace RE +{ + inline constexpr hkVector4f hkVector4f::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; + + constexpr hkVector4f::hkVector4f(float a_x, float a_y, float a_z, float a_w) noexcept : + x(a_x), y(a_y), z(a_z), w(a_w) + {} + + constexpr float& hkVector4f::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 4); + return std::addressof(x)[a_pos]; + } + + constexpr const float& hkVector4f::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 4); + return std::addressof(x)[a_pos]; + } + + constexpr bool hkVector4f::operator==(const hkVector4f& a_rhs) const noexcept + { + return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z) && (w == a_rhs.w); + } + + constexpr bool hkVector4f::operator!=(const hkVector4f& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr bool hkVector4f::operator<(const hkVector4f& a_rhs) const noexcept + { + return std::tie(x, y, z, w) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); + } + + constexpr bool hkVector4f::operator>(const hkVector4f& a_rhs) const noexcept + { + return std::tie(x, y, z, w) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator+(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z, w + a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator-(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z, w - a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator*(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z, w * a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator/(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z, w / a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator*(float a_scalar) const noexcept + { + return hkVector4f(x * a_scalar, y * a_scalar, z * a_scalar, w * a_scalar); + } + + constexpr hkVector4f hkVector4f::operator/(float a_scalar) const noexcept + { + return operator*(1.0F / a_scalar); + } + + constexpr hkVector4f hkVector4f::operator-() const noexcept + { + return hkVector4f(-x, -y, -z, -w); + } + + constexpr hkVector4f& hkVector4f::operator+=(const hkVector4f& a_rhs) noexcept + { + x += a_rhs.x; + y += a_rhs.y; + z += a_rhs.z; + w += a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator-=(const hkVector4f& a_rhs) noexcept + { + x -= a_rhs.x; + y -= a_rhs.y; + z -= a_rhs.z; + w -= a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator*=(const hkVector4f& a_rhs) noexcept + { + x *= a_rhs.x; + y *= a_rhs.y; + z *= a_rhs.z; + w *= a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator/=(const hkVector4f& a_rhs) noexcept + { + x /= a_rhs.x; + y /= a_rhs.y; + z /= a_rhs.z; + w /= a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator+=(float a_scalar) noexcept + { + x += a_scalar; + y += a_scalar; + z += a_scalar; + w += a_scalar; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator-=(float a_scalar) noexcept + { + x -= a_scalar; + y -= a_scalar; + z -= a_scalar; + w -= a_scalar; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator*=(float a_scalar) noexcept + { + x *= a_scalar; + y *= a_scalar; + z *= a_scalar; + w *= a_scalar; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator/=(float a_scalar) noexcept + { + x /= a_scalar; + y /= a_scalar; + z /= a_scalar; + w /= a_scalar; + return *this; + } + + constexpr float hkVector4f::Dot(const hkVector4f& v) const + { + return this->x * v.x + this->y * v.y + this->z * v.z; + } + + inline hkVector4f hkVector4f::GetNormalized() const + { + hkVector4f norm = *this; + norm.Normalize(); + return norm; + } + + inline float hkVector4f::Length() const + { + return std::sqrt(x * x + y * y + z * z); + } + + inline hkVector4f& hkVector4f::Normalize() + { + float l = Length(); + if (l == 0) { + this->x = 0; + this->y = 0; + this->z = 0; + return *this; + } + this->x /= l; + this->y /= l; + this->z /= l; + return *this; + } +} diff --git a/src/RE/N/NiAVObject.cpp b/src/RE/N/NiAVObject.cpp index 736fcdda..95f5454c 100644 --- a/src/RE/N/NiAVObject.cpp +++ b/src/RE/N/NiAVObject.cpp @@ -20,17 +20,17 @@ namespace RE void NiAVObject::CullGeometry(bool a_cull) { - BSVisit::TraverseScenegraphGeometries(this, [&](BSGeometry* a_geo) -> BSVisit::BSVisitControl { + BSVisit::TraverseScenegraphGeometries(this, [&](BSGeometry* a_geo) -> BSVisitControl { a_geo->SetAppCulled(a_cull); - return BSVisit::BSVisitControl::kContinue; + return BSVisitControl::kContinue; }); } void NiAVObject::CullNode(bool a_cull) { - BSVisit::TraverseScenegraphObjects(this, [&](NiAVObject* a_object) -> BSVisit::BSVisitControl { + BSVisit::TraverseScenegraphObjects(this, [&](NiAVObject* a_object) -> BSVisitControl { a_object->SetAppCulled(a_cull); - return BSVisit::BSVisitControl::kContinue; + return BSVisitControl::kContinue; }); } diff --git a/src/RE/N/NiExtraData.cpp b/src/RE/N/NiExtraData.cpp new file mode 100644 index 00000000..fa48fba9 --- /dev/null +++ b/src/RE/N/NiExtraData.cpp @@ -0,0 +1,27 @@ +#include "RE/N/NiExtraData.h" + +namespace RE +{ + NiExtraData::NiExtraData() + { + REX::EMPLACE_VTABLE(this); + } + + NiExtraData::NiExtraData(const BSFixedString& a_name) : + name(a_name) + { + REX::EMPLACE_VTABLE(this); + } + + NiExtraData::~NiExtraData() = default; + + const BSFixedString& NiExtraData::GetName() const + { + return name; + } + + void NiExtraData::SetName(const BSFixedString& a_name) + { + name = a_name; + } +} diff --git a/src/RE/N/NiExtraDataContainer.cpp b/src/RE/N/NiExtraDataContainer.cpp new file mode 100644 index 00000000..e3326863 --- /dev/null +++ b/src/RE/N/NiExtraDataContainer.cpp @@ -0,0 +1,58 @@ +#include "RE/N/NiExtraDataContainer.h" + +#include "RE/N/NiExtraData.h" + +namespace RE +{ + NiExtraDataContainer::NiExtraDataContainer(const std::uint32_t a_count) : + extra(a_count) + {} + + void NiExtraDataContainer::Add(NiExtraData* a_extra) + { + const BSAutoWriteLock l(lock); + extra.push_back(a_extra); + } + + NiExtraData* NiExtraDataContainer::FindExtra(const BSFixedString& a_key) const + { + const BSAutoReadLock l(lock); + for (auto& entry : extra) + if (entry->GetName() == a_key) + return entry.get(); + + return nullptr; + } + + std::int32_t NiExtraDataContainer::FindIndex(const BSFixedString& a_key) const + { + const BSAutoReadLock l(lock); + for (auto i = 0u; i < extra.size(); i++) + if (extra[i]->GetName() == a_key) + return i; + + return -1; + } + + std::uint32_t NiExtraDataContainer::GetSize() const + { + const BSAutoReadLock l(lock); + return extra.size(); + } + + bool NiExtraDataContainer::RemoveExtra(const BSFixedString& a_key) + { + const BSAutoWriteLock l(lock); + + const auto it = std::find_if(extra.begin(), extra.end(), [&](auto& entry) { + return entry->GetName() == a_key; + }); + + if (it != extra.end()) { + extra.erase(it); + return true; + } + + return false; + } +} diff --git a/src/RE/N/NiMatrix3.cpp b/src/RE/N/NiMatrix3.cpp index d0d0c785..9e4a9132 100644 --- a/src/RE/N/NiMatrix3.cpp +++ b/src/RE/N/NiMatrix3.cpp @@ -2,17 +2,17 @@ namespace RE { - const NiMatrix3 NiMatrix3::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; - const NiMatrix3 NiMatrix3::IDENTITY = { NiPoint4::IDENTITY0, NiPoint4::IDENTITY0, NiPoint4::IDENTITY0 }; + inline constexpr NiMatrix3 NiMatrix3::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; + inline constexpr NiMatrix3 NiMatrix3::IDENTITY = { NiPoint4::IDENTITY0, NiPoint4::IDENTITY0, NiPoint4::IDENTITY0 }; - NiMatrix3::NiMatrix3(const NiPoint4& a_point0, const NiPoint4& a_point1, const NiPoint4& a_point2) noexcept + constexpr NiMatrix3::NiMatrix3(const NiPoint4& a_point0, const NiPoint4& a_point1, const NiPoint4& a_point2) noexcept { entry[0] = a_point0; entry[1] = a_point1; entry[2] = a_point2; } - NiMatrix3::NiMatrix3( + constexpr NiMatrix3::NiMatrix3( float a_x0, float a_y0, float a_z0, float a_w0, float a_x1, float a_y1, float a_z1, float a_w1, float a_x2, float a_y2, float a_z2, float a_w2) noexcept @@ -22,29 +22,29 @@ namespace RE entry[2] = { a_x2, a_y2, a_z2, a_w2 }; } - NiPoint4& NiMatrix3::operator[](std::size_t a_pos) noexcept + constexpr NiPoint4& NiMatrix3::operator[](std::size_t a_pos) noexcept { assert(a_pos < 3); return entry[a_pos]; } - const NiPoint4& NiMatrix3::operator[](std::size_t a_pos) const noexcept + constexpr const NiPoint4& NiMatrix3::operator[](std::size_t a_pos) const noexcept { assert(a_pos < 3); return entry[a_pos]; } - bool NiMatrix3::operator==(const NiMatrix3& a_rhs) const noexcept + constexpr bool NiMatrix3::operator==(const NiMatrix3& a_rhs) const noexcept { return (entry[0] == a_rhs[0]) && (entry[1] == a_rhs[1]) && (entry[2] == a_rhs[2]); } - bool NiMatrix3::operator!=(const NiMatrix3& a_rhs) const noexcept + constexpr bool NiMatrix3::operator!=(const NiMatrix3& a_rhs) const noexcept { return !operator==(a_rhs); } - NiMatrix3 NiMatrix3::operator*(const NiMatrix3& a_rhs) const noexcept + constexpr NiMatrix3 NiMatrix3::operator*(const NiMatrix3& a_rhs) const noexcept { NiMatrix3 result; result[0][0] = entry[0][0] * a_rhs[0][0] + entry[0][1] * a_rhs[1][0] + entry[0][2] * a_rhs[2][0]; @@ -59,7 +59,7 @@ namespace RE return result; } - NiMatrix3 NiMatrix3::operator*(float a_scalar) const noexcept + constexpr NiMatrix3 NiMatrix3::operator*(float a_scalar) const noexcept { NiMatrix3 result; result[0][0] = entry[0][0] * a_scalar; @@ -74,7 +74,7 @@ namespace RE return result; } - NiPoint3 NiMatrix3::operator*(const NiPoint3& a_rhs) const noexcept + constexpr NiPoint3 NiMatrix3::operator*(const NiPoint3& a_rhs) const noexcept { return NiPoint3( entry[0][0] * a_rhs.x + entry[0][1] * a_rhs.y + entry[0][2] * a_rhs.z, @@ -82,14 +82,14 @@ namespace RE entry[2][0] * a_rhs.x + entry[2][1] * a_rhs.y + entry[2][2] * a_rhs.z); } - void NiMatrix3::MakeIdentity() noexcept + constexpr void NiMatrix3::MakeIdentity() noexcept { entry[0] = NiPoint4::IDENTITY0; entry[1] = NiPoint4::IDENTITY1; entry[2] = NiPoint4::IDENTITY2; } - NiMatrix3 NiMatrix3::Transpose() const noexcept + constexpr NiMatrix3 NiMatrix3::Transpose() const noexcept { NiMatrix3 result; result[0][0] = entry[0][0]; @@ -107,97 +107,97 @@ namespace RE return result; } - bool NiMatrix3::ToEulerAnglesXYZ(NiPoint3& a_point) const + inline bool NiMatrix3::ToEulerAnglesXYZ(NiPoint3& a_point) const { return ToEulerAnglesXYZ(a_point.x, a_point.y, a_point.z); } - bool NiMatrix3::ToEulerAnglesXYZ(float& a_x, float& a_y, float& a_z) const + inline bool NiMatrix3::ToEulerAnglesXYZ(float& a_x, float& a_y, float& a_z) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesXYZ1 }; + static REL::Relocation func{ REL::ID(2269806) }; return func(this, a_x, a_y, a_z); } - bool NiMatrix3::ToEulerAnglesXZY(float& a_x, float& a_z, float& a_y) const + inline bool NiMatrix3::ToEulerAnglesXZY(float& a_x, float& a_z, float& a_y) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesXZY2 }; + static REL::Relocation func{ REL::ID(2269807) }; return func(this, a_x, a_z, a_y); } - bool NiMatrix3::ToEulerAnglesYXZ(float& a_y, float& a_x, float& a_z) const + inline bool NiMatrix3::ToEulerAnglesYXZ(float& a_y, float& a_x, float& a_z) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesYXZ3 }; + static REL::Relocation func{ REL::ID(2269808) }; return func(this, a_y, a_x, a_z); } - bool NiMatrix3::ToEulerAnglesYZX(float& a_y, float& a_z, float& a_x) const + inline bool NiMatrix3::ToEulerAnglesYZX(float& a_y, float& a_z, float& a_x) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesYZX4 }; + static REL::Relocation func{ REL::ID(2269809) }; return func(this, a_y, a_z, a_x); } - bool NiMatrix3::ToEulerAnglesZYX(float& a_z, float& a_y, float& a_x) const + inline bool NiMatrix3::ToEulerAnglesZYX(float& a_z, float& a_y, float& a_x) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesZYX5 }; + static REL::Relocation func{ REL::ID(2269810) }; return func(this, a_z, a_y, a_x); } - bool NiMatrix3::ToEulerAnglesZXY(float& a_z, float& a_x, float& a_y) const + inline bool NiMatrix3::ToEulerAnglesZXY(float& a_z, float& a_x, float& a_y) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesZXY6 }; + static REL::Relocation func{ REL::ID(2269824) }; return func(this, a_z, a_x, a_y); } - void NiMatrix3::FromEulerAnglesXYZ(const NiPoint3& a_point) + inline void NiMatrix3::FromEulerAnglesXYZ(const NiPoint3& a_point) { FromEulerAnglesXYZ(a_point.x, a_point.y, a_point.z); } - void NiMatrix3::FromEulerAnglesXYZ(float a_x, float a_y, float a_z) + inline void NiMatrix3::FromEulerAnglesXYZ(float a_x, float a_y, float a_z) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesXYZ1 }; + static REL::Relocation func{ REL::ID(2269813) }; return func(this, a_x, a_y, a_z); } - void NiMatrix3::FromEulerAnglesXZY(float a_x, float a_z, float a_y) + inline void NiMatrix3::FromEulerAnglesXZY(float a_x, float a_z, float a_y) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesXZY2 }; + static REL::Relocation func{ REL::ID(2269814) }; return func(this, a_x, a_z, a_y); } - void NiMatrix3::FromEulerAnglesYXZ(float a_y, float a_x, float a_z) + inline void NiMatrix3::FromEulerAnglesYXZ(float a_y, float a_x, float a_z) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesYXZ3 }; + static REL::Relocation func{ REL::ID(2269815) }; return func(this, a_y, a_x, a_z); } - void NiMatrix3::FromEulerAnglesYZX(float a_y, float a_z, float a_x) + inline void NiMatrix3::FromEulerAnglesYZX(float a_y, float a_z, float a_x) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesYZX4 }; + static REL::Relocation func{ REL::ID(2269816) }; return func(this, a_y, a_z, a_x); } - void NiMatrix3::FromEulerAnglesZYX(float a_z, float a_y, float a_x) + inline void NiMatrix3::FromEulerAnglesZYX(float a_z, float a_y, float a_x) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesZYX5 }; + static REL::Relocation func{ REL::ID(2269817) }; return func(this, a_z, a_y, a_x); } - void NiMatrix3::FromEulerAnglesZXY(float a_z, float a_x, float a_y) + inline void NiMatrix3::FromEulerAnglesZXY(float a_z, float a_x, float a_y) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesZXY6 }; + static REL::Relocation func{ REL::ID(2269825) }; return func(this, a_z, a_x, a_y); } } diff --git a/src/RE/N/NiObjectNET.cpp b/src/RE/N/NiObjectNET.cpp index fb62ec86..6c0f39e5 100644 --- a/src/RE/N/NiObjectNET.cpp +++ b/src/RE/N/NiObjectNET.cpp @@ -1,22 +1,78 @@ #include "RE/N/NiObjectNET.h" +#include "RE/N/NiExtraData.h" +#include "RE/N/NiRTTI.h" +#include "RE/N/NiTimeController.h" + namespace RE { - NiObjectNET::NiObjectNET() { REX::EMPLACE_VTABLE(this); } + NiObjectNET::NiObjectNET() + { + REX::EMPLACE_VTABLE(this); + } + + NiObjectNET::~NiObjectNET() = default; + + bool NiObjectNET::AddExtraData(const BSFixedString& a_key, NiExtraData* a_extra) + { + if (a_key.empty()) + return false; + + if (!a_extra) + return false; + + if (!a_extra->GetName().empty()) + a_extra->SetName(a_key); + else if (a_key != a_extra->GetName()) + return false; + + return InsertExtraData(a_extra); + } + + bool NiObjectNET::AddExtraData(NiExtraData* a_extra) + { + if (!a_extra) + return false; + + const auto& extraName = a_extra->GetName(); + if (extraName.empty()) { + // TODO: Game handles nameless ExtraData by using the rtti name and a suffix? + assert(false); + } - NiObjectNET::~NiObjectNET() {} + return InsertExtraData(a_extra); + } + + NiExtraData* NiObjectNET::GetExtraData(const BSFixedString& a_key) const + { + return extra ? extra->FindExtra(a_key) : nullptr; + } + + std::uint16_t NiObjectNET::GetExtraDataSize() const + { + return extra ? static_cast(extra->GetSize()) : 0; + } - NiExtraData* NiObjectNET::GetExtraData(BSFixedString a_key) const noexcept + bool NiObjectNET::HasExtraData(const BSFixedString& a_key) const + { + return extra ? extra->FindExtra(a_key) : false; + } + + bool NiObjectNET::InsertExtraData(NiExtraData* a_extra) { if (extra) { - for (auto it = extra->begin(); it != extra->end(); ++it) { - if ((*it)->name == a_key) { - return *it; - } - } + extra->Add(a_extra); + return true; } - return nullptr; + return false; + } + + bool NiObjectNET::RemoveExtraData(const BSFixedString& a_key) + { + if (a_key.empty()) + return false; + + return extra && extra->RemoveExtra(a_key); } - // NOLINT(modernize-use-equals-default) } diff --git a/src/RE/N/NiPoint.cpp b/src/RE/N/NiPoint.cpp index 541ffd07..d5679328 100644 --- a/src/RE/N/NiPoint.cpp +++ b/src/RE/N/NiPoint.cpp @@ -1,218 +1,219 @@ #include "RE/N/NiPoint.h" +#include "RE/B/BSHavok.h" namespace RE { - const NiPoint2 NiPoint2::ZERO = { 0.0F, 0.0F }; - - NiPoint2::NiPoint2(float a_x, float a_y) noexcept : + constexpr NiPoint2::NiPoint2(float a_x, float a_y) noexcept : x(a_x), y(a_y) {} - float& NiPoint2::operator[](std::size_t a_pos) noexcept + constexpr float& NiPoint2::operator[](std::size_t a_pos) noexcept { assert(a_pos < 2); return std::addressof(x)[a_pos]; } - const float& NiPoint2::operator[](std::size_t a_pos) const noexcept + constexpr const float& NiPoint2::operator[](std::size_t a_pos) const noexcept { assert(a_pos < 2); return std::addressof(x)[a_pos]; } - bool NiPoint2::operator==(const NiPoint2& a_rhs) const noexcept + constexpr bool NiPoint2::operator==(const NiPoint2& a_rhs) const noexcept { return (x == a_rhs.x) && (y == a_rhs.y); } - bool NiPoint2::operator!=(const NiPoint2& a_rhs) const noexcept + constexpr bool NiPoint2::operator!=(const NiPoint2& a_rhs) const noexcept { return !operator==(a_rhs); } - bool NiPoint2::operator<(const NiPoint2& a_rhs) const noexcept + constexpr bool NiPoint2::operator<(const NiPoint2& a_rhs) const noexcept { return std::tie(x, y) < std::tie(a_rhs.x, a_rhs.y); } - bool NiPoint2::operator>(const NiPoint2& a_rhs) const noexcept + constexpr bool NiPoint2::operator>(const NiPoint2& a_rhs) const noexcept { return std::tie(x, y) > std::tie(a_rhs.x, a_rhs.y); } - NiPoint2 NiPoint2::operator+(const NiPoint2& a_rhs) const noexcept + constexpr NiPoint2 NiPoint2::operator+(const NiPoint2& a_rhs) const noexcept { return NiPoint2(x + a_rhs.x, y + a_rhs.y); } - NiPoint2 NiPoint2::operator-(const NiPoint2& a_rhs) const noexcept + constexpr NiPoint2 NiPoint2::operator-(const NiPoint2& a_rhs) const noexcept { return NiPoint2(x - a_rhs.x, y - a_rhs.y); } - NiPoint2 NiPoint2::operator*(const NiPoint2& a_rhs) const noexcept + constexpr NiPoint2 NiPoint2::operator*(const NiPoint2& a_rhs) const noexcept { return NiPoint2(x * a_rhs.x, y * a_rhs.y); } - NiPoint2 NiPoint2::operator/(const NiPoint2& a_rhs) const noexcept + constexpr NiPoint2 NiPoint2::operator/(const NiPoint2& a_rhs) const noexcept { return NiPoint2(x / a_rhs.x, y / a_rhs.y); } - NiPoint2 NiPoint2::operator*(float a_scalar) const noexcept + constexpr NiPoint2 NiPoint2::operator*(float a_scalar) const noexcept { return NiPoint2(x * a_scalar, y * a_scalar); } - NiPoint2 NiPoint2::operator/(float a_scalar) const noexcept + constexpr NiPoint2 NiPoint2::operator/(float a_scalar) const noexcept { return NiPoint2(x / a_scalar, y / a_scalar); } - NiPoint2 NiPoint2::operator-() const noexcept + constexpr NiPoint2 NiPoint2::operator-() const noexcept { return NiPoint2(-x, -y); } - NiPoint2& NiPoint2::operator+=(const NiPoint2& a_rhs) noexcept + constexpr NiPoint2& NiPoint2::operator+=(const NiPoint2& a_rhs) noexcept { x += a_rhs.x; y += a_rhs.y; return *this; } - NiPoint2& NiPoint2::operator-=(const NiPoint2& a_rhs) noexcept + constexpr NiPoint2& NiPoint2::operator-=(const NiPoint2& a_rhs) noexcept { x -= a_rhs.x; y -= a_rhs.y; return *this; } - NiPoint2& NiPoint2::operator*=(const NiPoint2& a_rhs) noexcept + constexpr NiPoint2& NiPoint2::operator*=(const NiPoint2& a_rhs) noexcept { x *= a_rhs.x; y *= a_rhs.y; return *this; } - NiPoint2& NiPoint2::operator/=(const NiPoint2& a_rhs) noexcept + constexpr NiPoint2& NiPoint2::operator/=(const NiPoint2& a_rhs) noexcept { x /= a_rhs.x; y /= a_rhs.y; return *this; } - NiPoint2& NiPoint2::operator+=(float a_scalar) noexcept + constexpr NiPoint2& NiPoint2::operator+=(float a_scalar) noexcept { x += a_scalar; y += a_scalar; return *this; } - NiPoint2& NiPoint2::operator-=(float a_scalar) noexcept + constexpr NiPoint2& NiPoint2::operator-=(float a_scalar) noexcept { x -= a_scalar; y -= a_scalar; return *this; } - NiPoint2& NiPoint2::operator*=(float a_scalar) noexcept + constexpr NiPoint2& NiPoint2::operator*=(float a_scalar) noexcept { x *= a_scalar; y *= a_scalar; return *this; } - NiPoint2& NiPoint2::operator/=(float a_scalar) noexcept + constexpr NiPoint2& NiPoint2::operator/=(float a_scalar) noexcept { x /= a_scalar; y /= a_scalar; return *this; } + + inline constexpr NiPoint2 NiPoint2::ZERO = { 0.0F, 0.0F }; + inline constexpr NiPoint2 NiPoint2::UNIT = { 1.0F, 1.0F }; + inline constexpr NiPoint2 NiPoint2::UNIT_X = { 1.0F, 0.0F }; + inline constexpr NiPoint2 NiPoint2::UNIT_Y = { 0.0F, 1.0F }; } namespace RE { - const NiPoint3 NiPoint3::ZERO = { 0.0F, 0.0F, 0.0F }; - const NiPoint3A NiPoint3A::ZERO = { 0.0F, 0.0F, 0.0F }; - - NiPoint3::NiPoint3(const NiPoint2& a_point) noexcept : + constexpr NiPoint3::NiPoint3(const NiPoint2& a_point) noexcept : x(a_point.x), y(a_point.y) {} - NiPoint3::NiPoint3(float a_x, float a_y, float a_z) noexcept : + constexpr NiPoint3::NiPoint3(float a_x, float a_y, float a_z) noexcept : x(a_x), y(a_y), z(a_z) {} - float& NiPoint3::operator[](std::size_t a_pos) noexcept + constexpr float& NiPoint3::operator[](std::size_t a_pos) noexcept { assert(a_pos < 3); return std::addressof(x)[a_pos]; } - const float& NiPoint3::operator[](std::size_t a_pos) const noexcept + constexpr const float& NiPoint3::operator[](std::size_t a_pos) const noexcept { assert(a_pos < 3); return std::addressof(x)[a_pos]; } - bool NiPoint3::operator==(const NiPoint3& a_rhs) const noexcept + constexpr bool NiPoint3::operator==(const NiPoint3& a_rhs) const noexcept { return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z); } - bool NiPoint3::operator!=(const NiPoint3& a_rhs) const noexcept + constexpr bool NiPoint3::operator!=(const NiPoint3& a_rhs) const noexcept { return !operator==(a_rhs); } - bool NiPoint3::operator<(const NiPoint3& a_rhs) const noexcept + constexpr bool NiPoint3::operator<(const NiPoint3& a_rhs) const noexcept { return std::tie(x, y, z) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z); } - bool NiPoint3::operator>(const NiPoint3& a_rhs) const noexcept + constexpr bool NiPoint3::operator>(const NiPoint3& a_rhs) const noexcept { return std::tie(x, y, z) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z); } - NiPoint3 NiPoint3::operator+(const NiPoint3& a_rhs) const noexcept + constexpr NiPoint3 NiPoint3::operator+(const NiPoint3& a_rhs) const noexcept { return NiPoint3(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z); } - NiPoint3 NiPoint3::operator-(const NiPoint3& a_rhs) const noexcept + constexpr NiPoint3 NiPoint3::operator-(const NiPoint3& a_rhs) const noexcept { return NiPoint3(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z); } - NiPoint3 NiPoint3::operator*(const NiPoint3& a_rhs) const noexcept + constexpr NiPoint3 NiPoint3::operator*(const NiPoint3& a_rhs) const noexcept { return NiPoint3(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z); } - NiPoint3 NiPoint3::operator/(const NiPoint3& a_rhs) const noexcept + constexpr NiPoint3 NiPoint3::operator/(const NiPoint3& a_rhs) const noexcept { return NiPoint3(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z); } - NiPoint3 NiPoint3::operator*(float a_scalar) const noexcept + constexpr NiPoint3 NiPoint3::operator*(float a_scalar) const noexcept { return NiPoint3(x * a_scalar, y * a_scalar, z * a_scalar); } - NiPoint3 NiPoint3::operator/(float a_scalar) const noexcept + constexpr NiPoint3 NiPoint3::operator/(float a_scalar) const noexcept { return NiPoint3(x / a_scalar, y / a_scalar, z / a_scalar); } - NiPoint3 NiPoint3::operator-() const noexcept + constexpr NiPoint3 NiPoint3::operator-() const noexcept { return NiPoint3(-x, -y, -z); } - NiPoint3& NiPoint3::operator+=(const NiPoint3& a_rhs) noexcept + constexpr NiPoint3& NiPoint3::operator+=(const NiPoint3& a_rhs) noexcept { x += a_rhs.x; y += a_rhs.y; @@ -220,7 +221,7 @@ namespace RE return *this; } - NiPoint3& NiPoint3::operator-=(const NiPoint3& a_rhs) noexcept + constexpr NiPoint3& NiPoint3::operator-=(const NiPoint3& a_rhs) noexcept { x -= a_rhs.x; y -= a_rhs.y; @@ -228,7 +229,7 @@ namespace RE return *this; } - NiPoint3& NiPoint3::operator*=(const NiPoint3& a_rhs) noexcept + constexpr NiPoint3& NiPoint3::operator*=(const NiPoint3& a_rhs) noexcept { x *= a_rhs.x; y *= a_rhs.y; @@ -236,7 +237,7 @@ namespace RE return *this; } - NiPoint3& NiPoint3::operator/=(const NiPoint3& a_rhs) noexcept + constexpr NiPoint3& NiPoint3::operator/=(const NiPoint3& a_rhs) noexcept { x /= a_rhs.x; y /= a_rhs.y; @@ -244,7 +245,7 @@ namespace RE return *this; } - NiPoint3& NiPoint3::operator+=(float a_scalar) noexcept + constexpr NiPoint3& NiPoint3::operator+=(float a_scalar) noexcept { x += a_scalar; y += a_scalar; @@ -252,7 +253,7 @@ namespace RE return *this; } - NiPoint3& NiPoint3::operator-=(float a_scalar) noexcept + constexpr NiPoint3& NiPoint3::operator-=(float a_scalar) noexcept { x -= a_scalar; y -= a_scalar; @@ -260,7 +261,7 @@ namespace RE return *this; } - NiPoint3& NiPoint3::operator*=(float a_scalar) noexcept + constexpr NiPoint3& NiPoint3::operator*=(float a_scalar) noexcept { x *= a_scalar; y *= a_scalar; @@ -268,7 +269,7 @@ namespace RE return *this; } - NiPoint3& NiPoint3::operator/=(float a_scalar) noexcept + constexpr NiPoint3& NiPoint3::operator/=(float a_scalar) noexcept { x /= a_scalar; y /= a_scalar; @@ -276,7 +277,7 @@ namespace RE return *this; } - NiPoint3 NiPoint3::Cross(const NiPoint3& a_point) const noexcept + constexpr NiPoint3 NiPoint3::Cross(const NiPoint3& a_point) const noexcept { return NiPoint3( y * a_point.z - z * a_point.y, @@ -284,17 +285,12 @@ namespace RE x * a_point.y - y * a_point.x); } - float NiPoint3::Dot(const NiPoint3& a_point) const noexcept + constexpr float NiPoint3::Dot(const NiPoint3& a_point) const noexcept { return x * a_point.x + y * a_point.y + z * a_point.z; } - float NiPoint3::GetDistance(const NiPoint3& a_point) const noexcept - { - return std::sqrtf(GetSquaredDistance(a_point)); - } - - float NiPoint3::GetSquaredDistance(const NiPoint3& a_point) const noexcept + constexpr float NiPoint3::GetSquaredDistance(const NiPoint3& a_point) const noexcept { const float dx = a_point.x - x; const float dy = a_point.y - y; @@ -302,31 +298,36 @@ namespace RE return dx * dx + dy * dy + dz * dz; } - float NiPoint3::GetZAngleFromVector() const + constexpr float NiPoint3::SqrLength() const noexcept { - using func_t = decltype(&NiPoint3::GetZAngleFromVector); - static REL::Relocation func{ ID::NiPoint::NiPoint3::GetZAngleFromVector }; - return func(this); + return x * x + y * y + z * z; } - float NiPoint3::Length() const noexcept + inline float NiPoint3::GetDistance(const NiPoint3& a_point) const noexcept { - return std::sqrtf(x * x + y * y + z * z); + return std::sqrtf(GetSquaredDistance(a_point)); } - float NiPoint3::SqrLength() const noexcept + inline float NiPoint3::GetZAngleFromVector() const { - return x * x + y * y + z * z; + using func_t = decltype(&NiPoint3::GetZAngleFromVector); + static REL::Relocation func{ REL::ID(1450064) }; + return func(this); } - NiPoint3 NiPoint3::UnitCross(const NiPoint3& a_point) const noexcept + inline float NiPoint3::Length() const noexcept + { + return std::sqrtf(x * x + y * y + z * z); + } + + inline NiPoint3 NiPoint3::UnitCross(const NiPoint3& a_point) const noexcept { auto cross = Cross(a_point); cross.Unitize(); return cross; } - float NiPoint3::Unitize() noexcept + inline float NiPoint3::Unitize() noexcept { auto length = Length(); if (length == 1.f) { @@ -341,96 +342,101 @@ namespace RE } return length; } + + inline constexpr NiPoint3 NiPoint3::ZERO = { 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT = { 1.0F, 1.0F, 1.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT_X = { 1.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT_Y = { 0.0F, 1.0F, 0.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT_Z = { 0.0F, 0.0F, 1.0F }; + inline constexpr NiPoint3A NiPoint3A::ZERO = { 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT = { 1.0F, 1.0F, 1.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT_X = { 1.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT_Y = { 0.0F, 1.0F, 0.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT_Z = { 0.0F, 0.0F, 1.0F }; } namespace RE { - const NiPoint4 NiPoint4::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; - const NiPoint4 NiPoint4::IDENTITY0 = { 1.0F, 0.0F, 0.0F, 0.0F }; - const NiPoint4 NiPoint4::IDENTITY1 = { 0.0F, 1.0F, 0.0F, 0.0F }; - const NiPoint4 NiPoint4::IDENTITY2 = { 0.0F, 0.0F, 1.0F, 0.0F }; - const NiPoint4 NiPoint4::IDENTITY3 = { 0.0F, 0.0F, 0.0F, 1.0F }; - - NiPoint4::NiPoint4(const NiPoint2& a_point) noexcept : + constexpr NiPoint4::NiPoint4(const NiPoint2& a_point) noexcept : x(a_point.x), y(a_point.y) {} - NiPoint4::NiPoint4(const NiPoint3& a_point) noexcept : + constexpr NiPoint4::NiPoint4(const NiPoint3& a_point) noexcept : x(a_point.x), y(a_point.y), z(a_point.z) {} - NiPoint4::NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept : + constexpr NiPoint4::NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept : x(a_x), y(a_y), z(a_z), w(a_w) {} - float& NiPoint4::operator[](std::size_t a_pos) noexcept + constexpr float& NiPoint4::operator[](std::size_t a_pos) noexcept { assert(a_pos < 4); return std::addressof(x)[a_pos]; } - const float& NiPoint4::operator[](std::size_t a_pos) const noexcept + constexpr const float& NiPoint4::operator[](std::size_t a_pos) const noexcept { assert(a_pos < 4); return std::addressof(x)[a_pos]; } - bool NiPoint4::operator==(const NiPoint4& a_rhs) const noexcept + constexpr bool NiPoint4::operator==(const NiPoint4& a_rhs) const noexcept { return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z) && (w == a_rhs.w); } - bool NiPoint4::operator!=(const NiPoint4& a_rhs) const noexcept + constexpr bool NiPoint4::operator!=(const NiPoint4& a_rhs) const noexcept { return !operator==(a_rhs); } - bool NiPoint4::operator<(const NiPoint4& a_rhs) const noexcept + constexpr bool NiPoint4::operator<(const NiPoint4& a_rhs) const noexcept { return std::tie(x, y, z, w) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); } - bool NiPoint4::operator>(const NiPoint4& a_rhs) const noexcept + constexpr bool NiPoint4::operator>(const NiPoint4& a_rhs) const noexcept { return std::tie(x, y, z, w) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); } - NiPoint4 NiPoint4::operator+(const NiPoint4& a_rhs) const noexcept + constexpr NiPoint4 NiPoint4::operator+(const NiPoint4& a_rhs) const noexcept { return NiPoint4(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z, w + a_rhs.w); } - NiPoint4 NiPoint4::operator-(const NiPoint4& a_rhs) const noexcept + constexpr NiPoint4 NiPoint4::operator-(const NiPoint4& a_rhs) const noexcept { return NiPoint4(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z, w - a_rhs.w); } - NiPoint4 NiPoint4::operator*(const NiPoint4& a_rhs) const noexcept + constexpr NiPoint4 NiPoint4::operator*(const NiPoint4& a_rhs) const noexcept { return NiPoint4(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z, w * a_rhs.w); } - NiPoint4 NiPoint4::operator/(const NiPoint4& a_rhs) const noexcept + constexpr NiPoint4 NiPoint4::operator/(const NiPoint4& a_rhs) const noexcept { return NiPoint4(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z, w / a_rhs.w); } - NiPoint4 NiPoint4::operator*(float a_scalar) const noexcept + constexpr NiPoint4 NiPoint4::operator*(float a_scalar) const noexcept { return NiPoint4(x * a_scalar, y * a_scalar, z * a_scalar, w * a_scalar); } - NiPoint4 NiPoint4::operator/(float a_scalar) const noexcept + constexpr NiPoint4 NiPoint4::operator/(float a_scalar) const noexcept { return operator*(1.0F / a_scalar); } - NiPoint4 NiPoint4::operator-() const noexcept + constexpr NiPoint4 NiPoint4::operator-() const noexcept { return NiPoint4(-x, -y, -z, -w); } - NiPoint4& NiPoint4::operator+=(const NiPoint4& a_rhs) noexcept + constexpr NiPoint4& NiPoint4::operator+=(const NiPoint4& a_rhs) noexcept { x += a_rhs.x; y += a_rhs.y; @@ -439,7 +445,7 @@ namespace RE return *this; } - NiPoint4& NiPoint4::operator-=(const NiPoint4& a_rhs) noexcept + constexpr NiPoint4& NiPoint4::operator-=(const NiPoint4& a_rhs) noexcept { x -= a_rhs.x; y -= a_rhs.y; @@ -448,7 +454,7 @@ namespace RE return *this; } - NiPoint4& NiPoint4::operator*=(const NiPoint4& a_rhs) noexcept + constexpr NiPoint4& NiPoint4::operator*=(const NiPoint4& a_rhs) noexcept { x *= a_rhs.x; y *= a_rhs.y; @@ -457,7 +463,7 @@ namespace RE return *this; } - NiPoint4& NiPoint4::operator/=(const NiPoint4& a_rhs) noexcept + constexpr NiPoint4& NiPoint4::operator/=(const NiPoint4& a_rhs) noexcept { x /= a_rhs.x; y /= a_rhs.y; @@ -466,7 +472,7 @@ namespace RE return *this; } - NiPoint4& NiPoint4::operator+=(float a_scalar) noexcept + constexpr NiPoint4& NiPoint4::operator+=(float a_scalar) noexcept { x += a_scalar; y += a_scalar; @@ -475,7 +481,7 @@ namespace RE return *this; } - NiPoint4& NiPoint4::operator-=(float a_scalar) noexcept + constexpr NiPoint4& NiPoint4::operator-=(float a_scalar) noexcept { x -= a_scalar; y -= a_scalar; @@ -484,7 +490,7 @@ namespace RE return *this; } - NiPoint4& NiPoint4::operator*=(float a_scalar) noexcept + constexpr NiPoint4& NiPoint4::operator*=(float a_scalar) noexcept { x *= a_scalar; y *= a_scalar; @@ -493,7 +499,7 @@ namespace RE return *this; } - NiPoint4& NiPoint4::operator/=(float a_scalar) noexcept + constexpr NiPoint4& NiPoint4::operator/=(float a_scalar) noexcept { x /= a_scalar; y /= a_scalar; @@ -501,4 +507,10 @@ namespace RE w /= a_scalar; return *this; } + + inline constexpr NiPoint4 NiPoint4::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY0 = { 1.0F, 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY1 = { 0.0F, 1.0F, 0.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY2 = { 0.0F, 0.0F, 1.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY3 = { 0.0F, 0.0F, 0.0F, 1.0F }; } diff --git a/src/RE/N/NiTransform.cpp b/src/RE/N/NiTransform.cpp index c98401fd..1ada4db7 100644 --- a/src/RE/N/NiTransform.cpp +++ b/src/RE/N/NiTransform.cpp @@ -2,40 +2,40 @@ namespace RE { - const NiTransform NiTransform::ZERO = { NiMatrix3::ZERO, NiPoint3::ZERO, 0.0F }; - const NiTransform NiTransform::IDENTITY = { NiMatrix3::IDENTITY, NiPoint3::ZERO, 1.0F }; + inline constexpr NiTransform NiTransform::ZERO = { NiMatrix3::ZERO, NiPoint3::ZERO, 0.0F }; + inline constexpr NiTransform NiTransform::IDENTITY = { NiMatrix3::IDENTITY, NiPoint3::ZERO, 1.0F }; - NiTransform::NiTransform(const NiMatrix3& a_rotate, const NiPoint3& a_translate, const float a_scale) noexcept : - rotate(a_rotate), translate(a_translate), scale(a_scale) + constexpr NiTransform::NiTransform(const NiMatrix3& a_rotation, const NiPoint3& a_translation, const float a_scale) noexcept : + rotate(a_rotation), translate(a_translation), scale(a_scale) {} - bool NiTransform::operator==(const NiTransform& a_rhs) const noexcept + constexpr bool NiTransform::operator==(const NiTransform& a_rhs) const noexcept { return (rotate == a_rhs.rotate) && (translate == a_rhs.translate) && (scale == a_rhs.scale); } - bool NiTransform::operator!=(const NiTransform& a_rhs) const noexcept + constexpr bool NiTransform::operator!=(const NiTransform& a_rhs) const noexcept { return !operator==(a_rhs); } - NiTransform NiTransform::operator*(const NiTransform& a_rhs) const noexcept + constexpr NiTransform NiTransform::operator*(const NiTransform& a_rhs) const noexcept { return NiTransform(rotate * a_rhs.rotate, translate + (rotate * a_rhs.translate) * scale, scale * a_rhs.scale); } - NiPoint3 NiTransform::operator*(const NiPoint3& a_rhs) const noexcept + constexpr NiPoint3 NiTransform::operator*(const NiPoint3& a_rhs) const noexcept { return NiPoint3(((rotate * a_rhs) * scale) + translate); } - NiTransform NiTransform::Invert() const noexcept + constexpr NiTransform NiTransform::Invert() const noexcept { NiTransform transform(*this); return transform.MakeInvert(); } - NiTransform& NiTransform::MakeIdentity() noexcept + constexpr NiTransform& NiTransform::MakeIdentity() noexcept { rotate = NiMatrix3::IDENTITY; translate = NiPoint3::ZERO; @@ -43,7 +43,7 @@ namespace RE return *this; } - NiTransform& NiTransform::MakeInvert() noexcept + constexpr NiTransform& NiTransform::MakeInvert() noexcept { rotate = rotate.Transpose(); scale = 1.0f / scale; diff --git a/src/RE/T/TES.cpp b/src/RE/T/TES.cpp new file mode 100644 index 00000000..968418a4 --- /dev/null +++ b/src/RE/T/TES.cpp @@ -0,0 +1,92 @@ +#include "RE/T/TES.h" + +#include "RE/E/EXTERIOR_DATA.h" +#include "RE/G/GridCellArray.h" +#include "RE/T/TESObjectCELL.h" +#include "RE/T/TESObjectREFR.h" +#include "RE/T/TESWorldSpace.h" + +namespace RE +{ + void TES::ForEachReference(std::function a_callback) + { + if (interiorCell) { + interiorCell->ForEachReference([&](TESObjectREFR* a_ref) { + return a_callback(a_ref); + }); + } else { + if (const auto gridLength = gridCells ? gridCells->dimension : 0; gridLength > 0) { + std::uint32_t x = 0; + do { + std::uint32_t y = 0; + do { + if (const auto cell = gridCells->GetCell(x, y); cell && cell->IsAttached()) { + cell->ForEachReference([&](TESObjectREFR* a_ref) { + return a_callback(a_ref); + }); + } + ++y; + } while (y < gridLength); + ++x; + } while (x < gridLength); + } + } + if (const auto skyCell = worldSpace ? worldSpace->GetSkyCell() : nullptr; skyCell) { + skyCell->ForEachReference([&](TESObjectREFR* a_ref) { + return a_callback(a_ref); + }); + } + } + + void TES::ForEachReferenceInRange(const NiPoint3& a_origin, const float a_radius, std::function a_callback) + { + if (a_radius > 0.0f) { + if (interiorCell) { + interiorCell->ForEachReferenceInRange(a_origin, a_radius, [&](TESObjectREFR* a_ref) { + return a_callback(a_ref); + }); + } else { + if (const auto gridLength = gridCells ? gridCells->dimension : 0; gridLength > 0) { + const float yPlus = a_origin.y + a_radius; + const float yMinus = a_origin.y - a_radius; + const float xPlus = a_origin.x + a_radius; + const float xMinus = a_origin.x - a_radius; + + std::uint32_t x = 0; + do { + std::uint32_t y = 0; + do { + if (const auto cell = gridCells->GetCell(x, y); cell && cell->IsAttached()) { + if (const auto cellCoords = cell->GetCoordinates(); cellCoords) { + const NiPoint2 worldPos{ cellCoords->worldX, cellCoords->worldY }; + if (worldPos.x < xPlus && (worldPos.x + 4096.0f) > xMinus && worldPos.y < yPlus && (worldPos.y + 4096.0f) > yMinus) { + cell->ForEachReferenceInRange(a_origin, a_radius, [&](TESObjectREFR* a_ref) { + return a_callback(a_ref); + }); + } + } + } + ++y; + } while (y < gridLength); + ++x; + } while (x < gridLength); + } + } + + if (const auto skyCell = worldSpace ? worldSpace->GetSkyCell() : nullptr; skyCell) { + skyCell->ForEachReferenceInRange(a_origin, a_radius, [&](TESObjectREFR* a_ref) { + return a_callback(a_ref); + }); + } + } else { + ForEachReference([&](TESObjectREFR* a_ref) { + return a_callback(a_ref); + }); + } + } + + void TES::ForEachReferenceInRange(const TESObjectREFR* a_ref, const float a_radius, std::function a_callback) + { + ForEachReferenceInRange(a_ref->GetPosition(), a_radius, a_callback); + } +} diff --git a/src/RE/T/TESObjectCELL.cpp b/src/RE/T/TESObjectCELL.cpp index 703aa2ba..65021c2d 100644 --- a/src/RE/T/TESObjectCELL.cpp +++ b/src/RE/T/TESObjectCELL.cpp @@ -1,11 +1,40 @@ #include "RE/T/TESObjectCELL.h" +#include "RE/E/EXTERIOR_DATA.h" #include "RE/E/ExtraCellWaterType.h" #include "RE/E/ExtraDataList.h" +#include "RE/T/TESObjectREFR.h" #include "RE/T/TESWorldSpace.h" namespace RE { + void TESObjectCELL::ForEachReference(std::function a_callback) + { + const BSAutoLock locker(spinLock); + for (const auto& ref : references) { + if (ref && a_callback(ref.get()) == BSContainer::ForEachResult::kStop) { + break; + } + } + } + + void TESObjectCELL::ForEachReferenceInRange(const NiPoint3& a_origin, float a_radius, std::function a_callback) + { + const float squaredRadius = a_radius * a_radius; + ForEachReference([&](TESObjectREFR* a_ref) { + const auto distance = a_origin.GetSquaredDistance(a_ref->GetPosition()); + if (distance <= squaredRadius) + return a_callback(a_ref); + + return BSContainer::ForEachResult::kContinue; + }); + } + + EXTERIOR_DATA* TESObjectCELL::GetCoordinates() const + { + return IsExterior() ? cellData.exterior : nullptr; + } + TESWaterForm* TESObjectCELL::GetWaterType() const noexcept { const auto xWater = extraList ? extraList->GetByType() : nullptr; From bb50eaf4cfb302faa53eb43f07fc35f655e542b4 Mon Sep 17 00:00:00 2001 From: qudix Date: Mon, 27 Apr 2026 23:06:21 +0000 Subject: [PATCH 2/9] maintenance --- include/RE/B/BSHavok.h | 2 +- include/RE/B/BSShaderResourceManager.h | 2 +- include/RE/E/EXTERIOR_DATA.h | 2 +- include/RE/G/GridCellArray.h | 28 ++++++++++++------------- include/RE/H/hkFreeListArray.h | 1 - include/RE/H/hkHalf.h | 2 +- include/RE/H/hknpCharacterContext.h | 4 ++-- include/RE/H/hknpShapeInstance.h | 12 +++++------ include/RE/H/hknpSparseCompactMap.h | 1 - include/RE/I/IRendererResourceManager.h | 4 ++-- include/RE/N/NiMatrix3.h | 2 +- src/RE/N/NiExtraDataContainer.cpp | 4 ++-- src/RE/N/NiTransform.cpp | 4 ++-- src/RE/T/TESObjectCELL.cpp | 4 ++-- 14 files changed, 35 insertions(+), 37 deletions(-) diff --git a/include/RE/B/BSHavok.h b/include/RE/B/BSHavok.h index 1320b803..bac2bd0e 100644 --- a/include/RE/B/BSHavok.h +++ b/include/RE/B/BSHavok.h @@ -1,7 +1,7 @@ #pragma once -#include "RE/N/NiTransform.h" #include "RE/H/hkTransform.h" +#include "RE/N/NiTransform.h" namespace RE { diff --git a/include/RE/B/BSShaderResourceManager.h b/include/RE/B/BSShaderResourceManager.h index 77f2373c..d9d3eacc 100644 --- a/include/RE/B/BSShaderResourceManager.h +++ b/include/RE/B/BSShaderResourceManager.h @@ -4,7 +4,7 @@ namespace RE { - class __declspec(novtable) BSShaderResourceManager : + class __declspec(novtable) BSShaderResourceManager : public IRendererResourceManager { public: diff --git a/include/RE/E/EXTERIOR_DATA.h b/include/RE/E/EXTERIOR_DATA.h index af1bb909..484f9818 100644 --- a/include/RE/E/EXTERIOR_DATA.h +++ b/include/RE/E/EXTERIOR_DATA.h @@ -4,7 +4,7 @@ namespace RE { class BGSTerrainVisibilityData; - class EXTERIOR_DATA + class EXTERIOR_DATA { public: enum class LandHideFlag : std::uint8_t diff --git a/include/RE/G/GridCellArray.h b/include/RE/G/GridCellArray.h index 14aefbbe..e90257e8 100644 --- a/include/RE/G/GridCellArray.h +++ b/include/RE/G/GridCellArray.h @@ -17,13 +17,13 @@ namespace RE class QueuedAttach { private: - enum class ProgressiveAttachState : std::int32_t - { - kWorld = 0, - kModels = 1, - kRegisterCombinedObjectVisibility = 2, - kDone = 3, - }; + enum class ProgressiveAttachState : std::int32_t + { + kWorld = 0, + kModels = 1, + kRegisterCombinedObjectVisibility = 2, + kDone = 3, + }; public: // members @@ -35,13 +35,13 @@ namespace RE class QueuedDetach { private: - enum class ProgressiveDetachState : std::int32_t - { - kActorsNext = 0, - kRefsNext = 1, - kCombinedArtNext = 2, - kDone = 3, - }; + enum class ProgressiveDetachState : std::int32_t + { + kActorsNext = 0, + kRefsNext = 1, + kCombinedArtNext = 2, + kDone = 3, + }; public: // members diff --git a/include/RE/H/hkFreeListArray.h b/include/RE/H/hkFreeListArray.h index d4b85068..d06125bf 100644 --- a/include/RE/H/hkFreeListArray.h +++ b/include/RE/H/hkFreeListArray.h @@ -28,7 +28,6 @@ namespace RE class hkFreeListArray { public: - private: // members hkArray> m_elements; diff --git a/include/RE/H/hkHalf.h b/include/RE/H/hkHalf.h index 2b2bb686..427f7520 100644 --- a/include/RE/H/hkHalf.h +++ b/include/RE/H/hkHalf.h @@ -2,7 +2,7 @@ namespace RE { - class hkHalf + class hkHalf { public: std::int16_t value; diff --git a/include/RE/H/hknpCharacterContext.h b/include/RE/H/hknpCharacterContext.h index 714fe5c6..8b3141f5 100644 --- a/include/RE/H/hknpCharacterContext.h +++ b/include/RE/H/hknpCharacterContext.h @@ -13,8 +13,8 @@ namespace RE public hkReferencedObject { public: - static constexpr auto RTTI{ RTTI::hknpCharacterContext }; - static constexpr auto VTABLE{ VTABLE::hknpCharacterContext }; + static constexpr auto RTTI{ RTTI::hknpCharacterContext }; + static constexpr auto VTABLE{ VTABLE::hknpCharacterContext }; enum class CharacterType : std::int32_t { diff --git a/include/RE/H/hknpShapeInstance.h b/include/RE/H/hknpShapeInstance.h index 9af28a17..d204ef9c 100644 --- a/include/RE/H/hknpShapeInstance.h +++ b/include/RE/H/hknpShapeInstance.h @@ -11,12 +11,12 @@ namespace RE { public: // members - hkTransformf transform; // 0x00 - hkVector4f scale; // 0x40 - hkRefPtr shape; // 0x50 - std::uint16_t shapeTag; // 0x58 - std::uint16_t destructionTag; // 0x5A - std::uint8_t padding[30]; // 0x5C + hkTransformf transform; // 0x00 + hkVector4f scale; // 0x40 + hkRefPtr shape; // 0x50 + std::uint16_t shapeTag; // 0x58 + std::uint16_t destructionTag; // 0x5A + std::uint8_t padding[30]; // 0x5C }; static_assert(sizeof(hknpShapeInstance) == 0x80); } diff --git a/include/RE/H/hknpSparseCompactMap.h b/include/RE/H/hknpSparseCompactMap.h index f792f42f..a9a23f1e 100644 --- a/include/RE/H/hknpSparseCompactMap.h +++ b/include/RE/H/hknpSparseCompactMap.h @@ -8,7 +8,6 @@ namespace RE class hknpSparseCompactMap { public: - private: std::uint32_t m_secondaryKeyMask; std::uint32_t m_sencondaryKeyBits; diff --git a/include/RE/I/IRendererResourceManager.h b/include/RE/I/IRendererResourceManager.h index 1f786061..683f0c16 100644 --- a/include/RE/I/IRendererResourceManager.h +++ b/include/RE/I/IRendererResourceManager.h @@ -4,7 +4,7 @@ namespace RE { - class BSDynamicLines; + class BSDynamicLines; class BSDynamicTriShape; class BSLines; class BSMeshLODTriShape; @@ -26,7 +26,7 @@ namespace RE class Texture; } - class __declspec(novtable) IRendererResourceManager + class __declspec(novtable) IRendererResourceManager { public: static constexpr auto RTTI{ RTTI::IRendererResourceManager }; diff --git a/include/RE/N/NiMatrix3.h b/include/RE/N/NiMatrix3.h index fdbf86ea..325c0782 100644 --- a/include/RE/N/NiMatrix3.h +++ b/include/RE/N/NiMatrix3.h @@ -17,7 +17,7 @@ namespace RE float a_x1, float a_y1, float a_z1, float a_w1, float a_x2, float a_y2, float a_z2, float a_w2) noexcept; - constexpr NiPoint4& operator[](std::size_t a_pos) noexcept; + constexpr NiPoint4& operator[](std::size_t a_pos) noexcept; constexpr const NiPoint4& operator[](std::size_t a_pos) const noexcept; constexpr bool operator==(const NiMatrix3& a_rhs) const noexcept; constexpr bool operator!=(const NiMatrix3& a_rhs) const noexcept; diff --git a/src/RE/N/NiExtraDataContainer.cpp b/src/RE/N/NiExtraDataContainer.cpp index e3326863..f9637f05 100644 --- a/src/RE/N/NiExtraDataContainer.cpp +++ b/src/RE/N/NiExtraDataContainer.cpp @@ -45,8 +45,8 @@ namespace RE const BSAutoWriteLock l(lock); const auto it = std::find_if(extra.begin(), extra.end(), [&](auto& entry) { - return entry->GetName() == a_key; - }); + return entry->GetName() == a_key; + }); if (it != extra.end()) { extra.erase(it); diff --git a/src/RE/N/NiTransform.cpp b/src/RE/N/NiTransform.cpp index 1ada4db7..7390bdd9 100644 --- a/src/RE/N/NiTransform.cpp +++ b/src/RE/N/NiTransform.cpp @@ -29,7 +29,7 @@ namespace RE return NiPoint3(((rotate * a_rhs) * scale) + translate); } - constexpr NiTransform NiTransform::Invert() const noexcept + constexpr NiTransform NiTransform::Invert() const noexcept { NiTransform transform(*this); return transform.MakeInvert(); @@ -43,7 +43,7 @@ namespace RE return *this; } - constexpr NiTransform& NiTransform::MakeInvert() noexcept + constexpr NiTransform& NiTransform::MakeInvert() noexcept { rotate = rotate.Transpose(); scale = 1.0f / scale; diff --git a/src/RE/T/TESObjectCELL.cpp b/src/RE/T/TESObjectCELL.cpp index 65021c2d..138c2ad0 100644 --- a/src/RE/T/TESObjectCELL.cpp +++ b/src/RE/T/TESObjectCELL.cpp @@ -8,7 +8,7 @@ namespace RE { - void TESObjectCELL::ForEachReference(std::function a_callback) + void TESObjectCELL::ForEachReference(std::function a_callback) { const BSAutoLock locker(spinLock); for (const auto& ref : references) { @@ -30,7 +30,7 @@ namespace RE }); } - EXTERIOR_DATA* TESObjectCELL::GetCoordinates() const + EXTERIOR_DATA* TESObjectCELL::GetCoordinates() const { return IsExterior() ? cellData.exterior : nullptr; } From 9e04b254115684de8e85e0153d8fecb91fdb18e1 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Mon, 27 Apr 2026 23:43:29 -0500 Subject: [PATCH 3/9] feat: more havok stuff + misc --- include/RE/A/AIProcess.h | 2 +- include/RE/A/ActiveEffect.h | 38 +- .../A/ActiveEffectReferenceEffectController.h | 2 +- include/RE/A/Actor.h | 2 +- include/RE/A/ActorMotionFeedbackData.h | 2 +- include/RE/A/AimModel.h | 2 +- include/RE/B/BGSCharacterMorph.h | 2 +- include/RE/B/BGSExplosionData.h | 2 +- include/RE/B/BGSPrimitive.h | 2 +- include/RE/B/BGSStaticCollection.h | 2 +- include/RE/B/BGSTransform.h | 2 +- include/RE/B/BGSZoomData.h | 2 +- include/RE/B/BIPED_OBJECT.h | 2 +- include/RE/B/BSAudioManager.h | 2 +- include/RE/B/BSBound.h | 2 +- include/RE/B/BSFurnitureMarker.h | 2 +- include/RE/B/BSGraphics.h | 2 +- include/RE/B/BSLensFlareSpriteData.h | 2 +- include/RE/B/BSMaterialObject.h | 2 +- include/RE/B/BSNavmeshGrid.h | 2 +- include/RE/B/BSNavmeshTriLocation.h | 2 +- include/RE/B/BSNavmeshVertex.h | 2 +- include/RE/B/BSNavmeshWaypoint.h | 2 +- include/RE/B/BSOcclusionBox.h | 2 +- include/RE/B/BSPathingAvoidNode.h | 2 +- include/RE/B/BSPathingFaceTarget.h | 2 +- include/RE/B/BSPathingGoal.h | 2 +- include/RE/B/BSPathingLocation.h | 2 +- include/RE/B/BSShaderAccumulator.h | 2 +- include/RE/B/BSShaderData.h | 2 +- include/RE/B/BSShaderManager.h | 2 +- include/RE/B/BSShaderMaterial.h | 2 +- include/RE/B/BSSpring_SpringState.h | 2 +- include/RE/B/BSTempEffectDebris.h | 2 +- include/RE/B/BSTempEffectGeometryDecal.h | 2 +- include/RE/B/BSTempEffectParticle.h | 2 +- include/RE/B/BSTerrainEffect.h | 2 +- include/RE/B/BSTransformDeltaEvent.h | 2 +- include/RE/B/BaseLoadedInventoryModel.h | 2 +- include/RE/B/BoneData.h | 2 +- include/RE/B/bhkCharacterController.h | 2 +- include/RE/B/bhkNPCollisionObject.h | 6 +- include/RE/B/bhkPickData.h | 2 +- include/RE/C/COL_LAYER.h | 2 +- include/RE/C/CameraStates.h | 2 +- include/RE/C/CombatUtilities.h | 3 +- include/RE/D/DECAL_CREATION_DATA.h | 2 +- include/RE/D/DamageImpactData.h | 2 +- include/RE/D/DesiredMovementData.h | 2 +- include/RE/D/DetectionEvent.h | 2 +- include/RE/D/DoorTeleportData.h | 2 +- include/RE/E/EquippedWeaponData.h | 1 - include/RE/E/Explosion.h | 2 +- include/RE/E/ExtraBendableSplineParams.h | 2 +- include/RE/E/ExtraDataList.h | 2 +- include/RE/F/FleePackage.h | 2 +- include/RE/F/FreeCameraState.h | 2 +- include/RE/Fallout.h | 5 +- include/RE/G/GridCellArray.h | 2 +- include/RE/H/HUDMenuUtils.h | 2 +- include/RE/H/HighProcessData.h | 2 +- include/RE/H/hkMatrix3.h | 72 +++ include/RE/H/hkTransform.h | 7 + include/RE/H/hkVector4.h | 153 ++++++ include/RE/H/hkVisualDebugger.h | 4 +- include/RE/H/hknpCapsuleShape.h | 34 ++ include/RE/I/IMovementState.h | 2 +- include/RE/I/IRendererResourceManager.h | 4 +- include/RE/I/IdleMovementData.h | 2 +- include/RE/I/ImpactResult.h | 2 +- include/RE/I/Interface3D.h | 2 +- include/RE/I/Inventory3DManager.h | 2 +- include/RE/IDs.h | 37 +- include/RE/L/LoadingMenu.h | 2 +- include/RE/L/LockpickingMenu.h | 2 +- include/RE/M/MenuTopicManager.h | 2 +- include/RE/M/MiddleHighProcessData.h | 2 +- include/RE/M/MissileProjectile.h | 2 +- include/RE/M/MoveData.h | 2 +- include/RE/M/MovementCorrection.h | 2 +- include/RE/M/MovementCorrectionData.h | 2 +- include/RE/M/MovementData.h | 2 +- include/RE/M/MovementTweenerOutputData.h | 2 +- include/RE/M/MovementVector.h | 2 +- include/RE/N/NEW_REFR_DATA.h | 2 +- include/RE/N/NiBound.h | 2 +- include/RE/N/NiCloningProcess.h | 2 +- include/RE/N/NiMatrix3.h | 110 +++- include/RE/N/NiObject.h | 8 +- include/RE/N/NiParticleInfo.h | 2 +- include/RE/N/NiPoint.h | 208 -------- include/RE/N/NiPoint2.h | 194 +++++++ include/RE/N/NiPoint3.h | 268 ++++++++++ include/RE/N/NiPoint4.h | 226 ++++++++ include/RE/N/NiTransform.h | 54 +- include/RE/O/OBJ_REFR.h | 2 +- include/RE/P/PART_DATA.h | 2 +- include/RE/P/PLAYER_TARGET_LOC.h | 2 +- include/RE/P/PipboyMapData.h | 2 +- include/RE/P/PlayerCamera.h | 2 +- include/RE/P/PlayerCharacter.h | 2 +- include/RE/P/PlayerControlsData.h | 2 +- include/RE/P/PlayerControlsMovementData.h | 2 +- include/RE/P/PlayerCoverData.h | 18 +- include/RE/P/Projectile.h | 38 +- include/RE/P/ProjectileLaunchData.h | 66 +-- include/RE/R/RACE_DATA.h | 90 ++-- include/RE/R/RACE_SIZE.h | 8 +- include/RE/R/RagDollBone.h | 2 +- include/RE/R/RagDollData.h | 2 +- include/RE/R/ReferenceEffectController.h | 2 +- include/RE/S/SpectatorPackage.h | 2 +- include/RE/S/SpectatorThreatInfo.h | 32 +- include/RE/S/SummonPlacementEffect.h | 2 +- include/RE/T/TESCameraState.h | 6 +- include/RE/T/TESImageSpaceModifier.h | 2 +- include/RE/T/TESNPC.h | 2 +- include/RE/T/TESObjectARMA.h | 2 +- include/RE/T/TESObjectREFR.h | 2 +- include/RE/T/TESRace.h | 2 +- include/RE/T/TESRegionPoint.h | 2 +- include/RE/T/TESWaterForm.h | 2 +- include/RE/T/TESWorldSpace.h | 2 +- include/RE/T/ThirdPersonState.h | 2 +- include/RE/W/WORLD_LOCATION.h | 2 +- include/RE/W/Workshop.h | 2 +- include/RE/W/WorkshopMenu.h | 2 +- src/RE/H/hkMatrix3.cpp | 73 --- src/RE/H/hkTransform.cpp | 8 - src/RE/H/hkVector4.cpp | 158 +----- src/RE/N/NiMatrix3.cpp | 157 +----- src/RE/N/NiPoint.cpp | 487 +----------------- src/RE/N/NiTransform.cpp | 53 -- 133 files changed, 1440 insertions(+), 1388 deletions(-) create mode 100644 include/RE/H/hknpCapsuleShape.h delete mode 100644 include/RE/N/NiPoint.h create mode 100644 include/RE/N/NiPoint2.h create mode 100644 include/RE/N/NiPoint3.h create mode 100644 include/RE/N/NiPoint4.h delete mode 100644 src/RE/H/hkMatrix3.cpp delete mode 100644 src/RE/H/hkTransform.cpp delete mode 100644 src/RE/N/NiTransform.cpp diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index f24f1fdc..d5ef04ed 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -7,7 +7,7 @@ #include "RE/B/BSPointerHandle.h" #include "RE/B/BSSimpleList.h" #include "RE/D/DEFAULT_OBJECT.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/A/ActiveEffect.h b/include/RE/A/ActiveEffect.h index 5080e352..ceb8a03d 100644 --- a/include/RE/A/ActiveEffect.h +++ b/include/RE/A/ActiveEffect.h @@ -16,7 +16,7 @@ namespace RE namespace MagicSystem { - enum class CastingSource; + enum class CastingSource : std::int32_t; } class __declspec(novtable) ActiveEffect : @@ -47,7 +47,7 @@ namespace RE enum class ConditionStatus : std::uint32_t { - kNotAvailable = static_cast>(-1), + kNotAvailable = 0xFFFFFFFF, kFalse = 0, kTrue = 1 }; @@ -62,23 +62,23 @@ namespace RE } // members - ActiveEffectReferenceEffectController hitEffectController; // 0C - BSSoundHandle persistentSound; // 30 - ActorHandle caster; // 38 - NiPointer sourceNode; // 40 - MagicItem* spell; // 48 - EffectItem* effect; // 50 - MagicTarget* target; // 58 - TESBoundObject* source; // 60 - BSSimpleList* hitEffects; // 68 - MagicItem* displacementSpell; // 70 - float elapsedSeconds; // 74 - float duration; // 78 - float magnitude; // 7C - REX::TEnumSet flags; // 80 - REX::TEnumSet conditionStatus; // 84 - std::uint16_t uniqueID; // 8C - REX::TEnumSet castingSource; // 90 + ActiveEffectReferenceEffectController hitEffectController; // 0C + BSSoundHandle persistentSound; // 30 + ActorHandle caster; // 38 + NiPointer sourceNode; // 40 + MagicItem* spell; // 48 + EffectItem* effect; // 50 + MagicTarget* target; // 58 + TESBoundObject* source; // 60 + BSSimpleList* hitEffects; // 68 + MagicItem* displacementSpell; // 70 + float elapsedSeconds; // 74 + float duration; // 78 + float magnitude; // 7C + REX::TEnumSet flags; // 80 + ConditionStatus conditionStatus; // 84 + std::uint16_t uniqueID; // 8C + MagicSystem::CastingSource castingSource; // 90 }; static_assert(sizeof(ActiveEffect) == 0x98); } diff --git a/include/RE/A/ActiveEffectReferenceEffectController.h b/include/RE/A/ActiveEffectReferenceEffectController.h index 2ae333b2..e340ff70 100644 --- a/include/RE/A/ActiveEffectReferenceEffectController.h +++ b/include/RE/A/ActiveEffectReferenceEffectController.h @@ -2,7 +2,7 @@ #include "RE/B/BSFixedString.h" #include "RE/B/BSPointerHandle.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/R/ReferenceEffectController.h" namespace RE diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index fccffbf7..6d5fa3d8 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -15,7 +15,7 @@ #include "RE/I/IPostAnimationChannelUpdateFunctor.h" #include "RE/M/MagicTarget.h" #include "RE/M/Modifiers.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiTFlags.h" #include "RE/O/ObjectEquipParams.h" #include "RE/S/SEX.h" diff --git a/include/RE/A/ActorMotionFeedbackData.h b/include/RE/A/ActorMotionFeedbackData.h index e934521e..c7cce725 100644 --- a/include/RE/A/ActorMotionFeedbackData.h +++ b/include/RE/A/ActorMotionFeedbackData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/A/AimModel.h b/include/RE/A/AimModel.h index 24f8d38b..7009a4ae 100644 --- a/include/RE/A/AimModel.h +++ b/include/RE/A/AimModel.h @@ -2,7 +2,7 @@ #include "RE/B/BGSAimModel.h" #include "RE/B/BSSpring_SpringState.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" namespace RE { diff --git a/include/RE/B/BGSCharacterMorph.h b/include/RE/B/BGSCharacterMorph.h index ce8b7545..4e3566b3 100644 --- a/include/RE/B/BGSCharacterMorph.h +++ b/include/RE/B/BGSCharacterMorph.h @@ -6,7 +6,7 @@ #include "RE/B/BSFixedString.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTHashMap.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BGSExplosionData.h b/include/RE/B/BGSExplosionData.h index eb49d7c9..73c6ab13 100644 --- a/include/RE/B/BGSExplosionData.h +++ b/include/RE/B/BGSExplosionData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BGSPrimitive.h b/include/RE/B/BGSPrimitive.h index c9d0d18d..8e974648 100644 --- a/include/RE/B/BGSPrimitive.h +++ b/include/RE/B/BGSPrimitive.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/BGSStaticCollection.h b/include/RE/B/BGSStaticCollection.h index 9d3cc1c4..a57f21dd 100644 --- a/include/RE/B/BGSStaticCollection.h +++ b/include/RE/B/BGSStaticCollection.h @@ -3,7 +3,7 @@ #include "RE/B/BGSModelMaterialSwap.h" #include "RE/B/BSSimpleList.h" #include "RE/B/BSTHashMap.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/T/TESBoundObject.h" namespace RE diff --git a/include/RE/B/BGSTransform.h b/include/RE/B/BGSTransform.h index 67d362ec..fb3ad6e7 100644 --- a/include/RE/B/BGSTransform.h +++ b/include/RE/B/BGSTransform.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/T/TESForm.h" namespace RE diff --git a/include/RE/B/BGSZoomData.h b/include/RE/B/BGSZoomData.h index 612dbb4b..98b65b49 100644 --- a/include/RE/B/BGSZoomData.h +++ b/include/RE/B/BGSZoomData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/T/TESForm.h" namespace RE diff --git a/include/RE/B/BIPED_OBJECT.h b/include/RE/B/BIPED_OBJECT.h index a5650408..ac755df0 100644 --- a/include/RE/B/BIPED_OBJECT.h +++ b/include/RE/B/BIPED_OBJECT.h @@ -2,7 +2,7 @@ namespace RE { - enum class BIPED_OBJECT + enum class BIPED_OBJECT : std::int32_t { kNone = static_cast>(-1), kHairTop = 0, diff --git a/include/RE/B/BSAudioManager.h b/include/RE/B/BSAudioManager.h index b2472cb7..a069c1be 100644 --- a/include/RE/B/BSAudioManager.h +++ b/include/RE/B/BSAudioManager.h @@ -6,7 +6,7 @@ #include "RE/B/BSSoundHandle.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTHashMap.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/BSBound.h b/include/RE/B/BSBound.h index 91895eef..56b6efa8 100644 --- a/include/RE/B/BSBound.h +++ b/include/RE/B/BSBound.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiExtraData.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSFurnitureMarker.h b/include/RE/B/BSFurnitureMarker.h index 1066c7dc..39e99963 100644 --- a/include/RE/B/BSFurnitureMarker.h +++ b/include/RE/B/BSFurnitureMarker.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSGraphics.h b/include/RE/B/BSGraphics.h index f3ecb43e..d529f243 100644 --- a/include/RE/B/BSGraphics.h +++ b/include/RE/B/BSGraphics.h @@ -5,7 +5,7 @@ #include "RE/B/BSTAtomicValue.h" #include "RE/B/BSTHashMap.h" #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint4.h" #include "RE/N/NiPointer.h" #include "RE/N/NiRect.h" #include "RE/N/NiTexture.h" diff --git a/include/RE/B/BSLensFlareSpriteData.h b/include/RE/B/BSLensFlareSpriteData.h index 27ac01c4..7ad62a72 100644 --- a/include/RE/B/BSLensFlareSpriteData.h +++ b/include/RE/B/BSLensFlareSpriteData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiColor.h" namespace RE { diff --git a/include/RE/B/BSMaterialObject.h b/include/RE/B/BSMaterialObject.h index 323739c5..3b3a5eac 100644 --- a/include/RE/B/BSMaterialObject.h +++ b/include/RE/B/BSMaterialObject.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSTArray.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/BSNavmeshGrid.h b/include/RE/B/BSNavmeshGrid.h index fe918d05..9add8797 100644 --- a/include/RE/B/BSNavmeshGrid.h +++ b/include/RE/B/BSNavmeshGrid.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSTArray.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSNavmeshTriLocation.h b/include/RE/B/BSNavmeshTriLocation.h index 8d2bcd18..3cc7b02a 100644 --- a/include/RE/B/BSNavmeshTriLocation.h +++ b/include/RE/B/BSNavmeshTriLocation.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSNavmeshTriHandle.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSNavmeshVertex.h b/include/RE/B/BSNavmeshVertex.h index adbb1c6e..71fc1efa 100644 --- a/include/RE/B/BSNavmeshVertex.h +++ b/include/RE/B/BSNavmeshVertex.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSNavmeshWaypoint.h b/include/RE/B/BSNavmeshWaypoint.h index 572934d3..947984f8 100644 --- a/include/RE/B/BSNavmeshWaypoint.h +++ b/include/RE/B/BSNavmeshWaypoint.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSOcclusionBox.h b/include/RE/B/BSOcclusionBox.h index 45e507eb..61e2bbd6 100644 --- a/include/RE/B/BSOcclusionBox.h +++ b/include/RE/B/BSOcclusionBox.h @@ -2,7 +2,7 @@ #include "RE/B/BSOcclusionShape.h" #include "RE/N/NiFrustumPlanes.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSPathingAvoidNode.h b/include/RE/B/BSPathingAvoidNode.h index 3ce970f2..ec2f85d4 100644 --- a/include/RE/B/BSPathingAvoidNode.h +++ b/include/RE/B/BSPathingAvoidNode.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSPathingFaceTarget.h b/include/RE/B/BSPathingFaceTarget.h index 1b7b40be..fa1b9e3e 100644 --- a/include/RE/B/BSPathingFaceTarget.h +++ b/include/RE/B/BSPathingFaceTarget.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSPathingGoal.h b/include/RE/B/BSPathingGoal.h index f84368f2..72a71c2b 100644 --- a/include/RE/B/BSPathingGoal.h +++ b/include/RE/B/BSPathingGoal.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSPathingLocation.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSPathingLocation.h b/include/RE/B/BSPathingLocation.h index f48d8d90..2ac1fbc1 100644 --- a/include/RE/B/BSPathingLocation.h +++ b/include/RE/B/BSPathingLocation.h @@ -2,7 +2,7 @@ #include "RE/B/BSTArray.h" #include "RE/B/BSTSmartPointer.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSShaderAccumulator.h b/include/RE/B/BSShaderAccumulator.h index 758aa6c4..232bed9e 100644 --- a/include/RE/B/BSShaderAccumulator.h +++ b/include/RE/B/BSShaderAccumulator.h @@ -4,7 +4,7 @@ #include "RE/B/BSShaderManager.h" #include "RE/N/NiAlphaAccumulator.h" #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/S/SunOcclusionTest.h" diff --git a/include/RE/B/BSShaderData.h b/include/RE/B/BSShaderData.h index c2e3377b..3313620d 100644 --- a/include/RE/B/BSShaderData.h +++ b/include/RE/B/BSShaderData.h @@ -5,7 +5,7 @@ #include "RE/B/BSTArray.h" #include "RE/N/NiAlphaProperty.h" #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/BSShaderManager.h b/include/RE/B/BSShaderManager.h index b6ccf975..808a165b 100644 --- a/include/RE/B/BSShaderManager.h +++ b/include/RE/B/BSShaderManager.h @@ -2,7 +2,7 @@ #include "RE/B/BSGeometry.h" #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/N/NiTexture.h" #include "RE/N/NiTransform.h" diff --git a/include/RE/B/BSShaderMaterial.h b/include/RE/B/BSShaderMaterial.h index 59042a37..1ed925ff 100644 --- a/include/RE/B/BSShaderMaterial.h +++ b/include/RE/B/BSShaderMaterial.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSIntrusiveRefCounted.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" namespace RE { diff --git a/include/RE/B/BSSpring_SpringState.h b/include/RE/B/BSSpring_SpringState.h index 36242861..a7e56ee6 100644 --- a/include/RE/B/BSSpring_SpringState.h +++ b/include/RE/B/BSSpring_SpringState.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/BSTempEffectDebris.h b/include/RE/B/BSTempEffectDebris.h index 61db605d..2c583ca4 100644 --- a/include/RE/B/BSTempEffectDebris.h +++ b/include/RE/B/BSTempEffectDebris.h @@ -3,7 +3,7 @@ #include "RE/B/BSTempEffect.h" #include "RE/N/NiAVObject.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/BSTempEffectGeometryDecal.h b/include/RE/B/BSTempEffectGeometryDecal.h index 0bbbf2b6..8a33b0d4 100644 --- a/include/RE/B/BSTempEffectGeometryDecal.h +++ b/include/RE/B/BSTempEffectGeometryDecal.h @@ -2,7 +2,7 @@ #include "RE/B/BSTempEffect.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/BSTempEffectParticle.h b/include/RE/B/BSTempEffectParticle.h index 219a18a3..905d03ff 100644 --- a/include/RE/B/BSTempEffectParticle.h +++ b/include/RE/B/BSTempEffectParticle.h @@ -3,7 +3,7 @@ #include "RE/B/BSSoundHandle.h" #include "RE/B/BSTempEffect.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/N/NiTransform.h" diff --git a/include/RE/B/BSTerrainEffect.h b/include/RE/B/BSTerrainEffect.h index 6ffd80b7..602addcd 100644 --- a/include/RE/B/BSTerrainEffect.h +++ b/include/RE/B/BSTerrainEffect.h @@ -6,7 +6,7 @@ #include "RE/B/BSTEvent.h" #include "RE/B/BSTempEffect.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/N/NiQuaternion.h" diff --git a/include/RE/B/BSTransformDeltaEvent.h b/include/RE/B/BSTransformDeltaEvent.h index 2c6d5d51..167d7a57 100644 --- a/include/RE/B/BSTransformDeltaEvent.h +++ b/include/RE/B/BSTransformDeltaEvent.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint4.h" namespace RE { diff --git a/include/RE/B/BaseLoadedInventoryModel.h b/include/RE/B/BaseLoadedInventoryModel.h index 78333166..143ffacb 100644 --- a/include/RE/B/BaseLoadedInventoryModel.h +++ b/include/RE/B/BaseLoadedInventoryModel.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BGSCreatedObjectManager.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/BoneData.h b/include/RE/B/BoneData.h index 2b721a08..aff1bcfb 100644 --- a/include/RE/B/BoneData.h +++ b/include/RE/B/BoneData.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/B/bhkCharacterController.h b/include/RE/B/bhkCharacterController.h index 0632cf98..cc24b61c 100644 --- a/include/RE/B/bhkCharacterController.h +++ b/include/RE/B/bhkCharacterController.h @@ -10,7 +10,7 @@ #include "RE/H/hknpCharacterContext.h" #include "RE/H/hknpCharacterState.h" #include "RE/H/hknpCharacterSurfaceInfo.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/B/bhkNPCollisionObject.h b/include/RE/B/bhkNPCollisionObject.h index b34e5843..ac4c6a03 100644 --- a/include/RE/B/bhkNPCollisionObject.h +++ b/include/RE/B/bhkNPCollisionObject.h @@ -23,8 +23,8 @@ namespace RE inline static constexpr auto Ni_RTTI{ Ni_RTTI::bhkNPCollisionObject }; // add - virtual void CreateInstance(bhkWorld& a_world); // 2D - virtual void AddToWorld(bhkWorld& a_world); // 2E + virtual void CreateInstance(bhkWorld* a_world); // 2D + virtual void AddToWorld(bhkWorld* a_world); // 2E virtual void RemoveFromWorld(); // 2F virtual bool SetCollisionFilterInfo(CFilter a_filterInfo); // 30 @@ -32,7 +32,7 @@ namespace RE { using func_t = decltype(&bhkNPCollisionObject::CreateObject); static REL::Relocation func{ ID::bhkNPCollisionObject::CreateObject }; - func(); + return func(); } void CopyMembers(bhkNPCollisionObject* a_dest, NiCloningProcess& a_cloningProcess) diff --git a/include/RE/B/bhkPickData.h b/include/RE/B/bhkPickData.h index 26f0010e..88d78cd4 100644 --- a/include/RE/B/bhkPickData.h +++ b/include/RE/B/bhkPickData.h @@ -4,7 +4,6 @@ #include "RE/H/hknpRayCastQuery.h" #include "RE/H/hknpRayCastQueryResult.h" #include "RE/M/MemoryManager.h" -#include "RE/N/NiPoint.h" namespace RE { @@ -12,6 +11,7 @@ namespace RE class hknpBSWorld; class hknpCollisionQueryCollector; class NiAVObject; + class NiPoint3; class bhkPickData { diff --git a/include/RE/C/COL_LAYER.h b/include/RE/C/COL_LAYER.h index 6a45ea69..e9c6194b 100644 --- a/include/RE/C/COL_LAYER.h +++ b/include/RE/C/COL_LAYER.h @@ -2,7 +2,7 @@ namespace RE { - enum class COL_LAYER + enum class COL_LAYER : std::int32_t { kUnidentified = 0, kStatic = 1, diff --git a/include/RE/C/CameraStates.h b/include/RE/C/CameraStates.h index 67f45be9..487aa007 100644 --- a/include/RE/C/CameraStates.h +++ b/include/RE/C/CameraStates.h @@ -5,7 +5,7 @@ namespace RE class CameraStates { public: - enum CameraState : std::uint32_t + enum CameraState : std::int32_t { kFirstPerson = 0x0, kAutoVanity = 0x1, diff --git a/include/RE/C/CombatUtilities.h b/include/RE/C/CombatUtilities.h index 66d5afa1..1cb21399 100644 --- a/include/RE/C/CombatUtilities.h +++ b/include/RE/C/CombatUtilities.h @@ -1,10 +1,9 @@ #pragma once -#include "RE/N/NiPoint.h" - namespace RE { class bhkPickData; + class NiPoint3; namespace CombatUtilities { diff --git a/include/RE/D/DECAL_CREATION_DATA.h b/include/RE/D/DECAL_CREATION_DATA.h index 439ca0c2..b0463831 100644 --- a/include/RE/D/DECAL_CREATION_DATA.h +++ b/include/RE/D/DECAL_CREATION_DATA.h @@ -3,7 +3,7 @@ #include "RE/B/BSPointerHandle.h" #include "RE/N/NiColor.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/D/DamageImpactData.h b/include/RE/D/DamageImpactData.h index 139016e3..1819fb3d 100644 --- a/include/RE/D/DamageImpactData.h +++ b/include/RE/D/DamageImpactData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/D/DesiredMovementData.h b/include/RE/D/DesiredMovementData.h index 7ceb7cc5..8d42c57f 100644 --- a/include/RE/D/DesiredMovementData.h +++ b/include/RE/D/DesiredMovementData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/D/DetectionEvent.h b/include/RE/D/DetectionEvent.h index 7f27fae9..71e8b6fe 100644 --- a/include/RE/D/DetectionEvent.h +++ b/include/RE/D/DetectionEvent.h @@ -2,7 +2,7 @@ #include "RE/A/AITimeStamp.h" #include "RE/B/BSPointerHandle.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/D/DoorTeleportData.h b/include/RE/D/DoorTeleportData.h index 9eaa568e..d37a806e 100644 --- a/include/RE/D/DoorTeleportData.h +++ b/include/RE/D/DoorTeleportData.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSPointerHandle.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/E/EquippedWeaponData.h b/include/RE/E/EquippedWeaponData.h index b1cdddbc..8ae19936 100644 --- a/include/RE/E/EquippedWeaponData.h +++ b/include/RE/E/EquippedWeaponData.h @@ -5,7 +5,6 @@ #include "RE/B/BSTArray.h" #include "RE/B/BSTTuple.h" #include "RE/E/EquippedItemData.h" -#include "RE/N/NiPoint.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/E/Explosion.h b/include/RE/E/Explosion.h index 3593a8ed..332bdcfe 100644 --- a/include/RE/E/Explosion.h +++ b/include/RE/E/Explosion.h @@ -8,7 +8,7 @@ #include "RE/B/BSTArray.h" #include "RE/B/BSTSmartPointer.h" #include "RE/H/hknpClosestUniqueBodyIdHitCollector.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/T/TESObjectREFR.h" diff --git a/include/RE/E/ExtraBendableSplineParams.h b/include/RE/E/ExtraBendableSplineParams.h index fc79a3e1..8b4b404b 100644 --- a/include/RE/E/ExtraBendableSplineParams.h +++ b/include/RE/E/ExtraBendableSplineParams.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSExtraData.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/E/ExtraDataList.h b/include/RE/E/ExtraDataList.h index ceacbe12..be7d6d97 100644 --- a/include/RE/E/ExtraDataList.h +++ b/include/RE/E/ExtraDataList.h @@ -7,13 +7,13 @@ #include "RE/B/BaseExtraList.h" #include "RE/E/EXTRA_DATA_TYPE.h" #include "RE/M/MemoryManager.h" -#include "RE/N/NiPoint.h" #include "RE/T/TBO_InstanceData.h" namespace RE { class BGSObjectInstanceExtra; class BGSPrimitive; + class NiPoint3; namespace detail { diff --git a/include/RE/F/FleePackage.h b/include/RE/F/FleePackage.h index 2687f79b..a06db38e 100644 --- a/include/RE/F/FleePackage.h +++ b/include/RE/F/FleePackage.h @@ -2,7 +2,7 @@ #include "RE/B/BSPointerHandle.h" #include "RE/B/BSTArray.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/T/TESPackage.h" namespace RE diff --git a/include/RE/F/FreeCameraState.h b/include/RE/F/FreeCameraState.h index 7d78065e..66aa5234 100644 --- a/include/RE/F/FreeCameraState.h +++ b/include/RE/F/FreeCameraState.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSTPoint.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/T/TESCameraState.h" namespace RE diff --git a/include/RE/Fallout.h b/include/RE/Fallout.h index aaeec1ab..7169b282 100644 --- a/include/RE/Fallout.h +++ b/include/RE/Fallout.h @@ -794,6 +794,7 @@ #include "RE/H/hknpBodyId.h" #include "RE/H/hknpBodyManager.h" #include "RE/H/hknpBodyQualityId.h" +#include "RE/H/hknpCapsuleShape.h" #include "RE/H/hknpCharacterContext.h" #include "RE/H/hknpCharacterState.h" #include "RE/H/hknpCharacterSurfaceInfo.h" @@ -1005,7 +1006,9 @@ #include "RE/N/NiObjectNET.h" #include "RE/N/NiParticleInfo.h" #include "RE/N/NiPlane.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" +#include "RE/N/NiPoint3.h" +#include "RE/N/NiPoint4.h" #include "RE/N/NiPointer.h" #include "RE/N/NiProperty.h" #include "RE/N/NiQuaternion.h" diff --git a/include/RE/G/GridCellArray.h b/include/RE/G/GridCellArray.h index e90257e8..93a954b4 100644 --- a/include/RE/G/GridCellArray.h +++ b/include/RE/G/GridCellArray.h @@ -3,7 +3,7 @@ #include "RE/B/BSTArray.h" #include "RE/G/GridArray.h" #include "RE/G/GridCell.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/H/HUDMenuUtils.h b/include/RE/H/HUDMenuUtils.h index 90591011..f78da35b 100644 --- a/include/RE/H/HUDMenuUtils.h +++ b/include/RE/H/HUDMenuUtils.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/H/HighProcessData.h b/include/RE/H/HighProcessData.h index 99296b8b..ec492a8e 100644 --- a/include/RE/H/HighProcessData.h +++ b/include/RE/H/HighProcessData.h @@ -5,7 +5,7 @@ #include "RE/I/IDLE_REPLAY_DELAY.h" #include "RE/M/MovementLargeDelta.h" #include "RE/N/NiBillboardNode.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NonMorphFaceManagement.h" #include "RE/R/ReanimateData.h" #include "RE/T/TESShout.h" diff --git a/include/RE/H/hkMatrix3.h b/include/RE/H/hkMatrix3.h index 1931358e..cebae0f5 100644 --- a/include/RE/H/hkMatrix3.h +++ b/include/RE/H/hkMatrix3.h @@ -28,3 +28,75 @@ namespace RE using hkMatrix3 = hkMatrix3f; } + +namespace RE +{ + constexpr hkMatrix3f::hkMatrix3f(const hkVector4f& a_vec0, const hkVector4f& a_vec1, const hkVector4f& a_vec2) noexcept + { + col[0] = a_vec0; + col[1] = a_vec1; + col[2] = a_vec2; + } + + constexpr hkMatrix3f::hkMatrix3f( + float a_x0, float a_y0, float a_z0, float a_w0, + float a_x1, float a_y1, float a_z1, float a_w1, + float a_x2, float a_y2, float a_z2, float a_w2) noexcept + { + col[0] = { a_x0, a_y0, a_z0, a_w0 }; + col[1] = { a_x1, a_y1, a_z1, a_w1 }; + col[2] = { a_x2, a_y2, a_z2, a_w2 }; + } + + constexpr hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 3); + return col[a_pos]; + } + + constexpr const hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 3); + return col[a_pos]; + } + + constexpr bool hkMatrix3f::operator==(const hkMatrix3f& a_rhs) const noexcept + { + return (col[0] == a_rhs[0]) && (col[1] == a_rhs[1]) && (col[2] == a_rhs[2]); + } + + constexpr bool hkMatrix3f::operator!=(const hkMatrix3f& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr hkMatrix3f hkMatrix3f::operator*(const hkMatrix3f& a_rhs) const noexcept + { + hkMatrix3f result; + result[0][0] = col[0][0] * a_rhs[0][0] + col[0][1] * a_rhs[1][0] + col[0][2] * a_rhs[2][0]; + result[1][0] = col[1][0] * a_rhs[0][0] + col[1][1] * a_rhs[1][0] + col[1][2] * a_rhs[2][0]; + result[2][0] = col[2][0] * a_rhs[0][0] + col[2][1] * a_rhs[1][0] + col[2][2] * a_rhs[2][0]; + result[0][1] = col[0][0] * a_rhs[0][1] + col[0][1] * a_rhs[1][1] + col[0][2] * a_rhs[2][1]; + result[1][1] = col[1][0] * a_rhs[0][1] + col[1][1] * a_rhs[1][1] + col[1][2] * a_rhs[2][1]; + result[2][1] = col[2][0] * a_rhs[0][1] + col[2][1] * a_rhs[1][1] + col[2][2] * a_rhs[2][1]; + result[0][2] = col[0][0] * a_rhs[0][2] + col[0][1] * a_rhs[1][2] + col[0][2] * a_rhs[2][2]; + result[1][2] = col[1][0] * a_rhs[0][2] + col[1][1] * a_rhs[1][2] + col[1][2] * a_rhs[2][2]; + result[2][2] = col[2][0] * a_rhs[0][2] + col[2][1] * a_rhs[1][2] + col[2][2] * a_rhs[2][2]; + return result; + } + + constexpr hkMatrix3f hkMatrix3f::operator*(float a_scalar) const noexcept + { + hkMatrix3f result; + result[0][0] = col[0][0] * a_scalar; + result[0][1] = col[0][1] * a_scalar; + result[0][2] = col[0][2] * a_scalar; + result[1][0] = col[1][0] * a_scalar; + result[1][1] = col[1][1] * a_scalar; + result[1][2] = col[1][2] * a_scalar; + result[2][0] = col[2][0] * a_scalar; + result[2][1] = col[2][1] * a_scalar; + result[2][2] = col[2][2] * a_scalar; + return result; + } +} diff --git a/include/RE/H/hkTransform.h b/include/RE/H/hkTransform.h index 2e79dad6..5ef63ab5 100644 --- a/include/RE/H/hkTransform.h +++ b/include/RE/H/hkTransform.h @@ -17,3 +17,10 @@ namespace RE using hkTransform = hkTransformf; } + +namespace RE +{ + constexpr hkTransformf::hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept : + rotation(a_rotation), translation(a_translation) + {} +} diff --git a/include/RE/H/hkVector4.h b/include/RE/H/hkVector4.h index b2816530..9c866b02 100644 --- a/include/RE/H/hkVector4.h +++ b/include/RE/H/hkVector4.h @@ -48,3 +48,156 @@ namespace RE using hkVector4 = hkVector4f; }; + +namespace RE +{ + inline constexpr hkVector4f hkVector4f::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; + + constexpr hkVector4f::hkVector4f(float a_x, float a_y, float a_z, float a_w) noexcept : + x(a_x), y(a_y), z(a_z), w(a_w) + {} + + constexpr float& hkVector4f::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 4); + return std::addressof(x)[a_pos]; + } + + constexpr const float& hkVector4f::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 4); + return std::addressof(x)[a_pos]; + } + + constexpr bool hkVector4f::operator==(const hkVector4f& a_rhs) const noexcept + { + return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z) && (w == a_rhs.w); + } + + constexpr bool hkVector4f::operator!=(const hkVector4f& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr bool hkVector4f::operator<(const hkVector4f& a_rhs) const noexcept + { + return std::tie(x, y, z, w) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); + } + + constexpr bool hkVector4f::operator>(const hkVector4f& a_rhs) const noexcept + { + return std::tie(x, y, z, w) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator+(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z, w + a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator-(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z, w - a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator*(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z, w * a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator/(const hkVector4f& a_rhs) const noexcept + { + return hkVector4f(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z, w / a_rhs.w); + } + + constexpr hkVector4f hkVector4f::operator*(float a_scalar) const noexcept + { + return hkVector4f(x * a_scalar, y * a_scalar, z * a_scalar, w * a_scalar); + } + + constexpr hkVector4f hkVector4f::operator/(float a_scalar) const noexcept + { + return operator*(1.0F / a_scalar); + } + + constexpr hkVector4f hkVector4f::operator-() const noexcept + { + return hkVector4f(-x, -y, -z, -w); + } + + constexpr hkVector4f& hkVector4f::operator+=(const hkVector4f& a_rhs) noexcept + { + x += a_rhs.x; + y += a_rhs.y; + z += a_rhs.z; + w += a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator-=(const hkVector4f& a_rhs) noexcept + { + x -= a_rhs.x; + y -= a_rhs.y; + z -= a_rhs.z; + w -= a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator*=(const hkVector4f& a_rhs) noexcept + { + x *= a_rhs.x; + y *= a_rhs.y; + z *= a_rhs.z; + w *= a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator/=(const hkVector4f& a_rhs) noexcept + { + x /= a_rhs.x; + y /= a_rhs.y; + z /= a_rhs.z; + w /= a_rhs.w; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator+=(float a_scalar) noexcept + { + x += a_scalar; + y += a_scalar; + z += a_scalar; + w += a_scalar; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator-=(float a_scalar) noexcept + { + x -= a_scalar; + y -= a_scalar; + z -= a_scalar; + w -= a_scalar; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator*=(float a_scalar) noexcept + { + x *= a_scalar; + y *= a_scalar; + z *= a_scalar; + w *= a_scalar; + return *this; + } + + constexpr hkVector4f& hkVector4f::operator/=(float a_scalar) noexcept + { + x /= a_scalar; + y /= a_scalar; + z /= a_scalar; + w /= a_scalar; + return *this; + } + + constexpr float hkVector4f::Dot(const hkVector4f& v) const + { + return this->x * v.x + this->y * v.y + this->z * v.z; + } +} diff --git a/include/RE/H/hkVisualDebugger.h b/include/RE/H/hkVisualDebugger.h index 6263426f..77e46c10 100644 --- a/include/RE/H/hkVisualDebugger.h +++ b/include/RE/H/hkVisualDebugger.h @@ -32,8 +32,8 @@ namespace RE } // add - virtual void Step(float a_frameTime) {} // 04 - virtual void PollForNewClients() {} // 05 + virtual void Step([[maybe_unused]] float a_frameTime) {} // 04 + virtual void PollForNewClients() {} // 05 void AddContext(hkProcessContext* a_context) { diff --git a/include/RE/H/hknpCapsuleShape.h b/include/RE/H/hknpCapsuleShape.h new file mode 100644 index 00000000..a5396bcf --- /dev/null +++ b/include/RE/H/hknpCapsuleShape.h @@ -0,0 +1,34 @@ +#pragma once + +#include "RE/H/hkVector4.h" +#include "RE/H/hknpConvexPolytopeShape.h" + +namespace RE +{ + class __declspec(novtable) hknpCapsuleShape : + public hknpConvexPolytopeShape + { + public: + inline static constexpr auto RTTI{ RTTI::hknpCapsuleShape }; + inline static constexpr auto VTABLE{ VTABLE::hknpCapsuleShape }; + + void Init(const hkVector4f& a_vertexA, const hkVector4f& a_vertexB) + { + using func_t = decltype(&hknpCapsuleShape::Init); + static REL::Relocation func{ ID::hknpCapsuleShape::Init }; + return func(this, a_vertexA, a_vertexB); + } + + static hknpCapsuleShape* CreateCapsuleShape(const hkVector4f& a_vertexA, const hkVector4f& a_vertexB, float a_radius) + { + using func_t = decltype(&hknpCapsuleShape::CreateCapsuleShape); + static REL::Relocation func{ ID::hknpCapsuleShape::CreateCapsuleShape }; + return func(a_vertexA, a_vertexB, a_radius); + } + + // members + hkVector4f vertexA; // 0x50 + hkVector4f vertexB; // 0x60 + }; + static_assert(sizeof(hknpCapsuleShape) == 0x70); +} diff --git a/include/RE/I/IMovementState.h b/include/RE/I/IMovementState.h index 44b58777..c811e6a4 100644 --- a/include/RE/I/IMovementState.h +++ b/include/RE/I/IMovementState.h @@ -3,13 +3,13 @@ #include "RE/B/BSTSmartPointer.h" #include "RE/I/IMovementInterface.h" #include "RE/M/Movement.h" -#include "RE/N/NiPoint.h" namespace RE { class BSPathingLocation; class BSPathingRequest; class IMovementParameters; + class NiPoint3; class __declspec(novtable) IMovementState : public IMovementInterface // 0 diff --git a/include/RE/I/IRendererResourceManager.h b/include/RE/I/IRendererResourceManager.h index 683f0c16..a84419d3 100644 --- a/include/RE/I/IRendererResourceManager.h +++ b/include/RE/I/IRendererResourceManager.h @@ -1,7 +1,5 @@ #pragma once -#include "RE/N/NiPoint.h" - namespace RE { class BSDynamicLines; @@ -17,6 +15,8 @@ namespace RE class NiDefaultAVObjectPalette; class NiNode; class NiPick; + class NiPoint2; + class NiPoint3; class NiShadeProperty; class NiStream; class NiTexture; diff --git a/include/RE/I/IdleMovementData.h b/include/RE/I/IdleMovementData.h index 0f1c6fd4..521b1884 100644 --- a/include/RE/I/IdleMovementData.h +++ b/include/RE/I/IdleMovementData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/I/ImpactResult.h b/include/RE/I/ImpactResult.h index 0314a090..b1a84fe8 100644 --- a/include/RE/I/ImpactResult.h +++ b/include/RE/I/ImpactResult.h @@ -2,7 +2,7 @@ namespace RE { - enum class ImpactResult + enum class ImpactResult : std::int32_t { kNone = 0x0, kDestroy = 0x1, diff --git a/include/RE/I/Interface3D.h b/include/RE/I/Interface3D.h index e273f94a..731e0e91 100644 --- a/include/RE/I/Interface3D.h +++ b/include/RE/I/Interface3D.h @@ -4,7 +4,7 @@ #include "RE/B/BSSpinLock.h" #include "RE/B/BSTArray.h" #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/U/UIShaderFXInfo.h" #include "Scaleform/G/GFx_Movie.h" diff --git a/include/RE/I/Inventory3DManager.h b/include/RE/I/Inventory3DManager.h index fd85ebbb..7ddf1d61 100644 --- a/include/RE/I/Inventory3DManager.h +++ b/include/RE/I/Inventory3DManager.h @@ -7,7 +7,7 @@ #include "RE/B/BSTHashMap.h" #include "RE/B/BSTSmartPointer.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/N/NiQuaternion.h" diff --git a/include/RE/IDs.h b/include/RE/IDs.h index b76d2d59..388727aa 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -1089,6 +1089,12 @@ namespace RE::ID inline constexpr REL::ID Get{ 2194566 }; } + namespace hknpCapsuleShape + { + inline constexpr REL::ID Init{ 2257217 }; + inline constexpr REL::ID CreateCapsuleShape{ 2257207 }; + } + namespace hkContainerHeapAllocator { inline constexpr REL::ID Singleton{ 2665426 }; @@ -1462,18 +1468,18 @@ namespace RE::ID namespace NiMatrix3 { - inline constexpr REL::ID ToEulerAnglesXYZ1{ 2269806 }; - inline constexpr REL::ID ToEulerAnglesXZY2{ 2269807 }; - inline constexpr REL::ID ToEulerAnglesYXZ3{ 2269808 }; - inline constexpr REL::ID ToEulerAnglesYZX4{ 2269809 }; - inline constexpr REL::ID ToEulerAnglesZYX5{ 2269810 }; - inline constexpr REL::ID ToEulerAnglesZXY6{ 2269824 }; - inline constexpr REL::ID FromEulerAnglesXYZ1{ 2269813 }; - inline constexpr REL::ID FromEulerAnglesXZY2{ 2269814 }; - inline constexpr REL::ID FromEulerAnglesYXZ3{ 2269815 }; - inline constexpr REL::ID FromEulerAnglesYZX4{ 2269816 }; - inline constexpr REL::ID FromEulerAnglesZYX5{ 2269817 }; - inline constexpr REL::ID FromEulerAnglesZXY6{ 2269825 }; + inline constexpr REL::ID ToEulerAnglesXYZ{ 2269806 }; + inline constexpr REL::ID ToEulerAnglesXZY{ 2269807 }; + inline constexpr REL::ID ToEulerAnglesYXZ{ 2269808 }; + inline constexpr REL::ID ToEulerAnglesYZX{ 2269809 }; + inline constexpr REL::ID ToEulerAnglesZYX{ 2269810 }; + inline constexpr REL::ID ToEulerAnglesZXY{ 2269824 }; + inline constexpr REL::ID FromEulerAnglesXYZ{ 2269813 }; + inline constexpr REL::ID FromEulerAnglesXZY{ 2269814 }; + inline constexpr REL::ID FromEulerAnglesYXZ{ 2269815 }; + inline constexpr REL::ID FromEulerAnglesYZX{ 2269816 }; + inline constexpr REL::ID FromEulerAnglesZYX{ 2269817 }; + inline constexpr REL::ID FromEulerAnglesZXY{ 2269825 }; } namespace NiNode @@ -1481,12 +1487,9 @@ namespace RE::ID inline constexpr REL::ID ChildrenVTable{ 390064 }; } - namespace NiPoint + namespace NiPoint3 { - namespace NiPoint3 - { - inline constexpr REL::ID GetZAngleFromVector{ 2269788 }; - } + inline constexpr REL::ID GetZAngleFromVector{ 2269788 }; } namespace NiRefObject diff --git a/include/RE/L/LoadingMenu.h b/include/RE/L/LoadingMenu.h index 980816a3..a6216763 100644 --- a/include/RE/L/LoadingMenu.h +++ b/include/RE/L/LoadingMenu.h @@ -5,7 +5,7 @@ #include "RE/G/GameMenuBase.h" #include "RE/I/ImageSpaceLUTData.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/L/LockpickingMenu.h b/include/RE/L/LockpickingMenu.h index 28154c62..2b445698 100644 --- a/include/RE/L/LockpickingMenu.h +++ b/include/RE/L/LockpickingMenu.h @@ -3,7 +3,7 @@ #include "RE/B/BSSoundHandle.h" #include "RE/G/GameMenuBase.h" #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/include/RE/M/MenuTopicManager.h b/include/RE/M/MenuTopicManager.h index 31ee6fdc..681032f9 100644 --- a/include/RE/M/MenuTopicManager.h +++ b/include/RE/M/MenuTopicManager.h @@ -4,7 +4,7 @@ #include "RE/B/BSTEvent.h" #include "RE/B/BSTSingleton.h" #include "RE/B/BSTSmartPointer.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/M/MiddleHighProcessData.h b/include/RE/M/MiddleHighProcessData.h index 27ad4fdf..5bbd438f 100644 --- a/include/RE/M/MiddleHighProcessData.h +++ b/include/RE/M/MiddleHighProcessData.h @@ -11,7 +11,7 @@ #include "RE/B/BSTEvent.h" #include "RE/B/BSTSmartPointer.h" #include "RE/B/BSTTuple.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/S/SubgraphHandle.h" #include "RE/S/SubgraphIdentifier.h" diff --git a/include/RE/M/MissileProjectile.h b/include/RE/M/MissileProjectile.h index 535faa71..e99ef450 100644 --- a/include/RE/M/MissileProjectile.h +++ b/include/RE/M/MissileProjectile.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/P/Projectile.h" diff --git a/include/RE/M/MoveData.h b/include/RE/M/MoveData.h index ec93c609..73f829b0 100644 --- a/include/RE/M/MoveData.h +++ b/include/RE/M/MoveData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/M/MovementCorrection.h b/include/RE/M/MovementCorrection.h index 5de3bdcb..43874705 100644 --- a/include/RE/M/MovementCorrection.h +++ b/include/RE/M/MovementCorrection.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/M/MovementCorrectionData.h b/include/RE/M/MovementCorrectionData.h index 96a1fa22..e8ed9621 100644 --- a/include/RE/M/MovementCorrectionData.h +++ b/include/RE/M/MovementCorrectionData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/M/MovementData.h b/include/RE/M/MovementData.h index 10ce7982..32ed0b36 100644 --- a/include/RE/M/MovementData.h +++ b/include/RE/M/MovementData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/M/MovementTweenerOutputData.h b/include/RE/M/MovementTweenerOutputData.h index 46a2e374..dd03b011 100644 --- a/include/RE/M/MovementTweenerOutputData.h +++ b/include/RE/M/MovementTweenerOutputData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/M/MovementVector.h b/include/RE/M/MovementVector.h index 9d29ccee..c38a9ddd 100644 --- a/include/RE/M/MovementVector.h +++ b/include/RE/M/MovementVector.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/N/NEW_REFR_DATA.h b/include/RE/N/NEW_REFR_DATA.h index 330ceb9d..817f5a5a 100644 --- a/include/RE/N/NEW_REFR_DATA.h +++ b/include/RE/N/NEW_REFR_DATA.h @@ -2,7 +2,7 @@ #include "RE/B/BSTSmartPointer.h" #include "RE/E/ExtraDataList.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/N/NiBound.h b/include/RE/N/NiBound.h index 49171ca0..2b370cdb 100644 --- a/include/RE/N/NiBound.h +++ b/include/RE/N/NiBound.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/N/NiCloningProcess.h b/include/RE/N/NiCloningProcess.h index e9aa03ea..510aa439 100644 --- a/include/RE/N/NiCloningProcess.h +++ b/include/RE/N/NiCloningProcess.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSTHashMap.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/N/NiMatrix3.h b/include/RE/N/NiMatrix3.h index 325c0782..076c5c02 100644 --- a/include/RE/N/NiMatrix3.h +++ b/include/RE/N/NiMatrix3.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint4.h" namespace RE { @@ -50,6 +50,114 @@ namespace RE static_assert(sizeof(NiMatrix3) == 0x30); } +namespace RE +{ + inline constexpr NiMatrix3 NiMatrix3::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; + inline constexpr NiMatrix3 NiMatrix3::IDENTITY = { NiPoint4::IDENTITY0, NiPoint4::IDENTITY0, NiPoint4::IDENTITY0 }; + + constexpr NiMatrix3::NiMatrix3(const NiPoint4& a_point0, const NiPoint4& a_point1, const NiPoint4& a_point2) noexcept + { + entry[0] = a_point0; + entry[1] = a_point1; + entry[2] = a_point2; + } + + constexpr NiMatrix3::NiMatrix3( + float a_x0, float a_y0, float a_z0, float a_w0, + float a_x1, float a_y1, float a_z1, float a_w1, + float a_x2, float a_y2, float a_z2, float a_w2) noexcept + { + entry[0] = { a_x0, a_y0, a_z0, a_w0 }; + entry[1] = { a_x1, a_y1, a_z1, a_w1 }; + entry[2] = { a_x2, a_y2, a_z2, a_w2 }; + } + + constexpr NiPoint4& NiMatrix3::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 3); + return entry[a_pos]; + } + + constexpr const NiPoint4& NiMatrix3::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 3); + return entry[a_pos]; + } + + constexpr bool NiMatrix3::operator==(const NiMatrix3& a_rhs) const noexcept + { + return (entry[0] == a_rhs[0]) && (entry[1] == a_rhs[1]) && (entry[2] == a_rhs[2]); + } + + constexpr bool NiMatrix3::operator!=(const NiMatrix3& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr NiMatrix3 NiMatrix3::operator*(const NiMatrix3& a_rhs) const noexcept + { + NiMatrix3 result; + result[0][0] = entry[0][0] * a_rhs[0][0] + entry[0][1] * a_rhs[1][0] + entry[0][2] * a_rhs[2][0]; + result[1][0] = entry[1][0] * a_rhs[0][0] + entry[1][1] * a_rhs[1][0] + entry[1][2] * a_rhs[2][0]; + result[2][0] = entry[2][0] * a_rhs[0][0] + entry[2][1] * a_rhs[1][0] + entry[2][2] * a_rhs[2][0]; + result[0][1] = entry[0][0] * a_rhs[0][1] + entry[0][1] * a_rhs[1][1] + entry[0][2] * a_rhs[2][1]; + result[1][1] = entry[1][0] * a_rhs[0][1] + entry[1][1] * a_rhs[1][1] + entry[1][2] * a_rhs[2][1]; + result[2][1] = entry[2][0] * a_rhs[0][1] + entry[2][1] * a_rhs[1][1] + entry[2][2] * a_rhs[2][1]; + result[0][2] = entry[0][0] * a_rhs[0][2] + entry[0][1] * a_rhs[1][2] + entry[0][2] * a_rhs[2][2]; + result[1][2] = entry[1][0] * a_rhs[0][2] + entry[1][1] * a_rhs[1][2] + entry[1][2] * a_rhs[2][2]; + result[2][2] = entry[2][0] * a_rhs[0][2] + entry[2][1] * a_rhs[1][2] + entry[2][2] * a_rhs[2][2]; + return result; + } + + constexpr NiMatrix3 NiMatrix3::operator*(float a_scalar) const noexcept + { + NiMatrix3 result; + result[0][0] = entry[0][0] * a_scalar; + result[0][1] = entry[0][1] * a_scalar; + result[0][2] = entry[0][2] * a_scalar; + result[1][0] = entry[1][0] * a_scalar; + result[1][1] = entry[1][1] * a_scalar; + result[1][2] = entry[1][2] * a_scalar; + result[2][0] = entry[2][0] * a_scalar; + result[2][1] = entry[2][1] * a_scalar; + result[2][2] = entry[2][2] * a_scalar; + return result; + } + + constexpr NiPoint3 NiMatrix3::operator*(const NiPoint3& a_rhs) const noexcept + { + return NiPoint3( + entry[0][0] * a_rhs.x + entry[0][1] * a_rhs.y + entry[0][2] * a_rhs.z, + entry[1][0] * a_rhs.x + entry[1][1] * a_rhs.y + entry[1][2] * a_rhs.z, + entry[2][0] * a_rhs.x + entry[2][1] * a_rhs.y + entry[2][2] * a_rhs.z); + } + + constexpr void NiMatrix3::MakeIdentity() noexcept + { + entry[0] = NiPoint4::IDENTITY0; + entry[1] = NiPoint4::IDENTITY1; + entry[2] = NiPoint4::IDENTITY2; + } + + constexpr NiMatrix3 NiMatrix3::Transpose() const noexcept + { + NiMatrix3 result; + result[0][0] = entry[0][0]; + result[0][1] = entry[1][0]; + result[0][2] = entry[2][0]; + result[0][3] = entry[0][3]; + result[1][0] = entry[0][1]; + result[1][1] = entry[1][1]; + result[1][2] = entry[2][1]; + result[1][3] = entry[1][3]; + result[2][0] = entry[0][2]; + result[2][1] = entry[1][2]; + result[2][2] = entry[2][2]; + result[2][3] = entry[2][3]; + return result; + } +} + template <> struct std::formatter { diff --git a/include/RE/N/NiObject.h b/include/RE/N/NiObject.h index 5d12e232..db7450b1 100644 --- a/include/RE/N/NiObject.h +++ b/include/RE/N/NiObject.h @@ -71,16 +71,16 @@ namespace RE virtual NiObject* CreateClone([[maybe_unused]] NiCloningProcess& a_cloneData) { return nullptr; } // 1A virtual void LoadBinary([[maybe_unused]] NiStream& a_stream) { return; } // 1B virtual void LinkObject([[maybe_unused]] NiStream& a_stream) { return; } // 1C - virtual bool RegisterStreamables(NiStream& a_stream) { return false; } // 1D + virtual bool RegisterStreamables([[maybe_unused]] NiStream& a_stream) { return false; } // 1D virtual void SaveBinary([[maybe_unused]] NiStream& a_stream) { return; } // 1E - virtual bool IsEqual(NiObject* a_object) { return false; } // 1F - virtual void ProcessClone(NiCloningProcess& a_cloning) {} // 20 + virtual bool IsEqual([[maybe_unused]] NiObject* a_object) { return false; } // 1F + virtual void ProcessClone([[maybe_unused]] NiCloningProcess& a_cloning) {} // 20 virtual void PostLinkObject([[maybe_unused]] NiStream& a_stream) { return; } // 21 virtual bool StreamCanSkip() { return false; } // 22 virtual const NiRTTI* GetStreamableRTTI() { return GetRTTI(); } // 23 virtual std::uint32_t GetBlockAllocationSize() const { return 0; } // 24 virtual NiObjectGroup* GetGroup() const { return nullptr; } // 25 - virtual void SetGroup(NiObjectGroup*) { return; } // 26 + virtual void SetGroup([[maybe_unused]] NiObjectGroup*) { return; } // 26 virtual NiControllerManager* IsNiControllerManager() { return nullptr; } // 27 F4_HEAP_REDEFINE_NEW(NiObject); diff --git a/include/RE/N/NiParticleInfo.h b/include/RE/N/NiParticleInfo.h index 8992c699..7c1fc396 100644 --- a/include/RE/N/NiParticleInfo.h +++ b/include/RE/N/NiParticleInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/N/NiPoint.h b/include/RE/N/NiPoint.h deleted file mode 100644 index c2af9faa..00000000 --- a/include/RE/N/NiPoint.h +++ /dev/null @@ -1,208 +0,0 @@ -#pragma once - -namespace RE -{ - class NiPoint2 - { - public: - static const NiPoint2 ZERO; - static const NiPoint2 UNIT; - static const NiPoint2 UNIT_X; - static const NiPoint2 UNIT_Y; - - constexpr NiPoint2() noexcept = default; - constexpr NiPoint2(float a_x, float a_y) noexcept; - - constexpr float& operator[](std::size_t a_pos) noexcept; - constexpr const float& operator[](std::size_t a_pos) const noexcept; - constexpr bool operator==(const NiPoint2& a_rhs) const noexcept; - constexpr bool operator!=(const NiPoint2& a_rhs) const noexcept; - constexpr bool operator<(const NiPoint2& a_rhs) const noexcept; - constexpr bool operator>(const NiPoint2& a_rhs) const noexcept; - constexpr NiPoint2 operator+(const NiPoint2& a_rhs) const noexcept; - constexpr NiPoint2 operator-(const NiPoint2& a_rhs) const noexcept; - constexpr NiPoint2 operator*(const NiPoint2& a_rhs) const noexcept; - constexpr NiPoint2 operator/(const NiPoint2& a_rhs) const noexcept; - constexpr NiPoint2 operator*(float a_scalar) const noexcept; - constexpr NiPoint2 operator/(float a_scalar) const noexcept; - constexpr NiPoint2 operator-() const noexcept; - constexpr NiPoint2& operator+=(const NiPoint2& a_rhs) noexcept; - constexpr NiPoint2& operator-=(const NiPoint2& a_rhs) noexcept; - constexpr NiPoint2& operator*=(const NiPoint2& a_rhs) noexcept; - constexpr NiPoint2& operator/=(const NiPoint2& a_rhs) noexcept; - constexpr NiPoint2& operator+=(float a_scalar) noexcept; - constexpr NiPoint2& operator-=(float a_scalar) noexcept; - constexpr NiPoint2& operator*=(float a_scalar) noexcept; - constexpr NiPoint2& operator/=(float a_scalar) noexcept; - - // members - float x{ 0.0F }; // 00 - float y{ 0.0F }; // 04 - }; - static_assert(sizeof(NiPoint2) == 0x8); -} - -namespace RE -{ - class NiPoint3 - { - public: - static const NiPoint3 ZERO; - static const NiPoint3 UNIT; - static const NiPoint3 UNIT_X; - static const NiPoint3 UNIT_Y; - static const NiPoint3 UNIT_Z; - - constexpr NiPoint3() noexcept = default; - constexpr NiPoint3(const NiPoint2& a_point) noexcept; - constexpr NiPoint3(float a_x, float a_y, float a_z) noexcept; - - constexpr float& operator[](std::size_t a_pos) noexcept; - constexpr const float& operator[](std::size_t a_pos) const noexcept; - constexpr bool operator==(const NiPoint3& a_rhs) const noexcept; - constexpr bool operator!=(const NiPoint3& a_rhs) const noexcept; - constexpr bool operator<(const NiPoint3& a_rhs) const noexcept; - constexpr bool operator>(const NiPoint3& a_rhs) const noexcept; - constexpr NiPoint3 operator+(const NiPoint3& a_rhs) const noexcept; - constexpr NiPoint3 operator-(const NiPoint3& a_rhs) const noexcept; - constexpr NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; - constexpr NiPoint3 operator/(const NiPoint3& a_rhs) const noexcept; - constexpr NiPoint3 operator*(float a_scalar) const noexcept; - constexpr NiPoint3 operator/(float a_scalar) const noexcept; - constexpr NiPoint3 operator-() const noexcept; - constexpr NiPoint3& operator+=(const NiPoint3& a_rhs) noexcept; - constexpr NiPoint3& operator-=(const NiPoint3& a_rhs) noexcept; - constexpr NiPoint3& operator*=(const NiPoint3& a_rhs) noexcept; - constexpr NiPoint3& operator/=(const NiPoint3& a_rhs) noexcept; - constexpr NiPoint3& operator+=(float a_scalar) noexcept; - constexpr NiPoint3& operator-=(float a_scalar) noexcept; - constexpr NiPoint3& operator*=(float a_scalar) noexcept; - constexpr NiPoint3& operator/=(float a_scalar) noexcept; - - constexpr NiPoint3 Cross(const NiPoint3& a_point) const noexcept; - constexpr float Dot(const NiPoint3& a_point) const noexcept; - constexpr float GetSquaredDistance(const NiPoint3& a_point) const noexcept; - constexpr float SqrLength() const noexcept; - - float GetDistance(const NiPoint3& a_point) const noexcept; - float GetZAngleFromVector() const; - float Length() const noexcept; - NiPoint3 UnitCross(const NiPoint3& a_point) const noexcept; - float Unitize() noexcept; - - // members - float x{ 0.0F }; // 00 - float y{ 0.0F }; // 04 - float z{ 0.0F }; // 08 - }; - static_assert(sizeof(NiPoint3) == 0xC); - - class alignas(0x10) NiPoint3A : - public NiPoint3 - { - public: - static const NiPoint3A ZERO; - static const NiPoint3A UNIT; - static const NiPoint3A UNIT_X; - static const NiPoint3A UNIT_Y; - static const NiPoint3A UNIT_Z; - - using NiPoint3::NiPoint3; - }; - static_assert(sizeof(NiPoint3A) == 0x10); -} - -namespace RE -{ - class NiPoint4 - { - public: - static const NiPoint4 ZERO; - static const NiPoint4 IDENTITY0; - static const NiPoint4 IDENTITY1; - static const NiPoint4 IDENTITY2; - static const NiPoint4 IDENTITY3; - - constexpr NiPoint4() noexcept = default; - constexpr NiPoint4(const NiPoint2& a_point) noexcept; - constexpr NiPoint4(const NiPoint3& a_point) noexcept; - constexpr NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept; - - constexpr float& operator[](std::size_t a_pos) noexcept; - constexpr const float& operator[](std::size_t a_pos) const noexcept; - constexpr bool operator==(const NiPoint4& a_rhs) const noexcept; - constexpr bool operator!=(const NiPoint4& a_rhs) const noexcept; - constexpr bool operator<(const NiPoint4& a_rhs) const noexcept; - constexpr bool operator>(const NiPoint4& a_rhs) const noexcept; - constexpr NiPoint4 operator+(const NiPoint4& a_rhs) const noexcept; - constexpr NiPoint4 operator-(const NiPoint4& a_rhs) const noexcept; - constexpr NiPoint4 operator*(const NiPoint4& a_rhs) const noexcept; - constexpr NiPoint4 operator/(const NiPoint4& a_rhs) const noexcept; - constexpr NiPoint4 operator*(float a_scalar) const noexcept; - constexpr NiPoint4 operator/(float a_scalar) const noexcept; - constexpr NiPoint4 operator-() const noexcept; - constexpr NiPoint4& operator+=(const NiPoint4& a_rhs) noexcept; - constexpr NiPoint4& operator-=(const NiPoint4& a_rhs) noexcept; - constexpr NiPoint4& operator*=(const NiPoint4& a_rhs) noexcept; - constexpr NiPoint4& operator/=(const NiPoint4& a_rhs) noexcept; - constexpr NiPoint4& operator+=(float a_scalar) noexcept; - constexpr NiPoint4& operator-=(float a_scalar) noexcept; - constexpr NiPoint4& operator*=(float a_scalar) noexcept; - constexpr NiPoint4& operator/=(float a_scalar) noexcept; - - // members - float x{ 0.0F }; // 00 - float y{ 0.0F }; // 04 - float z{ 0.0F }; // 08 - float w{ 0.0F }; // 0C - }; - static_assert(sizeof(NiPoint4) == 0x10); -} - -template <> -struct std::formatter -{ - template - constexpr auto parse(ParseContext& a_ctx) - { - return a_ctx.begin(); - } - - template - constexpr auto format(const RE::NiPoint2& a_point, FormatContext& a_ctx) const - { - return format_to(a_ctx.out(), "({}, {})", a_point.x, a_point.y); - } -}; - -template <> -struct std::formatter -{ - template - constexpr auto parse(ParseContext& a_ctx) - { - return a_ctx.begin(); - } - - template - constexpr auto format(const RE::NiPoint3& a_point, FormatContext& a_ctx) const - { - return format_to(a_ctx.out(), "({}, {}, {})", a_point.x, a_point.y, a_point.z); - } -}; - -template <> -struct std::formatter -{ - template - constexpr auto parse(ParseContext& a_ctx) - { - return a_ctx.begin(); - } - - template - constexpr auto format(const RE::NiPoint4& a_point, FormatContext& a_ctx) const - { - return format_to(a_ctx.out(), "({}, {}, {}, {})", a_point.x, a_point.y, a_point.z, a_point.w); - } -}; diff --git a/include/RE/N/NiPoint2.h b/include/RE/N/NiPoint2.h new file mode 100644 index 00000000..80a6edb1 --- /dev/null +++ b/include/RE/N/NiPoint2.h @@ -0,0 +1,194 @@ +#pragma once + +namespace RE +{ + class NiPoint2 + { + public: + static const NiPoint2 ZERO; + static const NiPoint2 UNIT; + static const NiPoint2 UNIT_X; + static const NiPoint2 UNIT_Y; + + constexpr NiPoint2() noexcept = default; + constexpr NiPoint2(float a_x, float a_y) noexcept; + + constexpr float& operator[](std::size_t a_pos) noexcept; + constexpr const float& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const NiPoint2& a_rhs) const noexcept; + constexpr bool operator!=(const NiPoint2& a_rhs) const noexcept; + constexpr bool operator<(const NiPoint2& a_rhs) const noexcept; + constexpr bool operator>(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator+(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator-(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator*(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator/(const NiPoint2& a_rhs) const noexcept; + constexpr NiPoint2 operator*(float a_scalar) const noexcept; + constexpr NiPoint2 operator/(float a_scalar) const noexcept; + constexpr NiPoint2 operator-() const noexcept; + constexpr NiPoint2& operator+=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator-=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator*=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator/=(const NiPoint2& a_rhs) noexcept; + constexpr NiPoint2& operator+=(float a_scalar) noexcept; + constexpr NiPoint2& operator-=(float a_scalar) noexcept; + constexpr NiPoint2& operator*=(float a_scalar) noexcept; + constexpr NiPoint2& operator/=(float a_scalar) noexcept; + + // members + float x{ 0.0F }; // 0x00 + float y{ 0.0F }; // 0x04 + }; + static_assert(sizeof(NiPoint2) == 0x8); +} + +namespace RE +{ + constexpr NiPoint2::NiPoint2(float a_x, float a_y) noexcept : + x(a_x), y(a_y) + {} + + constexpr float& NiPoint2::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 2); + return std::addressof(x)[a_pos]; + } + + constexpr const float& NiPoint2::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 2); + return std::addressof(x)[a_pos]; + } + + constexpr bool NiPoint2::operator==(const NiPoint2& a_rhs) const noexcept + { + return (x == a_rhs.x) && (y == a_rhs.y); + } + + constexpr bool NiPoint2::operator!=(const NiPoint2& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr bool NiPoint2::operator<(const NiPoint2& a_rhs) const noexcept + { + return std::tie(x, y) < std::tie(a_rhs.x, a_rhs.y); + } + + constexpr bool NiPoint2::operator>(const NiPoint2& a_rhs) const noexcept + { + return std::tie(x, y) > std::tie(a_rhs.x, a_rhs.y); + } + + constexpr NiPoint2 NiPoint2::operator+(const NiPoint2& a_rhs) const noexcept + { + return NiPoint2(x + a_rhs.x, y + a_rhs.y); + } + + constexpr NiPoint2 NiPoint2::operator-(const NiPoint2& a_rhs) const noexcept + { + return NiPoint2(x - a_rhs.x, y - a_rhs.y); + } + + constexpr NiPoint2 NiPoint2::operator*(const NiPoint2& a_rhs) const noexcept + { + return NiPoint2(x * a_rhs.x, y * a_rhs.y); + } + + constexpr NiPoint2 NiPoint2::operator/(const NiPoint2& a_rhs) const noexcept + { + return NiPoint2(x / a_rhs.x, y / a_rhs.y); + } + + constexpr NiPoint2 NiPoint2::operator*(float a_scalar) const noexcept + { + return NiPoint2(x * a_scalar, y * a_scalar); + } + + constexpr NiPoint2 NiPoint2::operator/(float a_scalar) const noexcept + { + return NiPoint2(x / a_scalar, y / a_scalar); + } + + constexpr NiPoint2 NiPoint2::operator-() const noexcept + { + return NiPoint2(-x, -y); + } + + constexpr NiPoint2& NiPoint2::operator+=(const NiPoint2& a_rhs) noexcept + { + x += a_rhs.x; + y += a_rhs.y; + return *this; + } + + constexpr NiPoint2& NiPoint2::operator-=(const NiPoint2& a_rhs) noexcept + { + x -= a_rhs.x; + y -= a_rhs.y; + return *this; + } + + constexpr NiPoint2& NiPoint2::operator*=(const NiPoint2& a_rhs) noexcept + { + x *= a_rhs.x; + y *= a_rhs.y; + return *this; + } + + constexpr NiPoint2& NiPoint2::operator/=(const NiPoint2& a_rhs) noexcept + { + x /= a_rhs.x; + y /= a_rhs.y; + return *this; + } + + constexpr NiPoint2& NiPoint2::operator+=(float a_scalar) noexcept + { + x += a_scalar; + y += a_scalar; + return *this; + } + + constexpr NiPoint2& NiPoint2::operator-=(float a_scalar) noexcept + { + x -= a_scalar; + y -= a_scalar; + return *this; + } + + constexpr NiPoint2& NiPoint2::operator*=(float a_scalar) noexcept + { + x *= a_scalar; + y *= a_scalar; + return *this; + } + + constexpr NiPoint2& NiPoint2::operator/=(float a_scalar) noexcept + { + x /= a_scalar; + y /= a_scalar; + return *this; + } + + inline constexpr NiPoint2 NiPoint2::ZERO = { 0.0F, 0.0F }; + inline constexpr NiPoint2 NiPoint2::UNIT = { 1.0F, 1.0F }; + inline constexpr NiPoint2 NiPoint2::UNIT_X = { 1.0F, 0.0F }; + inline constexpr NiPoint2 NiPoint2::UNIT_Y = { 0.0F, 1.0F }; +} + +template <> +struct std::formatter +{ + template + constexpr auto parse(ParseContext& a_ctx) + { + return a_ctx.begin(); + } + + template + constexpr auto format(const RE::NiPoint2& a_point, FormatContext& a_ctx) const + { + return format_to(a_ctx.out(), "({}, {})", a_point.x, a_point.y); + } +}; diff --git a/include/RE/N/NiPoint3.h b/include/RE/N/NiPoint3.h new file mode 100644 index 00000000..4cdbcf4f --- /dev/null +++ b/include/RE/N/NiPoint3.h @@ -0,0 +1,268 @@ +#pragma once + +#include "RE/N/NiPoint2.h" + +namespace RE +{ + class NiPoint3 + { + public: + static const NiPoint3 ZERO; + static const NiPoint3 UNIT; + static const NiPoint3 UNIT_X; + static const NiPoint3 UNIT_Y; + static const NiPoint3 UNIT_Z; + + constexpr NiPoint3() noexcept = default; + constexpr NiPoint3(const NiPoint2& a_point) noexcept; + constexpr NiPoint3(float a_x, float a_y, float a_z) noexcept; + + constexpr float& operator[](std::size_t a_pos) noexcept; + constexpr const float& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const NiPoint3& a_rhs) const noexcept; + constexpr bool operator!=(const NiPoint3& a_rhs) const noexcept; + constexpr bool operator<(const NiPoint3& a_rhs) const noexcept; + constexpr bool operator>(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator+(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator-(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator*(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator/(const NiPoint3& a_rhs) const noexcept; + constexpr NiPoint3 operator*(float a_scalar) const noexcept; + constexpr NiPoint3 operator/(float a_scalar) const noexcept; + constexpr NiPoint3 operator-() const noexcept; + constexpr NiPoint3& operator+=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator-=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator*=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator/=(const NiPoint3& a_rhs) noexcept; + constexpr NiPoint3& operator+=(float a_scalar) noexcept; + constexpr NiPoint3& operator-=(float a_scalar) noexcept; + constexpr NiPoint3& operator*=(float a_scalar) noexcept; + constexpr NiPoint3& operator/=(float a_scalar) noexcept; + + constexpr NiPoint3 Cross(const NiPoint3& a_point) const noexcept; + constexpr float Dot(const NiPoint3& a_point) const noexcept; + constexpr float GetSquaredDistance(const NiPoint3& a_point) const noexcept; + constexpr float SqrLength() const noexcept; + + float GetDistance(const NiPoint3& a_point) const noexcept; + float GetZAngleFromVector() const; + float Length() const noexcept; + NiPoint3 UnitCross(const NiPoint3& a_point) const noexcept; + float Unitize() noexcept; + + // members + float x{ 0.0F }; // 0x00 + float y{ 0.0F }; // 0x04 + float z{ 0.0F }; // 0x08 + }; + static_assert(sizeof(NiPoint3) == 0xC); + + class alignas(0x10) NiPoint3A : + public NiPoint3 + { + public: + static const NiPoint3A ZERO; + static const NiPoint3A UNIT; + static const NiPoint3A UNIT_X; + static const NiPoint3A UNIT_Y; + static const NiPoint3A UNIT_Z; + + using NiPoint3::NiPoint3; + }; + static_assert(sizeof(NiPoint3A) == 0x10); +} + +namespace RE +{ + constexpr NiPoint3::NiPoint3(const NiPoint2& a_point) noexcept : + x(a_point.x), y(a_point.y) + {} + + constexpr NiPoint3::NiPoint3(float a_x, float a_y, float a_z) noexcept : + x(a_x), y(a_y), z(a_z) + {} + + constexpr float& NiPoint3::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 3); + return std::addressof(x)[a_pos]; + } + + constexpr const float& NiPoint3::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 3); + return std::addressof(x)[a_pos]; + } + + constexpr bool NiPoint3::operator==(const NiPoint3& a_rhs) const noexcept + { + return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z); + } + + constexpr bool NiPoint3::operator!=(const NiPoint3& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr bool NiPoint3::operator<(const NiPoint3& a_rhs) const noexcept + { + return std::tie(x, y, z) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z); + } + + constexpr bool NiPoint3::operator>(const NiPoint3& a_rhs) const noexcept + { + return std::tie(x, y, z) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z); + } + + constexpr NiPoint3 NiPoint3::operator+(const NiPoint3& a_rhs) const noexcept + { + return NiPoint3(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z); + } + + constexpr NiPoint3 NiPoint3::operator-(const NiPoint3& a_rhs) const noexcept + { + return NiPoint3(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z); + } + + constexpr NiPoint3 NiPoint3::operator*(const NiPoint3& a_rhs) const noexcept + { + return NiPoint3(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z); + } + + constexpr NiPoint3 NiPoint3::operator/(const NiPoint3& a_rhs) const noexcept + { + return NiPoint3(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z); + } + + constexpr NiPoint3 NiPoint3::operator*(float a_scalar) const noexcept + { + return NiPoint3(x * a_scalar, y * a_scalar, z * a_scalar); + } + + constexpr NiPoint3 NiPoint3::operator/(float a_scalar) const noexcept + { + return NiPoint3(x / a_scalar, y / a_scalar, z / a_scalar); + } + + constexpr NiPoint3 NiPoint3::operator-() const noexcept + { + return NiPoint3(-x, -y, -z); + } + + constexpr NiPoint3& NiPoint3::operator+=(const NiPoint3& a_rhs) noexcept + { + x += a_rhs.x; + y += a_rhs.y; + z += a_rhs.z; + return *this; + } + + constexpr NiPoint3& NiPoint3::operator-=(const NiPoint3& a_rhs) noexcept + { + x -= a_rhs.x; + y -= a_rhs.y; + z -= a_rhs.z; + return *this; + } + + constexpr NiPoint3& NiPoint3::operator*=(const NiPoint3& a_rhs) noexcept + { + x *= a_rhs.x; + y *= a_rhs.y; + z *= a_rhs.z; + return *this; + } + + constexpr NiPoint3& NiPoint3::operator/=(const NiPoint3& a_rhs) noexcept + { + x /= a_rhs.x; + y /= a_rhs.y; + z /= a_rhs.z; + return *this; + } + + constexpr NiPoint3& NiPoint3::operator+=(float a_scalar) noexcept + { + x += a_scalar; + y += a_scalar; + z += a_scalar; + return *this; + } + + constexpr NiPoint3& NiPoint3::operator-=(float a_scalar) noexcept + { + x -= a_scalar; + y -= a_scalar; + z -= a_scalar; + return *this; + } + + constexpr NiPoint3& NiPoint3::operator*=(float a_scalar) noexcept + { + x *= a_scalar; + y *= a_scalar; + z *= a_scalar; + return *this; + } + + constexpr NiPoint3& NiPoint3::operator/=(float a_scalar) noexcept + { + x /= a_scalar; + y /= a_scalar; + z /= a_scalar; + return *this; + } + + constexpr NiPoint3 NiPoint3::Cross(const NiPoint3& a_point) const noexcept + { + return NiPoint3( + y * a_point.z - z * a_point.y, + z * a_point.x - x * a_point.z, + x * a_point.y - y * a_point.x); + } + + constexpr float NiPoint3::Dot(const NiPoint3& a_point) const noexcept + { + return x * a_point.x + y * a_point.y + z * a_point.z; + } + + constexpr float NiPoint3::GetSquaredDistance(const NiPoint3& a_point) const noexcept + { + const float dx = a_point.x - x; + const float dy = a_point.y - y; + const float dz = a_point.z - z; + return dx * dx + dy * dy + dz * dz; + } + + constexpr float NiPoint3::SqrLength() const noexcept + { + return x * x + y * y + z * z; + } + + inline constexpr NiPoint3 NiPoint3::ZERO = { 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT = { 1.0F, 1.0F, 1.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT_X = { 1.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT_Y = { 0.0F, 1.0F, 0.0F }; + inline constexpr NiPoint3 NiPoint3::UNIT_Z = { 0.0F, 0.0F, 1.0F }; + inline constexpr NiPoint3A NiPoint3A::ZERO = { 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT = { 1.0F, 1.0F, 1.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT_X = { 1.0F, 0.0F, 0.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT_Y = { 0.0F, 1.0F, 0.0F }; + inline constexpr NiPoint3A NiPoint3A::UNIT_Z = { 0.0F, 0.0F, 1.0F }; +} + +template <> +struct std::formatter +{ + template + constexpr auto parse(ParseContext& a_ctx) + { + return a_ctx.begin(); + } + + template + constexpr auto format(const RE::NiPoint3& a_point, FormatContext& a_ctx) const + { + return format_to(a_ctx.out(), "({}, {}, {})", a_point.x, a_point.y, a_point.z); + } +}; diff --git a/include/RE/N/NiPoint4.h b/include/RE/N/NiPoint4.h new file mode 100644 index 00000000..24696b31 --- /dev/null +++ b/include/RE/N/NiPoint4.h @@ -0,0 +1,226 @@ +#pragma once + +#include "RE/N/NiPoint3.h" + +namespace RE +{ + class NiPoint4 + { + public: + static const NiPoint4 ZERO; + static const NiPoint4 IDENTITY0; + static const NiPoint4 IDENTITY1; + static const NiPoint4 IDENTITY2; + static const NiPoint4 IDENTITY3; + + constexpr NiPoint4() noexcept = default; + constexpr NiPoint4(const NiPoint2& a_point) noexcept; + constexpr NiPoint4(const NiPoint3& a_point) noexcept; + constexpr NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept; + + constexpr float& operator[](std::size_t a_pos) noexcept; + constexpr const float& operator[](std::size_t a_pos) const noexcept; + constexpr bool operator==(const NiPoint4& a_rhs) const noexcept; + constexpr bool operator!=(const NiPoint4& a_rhs) const noexcept; + constexpr bool operator<(const NiPoint4& a_rhs) const noexcept; + constexpr bool operator>(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator+(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator-(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator*(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator/(const NiPoint4& a_rhs) const noexcept; + constexpr NiPoint4 operator*(float a_scalar) const noexcept; + constexpr NiPoint4 operator/(float a_scalar) const noexcept; + constexpr NiPoint4 operator-() const noexcept; + constexpr NiPoint4& operator+=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator-=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator*=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator/=(const NiPoint4& a_rhs) noexcept; + constexpr NiPoint4& operator+=(float a_scalar) noexcept; + constexpr NiPoint4& operator-=(float a_scalar) noexcept; + constexpr NiPoint4& operator*=(float a_scalar) noexcept; + constexpr NiPoint4& operator/=(float a_scalar) noexcept; + + // members + float x{ 0.0F }; // 0x00 + float y{ 0.0F }; // 0x04 + float z{ 0.0F }; // 0x08 + float w{ 0.0F }; // 0x0C + }; + static_assert(sizeof(NiPoint4) == 0x10); +} + +namespace RE +{ + constexpr NiPoint4::NiPoint4(const NiPoint2& a_point) noexcept : + x(a_point.x), y(a_point.y) + {} + + constexpr NiPoint4::NiPoint4(const NiPoint3& a_point) noexcept : + x(a_point.x), y(a_point.y), z(a_point.z) + {} + + constexpr NiPoint4::NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept : + x(a_x), y(a_y), z(a_z), w(a_w) + {} + + constexpr float& NiPoint4::operator[](std::size_t a_pos) noexcept + { + assert(a_pos < 4); + return std::addressof(x)[a_pos]; + } + + constexpr const float& NiPoint4::operator[](std::size_t a_pos) const noexcept + { + assert(a_pos < 4); + return std::addressof(x)[a_pos]; + } + + constexpr bool NiPoint4::operator==(const NiPoint4& a_rhs) const noexcept + { + return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z) && (w == a_rhs.w); + } + + constexpr bool NiPoint4::operator!=(const NiPoint4& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr bool NiPoint4::operator<(const NiPoint4& a_rhs) const noexcept + { + return std::tie(x, y, z, w) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); + } + + constexpr bool NiPoint4::operator>(const NiPoint4& a_rhs) const noexcept + { + return std::tie(x, y, z, w) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); + } + + constexpr NiPoint4 NiPoint4::operator+(const NiPoint4& a_rhs) const noexcept + { + return NiPoint4(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z, w + a_rhs.w); + } + + constexpr NiPoint4 NiPoint4::operator-(const NiPoint4& a_rhs) const noexcept + { + return NiPoint4(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z, w - a_rhs.w); + } + + constexpr NiPoint4 NiPoint4::operator*(const NiPoint4& a_rhs) const noexcept + { + return NiPoint4(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z, w * a_rhs.w); + } + + constexpr NiPoint4 NiPoint4::operator/(const NiPoint4& a_rhs) const noexcept + { + return NiPoint4(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z, w / a_rhs.w); + } + + constexpr NiPoint4 NiPoint4::operator*(float a_scalar) const noexcept + { + return NiPoint4(x * a_scalar, y * a_scalar, z * a_scalar, w * a_scalar); + } + + constexpr NiPoint4 NiPoint4::operator/(float a_scalar) const noexcept + { + return operator*(1.0F / a_scalar); + } + + constexpr NiPoint4 NiPoint4::operator-() const noexcept + { + return NiPoint4(-x, -y, -z, -w); + } + + constexpr NiPoint4& NiPoint4::operator+=(const NiPoint4& a_rhs) noexcept + { + x += a_rhs.x; + y += a_rhs.y; + z += a_rhs.z; + w += a_rhs.w; + return *this; + } + + constexpr NiPoint4& NiPoint4::operator-=(const NiPoint4& a_rhs) noexcept + { + x -= a_rhs.x; + y -= a_rhs.y; + z -= a_rhs.z; + w -= a_rhs.w; + return *this; + } + + constexpr NiPoint4& NiPoint4::operator*=(const NiPoint4& a_rhs) noexcept + { + x *= a_rhs.x; + y *= a_rhs.y; + z *= a_rhs.z; + w *= a_rhs.w; + return *this; + } + + constexpr NiPoint4& NiPoint4::operator/=(const NiPoint4& a_rhs) noexcept + { + x /= a_rhs.x; + y /= a_rhs.y; + z /= a_rhs.z; + w /= a_rhs.w; + return *this; + } + + constexpr NiPoint4& NiPoint4::operator+=(float a_scalar) noexcept + { + x += a_scalar; + y += a_scalar; + z += a_scalar; + w += a_scalar; + return *this; + } + + constexpr NiPoint4& NiPoint4::operator-=(float a_scalar) noexcept + { + x -= a_scalar; + y -= a_scalar; + z -= a_scalar; + w -= a_scalar; + return *this; + } + + constexpr NiPoint4& NiPoint4::operator*=(float a_scalar) noexcept + { + x *= a_scalar; + y *= a_scalar; + z *= a_scalar; + w *= a_scalar; + return *this; + } + + constexpr NiPoint4& NiPoint4::operator/=(float a_scalar) noexcept + { + x /= a_scalar; + y /= a_scalar; + z /= a_scalar; + w /= a_scalar; + return *this; + } + + inline constexpr NiPoint4 NiPoint4::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY0 = { 1.0F, 0.0F, 0.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY1 = { 0.0F, 1.0F, 0.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY2 = { 0.0F, 0.0F, 1.0F, 0.0F }; + inline constexpr NiPoint4 NiPoint4::IDENTITY3 = { 0.0F, 0.0F, 0.0F, 1.0F }; +} + +template <> +struct std::formatter +{ + template + constexpr auto parse(ParseContext& a_ctx) + { + return a_ctx.begin(); + } + + template + constexpr auto format(const RE::NiPoint4& a_point, FormatContext& a_ctx) const + { + return format_to(a_ctx.out(), "({}, {}, {}, {})", a_point.x, a_point.y, a_point.z, a_point.w); + } +}; diff --git a/include/RE/N/NiTransform.h b/include/RE/N/NiTransform.h index cc5c0d3b..f1b59b5d 100644 --- a/include/RE/N/NiTransform.h +++ b/include/RE/N/NiTransform.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiMatrix3.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { @@ -31,6 +31,58 @@ namespace RE static_assert(sizeof(NiTransform) == 0x40); } +namespace RE +{ + inline constexpr NiTransform NiTransform::ZERO = { NiMatrix3::ZERO, NiPoint3::ZERO, 0.0F }; + inline constexpr NiTransform NiTransform::IDENTITY = { NiMatrix3::IDENTITY, NiPoint3::ZERO, 1.0F }; + + constexpr NiTransform::NiTransform(const NiMatrix3& a_rotation, const NiPoint3& a_translation, const float a_scale) noexcept : + rotate(a_rotation), translate(a_translation), scale(a_scale) + {} + + constexpr bool NiTransform::operator==(const NiTransform& a_rhs) const noexcept + { + return (rotate == a_rhs.rotate) && (translate == a_rhs.translate) && (scale == a_rhs.scale); + } + + constexpr bool NiTransform::operator!=(const NiTransform& a_rhs) const noexcept + { + return !operator==(a_rhs); + } + + constexpr NiTransform NiTransform::operator*(const NiTransform& a_rhs) const noexcept + { + return NiTransform(rotate * a_rhs.rotate, translate + (rotate * a_rhs.translate) * scale, scale * a_rhs.scale); + } + + constexpr NiPoint3 NiTransform::operator*(const NiPoint3& a_rhs) const noexcept + { + return NiPoint3(((rotate * a_rhs) * scale) + translate); + } + + constexpr NiTransform NiTransform::Invert() const noexcept + { + NiTransform transform(*this); + return transform.MakeInvert(); + } + + constexpr NiTransform& NiTransform::MakeIdentity() noexcept + { + rotate = NiMatrix3::IDENTITY; + translate = NiPoint3::ZERO; + scale = 1.0F; + return *this; + } + + constexpr NiTransform& NiTransform::MakeInvert() noexcept + { + rotate = rotate.Transpose(); + scale = 1.0f / scale; + translate = (rotate * -translate) * scale; + return *this; + } +} + template <> struct std::formatter { diff --git a/include/RE/O/OBJ_REFR.h b/include/RE/O/OBJ_REFR.h index 96e07f73..b0247301 100644 --- a/include/RE/O/OBJ_REFR.h +++ b/include/RE/O/OBJ_REFR.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/P/PART_DATA.h b/include/RE/P/PART_DATA.h index e85616ed..969a576d 100644 --- a/include/RE/P/PART_DATA.h +++ b/include/RE/P/PART_DATA.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/P/PLAYER_TARGET_LOC.h b/include/RE/P/PLAYER_TARGET_LOC.h index 6fe2c9a0..b36f77cb 100644 --- a/include/RE/P/PLAYER_TARGET_LOC.h +++ b/include/RE/P/PLAYER_TARGET_LOC.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSPointerHandle.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/P/PipboyMapData.h b/include/RE/P/PipboyMapData.h index 0b63b73a..0eeb634a 100644 --- a/include/RE/P/PipboyMapData.h +++ b/include/RE/P/PipboyMapData.h @@ -4,7 +4,7 @@ #include "RE/B/BSTArray.h" #include "RE/B/BSTEvent.h" #include "RE/B/BSTHashMap.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/P/PipboyDataGroup.h" namespace RE diff --git a/include/RE/P/PlayerCamera.h b/include/RE/P/PlayerCamera.h index 1fab69d0..8fba74ea 100644 --- a/include/RE/P/PlayerCamera.h +++ b/include/RE/P/PlayerCamera.h @@ -8,7 +8,7 @@ #include "RE/B/BSTSmartPointer.h" #include "RE/C/CameraStates.h" #include "RE/H/hknpBodyId.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/T/TESCamera.h" #include "RE/T/TESCameraState.h" diff --git a/include/RE/P/PlayerCharacter.h b/include/RE/P/PlayerCharacter.h index 4cfc99d9..c724aa68 100644 --- a/include/RE/P/PlayerCharacter.h +++ b/include/RE/P/PlayerCharacter.h @@ -18,7 +18,7 @@ #include "RE/D/DifficultyLevel.h" #include "RE/F/FriendshipFactionsStruct.h" #include "RE/I/IMovementPlayerControlsFilter.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/N/NiTMap.h" #include "RE/P/PLAYER_TARGET_LOC.h" diff --git a/include/RE/P/PlayerControlsData.h b/include/RE/P/PlayerControlsData.h index af6290c6..923ca134 100644 --- a/include/RE/P/PlayerControlsData.h +++ b/include/RE/P/PlayerControlsData.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSSpring_SpringState.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" namespace RE { diff --git a/include/RE/P/PlayerControlsMovementData.h b/include/RE/P/PlayerControlsMovementData.h index e218b32f..13151ee3 100644 --- a/include/RE/P/PlayerControlsMovementData.h +++ b/include/RE/P/PlayerControlsMovementData.h @@ -1,7 +1,7 @@ #pragma once #include "RE/M/MovementData.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/P/PlayerCoverData.h b/include/RE/P/PlayerCoverData.h index faa2c73a..fb561891 100644 --- a/include/RE/P/PlayerCoverData.h +++ b/include/RE/P/PlayerCoverData.h @@ -1,22 +1,22 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { class PlayerCoverData { public: - enum class PEEK_STATE; + enum class PEEK_STATE : std::int32_t; // members - NiPoint3 coverLocation; // 00 - NiPoint3 peekLocation; // 0C - float peekTimer; // 18 - float updateTimer; // 2C - float blockedTimer; // 20 - REX::TEnumSet peekState; // 24 - bool gunBlocked; // 28 + NiPoint3 coverLocation; // 00 + NiPoint3 peekLocation; // 0C + float peekTimer; // 18 + float updateTimer; // 2C + float blockedTimer; // 20 + PEEK_STATE peekState; // 24 + bool gunBlocked; // 28 }; static_assert(sizeof(PlayerCoverData) == 0x2C); } diff --git a/include/RE/P/Projectile.h b/include/RE/P/Projectile.h index 5e1c994a..82b8b5b9 100644 --- a/include/RE/P/Projectile.h +++ b/include/RE/P/Projectile.h @@ -10,7 +10,7 @@ #include "RE/C/CELLJobs.h" #include "RE/C/CFilter.h" #include "RE/H/hknpBodyId.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/N/NiTransform.h" #include "RE/T/TESObjectREFR.h" @@ -61,24 +61,24 @@ namespace RE { public: // members - NiPoint3 location; // 00 - NiPoint3 normal; // 0C - bhkCollisionQueryResultHandle impactDecalQuery; // 18 - ObjectRefHandle collidee; // 20 - NiPointer colObj; // 28 - BGSMaterialType* materialType; // 30 - REX::TEnumSet damageLimb; // 38 - REX::TEnumSet collisionLayer; // 3C - NiPointer closestBone; // 40 - REX::TEnumSet resultOverride; // 48 - float decalSize; // 4C - std::uint32_t collisionShapeKey; // 50 - std::int16_t targetWorldObjectCount; // 54 - std::int16_t targetWorldObjectIndex; // 56 - bool processed; // 58 - bool spellCast; // 59 - bool effectSpawned; // 5A - bool backface; // 5B + NiPoint3 location; // 00 + NiPoint3 normal; // 0C + bhkCollisionQueryResultHandle impactDecalQuery; // 18 + ObjectRefHandle collidee; // 20 + NiPointer colObj; // 28 + BGSMaterialType* materialType; // 30 + BGSBodyPartDefs::LIMB_ENUM damageLimb; // 38 + COL_LAYER collisionLayer; // 3C + NiPointer closestBone; // 40 + ImpactResult resultOverride; // 48 + float decalSize; // 4C + std::uint32_t collisionShapeKey; // 50 + std::int16_t targetWorldObjectCount; // 54 + std::int16_t targetWorldObjectIndex; // 56 + bool processed; // 58 + bool spellCast; // 59 + bool effectSpawned; // 5A + bool backface; // 5B }; static_assert(sizeof(ImpactData) == 0x60); diff --git a/include/RE/P/ProjectileLaunchData.h b/include/RE/P/ProjectileLaunchData.h index 7302e500..2aac6d3c 100644 --- a/include/RE/P/ProjectileLaunchData.h +++ b/include/RE/P/ProjectileLaunchData.h @@ -3,7 +3,7 @@ #include "RE/B/BGSBodyPartDefs.h" #include "RE/B/BGSEquipIndex.h" #include "RE/B/BGSObjectInstance.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { @@ -18,38 +18,38 @@ namespace RE { public: // members - NiPoint3 origin; // 00 - NiPoint3 contactNormal; // 0C - BGSProjectile* projectileBase; // 18 - TESObjectREFR* shooter; // 20 - CombatController* shooterCombatController; // 28 - BGSObjectInstanceT fromWeapon; // 30 - TESAmmo* fromAmmo; // 40 - BGSEquipIndex equipIndex; // 48 - float zAngle; // 4C - float xAngle; // 50 - float yAngle; // 54 - TESObjectREFR* homingTarget; // 58 - TESObjectCELL* parentCell; // 60 - MagicItem* spell; // 68 - REX::TEnumSet castingSource; // 70 - AlchemyItem* poison; // 78 - std::int32_t area; // 80 - float power; // 84 - float scale; // 88 - float coneOfFireRadiusMult; // 8C - REX::TEnumSet targetLimb; // 90 - bool alwaysHit; // 94 - bool noDamageOutsideCombat; // 95 - bool autoAim; // 96 - bool useOrigin; // 97 - bool deferInitialization; // 98 - bool tracer; // 99 - bool forceConeOfFire; // 9A - bool intentionalMiss; // 9B - bool allow3D; // 9C - bool penetrates; // 9D - bool ignoreNearCollisions; // 9E + NiPoint3 origin; // 00 + NiPoint3 contactNormal; // 0C + BGSProjectile* projectileBase; // 18 + TESObjectREFR* shooter; // 20 + CombatController* shooterCombatController; // 28 + BGSObjectInstanceT fromWeapon; // 30 + TESAmmo* fromAmmo; // 40 + BGSEquipIndex equipIndex; // 48 + float zAngle; // 4C + float xAngle; // 50 + float yAngle; // 54 + TESObjectREFR* homingTarget; // 58 + TESObjectCELL* parentCell; // 60 + MagicItem* spell; // 68 + MagicSystem::CastingSource castingSource; // 70 + AlchemyItem* poison; // 78 + std::int32_t area; // 80 + float power; // 84 + float scale; // 88 + float coneOfFireRadiusMult; // 8C + BGSBodyPartDefs::LIMB_ENUM targetLimb; // 90 + bool alwaysHit; // 94 + bool noDamageOutsideCombat; // 95 + bool autoAim; // 96 + bool useOrigin; // 97 + bool deferInitialization; // 98 + bool tracer; // 99 + bool forceConeOfFire; // 9A + bool intentionalMiss; // 9B + bool allow3D; // 9C + bool penetrates; // 9D + bool ignoreNearCollisions; // 9E }; static_assert(sizeof(ProjectileLaunchData) == 0xA0); } diff --git a/include/RE/R/RACE_DATA.h b/include/RE/R/RACE_DATA.h index 53ff3e48..1fbd8b1a 100644 --- a/include/RE/R/RACE_DATA.h +++ b/include/RE/R/RACE_DATA.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { @@ -11,50 +11,50 @@ namespace RE { public: // members - float height[2]; // 000 - NiPoint3 weight[2]; // 008 - std::int32_t flags; // 020 - float accelerate; // 024 - float decelerate; // 028 - REX::TEnumSet raceSize; // 02C - REX::TEnumSet headObject; // 030 - REX::TEnumSet hairObject; // 034 - REX::TEnumSet beardObject; // 038 - float injuredHealthPercent; // 03C - REX::TEnumSet shieldObject; // 040 - REX::TEnumSet bodyObject; // 044 - float aimAngleTolerance; // 048 - float flightRadius; // 04C - float angleAccelerate; // 050 - float angleTolerance; // 054 - std::uint32_t flags2; // 058 - NiPoint3 mountOffset; // 05C - NiPoint3 dismountOffset; // 068 - NiPoint3 mountCameraOffset; // 074 - REX::TEnumSet pipboyObject; // 080 - std::int16_t xpValue; // 084 - BGSExplosion* onCrippleExplosion; // 088 - BGSDebris* onCrippleGenericDebris; // 090 - BGSImpactDataSet* onCrippleImpactDataSet; // 098 - float onCrippleGenericDebrisScale; // 0A0 - std::int8_t onCrippleGenericDebrisCount; // 0A4 - std::int8_t onCrippleDecalCount; // 0A5 - BGSExplosion* dismemberExplosion; // 0A8 - BGSDebris* dismemberGenericDebris; // 0B0 - BGSImpactDataSet* dismemberImpactDataSet; // 0B8 - float dismemberGenericDebrisScale; // 0C0 - std::int8_t dismemberGenericDebrisCount; // 0C4 - std::int8_t dismemberDecalCount; // 0C5 - BGSExplosion* explosion; // 0C8 - BGSDebris* explosionGenericDebris; // 0D0 - BGSImpactDataSet* explosionImpactDataSet; // 0D8 - float explosionGenericDebrisScale; // 0E0 - std::int8_t explosionGenericDebrisCount; // 0E4 - std::int8_t explosionDecalCount; // 0E5 - BGSExplosion* subsegmentExplosion; // 0E8 - float maxPitch; // 0F0 - float maxRoll; // 0F4 - float defaultHeadHeight; // 0F8 + float height[2]; // 000 + NiPoint3 weight[2]; // 008 + std::int32_t flags; // 020 + float accelerate; // 024 + float decelerate; // 028 + RACE_SIZE raceSize; // 02C + BIPED_OBJECT headObject; // 030 + BIPED_OBJECT hairObject; // 034 + BIPED_OBJECT beardObject; // 038 + float injuredHealthPercent; // 03C + BIPED_OBJECT shieldObject; // 040 + BIPED_OBJECT bodyObject; // 044 + float aimAngleTolerance; // 048 + float flightRadius; // 04C + float angleAccelerate; // 050 + float angleTolerance; // 054 + std::uint32_t flags2; // 058 + NiPoint3 mountOffset; // 05C + NiPoint3 dismountOffset; // 068 + NiPoint3 mountCameraOffset; // 074 + BIPED_OBJECT pipboyObject; // 080 + std::int16_t xpValue; // 084 + BGSExplosion* onCrippleExplosion; // 088 + BGSDebris* onCrippleGenericDebris; // 090 + BGSImpactDataSet* onCrippleImpactDataSet; // 098 + float onCrippleGenericDebrisScale; // 0A0 + std::int8_t onCrippleGenericDebrisCount; // 0A4 + std::int8_t onCrippleDecalCount; // 0A5 + BGSExplosion* dismemberExplosion; // 0A8 + BGSDebris* dismemberGenericDebris; // 0B0 + BGSImpactDataSet* dismemberImpactDataSet; // 0B8 + float dismemberGenericDebrisScale; // 0C0 + std::int8_t dismemberGenericDebrisCount; // 0C4 + std::int8_t dismemberDecalCount; // 0C5 + BGSExplosion* explosion; // 0C8 + BGSDebris* explosionGenericDebris; // 0D0 + BGSImpactDataSet* explosionImpactDataSet; // 0D8 + float explosionGenericDebrisScale; // 0E0 + std::int8_t explosionGenericDebrisCount; // 0E4 + std::int8_t explosionDecalCount; // 0E5 + BGSExplosion* subsegmentExplosion; // 0E8 + float maxPitch; // 0F0 + float maxRoll; // 0F4 + float defaultHeadHeight; // 0F8 }; static_assert(sizeof(RACE_DATA) == 0x100); } diff --git a/include/RE/R/RACE_SIZE.h b/include/RE/R/RACE_SIZE.h index 7a66c060..26b09d7e 100644 --- a/include/RE/R/RACE_SIZE.h +++ b/include/RE/R/RACE_SIZE.h @@ -4,9 +4,9 @@ namespace RE { enum class RACE_SIZE : std::int32_t { - kSmall = 0x0, - kMedium = 0x1, - kLarge = 0x2, - kExtraLarge = 0x2 + kSmall = 0, + kMedium = 1, + kLarge = 2, + kExtraLarge = 3 }; } diff --git a/include/RE/R/RagDollBone.h b/include/RE/R/RagDollBone.h index 37385812..ec686786 100644 --- a/include/RE/R/RagDollBone.h +++ b/include/RE/R/RagDollBone.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/R/RagDollData.h b/include/RE/R/RagDollData.h index 1c8f2922..b4b0b842 100644 --- a/include/RE/R/RagDollData.h +++ b/include/RE/R/RagDollData.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/R/ReferenceEffectController.h b/include/RE/R/ReferenceEffectController.h index 89d75116..2c9f0ac9 100644 --- a/include/RE/R/ReferenceEffectController.h +++ b/include/RE/R/ReferenceEffectController.h @@ -1,7 +1,6 @@ #pragma once #include "RE/B/BSFixedString.h" -#include "RE/N/NiPoint.h" namespace RE { @@ -9,6 +8,7 @@ namespace RE class BGSSaveGameBuffer; class NiAVObject; class NiNode; + class NiPoint3; class ReferenceEffect; class __declspec(novtable) ReferenceEffectController diff --git a/include/RE/S/SpectatorPackage.h b/include/RE/S/SpectatorPackage.h index e77a6c7c..b7342339 100644 --- a/include/RE/S/SpectatorPackage.h +++ b/include/RE/S/SpectatorPackage.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSTArray.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/T/TESPackage.h" diff --git a/include/RE/S/SpectatorThreatInfo.h b/include/RE/S/SpectatorThreatInfo.h index f6b64b73..67c0dca7 100644 --- a/include/RE/S/SpectatorThreatInfo.h +++ b/include/RE/S/SpectatorThreatInfo.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSPointerHandle.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE @@ -13,24 +13,24 @@ namespace RE public: enum class THREAT_LEVEL : std::int32_t { - kNone = 0x0, - kMeleeWeapons = 0x1, - kProjectileWeapons = 0x2, - kExplosion = 0x3, - kInsane = 0x4 + kNone = 0, + kMeleeWeapons = 1, + kProjectileWeapons = 2, + kExplosion = 3, + kInsane = 4 }; // members - ActorHandle source; // 00 - ActorHandle target; // 04 - REX::TEnumSet threatLevel; // 08 - std::time_t lastPerceivedTime; // 10 - float radius; // 18 - NiPoint3 lastKnownPosSource; // 1C - NiPoint3 lastKnownPosTarget; // 28 - bool hasSource; // 34 - bool hasTarget; // 35 - NiPointer debugGeometry; // 38 + ActorHandle source; // 00 + ActorHandle target; // 04 + THREAT_LEVEL threatLevel; // 08 + std::time_t lastPerceivedTime; // 10 + float radius; // 18 + NiPoint3 lastKnownPosSource; // 1C + NiPoint3 lastKnownPosTarget; // 28 + bool hasSource; // 34 + bool hasTarget; // 35 + NiPointer debugGeometry; // 38 }; static_assert(sizeof(SpectatorThreatInfo) == 0x40); } diff --git a/include/RE/S/SummonPlacementEffect.h b/include/RE/S/SummonPlacementEffect.h index 8e95cc93..a2399e90 100644 --- a/include/RE/S/SummonPlacementEffect.h +++ b/include/RE/S/SummonPlacementEffect.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSTEvent.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/R/ReferenceEffect.h" #include "RE/S/SimpleAnimationGraphManagerHolder.h" diff --git a/include/RE/T/TESCameraState.h b/include/RE/T/TESCameraState.h index d6fac10b..fefecbeb 100644 --- a/include/RE/T/TESCameraState.h +++ b/include/RE/T/TESCameraState.h @@ -4,13 +4,13 @@ #include "RE/B/BSIntrusiveRefCounted.h" #include "RE/B/BSTSmartPointer.h" #include "RE/C/CameraStates.h" -#include "RE/N/NiPoint.h" #include "RE/N/NiQuaternion.h" namespace RE { class BGSLoadFormBuffer; class BGSSaveFormBuffer; + class NiPoint3; class TESCamera; class __declspec(novtable) TESCameraState : @@ -34,8 +34,8 @@ namespace RE virtual void Revert([[maybe_unused]] BGSLoadFormBuffer* a_loadGameBuffer) { return; } // 10 // members - TESCamera* camera; // 18 - REX::TEnumSet id; // 20 + TESCamera* camera; // 18 + REX::TEnum id; // 20 }; static_assert(sizeof(TESCameraState) == 0x28); } diff --git a/include/RE/T/TESImageSpaceModifier.h b/include/RE/T/TESImageSpaceModifier.h index e322b737..1beabe06 100644 --- a/include/RE/T/TESImageSpaceModifier.h +++ b/include/RE/T/TESImageSpaceModifier.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSStringT.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" #include "RE/N/NiPointer.h" #include "RE/T/TESForm.h" diff --git a/include/RE/T/TESNPC.h b/include/RE/T/TESNPC.h index c8f46fbc..fd9081d2 100644 --- a/include/RE/T/TESNPC.h +++ b/include/RE/T/TESNPC.h @@ -11,7 +11,7 @@ #include "RE/B/BSTEvent.h" #include "RE/B/BSTHashMap.h" #include "RE/N/NPC_DATA.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/P/PerkRankData.h" #include "RE/S/SEX.h" #include "RE/T/TESActorBase.h" diff --git a/include/RE/T/TESObjectARMA.h b/include/RE/T/TESObjectARMA.h index 113abbb5..6285f4a9 100644 --- a/include/RE/T/TESObjectARMA.h +++ b/include/RE/T/TESObjectARMA.h @@ -5,7 +5,7 @@ #include "RE/B/BSFixedString.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTHashMap.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/O/OBJ_ARMA.h" #include "RE/T/TESObject.h" #include "RE/T/TESRaceForm.h" diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index d1cac33d..2baab003 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -16,7 +16,7 @@ #include "RE/I/IKeywordFormBase.h" #include "RE/I/ITEM_REMOVE_REASON.h" #include "RE/M/MapMarkerData.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/O/OBJ_REFR.h" #include "RE/T/TESForm.h" diff --git a/include/RE/T/TESRace.h b/include/RE/T/TESRace.h index 7a0b0c63..3f607657 100644 --- a/include/RE/T/TESRace.h +++ b/include/RE/T/TESRace.h @@ -16,7 +16,7 @@ #include "RE/B/BSTArray.h" #include "RE/B/BSTHashMap.h" #include "RE/M/Movement.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/R/RACE_DATA.h" #include "RE/T/TESDescription.h" #include "RE/T/TESForm.h" diff --git a/include/RE/T/TESRegionPoint.h b/include/RE/T/TESRegionPoint.h index 4dffdda6..80c57602 100644 --- a/include/RE/T/TESRegionPoint.h +++ b/include/RE/T/TESRegionPoint.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" namespace RE { diff --git a/include/RE/T/TESWaterForm.h b/include/RE/T/TESWaterForm.h index 54fe5a56..7eb2d63c 100644 --- a/include/RE/T/TESWaterForm.h +++ b/include/RE/T/TESWaterForm.h @@ -1,7 +1,7 @@ #pragma once #include "RE/N/NiColor.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/T/TESForm.h" #include "RE/T/TESFullName.h" diff --git a/include/RE/T/TESWorldSpace.h b/include/RE/T/TESWorldSpace.h index 60b46f21..9c63ac81 100644 --- a/include/RE/T/TESWorldSpace.h +++ b/include/RE/T/TESWorldSpace.h @@ -6,7 +6,7 @@ #include "RE/B/BSStringT.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTHashMap.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint2.h" #include "RE/N/NiPointer.h" #include "RE/N/NiTMap.h" #include "RE/T/TESForm.h" diff --git a/include/RE/T/ThirdPersonState.h b/include/RE/T/ThirdPersonState.h index 7f7789dd..05852df6 100644 --- a/include/RE/T/ThirdPersonState.h +++ b/include/RE/T/ThirdPersonState.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSFixedString.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/N/NiQuaternion.h" #include "RE/T/TESCameraState.h" diff --git a/include/RE/W/WORLD_LOCATION.h b/include/RE/W/WORLD_LOCATION.h index bdcbb4f2..e834925c 100644 --- a/include/RE/W/WORLD_LOCATION.h +++ b/include/RE/W/WORLD_LOCATION.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { diff --git a/include/RE/W/Workshop.h b/include/RE/W/Workshop.h index 8cc120b6..5d7a6416 100644 --- a/include/RE/W/Workshop.h +++ b/include/RE/W/Workshop.h @@ -5,7 +5,7 @@ #include "RE/B/BSPointerHandle.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTTuple.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" #include "RE/P/PowerUtils.h" #include "RE/T/TESObjectCELL.h" diff --git a/include/RE/W/WorkshopMenu.h b/include/RE/W/WorkshopMenu.h index 499e7a72..d1521e62 100644 --- a/include/RE/W/WorkshopMenu.h +++ b/include/RE/W/WorkshopMenu.h @@ -9,7 +9,7 @@ #include "RE/D/DisplayItemModel.h" #include "RE/G/GameMenuBase.h" #include "RE/I/Inventory3DManager.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" #include "RE/N/NiPointer.h" namespace RE diff --git a/src/RE/H/hkMatrix3.cpp b/src/RE/H/hkMatrix3.cpp deleted file mode 100644 index e8b3a7ee..00000000 --- a/src/RE/H/hkMatrix3.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "RE/H/hkMatrix3.h" - -namespace RE -{ - constexpr hkMatrix3f::hkMatrix3f(const hkVector4f& a_vec0, const hkVector4f& a_vec1, const hkVector4f& a_vec2) noexcept - { - col[0] = a_vec0; - col[1] = a_vec1; - col[2] = a_vec2; - } - - constexpr hkMatrix3f::hkMatrix3f( - float a_x0, float a_y0, float a_z0, float a_w0, - float a_x1, float a_y1, float a_z1, float a_w1, - float a_x2, float a_y2, float a_z2, float a_w2) noexcept - { - col[0] = { a_x0, a_y0, a_z0, a_w0 }; - col[1] = { a_x1, a_y1, a_z1, a_w1 }; - col[2] = { a_x2, a_y2, a_z2, a_w2 }; - } - - constexpr hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) noexcept - { - assert(a_pos < 3); - return col[a_pos]; - } - - constexpr const hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) const noexcept - { - assert(a_pos < 3); - return col[a_pos]; - } - - constexpr bool hkMatrix3f::operator==(const hkMatrix3f& a_rhs) const noexcept - { - return (col[0] == a_rhs[0]) && (col[1] == a_rhs[1]) && (col[2] == a_rhs[2]); - } - - constexpr bool hkMatrix3f::operator!=(const hkMatrix3f& a_rhs) const noexcept - { - return !operator==(a_rhs); - } - - constexpr hkMatrix3f hkMatrix3f::operator*(const hkMatrix3f& a_rhs) const noexcept - { - hkMatrix3f result; - result[0][0] = col[0][0] * a_rhs[0][0] + col[0][1] * a_rhs[1][0] + col[0][2] * a_rhs[2][0]; - result[1][0] = col[1][0] * a_rhs[0][0] + col[1][1] * a_rhs[1][0] + col[1][2] * a_rhs[2][0]; - result[2][0] = col[2][0] * a_rhs[0][0] + col[2][1] * a_rhs[1][0] + col[2][2] * a_rhs[2][0]; - result[0][1] = col[0][0] * a_rhs[0][1] + col[0][1] * a_rhs[1][1] + col[0][2] * a_rhs[2][1]; - result[1][1] = col[1][0] * a_rhs[0][1] + col[1][1] * a_rhs[1][1] + col[1][2] * a_rhs[2][1]; - result[2][1] = col[2][0] * a_rhs[0][1] + col[2][1] * a_rhs[1][1] + col[2][2] * a_rhs[2][1]; - result[0][2] = col[0][0] * a_rhs[0][2] + col[0][1] * a_rhs[1][2] + col[0][2] * a_rhs[2][2]; - result[1][2] = col[1][0] * a_rhs[0][2] + col[1][1] * a_rhs[1][2] + col[1][2] * a_rhs[2][2]; - result[2][2] = col[2][0] * a_rhs[0][2] + col[2][1] * a_rhs[1][2] + col[2][2] * a_rhs[2][2]; - return result; - } - - constexpr hkMatrix3f hkMatrix3f::operator*(float a_scalar) const noexcept - { - hkMatrix3f result; - result[0][0] = col[0][0] * a_scalar; - result[0][1] = col[0][1] * a_scalar; - result[0][2] = col[0][2] * a_scalar; - result[1][0] = col[1][0] * a_scalar; - result[1][1] = col[1][1] * a_scalar; - result[1][2] = col[1][2] * a_scalar; - result[2][0] = col[2][0] * a_scalar; - result[2][1] = col[2][1] * a_scalar; - result[2][2] = col[2][2] * a_scalar; - return result; - } -} diff --git a/src/RE/H/hkTransform.cpp b/src/RE/H/hkTransform.cpp deleted file mode 100644 index 97b2455a..00000000 --- a/src/RE/H/hkTransform.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "RE/H/hkTransform.h" - -namespace RE -{ - constexpr hkTransformf::hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept : - rotation(a_rotation), translation(a_translation) - {} -} diff --git a/src/RE/H/hkVector4.cpp b/src/RE/H/hkVector4.cpp index da845a2a..7cd76513 100644 --- a/src/RE/H/hkVector4.cpp +++ b/src/RE/H/hkVector4.cpp @@ -2,169 +2,19 @@ namespace RE { - inline constexpr hkVector4f hkVector4f::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; - - constexpr hkVector4f::hkVector4f(float a_x, float a_y, float a_z, float a_w) noexcept : - x(a_x), y(a_y), z(a_z), w(a_w) - {} - - constexpr float& hkVector4f::operator[](std::size_t a_pos) noexcept - { - assert(a_pos < 4); - return std::addressof(x)[a_pos]; - } - - constexpr const float& hkVector4f::operator[](std::size_t a_pos) const noexcept - { - assert(a_pos < 4); - return std::addressof(x)[a_pos]; - } - - constexpr bool hkVector4f::operator==(const hkVector4f& a_rhs) const noexcept - { - return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z) && (w == a_rhs.w); - } - - constexpr bool hkVector4f::operator!=(const hkVector4f& a_rhs) const noexcept - { - return !operator==(a_rhs); - } - - constexpr bool hkVector4f::operator<(const hkVector4f& a_rhs) const noexcept - { - return std::tie(x, y, z, w) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); - } - - constexpr bool hkVector4f::operator>(const hkVector4f& a_rhs) const noexcept - { - return std::tie(x, y, z, w) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); - } - - constexpr hkVector4f hkVector4f::operator+(const hkVector4f& a_rhs) const noexcept - { - return hkVector4f(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z, w + a_rhs.w); - } - - constexpr hkVector4f hkVector4f::operator-(const hkVector4f& a_rhs) const noexcept - { - return hkVector4f(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z, w - a_rhs.w); - } - - constexpr hkVector4f hkVector4f::operator*(const hkVector4f& a_rhs) const noexcept - { - return hkVector4f(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z, w * a_rhs.w); - } - - constexpr hkVector4f hkVector4f::operator/(const hkVector4f& a_rhs) const noexcept - { - return hkVector4f(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z, w / a_rhs.w); - } - - constexpr hkVector4f hkVector4f::operator*(float a_scalar) const noexcept - { - return hkVector4f(x * a_scalar, y * a_scalar, z * a_scalar, w * a_scalar); - } - - constexpr hkVector4f hkVector4f::operator/(float a_scalar) const noexcept - { - return operator*(1.0F / a_scalar); - } - - constexpr hkVector4f hkVector4f::operator-() const noexcept - { - return hkVector4f(-x, -y, -z, -w); - } - - constexpr hkVector4f& hkVector4f::operator+=(const hkVector4f& a_rhs) noexcept - { - x += a_rhs.x; - y += a_rhs.y; - z += a_rhs.z; - w += a_rhs.w; - return *this; - } - - constexpr hkVector4f& hkVector4f::operator-=(const hkVector4f& a_rhs) noexcept - { - x -= a_rhs.x; - y -= a_rhs.y; - z -= a_rhs.z; - w -= a_rhs.w; - return *this; - } - - constexpr hkVector4f& hkVector4f::operator*=(const hkVector4f& a_rhs) noexcept - { - x *= a_rhs.x; - y *= a_rhs.y; - z *= a_rhs.z; - w *= a_rhs.w; - return *this; - } - - constexpr hkVector4f& hkVector4f::operator/=(const hkVector4f& a_rhs) noexcept - { - x /= a_rhs.x; - y /= a_rhs.y; - z /= a_rhs.z; - w /= a_rhs.w; - return *this; - } - - constexpr hkVector4f& hkVector4f::operator+=(float a_scalar) noexcept - { - x += a_scalar; - y += a_scalar; - z += a_scalar; - w += a_scalar; - return *this; - } - - constexpr hkVector4f& hkVector4f::operator-=(float a_scalar) noexcept - { - x -= a_scalar; - y -= a_scalar; - z -= a_scalar; - w -= a_scalar; - return *this; - } - - constexpr hkVector4f& hkVector4f::operator*=(float a_scalar) noexcept - { - x *= a_scalar; - y *= a_scalar; - z *= a_scalar; - w *= a_scalar; - return *this; - } - - constexpr hkVector4f& hkVector4f::operator/=(float a_scalar) noexcept - { - x /= a_scalar; - y /= a_scalar; - z /= a_scalar; - w /= a_scalar; - return *this; - } - - constexpr float hkVector4f::Dot(const hkVector4f& v) const - { - return this->x * v.x + this->y * v.y + this->z * v.z; - } - - inline hkVector4f hkVector4f::GetNormalized() const + hkVector4f hkVector4f::GetNormalized() const { hkVector4f norm = *this; norm.Normalize(); return norm; } - inline float hkVector4f::Length() const + float hkVector4f::Length() const { return std::sqrt(x * x + y * y + z * z); } - inline hkVector4f& hkVector4f::Normalize() + hkVector4f& hkVector4f::Normalize() { float l = Length(); if (l == 0) { @@ -173,9 +23,11 @@ namespace RE this->z = 0; return *this; } + this->x /= l; this->y /= l; this->z /= l; + return *this; } } diff --git a/src/RE/N/NiMatrix3.cpp b/src/RE/N/NiMatrix3.cpp index 9e4a9132..55f08d87 100644 --- a/src/RE/N/NiMatrix3.cpp +++ b/src/RE/N/NiMatrix3.cpp @@ -2,202 +2,97 @@ namespace RE { - inline constexpr NiMatrix3 NiMatrix3::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; - inline constexpr NiMatrix3 NiMatrix3::IDENTITY = { NiPoint4::IDENTITY0, NiPoint4::IDENTITY0, NiPoint4::IDENTITY0 }; - - constexpr NiMatrix3::NiMatrix3(const NiPoint4& a_point0, const NiPoint4& a_point1, const NiPoint4& a_point2) noexcept - { - entry[0] = a_point0; - entry[1] = a_point1; - entry[2] = a_point2; - } - - constexpr NiMatrix3::NiMatrix3( - float a_x0, float a_y0, float a_z0, float a_w0, - float a_x1, float a_y1, float a_z1, float a_w1, - float a_x2, float a_y2, float a_z2, float a_w2) noexcept - { - entry[0] = { a_x0, a_y0, a_z0, a_w0 }; - entry[1] = { a_x1, a_y1, a_z1, a_w1 }; - entry[2] = { a_x2, a_y2, a_z2, a_w2 }; - } - - constexpr NiPoint4& NiMatrix3::operator[](std::size_t a_pos) noexcept - { - assert(a_pos < 3); - return entry[a_pos]; - } - - constexpr const NiPoint4& NiMatrix3::operator[](std::size_t a_pos) const noexcept - { - assert(a_pos < 3); - return entry[a_pos]; - } - - constexpr bool NiMatrix3::operator==(const NiMatrix3& a_rhs) const noexcept - { - return (entry[0] == a_rhs[0]) && (entry[1] == a_rhs[1]) && (entry[2] == a_rhs[2]); - } - - constexpr bool NiMatrix3::operator!=(const NiMatrix3& a_rhs) const noexcept - { - return !operator==(a_rhs); - } - - constexpr NiMatrix3 NiMatrix3::operator*(const NiMatrix3& a_rhs) const noexcept - { - NiMatrix3 result; - result[0][0] = entry[0][0] * a_rhs[0][0] + entry[0][1] * a_rhs[1][0] + entry[0][2] * a_rhs[2][0]; - result[1][0] = entry[1][0] * a_rhs[0][0] + entry[1][1] * a_rhs[1][0] + entry[1][2] * a_rhs[2][0]; - result[2][0] = entry[2][0] * a_rhs[0][0] + entry[2][1] * a_rhs[1][0] + entry[2][2] * a_rhs[2][0]; - result[0][1] = entry[0][0] * a_rhs[0][1] + entry[0][1] * a_rhs[1][1] + entry[0][2] * a_rhs[2][1]; - result[1][1] = entry[1][0] * a_rhs[0][1] + entry[1][1] * a_rhs[1][1] + entry[1][2] * a_rhs[2][1]; - result[2][1] = entry[2][0] * a_rhs[0][1] + entry[2][1] * a_rhs[1][1] + entry[2][2] * a_rhs[2][1]; - result[0][2] = entry[0][0] * a_rhs[0][2] + entry[0][1] * a_rhs[1][2] + entry[0][2] * a_rhs[2][2]; - result[1][2] = entry[1][0] * a_rhs[0][2] + entry[1][1] * a_rhs[1][2] + entry[1][2] * a_rhs[2][2]; - result[2][2] = entry[2][0] * a_rhs[0][2] + entry[2][1] * a_rhs[1][2] + entry[2][2] * a_rhs[2][2]; - return result; - } - - constexpr NiMatrix3 NiMatrix3::operator*(float a_scalar) const noexcept - { - NiMatrix3 result; - result[0][0] = entry[0][0] * a_scalar; - result[0][1] = entry[0][1] * a_scalar; - result[0][2] = entry[0][2] * a_scalar; - result[1][0] = entry[1][0] * a_scalar; - result[1][1] = entry[1][1] * a_scalar; - result[1][2] = entry[1][2] * a_scalar; - result[2][0] = entry[2][0] * a_scalar; - result[2][1] = entry[2][1] * a_scalar; - result[2][2] = entry[2][2] * a_scalar; - return result; - } - - constexpr NiPoint3 NiMatrix3::operator*(const NiPoint3& a_rhs) const noexcept - { - return NiPoint3( - entry[0][0] * a_rhs.x + entry[0][1] * a_rhs.y + entry[0][2] * a_rhs.z, - entry[1][0] * a_rhs.x + entry[1][1] * a_rhs.y + entry[1][2] * a_rhs.z, - entry[2][0] * a_rhs.x + entry[2][1] * a_rhs.y + entry[2][2] * a_rhs.z); - } - - constexpr void NiMatrix3::MakeIdentity() noexcept - { - entry[0] = NiPoint4::IDENTITY0; - entry[1] = NiPoint4::IDENTITY1; - entry[2] = NiPoint4::IDENTITY2; - } - - constexpr NiMatrix3 NiMatrix3::Transpose() const noexcept - { - NiMatrix3 result; - result[0][0] = entry[0][0]; - result[0][1] = entry[1][0]; - result[0][2] = entry[2][0]; - result[0][3] = entry[0][3]; - result[1][0] = entry[0][1]; - result[1][1] = entry[1][1]; - result[1][2] = entry[2][1]; - result[1][3] = entry[1][3]; - result[2][0] = entry[0][2]; - result[2][1] = entry[1][2]; - result[2][2] = entry[2][2]; - result[2][3] = entry[2][3]; - return result; - } - - inline bool NiMatrix3::ToEulerAnglesXYZ(NiPoint3& a_point) const + bool NiMatrix3::ToEulerAnglesXYZ(NiPoint3& a_point) const { return ToEulerAnglesXYZ(a_point.x, a_point.y, a_point.z); } - inline bool NiMatrix3::ToEulerAnglesXYZ(float& a_x, float& a_y, float& a_z) const + bool NiMatrix3::ToEulerAnglesXYZ(float& a_x, float& a_y, float& a_z) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ REL::ID(2269806) }; + static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesXYZ }; return func(this, a_x, a_y, a_z); } - inline bool NiMatrix3::ToEulerAnglesXZY(float& a_x, float& a_z, float& a_y) const + bool NiMatrix3::ToEulerAnglesXZY(float& a_x, float& a_z, float& a_y) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ REL::ID(2269807) }; + static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesXZY }; return func(this, a_x, a_z, a_y); } - inline bool NiMatrix3::ToEulerAnglesYXZ(float& a_y, float& a_x, float& a_z) const + bool NiMatrix3::ToEulerAnglesYXZ(float& a_y, float& a_x, float& a_z) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ REL::ID(2269808) }; + static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesYXZ }; return func(this, a_y, a_x, a_z); } - inline bool NiMatrix3::ToEulerAnglesYZX(float& a_y, float& a_z, float& a_x) const + bool NiMatrix3::ToEulerAnglesYZX(float& a_y, float& a_z, float& a_x) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ REL::ID(2269809) }; + static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesYZX }; return func(this, a_y, a_z, a_x); } - inline bool NiMatrix3::ToEulerAnglesZYX(float& a_z, float& a_y, float& a_x) const + bool NiMatrix3::ToEulerAnglesZYX(float& a_z, float& a_y, float& a_x) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ REL::ID(2269810) }; + static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesZYX }; return func(this, a_z, a_y, a_x); } - inline bool NiMatrix3::ToEulerAnglesZXY(float& a_z, float& a_x, float& a_y) const + bool NiMatrix3::ToEulerAnglesZXY(float& a_z, float& a_x, float& a_y) const { using func_t = bool (*)(const NiMatrix3*, float&, float&, float&); - static REL::Relocation func{ REL::ID(2269824) }; + static REL::Relocation func{ ID::NiMatrix3::ToEulerAnglesZXY }; return func(this, a_z, a_x, a_y); } - inline void NiMatrix3::FromEulerAnglesXYZ(const NiPoint3& a_point) + void NiMatrix3::FromEulerAnglesXYZ(const NiPoint3& a_point) { FromEulerAnglesXYZ(a_point.x, a_point.y, a_point.z); } - inline void NiMatrix3::FromEulerAnglesXYZ(float a_x, float a_y, float a_z) + void NiMatrix3::FromEulerAnglesXYZ(float a_x, float a_y, float a_z) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ REL::ID(2269813) }; + static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesXYZ }; return func(this, a_x, a_y, a_z); } - inline void NiMatrix3::FromEulerAnglesXZY(float a_x, float a_z, float a_y) + void NiMatrix3::FromEulerAnglesXZY(float a_x, float a_z, float a_y) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ REL::ID(2269814) }; + static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesXZY }; return func(this, a_x, a_z, a_y); } - inline void NiMatrix3::FromEulerAnglesYXZ(float a_y, float a_x, float a_z) + void NiMatrix3::FromEulerAnglesYXZ(float a_y, float a_x, float a_z) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ REL::ID(2269815) }; + static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesYXZ }; return func(this, a_y, a_x, a_z); } - inline void NiMatrix3::FromEulerAnglesYZX(float a_y, float a_z, float a_x) + void NiMatrix3::FromEulerAnglesYZX(float a_y, float a_z, float a_x) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ REL::ID(2269816) }; + static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesYZX }; return func(this, a_y, a_z, a_x); } - inline void NiMatrix3::FromEulerAnglesZYX(float a_z, float a_y, float a_x) + void NiMatrix3::FromEulerAnglesZYX(float a_z, float a_y, float a_x) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ REL::ID(2269817) }; + static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesZYX }; return func(this, a_z, a_y, a_x); } - inline void NiMatrix3::FromEulerAnglesZXY(float a_z, float a_x, float a_y) + void NiMatrix3::FromEulerAnglesZXY(float a_z, float a_x, float a_y) { using func_t = void (*)(NiMatrix3*, float, float, float); - static REL::Relocation func{ REL::ID(2269825) }; + static REL::Relocation func{ ID::NiMatrix3::FromEulerAnglesZXY }; return func(this, a_z, a_x, a_y); } } diff --git a/src/RE/N/NiPoint.cpp b/src/RE/N/NiPoint.cpp index d5679328..ec27a8ac 100644 --- a/src/RE/N/NiPoint.cpp +++ b/src/RE/N/NiPoint.cpp @@ -1,333 +1,33 @@ -#include "RE/N/NiPoint.h" -#include "RE/B/BSHavok.h" +#include "RE/N/NiPoint3.h" namespace RE { - constexpr NiPoint2::NiPoint2(float a_x, float a_y) noexcept : - x(a_x), y(a_y) - {} - - constexpr float& NiPoint2::operator[](std::size_t a_pos) noexcept - { - assert(a_pos < 2); - return std::addressof(x)[a_pos]; - } - - constexpr const float& NiPoint2::operator[](std::size_t a_pos) const noexcept - { - assert(a_pos < 2); - return std::addressof(x)[a_pos]; - } - - constexpr bool NiPoint2::operator==(const NiPoint2& a_rhs) const noexcept - { - return (x == a_rhs.x) && (y == a_rhs.y); - } - - constexpr bool NiPoint2::operator!=(const NiPoint2& a_rhs) const noexcept - { - return !operator==(a_rhs); - } - - constexpr bool NiPoint2::operator<(const NiPoint2& a_rhs) const noexcept - { - return std::tie(x, y) < std::tie(a_rhs.x, a_rhs.y); - } - - constexpr bool NiPoint2::operator>(const NiPoint2& a_rhs) const noexcept - { - return std::tie(x, y) > std::tie(a_rhs.x, a_rhs.y); - } - - constexpr NiPoint2 NiPoint2::operator+(const NiPoint2& a_rhs) const noexcept - { - return NiPoint2(x + a_rhs.x, y + a_rhs.y); - } - - constexpr NiPoint2 NiPoint2::operator-(const NiPoint2& a_rhs) const noexcept - { - return NiPoint2(x - a_rhs.x, y - a_rhs.y); - } - - constexpr NiPoint2 NiPoint2::operator*(const NiPoint2& a_rhs) const noexcept - { - return NiPoint2(x * a_rhs.x, y * a_rhs.y); - } - - constexpr NiPoint2 NiPoint2::operator/(const NiPoint2& a_rhs) const noexcept - { - return NiPoint2(x / a_rhs.x, y / a_rhs.y); - } - - constexpr NiPoint2 NiPoint2::operator*(float a_scalar) const noexcept - { - return NiPoint2(x * a_scalar, y * a_scalar); - } - - constexpr NiPoint2 NiPoint2::operator/(float a_scalar) const noexcept - { - return NiPoint2(x / a_scalar, y / a_scalar); - } - - constexpr NiPoint2 NiPoint2::operator-() const noexcept - { - return NiPoint2(-x, -y); - } - - constexpr NiPoint2& NiPoint2::operator+=(const NiPoint2& a_rhs) noexcept - { - x += a_rhs.x; - y += a_rhs.y; - return *this; - } - - constexpr NiPoint2& NiPoint2::operator-=(const NiPoint2& a_rhs) noexcept - { - x -= a_rhs.x; - y -= a_rhs.y; - return *this; - } - - constexpr NiPoint2& NiPoint2::operator*=(const NiPoint2& a_rhs) noexcept - { - x *= a_rhs.x; - y *= a_rhs.y; - return *this; - } - - constexpr NiPoint2& NiPoint2::operator/=(const NiPoint2& a_rhs) noexcept - { - x /= a_rhs.x; - y /= a_rhs.y; - return *this; - } - - constexpr NiPoint2& NiPoint2::operator+=(float a_scalar) noexcept - { - x += a_scalar; - y += a_scalar; - return *this; - } - - constexpr NiPoint2& NiPoint2::operator-=(float a_scalar) noexcept - { - x -= a_scalar; - y -= a_scalar; - return *this; - } - - constexpr NiPoint2& NiPoint2::operator*=(float a_scalar) noexcept - { - x *= a_scalar; - y *= a_scalar; - return *this; - } - - constexpr NiPoint2& NiPoint2::operator/=(float a_scalar) noexcept - { - x /= a_scalar; - y /= a_scalar; - return *this; - } - - inline constexpr NiPoint2 NiPoint2::ZERO = { 0.0F, 0.0F }; - inline constexpr NiPoint2 NiPoint2::UNIT = { 1.0F, 1.0F }; - inline constexpr NiPoint2 NiPoint2::UNIT_X = { 1.0F, 0.0F }; - inline constexpr NiPoint2 NiPoint2::UNIT_Y = { 0.0F, 1.0F }; -} - -namespace RE -{ - constexpr NiPoint3::NiPoint3(const NiPoint2& a_point) noexcept : - x(a_point.x), y(a_point.y) - {} - - constexpr NiPoint3::NiPoint3(float a_x, float a_y, float a_z) noexcept : - x(a_x), y(a_y), z(a_z) - {} - - constexpr float& NiPoint3::operator[](std::size_t a_pos) noexcept - { - assert(a_pos < 3); - return std::addressof(x)[a_pos]; - } - - constexpr const float& NiPoint3::operator[](std::size_t a_pos) const noexcept - { - assert(a_pos < 3); - return std::addressof(x)[a_pos]; - } - - constexpr bool NiPoint3::operator==(const NiPoint3& a_rhs) const noexcept - { - return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z); - } - - constexpr bool NiPoint3::operator!=(const NiPoint3& a_rhs) const noexcept - { - return !operator==(a_rhs); - } - - constexpr bool NiPoint3::operator<(const NiPoint3& a_rhs) const noexcept - { - return std::tie(x, y, z) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z); - } - - constexpr bool NiPoint3::operator>(const NiPoint3& a_rhs) const noexcept - { - return std::tie(x, y, z) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z); - } - - constexpr NiPoint3 NiPoint3::operator+(const NiPoint3& a_rhs) const noexcept - { - return NiPoint3(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z); - } - - constexpr NiPoint3 NiPoint3::operator-(const NiPoint3& a_rhs) const noexcept - { - return NiPoint3(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z); - } - - constexpr NiPoint3 NiPoint3::operator*(const NiPoint3& a_rhs) const noexcept - { - return NiPoint3(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z); - } - - constexpr NiPoint3 NiPoint3::operator/(const NiPoint3& a_rhs) const noexcept - { - return NiPoint3(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z); - } - - constexpr NiPoint3 NiPoint3::operator*(float a_scalar) const noexcept - { - return NiPoint3(x * a_scalar, y * a_scalar, z * a_scalar); - } - - constexpr NiPoint3 NiPoint3::operator/(float a_scalar) const noexcept - { - return NiPoint3(x / a_scalar, y / a_scalar, z / a_scalar); - } - - constexpr NiPoint3 NiPoint3::operator-() const noexcept - { - return NiPoint3(-x, -y, -z); - } - - constexpr NiPoint3& NiPoint3::operator+=(const NiPoint3& a_rhs) noexcept - { - x += a_rhs.x; - y += a_rhs.y; - z += a_rhs.z; - return *this; - } - - constexpr NiPoint3& NiPoint3::operator-=(const NiPoint3& a_rhs) noexcept - { - x -= a_rhs.x; - y -= a_rhs.y; - z -= a_rhs.z; - return *this; - } - - constexpr NiPoint3& NiPoint3::operator*=(const NiPoint3& a_rhs) noexcept - { - x *= a_rhs.x; - y *= a_rhs.y; - z *= a_rhs.z; - return *this; - } - - constexpr NiPoint3& NiPoint3::operator/=(const NiPoint3& a_rhs) noexcept - { - x /= a_rhs.x; - y /= a_rhs.y; - z /= a_rhs.z; - return *this; - } - - constexpr NiPoint3& NiPoint3::operator+=(float a_scalar) noexcept - { - x += a_scalar; - y += a_scalar; - z += a_scalar; - return *this; - } - - constexpr NiPoint3& NiPoint3::operator-=(float a_scalar) noexcept - { - x -= a_scalar; - y -= a_scalar; - z -= a_scalar; - return *this; - } - - constexpr NiPoint3& NiPoint3::operator*=(float a_scalar) noexcept - { - x *= a_scalar; - y *= a_scalar; - z *= a_scalar; - return *this; - } - - constexpr NiPoint3& NiPoint3::operator/=(float a_scalar) noexcept - { - x /= a_scalar; - y /= a_scalar; - z /= a_scalar; - return *this; - } - - constexpr NiPoint3 NiPoint3::Cross(const NiPoint3& a_point) const noexcept - { - return NiPoint3( - y * a_point.z - z * a_point.y, - z * a_point.x - x * a_point.z, - x * a_point.y - y * a_point.x); - } - - constexpr float NiPoint3::Dot(const NiPoint3& a_point) const noexcept - { - return x * a_point.x + y * a_point.y + z * a_point.z; - } - - constexpr float NiPoint3::GetSquaredDistance(const NiPoint3& a_point) const noexcept - { - const float dx = a_point.x - x; - const float dy = a_point.y - y; - const float dz = a_point.z - z; - return dx * dx + dy * dy + dz * dz; - } - - constexpr float NiPoint3::SqrLength() const noexcept - { - return x * x + y * y + z * z; - } - - inline float NiPoint3::GetDistance(const NiPoint3& a_point) const noexcept + float NiPoint3::GetDistance(const NiPoint3& a_point) const noexcept { + // std math functions are not constexpr yet return std::sqrtf(GetSquaredDistance(a_point)); } - inline float NiPoint3::GetZAngleFromVector() const + float NiPoint3::GetZAngleFromVector() const { using func_t = decltype(&NiPoint3::GetZAngleFromVector); - static REL::Relocation func{ REL::ID(1450064) }; + static REL::Relocation func{ ID::NiPoint3::GetZAngleFromVector }; return func(this); } - inline float NiPoint3::Length() const noexcept + float NiPoint3::Length() const noexcept { return std::sqrtf(x * x + y * y + z * z); } - inline NiPoint3 NiPoint3::UnitCross(const NiPoint3& a_point) const noexcept + NiPoint3 NiPoint3::UnitCross(const NiPoint3& a_point) const noexcept { auto cross = Cross(a_point); cross.Unitize(); return cross; } - inline float NiPoint3::Unitize() noexcept + float NiPoint3::Unitize() noexcept { auto length = Length(); if (length == 1.f) { @@ -342,175 +42,4 @@ namespace RE } return length; } - - inline constexpr NiPoint3 NiPoint3::ZERO = { 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT = { 1.0F, 1.0F, 1.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT_X = { 1.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT_Y = { 0.0F, 1.0F, 0.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT_Z = { 0.0F, 0.0F, 1.0F }; - inline constexpr NiPoint3A NiPoint3A::ZERO = { 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT = { 1.0F, 1.0F, 1.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT_X = { 1.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT_Y = { 0.0F, 1.0F, 0.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT_Z = { 0.0F, 0.0F, 1.0F }; -} - -namespace RE -{ - constexpr NiPoint4::NiPoint4(const NiPoint2& a_point) noexcept : - x(a_point.x), y(a_point.y) - {} - - constexpr NiPoint4::NiPoint4(const NiPoint3& a_point) noexcept : - x(a_point.x), y(a_point.y), z(a_point.z) - {} - - constexpr NiPoint4::NiPoint4(float a_x, float a_y, float a_z, float a_w) noexcept : - x(a_x), y(a_y), z(a_z), w(a_w) - {} - - constexpr float& NiPoint4::operator[](std::size_t a_pos) noexcept - { - assert(a_pos < 4); - return std::addressof(x)[a_pos]; - } - - constexpr const float& NiPoint4::operator[](std::size_t a_pos) const noexcept - { - assert(a_pos < 4); - return std::addressof(x)[a_pos]; - } - - constexpr bool NiPoint4::operator==(const NiPoint4& a_rhs) const noexcept - { - return (x == a_rhs.x) && (y == a_rhs.y) && (z == a_rhs.z) && (w == a_rhs.w); - } - - constexpr bool NiPoint4::operator!=(const NiPoint4& a_rhs) const noexcept - { - return !operator==(a_rhs); - } - - constexpr bool NiPoint4::operator<(const NiPoint4& a_rhs) const noexcept - { - return std::tie(x, y, z, w) < std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); - } - - constexpr bool NiPoint4::operator>(const NiPoint4& a_rhs) const noexcept - { - return std::tie(x, y, z, w) > std::tie(a_rhs.x, a_rhs.y, a_rhs.z, a_rhs.w); - } - - constexpr NiPoint4 NiPoint4::operator+(const NiPoint4& a_rhs) const noexcept - { - return NiPoint4(x + a_rhs.x, y + a_rhs.y, z + a_rhs.z, w + a_rhs.w); - } - - constexpr NiPoint4 NiPoint4::operator-(const NiPoint4& a_rhs) const noexcept - { - return NiPoint4(x - a_rhs.x, y - a_rhs.y, z - a_rhs.z, w - a_rhs.w); - } - - constexpr NiPoint4 NiPoint4::operator*(const NiPoint4& a_rhs) const noexcept - { - return NiPoint4(x * a_rhs.x, y * a_rhs.y, z * a_rhs.z, w * a_rhs.w); - } - - constexpr NiPoint4 NiPoint4::operator/(const NiPoint4& a_rhs) const noexcept - { - return NiPoint4(x / a_rhs.x, y / a_rhs.y, z / a_rhs.z, w / a_rhs.w); - } - - constexpr NiPoint4 NiPoint4::operator*(float a_scalar) const noexcept - { - return NiPoint4(x * a_scalar, y * a_scalar, z * a_scalar, w * a_scalar); - } - - constexpr NiPoint4 NiPoint4::operator/(float a_scalar) const noexcept - { - return operator*(1.0F / a_scalar); - } - - constexpr NiPoint4 NiPoint4::operator-() const noexcept - { - return NiPoint4(-x, -y, -z, -w); - } - - constexpr NiPoint4& NiPoint4::operator+=(const NiPoint4& a_rhs) noexcept - { - x += a_rhs.x; - y += a_rhs.y; - z += a_rhs.z; - w += a_rhs.w; - return *this; - } - - constexpr NiPoint4& NiPoint4::operator-=(const NiPoint4& a_rhs) noexcept - { - x -= a_rhs.x; - y -= a_rhs.y; - z -= a_rhs.z; - w -= a_rhs.w; - return *this; - } - - constexpr NiPoint4& NiPoint4::operator*=(const NiPoint4& a_rhs) noexcept - { - x *= a_rhs.x; - y *= a_rhs.y; - z *= a_rhs.z; - w *= a_rhs.w; - return *this; - } - - constexpr NiPoint4& NiPoint4::operator/=(const NiPoint4& a_rhs) noexcept - { - x /= a_rhs.x; - y /= a_rhs.y; - z /= a_rhs.z; - w /= a_rhs.w; - return *this; - } - - constexpr NiPoint4& NiPoint4::operator+=(float a_scalar) noexcept - { - x += a_scalar; - y += a_scalar; - z += a_scalar; - w += a_scalar; - return *this; - } - - constexpr NiPoint4& NiPoint4::operator-=(float a_scalar) noexcept - { - x -= a_scalar; - y -= a_scalar; - z -= a_scalar; - w -= a_scalar; - return *this; - } - - constexpr NiPoint4& NiPoint4::operator*=(float a_scalar) noexcept - { - x *= a_scalar; - y *= a_scalar; - z *= a_scalar; - w *= a_scalar; - return *this; - } - - constexpr NiPoint4& NiPoint4::operator/=(float a_scalar) noexcept - { - x /= a_scalar; - y /= a_scalar; - z /= a_scalar; - w /= a_scalar; - return *this; - } - - inline constexpr NiPoint4 NiPoint4::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY0 = { 1.0F, 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY1 = { 0.0F, 1.0F, 0.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY2 = { 0.0F, 0.0F, 1.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY3 = { 0.0F, 0.0F, 0.0F, 1.0F }; } diff --git a/src/RE/N/NiTransform.cpp b/src/RE/N/NiTransform.cpp deleted file mode 100644 index 7390bdd9..00000000 --- a/src/RE/N/NiTransform.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "RE/N/NiTransform.h" - -namespace RE -{ - inline constexpr NiTransform NiTransform::ZERO = { NiMatrix3::ZERO, NiPoint3::ZERO, 0.0F }; - inline constexpr NiTransform NiTransform::IDENTITY = { NiMatrix3::IDENTITY, NiPoint3::ZERO, 1.0F }; - - constexpr NiTransform::NiTransform(const NiMatrix3& a_rotation, const NiPoint3& a_translation, const float a_scale) noexcept : - rotate(a_rotation), translate(a_translation), scale(a_scale) - {} - - constexpr bool NiTransform::operator==(const NiTransform& a_rhs) const noexcept - { - return (rotate == a_rhs.rotate) && (translate == a_rhs.translate) && (scale == a_rhs.scale); - } - - constexpr bool NiTransform::operator!=(const NiTransform& a_rhs) const noexcept - { - return !operator==(a_rhs); - } - - constexpr NiTransform NiTransform::operator*(const NiTransform& a_rhs) const noexcept - { - return NiTransform(rotate * a_rhs.rotate, translate + (rotate * a_rhs.translate) * scale, scale * a_rhs.scale); - } - - constexpr NiPoint3 NiTransform::operator*(const NiPoint3& a_rhs) const noexcept - { - return NiPoint3(((rotate * a_rhs) * scale) + translate); - } - - constexpr NiTransform NiTransform::Invert() const noexcept - { - NiTransform transform(*this); - return transform.MakeInvert(); - } - - constexpr NiTransform& NiTransform::MakeIdentity() noexcept - { - rotate = NiMatrix3::IDENTITY; - translate = NiPoint3::ZERO; - scale = 1.0F; - return *this; - } - - constexpr NiTransform& NiTransform::MakeInvert() noexcept - { - rotate = rotate.Transpose(); - scale = 1.0f / scale; - translate = (rotate * -translate) * scale; - return *this; - } -} From baf00c03527c6436c9889f51d3e38888e42caf61 Mon Sep 17 00:00:00 2001 From: qudix Date: Tue, 28 Apr 2026 04:44:03 +0000 Subject: [PATCH 4/9] maintenance --- include/RE/H/hkTransform.h | 2 +- src/RE/N/NiMatrix3.cpp | 2 +- src/RE/N/NiPoint.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/RE/H/hkTransform.h b/include/RE/H/hkTransform.h index 5ef63ab5..739fb76e 100644 --- a/include/RE/H/hkTransform.h +++ b/include/RE/H/hkTransform.h @@ -20,7 +20,7 @@ namespace RE namespace RE { - constexpr hkTransformf::hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept : + constexpr hkTransformf::hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept : rotation(a_rotation), translation(a_translation) {} } diff --git a/src/RE/N/NiMatrix3.cpp b/src/RE/N/NiMatrix3.cpp index 55f08d87..a9c238fc 100644 --- a/src/RE/N/NiMatrix3.cpp +++ b/src/RE/N/NiMatrix3.cpp @@ -2,7 +2,7 @@ namespace RE { - bool NiMatrix3::ToEulerAnglesXYZ(NiPoint3& a_point) const + bool NiMatrix3::ToEulerAnglesXYZ(NiPoint3& a_point) const { return ToEulerAnglesXYZ(a_point.x, a_point.y, a_point.z); } diff --git a/src/RE/N/NiPoint.cpp b/src/RE/N/NiPoint.cpp index ec27a8ac..3e783fe8 100644 --- a/src/RE/N/NiPoint.cpp +++ b/src/RE/N/NiPoint.cpp @@ -2,9 +2,9 @@ namespace RE { - float NiPoint3::GetDistance(const NiPoint3& a_point) const noexcept + float NiPoint3::GetDistance(const NiPoint3& a_point) const noexcept { - // std math functions are not constexpr yet + // std math functions are not constexpr yet return std::sqrtf(GetSquaredDistance(a_point)); } From 8d885a7b8c3c89d085f6407b8687318d9d168e61 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 May 2026 12:47:42 -0500 Subject: [PATCH 5/9] feat: more havok stuff --- include/RE/B/BSHavok.h | 2 +- include/RE/B/bhkNPCollisionObject.h | 4 +- include/RE/B/bhkWorld.h | 107 ++++++++++--- include/RE/B/bhkWorldM.h | 6 +- include/RE/Fallout.h | 12 +- include/RE/H/hclTriangleBuffer.h | 8 +- include/RE/H/hclVectorBuffer.h | 8 +- include/RE/H/hkBaseObject.h | 8 +- include/RE/H/hkBlockStreamBase.h | 28 ++-- include/RE/H/hkBool.h | 20 ++- include/RE/H/hkDisplaySerializeIStream.h | 14 ++ include/RE/H/hkDisplaySerializeOStream.h | 14 ++ include/RE/H/hkHalf.h | 2 +- include/RE/H/hkHandle.h | 2 +- include/RE/H/hkHardwareInfo.h | 4 +- include/RE/H/hkIArchive.h | 28 ++++ include/RE/H/hkIntSpaceUtil.h | 10 +- include/RE/H/hkLifoAllocator.h | 18 +-- include/RE/H/hkMatrix3.h | 56 +++---- include/RE/H/hkMemorySystem.h | 40 ++--- include/RE/H/hkMonitorStream.h | 12 +- include/RE/H/hkOArchive.h | 28 ++++ include/RE/H/hkProcess.h | 44 +++++ include/RE/H/hkProcessContext.h | 15 +- include/RE/H/hkQsTransformf.h | 6 +- include/RE/H/hkQuaternion.h | 2 +- include/RE/H/hkReferencedObject.h | 13 +- include/RE/H/hkResult.h | 27 +++- include/RE/H/hkResultEnum.h | 10 -- include/RE/H/hkSeekableStreamReader.h | 28 ++++ include/RE/H/hkSignal.h | 2 +- include/RE/H/hkSimdFloat32.h | 2 +- include/RE/H/hkSlot.h | 4 +- include/RE/H/hkStepInfo.h | 8 +- include/RE/H/hkStopwatch.h | 14 +- include/RE/H/hkStreamReader.h | 27 ++++ include/RE/H/hkStreamWriter.h | 30 ++++ include/RE/H/hkTransform.h | 16 +- include/RE/H/hkVisualDebugger.h | 31 ++-- include/RE/H/hkcdRay.h | 6 +- include/RE/H/hkcdRayQueryFlags.h | 2 +- include/RE/H/hknpAllHitsCollector.h | 6 +- include/RE/H/hknpBSWorld.h | 59 ++++++- include/RE/H/hknpBody.h | 40 ++--- include/RE/H/hknpBodyCinfo.h | 28 ++-- include/RE/H/hknpBodyManager.h | 52 +++--- include/RE/H/hknpCapsuleShape.h | 6 +- include/RE/H/hknpCharacterContext.h | 24 +-- include/RE/H/hknpCharacterSurfaceInfo.h | 14 +- include/RE/H/hknpClosestHitCollector.h | 14 +- include/RE/H/hknpCollisionQuery.h | 6 +- include/RE/H/hknpCollisionQueryCollector.h | 14 +- include/RE/H/hknpConvexPolytopeShape.h | 7 + include/RE/H/hknpConvexShape.h | 10 +- include/RE/H/hknpDefaultViewerColorScheme.h | 4 +- include/RE/H/hknpDynamicCompoundShape.h | 2 +- include/RE/H/hknpMotionCinfo.h | 22 +-- include/RE/H/hknpMotionManager.h | 2 +- include/RE/H/hknpMotionPropertiesId.h | 12 +- include/RE/H/hknpPhysicsSystem.h | 8 +- include/RE/H/hknpPhysicsSystemData.h | 16 +- include/RE/H/hknpProcessContext.h | 18 +-- include/RE/H/hknpProcessContextListener.h | 21 +++ include/RE/H/hknpQueryFilterData.h | 6 +- include/RE/H/hknpRayCastQuery.h | 6 +- include/RE/H/hknpShape.h | 19 +-- include/RE/H/hknpShapeInstance.h | 13 +- include/RE/H/hknpShapeManager.h | 14 +- include/RE/H/hknpShapeSignals.h | 4 +- include/RE/H/hknpSolverInfo.h | 60 +++---- include/RE/H/hknpSparseCompactMap.h | 8 +- include/RE/H/hknpThreadSafetyCheck.h | 12 +- include/RE/H/hknpTriangleShape.h | 35 ++++ include/RE/H/hknpViewer.h | 29 ++++ include/RE/H/hknpViewerColorScheme.h | 9 +- include/RE/H/hknpWorld.h | 168 +++++++++++++------- include/RE/IDs.h | 61 ++++++- 77 files changed, 1049 insertions(+), 498 deletions(-) create mode 100644 include/RE/H/hkDisplaySerializeIStream.h create mode 100644 include/RE/H/hkDisplaySerializeOStream.h create mode 100644 include/RE/H/hkIArchive.h create mode 100644 include/RE/H/hkOArchive.h create mode 100644 include/RE/H/hkProcess.h delete mode 100644 include/RE/H/hkResultEnum.h create mode 100644 include/RE/H/hkSeekableStreamReader.h create mode 100644 include/RE/H/hkStreamReader.h create mode 100644 include/RE/H/hkStreamWriter.h create mode 100644 include/RE/H/hknpProcessContextListener.h create mode 100644 include/RE/H/hknpTriangleShape.h create mode 100644 include/RE/H/hknpViewer.h diff --git a/include/RE/B/BSHavok.h b/include/RE/B/BSHavok.h index bac2bd0e..1c5bcb3f 100644 --- a/include/RE/B/BSHavok.h +++ b/include/RE/B/BSHavok.h @@ -24,7 +24,7 @@ namespace RE ni[2] = { a_hk[0][2], a_hk[1][2], a_hk[2][2], 0.0F }; return ni; } else if constexpr (std::is_same_v && std::is_same_v) { - return NiTransform(HK_TO_NI(a_hk.rotation), HK_TO_NI(a_hk.translation)); + return NiTransform(HK_TO_NI(a_hk.m_rotation), HK_TO_NI(a_hk.m_translation)); } } diff --git a/include/RE/B/bhkNPCollisionObject.h b/include/RE/B/bhkNPCollisionObject.h index ac4c6a03..7613d191 100644 --- a/include/RE/B/bhkNPCollisionObject.h +++ b/include/RE/B/bhkNPCollisionObject.h @@ -49,11 +49,11 @@ namespace RE return func(this); } - hknpBodyId& GetBodyId(hknpBodyId& a_id) + hknpBodyId& GetBodyId(hknpBodyId& a_bodyId) { using func_t = decltype(&bhkNPCollisionObject::GetBodyId); static REL::Relocation func{ ID::bhkNPCollisionObject::GetBodyId }; - return func(this, a_id); + return func(this, a_bodyId); } NiPointer GetPhysicsSystem() const diff --git a/include/RE/B/bhkWorld.h b/include/RE/B/bhkWorld.h index 24d29d10..9ce4bd51 100644 --- a/include/RE/B/bhkWorld.h +++ b/include/RE/B/bhkWorld.h @@ -11,6 +11,7 @@ namespace RE { + class bhkIAddToWorld; class bhkTrapListener; class hclBSWorld; class hkbnpPhysicsInterface; @@ -33,6 +34,13 @@ namespace RE virtual bool Update(std::uint32_t a_updateFlags); // 28 virtual void Init(const hknpWorldCinfo& a_info); // 29 + bool AddObjects(NiAVObject* a_object, bool a_recurse, bool a_notify, std::uint32_t a_group, bool a_force, const bhkIAddToWorld* a_addToWorld) + { + using func_t = decltype(&bhkWorld::AddObjects); + static REL::Relocation func{ ID::bhkWorld::AddObjects }; + return func(this, a_object, a_recurse, a_notify, a_group, a_force, a_addToWorld); + } + void AddPhysicsSystem(hknpPhysicsSystem* a_physicsSystem, bool a_startActive) { using func_t = decltype(&bhkWorld::AddPhysicsSystem); @@ -40,6 +48,13 @@ namespace RE func(this, a_physicsSystem, a_startActive); } + bool IsBodyAdded(hknpBodyId a_bodyId) + { + using func_t = decltype(&bhkWorld::IsBodyAdded); + static REL::Relocation func{ ID::bhkWorld::IsBodyAdded }; + return func(this, a_bodyId); + } + void RemovePhysicsSystem(hknpPhysicsSystem* a_physicsSystem) { using func_t = decltype(&bhkWorld::RemovePhysicsSystem); @@ -47,34 +62,84 @@ namespace RE func(this, a_physicsSystem); } - inline static bool RemoveObjects(NiAVObject* a_object, bool a_recurse, bool a_force) + static bool Activate(NiAVObject* a_object, bool a_activate, bool a_recurse, bool a_force) + { + using func_t = decltype(&bhkWorld::Activate); + static REL::Relocation func{ ID::bhkWorld::Activate }; + return func(a_object, a_activate, a_recurse, a_force); + } + + static bool Enable(NiAVObject* a_object, bool a_enable, bool a_recurse, bool a_force) + { + using func_t = decltype(&bhkWorld::Enable); + static REL::Relocation func{ ID::bhkWorld::Enable }; + return func(a_object, a_enable, a_recurse, a_force); + } + + static bool EnableCollision(NiAVObject* a_object, bool a_enable, bool a_recurse, bool a_force) + { + using func_t = decltype(&bhkWorld::EnableCollision); + static REL::Relocation func{ ID::bhkWorld::EnableCollision }; + return func(a_object, a_enable, a_recurse, a_force); + } + + static bool IsActive(NiAVObject* a_object, bool a_recurse, bool a_force) + { + using func_t = decltype(&bhkWorld::IsActive); + static REL::Relocation func{ ID::bhkWorld::IsActive }; + return func(a_object, a_recurse, a_force); + } + + static bool RemoveObjects(NiAVObject* a_object, bool a_recurse, bool a_force) { using func_t = decltype(&bhkWorld::RemoveObjects); static REL::Relocation func{ ID::bhkWorld::RemoveObjects }; return func(a_object, a_recurse, a_force); } + static bool SetCollisionGroup(NiAVObject* a_object, std::uint32_t a_group, bool a_recurse, bool a_force) + { + using func_t = decltype(&bhkWorld::SetCollisionGroup); + static REL::Relocation func{ ID::bhkWorld::SetCollisionGroup }; + return func(a_object, a_group, a_recurse, a_force); + } + + static bool SetDismemberedLimb(NiAVObject* a_object, bool a_tf, bool a_recurse) + { + using func_t = decltype(&bhkWorld::SetDismemberedLimb); + static REL::Relocation func{ ID::bhkWorld::SetDismemberedLimb }; + return func(a_object, a_tf, a_recurse); + } + + static bool SetMotion(NiAVObject* a_object, std::uint32_t a_type, bool a_recurse, bool a_force, bool a_allowActivate) + { + using func_t = decltype(&bhkWorld::SetMotion); + static REL::Relocation func{ ID::bhkWorld::SetMotion }; + return func(a_object, a_type, a_recurse, a_force, a_allowActivate); + } + // members - hkRefPtr taskQueue; - BSTArray stepListenerA; - hkRefPtr behaviorInterface; - BSReadWriteLock charProxyManagerLock; - BSReadWriteLock charRigidBodyManagerLock; - BSReadWriteLock stepListenerALock; - hkVector4f origin; - hkRefPtr worldNP; - bhkCharProxyManager charProxyManager; - bhkCharRigidBodyManager charRigidBodyManager; - hkRefPtr clothWorld; - char* clothStepBuffer; - std::int32_t clothStepBufferSize; - hknpWorld::AdditionMode additionMode; - bhkTrapListener* trapListener; - float originalTau; - float originalDamping; - bool globalWindActivated; - bool added; - bool enabled; + hkRefPtr m_taskQueue; // 0x010 + BSTArray m_stepListenerA; // 0x018 + hkRefPtr m_behaviorInterface; // 0x030 + BSReadWriteLock m_charProxyManagerLock; // 0x038 + BSReadWriteLock m_charRigidBodyManagerLock; // 0x040 + BSReadWriteLock m_stepListenerALock; // 0x048 + hkVector4f m_origin; // 0x050 + hkRefPtr m_worldNP; // 0x060 + bhkCharProxyManager m_charProxyManager; // 0x068 + bhkCharRigidBodyManager m_charRigidBodyManager; // 0x0D8 + hkRefPtr m_clothWorld; // 0x148 + char* m_clothStepBuffer; // 0x150 + std::int32_t m_clothStepBufferSize; // 0x158 + hknpWorld::AdditionMode m_additionMode; // 0x15C + bhkTrapListener* m_trapListener; // 0x160 + float m_originalTau; // 0x168 + float m_originalDamping; // 0x16C + bool m_globalWindActivated; // 0x170 + bool m_added; // 0x171 + bool m_enabled; // 0x172 + std::byte m_pad173[0xD]; // 0x173 }; static_assert(sizeof(bhkWorld) == 0x180); } diff --git a/include/RE/B/bhkWorldM.h b/include/RE/B/bhkWorldM.h index a0fa9a55..bad5ab76 100644 --- a/include/RE/B/bhkWorldM.h +++ b/include/RE/B/bhkWorldM.h @@ -15,9 +15,9 @@ namespace RE virtual ~bhkWorldM(); // 00 // members - hkVector4f worldTotalSize; - hkVector4f borderSize; - hkVector4f broadPhaseSize; + hkVector4f m_worldTotalSize; // 0x180 + hkVector4f m_borderSize; // 0x190 + hkVector4f m_broadPhaseSize; // 0x1A0 }; static_assert(sizeof(bhkWorldM) == 0x1B0); } diff --git a/include/RE/Fallout.h b/include/RE/Fallout.h index 7169b282..58b2aedc 100644 --- a/include/RE/Fallout.h +++ b/include/RE/Fallout.h @@ -745,12 +745,15 @@ #include "RE/H/hkBool.h" #include "RE/H/hkContainerHeapAllocator.h" #include "RE/H/hkCriticalSection.h" +#include "RE/H/hkDisplaySerializeIStream.h" +#include "RE/H/hkDisplaySerializeOStream.h" #include "RE/H/hkEnum.h" #include "RE/H/hkFlags.h" #include "RE/H/hkFreeListArray.h" #include "RE/H/hkHalf.h" #include "RE/H/hkHandle.h" #include "RE/H/hkHardwareInfo.h" +#include "RE/H/hkIArchive.h" #include "RE/H/hkIntSpaceUtil.h" #include "RE/H/hkLifoAllocator.h" #include "RE/H/hkLocalArray.h" @@ -761,7 +764,9 @@ #include "RE/H/hkMemorySystem.h" #include "RE/H/hkMonitorStream.h" #include "RE/H/hkMultiMap.h" +#include "RE/H/hkOArchive.h" #include "RE/H/hkPadSpu.h" +#include "RE/H/hkProcess.h" #include "RE/H/hkProcessContext.h" #include "RE/H/hkProcessFactory.h" #include "RE/H/hkPtrAndInt.h" @@ -771,13 +776,15 @@ #include "RE/H/hkReferencedObject.h" #include "RE/H/hkRelArray.h" #include "RE/H/hkResult.h" -#include "RE/H/hkResultEnum.h" #include "RE/H/hkRotation.h" +#include "RE/H/hkSeekableStreamReader.h" #include "RE/H/hkSignal.h" #include "RE/H/hkSimdFloat32.h" #include "RE/H/hkSlot.h" #include "RE/H/hkStepInfo.h" #include "RE/H/hkStopwatch.h" +#include "RE/H/hkStreamReader.h" +#include "RE/H/hkStreamWriter.h" #include "RE/H/hkStridedVertices.h" #include "RE/H/hkStringPtr.h" #include "RE/H/hkTransform.h" @@ -824,6 +831,7 @@ #include "RE/H/hknpPhysicsSystem.h" #include "RE/H/hknpPhysicsSystemData.h" #include "RE/H/hknpProcessContext.h" +#include "RE/H/hknpProcessContextListener.h" #include "RE/H/hknpQueryFilterData.h" #include "RE/H/hknpRayCastQuery.h" #include "RE/H/hknpRayCastQueryResult.h" @@ -837,7 +845,9 @@ #include "RE/H/hknpSparseCompactMap.h" #include "RE/H/hknpSphereShape.h" #include "RE/H/hknpThreadSafetyCheck.h" +#include "RE/H/hknpTriangleShape.h" #include "RE/H/hknpUniqueBodyIdHitCollector.h" +#include "RE/H/hknpViewer.h" #include "RE/H/hknpViewerColorScheme.h" #include "RE/H/hknpWorld.h" #include "RE/H/hknpWorldCinfo.h" diff --git a/include/RE/H/hclTriangleBuffer.h b/include/RE/H/hclTriangleBuffer.h index ac17dc48..d9139633 100644 --- a/include/RE/H/hclTriangleBuffer.h +++ b/include/RE/H/hclTriangleBuffer.h @@ -8,10 +8,10 @@ namespace RE { public: // members - const void* bufferStart; // 00 - std::uint32_t numElements; // 08 - std::uint8_t stride; // 0C - hkBool use16BitsIndices; /// 0D + const void* m_bufferStart; // 0x00 + std::uint32_t m_numElements; // 0x08 + std::uint8_t m_stride; // 0x0C + hkBool m_use16BitsIndices; // 0x0D }; static_assert(sizeof(hclTriangleBuffer) == 0x10); } diff --git a/include/RE/H/hclVectorBuffer.h b/include/RE/H/hclVectorBuffer.h index f917f269..3c437dbc 100644 --- a/include/RE/H/hclVectorBuffer.h +++ b/include/RE/H/hclVectorBuffer.h @@ -6,10 +6,10 @@ namespace RE { public: // members - void* bufferStart; // 00 - std::uint32_t numElements; // 08 - std::uint8_t stride; // 0C - std::uint32_t flags; // 10 + void* m_bufferStart; // 0x00 + std::uint32_t m_numElements; // 0x08 + std::uint8_t m_stride; // 0x0C + std::uint32_t m_flags; // 0x10 }; static_assert(sizeof(hclVectorBuffer) == 0x18); } diff --git a/include/RE/H/hkBaseObject.h b/include/RE/H/hkBaseObject.h index cd02c54d..f483821b 100644 --- a/include/RE/H/hkBaseObject.h +++ b/include/RE/H/hkBaseObject.h @@ -2,15 +2,17 @@ namespace RE { - class hkBaseObject + class __declspec(novtable) hkBaseObject { public: inline static constexpr auto RTTI{ RTTI::hkBaseObject }; inline static constexpr auto VTABLE{ VTABLE::hkBaseObject }; + hkBaseObject() { REX::EMPLACE_VTABLE(this); } + // add - virtual ~hkBaseObject(); // 00 - virtual void __first_virtual_table_function__(); // 01 + virtual ~hkBaseObject() {}; // 0x00 [00] + virtual void __first_virtual_table_function__() {} // 0x08 [01] }; static_assert(sizeof(hkBaseObject) == 0x08); } diff --git a/include/RE/H/hkBlockStreamBase.h b/include/RE/H/hkBlockStreamBase.h index 4773c6e6..462ff955 100644 --- a/include/RE/H/hkBlockStreamBase.h +++ b/include/RE/H/hkBlockStreamBase.h @@ -16,12 +16,12 @@ namespace RE { public: // members - std::uint32_t numElementsAndBytesUsed; // 00 - std::int32_t blockIndexInStream; // 04 - Block* next; // 08 - hkBlockStreamAllocator* allocator; // 10 - Stream* blockStream; // 18 - std::byte data[4064]; // 20 + std::uint32_t m_numElementsAndBytesUsed; // 0x00 + std::int32_t m_blockIndexInStream; // 0x04 + Block* m_next; // 0x08 + hkBlockStreamAllocator* m_allocator; // 0x10 + Stream* m_blockStream; // 0x18 + std::byte m_data[4064]; // 0x20 }; static_assert(sizeof(Block) == 0x1000); @@ -29,14 +29,14 @@ namespace RE { public: // members - hkBlockStreamAllocator* allocator; // 00 - std::int32_t numTotalElements; // 08 - Stream* blockStreamPPU; // 10 - hkBool partiallyFreed; // 18 - hkBool zeroNewBlocks; // 19 - hkBool isLocked; // 1A - hkBool spuWronglySentConsumedBlockStreamBack; // 1B - hkInplaceArrayAligned16 blocks; // 20 + hkBlockStreamAllocator* m_allocator; // 0x00 + std::int32_t m_numTotalElements; // 0x08 + Stream* m_blockStreamPPU; // 0x10 + hkBool m_partiallyFreed; // 0x18 + hkBool m_zeroNewBlocks; // 0x19 + hkBool m_isLocked; // 0x1A + hkBool m_spuWronglySentConsumedBlockStreamBack; // 0x1B + hkInplaceArrayAligned16 m_blocks; // 0x20 }; static_assert(sizeof(Stream) == 0x100); }; diff --git a/include/RE/H/hkBool.h b/include/RE/H/hkBool.h index 24652b45..c9aa8dcb 100644 --- a/include/RE/H/hkBool.h +++ b/include/RE/H/hkBool.h @@ -5,10 +5,26 @@ namespace RE class hkBool { public: + hkBool() = default; + + hkBool(bool a_bool) : + m_bool(a_bool) + {} + + hkBool& operator=(bool a_bool) + { + m_bool = a_bool; + return *this; + } + + bool operator==(const hkBool&) const = default; + bool operator!=(const hkBool&) const = default; + + operator bool() { return m_bool; } + // members - bool _bool; // 00 + bool m_bool{ false }; }; - static_assert(sizeof(hkBool) == 0x01); using hkBool32 = std::uint32_t; using hkBoolLL = std::uint64_t; diff --git a/include/RE/H/hkDisplaySerializeIStream.h b/include/RE/H/hkDisplaySerializeIStream.h new file mode 100644 index 00000000..a3d32450 --- /dev/null +++ b/include/RE/H/hkDisplaySerializeIStream.h @@ -0,0 +1,14 @@ +#pragma once + +#include "RE/H/hkIArchive.h" + +namespace RE +{ + class __declspec(novtable) hkDisplaySerializeIStream : + public hkIArchive + { + public: + inline static constexpr auto RTTI{ RTTI::hkDisplaySerializeIStream }; + inline static constexpr auto VTABLE{ VTABLE::hkDisplaySerializeIStream }; + }; +} diff --git a/include/RE/H/hkDisplaySerializeOStream.h b/include/RE/H/hkDisplaySerializeOStream.h new file mode 100644 index 00000000..e0ef1b9e --- /dev/null +++ b/include/RE/H/hkDisplaySerializeOStream.h @@ -0,0 +1,14 @@ +#pragma once + +#include "RE/H/hkOArchive.h" + +namespace RE +{ + class __declspec(novtable) hkDisplaySerializeOStream : + public hkOArchive + { + public: + inline static constexpr auto RTTI{ RTTI::hkDisplaySerializeOStream }; + inline static constexpr auto VTABLE{ VTABLE::hkDisplaySerializeOStream }; + }; +} diff --git a/include/RE/H/hkHalf.h b/include/RE/H/hkHalf.h index 427f7520..78ef8184 100644 --- a/include/RE/H/hkHalf.h +++ b/include/RE/H/hkHalf.h @@ -5,6 +5,6 @@ namespace RE class hkHalf { public: - std::int16_t value; + std::int16_t m_value; }; } diff --git a/include/RE/H/hkHandle.h b/include/RE/H/hkHandle.h index 0e62b421..0922751d 100644 --- a/include/RE/H/hkHandle.h +++ b/include/RE/H/hkHandle.h @@ -9,7 +9,7 @@ namespace RE ~hkHandle() noexcept {} // intentional // members - T value; // 0x00 + T m_value; // 0x00 }; static_assert(sizeof(hkHandle) == 0x01); } diff --git a/include/RE/H/hkHardwareInfo.h b/include/RE/H/hkHardwareInfo.h index 74fa41c9..f3e327a7 100644 --- a/include/RE/H/hkHardwareInfo.h +++ b/include/RE/H/hkHardwareInfo.h @@ -19,8 +19,8 @@ namespace RE } // members - std::int32_t numHardwareThreads; - std::uint32_t cpuFeatures; + std::int32_t m_numHardwareThreads; + std::uint32_t m_cpuFeatures; }; static_assert(sizeof(hkHardwareInfo) == 0x18); } diff --git a/include/RE/H/hkIArchive.h b/include/RE/H/hkIArchive.h new file mode 100644 index 00000000..72233871 --- /dev/null +++ b/include/RE/H/hkIArchive.h @@ -0,0 +1,28 @@ +#pragma once + +#include "RE/H/hkBool.h" +#include "RE/H/hkReferencedObject.h" +#include "RE/H/hkRefPtr.h" +#include "RE/H/hkStreamReader.h" + +namespace RE +{ + class __declspec(novtable) hkIArchive : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkIArchive }; + inline static constexpr auto VTABLE{ VTABLE::hkIArchive }; + + bool IsOk() const + { + return m_reader->IsOk(); + } + + // members + hkRefPtr m_reader; // 0x10 + hkBool m_byteSwap; // 0x18 + std::byte m_pad19[7]; // 0x19 + }; + static_assert(sizeof(hkIArchive) == 0x20); +} diff --git a/include/RE/H/hkIntSpaceUtil.h b/include/RE/H/hkIntSpaceUtil.h index 5be72f59..ace97b51 100644 --- a/include/RE/H/hkIntSpaceUtil.h +++ b/include/RE/H/hkIntSpaceUtil.h @@ -9,11 +9,11 @@ namespace RE { public: // members - hkVector4f bitOffsetLow; // 0x00 - hkVector4f bitOffsetHigh; // 0x10 - hkVector4f bitScale; // 0x20 - hkVector4f bitScaleInv; // 0x30 - hkAabb aabb; // 0x40 + hkVector4f m_bitOffsetLow; // 0x00 + hkVector4f m_bitOffsetHigh; // 0x10 + hkVector4f m_bitScale; // 0x20 + hkVector4f m_bitScaleInv; // 0x30 + hkAabb m_aabb; // 0x40 }; static_assert(sizeof(hkIntSpaceUtil) == 0x60); } diff --git a/include/RE/H/hkLifoAllocator.h b/include/RE/H/hkLifoAllocator.h index 0b7da41a..d2bec735 100644 --- a/include/RE/H/hkLifoAllocator.h +++ b/include/RE/H/hkLifoAllocator.h @@ -39,15 +39,15 @@ namespace RE } // members - Implementation* impl{ nullptr }; // 0x08 - const std::int32_t slabSize{ 0x8000 }; // 0x10 - void* cur{ nullptr }; // 0x18 - void* end{ nullptr }; // 0x20 - void* firstNonLifoEnd{ nullptr }; // 0x28 - void* cachedEmptySlab{ nullptr }; // 0x30 - hkMemoryAllocator* slabAllocator{ nullptr }; // 0x38 - hkMemoryAllocator* largeAllocator{ nullptr }; // 0x40 - hkMemoryAllocator* internalAllocator{ nullptr }; // 0x48 + Implementation* m_impl{ nullptr }; // 0x08 + const std::int32_t m_slabSize{ 0x8000 }; // 0x10 + void* m_cur{ nullptr }; // 0x18 + void* m_end{ nullptr }; // 0x20 + void* m_firstNonLifoEnd{ nullptr }; // 0x28 + void* m_cachedEmptySlab{ nullptr }; // 0x30 + hkMemoryAllocator* m_slabAllocator{ nullptr }; // 0x38 + hkMemoryAllocator* m_largeAllocator{ nullptr }; // 0x40 + hkMemoryAllocator* m_internalAllocator{ nullptr }; // 0x48 }; static_assert(sizeof(hkLifoAllocator) == 0x50); } diff --git a/include/RE/H/hkMatrix3.h b/include/RE/H/hkMatrix3.h index cebae0f5..67e0c596 100644 --- a/include/RE/H/hkMatrix3.h +++ b/include/RE/H/hkMatrix3.h @@ -22,7 +22,7 @@ namespace RE constexpr hkMatrix3f operator*(float a_scalar) const noexcept; // members - hkVector4f col[3]; // 00 + hkVector4f m_col[3]; // 0x00 }; static_assert(sizeof(hkMatrix3f) == 0x30); @@ -33,9 +33,9 @@ namespace RE { constexpr hkMatrix3f::hkMatrix3f(const hkVector4f& a_vec0, const hkVector4f& a_vec1, const hkVector4f& a_vec2) noexcept { - col[0] = a_vec0; - col[1] = a_vec1; - col[2] = a_vec2; + m_col[0] = a_vec0; + m_col[1] = a_vec1; + m_col[2] = a_vec2; } constexpr hkMatrix3f::hkMatrix3f( @@ -43,26 +43,26 @@ namespace RE float a_x1, float a_y1, float a_z1, float a_w1, float a_x2, float a_y2, float a_z2, float a_w2) noexcept { - col[0] = { a_x0, a_y0, a_z0, a_w0 }; - col[1] = { a_x1, a_y1, a_z1, a_w1 }; - col[2] = { a_x2, a_y2, a_z2, a_w2 }; + m_col[0] = { a_x0, a_y0, a_z0, a_w0 }; + m_col[1] = { a_x1, a_y1, a_z1, a_w1 }; + m_col[2] = { a_x2, a_y2, a_z2, a_w2 }; } constexpr hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) noexcept { assert(a_pos < 3); - return col[a_pos]; + return m_col[a_pos]; } constexpr const hkVector4f& hkMatrix3f::operator[](std::size_t a_pos) const noexcept { assert(a_pos < 3); - return col[a_pos]; + return m_col[a_pos]; } constexpr bool hkMatrix3f::operator==(const hkMatrix3f& a_rhs) const noexcept { - return (col[0] == a_rhs[0]) && (col[1] == a_rhs[1]) && (col[2] == a_rhs[2]); + return (m_col[0] == a_rhs[0]) && (m_col[1] == a_rhs[1]) && (m_col[2] == a_rhs[2]); } constexpr bool hkMatrix3f::operator!=(const hkMatrix3f& a_rhs) const noexcept @@ -73,30 +73,30 @@ namespace RE constexpr hkMatrix3f hkMatrix3f::operator*(const hkMatrix3f& a_rhs) const noexcept { hkMatrix3f result; - result[0][0] = col[0][0] * a_rhs[0][0] + col[0][1] * a_rhs[1][0] + col[0][2] * a_rhs[2][0]; - result[1][0] = col[1][0] * a_rhs[0][0] + col[1][1] * a_rhs[1][0] + col[1][2] * a_rhs[2][0]; - result[2][0] = col[2][0] * a_rhs[0][0] + col[2][1] * a_rhs[1][0] + col[2][2] * a_rhs[2][0]; - result[0][1] = col[0][0] * a_rhs[0][1] + col[0][1] * a_rhs[1][1] + col[0][2] * a_rhs[2][1]; - result[1][1] = col[1][0] * a_rhs[0][1] + col[1][1] * a_rhs[1][1] + col[1][2] * a_rhs[2][1]; - result[2][1] = col[2][0] * a_rhs[0][1] + col[2][1] * a_rhs[1][1] + col[2][2] * a_rhs[2][1]; - result[0][2] = col[0][0] * a_rhs[0][2] + col[0][1] * a_rhs[1][2] + col[0][2] * a_rhs[2][2]; - result[1][2] = col[1][0] * a_rhs[0][2] + col[1][1] * a_rhs[1][2] + col[1][2] * a_rhs[2][2]; - result[2][2] = col[2][0] * a_rhs[0][2] + col[2][1] * a_rhs[1][2] + col[2][2] * a_rhs[2][2]; + result[0][0] = m_col[0][0] * a_rhs[0][0] + m_col[0][1] * a_rhs[1][0] + m_col[0][2] * a_rhs[2][0]; + result[1][0] = m_col[1][0] * a_rhs[0][0] + m_col[1][1] * a_rhs[1][0] + m_col[1][2] * a_rhs[2][0]; + result[2][0] = m_col[2][0] * a_rhs[0][0] + m_col[2][1] * a_rhs[1][0] + m_col[2][2] * a_rhs[2][0]; + result[0][1] = m_col[0][0] * a_rhs[0][1] + m_col[0][1] * a_rhs[1][1] + m_col[0][2] * a_rhs[2][1]; + result[1][1] = m_col[1][0] * a_rhs[0][1] + m_col[1][1] * a_rhs[1][1] + m_col[1][2] * a_rhs[2][1]; + result[2][1] = m_col[2][0] * a_rhs[0][1] + m_col[2][1] * a_rhs[1][1] + m_col[2][2] * a_rhs[2][1]; + result[0][2] = m_col[0][0] * a_rhs[0][2] + m_col[0][1] * a_rhs[1][2] + m_col[0][2] * a_rhs[2][2]; + result[1][2] = m_col[1][0] * a_rhs[0][2] + m_col[1][1] * a_rhs[1][2] + m_col[1][2] * a_rhs[2][2]; + result[2][2] = m_col[2][0] * a_rhs[0][2] + m_col[2][1] * a_rhs[1][2] + m_col[2][2] * a_rhs[2][2]; return result; } constexpr hkMatrix3f hkMatrix3f::operator*(float a_scalar) const noexcept { hkMatrix3f result; - result[0][0] = col[0][0] * a_scalar; - result[0][1] = col[0][1] * a_scalar; - result[0][2] = col[0][2] * a_scalar; - result[1][0] = col[1][0] * a_scalar; - result[1][1] = col[1][1] * a_scalar; - result[1][2] = col[1][2] * a_scalar; - result[2][0] = col[2][0] * a_scalar; - result[2][1] = col[2][1] * a_scalar; - result[2][2] = col[2][2] * a_scalar; + result[0][0] = m_col[0][0] * a_scalar; + result[0][1] = m_col[0][1] * a_scalar; + result[0][2] = m_col[0][2] * a_scalar; + result[1][0] = m_col[1][0] * a_scalar; + result[1][1] = m_col[1][1] * a_scalar; + result[1][2] = m_col[1][2] * a_scalar; + result[2][0] = m_col[2][0] * a_scalar; + result[2][1] = m_col[2][1] * a_scalar; + result[2][2] = m_col[2][2] * a_scalar; return result; } } diff --git a/include/RE/H/hkMemorySystem.h b/include/RE/H/hkMemorySystem.h index c140312e..3fce5378 100644 --- a/include/RE/H/hkMemorySystem.h +++ b/include/RE/H/hkMemorySystem.h @@ -35,26 +35,26 @@ namespace RE virtual ~hkMemorySystem() = default; // 00 // add - virtual hkMemoryRouter* MainInit(const FrameInfo& a_info, hkFlags a_flags) = 0; // 01 - virtual hkResult MainQuit(hkFlags a_flags) = 0; // 02 - virtual void ThreadInit(hkMemoryRouter& a_router, const char* a_name, hkFlags a_flags) = 0; // 03 - virtual void ThreadQuit(hkMemoryRouter& a_router, hkFlags a_flags) = 0; // 04 - virtual hkResult GetHeapSoftLimit([[maybe_unused]] std::int32_t a_numBytes) { return { hkResultEnum::kFailure }; } // 05 - virtual std::int32_t GetHeapSoftLimit() const { return -1; } // 06 - virtual bool SolverCanAllocSingleBlock([[maybe_unused]] std::int32_t a_numBytes) { return true; } // 07 - virtual bool HeapCanAllocTotal([[maybe_unused]] std::int32_t a_numBytes) { return true; } // 08 - virtual void PrintStatistics(hkOstream& a_ostr) const = 0; // 09 - virtual void GetMemoryStatistics(MemoryStatistics&) = 0; // 0A - virtual hkMemoryAllocator* GetUncachedLockedHeapAllocator() = 0; // 0B - virtual void GarbageCollectThread([[maybe_unused]] hkMemoryRouter& a_router) { return; } // 0C - virtual void GarbageCollectShared() { return; } // 0D - virtual void GarbageCollect(); // 0E - virtual void AdvanceFrame() { return; } // 0F - virtual hkDebugMemorySystem* GetDebugInterface() { return nullptr; } // 10 - virtual hkResult GetMemorySnapshot([[maybe_unused]] hkMemorySnapshot& a_snapshot) const { return { hkResultEnum::kFailure }; } // 11 - virtual hkResult GetAllocationCallStack([[maybe_unused]] const void* a_ptr, [[maybe_unused]] std::uint64_t* a_callStack, [[maybe_unused]] std::int32_t& a_stackSize, [[maybe_unused]] std::size_t& a_allocSize) { return { hkResultEnum::kFailure }; } // 12 - virtual void SetHeapScrubValues([[maybe_unused]] std::uint32_t a_allocValue, [[maybe_unused]] std::uint32_t a_freeValue) { return; } // 13 - virtual std::uint32_t IsOk() const { return 1; } // 14 + virtual hkMemoryRouter* MainInit(const FrameInfo& a_info, hkFlags a_flags) = 0; // 01 + virtual hkResult MainQuit(hkFlags a_flags) = 0; // 02 + virtual void ThreadInit(hkMemoryRouter& a_router, const char* a_name, hkFlags a_flags) = 0; // 03 + virtual void ThreadQuit(hkMemoryRouter& a_router, hkFlags a_flags) = 0; // 04 + virtual hkResult GetHeapSoftLimit([[maybe_unused]] std::int32_t a_numBytes) { return hkResult::kFailure; } // 05 + virtual std::int32_t GetHeapSoftLimit() const { return -1; } // 06 + virtual bool SolverCanAllocSingleBlock([[maybe_unused]] std::int32_t a_numBytes) { return true; } // 07 + virtual bool HeapCanAllocTotal([[maybe_unused]] std::int32_t a_numBytes) { return true; } // 08 + virtual void PrintStatistics(hkOstream& a_ostr) const = 0; // 09 + virtual void GetMemoryStatistics(MemoryStatistics&) = 0; // 0A + virtual hkMemoryAllocator* GetUncachedLockedHeapAllocator() = 0; // 0B + virtual void GarbageCollectThread([[maybe_unused]] hkMemoryRouter& a_router) { return; } // 0C + virtual void GarbageCollectShared() { return; } // 0D + virtual void GarbageCollect(); // 0E + virtual void AdvanceFrame() { return; } // 0F + virtual hkDebugMemorySystem* GetDebugInterface() { return nullptr; } // 10 + virtual hkResult GetMemorySnapshot([[maybe_unused]] hkMemorySnapshot& a_snapshot) const { return hkResult::kFailure; } // 11 + virtual hkResult GetAllocationCallStack([[maybe_unused]] const void* a_ptr, [[maybe_unused]] std::uint64_t* a_callStack, [[maybe_unused]] std::int32_t& a_stackSize, [[maybe_unused]] std::size_t& a_allocSize) { return hkResultEnum::kFailure; } // 12 + virtual void SetHeapScrubValues([[maybe_unused]] std::uint32_t a_allocValue, [[maybe_unused]] std::uint32_t a_freeValue) { return; } // 13 + virtual std::uint32_t IsOk() const { return 1; } // 14 }; static_assert(sizeof(hkMemorySystem) == 0x8); } diff --git a/include/RE/H/hkMonitorStream.h b/include/RE/H/hkMonitorStream.h index b829856a..6f8b31dd 100644 --- a/include/RE/H/hkMonitorStream.h +++ b/include/RE/H/hkMonitorStream.h @@ -23,7 +23,7 @@ namespace RE void Reset() { - end = start; + m_end = m_start; } void Resize(const std::int32_t a_newSize) @@ -34,11 +34,11 @@ namespace RE } // members - hkPadSpu start; // 0x00 - hkPadSpu end; // 0x08 - hkPadSpu capacity; // 0x10 - hkPadSpu capacityMinus16; // 0x18 - hkBool isBufferAllocatedOnTheHeap; // 0x20 + hkPadSpu m_start; // 0x00 + hkPadSpu m_end; // 0x08 + hkPadSpu m_capacity; // 0x10 + hkPadSpu m_capacityMinus16; // 0x18 + hkBool m_isBufferAllocatedOnTheHeap; // 0x20 }; static_assert(sizeof(hkMonitorStream) == 0x28); } diff --git a/include/RE/H/hkOArchive.h b/include/RE/H/hkOArchive.h new file mode 100644 index 00000000..689f47ea --- /dev/null +++ b/include/RE/H/hkOArchive.h @@ -0,0 +1,28 @@ +#pragma once + +#include "RE/H/hkBool.h" +#include "RE/H/hkReferencedObject.h" +#include "RE/H/hkRefPtr.h" +#include "RE/H/hkStreamWriter.h" + +namespace RE +{ + class __declspec(novtable) hkOArchive : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkOArchive }; + inline static constexpr auto VTABLE{ VTABLE::hkOArchive }; + + bool IsOk() const + { + return m_writer->IsOk(); + } + + // members + hkRefPtr m_writer; // 0x10 + hkBool m_byteSwap; // 0x18 + std::byte m_pad19[7]; // 0x19 + }; + static_assert(sizeof(hkOArchive) == 0x20); +} diff --git a/include/RE/H/hkProcess.h b/include/RE/H/hkProcess.h new file mode 100644 index 00000000..72bf7038 --- /dev/null +++ b/include/RE/H/hkProcess.h @@ -0,0 +1,44 @@ +#pragma once + +#include "RE/H/hkBool.h" + +namespace RE +{ + class hkDebugDisplayHandler; + class hkDisplaySerializeIStream; + class hkDisplaySerializeOStream; + class hkProcessHandler; + + class __declspec(novtable) hkProcess + { + public: + inline static constexpr auto RTTI{ RTTI::hkProcess }; + inline static constexpr auto VTABLE{ VTABLE::hkProcess }; + + hkProcess(hkBool a_selectable) : + m_selectable(a_selectable) + { + REX::EMPLACE_VTABLE(this); + } + + virtual ~hkProcess() = default; // 0x00 [00] + + // add + virtual void Unk01() = 0; // 0x08 [01] + virtual std::int64_t GetType() { return 0; } // 0x10 [02] + virtual void GetConsumableCommands([[maybe_unused]] std::uint8_t** a_commands, [[maybe_unused]] std::int32_t* a_numCommands) {} // 0x18 [03] + virtual void ConsumeCommand([[maybe_unused]] std::uint8_t a_command) {} // 0x20 [04] + virtual bool IsOk() { return false; } // 0x28 [05] + virtual void Init() {} // + virtual void Step([[maybe_unused]] float a_frameTimeInMs) {} // + + // members + hkBool m_selectable; // 0x08 + std::byte m_pad09[0x7]; // 0x09 + hkDisplaySerializeIStream* m_inStream; // 0x10 + hkDisplaySerializeOStream* m_outStream; // 0x18 + hkDebugDisplayHandler* m_displayHandler; // 0x20 + hkProcessHandler* m_processHandler; // 0x28 + }; + static_assert(sizeof(hkProcess) == 0x30); +} diff --git a/include/RE/H/hkProcessContext.h b/include/RE/H/hkProcessContext.h index 6993a225..385753f6 100644 --- a/include/RE/H/hkProcessContext.h +++ b/include/RE/H/hkProcessContext.h @@ -11,19 +11,20 @@ namespace RE public: hkProcessContext() = default; - virtual ~hkProcessContext() = default; + virtual ~hkProcessContext() = default; // 0x00 [00] - virtual const char* GetType() = 0; + // add + virtual const char* GetType() = 0; // 0x08 [01] - virtual void SetOwner(hkVisualDebugger* a_owner) + virtual void SetOwner(hkVisualDebugger* a_owner) // 0x10 [02] { - owner = a_owner; + m_owner = a_owner; } // members - hkVisualDebugger* owner{ nullptr }; // 0x08 - hkInplaceArray monitorStreamBegins; // 0x10 - hkInplaceArray monitorStreamEnds; // 0x50 + hkVisualDebugger* m_owner{ nullptr }; // 0x08 + hkInplaceArray m_monitorStreamBegins; // 0x10 + hkInplaceArray m_monitorStreamEnds; // 0x50 }; static_assert(sizeof(hkProcessContext) == 0x90); } diff --git a/include/RE/H/hkQsTransformf.h b/include/RE/H/hkQsTransformf.h index 965d6add..ed406c8f 100644 --- a/include/RE/H/hkQsTransformf.h +++ b/include/RE/H/hkQsTransformf.h @@ -9,9 +9,9 @@ namespace RE { public: // members - hkVector4f translation; // 0x00 - hkQuaternionf rotation; // 0x10 - hkVector4f scale; // 0x20 + hkVector4f m_translation; // 0x00 + hkQuaternionf m_rotation; // 0x10 + hkVector4f m_scale; // 0x20 }; static_assert(sizeof(hkQsTransformf) == 0x30); diff --git a/include/RE/H/hkQuaternion.h b/include/RE/H/hkQuaternion.h index 97cf024f..7567b3d1 100644 --- a/include/RE/H/hkQuaternion.h +++ b/include/RE/H/hkQuaternion.h @@ -6,7 +6,7 @@ namespace RE { public: // members - hkVector4f vec; // 00 + hkVector4f m_vec; // 0x00 }; static_assert(sizeof(hkQuaternionf) == 0x10); diff --git a/include/RE/H/hkReferencedObject.h b/include/RE/H/hkReferencedObject.h index 8814ea9e..a2cc8c0a 100644 --- a/include/RE/H/hkReferencedObject.h +++ b/include/RE/H/hkReferencedObject.h @@ -6,21 +6,18 @@ namespace RE { class hkClass; - class hkReferencedObject : + class __declspec(novtable) hkReferencedObject : public hkBaseObject // 0x00 { public: inline static constexpr auto RTTI{ RTTI::hkReferencedObject }; inline static constexpr auto VTABLE{ VTABLE::hkReferencedObject }; - hkReferencedObject() - { - REX::EMPLACE_VTABLE(this); - } + hkReferencedObject() { REX::EMPLACE_VTABLE(this); } // add - virtual const hkClass* GetClassType() const { return nullptr; } // 02 - virtual void DeleteThisReferencedObject() const { delete this; } // 03 + virtual const hkClass* GetClassType() const { return nullptr; } // 0x10 [02] + virtual void DeleteThisReferencedObject() const { delete this; } // 0x18 [03] void AddReference() { @@ -37,7 +34,7 @@ namespace RE } // members - std::uint32_t memSizeAndRefCount; // 0x08 + std::uint32_t m_memSizeAndRefCount{ static_cast(-65535) }; // 0x08 }; static_assert(sizeof(hkReferencedObject) == 0x10); } diff --git a/include/RE/H/hkResult.h b/include/RE/H/hkResult.h index 2aabd3e5..4029d32e 100644 --- a/include/RE/H/hkResult.h +++ b/include/RE/H/hkResult.h @@ -1,16 +1,35 @@ #pragma once -#include "RE/H/hkResultEnum.h" - namespace RE { + enum class hkResultEnum : std::int32_t + { + kSuccess, + kFailure + }; + class hkResult { public: - ~hkResult() noexcept {} // NOLINT(modernize-use-equals-default) + using enum hkResultEnum; + + hkResult() = default; + + hkResult(hkResultEnum a_enum) : + m_enum(a_enum) + {} + + hkResult& operator=(hkResultEnum a_enum) + { + m_enum = a_enum; + return *this; + } + + bool operator==(const hkResult&) const = default; + bool operator!=(const hkResult&) const = default; // members - hkResultEnum e; // 0 + hkResultEnum m_enum; // 0x00 }; static_assert(sizeof(hkResult) == 0x4); } diff --git a/include/RE/H/hkResultEnum.h b/include/RE/H/hkResultEnum.h deleted file mode 100644 index 612e9e88..00000000 --- a/include/RE/H/hkResultEnum.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -namespace RE -{ - enum class hkResultEnum - { - kSuccess, - kFailure - }; -} diff --git a/include/RE/H/hkSeekableStreamReader.h b/include/RE/H/hkSeekableStreamReader.h new file mode 100644 index 00000000..396557b7 --- /dev/null +++ b/include/RE/H/hkSeekableStreamReader.h @@ -0,0 +1,28 @@ +#pragma once + +#include "RE/H/hkStreamReader.h" + +namespace RE +{ + class __declspec(novtable) hkSeekableStreamReader : + public hkStreamReader + { + public: + inline static constexpr auto RTTI{ RTTI::hkSeekableStreamReader }; + inline static constexpr auto VTABLE{ VTABLE::hkSeekableStreamReader }; + + enum class SeekWhence : std::int32_t + { + kSet = 0, + kCur = 1, + kEnd = 2 + }; + + hkSeekableStreamReader() { REX::EMPLACE_VTABLE(this); } + + // add + virtual hkResult Seek([[maybe_unused]] std::int32_t a_numBytes, [[maybe_unused]] SeekWhence a_whence) = 0; // 0x48 [09] + virtual std::int32_t Tell() = 0; // 0x50 [10] + }; + static_assert(sizeof(hkSeekableStreamReader) == 0x10); +} diff --git a/include/RE/H/hkSignal.h b/include/RE/H/hkSignal.h index 6b82e002..db45afa9 100644 --- a/include/RE/H/hkSignal.h +++ b/include/RE/H/hkSignal.h @@ -9,7 +9,7 @@ namespace RE { public: // members - hkPtrAndInt slots; // 00 + hkPtrAndInt m_slots; // 00 }; static_assert(sizeof(hkSignal) == 0x08); diff --git a/include/RE/H/hkSimdFloat32.h b/include/RE/H/hkSimdFloat32.h index 76f5c8fc..be8f855c 100644 --- a/include/RE/H/hkSimdFloat32.h +++ b/include/RE/H/hkSimdFloat32.h @@ -6,7 +6,7 @@ namespace RE { public: // members - __m128 real; // 00 + __m128 m_real; // 00 }; static_assert(sizeof(hkSimdFloat32) == 0x10); } diff --git a/include/RE/H/hkSlot.h b/include/RE/H/hkSlot.h index 2209fc95..ca4f2488 100644 --- a/include/RE/H/hkSlot.h +++ b/include/RE/H/hkSlot.h @@ -15,8 +15,8 @@ namespace RE virtual std::uint32_t matchMethod(const void*, std::int32_t); // 01 // members - hkPtrAndInt next; // 0x08 - void* object; // 0x10 + hkPtrAndInt m_next; // 0x08 + void* m_object; // 0x10 }; static_assert(sizeof(hkSlot) == 0x18); } diff --git a/include/RE/H/hkStepInfo.h b/include/RE/H/hkStepInfo.h index 36211274..89d884d5 100644 --- a/include/RE/H/hkStepInfo.h +++ b/include/RE/H/hkStepInfo.h @@ -8,10 +8,10 @@ namespace RE { public: // members - hkPadSpu startTime; // 0x00 - hkPadSpu endTime; // 0x04 - hkPadSpu deltaTime; // 0x08 - hkPadSpu invDeltaTime; // 0x0C + hkPadSpu m_startTime; // 0x00 + hkPadSpu m_endTime; // 0x04 + hkPadSpu m_deltaTime; // 0x08 + hkPadSpu m_invDeltaTime; // 0x0C }; static_assert(sizeof(hkStepInfo) == 0x10); } diff --git a/include/RE/H/hkStopwatch.h b/include/RE/H/hkStopwatch.h index 853fecfe..451a45cd 100644 --- a/include/RE/H/hkStopwatch.h +++ b/include/RE/H/hkStopwatch.h @@ -8,13 +8,13 @@ namespace RE hkStopwatch() = default; // members - std::int64_t ticksAtStart{ 0 }; // 0x00 - std::int64_t ticksTotal{ 0 }; // 0x08 - std::int64_t ticksAtSplit{ 0 }; // 0x10 - std::int64_t splitTotal{ 0 }; // 0x18 - hkBool runningFlag{ false }; // 0x20 - std::int32_t numTimings{ 0 }; // 0x24 - const char* name{ nullptr }; // 0x28 + std::int64_t m_ticksAtStart{ 0 }; // 0x00 + std::int64_t m_ticksTotal{ 0 }; // 0x08 + std::int64_t m_ticksAtSplit{ 0 }; // 0x10 + std::int64_t m_splitTotal{ 0 }; // 0x18 + hkBool m_runningFlag{ false }; // 0x20 + std::int32_t m_numTimings{ 0 }; // 0x24 + const char* m_name{ nullptr }; // 0x28 }; static_assert(sizeof(hkStopwatch) == 0x30); } diff --git a/include/RE/H/hkStreamReader.h b/include/RE/H/hkStreamReader.h new file mode 100644 index 00000000..3961f68f --- /dev/null +++ b/include/RE/H/hkStreamReader.h @@ -0,0 +1,27 @@ +#pragma once + +#include "RE/H/hkBool.h" +#include "RE/H/hkReferencedObject.h" + +namespace RE +{ + class hkSeekableStreamReader; + + class __declspec(novtable) hkStreamReader : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkStreamReader }; + inline static constexpr auto VTABLE{ VTABLE::hkStreamReader }; + + hkStreamReader() { REX::EMPLACE_VTABLE(this); } + + // add + virtual hkBool IsOk() = 0; // 0x20 [04] + virtual std::int32_t Read([[maybe_unused]] void* a_buffer, [[maybe_unused]] std::int32_t a_numBytes) = 0; // 0x28 [05] + virtual std::int32_t Skip([[maybe_unused]] std::int32_t a_numBytes) {} // 0x30 [06] + virtual std::int32_t Peek([[maybe_unused]] void* a_buffer, [[maybe_unused]] std::int32_t a_numBytes) { return false; } // 0x38 [07] + virtual hkSeekableStreamReader* IsSeekTellSupported() { return nullptr; } // 0x40 [08] + }; + static_assert(sizeof(hkStreamReader) == 0x10); +} diff --git a/include/RE/H/hkStreamWriter.h b/include/RE/H/hkStreamWriter.h new file mode 100644 index 00000000..b8e1cb15 --- /dev/null +++ b/include/RE/H/hkStreamWriter.h @@ -0,0 +1,30 @@ +#pragma once + +#include "RE/H/hkBool.h" +#include "RE/H/hkReferencedObject.h" +#include "RE/H/hkResult.h" +#include "RE/H/hkSeekableStreamReader.h" + +namespace RE +{ + class __declspec(novtable) hkStreamWriter : + public hkReferencedObject + { + public: + inline static constexpr auto RTTI{ RTTI::hkStreamWriter }; + inline static constexpr auto VTABLE{ VTABLE::hkStreamWriter }; + + using SeekWhence = hkSeekableStreamReader::SeekWhence; + + hkStreamWriter() { REX::EMPLACE_VTABLE(this); } + + // add + virtual hkBool IsOk() = 0; // 0x20 [04] + virtual std::int32_t Write(const void* a_buffer, std::int32_t a_numBytes) = 0; // 0x28 [05] + virtual void Flush() {} // 0x30 [06] + virtual hkBool SeekTellSupported() { return false; } // 0x38 [07] + virtual hkResult Seek([[maybe_unused]] std::int32_t a_offset, [[maybe_unused]] SeekWhence a_whence) { return hkResult::kFailure; } // 0x40 [08] + virtual std::int32_t Tell() { return 0xFFFFFFFF; } // 0x48 [09] + virtual hkBool IsBuffered() { return false; } // 0x50 [10] + }; +} diff --git a/include/RE/H/hkTransform.h b/include/RE/H/hkTransform.h index 739fb76e..cc94b6c0 100644 --- a/include/RE/H/hkTransform.h +++ b/include/RE/H/hkTransform.h @@ -8,19 +8,15 @@ namespace RE { public: constexpr hkTransformf() noexcept = default; - constexpr hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept; + + constexpr hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept : + m_rotation(a_rotation), m_translation(a_translation) + {} // members - hkRotationf rotation; - hkVector4f translation; + hkRotationf m_rotation; + hkVector4f m_translation; }; using hkTransform = hkTransformf; } - -namespace RE -{ - constexpr hkTransformf::hkTransformf(const hkRotationf& a_rotation, const hkVector4f& a_translation) noexcept : - rotation(a_rotation), translation(a_translation) - {} -} diff --git a/include/RE/H/hkVisualDebugger.h b/include/RE/H/hkVisualDebugger.h index 77e46c10..0f5c28ae 100644 --- a/include/RE/H/hkVisualDebugger.h +++ b/include/RE/H/hkVisualDebugger.h @@ -32,8 +32,8 @@ namespace RE } // add - virtual void Step([[maybe_unused]] float a_frameTime) {} // 04 - virtual void PollForNewClients() {} // 05 + virtual void Step([[maybe_unused]] float a_frameTime) {} // 0x20 [04] + virtual void PollForNewClients() {} // 0x28 [05] void AddContext(hkProcessContext* a_context) { @@ -64,19 +64,20 @@ namespace RE } // members - hkSocket* server; // 0x10 - bool suppressPollForNewClients; // 0x18 - hkArray clients; // 0x20 - hkArray contexts; // 0x30 - hkArray trackedObjects; // 0x40 - hkArray trackCallbacks; // 0x50 - hkArray trackCallbackHandles; // 0x60 - const hkVtableClassRegistry* classReg; // 0x70 - hkArray defaultProcesses; // 0x78 - hkArray requiredProcesses; // 0x88 - hkBool timingFrame; // 0x98 - hkStopwatch frameTimer; // 0xA0 - hkBool overrideFrameTimeIfZero; // 0xD0 + hkSocket* m_server; // 0x10 + bool m_suppressPollForNewClients; // 0x18 + hkArray m_clients; // 0x20 + hkArray m_contexts; // 0x30 + hkArray m_trackedObjects; // 0x40 + hkArray m_trackCallbacks; // 0x50 + hkArray m_trackCallbackHandles; // 0x60 + const hkVtableClassRegistry* m_classReg; // 0x70 + hkArray m_defaultProcesses; // 0x78 + hkArray m_requiredProcesses; // 0x88 + hkBool m_timingFrame; // 0x98 + hkStopwatch m_frameTimer; // 0xA0 + hkBool m_overrideFrameTimeIfZero; // 0xD0 + std::byte m_padD1[0x7]; // 0xD1 }; static_assert(sizeof(hkVisualDebugger) == 0xD8); } diff --git a/include/RE/H/hkcdRay.h b/include/RE/H/hkcdRay.h index 3cab5c0f..3d559296 100644 --- a/include/RE/H/hkcdRay.h +++ b/include/RE/H/hkcdRay.h @@ -8,9 +8,9 @@ namespace RE { public: // members - hkVector4f origin; // 00 - hkVector4f direction; // 10 - hkVector4f invDirection; // 20 + hkVector4f m_origin; // 0x00 + hkVector4f m_direction; // 0x10 + hkVector4f m_invDirection; // 0x20 }; static_assert(sizeof(hkcdRay) == 0x30); } diff --git a/include/RE/H/hkcdRayQueryFlags.h b/include/RE/H/hkcdRayQueryFlags.h index ab4e2124..d6ef2d2d 100644 --- a/include/RE/H/hkcdRayQueryFlags.h +++ b/include/RE/H/hkcdRayQueryFlags.h @@ -5,7 +5,7 @@ namespace RE class hkcdRayQueryFlags { public: - enum class Enum + enum class Enum : std::int32_t { kNoFlags = 0x0, kDisableBackFacingTriangleHits = 0x1, diff --git a/include/RE/H/hknpAllHitsCollector.h b/include/RE/H/hknpAllHitsCollector.h index 351c1e3f..6ddac127 100644 --- a/include/RE/H/hknpAllHitsCollector.h +++ b/include/RE/H/hknpAllHitsCollector.h @@ -16,8 +16,8 @@ namespace RE hknpAllHitsCollector() { REX::EMPLACE_VTABLE(this); - hits.m_data = (hknpCollisionResult*)((uintptr_t)this + 0x30); - hits.m_capacityAndFlags = 0x8000000A; + m_hits.m_data = (hknpCollisionResult*)((uintptr_t)this + 0x30); + m_hits.m_capacityAndFlags = 0x8000000A; } // override (hknpCollisionQueryCollector) @@ -28,7 +28,7 @@ namespace RE const hknpCollisionResult* GetHits() const override; // 05 // members - hkInplaceArray hits; // 0x020 + hkInplaceArray m_hits; // 0x020 }; static_assert(sizeof(hknpAllHitsCollector) == 0x3F0); } diff --git a/include/RE/H/hknpBSWorld.h b/include/RE/H/hknpBSWorld.h index 181ebc0f..2e93e0e7 100644 --- a/include/RE/H/hknpBSWorld.h +++ b/include/RE/H/hknpBSWorld.h @@ -17,12 +17,61 @@ namespace RE virtual ~hknpBSWorld() override; // 00 + hknpMotion* AccessMotion(hknpMotionId a_motionId) + { + using func_t = decltype(&hknpBSWorld::AccessMotion); + static REL::Relocation func{ ID::hknpBSWorld::AccessMotion }; + return func(this, a_motionId); + } + + void ActivateBody(hknpBodyId a_bodyId) + { + using func_t = decltype(&hknpBSWorld::ActivateBody); + static REL::Relocation func{ ID::hknpBSWorld::ActivateBody }; + func(this, a_bodyId); + } + + void SetBodyAngularVelocity(hknpBodyId a_bodyId, const hkVector4& a_angularVelocity) + { + using func_t = decltype(&hknpBSWorld::SetBodyAngularVelocity); + static REL::Relocation func{ ID::hknpBSWorld::SetBodyAngularVelocity }; + func(this, a_bodyId, a_angularVelocity); + } + + void SetBodyKeyframed(hknpBodyId a_bodyId, RebuildCachesMode a_cacheBehavior) + { + using func_t = decltype(&hknpBSWorld::SetBodyKeyframed); + static REL::Relocation func{ ID::hknpBSWorld::SetBodyKeyframed }; + func(this, a_bodyId, a_cacheBehavior); + } + + void SetBodyLinearVelocity(hknpBodyId a_bodyId, const hkVector4& a_linearVelocity) + { + using func_t = decltype(&hknpBSWorld::SetBodyLinearVelocity); + static REL::Relocation func{ ID::hknpBSWorld::SetBodyLinearVelocity }; + func(this, a_bodyId, a_linearVelocity); + } + + void SetBodyStatic(hknpBodyId a_bodyId, RebuildCachesMode a_cacheBehavior) + { + using func_t = decltype(&hknpBSWorld::SetBodyStatic); + static REL::Relocation func{ ID::hknpBSWorld::SetBodyStatic }; + func(this, a_bodyId, a_cacheBehavior); + } + + void SetBodyVelocity(hknpBodyId a_bodyId, const hkVector4& a_linearVelocity, const hkVector4& a_angularVelocity) + { + using func_t = decltype(&hknpBSWorld::SetBodyVelocity); + static REL::Relocation func{ ID::hknpBSWorld::SetBodyVelocity }; + func(this, a_bodyId, a_linearVelocity, a_angularVelocity); + } + // members - void* userData; // 6D0 - BSReadWriteLock worldLock; // 6D8 - std::byte activateBodyPostCollideSet[48]; // 6E0 - BSTSet - BSSpinLock activateBodyPostCollideLock; // 710 - hkMultiMap constrainedBodyFromBody; // 718 + void* m_userData; // 0x6D0 + BSReadWriteLock m_worldLock; // 0x6D8 + std::byte m_activateBodyPostCollideSet[48]; // 0x6E0 - BSTSet + BSSpinLock m_activateBodyPostCollideLock; // 0x710 + hkMultiMap m_constrainedBodyFromBody; // 0x718 }; static_assert(sizeof(hknpBSWorld) == 0x730); } diff --git a/include/RE/H/hknpBody.h b/include/RE/H/hknpBody.h index 00616d37..b1463d5e 100644 --- a/include/RE/H/hknpBody.h +++ b/include/RE/H/hknpBody.h @@ -22,26 +22,26 @@ namespace RE }; // members - hkTransform transform; // 0x00 - hknpCollisionFlags flags; // 0x40 - std::uint32_t collisionFilterInfo; // 0x44 - const hknpShape* shape; // 0x48 - hkAabb16 aabb; // 0x50 - hknpBodyId id; // 0x60 - hknpBodyId nextAttachedBodyId; // 0x64 - hknpMotionId motionId; // 0x68 - std::uint32_t broadPhaseId; // 0x6C - hknpMaterialId materialId; // 0x70 - hknpBodyQualityId qualityId; // 0x72 - std::uint8_t timAngle; // 0x73 - std::uint16_t maxTimDistance; // 0x74 - std::uint16_t maxContactDistance; // 0x76 - std::uint32_t indexIntoActiveListOrDeactivatedIslandId; // 0x78 - hkHalf radiusOfComCenteredBoundingSphere; // 0x7C - hkFlags spuFlags; // 0x7E - std::uint8_t shapeSizeDiv16; // 0x7F - std::uint16_t motionToBodyRotation[4]; // 0x80 - hkPackedUnitVector<4> - std::uint64_t userData; // 0x88 + hkTransform m_transform; // 0x00 + hknpCollisionFlags m_flags; // 0x40 + std::uint32_t m_collisionFilterInfo; // 0x44 + const hknpShape* m_shape; // 0x48 + hkAabb16 m_aabb; // 0x50 + hknpBodyId m_id; // 0x60 + hknpBodyId m_nextAttachedBodyId; // 0x64 + hknpMotionId m_motionId; // 0x68 + std::uint32_t m_broadPhaseId; // 0x6C + hknpMaterialId m_materialId; // 0x70 + hknpBodyQualityId m_qualityId; // 0x72 + std::uint8_t m_timAngle; // 0x73 + std::uint16_t m_maxTimDistance; // 0x74 + std::uint16_t m_maxContactDistance; // 0x76 + std::uint32_t m_indexIntoActiveListOrDeactivatedIslandId; // 0x78 + hkHalf m_radiusOfComCenteredBoundingSphere; // 0x7C + hkFlags m_spuFlags; // 0x7E + std::uint8_t m_shapeSizeDiv16; // 0x7F + std::uint16_t m_motionToBodyRotation[4]; // 0x80 - hkPackedUnitVector<4> + std::uint64_t m_userData; // 0x88 }; static_assert(sizeof(hknpBody) == 0x90); } diff --git a/include/RE/H/hknpBodyCinfo.h b/include/RE/H/hknpBodyCinfo.h index 7f7f0c7f..6c278d1e 100644 --- a/include/RE/H/hknpBodyCinfo.h +++ b/include/RE/H/hknpBodyCinfo.h @@ -21,20 +21,20 @@ namespace RE } // members - const hknpShape* shape; // 0x00 - hknpBodyId reservedBodyId; // 0x08 - hknpMotionId motionId; // 0x0C - hknpBodyQualityId qualityId; // 0x10 - hknpMaterialId materialId; // 0x12 - std::uint32_t collisionFilterInfo; // 0x14 - hknpCollisionFlags flags; // 0x18 - float collisionLookAheadDistance; // 0x1C - hkStringPtr name; // 0x20 - std::uint64_t userData; // 0x28 - hkVector4f position; // 0x30 - hkQuaternionf orientation; // 0x40 - hkFlags spuFlags; // 0x50 - hkRefPtr localFrame; // 0x58 + const hknpShape* m_shape; // 0x00 + hknpBodyId m_reservedBodyId; // 0x08 + hknpMotionId m_motionId; // 0x0C + hknpBodyQualityId m_qualityId; // 0x10 + hknpMaterialId m_materialId; // 0x12 + std::uint32_t m_collisionFilterInfo; // 0x14 + hknpCollisionFlags m_flags; // 0x18 + float m_collisionLookAheadDistance; // 0x1C + hkStringPtr m_name; // 0x20 + std::uint64_t m_userData; // 0x28 + hkVector4f m_position; // 0x30 + hkQuaternionf m_orientation; // 0x40 + hkFlags m_spuFlags; // 0x50 + hkRefPtr m_localFrame; // 0x58 }; static_assert(sizeof(hknpBodyCinfo) == 0x60); } diff --git a/include/RE/H/hknpBodyManager.h b/include/RE/H/hknpBodyManager.h index a911880b..132acb00 100644 --- a/include/RE/H/hknpBodyManager.h +++ b/include/RE/H/hknpBodyManager.h @@ -24,8 +24,8 @@ namespace RE { public: // members - const hknpBodyManager* bodyManager; // 00 - std::int32_t bodyIndex; // 08 + const hknpBodyManager* m_bodyManager; // 0x00 + std::int32_t m_bodyIndex; // 0x08 }; static_assert(sizeof(BodyIterator) == 0x10); @@ -33,10 +33,10 @@ namespace RE { public: // members - std::int32_t bufferSize; // 00 - std::int32_t propertySize; // 04 - hkBitField occupancy; // 08 - void* properties; // 20 + std::int32_t m_bufferSize; // 0x00 + std::int32_t m_propertySize; // 0x04 + hkBitField m_occupancy; // 0x08 + void* m_properties; // 0x20 }; static_assert(sizeof(PropertyBuffer) == 0x28); @@ -44,30 +44,30 @@ namespace RE { public: // members - hknpBodyId bodyId; // 00 - hkFlags scheduledBodyFlags; // 04 - std::uint32_t pendingAddIndex; // 08 + hknpBodyId m_bodyId; // 0x00 + hkFlags m_scheduledBodyFlags; // 0x04 + std::uint32_t m_pendingAddIndex; // 0x08 }; static_assert(sizeof(ScheduledBodyChange) == 0x0C); // members - hknpWorld* world; // 00 - hknpMotionManager* motionManager; // 08 - hkArray bodies; // 10 - hkBool bodyBufferIsUserOwned; // 20 - hknpBodyId firstFreeBodyId; // 24 - hkArray previousAabbs; // 28 - hkArray bodyNames; // 38 - hkMap propertyMap; // 48 - std::uint32_t numAllocatedBodies; // 58 - std::uint32_t numMarkedBodies; // 5C - std::uint32_t peakBodyIndex; // 60 - hkArray activeBodyIds; // 68 - hkArray bodyIdToCellIndexMap; // 78 - hkArray scheduledBodyChanges; // 88 - hkArray scheduledBodyChangeIndices; // 98 - hkArray bodiesToAddAsActive; // A8 - hkArray bodiesToAddAsInactive; // B8 + hknpWorld* m_world; // 00 + hknpMotionManager* m_motionManager; // 08 + hkArray m_bodies; // 10 + hkBool m_bodyBufferIsUserOwned; // 20 + hknpBodyId m_firstFreeBodyId; // 24 + hkArray m_previousAabbs; // 28 + hkArray m_bodyNames; // 38 + hkMap m_propertyMap; // 48 + std::uint32_t m_numAllocatedBodies; // 58 + std::uint32_t m_numMarkedBodies; // 5C + std::uint32_t m_peakBodyIndex; // 60 + hkArray m_activeBodyIds; // 68 + hkArray m_bodyIdToCellIndexMap; // 78 + hkArray m_scheduledBodyChanges; // 88 + hkArray m_scheduledBodyChangeIndices; // 98 + hkArray m_bodiesToAddAsActive; // A8 + hkArray m_bodiesToAddAsInactive; // B8 }; static_assert(sizeof(hknpBodyManager) == 0xC8); } diff --git a/include/RE/H/hknpCapsuleShape.h b/include/RE/H/hknpCapsuleShape.h index a5396bcf..65267a65 100644 --- a/include/RE/H/hknpCapsuleShape.h +++ b/include/RE/H/hknpCapsuleShape.h @@ -16,7 +16,7 @@ namespace RE { using func_t = decltype(&hknpCapsuleShape::Init); static REL::Relocation func{ ID::hknpCapsuleShape::Init }; - return func(this, a_vertexA, a_vertexB); + func(this, a_vertexA, a_vertexB); } static hknpCapsuleShape* CreateCapsuleShape(const hkVector4f& a_vertexA, const hkVector4f& a_vertexB, float a_radius) @@ -27,8 +27,8 @@ namespace RE } // members - hkVector4f vertexA; // 0x50 - hkVector4f vertexB; // 0x60 + hkVector4f m_vertexA; // 0x50 + hkVector4f m_vertexB; // 0x60 }; static_assert(sizeof(hknpCapsuleShape) == 0x70); } diff --git a/include/RE/H/hknpCharacterContext.h b/include/RE/H/hknpCharacterContext.h index 8b3141f5..25f89f4c 100644 --- a/include/RE/H/hknpCharacterContext.h +++ b/include/RE/H/hknpCharacterContext.h @@ -22,18 +22,18 @@ namespace RE kRigidBody = 0x1 }; - CharacterType characterType; // 0x10 - const hknpCharacterStateManager* stateManager; // 0x18 - hknpCharacterState::hknpCharacterStateType currentState; // 0x20 - hknpCharacterState::hknpCharacterStateType previousState; // 0x24 - hkBool filterEnable; // 0x28 - float maxLinearAcceleration; // 0x2C - float maxLinearSpeed; // 0x30 - float gain; // 0x34 - std::byte pad38[0x04]; // 0x38 - hkVector4f previousSurfaceVelocity; // 0x40 - std::int32_t numUpdatesInCurrentState; // 0x50 - std::byte pad54[0x0C]; // 0x54 + CharacterType m_characterType; // 0x10 + const hknpCharacterStateManager* m_stateManager; // 0x18 + hknpCharacterState::hknpCharacterStateType m_currentState; // 0x20 + hknpCharacterState::hknpCharacterStateType m_previousState; // 0x24 + hkBool m_filterEnable; // 0x28 + float m_maxLinearAcceleration; // 0x2C + float m_maxLinearSpeed; // 0x30 + float m_gain; // 0x34 + std::byte m_pad38[0x04]; // 0x38 + hkVector4f m_previousSurfaceVelocity; // 0x40 + std::int32_t m_numUpdatesInCurrentState; // 0x50 + std::byte m_pad54[0x0C]; // 0x54 }; static_assert(sizeof(hknpCharacterContext) == 0x60); } diff --git a/include/RE/H/hknpCharacterSurfaceInfo.h b/include/RE/H/hknpCharacterSurfaceInfo.h index a5be8ade..2d0874d2 100644 --- a/include/RE/H/hknpCharacterSurfaceInfo.h +++ b/include/RE/H/hknpCharacterSurfaceInfo.h @@ -17,13 +17,13 @@ namespace RE }; // members - hkBool isSurfaceDynamic; // 00 - hkEnum supportedState; // 01 - std::byte pad02[0x02]; // 02 - float surfaceDistanceExcess; // 04 - std::byte pad08[8]; // 08 - hkVector4f surfaceNormal; // 10 - hkVector4f surfaceVelocity; // 20 + hkBool m_isSurfaceDynamic; // 0x00 + hkEnum m_supportedState; // 0x01 + std::byte m_pad02[0x02]; // 0x02 + float m_surfaceDistanceExcess; // 0x04 + std::byte m_pad08[8]; // 0x08 + hkVector4f m_surfaceNormal; // 0x10 + hkVector4f m_surfaceVelocity; // 0x20 }; static_assert(sizeof(hknpCharacterSurfaceInfo) == 0x30); } diff --git a/include/RE/H/hknpClosestHitCollector.h b/include/RE/H/hknpClosestHitCollector.h index ccc2a043..7c2a2765 100644 --- a/include/RE/H/hknpClosestHitCollector.h +++ b/include/RE/H/hknpClosestHitCollector.h @@ -14,15 +14,15 @@ namespace RE static constexpr auto VTABLE{ VTABLE::hknpClosestHitCollector }; // override (hknpCollisionQueryCollector) - void Reset() override; // 01 - void AddHit(const hknpCollisionResult&) override; // 02 - bool HasHit() const override; // 03 - std::int32_t GetNumHits() const override; // 04 - const hknpCollisionResult* GetHits() const override; // 05 + void Reset() override; // 0x08 [01] + void AddHit(const hknpCollisionResult&) override; // 0x10 [02] + bool HasHit() const override; // 0x18 [03] + std::int32_t GetNumHits() const override; // 0x20 [04] + const hknpCollisionResult* GetHits() const override; // 0x28 [05] // members - hknpCollisionResult result; // 0x20 - bool hasHit; // 0x80 + hknpCollisionResult m_result; // 0x20 + hkBool m_hasHit; // 0x80 }; static_assert(sizeof(hknpClosestHitCollector) == 0x90); } diff --git a/include/RE/H/hknpCollisionQuery.h b/include/RE/H/hknpCollisionQuery.h index 1944b0a2..5c5bf6b6 100644 --- a/include/RE/H/hknpCollisionQuery.h +++ b/include/RE/H/hknpCollisionQuery.h @@ -10,9 +10,9 @@ namespace RE { public: // members - hkPadSpu filter; // 0x00 - hknpQueryFilterData filterData; // 0x08 - std::uint8_t levelOfDetail; // 0x18 + hkPadSpu m_filter; // 0x00 + hknpQueryFilterData m_filterData; // 0x08 + std::uint8_t m_levelOfDetail; // 0x18 }; static_assert(sizeof(hknpCollisionQuery) == 0x20); } diff --git a/include/RE/H/hknpCollisionQueryCollector.h b/include/RE/H/hknpCollisionQueryCollector.h index ada628d0..f518cfd4 100644 --- a/include/RE/H/hknpCollisionQueryCollector.h +++ b/include/RE/H/hknpCollisionQueryCollector.h @@ -15,15 +15,15 @@ namespace RE static constexpr auto VTABLE{ VTABLE::hknpCollisionQueryCollector }; // add - virtual void Reset() = 0; // 01 - virtual void AddHit(const hknpCollisionResult& a_hit) = 0; // 02 - virtual bool HasHit() const = 0; // 03 - virtual std::int32_t GetNumHits() const = 0; // 04 - virtual const hknpCollisionResult* GetHits() const = 0; // 05 + virtual void Reset() = 0; // 0x08 [01] + virtual void AddHit(const hknpCollisionResult& a_hit) = 0; // 0x10 [02] + virtual bool HasHit() const = 0; // 0x18 [03] + virtual std::int32_t GetNumHits() const = 0; // 0x20 [04] + virtual const hknpCollisionResult* GetHits() const = 0; // 0x28 [05] // members - std::int32_t hints; // 0x08 - hkSimdFloat32 earlyOutThreshold; // 0x10 + std::int32_t m_hints; // 0x08 + hkSimdFloat32 m_earlyOutThreshold; // 0x10 }; static_assert(sizeof(hknpCollisionQueryCollector) == 0x20); } diff --git a/include/RE/H/hknpConvexPolytopeShape.h b/include/RE/H/hknpConvexPolytopeShape.h index 635b44a2..a554cbf3 100644 --- a/include/RE/H/hknpConvexPolytopeShape.h +++ b/include/RE/H/hknpConvexPolytopeShape.h @@ -20,6 +20,13 @@ namespace RE std::uint8_t minHalfAngle; }; + static hknpConvexPolytopeShape* CreateFromVerticesInternal(const hkStridedVertices& a_vertices, const float a_radius, const BuildConfig& a_config) + { + using func_t = decltype(&hknpConvexPolytopeShape::CreateFromVerticesInternal); + static REL::Relocation func{ ID::hknpConvexPolytopeShape::CreateFromVerticesInternal }; + return func(a_vertices, a_radius, a_config); + } + // members hkRelArray planes; // 0x40 hkRelArray faces; // 0x44 diff --git a/include/RE/H/hknpConvexShape.h b/include/RE/H/hknpConvexShape.h index 7b3e19dc..837ec143 100644 --- a/include/RE/H/hknpConvexShape.h +++ b/include/RE/H/hknpConvexShape.h @@ -21,16 +21,16 @@ namespace RE struct BuildConfig { float simplificationTolerance{ 0.0099999998f }; // 0x00 - bool shrinkByRadius{ true }; // 0x04 + hkBool shrinkByRadius{ true }; // 0x04 float featurePreservationFactor{ 0.0f }; // 0x08 - bool buildFaces{ true }; // 0x0C - bool buildMassProperties{ false }; // 0x0D + hkBool buildFaces{ true }; // 0x0C + hkBool buildMassProperties{ false }; // 0x0D MassConfig massConfig; // 0x10 hkTransformf* extraTransform{ nullptr }; // 0x20 std::uint32_t sizeOfBaseClass{ 80 }; // 0x28 std::uint32_t maxNumVertices{ 252 }; // 0x2C - bool checkForDegenerateFaces{ false }; // 0x30 - bool verbose{ false }; // 0x31 + hkBool checkForDegenerateFaces{ false }; // 0x30 + hkBool verbose{ false }; // 0x31 }; static_assert(sizeof(BuildConfig) == 0x38); diff --git a/include/RE/H/hknpDefaultViewerColorScheme.h b/include/RE/H/hknpDefaultViewerColorScheme.h index 994c9471..f0af796e 100644 --- a/include/RE/H/hknpDefaultViewerColorScheme.h +++ b/include/RE/H/hknpDefaultViewerColorScheme.h @@ -10,12 +10,12 @@ namespace RE public: hknpDefaultViewerColorScheme() = default; - virtual std::uint32_t GetBodyColor(const hknpWorld&, hknpBodyId, hknpViewer*) override + virtual std::uint32_t GetBodyColor(const hknpWorld*, hknpBodyId, hknpViewer*) override { return staticBodyColor; // TODO: Get color based on body flags } - virtual bool IsBodyVisible(const hknpWorld&, hknpBodyId, hknpViewer*) override + virtual bool IsBodyVisible(const hknpWorld*, hknpBodyId, hknpViewer*) override { return true; // TODO: err...? } diff --git a/include/RE/H/hknpDynamicCompoundShape.h b/include/RE/H/hknpDynamicCompoundShape.h index 9fb87b3e..44aaa723 100644 --- a/include/RE/H/hknpDynamicCompoundShape.h +++ b/include/RE/H/hknpDynamicCompoundShape.h @@ -14,7 +14,7 @@ namespace RE static constexpr auto VTABLE{ VTABLE::hknpDynamicCompoundShape }; // members - hknpDynamicCompoundShapeData* boundingVolumeData; // 0xC0 + hknpDynamicCompoundShapeData* m_boundingVolumeData; // 0xC0 }; static_assert(sizeof(hknpDynamicCompoundShape) == 0xD0); } diff --git a/include/RE/H/hknpMotionCinfo.h b/include/RE/H/hknpMotionCinfo.h index e407bb2e..91315224 100644 --- a/include/RE/H/hknpMotionCinfo.h +++ b/include/RE/H/hknpMotionCinfo.h @@ -27,17 +27,17 @@ namespace RE } // members - hknpMotionPropertiesId motionPropertiesId; // 0x00 - hkBool enableDeactivation; // 0x02 - float inverseMass; // 0x04 - float massFactor; // 0x08 - float maxLinearAccelerationDistancePerStep; // 0x0C - float maxRotationToPreventTunneling; // 0x10 - hkVector4f inverseInertiaLocal; // 0x20 - hkVector4f centerOfMassWorld; // 0x30 - hkQuaternionf orientation; // 0x40 - hkVector4f linearVelocity; // 0x50 - hkVector4f angularVelocity; // 0x60 + hknpMotionPropertiesId m_motionPropertiesId; // 0x00 + hkBool m_enableDeactivation; // 0x02 + float m_inverseMass; // 0x04 + float m_massFactor; // 0x08 + float m_maxLinearAccelerationDistancePerStep; // 0x0C + float m_maxRotationToPreventTunneling; // 0x10 + hkVector4f m_inverseInertiaLocal; // 0x20 + hkVector4f m_centerOfMassWorld; // 0x30 + hkQuaternionf m_orientation; // 0x40 + hkVector4f m_linearVelocity; // 0x50 + hkVector4f m_angularVelocity; // 0x60 }; static_assert(sizeof(hknpMotionCinfo) == 0x70); } diff --git a/include/RE/H/hknpMotionManager.h b/include/RE/H/hknpMotionManager.h index c392e653..523a3b1e 100644 --- a/include/RE/H/hknpMotionManager.h +++ b/include/RE/H/hknpMotionManager.h @@ -16,7 +16,7 @@ namespace RE { public: // members - hkArray solverIdToMotionId; // 0x00 + hkArray m_solverIdToMotionId; // 0x00 }; static_assert(sizeof(CellData) == 0x10); diff --git a/include/RE/H/hknpMotionPropertiesId.h b/include/RE/H/hknpMotionPropertiesId.h index ac1ce074..2aff8308 100644 --- a/include/RE/H/hknpMotionPropertiesId.h +++ b/include/RE/H/hknpMotionPropertiesId.h @@ -16,12 +16,12 @@ namespace RE public: enum class Preset : std::uint32_t { - kStatic = 0x0, - kDynamic = 0x1, - kKeyframed = 0x2, - kFrozen = 0x3, - kDebris = 0x4, - kCount = 0x5, + kStatic = 0, + kDynamic = 1, + kKeyframed = 2, + kFrozen = 3, + kDebris = 4, + kCount = 5, kInvalid = 0xFFFF }; }; diff --git a/include/RE/H/hknpPhysicsSystem.h b/include/RE/H/hknpPhysicsSystem.h index 6adcdc5b..b54e728b 100644 --- a/include/RE/H/hknpPhysicsSystem.h +++ b/include/RE/H/hknpPhysicsSystem.h @@ -44,10 +44,10 @@ namespace RE } // members - hkRefPtr data; // 0x10 - hkRefPtr world; // 0x18 - hkArray bodyIds; // 0x20 - hkArray constraintIds; // 0x30 + hkRefPtr m_data; // 0x10 + hkRefPtr m_world; // 0x18 + hkArray m_bodyIds; // 0x20 + hkArray m_constraintIds; // 0x30 }; static_assert(sizeof(hknpPhysicsSystem) == 0x40); } diff --git a/include/RE/H/hknpPhysicsSystemData.h b/include/RE/H/hknpPhysicsSystemData.h index 440b1e72..c5f7e945 100644 --- a/include/RE/H/hknpPhysicsSystemData.h +++ b/include/RE/H/hknpPhysicsSystemData.h @@ -24,16 +24,16 @@ namespace RE hknpPhysicsSystemData() { REX::EMPLACE_VTABLE(this); } - virtual ~hknpPhysicsSystemData(); // 00 + virtual ~hknpPhysicsSystemData(); // 0x00 // members - hkArray materials; // 0x10 - hkArray motionProperties; // 0x20 - hkArray motionCinfos; // 0x30 - hkArray bodyCinfos; // 0x40 - hkArray constraintCinfos; // 0x50 - hkArray> referencedObjects; // 0x60 - hkStringPtr name; // 0x70 + hkArray m_materials; // 0x10 + hkArray m_motionProperties; // 0x20 + hkArray m_motionCinfos; // 0x30 + hkArray m_bodyCinfos; // 0x40 + hkArray m_constraintCinfos; // 0x50 + hkArray> m_referencedObjects; // 0x60 + hkStringPtr m_name; // 0x70 }; static_assert(sizeof(hknpPhysicsSystemData) == 0x78); } diff --git a/include/RE/H/hknpProcessContext.h b/include/RE/H/hknpProcessContext.h index e69ce4d4..f689da45 100644 --- a/include/RE/H/hknpProcessContext.h +++ b/include/RE/H/hknpProcessContext.h @@ -24,28 +24,28 @@ namespace RE void AddWorld(hknpWorld* a_world) { - for (auto world : worlds) { + for (auto world : m_worlds) { if (world == a_world) return; } - worlds.push_back(a_world); + m_worlds.push_back(a_world); } void SetColorScheme(hknpViewerColorScheme* a_colorScheme) { if (a_colorScheme) - colorScheme = a_colorScheme; + m_colorScheme = a_colorScheme; else - colorScheme = &defaultColorScheme; + m_colorScheme = &m_defaultColorScheme; } // members - hkArray worlds; // 0xA0 - hkArray addListeners; // 0xB0 - hknpViewerColorScheme* colorScheme{ &defaultColorScheme }; // 0xC0 - hknpDefaultViewerColorScheme defaultColorScheme; // 0xC8 - hkTaskQueue* taskQueue{ nullptr }; // 0xE8 + hkArray m_worlds; // 0xA0 + hkArray m_addListeners; // 0xB0 + hknpViewerColorScheme* m_colorScheme{ &m_defaultColorScheme }; // 0xC0 + hknpDefaultViewerColorScheme m_defaultColorScheme; // 0xC8 + hkTaskQueue* m_taskQueue{ nullptr }; // 0xE8 }; static_assert(sizeof(hknpProcessContext) == 0xF0); } diff --git a/include/RE/H/hknpProcessContextListener.h b/include/RE/H/hknpProcessContextListener.h new file mode 100644 index 00000000..4c9cdecc --- /dev/null +++ b/include/RE/H/hknpProcessContextListener.h @@ -0,0 +1,21 @@ +#pragma once + +namespace RE +{ + class hknpWorld; + class hkProcess; + + class hknpProcessContextListener + { + public: + hknpProcessContextListener() = default; + + virtual ~hknpProcessContextListener() = default; // 0x00 [00] + + // add + virtual void WorldAddedCallback(hknpWorld* a_world) = 0; // 0x08 [01] + virtual void WorldRemovedCallback(hknpWorld* a_world) = 0; // 0x10 [02] + virtual hkProcess* GetProcess() { return nullptr; } // 0x18 [03] + }; + static_assert(sizeof(hknpProcessContextListener) == 0x08); +} diff --git a/include/RE/H/hknpQueryFilterData.h b/include/RE/H/hknpQueryFilterData.h index d46555ff..c2804e2b 100644 --- a/include/RE/H/hknpQueryFilterData.h +++ b/include/RE/H/hknpQueryFilterData.h @@ -9,9 +9,9 @@ namespace RE { public: // members - hknpMaterialId materialId; // 0x00 - hkPadSpu collisionFilterInfo; // 0x04 - hkPadSpu userData; // 0x08 + hknpMaterialId m_materialId; // 0x00 + hkPadSpu m_collisionFilterInfo; // 0x04 + hkPadSpu m_userData; // 0x08 }; static_assert(sizeof(hknpQueryFilterData) == 0x10); } diff --git a/include/RE/H/hknpRayCastQuery.h b/include/RE/H/hknpRayCastQuery.h index b64ffd63..1dbc3bd3 100644 --- a/include/RE/H/hknpRayCastQuery.h +++ b/include/RE/H/hknpRayCastQuery.h @@ -12,9 +12,9 @@ namespace RE { public: // members - hkcdRay ray; // 0x20 - hkFlags flags; // 0x50 - std::byte pad54[0x0C]; // 0x54 + hkcdRay m_ray; // 0x20 + hkFlags m_flags; // 0x50 + std::byte m_pad54[0x0C]; // 0x54 }; static_assert(sizeof(hknpRayCastQuery) == 0x60); } diff --git a/include/RE/H/hknpShape.h b/include/RE/H/hknpShape.h index dcbfe754..ee023196 100644 --- a/include/RE/H/hknpShape.h +++ b/include/RE/H/hknpShape.h @@ -72,9 +72,9 @@ namespace RE kHigh = 2 }; - Quality quality{ Quality::kHigh }; - float inertiaFactor{ 1.5f }; - float massOrNegativeDensity{ -1.0f }; + Quality m_quality{ Quality::kHigh }; + float m_inertiaFactor{ 1.5f }; + float m_massOrNegativeDensity{ -1.0f }; }; static_assert(sizeof(MassConfig) == 0xC); @@ -112,12 +112,13 @@ namespace RE virtual void CheckConsistency() const; // 1D // members - hkFlags flags; // 0x10 - std::uint8_t numShapeKeyBits; // 0x12 - hkEnum dispatchType; // 0x13 - float convexRadius; // 0x14 - std::uintptr_t userData; // 0x18 - hkRefCountedProperties* properties; // 0x20 + hkFlags m_flags; // 0x10 + std::uint8_t m_numShapeKeyBits; // 0x12 + hkEnum m_dispatchType; // 0x13 + float m_convexRadius; // 0x14 + std::uintptr_t m_userData; // 0x18 + hkRefCountedProperties* m_properties; // 0x20 + std::byte m_pad28[0x08]; // 0x28 }; static_assert(sizeof(hknpShape) == 0x30); } diff --git a/include/RE/H/hknpShapeInstance.h b/include/RE/H/hknpShapeInstance.h index d204ef9c..ddeb1fb0 100644 --- a/include/RE/H/hknpShapeInstance.h +++ b/include/RE/H/hknpShapeInstance.h @@ -11,12 +11,13 @@ namespace RE { public: // members - hkTransformf transform; // 0x00 - hkVector4f scale; // 0x40 - hkRefPtr shape; // 0x50 - std::uint16_t shapeTag; // 0x58 - std::uint16_t destructionTag; // 0x5A - std::uint8_t padding[30]; // 0x5C + hkTransformf m_transform; // 0x00 + hkVector4f m_scale; // 0x40 + hkRefPtr m_shape; // 0x50 + std::uint16_t m_shapeTag; // 0x58 + std::uint16_t m_destructionTag; // 0x5A + std::byte m_padding[30]; // 0x5C + std::byte m_pad7A[6]; // 0x7A }; static_assert(sizeof(hknpShapeInstance) == 0x80); } diff --git a/include/RE/H/hknpShapeManager.h b/include/RE/H/hknpShapeManager.h index 75cafdbb..fd09277a 100644 --- a/include/RE/H/hknpShapeManager.h +++ b/include/RE/H/hknpShapeManager.h @@ -17,17 +17,17 @@ namespace RE { public: // members - hknpShapeManager* shapeManager; // 0x00 - const hknpShape* shape; // 0x08 - hkArray bodyIds; // 0x10 - hkFlags mutations; // 0x20 + hknpShapeManager* m_shapeManager; // 0x00 + const hknpShape* m_shape; // 0x08 + hkArray m_bodyIds; // 0x10 + hkFlags m_mutations; // 0x20 }; static_assert(sizeof(MutableShapeInfo) == 0x28); // members - hkArray mutableShapeInfos; // 0x00 - hkArray freeMutableShapeInfos; // 0x10 - hkBool isAnyShapeMutated; // 0x20 + hkArray m_mutableShapeInfos; // 0x00 + hkArray m_freeMutableShapeInfos; // 0x10 + hkBool m_isAnyShapeMutated; // 0x20 }; static_assert(sizeof(hknpShapeManager) == 0x28); } diff --git a/include/RE/H/hknpShapeSignals.h b/include/RE/H/hknpShapeSignals.h index 6983c84d..ff2fd1c6 100644 --- a/include/RE/H/hknpShapeSignals.h +++ b/include/RE/H/hknpShapeSignals.h @@ -29,8 +29,8 @@ namespace RE static_assert(sizeof(ShapeMutatedSignal) == 0x08); // members - ShapeMutatedSignal shapeMutated; // 0x00 - ShapeDestroyedSignal shapeDestroyed; // 0x08 + ShapeMutatedSignal m_shapeMutated; // 0x00 + ShapeDestroyedSignal m_shapeDestroyed; // 0x08 }; static_assert(sizeof(hknpShapeSignals) == 0x10); } diff --git a/include/RE/H/hknpSolverInfo.h b/include/RE/H/hknpSolverInfo.h index 56cd1d44..baed87e2 100644 --- a/include/RE/H/hknpSolverInfo.h +++ b/include/RE/H/hknpSolverInfo.h @@ -9,36 +9,36 @@ namespace RE { public: // members - float tau; // 0x000 - float frictionTau; // 0x004 - hkSimdFloat32 damping; // 0x010 - hkSimdFloat32 deltaTime; // 0x020 - hkSimdFloat32 invDeltaTime; // 0x030 - hkSimdFloat32 subStepDeltaTime; // 0x040 - hkSimdFloat32 subStepInvDeltaTime; // 0x050 - hkSimdFloat32 distanceToLinearTim; // 0x060 - hkSimdFloat32 linearTimToDistance; // 0x070 - hkSimdFloat32 collisionTolerance; // 0x080 - hkSimdFloat32 unitScale; // 0x090 - hkSimdFloat32 collisionAccuracy; // 0x0A0 - float maxApproachSpeedForHighQualitySolver; // 0x0B0 - std::int32_t numSteps; // 0x0B4 - float invNumSteps; // 0x0B8 - std::int32_t numMicroSteps; // 0x0BC - float invNumMicroSteps; // 0x0C0 - float nominalGravityLength; // 0x0C4 - float expectedDeltaTime; // 0x0C8 - std::uint32_t stepSolveCount; // 0x0CC - hkVector4f globalAccelerationPerSubStep; // 0x0D0 - hkVector4f globalAccelerationPerStep; // 0x0E0 - hkVector4f integrateVelocityFactor; // 0x0F0 - hkVector4f invIntegrateVelocityFactor; // 0x100 - hkSimdFloat32 rhsFactor; // 0x110 - hkSimdFloat32 frictionRhsFactor; // 0x120 - float dampDivTau; // 0x130 - float tauDivDamp; // 0x134 - float dampDivFrictionTau; // 0x138 - float frictionTauDivDamp; // 0x13C + float m_tau; // 0x000 + float m_frictionTau; // 0x004 + hkSimdFloat32 m_damping; // 0x010 + hkSimdFloat32 m_deltaTime; // 0x020 + hkSimdFloat32 m_invDeltaTime; // 0x030 + hkSimdFloat32 m_subStepDeltaTime; // 0x040 + hkSimdFloat32 m_subStepInvDeltaTime; // 0x050 + hkSimdFloat32 m_distanceToLinearTim; // 0x060 + hkSimdFloat32 m_linearTimToDistance; // 0x070 + hkSimdFloat32 m_collisionTolerance; // 0x080 + hkSimdFloat32 m_unitScale; // 0x090 + hkSimdFloat32 m_collisionAccuracy; // 0x0A0 + float m_maxApproachSpeedForHighQualitySolver; // 0x0B0 + std::int32_t m_numSteps; // 0x0B4 + float m_invNumSteps; // 0x0B8 + std::int32_t m_numMicroSteps; // 0x0BC + float m_invNumMicroSteps; // 0x0C0 + float m_nominalGravityLength; // 0x0C4 + float m_expectedDeltaTime; // 0x0C8 + std::uint32_t m_stepSolveCount; // 0x0CC + hkVector4f m_globalAccelerationPerSubStep; // 0x0D0 + hkVector4f m_globalAccelerationPerStep; // 0x0E0 + hkVector4f m_integrateVelocityFactor; // 0x0F0 + hkVector4f m_invIntegrateVelocityFactor; // 0x100 + hkSimdFloat32 m_rhsFactor; // 0x110 + hkSimdFloat32 m_frictionRhsFactor; // 0x120 + float m_dampDivTau; // 0x130 + float m_tauDivDamp; // 0x134 + float m_dampDivFrictionTau; // 0x138 + float m_frictionTauDivDamp; // 0x13C }; static_assert(sizeof(hknpSolverInfo) == 0x140); } diff --git a/include/RE/H/hknpSparseCompactMap.h b/include/RE/H/hknpSparseCompactMap.h index a9a23f1e..165601d1 100644 --- a/include/RE/H/hknpSparseCompactMap.h +++ b/include/RE/H/hknpSparseCompactMap.h @@ -9,10 +9,10 @@ namespace RE { public: private: - std::uint32_t m_secondaryKeyMask; - std::uint32_t m_sencondaryKeyBits; - hkArray m_primaryKeyToIndex; - hkArray m_valueAndSecondaryKeys; + std::uint32_t m_secondaryKeyMask; // 0x00 + std::uint32_t m_sencondaryKeyBits; // 0x04 + hkArray m_primaryKeyToIndex; // 0x08 + hkArray m_valueAndSecondaryKeys; // 0x18 }; static_assert(sizeof(hknpSparseCompactMap) == 0x28); } diff --git a/include/RE/H/hknpThreadSafetyCheck.h b/include/RE/H/hknpThreadSafetyCheck.h index 2d3d126a..5f28ebfd 100644 --- a/include/RE/H/hknpThreadSafetyCheck.h +++ b/include/RE/H/hknpThreadSafetyCheck.h @@ -12,16 +12,16 @@ namespace RE { public: // members - std::uint32_t numReaders: 5; - std::uint32_t numWriters: 3; - std::uint32_t writerThreadId: 24; + std::uint32_t m_numReaders: 5; + std::uint32_t m_numWriters: 3; + std::uint32_t m_writerThreadId: 24; }; static_assert(sizeof(State) == 0x04); // members - State state; // 0x00 - hkCriticalSection criticalSection; // 0x08 - hkBool enabled; // 0x30 + State m_state; // 0x00 + hkCriticalSection m_criticalSection; // 0x08 + hkBool m_enabled; // 0x30 }; static_assert(sizeof(hknpThreadSafetyCheck) == 0x38); } diff --git a/include/RE/H/hknpTriangleShape.h b/include/RE/H/hknpTriangleShape.h new file mode 100644 index 00000000..1ebc5c19 --- /dev/null +++ b/include/RE/H/hknpTriangleShape.h @@ -0,0 +1,35 @@ +#pragma once + +#include "RE/H/hknpConvexPolytopeShape.h" + +namespace RE +{ + class __declspec(novtable) hknpTriangleShape : + public hknpConvexPolytopeShape + { + public: + inline static constexpr auto RTTI{ RTTI::hknpTriangleShape }; + inline static constexpr auto VTABLE{ VTABLE::hknpTriangleShape }; + + static hknpTriangleShape* CreateEmptyTriangleShape(const float a_radius) + { + using func_t = decltype(&hknpTriangleShape::CreateEmptyTriangleShape); + static REL::Relocation func{ ID::hknpTriangleShape::CreateEmptyTriangleShape }; + return func(a_radius); + } + + static hknpTriangleShape* CreateTriangleShape(const hkVector4f& a_vertexA, const hkVector4f& a_vertexB, const hkVector4f& a_vertexC, const float a_radius) + { + auto shape = CreateEmptyTriangleShape(a_radius); + shape->SetVertices(a_vertexA, a_vertexB, a_vertexC); + return shape; + } + + void SetVertices(const hkVector4f& a_vertexA, const hkVector4f& a_vertexB, const hkVector4f& a_vertexC) + { + using func_t = decltype(&hknpTriangleShape::SetVertices); + static REL::Relocation func{ ID::hknpTriangleShape::SetVertices }; + func(this, a_vertexA, a_vertexB, a_vertexC); + } + }; +} diff --git a/include/RE/H/hknpViewer.h b/include/RE/H/hknpViewer.h new file mode 100644 index 00000000..f4a6b232 --- /dev/null +++ b/include/RE/H/hknpViewer.h @@ -0,0 +1,29 @@ +#pragma once + +#include "RE/H/hknpBodyId.h" +#include "RE/H/hknpProcessContextListener.h" +#include "RE/H/hkProcess.h" +#include "RE/H/hkReferencedObject.h" + +namespace RE +{ + class hknpProcessContext; + class hknpWorld; + + class hknpViewer : + public hkReferencedObject, + public hkProcess, + public hknpProcessContextListener + { + public: + // add + virtual void OnSetViewerSpecificBody() {} // 0x20 [04] + + // members + hknpProcessContext* m_context; // 0x48 + hknpBodyId m_selectedBody; // 0x50 + std::byte m_pad54[0x4]; // 0x54 + const hknpWorld* m_worldForViewerSpecifcBody; // 0x58 + }; + static_assert(sizeof(hknpViewer) == 0x60); +} diff --git a/include/RE/H/hknpViewerColorScheme.h b/include/RE/H/hknpViewerColorScheme.h index bc73d1e9..e7b4943b 100644 --- a/include/RE/H/hknpViewerColorScheme.h +++ b/include/RE/H/hknpViewerColorScheme.h @@ -10,10 +10,11 @@ namespace RE class hknpViewerColorScheme { public: - virtual ~hknpViewerColorScheme() = default; + virtual ~hknpViewerColorScheme() = default; // 0x00 [00] - virtual std::uint32_t GetBodyColor(const hknpWorld&, hknpBodyId, hknpViewer*) = 0; - virtual bool IsBodyVisible(const hknpWorld&, hknpBodyId, hknpViewer*) = 0; + // add + virtual std::uint32_t GetBodyColor(const hknpWorld* a_world, hknpBodyId a_bodyId, hknpViewer* a_viewer) = 0; // 0x08 [01] + virtual bool IsBodyVisible(const hknpWorld* a_world, hknpBodyId a_bodyId, hknpViewer* a_viewer) = 0; // 0x10 [02] }; - static_assert(sizeof(hknpViewerColorScheme) == 0x8); + static_assert(sizeof(hknpViewerColorScheme) == 0x08); } diff --git a/include/RE/H/hknpWorld.h b/include/RE/H/hknpWorld.h index 319996f5..9b020a75 100644 --- a/include/RE/H/hknpWorld.h +++ b/include/RE/H/hknpWorld.h @@ -11,6 +11,7 @@ #include "RE/H/hkSimdFloat32.h" #include "RE/H/hkVector4.h" #include "RE/H/hknpBodyManager.h" +#include "RE/H/hknpCollisionFlags.h" #include "RE/H/hknpConstraintManager.h" #include "RE/H/hknpContactSolverType.h" #include "RE/H/hknpMotionManager.h" @@ -55,9 +56,15 @@ namespace RE public: enum class AdditionMode : std::int32_t { - kDoNotAddBody = 0x0, - kAddBodyNow = 0x1, - kAddBodyInNextStep = 0x2 + kDoNotAddBody = 0, + kAddBodyNow = 1, + kAddBodyInNextStep = 2 + }; + + enum class RebuildCachesMode : std::int32_t + { + kRebuild = 0, + kKeep = 1 }; enum class SimulationStage : std::int32_t @@ -82,73 +89,112 @@ namespace RE func(this, a_ids, a_idCount, a_additionMode, a_additionFlags); } - hknpBodyId& CreateBody(hknpBodyId& a_id, const hknpBodyCinfo& a_cInfo, AdditionMode a_additionMode, hkFlags a_additionFlags) + hknpBodyId& CreateBody(const hknpBodyCinfo& a_cInfo, AdditionMode a_additionMode = AdditionMode::kAddBodyNow, hkFlags a_additionFlags = AdditionFlagsEnum::kNoFlags) { - using func_t = decltype(&hknpWorld::CreateBody); + using func_t = hknpBodyId&(hknpWorld*, hknpBodyId&, const hknpBodyCinfo&, AdditionMode, hkFlags); static REL::Relocation func{ ID::hknpWorld::CreateBody }; - return func(this, a_id, a_cInfo, a_additionMode, a_additionFlags); + + hknpBodyId bodyId; + return func(this, bodyId, a_cInfo, a_additionMode, a_additionFlags); } - hknpMotionId& CreateMotion(hknpMotionId& a_id, const hknpMotionCinfo& a_cInfo) + hknpMotionId& CreateMotion(const hknpMotionCinfo& a_cInfo) { - using func_t = decltype(&hknpWorld::CreateMotion); + using func_t = hknpMotionId&(hknpWorld*, hknpMotionId&, const hknpMotionCinfo&); static REL::Relocation func{ ID::hknpWorld::CreateMotion }; - return func(this, a_id, a_cInfo); + + hknpMotionId motionId; + return func(this, motionId, a_cInfo); + } + + void DisableBodyFlags(hknpBodyId a_bodyId, hknpCollisionFlags a_enabledFlags, RebuildCachesMode a_cacheBehavior = RebuildCachesMode::kRebuild) + { + using func_t = decltype(&hknpWorld::DisableBodyFlags); + static REL::Relocation func{ ID::hknpWorld::DisableBodyFlags }; + func(this, a_bodyId, a_enabledFlags, a_cacheBehavior); + } + + void EnableBodyFlags(hknpBodyId a_bodyId, hknpCollisionFlags a_enabledFlags, RebuildCachesMode a_cacheBehavior = RebuildCachesMode::kRebuild) + { + using func_t = decltype(&hknpWorld::EnableBodyFlags); + static REL::Relocation func{ ID::hknpWorld::EnableBodyFlags }; + func(this, a_bodyId, a_enabledFlags, a_cacheBehavior); + } + + hknpActionManager* GetActionManager() + { + using func_t = decltype(&hknpWorld::GetActionManager); + static REL::Relocation func{ ID::hknpWorld::GetActionManager }; + return func(this); + } + + void SetBodyCollisionFilterInfo(hknpBodyId a_bodyId, std::uint32_t a_collisionFilterInfo, RebuildCachesMode a_cacheBehavior = RebuildCachesMode::kRebuild) + { + using func_t = decltype(&hknpWorld::SetBodyCollisionFilterInfo); + static REL::Relocation func{ ID::hknpWorld::SetBodyCollisionFilterInfo }; + func(this, a_bodyId, a_collisionFilterInfo, a_cacheBehavior); + } + + void SetBodyMotion(hknpBodyId a_bodyId, hknpMotionId a_motionId, RebuildCachesMode a_cacheBehavior = RebuildCachesMode::kRebuild) + { + using func_t = decltype(&hknpWorld::SetBodyMotion); + static REL::Relocation func{ ID::hknpWorld::SetBodyMotion }; + func(this, a_bodyId, a_motionId, a_cacheBehavior); } // members - hknpBodyManager bodyManager; // 010 - hknpMotionManager motionManager; // 0D8 - hknpConstraintManager constraintManager; // 120 - hknpModifierManager* modifierManager; // 150 - hkRefPtr persistentStreamAllocator; // 158 - hkBlockStreamAllocator* stepLocalStreamAllocator; // 160 - hknpSimulation* simulation; // 168 - hknpSpaceSplitter* spaceSplitter; // 170 - hknpBroadPhase* broadPhase; // 178 - hkIntSpaceUtil intSpaceUtil; // 180 - hkSimdFloat32 collisionTolerance; // 1E0 - hknpCollisionCacheManager* collisionCacheManager; // 1F0 - hknpCollisionDispatcher* collisionDispatcher; // 1F8 - hknpCollisionQueryDispatcherBase* collisionQueryDispatcher; // 200 - hkBool contactCachingEnabled; // 208 - hkBlockStream lastFrameContactData; // 210 - hknpContactSolverType::Enum contactSolverType; // 310 - hknpContactConstraintSolver* contactSolver; // 318 - hknpConstraintAtomSolver* constraintAtomSolver; // 320 - hknpSolverInfo solverInfo; // 330 - hkBool enableSolverDynamicScheduling; // 470 - hkArray solverVelocities; // 478 - hkArray solverSumVelocities; // 488 - hkBool deactivationEnabled; // 498 - hknpDeactivationManager* deactivationManager; // 4A0 - hkBool deleteCachesOnDeactivation; // 4A8 - hknpWorldSignals signals; // 4B0 - hkPrimaryCommandDispatcher* commandDispatcher; // 598 - hkRefPtr traceDispatcher; // 5A0 - std::uint16_t userData; // 5A8 - hkVector4f gravity; // 5B0 - hkRefPtr defaultModifierSet; // 5C0 - hkRefPtr materialLibrary; // 5C8 - hkRefPtr motionPropertiesLibrary; // 5D0 - hkRefPtr qualityLibrary; // 5D8 - hkBitField dirtyMaterials; // 5E0 - hkBitField dirtyQualities; // 5F8 - hknpShapeManager shapeManager; // 610 - hkRefPtr shapeTagCodec; // 638 - hknpNullShapeTagCodec* nullShapeTagCodec; // 640 - hkRefPtr eventDispatcher; // 648 - hkRefPtr internalPhysicsCommandDispatcher; // 650 - hkBool consistencyChecksEnabled; // 658 - hknpPostCollideTask* postCollideTask; // 660 - hknpPostSolveTask* postSolveTask; // 668 - hkEnum simulationStage; // 670 - hknpSimulationContext* simulationContext; // 678 - hknpActionManager* actionManager; // 680 - hkEnum simulationType; // 688 - hkBool mergeEventsBeforeDispatch; // 689 - hkEnum leavingBroadPhaseBehavior; // 68A - hknpThreadSafetyCheck threadSafetyCheck; // 690 + hknpBodyManager m_bodyManager; // 0x010 + hknpMotionManager m_motionManager; // 0x0D8 + hknpConstraintManager m_constraintManager; // 0x120 + hknpModifierManager* m_modifierManager; // 0x150 + hkRefPtr m_persistentStreamAllocator; // 0x158 + hkBlockStreamAllocator* m_stepLocalStreamAllocator; // 0x160 + hknpSimulation* m_simulation; // 0x168 + hknpSpaceSplitter* m_spaceSplitter; // 0x170 + hknpBroadPhase* m_broadPhase; // 0x178 + hkIntSpaceUtil m_intSpaceUtil; // 0x180 + hkSimdFloat32 m_collisionTolerance; // 0x1E0 + hknpCollisionCacheManager* m_collisionCacheManager; // 0x1F0 + hknpCollisionDispatcher* m_collisionDispatcher; // 0x1F8 + hknpCollisionQueryDispatcherBase* m_collisionQueryDispatcher; // 0x200 + hkBool m_contactCachingEnabled; // 0x208 + hkBlockStream m_lastFrameContactData; // 0x210 + hknpContactSolverType::Enum m_contactSolverType; // 0x310 + hknpContactConstraintSolver* m_contactSolver; // 0x318 + hknpConstraintAtomSolver* m_constraintAtomSolver; // 0x320 + hknpSolverInfo m_solverInfo; // 0x330 + hkBool m_enableSolverDynamicScheduling; // 0x470 + hkArray m_solverVelocities; // 0x478 + hkArray m_solverSumVelocities; // 0x488 + hkBool m_deactivationEnabled; // 0x498 + hknpDeactivationManager* m_deactivationManager; // 0x4A0 + hkBool m_deleteCachesOnDeactivation; // 0x4A8 + hknpWorldSignals m_signals; // 0x4B0 + hkPrimaryCommandDispatcher* m_commandDispatcher; // 0x598 + hkRefPtr m_traceDispatcher; // 0x5A0 + std::uint16_t m_userData; // 0x5A8 + hkVector4f m_gravity; // 0x5B0 + hkRefPtr m_defaultModifierSet; // 0x5C0 + hkRefPtr m_materialLibrary; // 0x5C8 + hkRefPtr m_motionPropertiesLibrary; // 0x5D0 + hkRefPtr m_qualityLibrary; // 0x5D8 + hkBitField m_dirtyMaterials; // 0x5E0 + hkBitField m_dirtyQualities; // 0x5F8 + hknpShapeManager m_shapeManager; // 0x610 + hkRefPtr m_shapeTagCodec; // 0x638 + hknpNullShapeTagCodec* m_nullShapeTagCodec; // 0x640 + hkRefPtr m_eventDispatcher; // 0x648 + hkRefPtr m_internalPhysicsCommandDispatcher; // 0x650 + hkBool m_consistencyChecksEnabled; // 0x658 + hknpPostCollideTask* m_postCollideTask; // 0x660 + hknpPostSolveTask* m_postSolveTask; // 0x668 + hkEnum m_simulationStage; // 0x670 + hknpSimulationContext* m_simulationContext; // 0x678 + hknpActionManager* m_actionManager; // 0x680 + hkEnum m_simulationType; // 0x688 + hkBool m_mergeEventsBeforeDispatch; // 0x689 + hkEnum m_leavingBroadPhaseBehavior; // 0x68A + hknpThreadSafetyCheck m_threadSafetyCheck; // 0x690 }; static_assert(sizeof(hknpWorld) == 0x6D0); } diff --git a/include/RE/IDs.h b/include/RE/IDs.h index 388727aa..4d759e2e 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -467,9 +467,18 @@ namespace RE::ID namespace bhkWorld { + inline constexpr REL::ID AddObjects{ 2277719 }; inline constexpr REL::ID AddPhysicsSystem{ 2277752 }; + inline constexpr REL::ID IsBodyAdded{ 2277997 }; inline constexpr REL::ID RemovePhysicsSystem{ 2277753 }; + inline constexpr REL::ID Activate{ 2277728 }; + inline constexpr REL::ID Enable{ 2277725 }; + inline constexpr REL::ID EnableCollision{ 2277730 }; + inline constexpr REL::ID IsActive{ 2277729 }; inline constexpr REL::ID RemoveObjects{ 2277721 }; + inline constexpr REL::ID SetCollisionGroup{ 2277722 }; + inline constexpr REL::ID SetDismemberedLimb{ 2277726 }; + inline constexpr REL::ID SetMotion{ 2277723 }; } namespace BIPOBJECT @@ -1089,15 +1098,14 @@ namespace RE::ID inline constexpr REL::ID Get{ 2194566 }; } - namespace hknpCapsuleShape + namespace hkContainerHeapAllocator { - inline constexpr REL::ID Init{ 2257217 }; - inline constexpr REL::ID CreateCapsuleShape{ 2257207 }; + inline constexpr REL::ID Singleton{ 2665426 }; } - namespace hkContainerHeapAllocator + namespace hkDisplaySerializeOStream { - inline constexpr REL::ID Singleton{ 2665426 }; + inline constexpr REL::ID ctor{ 2266374 }; } namespace hkHardwareInfo @@ -1105,6 +1113,11 @@ namespace RE::ID inline constexpr REL::ID CalcNumHardwareThreads{ 2260765 }; } + namespace hkIArchive + { + inline constexpr REL::ID ctor2{ }; + } + namespace hkMemoryRouter { inline constexpr REL::ID tlsSlotID{ 878080 }; @@ -1117,6 +1130,17 @@ namespace RE::ID inline constexpr REL::ID Resize{ 2257310 }; } + namespace hknpCapsuleShape + { + inline constexpr REL::ID Init{ 2257217 }; + inline constexpr REL::ID CreateCapsuleShape{ 2257207 }; + } + + namespace hknpConvexPolytopeShape + { + inline constexpr REL::ID CreateFromVerticesInternal{ 2257201 }; + } + namespace hknpConvexShape { inline constexpr REL::ID CreateFromAabb{ 2257125 }; @@ -1143,11 +1167,38 @@ namespace RE::ID inline constexpr REL::ID CreateSphereShape{ 2256377 }; } + namespace hknpTriangleShape + { + inline constexpr REL::ID CreateEmptyTriangleShape{ 2256226 }; + inline constexpr REL::ID SetVertices{ 2256228 }; + } + + namespace hknpBSWorld + { + inline constexpr REL::ID AccessMotion{ 2277680 }; + inline constexpr REL::ID ActivateBody{ 2277677 }; + inline constexpr REL::ID SetBodyAngularVelocity{ 2277672 }; + inline constexpr REL::ID SetBodyKeyframed{ 2277684 }; + inline constexpr REL::ID SetBodyLinearVelocity{ 2277671 }; + inline constexpr REL::ID SetBodyStatic{ 2277683 }; + inline constexpr REL::ID SetBodyVelocity{ 2277670 }; + } + namespace hknpWorld { inline constexpr REL::ID AddBodies{ 2255681 }; inline constexpr REL::ID CreateBody{ 2255680 }; inline constexpr REL::ID CreateMotion{ 2255688 }; + inline constexpr REL::ID DisableBodyFlags{ 2255636 }; + inline constexpr REL::ID EnableBodyFlags{ 2255635 }; + inline constexpr REL::ID GetActionManager{ 2255709 }; + inline constexpr REL::ID SetBodyCollisionFilterInfo{ 2255626 }; + inline constexpr REL::ID SetBodyMotion{ 2255634 }; + } + + namespace hkOArchive + { + inline constexpr REL::ID ctor2{ 2259258 }; } namespace hkProcessFactory From 40f9f510ab86551e09e0a56317e815bf391d7b6b Mon Sep 17 00:00:00 2001 From: qudix Date: Fri, 1 May 2026 17:48:14 +0000 Subject: [PATCH 6/9] maintenance --- include/RE/H/hkBaseObject.h | 2 +- include/RE/H/hkIArchive.h | 2 +- include/RE/H/hkOArchive.h | 2 +- include/RE/H/hknpViewer.h | 6 +++--- include/RE/IDs.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/RE/H/hkBaseObject.h b/include/RE/H/hkBaseObject.h index f483821b..ec1df435 100644 --- a/include/RE/H/hkBaseObject.h +++ b/include/RE/H/hkBaseObject.h @@ -11,7 +11,7 @@ namespace RE hkBaseObject() { REX::EMPLACE_VTABLE(this); } // add - virtual ~hkBaseObject() {}; // 0x00 [00] + virtual ~hkBaseObject(){}; // 0x00 [00] virtual void __first_virtual_table_function__() {} // 0x08 [01] }; static_assert(sizeof(hkBaseObject) == 0x08); diff --git a/include/RE/H/hkIArchive.h b/include/RE/H/hkIArchive.h index 72233871..1c72f77d 100644 --- a/include/RE/H/hkIArchive.h +++ b/include/RE/H/hkIArchive.h @@ -1,8 +1,8 @@ #pragma once #include "RE/H/hkBool.h" -#include "RE/H/hkReferencedObject.h" #include "RE/H/hkRefPtr.h" +#include "RE/H/hkReferencedObject.h" #include "RE/H/hkStreamReader.h" namespace RE diff --git a/include/RE/H/hkOArchive.h b/include/RE/H/hkOArchive.h index 689f47ea..0f72408e 100644 --- a/include/RE/H/hkOArchive.h +++ b/include/RE/H/hkOArchive.h @@ -1,8 +1,8 @@ #pragma once #include "RE/H/hkBool.h" -#include "RE/H/hkReferencedObject.h" #include "RE/H/hkRefPtr.h" +#include "RE/H/hkReferencedObject.h" #include "RE/H/hkStreamWriter.h" namespace RE diff --git a/include/RE/H/hknpViewer.h b/include/RE/H/hknpViewer.h index f4a6b232..a057db29 100644 --- a/include/RE/H/hknpViewer.h +++ b/include/RE/H/hknpViewer.h @@ -1,16 +1,16 @@ #pragma once -#include "RE/H/hknpBodyId.h" -#include "RE/H/hknpProcessContextListener.h" #include "RE/H/hkProcess.h" #include "RE/H/hkReferencedObject.h" +#include "RE/H/hknpBodyId.h" +#include "RE/H/hknpProcessContextListener.h" namespace RE { class hknpProcessContext; class hknpWorld; - class hknpViewer : + class hknpViewer : public hkReferencedObject, public hkProcess, public hknpProcessContextListener diff --git a/include/RE/IDs.h b/include/RE/IDs.h index 4d759e2e..2eba2891 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -1115,7 +1115,7 @@ namespace RE::ID namespace hkIArchive { - inline constexpr REL::ID ctor2{ }; + inline constexpr REL::ID ctor2{}; } namespace hkMemoryRouter From 2e82782798569e248ea699e6b2dcaeb6ec3cb7a4 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 May 2026 18:02:36 -0500 Subject: [PATCH 7/9] fix: `PowerUtils` missing inline --- include/RE/P/PowerUtils.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/RE/P/PowerUtils.h b/include/RE/P/PowerUtils.h index be22d2ca..43d85ff0 100644 --- a/include/RE/P/PowerUtils.h +++ b/include/RE/P/PowerUtils.h @@ -51,18 +51,18 @@ namespace RE }; static_assert(sizeof(TraverseConnectionsOptions) == 0x8); - bool ItemIsPowerConnection(const TESObjectREFR* refr) + inline bool ItemIsPowerConnection(const TESObjectREFR* a_refr) { using func_t = decltype(&PowerUtils::ItemIsPowerConnection); static REL::Relocation func{ ID::PowerUtils::ItemIsPowerConnection }; - return func(refr); + return func(a_refr); } - bool ItemIsPowerReceiver(const TESObjectREFR* refr) + inline bool ItemIsPowerReceiver(const TESObjectREFR* a_refr) { using func_t = decltype(&PowerUtils::ItemIsPowerReceiver); static REL::Relocation func{ ID::PowerUtils::ItemIsPowerReceiver }; - return func(refr); + return func(a_refr); } } From 46b7491e89ac953e9c85f66ef89b3a7a5b6565bb Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 May 2026 18:19:55 -0500 Subject: [PATCH 8/9] fix: NiPoint3 include --- include/RE/D/DetectionData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/D/DetectionData.h b/include/RE/D/DetectionData.h index c839efcd..aac28a5d 100644 --- a/include/RE/D/DetectionData.h +++ b/include/RE/D/DetectionData.h @@ -2,7 +2,7 @@ #include "RE/D/DetectionFormulaData.h" #include "RE/D/DetectionLevels.h" -#include "RE/N/NiPoint.h" +#include "RE/N/NiPoint3.h" namespace RE { From a4c1c0d561f3515c989231a8448ccab9c1d58845 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 May 2026 18:43:17 -0500 Subject: [PATCH 9/9] fix: `clang-cl` --- include/RE/H/hkStreamReader.h | 2 +- include/RE/H/hkStridedVertices.h | 20 ++++++++++---------- include/RE/H/hkVector4.h | 2 +- include/RE/N/NiMatrix3.h | 4 ++-- include/RE/N/NiPoint2.h | 8 ++++---- include/RE/N/NiPoint3.h | 20 ++++++++++---------- include/RE/N/NiPoint4.h | 10 +++++----- include/RE/N/NiTransform.h | 4 ++-- include/RE/P/PipboyCommand.h | 14 ++++++++++---- include/RE/P/PipboyCommandResult.h | 8 +++++++- 10 files changed, 52 insertions(+), 40 deletions(-) diff --git a/include/RE/H/hkStreamReader.h b/include/RE/H/hkStreamReader.h index 3961f68f..c7bcee21 100644 --- a/include/RE/H/hkStreamReader.h +++ b/include/RE/H/hkStreamReader.h @@ -19,7 +19,7 @@ namespace RE // add virtual hkBool IsOk() = 0; // 0x20 [04] virtual std::int32_t Read([[maybe_unused]] void* a_buffer, [[maybe_unused]] std::int32_t a_numBytes) = 0; // 0x28 [05] - virtual std::int32_t Skip([[maybe_unused]] std::int32_t a_numBytes) {} // 0x30 [06] + virtual std::int32_t Skip([[maybe_unused]] std::int32_t a_numBytes) { return 0; } // 0x30 [06] virtual std::int32_t Peek([[maybe_unused]] void* a_buffer, [[maybe_unused]] std::int32_t a_numBytes) { return false; } // 0x38 [07] virtual hkSeekableStreamReader* IsSeekTellSupported() { return nullptr; } // 0x40 [08] }; diff --git a/include/RE/H/hkStridedVertices.h b/include/RE/H/hkStridedVertices.h index 324b6518..6290fe48 100644 --- a/include/RE/H/hkStridedVertices.h +++ b/include/RE/H/hkStridedVertices.h @@ -14,27 +14,27 @@ namespace RE constexpr hkStridedVertices(const T* a_vertices, const std::int32_t a_numVertices) { static_assert(sizeof(T) > sizeof(float)); - vertices = (const float*)vertices; - numVertices = a_numVertices; - striding = sizeof(T); + m_vertices = (const float*)a_vertices; + m_numVertices = a_numVertices; + m_striding = sizeof(T); } hkStridedVertices(const hkArrayBase& a_vertices) { - vertices = (const float*)a_vertices.begin(); - numVertices = a_vertices.size(); - striding = sizeof(hkVector4); + m_vertices = (const float*)a_vertices.begin(); + m_numVertices = a_vertices.size(); + m_striding = sizeof(hkVector4); } constexpr std::int32_t size() const { - return numVertices; + return m_numVertices; } // members - const float* vertices{ nullptr }; // 0x00 - std::int32_t numVertices{ 0 }; // 0x08 - std::int32_t striding{ 0 }; // 0x0C - sizeof(T) + const float* m_vertices{ nullptr }; // 0x00 + std::int32_t m_numVertices{ 0 }; // 0x08 + std::int32_t m_striding{ 0 }; // 0x0C - sizeof(T) }; static_assert(sizeof(hkStridedVertices) == 0x10); } diff --git a/include/RE/H/hkVector4.h b/include/RE/H/hkVector4.h index 9c866b02..937ded06 100644 --- a/include/RE/H/hkVector4.h +++ b/include/RE/H/hkVector4.h @@ -51,7 +51,7 @@ namespace RE namespace RE { - inline constexpr hkVector4f hkVector4f::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; + inline const hkVector4f hkVector4f::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; constexpr hkVector4f::hkVector4f(float a_x, float a_y, float a_z, float a_w) noexcept : x(a_x), y(a_y), z(a_z), w(a_w) diff --git a/include/RE/N/NiMatrix3.h b/include/RE/N/NiMatrix3.h index 076c5c02..edba49dc 100644 --- a/include/RE/N/NiMatrix3.h +++ b/include/RE/N/NiMatrix3.h @@ -52,8 +52,8 @@ namespace RE namespace RE { - inline constexpr NiMatrix3 NiMatrix3::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; - inline constexpr NiMatrix3 NiMatrix3::IDENTITY = { NiPoint4::IDENTITY0, NiPoint4::IDENTITY0, NiPoint4::IDENTITY0 }; + inline const NiMatrix3 NiMatrix3::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; + inline const NiMatrix3 NiMatrix3::IDENTITY = { NiPoint4::IDENTITY0, NiPoint4::IDENTITY0, NiPoint4::IDENTITY0 }; constexpr NiMatrix3::NiMatrix3(const NiPoint4& a_point0, const NiPoint4& a_point1, const NiPoint4& a_point2) noexcept { diff --git a/include/RE/N/NiPoint2.h b/include/RE/N/NiPoint2.h index 80a6edb1..54d9a0d9 100644 --- a/include/RE/N/NiPoint2.h +++ b/include/RE/N/NiPoint2.h @@ -171,10 +171,10 @@ namespace RE return *this; } - inline constexpr NiPoint2 NiPoint2::ZERO = { 0.0F, 0.0F }; - inline constexpr NiPoint2 NiPoint2::UNIT = { 1.0F, 1.0F }; - inline constexpr NiPoint2 NiPoint2::UNIT_X = { 1.0F, 0.0F }; - inline constexpr NiPoint2 NiPoint2::UNIT_Y = { 0.0F, 1.0F }; + inline const NiPoint2 NiPoint2::ZERO = { 0.0F, 0.0F }; + inline const NiPoint2 NiPoint2::UNIT = { 1.0F, 1.0F }; + inline const NiPoint2 NiPoint2::UNIT_X = { 1.0F, 0.0F }; + inline const NiPoint2 NiPoint2::UNIT_Y = { 0.0F, 1.0F }; } template <> diff --git a/include/RE/N/NiPoint3.h b/include/RE/N/NiPoint3.h index 4cdbcf4f..48eaaefd 100644 --- a/include/RE/N/NiPoint3.h +++ b/include/RE/N/NiPoint3.h @@ -239,16 +239,16 @@ namespace RE return x * x + y * y + z * z; } - inline constexpr NiPoint3 NiPoint3::ZERO = { 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT = { 1.0F, 1.0F, 1.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT_X = { 1.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT_Y = { 0.0F, 1.0F, 0.0F }; - inline constexpr NiPoint3 NiPoint3::UNIT_Z = { 0.0F, 0.0F, 1.0F }; - inline constexpr NiPoint3A NiPoint3A::ZERO = { 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT = { 1.0F, 1.0F, 1.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT_X = { 1.0F, 0.0F, 0.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT_Y = { 0.0F, 1.0F, 0.0F }; - inline constexpr NiPoint3A NiPoint3A::UNIT_Z = { 0.0F, 0.0F, 1.0F }; + inline const NiPoint3 NiPoint3::ZERO = { 0.0F, 0.0F, 0.0F }; + inline const NiPoint3 NiPoint3::UNIT = { 1.0F, 1.0F, 1.0F }; + inline const NiPoint3 NiPoint3::UNIT_X = { 1.0F, 0.0F, 0.0F }; + inline const NiPoint3 NiPoint3::UNIT_Y = { 0.0F, 1.0F, 0.0F }; + inline const NiPoint3 NiPoint3::UNIT_Z = { 0.0F, 0.0F, 1.0F }; + inline const NiPoint3A NiPoint3A::ZERO = { 0.0F, 0.0F, 0.0F }; + inline const NiPoint3A NiPoint3A::UNIT = { 1.0F, 1.0F, 1.0F }; + inline const NiPoint3A NiPoint3A::UNIT_X = { 1.0F, 0.0F, 0.0F }; + inline const NiPoint3A NiPoint3A::UNIT_Y = { 0.0F, 1.0F, 0.0F }; + inline const NiPoint3A NiPoint3A::UNIT_Z = { 0.0F, 0.0F, 1.0F }; } template <> diff --git a/include/RE/N/NiPoint4.h b/include/RE/N/NiPoint4.h index 24696b31..dc8f296b 100644 --- a/include/RE/N/NiPoint4.h +++ b/include/RE/N/NiPoint4.h @@ -202,11 +202,11 @@ namespace RE return *this; } - inline constexpr NiPoint4 NiPoint4::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY0 = { 1.0F, 0.0F, 0.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY1 = { 0.0F, 1.0F, 0.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY2 = { 0.0F, 0.0F, 1.0F, 0.0F }; - inline constexpr NiPoint4 NiPoint4::IDENTITY3 = { 0.0F, 0.0F, 0.0F, 1.0F }; + inline const NiPoint4 NiPoint4::ZERO = { 0.0F, 0.0F, 0.0F, 0.0F }; + inline const NiPoint4 NiPoint4::IDENTITY0 = { 1.0F, 0.0F, 0.0F, 0.0F }; + inline const NiPoint4 NiPoint4::IDENTITY1 = { 0.0F, 1.0F, 0.0F, 0.0F }; + inline const NiPoint4 NiPoint4::IDENTITY2 = { 0.0F, 0.0F, 1.0F, 0.0F }; + inline const NiPoint4 NiPoint4::IDENTITY3 = { 0.0F, 0.0F, 0.0F, 1.0F }; } template <> diff --git a/include/RE/N/NiTransform.h b/include/RE/N/NiTransform.h index f1b59b5d..9edefe15 100644 --- a/include/RE/N/NiTransform.h +++ b/include/RE/N/NiTransform.h @@ -33,8 +33,8 @@ namespace RE namespace RE { - inline constexpr NiTransform NiTransform::ZERO = { NiMatrix3::ZERO, NiPoint3::ZERO, 0.0F }; - inline constexpr NiTransform NiTransform::IDENTITY = { NiMatrix3::IDENTITY, NiPoint3::ZERO, 1.0F }; + inline const NiTransform NiTransform::ZERO = { NiMatrix3::ZERO, NiPoint3::ZERO, 0.0F }; + inline const NiTransform NiTransform::IDENTITY = { NiMatrix3::IDENTITY, NiPoint3::ZERO, 1.0F }; constexpr NiTransform::NiTransform(const NiMatrix3& a_rotation, const NiPoint3& a_translation, const float a_scale) noexcept : rotate(a_rotation), translate(a_translation), scale(a_scale) diff --git a/include/RE/P/PipboyCommand.h b/include/RE/P/PipboyCommand.h index 1c33d210..04b7577b 100644 --- a/include/RE/P/PipboyCommand.h +++ b/include/RE/P/PipboyCommand.h @@ -10,6 +10,12 @@ namespace RE static constexpr auto RTTI{ RTTI::PipboyCommand }; static constexpr auto VTABLE{ VTABLE::PipboyCommand }; + PipboyCommand(std::uint32_t a_id) : + id(a_id) + { + REX::EMPLACE_VTABLE(this); + } + // add virtual ~PipboyCommand(); // 00 virtual void Init(Json::Value* a_json) = 0; // 01 @@ -17,10 +23,10 @@ namespace RE virtual const PipboyCommandResult* DoExecute(); // 03 // members - const std::uint32_t id; // 08 - const PipboyCommandResult* validationResult; // 10 - const PipboyCommandResult* executionResult; // 18 - bool isReadonOnly; // 20 + const std::uint32_t id; // 0x08 + const PipboyCommandResult* validationResult{ nullptr }; // 0x10 + const PipboyCommandResult* executionResult{ nullptr }; // 0x18 + bool isReadonOnly{ false }; // 0x20 }; static_assert(sizeof(PipboyCommand) == 0x28); } diff --git a/include/RE/P/PipboyCommandResult.h b/include/RE/P/PipboyCommandResult.h index 7808df77..ee8f2779 100644 --- a/include/RE/P/PipboyCommandResult.h +++ b/include/RE/P/PipboyCommandResult.h @@ -8,12 +8,18 @@ namespace RE static constexpr auto RTTI{ RTTI::PipboyCommandResult }; static constexpr auto VTABLE{ VTABLE::PipboyCommandResult }; + PipboyCommandResult(std::uint32_t a_commandId, bool a_succeeded, bool a_shouldReply) : + commandId(a_commandId), succeeded(a_succeeded), shouldReply(a_shouldReply) + { + REX::EMPLACE_VTABLE(this); + } + // add virtual ~PipboyCommandResult(); // 00 virtual void Serialize(Json::Value* a_json) = 0; // 01 // members - const std::uint32_t commandID; // 08 + const std::uint32_t commandId; // 08 const bool succeeded; // 0C const bool shouldReply; // 0D };