ksys/phys: Add ScRigidBodyGroup::Unk1 and one missed function

This commit is contained in:
Léo Lam
2022-03-25 00:31:34 +01:00
parent 7136dc0115
commit 5e6d930816
3 changed files with 45 additions and 4 deletions
@@ -1,4 +1,5 @@
#include "KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h"
#include <Havok/Common/Base/hkBase.h>
#include <Havok/Physics2012/Dynamics/Entity/hkpRigidBody.h>
#include <Havok/Physics2012/Dynamics/World/hkpPhysicsSystem.h>
#include <Havok/Physics2012/Internal/Collide/StaticCompound/hkpStaticCompoundShape.h>
@@ -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<int>(body_layer_type);
if (idx < 0 || idx >= mRigidBodiesPerBodyLayerType.size())
return nullptr;
return mRigidBodiesPerBodyLayerType[idx];
}
} // namespace ksys::phys
@@ -9,6 +9,7 @@
#include <thread/seadAtomic.h>
#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;