ksys: Start adding PhysicsConstraints

This commit is contained in:
Léo Lam 2021-10-16 16:36:32 +02:00
parent 381d8922c1
commit 4b6f513606
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
7 changed files with 91 additions and 4 deletions

View File

@ -73704,9 +73704,9 @@ Address,Quality,Size,Name
0x0000007100d3d40c,U,000144,
0x0000007100d3d49c,U,000100,
0x0000007100d3d500,U,000244,
0x0000007100d3d5f4,U,000016,ActorConstraints::ctor
0x0000007100d3d604,U,000104,
0x0000007100d3d66c,U,000104,
0x0000007100d3d5f4,O,000016,_ZN4ksys3act18PhysicsConstraintsC1Ev
0x0000007100d3d604,O,000104,_ZN4ksys3act18PhysicsConstraintsD1Ev
0x0000007100d3d66c,O,000104,_ZN4ksys3act18PhysicsConstraints8finalizeEv
0x0000007100d3d6d4,U,002256,ActorConstraints::init
0x0000007100d3dfa4,U,000380,
0x0000007100d3e120,U,000332,
@ -82384,7 +82384,7 @@ Address,Quality,Size,Name
0x0000007100f6a5c8,U,000212,
0x0000007100f6a69c,U,000092,
0x0000007100f6a6f8,U,000372,
0x0000007100f6a86c,U,000020,
0x0000007100f6a86c,O,000020,_ZN4ksys4phys10Constraint7destroyEPS1_
0x0000007100f6a880,U,000012,
0x0000007100f6a88c,U,000160,
0x0000007100f6a92c,U,000168,

Can't render this file because it is too large.

View File

@ -107,6 +107,8 @@ target_sources(uking PRIVATE
actInstParamPack.cpp
actInstParamPack.h
actLifeRecoveryInfo.h
actPhysicsConstraints.cpp
actPhysicsConstraints.h
actPhysicsUserTag.cpp
actPhysicsUserTag.h
actPlayerInfo.cpp

View File

@ -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

View File

@ -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

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

View File

@ -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

View File

@ -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