ksys: Start adding PhysicsConstraints

This commit is contained in:
Léo Lam
2021-10-16 16:36:32 +02:00
parent 381d8922c1
commit 4b6f513606
7 changed files with 91 additions and 4 deletions
@@ -107,6 +107,8 @@ target_sources(uking PRIVATE
actInstParamPack.cpp
actInstParamPack.h
actLifeRecoveryInfo.h
actPhysicsConstraints.cpp
actPhysicsConstraints.h
actPhysicsUserTag.cpp
actPhysicsUserTag.h
actPlayerInfo.cpp
@@ -0,0 +1,24 @@
#include "KingSystem/ActorSystem/actPhysicsConstraints.h"
#include "KingSystem/Physics/System/physConstraint.h"
namespace ksys::act {
PhysicsConstraints::PhysicsConstraints() = default;
PhysicsConstraints::~PhysicsConstraints() {
finalize();
}
void PhysicsConstraints::finalize() {
for (auto*& cs : mConstraints) {
if (cs) {
phys::Constraint::destroy(cs);
cs = nullptr;
}
}
mConstraints.freeBuffer();
_10 = false;
_11 = false;
}
} // namespace ksys::act
@@ -0,0 +1,30 @@
#pragma once
#include <container/seadBuffer.h>
#include "KingSystem/Utils/Types.h"
namespace ksys::phys {
class Constraint;
}
namespace ksys::act {
class Actor;
class PhysicsConstraints {
public:
PhysicsConstraints();
~PhysicsConstraints();
bool initialize(Actor* actor, sead::Heap* heap);
void finalize();
void calc();
private:
sead::Buffer<phys::Constraint*> mConstraints;
bool _10 = false;
bool _11 = false;
};
KSYS_CHECK_SIZE_NX150(PhysicsConstraints, 0x18);
} // namespace ksys::act
+2
View File
@@ -18,6 +18,8 @@ target_sources(uking PRIVATE
SupportBone/physSupportBoneResourceMainBone.cpp
System/physCharacterControllerParam.cpp
System/physCharacterControllerParam.h
System/physConstraint.cpp
System/physConstraint.h
System/physContactInfoParam.cpp
System/physContactInfoParam.h
System/physDefines.cpp
@@ -0,0 +1,10 @@
#include "KingSystem/Physics/System/physConstraint.h"
namespace ksys::phys {
void Constraint::destroy(Constraint* instance) {
if (instance)
delete instance;
}
} // namespace ksys::phys
@@ -0,0 +1,19 @@
#pragma once
#include <prim/seadRuntimeTypeInfo.h>
namespace ksys::phys {
class Constraint {
SEAD_RTTI_BASE(Constraint)
public:
// FIXME: types
Constraint();
virtual ~Constraint();
/// No-op if instance is null.
static void destroy(Constraint* instance);
};
} // namespace ksys::phys