summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/System
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2022-12-18 18:35:29 +0100
committerLéo Lam <leo@leolam.fr>2022-12-19 00:07:21 +0100
commitbdd2015a088f6331e809aad6a65ca8d239b5cae9 (patch)
treed113f3b9b5a9ad683be533aa05d392a272573116 /src/KingSystem/Physics/System
parent20be3a197a8296b0e3d7f07f87c2bc6d526aa203 (diff)
ksys/phys: Implement more RagdollController functions
Diffstat (limited to 'src/KingSystem/Physics/System')
-rw-r--r--src/KingSystem/Physics/System/physEntityGroupFilter.cpp4
-rw-r--r--src/KingSystem/Physics/System/physEntityGroupFilter.h16
-rw-r--r--src/KingSystem/Physics/System/physInstanceSet.cpp6
3 files changed, 14 insertions, 12 deletions
diff --git a/src/KingSystem/Physics/System/physEntityGroupFilter.cpp b/src/KingSystem/Physics/System/physEntityGroupFilter.cpp
index 8b20d914..fd3637ed 100644
--- a/src/KingSystem/Physics/System/physEntityGroupFilter.cpp
+++ b/src/KingSystem/Physics/System/physEntityGroupFilter.cpp
@@ -123,8 +123,8 @@ hkBool EntityGroupFilter::testCollisionForEntities(u32 infoA, u32 infoB) const {
return false;
}
} else if ((infoA & GroupHandlerIdxMask) >> GroupHandlerIdxShift != 0) {
- if (a.regular.ragdoll_bone_index == b.regular.ragdoll_bone_index2 ||
- b.regular.ragdoll_bone_index == a.regular.ragdoll_bone_index2)
+ if (a.regular.ragdoll_bone_index == b.regular.ragdoll_parent_bone_index ||
+ b.regular.ragdoll_bone_index == a.regular.ragdoll_parent_bone_index)
return false;
}
return true;
diff --git a/src/KingSystem/Physics/System/physEntityGroupFilter.h b/src/KingSystem/Physics/System/physEntityGroupFilter.h
index fb1989c3..70a1fa23 100644
--- a/src/KingSystem/Physics/System/physEntityGroupFilter.h
+++ b/src/KingSystem/Physics/System/physEntityGroupFilter.h
@@ -52,8 +52,8 @@ public:
void setLayerCustomMask(ContactLayer layer, u32 mask) override;
u32 getCollisionFilterInfoGroupHandlerIdx(u32 info) override;
- virtual u32 makeCollisionFilterInfo(ContactLayer layer, GroundHit ground_hit, u32 unk5,
- u32 unk10);
+ virtual u32 makeRagdollCollisionFilterInfo(ContactLayer layer, GroundHit ground_hit,
+ u32 bone_index, u32 parent_bone_index);
/// @param layer An entity layer
virtual void setEntityLayerCollisionEnabledMask(ContactLayer layer, u32 mask);
@@ -111,7 +111,8 @@ inline u32 EntitySystemGroupHandler::makeCollisionFilterInfo(u32 info, ContactLa
if (layer == ContactLayer::EntityRagdoll) {
result.regular.layer.Init(layer);
result.regular.ragdoll_bone_index.Init(current_info.regular.ragdoll_bone_index);
- result.regular.ragdoll_bone_index2.Init(current_info.regular.ragdoll_bone_index2);
+ result.regular.ragdoll_parent_bone_index.Init(
+ current_info.regular.ragdoll_parent_bone_index);
result.regular.group_handler_index.Init(getIndex());
result.regular.ground_hit.Init(ground_hit);
result.is_ragdoll = true;
@@ -196,12 +197,13 @@ inline u32 EntityGroupFilter::getCollisionFilterInfoGroupHandlerIdx(u32 info) {
return EntityCollisionMask(info).regular.group_handler_index;
}
-inline u32 EntityGroupFilter::makeCollisionFilterInfo(ContactLayer layer, GroundHit ground_hit,
- u32 unk5, u32 unk10) {
+inline u32 EntityGroupFilter::makeRagdollCollisionFilterInfo(ContactLayer layer,
+ GroundHit ground_hit, u32 bone_index,
+ u32 parent_bone_index) {
EntityCollisionMask info;
info.regular.layer.Init(layer);
- info.regular.ragdoll_bone_index.Init(unk5);
- info.regular.ragdoll_bone_index2.Init(unk10);
+ info.regular.ragdoll_bone_index.Init(bone_index);
+ info.regular.ragdoll_parent_bone_index.Init(parent_bone_index);
info.regular.ground_hit.Init(ground_hit);
info.is_ragdoll = true;
return info.raw;
diff --git a/src/KingSystem/Physics/System/physInstanceSet.cpp b/src/KingSystem/Physics/System/physInstanceSet.cpp
index df7bcfa4..872cd713 100644
--- a/src/KingSystem/Physics/System/physInstanceSet.cpp
+++ b/src/KingSystem/Physics/System/physInstanceSet.cpp
@@ -104,10 +104,10 @@ void InstanceSet::sub_7100FBACE0(phys::ContactLayer layer) {
return;
if (mRagdollController != nullptr)
- mRagdollController->sub_7101221728(layer);
+ mRagdollController->disableContactLayer(layer);
if (mCharacterController != nullptr)
- mCharacterController->enableCollisionMaybe_0(layer);
+ mCharacterController->disableContactLayer(layer);
}
void InstanceSet::sub_7100FBAD74() {
@@ -115,7 +115,7 @@ void InstanceSet::sub_7100FBAD74() {
rb.disableAllContactLayers();
}
if (mRagdollController != nullptr) {
- mRagdollController->sub_71012217A8();
+ mRagdollController->setContactNone();
}
if (mCharacterController != nullptr) {
mCharacterController->sub_7100F60604();