ksys/phys: Rename RigidBody/UserTag broadphase border callbacks

This commit is contained in:
Léo Lam 2022-01-29 12:36:59 +01:00
parent 10d3f129b0
commit 61201ca54b
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
6 changed files with 21 additions and 10 deletions

View File

@ -83127,7 +83127,7 @@ Address,Quality,Size,Name
0x0000007100f964dc,O,000148,_ZNK4ksys4phys9RigidBody25getMagneMassScalingFactorEv
0x0000007100f96570,O,000008,_ZN4ksys4phys9RigidBody11getNewShapeEv
0x0000007100f96578,O,000008,_ZN4ksys4phys9RigidBody3m11Ev
0x0000007100f96580,O,000240,_ZN4ksys4phys9RigidBody13resetPositionEv
0x0000007100f96580,O,000240,_ZN4ksys4phys9RigidBody21onMaxPositionExceededEv
0x0000007100f96670,O,000144,_ZN4ksys4phys9RigidBody7getNameEv
0x0000007100f96700,O,000068,_ZNK4ksys4phys9RigidBody11logPositionEv
0x0000007100f96744,O,000176,_ZNK4ksys4phys9RigidBody14getAabbInLocalEPN4sead9BoundBox3IfEE
@ -84271,7 +84271,7 @@ Address,Quality,Size,Name
0x0000007100fcd5cc,U,000380,
0x0000007100fcd748,U,000036,
0x0000007100fcd76c,U,000052,
0x0000007100fcd7a0,U,000016,phys::UserTag::m2
0x0000007100fcd7a0,O,000016,_ZN4ksys4phys7UserTag21onMaxPositionExceededEPNS0_9RigidBodyE
0x0000007100fcd7b0,U,000020,phys::UserTag::m3
0x0000007100fcd7c4,U,000004,phys::UserTag::m4n
0x0000007100fcd7c8,U,000004,phys::UserTag::m5n

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

View File

@ -18,7 +18,7 @@ public:
Actor* getActor(ActorLinkConstDataAccess* accessor, Actor* other_actor) const;
bool acquireActor(ActorLinkConstDataAccess* accessor) const;
void m2(void* a) override;
void onMaxPositionExceeded(phys::RigidBody* body) override;
void m3(void* a, void* b, float c) override;
void onBodyShapeChanged(phys::RigidBody* body) override;
void m5() override;

View File

@ -1746,7 +1746,7 @@ void* RigidBody::m11() {
return nullptr;
}
void RigidBody::resetPosition() {
void RigidBody::onMaxPositionExceeded() {
// debug logging?
[[maybe_unused]] sead::Vector3f position = getPosition();
setPosition(sead::Vector3f::zero, true);

View File

@ -456,7 +456,7 @@ public:
void setMotionFlag(MotionFlag flag);
hkpRigidBody* getHkBody() const { return mHkBody; }
UserTag* getUserTag() const { return mUserTag; }
Type getType() const { return mType; }
bool isCharacterControllerType() const { return mType == Type::CharacterController; }
@ -498,7 +498,16 @@ public:
virtual const hkpShape* getNewShape();
virtual void* m11();
virtual float m12(float x, float y);
virtual void resetPosition();
/// Called when the rigid body goes beyond the broadphase border.
///
/// Note: this is not guaranteed to be called if we have a user tag.
/// The tag may choose not to invoke this callback.
///
/// The default implementation just resets the position to the origin.
virtual void onMaxPositionExceeded();
/// Get the name of this rigid body or its user.
virtual const char* getName();
// Internal.

View File

@ -1,9 +1,10 @@
#include "KingSystem/Physics/System/physUserTag.h"
#include "KingSystem/Physics/RigidBody/physRigidBody.h"
namespace ksys::phys {
void UserTag::m2(void* a) {
// FIXME
void UserTag::onMaxPositionExceeded(RigidBody* body) {
body->onMaxPositionExceeded();
}
void UserTag::m3(void* a, void* b, float c) {

View File

@ -13,8 +13,9 @@ class UserTag {
public:
UserTag() = default;
// FIXME: names and types
virtual void m2(void* a);
/// Called when a rigid body goes beyond the broadphase border.
/// The default implementation just notifies the rigid body of this callback.
virtual void onMaxPositionExceeded(RigidBody* body);
// a and b are probably physics bodies?
virtual void m3(void* a, void* b, float c);
virtual void onBodyShapeChanged(RigidBody* body);