ksys/phys: Rename BodyGroup -> StaticCompoundRigidBodyGroup

Makes it obvious that it is related to StaticCompound stuff

Also fixes the relative ordering (BodyGroup is located after Mgr code).
This commit is contained in:
Léo Lam 2022-03-23 00:51:35 +01:00
parent f3308d7bee
commit a86fb2a9ed
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
10 changed files with 28 additions and 28 deletions

View File

@ -39,7 +39,7 @@ class UMii;
} // namespace mii } // namespace mii
namespace phys { namespace phys {
class BodyGroup; class StaticCompoundRigidBodyGroup;
class Physics; class Physics;
class Reaction; class Reaction;
class RigidBody; class RigidBody;
@ -390,7 +390,7 @@ protected:
/* 0x580 */ PhysicsConstraints mConstraints; /* 0x580 */ PhysicsConstraints mConstraints;
/* 0x598 */ void* _598 = nullptr; /* 0x598 */ void* _598 = nullptr;
/* 0x5a0 */ BoneControl* mBoneControl = nullptr; /* 0x5a0 */ BoneControl* mBoneControl = nullptr;
/* 0x5a8 */ phys::BodyGroup* mFieldBodyGroup = nullptr; /* 0x5a8 */ phys::StaticCompoundRigidBodyGroup* mFieldBodyGroup = nullptr;
/* 0x5b0 */ void* _5b0 = nullptr; /* 0x5b0 */ void* _5b0 = nullptr;
/* 0x5b8 */ sead::Heap* mDualHeap = nullptr; // TODO: rename /* 0x5b8 */ sead::Heap* mDualHeap = nullptr; // TODO: rename
/* 0x5c0 */ sead::Heap* mDualHeap2 = nullptr; // TODO: rename /* 0x5c0 */ sead::Heap* mDualHeap2 = nullptr; // TODO: rename

View File

@ -354,7 +354,7 @@ void PlacementMap::unload() {
mDynamicMubinRes.requestUnload(); mDynamicMubinRes.requestUnload();
} }
phys::BodyGroup* PlacementMap::getFieldBodyGroup(int field_group_idx) { phys::StaticCompoundRigidBodyGroup* PlacementMap::getFieldBodyGroup(int field_group_idx) {
const auto lock = sead::makeScopedLock(mCs); const auto lock = sead::makeScopedLock(mCs);
auto* r = mRes[0].mRes.getResource(); auto* r = mRes[0].mRes.getResource();

View File

@ -88,7 +88,7 @@ private:
void x_5(); void x_5();
int traverseStuff(sead::Vector3f* vec, PlacementActors* pa, int id); int traverseStuff(sead::Vector3f* vec, PlacementActors* pa, int id);
phys::BodyGroup* getFieldBodyGroup(int field_group_idx); phys::StaticCompoundRigidBodyGroup* getFieldBodyGroup(int field_group_idx);
void cleanupPhysics(); void cleanupPhysics();
bool loadStaticCompound(int hksc_idx, bool is_auto_gen_mu, bool req_arg_8); bool loadStaticCompound(int hksc_idx, bool is_auto_gen_mu, bool req_arg_8);
MapObjStatus x_2(int hksc_idx); MapObjStatus x_2(int hksc_idx);

View File

@ -92,12 +92,12 @@ target_sources(uking PRIVATE
StaticCompound/physStaticCompound.cpp StaticCompound/physStaticCompound.cpp
StaticCompound/physStaticCompound.h StaticCompound/physStaticCompound.h
StaticCompound/physStaticCompoundAutogen.cpp StaticCompound/physStaticCompoundAutogen.cpp
StaticCompound/physStaticCompoundBodyGroup.cpp
StaticCompound/physStaticCompoundBodyGroup.h
StaticCompound/physStaticCompoundInfo.cpp StaticCompound/physStaticCompoundInfo.cpp
StaticCompound/physStaticCompoundInfo.h StaticCompound/physStaticCompoundInfo.h
StaticCompound/physStaticCompoundMgr.cpp StaticCompound/physStaticCompoundMgr.cpp
StaticCompound/physStaticCompoundMgr.h StaticCompound/physStaticCompoundMgr.h
StaticCompound/physStaticCompoundRigidBodyGroup.cpp
StaticCompound/physStaticCompoundRigidBodyGroup.h
StaticCompound/physStaticCompoundUtil.cpp StaticCompound/physStaticCompoundUtil.cpp
StaticCompound/physStaticCompoundUtil.h StaticCompound/physStaticCompoundUtil.h

View File

@ -2,7 +2,7 @@
#include <Havok/Common/Serialize/Util/hkNativePackfileUtils.h> #include <Havok/Common/Serialize/Util/hkNativePackfileUtils.h>
#include <Havok/Common/Serialize/Util/hkRootLevelContainer.h> #include <Havok/Common/Serialize/Util/hkRootLevelContainer.h>
#include <Havok/Physics2012/Utilities/Serialize/hkpPhysicsData.h> #include <Havok/Physics2012/Utilities/Serialize/hkpPhysicsData.h>
#include "KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.h" #include "KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h"
#include "KingSystem/Physics/StaticCompound/physStaticCompoundInfo.h" #include "KingSystem/Physics/StaticCompound/physStaticCompoundInfo.h"
#include "KingSystem/Utils/Debug.h" #include "KingSystem/Utils/Debug.h"
#include "KingSystem/Utils/HeapUtil.h" #include "KingSystem/Utils/HeapUtil.h"
@ -98,11 +98,11 @@ bool StaticCompound::disableCollision(int actor_idx, bool x) {
return true; return true;
} }
BodyGroup* StaticCompound::getFieldBodyGroup(int idx) { StaticCompoundRigidBodyGroup* StaticCompound::getFieldBodyGroup(int idx) {
return &mFieldBodyGroups[idx]; return &mFieldBodyGroups[idx];
} }
bool StaticCompound::hasFieldBodyGroup(BodyGroup* group) const { bool StaticCompound::hasFieldBodyGroup(StaticCompoundRigidBodyGroup* group) const {
for (int i = 0, n = mFieldBodyGroups.size(); i < n; ++i) { for (int i = 0, n = mFieldBodyGroups.size(); i < n; ++i) {
if (&mFieldBodyGroups[i] == group) if (&mFieldBodyGroups[i] == group)
return true; return true;

View File

@ -17,7 +17,7 @@ class Object;
namespace ksys::phys { namespace ksys::phys {
struct ActorInfo; struct ActorInfo;
class BodyGroup; class StaticCompoundRigidBodyGroup;
struct StaticCompoundInfo; struct StaticCompoundInfo;
class StaticCompound : public res::Resource, public sead::hostio::Node { class StaticCompound : public res::Resource, public sead::hostio::Node {
@ -32,8 +32,8 @@ public:
bool disableCollision(int actor_idx, bool x); bool disableCollision(int actor_idx, bool x);
BodyGroup* getFieldBodyGroup(int idx); StaticCompoundRigidBodyGroup* getFieldBodyGroup(int idx);
bool hasFieldBodyGroup(BodyGroup* group) const; bool hasFieldBodyGroup(StaticCompoundRigidBodyGroup* group) const;
// res::Resource interface // res::Resource interface
void doCreate_(u8* buffer, u32 buffer_size, sead::Heap* parent_heap) override; void doCreate_(u8* buffer, u32 buffer_size, sead::Heap* parent_heap) override;
@ -60,7 +60,7 @@ private:
int mBufferSize{}; int mBufferSize{};
void* mContainerBuffer{}; void* mContainerBuffer{};
int mContainerBufferSize{}; int mContainerBufferSize{};
sead::Buffer<BodyGroup> mFieldBodyGroups; sead::Buffer<StaticCompoundRigidBodyGroup> mFieldBodyGroups;
sead::FixedSafeString<32> mName; sead::FixedSafeString<32> mName;
sead::Matrix34f mMtx = sead::Matrix34f::ident; sead::Matrix34f mMtx = sead::Matrix34f::ident;
sead::Buffer<map::Object*> mMapObjects{}; sead::Buffer<map::Object*> mMapObjects{};

View File

@ -1,4 +1,4 @@
#include "KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.h" #include "KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h"
#include <Havok/Physics2012/Dynamics/Entity/hkpRigidBody.h> #include <Havok/Physics2012/Dynamics/Entity/hkpRigidBody.h>
#include <Havok/Physics2012/Dynamics/World/hkpPhysicsSystem.h> #include <Havok/Physics2012/Dynamics/World/hkpPhysicsSystem.h>
#include "KingSystem/Physics/RigidBody/physRigidBodyFromResource.h" #include "KingSystem/Physics/RigidBody/physRigidBodyFromResource.h"
@ -12,9 +12,9 @@ namespace ksys::phys {
// TODO: rename // TODO: rename
constexpr int BodyGroupNumMatrices = 8; constexpr int BodyGroupNumMatrices = 8;
BodyGroup::BodyGroup() = default; StaticCompoundRigidBodyGroup::StaticCompoundRigidBodyGroup() = default;
BodyGroup::~BodyGroup() { StaticCompoundRigidBodyGroup::~StaticCompoundRigidBodyGroup() {
mFlags.reset(Flag::Initialised); mFlags.reset(Flag::Initialised);
for (int i = 0, n = mRigidBodiesPerBodyLayerType.size(); i < n; ++i) { for (int i = 0, n = mRigidBodiesPerBodyLayerType.size(); i < n; ++i) {
@ -29,7 +29,7 @@ BodyGroup::~BodyGroup() {
mRigidBodies.freeBuffer(); mRigidBodies.freeBuffer();
} }
void BodyGroup::init(const hkpPhysicsSystem& system, sead::Matrix34f* mtx, StaticCompound* sc, void StaticCompoundRigidBodyGroup::init(const hkpPhysicsSystem& system, sead::Matrix34f* mtx, StaticCompound* sc,
sead::Heap* heap) { sead::Heap* heap) {
mStaticCompound = sc; mStaticCompound = sc;
mMtxPtr = mtx; mMtxPtr = mtx;
@ -92,7 +92,7 @@ void BodyGroup::init(const hkpPhysicsSystem& system, sead::Matrix34f* mtx, Stati
mFlags.set(Flag::Initialised); mFlags.set(Flag::Initialised);
} }
void BodyGroup::modifyMatrix(const sead::Matrix34f& matrix, int index) { void StaticCompoundRigidBodyGroup::modifyMatrix(const sead::Matrix34f& matrix, int index) {
if (mMatrices[index] == matrix) if (mMatrices[index] == matrix)
return; return;

View File

@ -18,13 +18,13 @@ enum class BodyLayerType;
class RigidBody; class RigidBody;
class StaticCompound; class StaticCompound;
class BodyGroup { class StaticCompoundRigidBodyGroup {
public: public:
BodyGroup(); StaticCompoundRigidBodyGroup();
~BodyGroup(); ~StaticCompoundRigidBodyGroup();
BodyGroup(const BodyGroup&) = delete; StaticCompoundRigidBodyGroup(const StaticCompoundRigidBodyGroup&) = delete;
auto operator=(const BodyGroup&) = delete; auto operator=(const StaticCompoundRigidBodyGroup&) = delete;
void init(const hkpPhysicsSystem& system, sead::Matrix34f* mtx, StaticCompound* sc, void init(const hkpPhysicsSystem& system, sead::Matrix34f* mtx, StaticCompound* sc,
sead::Heap* heap); sead::Heap* heap);
@ -62,6 +62,6 @@ private:
u32 _e0{}; u32 _e0{};
sead::Buffer<Unk1> _e8; sead::Buffer<Unk1> _e8;
}; };
KSYS_CHECK_SIZE_NX150(BodyGroup, 0xf8); KSYS_CHECK_SIZE_NX150(StaticCompoundRigidBodyGroup, 0xf8);
} // namespace ksys::phys } // namespace ksys::phys

View File

@ -12,7 +12,7 @@ class Object;
namespace ksys::phys { namespace ksys::phys {
class BodyGroup; class StaticCompoundRigidBodyGroup;
struct RigidBodyCollisionMasks; struct RigidBodyCollisionMasks;
// 0x0000007100fd0810 // 0x0000007100fd0810
@ -24,7 +24,7 @@ bool getMaterialMaskFromCollidable(RigidBodyCollisionMasks* p_masks, u32* p_coll
const hkpShape& shape, const u32* shape_key); const hkpShape& shape, const u32* shape_key);
// 0x0000007100fd09d0 // 0x0000007100fd09d0
void getBodyGroupAndObjectFromSCShape(BodyGroup** p_body_group, map::Object** p_object, void getBodyGroupAndObjectFromSCShape(StaticCompoundRigidBodyGroup** p_body_group, map::Object** p_object,
const hkpShape& shape, const u32* shape_key); const hkpShape& shape, const u32* shape_key);
// 0x0000007100fd0a1c // 0x0000007100fd0a1c

View File

@ -23,7 +23,7 @@ class Object;
namespace ksys::phys { namespace ksys::phys {
struct ActorInfo; struct ActorInfo;
class BodyGroup; class StaticCompoundRigidBodyGroup;
class LayerMaskBuilder; class LayerMaskBuilder;
class Phantom; class Phantom;
class RigidBody; class RigidBody;
@ -117,7 +117,7 @@ protected:
const hkpCollidable* mHitCollidable; const hkpCollidable* mHitCollidable;
u32 mHitShapeKey; u32 mHitShapeKey;
bool mHasHitSpecifiedRigidBody; bool mHasHitSpecifiedRigidBody;
BodyGroup* mHitBodyGroup{}; StaticCompoundRigidBodyGroup* mHitBodyGroup{};
map::Object* mHitMapObject; map::Object* mHitMapObject;
sead::SafeArray<sead::BitFlag32, NumContactLayerTypes> mLayerMasks{}; sead::SafeArray<sead::BitFlag32, NumContactLayerTypes> mLayerMasks{};
sead::Atomic<u32> _70; sead::Atomic<u32> _70;