ksys/phys: Finish RigidBodyParam (add createEntityShapeBody)

This commit is contained in:
Léo Lam 2022-02-13 18:58:34 +01:00
parent db72086c68
commit 3512b78627
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
3 changed files with 26 additions and 3 deletions

View File

@ -83335,7 +83335,7 @@ Address,Quality,Size,Name
0x0000007100f9ff60,O,000344,_ZN4ksys4phys14RigidBodyParam5parseERKN3agl3utl16ResParameterListEPN4sead4HeapE
0x0000007100fa00b8,O,003684,_ZNK4ksys4phys14RigidBodyParam15createRigidBodyEPNS0_18SystemGroupHandlerEPN4sead4HeapENS1_29CreateFixedBoxWithNoCollisionE
0x0000007100fa0f1c,O,000308,_ZNK4ksys4phys14RigidBodyParam17makeInstanceParamEPNS0_22RigidBodyInstanceParamE
0x0000007100fa1050,U,000296,ksys::phys::RigidBodyParam::createEntityShape
0x0000007100fa1050,O,000296,_ZNK4ksys4phys14RigidBodyParam21createEntityShapeBodyEPNS0_9RigidBodyEPNS0_18SystemGroupHandlerEPN4sead4HeapE
0x0000007100fa1178,O,000028,_ZNK4ksys4phys14RigidBodyParam15getContactLayerEv
0x0000007100fa1194,O,000028,_ZNK4ksys4phys14RigidBodyParam12getGroundHitEv
0x0000007100fa11b0,O,000008,_ZNK4ksys4phys14RigidBodyParam13getMotionTypeEv

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

View File

@ -302,6 +302,28 @@ RigidBodyParam::createRigidBody(SystemGroupHandler* group_handler, sead::Heap* h
return list_body;
}
RigidBody* RigidBodyParam::createEntityShapeBody(RigidBody* linked_body,
SystemGroupHandler* group_handler,
sead::Heap* heap) const {
auto* linked_shape_body = sead::DynamicCast<RigidBodyFromShape>(linked_body);
if (!linked_shape_body)
return nullptr;
auto* body = RigidBodyFromShape::createEntityShapeBody(*info.rigid_body_name, getContactLayer(),
linked_shape_body, heap, group_handler);
if (!body)
return nullptr;
body->setUpdateRequestedFlag();
body->setMaxLinearVelocity(*info.max_linear_velocity);
body->setMaxAngularVelocity(*info.max_angular_velocity_rad);
body->setCenterOfMassInLocal(*info.center_of_mass);
body->updateCollidableQualityType(*info.toi);
body->processUpdateRequests();
return body;
}
ContactLayer RigidBodyParam::getContactLayer() const {
return contactLayerFromText(*info.layer);
}

View File

@ -168,8 +168,9 @@ struct RigidBodyParam : agl::utl::ParameterList {
SystemGroupHandler* group_handler, sead::Heap* heap,
CreateFixedBoxWithNoCollision no_collision = CreateFixedBoxWithNoCollision::No) const;
// TODO: types and names
void* createEntityShape(void* x, void* y, sead::Heap* heap);
/// @param linked_body Must be a RigidBodyFromShape.
RigidBody* createEntityShapeBody(RigidBody* linked_body, SystemGroupHandler* group_handler,
sead::Heap* heap) const;
ContactLayer getContactLayer() const;
GroundHit getGroundHit() const;