mirror of https://github.com/zeldaret/botw.git
ksys/phys: Add one more RigidBody function
This commit is contained in:
parent
a2a4ae4163
commit
98c69ebaef
|
|
@ -82976,7 +82976,7 @@ Address,Quality,Size,Name
|
|||
0x0000007100f8d204,O,000012,_ZNK4ksys4phys9RigidBody16isMotionFlag1SetEv
|
||||
0x0000007100f8d210,O,000012,_ZNK4ksys4phys9RigidBody16isMotionFlag2SetEv
|
||||
0x0000007100f8d21c,O,000236,_ZN4ksys4phys9RigidBody14sub_7100F8D21CEv
|
||||
0x0000007100f8d308,U,000888,phys::RigidBody::x_6
|
||||
0x0000007100f8d308,O,000888,_ZN4ksys4phys9RigidBody3x_6Ev
|
||||
0x0000007100f8d680,O,000140,_ZNK4ksys4phys9RigidBody23getEntityMotionAccessorEv
|
||||
0x0000007100f8d70c,O,000156,_ZNK4ksys4phys9RigidBody18getLinkedRigidBodyEv
|
||||
0x0000007100f8d7a8,O,000152,_ZNK4ksys4phys9RigidBody20resetLinkedRigidBodyEv
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -231,18 +231,60 @@ bool RigidBody::isMotionFlag2Set() const {
|
|||
|
||||
void RigidBody::sub_7100F8D21C() {
|
||||
// debug code that survived because mFlags is atomic?
|
||||
static_cast<void>(mFlags.isOn(Flag::_8));
|
||||
static_cast<void>(mFlags.getDirect());
|
||||
|
||||
auto lock = sead::makeScopedLock(mCS);
|
||||
|
||||
if (mMotionFlags.isOn(MotionFlag::_1)) {
|
||||
mMotionFlags.reset(MotionFlag::_1);
|
||||
mMotionFlags.set(MotionFlag::_2);
|
||||
} else if (mFlags.isOn(Flag::_8)) {
|
||||
} else if (isFlag8Set()) {
|
||||
setMotionFlag(MotionFlag::_2);
|
||||
}
|
||||
}
|
||||
|
||||
bool RigidBody::x_6() {
|
||||
// debug code that survived because mFlags is atomic?
|
||||
static_cast<void>(mFlags.getDirect());
|
||||
|
||||
auto lock = makeScopedLock(false);
|
||||
|
||||
bool result = true;
|
||||
|
||||
if (isFlag8Set()) {
|
||||
mFlags.reset(Flag::_20);
|
||||
|
||||
if (mMotionFlags.isOn(MotionFlag::_1)) {
|
||||
mMotionFlags.reset(MotionFlag::_1);
|
||||
mMotionFlags.set(MotionFlag::_2);
|
||||
}
|
||||
|
||||
setMotionFlag(MotionFlag::_2);
|
||||
result = false;
|
||||
} else if (mFlags.isOn(Flag::UpdateRequested)) {
|
||||
MemSystem::instance()->getRigidBodyRequestMgr()->pushRigidBody(getLayerType(), this);
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (isSensor()) {
|
||||
auto* accessor = getSensorMotionAccessor();
|
||||
if (accessor && accessor->getLinkedRigidBody() != nullptr) {
|
||||
mFlags.reset(Flag::_20);
|
||||
resetLinkedRigidBody();
|
||||
result = false;
|
||||
}
|
||||
} else if (mMotionAccessor &&
|
||||
getEntityMotionAccessor()->hasFlag(RigidBodyMotionEntity::Flag::_2)) {
|
||||
mFlags.reset(Flag::_20);
|
||||
getEntityMotionAccessor()->deregisterAllAccessors();
|
||||
result = false;
|
||||
}
|
||||
|
||||
mFlags.set(Flag::_20);
|
||||
mFlags.set(Flag::_4);
|
||||
return result;
|
||||
}
|
||||
|
||||
RigidBodyMotionEntity* RigidBody::getEntityMotionAccessor() const {
|
||||
return sead::DynamicCast<RigidBodyMotionEntity>(mMotionAccessor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void RigidBodyRequestMgr::init(sead::Heap* heap) {
|
|||
_e0.push(&_138[i]);
|
||||
}
|
||||
|
||||
_148 = 0;
|
||||
mNumEntitiesInWorld = 0;
|
||||
|
||||
mContactPoints =
|
||||
RigidContactPointsEx::make(heap, 0x1000, 11, "RigidBodyRequestMgr::Water", 0, 0, 0);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
#include "KingSystem/Utils/Container/LockFreeQueue.h"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
class hkpEntity;
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
class MotionAccessor;
|
||||
|
|
@ -45,6 +47,12 @@ public:
|
|||
void init(sead::Heap* heap);
|
||||
|
||||
bool pushRigidBody(ContactLayerType type, RigidBody* body);
|
||||
// 0x0000007100fa6d48
|
||||
void addEntityToWorld(ContactLayerType type, hkpEntity* entity);
|
||||
// 0x0000007100fa6dac
|
||||
void removeEntityToWorld(ContactLayerType type, hkpEntity* entity);
|
||||
// 0x0000007100fa6ebc
|
||||
void removeRigidBody(ContactLayerType type, RigidBody* body);
|
||||
|
||||
bool registerMotionAccessor(MotionAccessor* accessor);
|
||||
bool deregisterMotionAccessor(MotionAccessor* accessor);
|
||||
|
|
@ -103,7 +111,7 @@ private:
|
|||
sead::Buffer<Unk6> _120;
|
||||
sead::Atomic<u32> _130;
|
||||
sead::Buffer<Unk4> _138;
|
||||
u32 _148{};
|
||||
u32 mNumEntitiesInWorld{};
|
||||
RigidContactPointsEx* mContactPoints{};
|
||||
sead::SafeArray<sead::CriticalSection, NumRigidBodyBuffers> mCriticalSections;
|
||||
sead::CriticalSection mCS;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ public:
|
|||
void registerContactPointLayerPair(RigidContactPointsEx* points, ContactLayer layer1,
|
||||
ContactLayer layer2, bool enabled);
|
||||
|
||||
// 0x0000007101216a20
|
||||
void x_1(RigidBody* body);
|
||||
|
||||
void removeSystemGroupHandler(SystemGroupHandler* handler);
|
||||
|
||||
void lockWorld(ContactLayerType type, void* a = nullptr, int b = 0, bool c = false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue