diff --git a/data/uking_functions.csv b/data/uking_functions.csv index d6c42f18..86c9a4c4 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -84310,8 +84310,8 @@ Address,Quality,Size,Name 0x0000007100fcfc0c,O,000168,_ZN4ksys4phys20RigidContactPointsEx10freePointsEv 0x0000007100fcfcb4,O,000260,_ZNK4ksys4phys20RigidContactPointsEx8Iterator7getDataEPN4sead7Vector3IfEENS2_4ModeE 0x0000007100fcfdb8,O,000048,_ZNK4ksys4phys20RigidContactPointsEx8Iterator7getDataENS2_4ModeE -0x0000007100fcfde8,O,000068,_ZN4ksys4phys20RigidContactPointsEx8IteratorC1ERKN4sead6BufferIPNS1_5PointEEEi -0x0000007100fcfe2c,O,000028,_ZN4ksys4phys20RigidContactPointsEx11IteratorEndC1ERKN4sead6BufferIPNS1_5PointEEEi +0x0000007100fcfde8,O,000068,_ZN4ksys4phys20RigidContactPointsEx8IteratorC1ERKN4sead6BufferIPNS0_12ContactPointEEEi +0x0000007100fcfe2c,O,000028,_ZN4ksys4phys20RigidContactPointsEx11IteratorEndC1ERKN4sead6BufferIPNS0_12ContactPointEEEi 0x0000007100fcfe48,U,000112, 0x0000007100fcfeb8,U,000072, 0x0000007100fcff00,U,000692, diff --git a/src/KingSystem/Physics/System/physContactMgr.h b/src/KingSystem/Physics/System/physContactMgr.h index 3420f882..b96e46a2 100644 --- a/src/KingSystem/Physics/System/physContactMgr.h +++ b/src/KingSystem/Physics/System/physContactMgr.h @@ -13,6 +13,7 @@ #include #include #include "KingSystem/Physics/System/physDefines.h" +#include "KingSystem/Utils/Types.h" namespace sead { class Heap; @@ -42,6 +43,29 @@ struct ContactInfoTable { sead::Buffer receivers; }; +// XXX: what exactly is this? Is this really a contact point? +struct ContactPoint { + enum class Flag { + _1 = 1 << 0, + _2 = 1 << 1, + }; + + void* _0; + void* _8; + sead::Vector3f _10; + sead::Vector3f _1c; + float scale; + void* _30; + void* _38; + void* _40; + void* _48; + void* _50; + void* _58; + void* _60; + sead::TypedBitFlag flags; +}; +KSYS_CHECK_SIZE_NX150(ContactPoint, 0x70); + class ContactMgr : public sead::hostio::Node { public: ContactMgr(); diff --git a/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp b/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp index 98aabe5f..58a6a925 100644 --- a/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp +++ b/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp @@ -1,4 +1,5 @@ #include "KingSystem/Physics/System/physRigidContactPointsEx.h" +#include "KingSystem/Physics/System/physContactMgr.h" #include "KingSystem/Physics/System/physMemSystem.h" namespace ksys::phys { @@ -66,14 +67,14 @@ void RigidContactPointsEx::Iterator::getData(sead::Vector3f* out, switch (mode) { case Mode::_0: { - if (getPoint()->flags.isOn(Point::Flag::_2)) + if (getPoint()->flags.isOn(ContactPoint::Flag::_2)) return; *out += getPoint()->_1c * -scale; break; } case Mode::_1: { - if (!getPoint()->flags.isOn(Point::Flag::_2)) + if (!getPoint()->flags.isOn(ContactPoint::Flag::_2)) return; *out += getPoint()->_1c * scale; break; @@ -97,7 +98,7 @@ RigidContactPointsEx::Iterator::getData(RigidContactPointsEx::Iterator::Mode mod RigidContactPointsEx::Iterator::Iterator(const RigidContactPointsEx::Points& points, int count) : mPoints(points.getBufferPtr()), mPointsNum(count), mPointsStart(points.getBufferPtr()) { for (int i = 0; i != count; ++i) { - if (!mPoints[i]->flags.isOn(Point::Flag::_1)) + if (!mPoints[i]->flags.isOn(ContactPoint::Flag::_1)) break; ++mIdx; } diff --git a/src/KingSystem/Physics/System/physRigidContactPointsEx.h b/src/KingSystem/Physics/System/physRigidContactPointsEx.h index 1fd53db2..e581699e 100644 --- a/src/KingSystem/Physics/System/physRigidContactPointsEx.h +++ b/src/KingSystem/Physics/System/physRigidContactPointsEx.h @@ -9,32 +9,12 @@ namespace ksys::phys { +struct ContactPoint; + // FIXME: rename. This should be below SensorGroupFilter and StaticCompound stuff class RigidContactPointsEx : public IRigidContactPoints { public: - struct Point { - enum class Flag { - _1 = 1 << 0, - _2 = 1 << 1, - }; - - void* _0; - void* _8; - sead::Vector3f _10; - sead::Vector3f _1c; - float scale; - void* _30; - void* _38; - void* _40; - void* _48; - void* _50; - void* _58; - void* _60; - sead::TypedBitFlag flags; - }; - KSYS_CHECK_SIZE_NX150(Point, 0x70); - - using Points = sead::Buffer; + using Points = sead::Buffer; class IteratorEnd; @@ -57,8 +37,8 @@ public: void getData(sead::Vector3f* out, Mode mode) const; sead::Vector3f getData(Mode mode) const; - const Point* getPoint() const { return mPoints[mIdx]; } - const Point* operator*() const { return getPoint(); } + const ContactPoint* getPoint() const { return mPoints[mIdx]; } + const ContactPoint* operator*() const { return getPoint(); } friend bool operator==(const Iterator& lhs, const Iterator& rhs) { return lhs.mIdx == rhs.mIdx; @@ -71,9 +51,9 @@ public: friend class IteratorEnd; int mIdx = 0; - const Point* const* mPoints = nullptr; + const ContactPoint* const* mPoints = nullptr; int mPointsNum = 0; - const Point* const* mPointsStart = nullptr; + const ContactPoint* const* mPointsStart = nullptr; }; class IteratorEnd { @@ -95,9 +75,9 @@ public: private: int mIdx = 0; - const Point* const* mPoints = nullptr; + const ContactPoint* const* mPoints = nullptr; int mPointsNum = 0; - const Point* const* mPointsStart = nullptr; + const ContactPoint* const* mPointsStart = nullptr; }; static RigidContactPointsEx* make(sead::Heap* heap, int num, int num2,