mirror of
https://github.com/zeldaret/botw
synced 2026-06-21 15:56:53 -04:00
ksys/phys: Add RigidBodySetParam
This commit is contained in:
@@ -9,6 +9,8 @@ target_sources(uking PRIVATE
|
||||
RigidBody/physEdgeRigidBodyParam.h
|
||||
RigidBody/physRigidBodyParam.cpp
|
||||
RigidBody/physRigidBodyParam.h
|
||||
RigidBody/physRigidBodySetParam.cpp
|
||||
RigidBody/physRigidBodySetParam.h
|
||||
SupportBone/physSupportBoneParam.cpp
|
||||
SupportBone/physSupportBoneParam.h
|
||||
System/physCharacterControllerParam.cpp
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodySetParam.h"
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodyParam.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
RigidBodySetParam::RigidBodySetParam()
|
||||
: set_name(sead::SafeString::cEmptyString, "set_name", &obj),
|
||||
type(sead::SafeString::cEmptyString, "type", &obj), num(1, "num", &obj),
|
||||
setup_file_path(sead::SafeString::cEmptyString, "setup_file_path", &obj) {}
|
||||
|
||||
RigidBodySetParam::~RigidBodySetParam() {
|
||||
rigid_bodies.freeBuffer();
|
||||
}
|
||||
|
||||
bool RigidBodySetParam::parse(agl::utl::ResParameterList res_list, sead::Heap* heap) {
|
||||
if (!res_list)
|
||||
return false;
|
||||
|
||||
obj.applyResParameterObj(res_list.getResParameterObj(0), nullptr);
|
||||
|
||||
if (*type == "from_shape_type")
|
||||
type_val = Type::FromShapeType;
|
||||
else
|
||||
type_val = Type::Other;
|
||||
|
||||
const int num_bodies = *num;
|
||||
if (num_bodies == 0 || res_list.getResParameterListNum() != num_bodies)
|
||||
return false;
|
||||
|
||||
rigid_bodies.allocBufferAssert(num_bodies, heap);
|
||||
for (int i = 0; i < num_bodies; ++i) {
|
||||
rigid_bodies[i].parse(res_list.getResParameterList(i), heap);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int RigidBodySetParam::getNumRigidBodies() const {
|
||||
return *num;
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <agl/Utils/aglParameter.h>
|
||||
#include <agl/Utils/aglParameterList.h>
|
||||
#include <agl/Utils/aglParameterObj.h>
|
||||
#include <container/seadBuffer.h>
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
struct RigidBodyParam;
|
||||
|
||||
struct RigidBodySetParam : agl::utl::ParameterList {
|
||||
enum class Type {
|
||||
Invalid = 0,
|
||||
FromShapeType = 1,
|
||||
Other = 2,
|
||||
};
|
||||
|
||||
RigidBodySetParam();
|
||||
~RigidBodySetParam() override;
|
||||
RigidBodySetParam(const RigidBodySetParam&) = delete;
|
||||
auto operator=(const RigidBodySetParam&) = delete;
|
||||
|
||||
bool parse(agl::utl::ResParameterList res_list, sead::Heap* heap);
|
||||
int getNumRigidBodies() const;
|
||||
|
||||
Type type_val = Type::Invalid;
|
||||
agl::utl::ParameterObj obj;
|
||||
agl::utl::Parameter<sead::SafeString> set_name;
|
||||
agl::utl::Parameter<sead::SafeString> type;
|
||||
agl::utl::Parameter<int> num;
|
||||
agl::utl::Parameter<sead::SafeString> setup_file_path;
|
||||
sead::Buffer<RigidBodyParam> rigid_bodies;
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
||||
Reference in New Issue
Block a user