diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 98108a5b..6682098d 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -84275,9 +84275,9 @@ Address,Quality,Size,Name 0x0000007100fcd424,O,000164,_ZNK4ksys4phys28StaticCompoundRigidBodyGroup23getInvTransformedMatrixERKN4sead8Matrix34IfEE 0x0000007100fcd4c8,O,000136,_ZNK4ksys4phys28StaticCompoundRigidBodyGroup17getTransformedPosERKN4sead7Vector3IfEE 0x0000007100fcd550,O,000124,_ZNK4ksys4phys28StaticCompoundRigidBodyGroup13getRotatedDirERKN4sead7Vector3IfEE -0x0000007100fcd5cc,U,000380, -0x0000007100fcd748,U,000036, -0x0000007100fcd76c,U,000052, +0x0000007100fcd5cc,O,000380,_ZN4ksys4phys28StaticCompoundRigidBodyGroup4Unk1D1Ev +0x0000007100fcd748,O,000036,_ZN4ksys4phys28StaticCompoundRigidBodyGroup4Unk1D0Ev +0x0000007100fcd76c,O,000052,_ZNK4ksys4phys28StaticCompoundRigidBodyGroup12getRigidBodyENS0_13BodyLayerTypeE 0x0000007100fcd7a0,O,000016,_ZN4ksys4phys7UserTag21onMaxPositionExceededEPNS0_9RigidBodyE 0x0000007100fcd7b0,U,000020,phys::UserTag::m3 0x0000007100fcd7c4,U,000004,phys::UserTag::m4n diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.cpp b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.cpp index fddb16c1..940663e6 100644 --- a/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.cpp +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.cpp @@ -1,4 +1,5 @@ #include "KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h" +#include #include #include #include @@ -340,4 +341,30 @@ const sead::Matrix34f& StaticCompoundRigidBodyGroup::getTransform() const { return mTransform; } +StaticCompoundRigidBodyGroup::Unk1::~Unk1() { + if (_8) { + delete _8; + _8 = nullptr; + } + + const auto decref = [](hkReferencedObject*& ptr) { + if (ptr) { + ptr->removeReference(); + ptr = nullptr; + } + }; + + decref(_10); + decref(_18); + decref(_20); +} + +RigidBody* StaticCompoundRigidBodyGroup::getRigidBody(BodyLayerType body_layer_type) const { + auto idx = static_cast(body_layer_type); + if (idx < 0 || idx >= mRigidBodiesPerBodyLayerType.size()) + return nullptr; + + return mRigidBodiesPerBodyLayerType[idx]; +} + } // namespace ksys::phys diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h index d4724c78..8bc40f64 100644 --- a/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h @@ -9,6 +9,7 @@ #include #include "KingSystem/Utils/Types.h" +class hkReferencedObject; class hkpPhysicsSystem; class hkpStaticCompoundShape; @@ -69,6 +70,8 @@ public: sead::Vector3f getTransformedPos(const sead::Vector3f& pos) const; sead::Vector3f getRotatedDir(const sead::Vector3f& dir) const; + RigidBody* getRigidBody(BodyLayerType body_layer_type) const; + void processUpdates(); static Config& getConfig(); @@ -84,10 +87,21 @@ private: HasEnabledOrDisabledInstance = 1 << 5, }; + // A type with a virtual destructor. Nothing else is known about it. + struct Unk2 { + virtual ~Unk2() = default; + }; + + // The remnants of a type that had a virtual destructor and a bunch of pointers. + // Nothing else is known about it. struct Unk1 { virtual ~Unk1(); - u8 _8[0xc0]; + Unk2* _8; + hkReferencedObject* _10; + hkReferencedObject* _18; + hkReferencedObject* _20; + u8 _28[0xc8 - 0x28]; }; const sead::Matrix34f& getTransform() const;