mirror of
https://github.com/zeldaret/botw
synced 2026-08-04 09:08:44 -04:00
ksys: Start adding PhysicsConstraints
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user