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
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
3 changed files with 45 additions and 4 deletions

View File

@ -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

Can't render this file because it is too large.

View File

@ -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

View File

@ -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;