From a86fb2a9ed3ba912c9399fcb3a494554be372c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Wed, 23 Mar 2022 00:51:35 +0100 Subject: [PATCH] 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). --- src/KingSystem/ActorSystem/actActor.h | 4 ++-- src/KingSystem/Map/mapPlacementMap.cpp | 2 +- src/KingSystem/Map/mapPlacementMap.h | 2 +- src/KingSystem/Physics/CMakeLists.txt | 4 ++-- .../Physics/StaticCompound/physStaticCompound.cpp | 6 +++--- .../Physics/StaticCompound/physStaticCompound.h | 8 ++++---- ...roup.cpp => physStaticCompoundRigidBodyGroup.cpp} | 10 +++++----- ...odyGroup.h => physStaticCompoundRigidBodyGroup.h} | 12 ++++++------ .../Physics/StaticCompound/physStaticCompoundUtil.h | 4 ++-- src/KingSystem/Physics/System/physRayCast.h | 4 ++-- 10 files changed, 28 insertions(+), 28 deletions(-) rename src/KingSystem/Physics/StaticCompound/{physStaticCompoundBodyGroup.cpp => physStaticCompoundRigidBodyGroup.cpp} (89%) rename src/KingSystem/Physics/StaticCompound/{physStaticCompoundBodyGroup.h => physStaticCompoundRigidBodyGroup.h} (83%) diff --git a/src/KingSystem/ActorSystem/actActor.h b/src/KingSystem/ActorSystem/actActor.h index 97350562..4868e101 100644 --- a/src/KingSystem/ActorSystem/actActor.h +++ b/src/KingSystem/ActorSystem/actActor.h @@ -39,7 +39,7 @@ class UMii; } // namespace mii namespace phys { -class BodyGroup; +class StaticCompoundRigidBodyGroup; class Physics; class Reaction; class RigidBody; @@ -390,7 +390,7 @@ protected: /* 0x580 */ PhysicsConstraints mConstraints; /* 0x598 */ void* _598 = nullptr; /* 0x5a0 */ BoneControl* mBoneControl = nullptr; - /* 0x5a8 */ phys::BodyGroup* mFieldBodyGroup = nullptr; + /* 0x5a8 */ phys::StaticCompoundRigidBodyGroup* mFieldBodyGroup = nullptr; /* 0x5b0 */ void* _5b0 = nullptr; /* 0x5b8 */ sead::Heap* mDualHeap = nullptr; // TODO: rename /* 0x5c0 */ sead::Heap* mDualHeap2 = nullptr; // TODO: rename diff --git a/src/KingSystem/Map/mapPlacementMap.cpp b/src/KingSystem/Map/mapPlacementMap.cpp index ad4cfeef..26dfbd0f 100644 --- a/src/KingSystem/Map/mapPlacementMap.cpp +++ b/src/KingSystem/Map/mapPlacementMap.cpp @@ -354,7 +354,7 @@ void PlacementMap::unload() { mDynamicMubinRes.requestUnload(); } -phys::BodyGroup* PlacementMap::getFieldBodyGroup(int field_group_idx) { +phys::StaticCompoundRigidBodyGroup* PlacementMap::getFieldBodyGroup(int field_group_idx) { const auto lock = sead::makeScopedLock(mCs); auto* r = mRes[0].mRes.getResource(); diff --git a/src/KingSystem/Map/mapPlacementMap.h b/src/KingSystem/Map/mapPlacementMap.h index 7e563654..219a82b1 100644 --- a/src/KingSystem/Map/mapPlacementMap.h +++ b/src/KingSystem/Map/mapPlacementMap.h @@ -88,7 +88,7 @@ private: void x_5(); 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(); bool loadStaticCompound(int hksc_idx, bool is_auto_gen_mu, bool req_arg_8); MapObjStatus x_2(int hksc_idx); diff --git a/src/KingSystem/Physics/CMakeLists.txt b/src/KingSystem/Physics/CMakeLists.txt index a9a37fb2..228071cc 100644 --- a/src/KingSystem/Physics/CMakeLists.txt +++ b/src/KingSystem/Physics/CMakeLists.txt @@ -92,12 +92,12 @@ target_sources(uking PRIVATE StaticCompound/physStaticCompound.cpp StaticCompound/physStaticCompound.h StaticCompound/physStaticCompoundAutogen.cpp - StaticCompound/physStaticCompoundBodyGroup.cpp - StaticCompound/physStaticCompoundBodyGroup.h StaticCompound/physStaticCompoundInfo.cpp StaticCompound/physStaticCompoundInfo.h StaticCompound/physStaticCompoundMgr.cpp StaticCompound/physStaticCompoundMgr.h + StaticCompound/physStaticCompoundRigidBodyGroup.cpp + StaticCompound/physStaticCompoundRigidBodyGroup.h StaticCompound/physStaticCompoundUtil.cpp StaticCompound/physStaticCompoundUtil.h diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompound.cpp b/src/KingSystem/Physics/StaticCompound/physStaticCompound.cpp index ea20e2df..1bf1ae18 100644 --- a/src/KingSystem/Physics/StaticCompound/physStaticCompound.cpp +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompound.cpp @@ -2,7 +2,7 @@ #include #include #include -#include "KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.h" +#include "KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h" #include "KingSystem/Physics/StaticCompound/physStaticCompoundInfo.h" #include "KingSystem/Utils/Debug.h" #include "KingSystem/Utils/HeapUtil.h" @@ -98,11 +98,11 @@ bool StaticCompound::disableCollision(int actor_idx, bool x) { return true; } -BodyGroup* StaticCompound::getFieldBodyGroup(int idx) { +StaticCompoundRigidBodyGroup* StaticCompound::getFieldBodyGroup(int 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) { if (&mFieldBodyGroups[i] == group) return true; diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompound.h b/src/KingSystem/Physics/StaticCompound/physStaticCompound.h index 18129f00..fc06f8fa 100644 --- a/src/KingSystem/Physics/StaticCompound/physStaticCompound.h +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompound.h @@ -17,7 +17,7 @@ class Object; namespace ksys::phys { struct ActorInfo; -class BodyGroup; +class StaticCompoundRigidBodyGroup; struct StaticCompoundInfo; class StaticCompound : public res::Resource, public sead::hostio::Node { @@ -32,8 +32,8 @@ public: bool disableCollision(int actor_idx, bool x); - BodyGroup* getFieldBodyGroup(int idx); - bool hasFieldBodyGroup(BodyGroup* group) const; + StaticCompoundRigidBodyGroup* getFieldBodyGroup(int idx); + bool hasFieldBodyGroup(StaticCompoundRigidBodyGroup* group) const; // res::Resource interface void doCreate_(u8* buffer, u32 buffer_size, sead::Heap* parent_heap) override; @@ -60,7 +60,7 @@ private: int mBufferSize{}; void* mContainerBuffer{}; int mContainerBufferSize{}; - sead::Buffer mFieldBodyGroups; + sead::Buffer mFieldBodyGroups; sead::FixedSafeString<32> mName; sead::Matrix34f mMtx = sead::Matrix34f::ident; sead::Buffer mMapObjects{}; diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.cpp b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.cpp similarity index 89% rename from src/KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.cpp rename to src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.cpp index 3a95859d..756ebaae 100644 --- a/src/KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.cpp +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.cpp @@ -1,4 +1,4 @@ -#include "KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.h" +#include "KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h" #include #include #include "KingSystem/Physics/RigidBody/physRigidBodyFromResource.h" @@ -12,9 +12,9 @@ namespace ksys::phys { // TODO: rename constexpr int BodyGroupNumMatrices = 8; -BodyGroup::BodyGroup() = default; +StaticCompoundRigidBodyGroup::StaticCompoundRigidBodyGroup() = default; -BodyGroup::~BodyGroup() { +StaticCompoundRigidBodyGroup::~StaticCompoundRigidBodyGroup() { mFlags.reset(Flag::Initialised); for (int i = 0, n = mRigidBodiesPerBodyLayerType.size(); i < n; ++i) { @@ -29,7 +29,7 @@ BodyGroup::~BodyGroup() { 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) { mStaticCompound = sc; mMtxPtr = mtx; @@ -92,7 +92,7 @@ void BodyGroup::init(const hkpPhysicsSystem& system, sead::Matrix34f* mtx, Stati 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) return; diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.h b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h similarity index 83% rename from src/KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.h rename to src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h index f6be6605..896f83a5 100644 --- a/src/KingSystem/Physics/StaticCompound/physStaticCompoundBodyGroup.h +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompoundRigidBodyGroup.h @@ -18,13 +18,13 @@ enum class BodyLayerType; class RigidBody; class StaticCompound; -class BodyGroup { +class StaticCompoundRigidBodyGroup { public: - BodyGroup(); - ~BodyGroup(); + StaticCompoundRigidBodyGroup(); + ~StaticCompoundRigidBodyGroup(); - BodyGroup(const BodyGroup&) = delete; - auto operator=(const BodyGroup&) = delete; + StaticCompoundRigidBodyGroup(const StaticCompoundRigidBodyGroup&) = delete; + auto operator=(const StaticCompoundRigidBodyGroup&) = delete; void init(const hkpPhysicsSystem& system, sead::Matrix34f* mtx, StaticCompound* sc, sead::Heap* heap); @@ -62,6 +62,6 @@ private: u32 _e0{}; sead::Buffer _e8; }; -KSYS_CHECK_SIZE_NX150(BodyGroup, 0xf8); +KSYS_CHECK_SIZE_NX150(StaticCompoundRigidBodyGroup, 0xf8); } // namespace ksys::phys diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompoundUtil.h b/src/KingSystem/Physics/StaticCompound/physStaticCompoundUtil.h index 0aef6607..70aa5243 100644 --- a/src/KingSystem/Physics/StaticCompound/physStaticCompoundUtil.h +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompoundUtil.h @@ -12,7 +12,7 @@ class Object; namespace ksys::phys { -class BodyGroup; +class StaticCompoundRigidBodyGroup; struct RigidBodyCollisionMasks; // 0x0000007100fd0810 @@ -24,7 +24,7 @@ bool getMaterialMaskFromCollidable(RigidBodyCollisionMasks* p_masks, u32* p_coll const hkpShape& shape, const u32* shape_key); // 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); // 0x0000007100fd0a1c diff --git a/src/KingSystem/Physics/System/physRayCast.h b/src/KingSystem/Physics/System/physRayCast.h index 2557e957..0f783542 100644 --- a/src/KingSystem/Physics/System/physRayCast.h +++ b/src/KingSystem/Physics/System/physRayCast.h @@ -23,7 +23,7 @@ class Object; namespace ksys::phys { struct ActorInfo; -class BodyGroup; +class StaticCompoundRigidBodyGroup; class LayerMaskBuilder; class Phantom; class RigidBody; @@ -117,7 +117,7 @@ protected: const hkpCollidable* mHitCollidable; u32 mHitShapeKey; bool mHasHitSpecifiedRigidBody; - BodyGroup* mHitBodyGroup{}; + StaticCompoundRigidBodyGroup* mHitBodyGroup{}; map::Object* mHitMapObject; sead::SafeArray mLayerMasks{}; sead::Atomic _70;