ksys/phys: Start adding RigidContactPoints

Super messy stuff. I have no idea what it's used for
This commit is contained in:
Léo Lam
2021-12-27 21:56:20 +01:00
parent e187c1ecfd
commit b513fbbf03
13 changed files with 260 additions and 21 deletions
@@ -1,13 +1,15 @@
#include "KingSystem/Physics/System/physContactMgr.h"
#include <prim/seadScopedLock.h>
#include "KingSystem/Physics/System/physEntityGroupFilter.h"
#include "KingSystem/Physics/System/physGroupFilter.h"
#include "KingSystem/Physics/System/physMemSystem.h"
#include "KingSystem/Physics/System/physRigidContactPoints.h"
namespace ksys::phys {
ContactMgr::ContactMgr() {
mRigidContactPoints.initOffset(RigidContactPoints::getListNodeOffset());
// FIXME: figure out what these offsets are
mList1.initOffset(0x38);
mList2.initOffset(0x78);
mList3.initOffset(0x40);
mList0.initOffset(0x10);
@@ -62,6 +64,33 @@ void ContactMgr::doLoadContactInfoTable(agl::utl::ResParameterArchive archive,
table.param_io.applyResParameterArchive(archive);
}
RigidContactPoints* ContactMgr::allocContactPoints(sead::Heap* heap, int num,
const sead::SafeString& name, int a, int b,
int c) {
auto* points = new (heap) RigidContactPoints(name, a, b, c);
points->allocPoints(heap, num);
return points;
}
void ContactMgr::registerContactPoints(RigidContactPoints* points) {
auto lock = sead::makeScopedLock(mMutex1);
if (!points->isLinked())
mRigidContactPoints.pushBack(points);
}
void ContactMgr::freeContactPoints(RigidContactPoints* points) {
if (!points)
return;
{
auto lock = sead::makeScopedLock(mMutex1);
if (points->isLinked())
mRigidContactPoints.erase(points);
}
points->freePoints();
delete points;
}
bool ContactMgr::getSensorLayerMask(ReceiverMask* mask,
const sead::SafeString& receiver_type) const {
const auto& receivers = mContactInfoTables[int(ContactLayerType::Sensor)].receivers;