mirror of https://github.com/zeldaret/botw.git
ksys/phys: Add RigidBodySet
This commit is contained in:
parent
70d6ec2ae7
commit
d9eeeb6ecc
|
@ -82976,7 +82976,7 @@ Address,Quality,Size,Name
|
|||
0x0000007100f8d1f8,O,000012,_ZNK4ksys4phys9RigidBody10isFlag8SetEv
|
||||
0x0000007100f8d204,O,000012,_ZNK4ksys4phys9RigidBody16isMotionFlag1SetEv
|
||||
0x0000007100f8d210,O,000012,_ZNK4ksys4phys9RigidBody16isMotionFlag2SetEv
|
||||
0x0000007100f8d21c,O,000236,_ZN4ksys4phys9RigidBody14sub_7100F8D21CEv
|
||||
0x0000007100f8d21c,O,000236,_ZN4ksys4phys9RigidBody27addOrRemoveRigidBodyToWorldEv
|
||||
0x0000007100f8d308,O,000888,_ZN4ksys4phys9RigidBody3x_6Ev
|
||||
0x0000007100f8d680,O,000140,_ZNK4ksys4phys9RigidBody23getEntityMotionAccessorEv
|
||||
0x0000007100f8d70c,O,000156,_ZNK4ksys4phys9RigidBody18getLinkedRigidBodyEv
|
||||
|
@ -82997,8 +82997,8 @@ Address,Quality,Size,Name
|
|||
0x0000007100f8ee50,U,000048,phys::RigidBody::x_17
|
||||
0x0000007100f8ee80,O,000384,_ZN4ksys4phys9RigidBody27updateCollidableQualityTypeEb
|
||||
0x0000007100f8f000,O,000012,_ZNK4ksys4phys9RigidBody13getCollidableEv
|
||||
0x0000007100f8f00c,O,000080,_ZN4ksys4phys9RigidBody15addContactLayerENS0_12ContactLayerE
|
||||
0x0000007100f8f05c,O,000080,_ZN4ksys4phys9RigidBody18removeContactLayerENS0_12ContactLayerE
|
||||
0x0000007100f8f00c,O,000080,_ZN4ksys4phys9RigidBody18enableContactLayerENS0_12ContactLayerE
|
||||
0x0000007100f8f05c,O,000080,_ZN4ksys4phys9RigidBody19disableContactLayerENS0_12ContactLayerE
|
||||
0x0000007100f8f0ac,O,000008,_ZN4ksys4phys9RigidBody14setContactMaskEj
|
||||
0x0000007100f8f0b4,O,000012,_ZN4ksys4phys9RigidBody13setContactAllEv
|
||||
0x0000007100f8f0c0,O,000008,_ZN4ksys4phys9RigidBody14setContactNoneEv
|
||||
|
@ -83025,7 +83025,7 @@ Address,Quality,Size,Name
|
|||
0x0000007100f8fb08,O,000360,_ZN4ksys4phys9RigidBody12setTransformERKN4sead8Matrix34IfEEb
|
||||
0x0000007100f8fc70,O,000196,_ZN4ksys4phys9RigidBody11setPositionERKN4sead7Vector3IfEEb
|
||||
0x0000007100f8fd34,O,000012,_ZNK4ksys4phys9RigidBody16isTransformDirtyEv
|
||||
0x0000007100f8fd40,O,000124,_ZN4ksys4phys9RigidBody19updateShapeIfNeededEf
|
||||
0x0000007100f8fd40,O,000124,_ZN4ksys4phys9RigidBody8setScaleEf
|
||||
0x0000007100f8fdbc,O,000328,_ZN4ksys4phys9RigidBody11updateShapeEv
|
||||
0x0000007100f8ff04,O,000032,_ZNK4ksys4phys9RigidBody11getPositionEPN4sead7Vector3IfEE
|
||||
0x0000007100f8ff24,O,000076,_ZNK4ksys4phys9RigidBody11getPositionEv
|
||||
|
@ -83486,35 +83486,35 @@ Address,Quality,Size,Name
|
|||
0x0000007100fa8cc8,U,000076,
|
||||
0x0000007100fa8d14,U,000008,
|
||||
0x0000007100fa8d1c,U,000008,
|
||||
0x0000007100fa8d24,U,000044,phys::RigidBodySet::ctor
|
||||
0x0000007100fa8d50,U,000020,
|
||||
0x0000007100fa8d64,U,000004,j__ZdlPv_1000
|
||||
0x0000007100fa8d68,U,000080,
|
||||
0x0000007100fa8db8,U,000056,
|
||||
0x0000007100fa8df0,U,000180,phys::RigidBodyGroup::x_6
|
||||
0x0000007100fa8ea4,U,000180,phys::RigidBodyGroup::x_7
|
||||
0x0000007100fa8f58,U,000072,phys::RigidBodyGroup::x_8
|
||||
0x0000007100fa8fa0,U,000080,phys::RigidBodyGroup::x_9
|
||||
0x0000007100fa8ff0,U,000056,
|
||||
0x0000007100fa9028,U,000056,
|
||||
0x0000007100fa9060,U,000084,phys::RigidBodyGroup::x_3
|
||||
0x0000007100fa90b4,U,000328,phys::RigidBodyGroup::x_0
|
||||
0x0000007100fa91fc,U,000308,phys::RigidBodyGroup::x_1
|
||||
0x0000007100fa9330,U,000328,phys::RigidBodyGroup::x
|
||||
0x0000007100fa9478,U,000128,registerAttackSensorMaybe
|
||||
0x0000007100fa94f8,U,000128,
|
||||
0x0000007100fa9578,U,000112,
|
||||
0x0000007100fa95e8,U,000076,RigidBody::setMtx
|
||||
0x0000007100fa9634,U,000108,enableCollisionMaybe
|
||||
0x0000007100fa96a0,U,000108,disableCollisionMaybe
|
||||
0x0000007100fa970c,U,000056,
|
||||
0x0000007100fa9744,U,000112,
|
||||
0x0000007100fa97b4,U,000072,RigidBody::setScale
|
||||
0x0000007100fa97fc,U,000056,
|
||||
0x0000007100fa9834,U,000056,RigidBody::x
|
||||
0x0000007100fa986c,U,000084,
|
||||
0x0000007100fa98c0,U,000120,
|
||||
0x0000007100fa9938,U,000072,
|
||||
0x0000007100fa8d24,O,000044,_ZN4ksys4phys12RigidBodySetC1ERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100fa8d50,O,000020,_ZN4ksys4phys12RigidBodySetD1Ev
|
||||
0x0000007100fa8d64,O,000004,_ZN4ksys4phys12RigidBodySetD0Ev
|
||||
0x0000007100fa8d68,O,000080,_ZN4ksys4phys12RigidBodySet26setFixedAndPreserveImpulseEbb
|
||||
0x0000007100fa8db8,O,000056,_ZN4ksys4phys12RigidBodySet16resetFrozenStateEv
|
||||
0x0000007100fa8df0,O,000180,_ZN4ksys4phys12RigidBodySet22setUseSystemTimeFactorEb
|
||||
0x0000007100fa8ea4,O,000180,_ZN4ksys4phys12RigidBodySet15clearFlag400000Eb
|
||||
0x0000007100fa8f58,O,000072,_ZN4ksys4phys12RigidBodySet22setEntityMotionFlag200Eb
|
||||
0x0000007100fa8fa0,O,000080,_ZN4ksys4phys12RigidBodySet8setFixedEbb
|
||||
0x0000007100fa8ff0,O,000056,_ZN4ksys4phys12RigidBodySet28updateMotionTypeRelatedFlagsEv
|
||||
0x0000007100fa9028,O,000056,_ZN4ksys4phys12RigidBodySet32triggerScheduledMotionTypeChangeEv
|
||||
0x0000007100fa9060,O,000084,_ZNK4ksys4phys12RigidBodySet19hasActiveEntityBodyEv
|
||||
0x0000007100fa90b4,O,000328,_ZN4ksys4phys12RigidBodySet19findBodyByHavokNameERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100fa91fc,O,000308,_ZNK4ksys4phys12RigidBodySet24findBodyIndexByHavokNameERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100fa9330,O,000328,_ZNK4ksys4phys12RigidBodySet19findBodyByHavokNameERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100fa9478,O,000128,_ZN4ksys4phys12RigidBodySet10setUserTagEPNS0_7UserTagE
|
||||
0x0000007100fa94f8,O,000128,_ZN4ksys4phys12RigidBodySet21setSystemGroupHandlerEPNS0_18SystemGroupHandlerE
|
||||
0x0000007100fa9578,O,000112,_ZN4ksys4phys12RigidBodySet21setSystemGroupHandlerEPNS0_18SystemGroupHandlerENS0_16ContactLayerTypeE
|
||||
0x0000007100fa95e8,O,000076,_ZN4ksys4phys12RigidBodySet12setTransformERKN4sead8Matrix34IfEE
|
||||
0x0000007100fa9634,O,000108,_ZN4ksys4phys12RigidBodySet18enableContactLayerENS0_12ContactLayerE
|
||||
0x0000007100fa96a0,O,000108,_ZN4ksys4phys12RigidBodySet19disableContactLayerENS0_12ContactLayerE
|
||||
0x0000007100fa970c,O,000056,_ZN4ksys4phys12RigidBodySet23disableAllContactLayersEv
|
||||
0x0000007100fa9744,O,000112,_ZN4ksys4phys12RigidBodySet28setScaleAndUpdateImmediatelyEf
|
||||
0x0000007100fa97b4,O,000072,_ZN4ksys4phys12RigidBodySet8setScaleEf
|
||||
0x0000007100fa97fc,O,000056,_ZN4ksys4phys12RigidBodySet17callRigidBody_x_0Ev
|
||||
0x0000007100fa9834,O,000056,_ZN4ksys4phys12RigidBodySet29addOrRemoveRigidBodiesToWorldEv
|
||||
0x0000007100fa986c,O,000084,_ZN4ksys4phys12RigidBodySet23areAllTrueRigidBody_x_6Ev
|
||||
0x0000007100fa98c0,O,000120,_ZN4ksys4phys12RigidBodySet23hasNoRigidBodyWithFlag8Eb
|
||||
0x0000007100fa9938,O,000072,_ZN4ksys4phys12RigidBodySet17callRigidBody_x_7Eh
|
||||
0x0000007100fa9980,U,000004,j__ZN4ksys4phys16RigidBodyFactory12createSphereEPNS0_18RigidBodyParamViewEPN4sead4HeapE
|
||||
0x0000007100fa9984,U,000084,
|
||||
0x0000007100fa99d8,U,000088,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -33,6 +33,8 @@ target_sources(uking PRIVATE
|
|||
RigidBody/physRigidBodyRequestMgr.h
|
||||
RigidBody/physRigidBodyResource.cpp
|
||||
RigidBody/physRigidBodyResource.h
|
||||
RigidBody/physRigidBodySet.cpp
|
||||
RigidBody/physRigidBodySet.h
|
||||
RigidBody/physRigidBodySetParam.cpp
|
||||
RigidBody/physRigidBodySetParam.h
|
||||
RigidBody/Shape/physBoxShape.cpp
|
||||
|
|
|
@ -247,7 +247,7 @@ bool RigidBody::isMotionFlag2Set() const {
|
|||
return mMotionFlags.isOn(MotionFlag::_2);
|
||||
}
|
||||
|
||||
void RigidBody::sub_7100F8D21C() {
|
||||
void RigidBody::addOrRemoveRigidBodyToWorld() {
|
||||
// debug code that survived because mFlags is atomic?
|
||||
static_cast<void>(mFlags.getDirect());
|
||||
|
||||
|
@ -571,12 +571,12 @@ static int getLayerBit(int layer, ContactLayerType type) {
|
|||
return layer - FirstSensor * int(type);
|
||||
}
|
||||
|
||||
void RigidBody::addContactLayer(ContactLayer layer) {
|
||||
void RigidBody::enableContactLayer(ContactLayer layer) {
|
||||
assertLayerType(layer);
|
||||
mContactMask.setBit(getLayerBit(layer, getLayerType()));
|
||||
}
|
||||
|
||||
void RigidBody::removeContactLayer(ContactLayer layer) {
|
||||
void RigidBody::disableContactLayer(ContactLayer layer) {
|
||||
assertLayerType(layer);
|
||||
mContactMask.resetBit(getLayerBit(layer, getLayerType()));
|
||||
}
|
||||
|
@ -926,17 +926,17 @@ void RigidBody::updateShape() {
|
|||
mUserTag->onBodyShapeChanged(this);
|
||||
}
|
||||
|
||||
void RigidBody::updateShapeIfNeeded(float x) {
|
||||
void RigidBody::setScale(float scale) {
|
||||
if (!hasFlag(Flag::_10))
|
||||
return;
|
||||
|
||||
if (x <= 0.0)
|
||||
x = 1.0;
|
||||
if (scale <= 0.0)
|
||||
scale = 1.0;
|
||||
|
||||
if (sead::Mathf::equalsEpsilon(_b0, x))
|
||||
if (sead::Mathf::equalsEpsilon(mScale, scale))
|
||||
return;
|
||||
|
||||
_b0 = m12(x, _b0);
|
||||
mScale = m12(scale, mScale);
|
||||
updateShape();
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
bool isFlag8Set() const;
|
||||
bool isMotionFlag1Set() const;
|
||||
bool isMotionFlag2Set() const;
|
||||
void sub_7100F8D21C();
|
||||
void addOrRemoveRigidBodyToWorld();
|
||||
bool x_6();
|
||||
|
||||
/// Get the motion accessor if it is a RigidBodyMotionEntity. Returns nullptr otherwise.
|
||||
|
@ -191,8 +191,8 @@ public:
|
|||
|
||||
void updateCollidableQualityType(bool high_quality);
|
||||
|
||||
void addContactLayer(ContactLayer layer);
|
||||
void removeContactLayer(ContactLayer layer);
|
||||
void enableContactLayer(ContactLayer layer);
|
||||
void disableContactLayer(ContactLayer layer);
|
||||
void setContactMask(u32);
|
||||
void setContactAll();
|
||||
void setContactNone();
|
||||
|
@ -278,7 +278,7 @@ public:
|
|||
bool isTransformDirty() const;
|
||||
|
||||
void updateShape();
|
||||
void updateShapeIfNeeded(float x);
|
||||
void setScale(float scale);
|
||||
|
||||
void changeMotionType(MotionType motion_type);
|
||||
// 0x0000007100f9045c - calls a bunch of Havok world functions
|
||||
|
@ -459,10 +459,13 @@ 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; }
|
||||
|
||||
UserTag* getUserTag() const { return mUserTag; }
|
||||
void setUserTag(UserTag* tag) { mUserTag = tag; }
|
||||
|
||||
bool hasConstraintWithUserData();
|
||||
// 0x0000007100f94e80
|
||||
bool x_103(int a);
|
||||
|
@ -521,6 +524,13 @@ public:
|
|||
/// Get the name of this rigid body or its user.
|
||||
virtual const char* getName();
|
||||
|
||||
// Internal.
|
||||
void setUseSystemTimeFactor(bool use) { mFlags.change(Flag::UseSystemTimeFactor, use); }
|
||||
// Internal.
|
||||
void setFlag400000(bool set) { mFlags.change(Flag::_400000, set); }
|
||||
// Internal.
|
||||
void setUpdateRequestedFlag() { mFlags.set(Flag::UpdateRequested); }
|
||||
|
||||
// Internal.
|
||||
void onCollisionAdded() {
|
||||
if (mCollisionCount.increment() == 0)
|
||||
|
@ -551,7 +561,7 @@ private:
|
|||
void* _90 = nullptr;
|
||||
u16 _98 = 0;
|
||||
RigidBodyAccessor mRigidBodyAccessor;
|
||||
f32 _b0 = 1.0f;
|
||||
f32 mScale = 1.0f;
|
||||
Type mType{};
|
||||
MotionAccessor* mMotionAccessor = nullptr;
|
||||
sead::Atomic<int> mCollisionCount;
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
#include "KingSystem/Physics/RigidBody/physRigidBodySet.h"
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBody.h"
|
||||
#include "KingSystem/Physics/System/physGroupFilter.h"
|
||||
#include "KingSystem/Utils/Debug.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
RigidBodySet::RigidBodySet(const sead::SafeString& name) : mName(name) {}
|
||||
|
||||
RigidBodySet::~RigidBodySet() {
|
||||
util::PrintDebug("~RigidBodySet");
|
||||
}
|
||||
|
||||
void RigidBodySet::setFixedAndPreserveImpulse(bool fixed, bool mark_linear_vel_as_dirty) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setFixedAndPreserveImpulse(fixed, mark_linear_vel_as_dirty);
|
||||
}
|
||||
|
||||
void RigidBodySet::resetFrozenState() {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.resetFrozenState();
|
||||
}
|
||||
|
||||
void RigidBodySet::setUseSystemTimeFactor(bool use) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setUseSystemTimeFactor(use);
|
||||
}
|
||||
|
||||
void RigidBodySet::clearFlag400000(bool clear) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setFlag400000(!clear);
|
||||
}
|
||||
|
||||
void RigidBodySet::setEntityMotionFlag200(bool set) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setEntityMotionFlag200(set);
|
||||
}
|
||||
|
||||
void RigidBodySet::setFixed(bool fixed, bool preserve_velocities) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setFixed(fixed, preserve_velocities);
|
||||
}
|
||||
|
||||
void RigidBodySet::updateMotionTypeRelatedFlags() {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.updateMotionTypeRelatedFlags();
|
||||
}
|
||||
|
||||
void RigidBodySet::triggerScheduledMotionTypeChange() {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.triggerScheduledMotionTypeChange();
|
||||
}
|
||||
|
||||
bool RigidBodySet::hasActiveEntityBody() const {
|
||||
for (const auto& body : mRigidBodies) {
|
||||
if (body.isEntity() && body.isActive())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RigidBody* RigidBodySet::findBodyByHavokName(const sead::SafeString& name) {
|
||||
const int index = findBodyIndexByHavokName(name);
|
||||
if (index < 0)
|
||||
return nullptr;
|
||||
return mRigidBodies[index];
|
||||
}
|
||||
|
||||
const RigidBody* RigidBodySet::findBodyByHavokName(const sead::SafeString& name) const {
|
||||
const int index = findBodyIndexByHavokName(name);
|
||||
if (index < 0)
|
||||
return nullptr;
|
||||
return mRigidBodies[index];
|
||||
}
|
||||
|
||||
int RigidBodySet::findBodyIndexByHavokName(const sead::SafeString& name) const {
|
||||
int idx = 0;
|
||||
for (const auto& body : mRigidBodies) {
|
||||
if (name == body.getHkBodyName())
|
||||
return idx;
|
||||
++idx;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void RigidBodySet::setUserTag(UserTag* tag) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setUserTag(tag);
|
||||
}
|
||||
|
||||
void RigidBodySet::setSystemGroupHandler(SystemGroupHandler* handler) {
|
||||
for (auto& body : mRigidBodies) {
|
||||
if (handler == nullptr || handler->getLayerType() == body.getLayerType())
|
||||
body.setSystemGroupHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBodySet::setSystemGroupHandler(SystemGroupHandler* handler, ContactLayerType layer_type) {
|
||||
if (handler != nullptr && handler->getLayerType() != layer_type)
|
||||
return;
|
||||
|
||||
for (auto& body : mRigidBodies) {
|
||||
if (body.getLayerType() == layer_type)
|
||||
body.setSystemGroupHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBodySet::setTransform(const sead::Matrix34f& mtx) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setTransform(mtx, true);
|
||||
}
|
||||
|
||||
void RigidBodySet::enableContactLayer(ContactLayer layer) {
|
||||
const auto type = getContactLayerType(layer);
|
||||
for (auto& body : mRigidBodies) {
|
||||
if (body.getLayerType() == type)
|
||||
body.enableContactLayer(layer);
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBodySet::disableContactLayer(ContactLayer layer) {
|
||||
const auto type = getContactLayerType(layer);
|
||||
for (auto& body : mRigidBodies) {
|
||||
if (body.getLayerType() == type)
|
||||
body.disableContactLayer(layer);
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBodySet::disableAllContactLayers() {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setContactNone();
|
||||
}
|
||||
|
||||
void RigidBodySet::setScaleAndUpdateImmediately(float scale) {
|
||||
for (auto it = mRigidBodies.begin(), end = mRigidBodies.end(); it != end; ++it) {
|
||||
it->setUpdateRequestedFlag();
|
||||
it->setScale(scale);
|
||||
it->processUpdateRequests(nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBodySet::setScale(float scale) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setScale(scale);
|
||||
}
|
||||
|
||||
void RigidBodySet::callRigidBody_x_0() {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.x_0();
|
||||
}
|
||||
|
||||
void RigidBodySet::addOrRemoveRigidBodiesToWorld() {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.addOrRemoveRigidBodyToWorld();
|
||||
}
|
||||
|
||||
bool RigidBodySet::areAllTrueRigidBody_x_6() {
|
||||
bool ok = true;
|
||||
for (auto& body : mRigidBodies)
|
||||
ok &= body.x_6();
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RigidBodySet::hasNoRigidBodyWithFlag8(bool require_motion_flag_1_to_be_unset) {
|
||||
for (auto it = mRigidBodies.begin(), end = mRigidBodies.end(); it != end; ++it) {
|
||||
if (it->isFlag8Set())
|
||||
return false;
|
||||
if (require_motion_flag_1_to_be_unset && it->isMotionFlag1Set())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void RigidBodySet::callRigidBody_x_7(u8 type) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.x_17(type);
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
|
@ -0,0 +1,72 @@
|
|||
#pragma once
|
||||
|
||||
#include <container/seadPtrArray.h>
|
||||
#include <hostio/seadHostIONode.h>
|
||||
#include <math/seadMatrix.h>
|
||||
#include <prim/seadNamable.h>
|
||||
#include <prim/seadSafeString.h>
|
||||
#include "KingSystem/Physics/System/physDefines.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
class RigidBody;
|
||||
class SystemGroupHandler;
|
||||
class UserTag;
|
||||
|
||||
class RigidBodySet : public sead::hostio::Node {
|
||||
public:
|
||||
explicit RigidBodySet(const sead::SafeString& name);
|
||||
virtual ~RigidBodySet();
|
||||
|
||||
const sead::SafeString& getName() const { return mName; }
|
||||
|
||||
sead::PtrArray<RigidBody>& getRigidBodies() { return mRigidBodies; }
|
||||
const sead::PtrArray<RigidBody>& getRigidBodies() const { return mRigidBodies; }
|
||||
RigidBody* getRigidBody(int idx) const { return mRigidBodies[idx]; }
|
||||
|
||||
void setFixedAndPreserveImpulse(bool fixed, bool mark_linear_vel_as_dirty);
|
||||
void resetFrozenState();
|
||||
void setUseSystemTimeFactor(bool use);
|
||||
void clearFlag400000(bool clear);
|
||||
void setEntityMotionFlag200(bool set);
|
||||
void setFixed(bool fixed, bool preserve_velocities);
|
||||
|
||||
void updateMotionTypeRelatedFlags();
|
||||
void triggerScheduledMotionTypeChange();
|
||||
|
||||
bool hasActiveEntityBody() const;
|
||||
|
||||
RigidBody* findBodyByHavokName(const sead::SafeString& name);
|
||||
const RigidBody* findBodyByHavokName(const sead::SafeString& name) const;
|
||||
int findBodyIndexByHavokName(const sead::SafeString& name) const;
|
||||
|
||||
void setUserTag(UserTag* tag);
|
||||
|
||||
/// Set the specified handler for all rigid bodies whose type (entity/sensor) matches
|
||||
/// the layer type of the handler.
|
||||
void setSystemGroupHandler(SystemGroupHandler* handler);
|
||||
|
||||
/// Set the specified handler for all rigid bodies whose type (entity/sensor) matches
|
||||
/// both `layer_type` and the layer type of the handler.
|
||||
void setSystemGroupHandler(SystemGroupHandler* handler, ContactLayerType layer_type);
|
||||
|
||||
void setTransform(const sead::Matrix34f& mtx);
|
||||
|
||||
void enableContactLayer(ContactLayer layer);
|
||||
void disableContactLayer(ContactLayer layer);
|
||||
void disableAllContactLayers();
|
||||
|
||||
void setScaleAndUpdateImmediately(float scale);
|
||||
void setScale(float scale);
|
||||
void callRigidBody_x_0();
|
||||
void addOrRemoveRigidBodiesToWorld();
|
||||
bool areAllTrueRigidBody_x_6();
|
||||
bool hasNoRigidBodyWithFlag8(bool require_motion_flag_1_to_be_unset);
|
||||
void callRigidBody_x_7(u8 type);
|
||||
|
||||
private:
|
||||
sead::SafeString mName;
|
||||
sead::PtrArray<RigidBody> mRigidBodies;
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
|
@ -1,4 +1,5 @@
|
|||
#include "KingSystem/Physics/System/physInstanceSet.h"
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodySet.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
|
@ -77,7 +78,7 @@ u32 InstanceSet::sub_7100FB9C2C() const {
|
|||
|
||||
void InstanceSet::sub_7100FBA9BC() {
|
||||
for (auto& rb : mRigidBodySets) {
|
||||
rb.sub_7100FA97FC();
|
||||
rb.callRigidBody_x_0();
|
||||
}
|
||||
|
||||
for (auto& body : mList) {
|
||||
|
@ -92,7 +93,7 @@ void InstanceSet::sub_7100FBACE0(phys::ContactLayer layer) {
|
|||
bool sensor = phys::getContactLayerType(layer) != ContactLayerType::Entity;
|
||||
|
||||
for (auto& rb : mRigidBodySets) {
|
||||
rb.disableCollisionMaybe(layer);
|
||||
rb.disableContactLayer(layer);
|
||||
}
|
||||
if (sensor)
|
||||
return;
|
||||
|
@ -106,7 +107,7 @@ void InstanceSet::sub_7100FBACE0(phys::ContactLayer layer) {
|
|||
|
||||
void InstanceSet::sub_7100FBAD74() {
|
||||
for (auto& rb : mRigidBodySets) {
|
||||
rb.disableAllContact();
|
||||
rb.disableAllContactLayers();
|
||||
}
|
||||
if (mRagdollController != nullptr) {
|
||||
mRagdollController->sub_71012217A8();
|
||||
|
@ -143,7 +144,7 @@ void InstanceSet::sub_7100FBB00C(phys::RigidBody* body, phys::RigidBodyParam* pa
|
|||
|
||||
void* InstanceSet::sub_7100FBBC28(const sead::SafeString& name) const {
|
||||
for (auto& rb : mRigidBodySets) {
|
||||
void* p = rb.findXByName(name);
|
||||
void* p = rb.findBodyByHavokName(name);
|
||||
if (p != nullptr)
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
|
||||
namespace ksys::phys {
|
||||
|
||||
class RigidBodySet;
|
||||
class SystemGroupHandler;
|
||||
|
||||
class Ragdoll {};
|
||||
|
@ -46,21 +47,6 @@ struct ContactInfo {
|
|||
sead::SafeString mName;
|
||||
};
|
||||
|
||||
class RigidBodySet {
|
||||
public:
|
||||
void disableAllContact();
|
||||
void sub_7100FA97FC();
|
||||
void disableCollisionMaybe(ContactLayer);
|
||||
void* findXByName(const sead::SafeString& name) const;
|
||||
|
||||
RigidBody* getRigidBody() const { return mBodies[0]; }
|
||||
RigidBody* getRigidBody(s32 idx) const { return mBodies[idx]; }
|
||||
|
||||
private:
|
||||
u8 _0[0x18];
|
||||
sead::PtrArray<RigidBody> mBodies;
|
||||
};
|
||||
|
||||
class InstanceSet : public sead::hostio::Node {
|
||||
public:
|
||||
enum class Flag : u32 {
|
||||
|
|
Loading…
Reference in New Issue