mirror of
https://github.com/zeldaret/botw
synced 2026-06-29 02:50:44 -04:00
ksys/phys: Add ContactInfoParam
This commit is contained in:
@@ -9,6 +9,8 @@ target_sources(uking PRIVATE
|
||||
RigidBody/physEdgeRigidBodyParam.h
|
||||
SupportBone/physSupportBoneParam.cpp
|
||||
SupportBone/physSupportBoneParam.h
|
||||
System/physContactInfoParam.cpp
|
||||
System/physContactInfoParam.h
|
||||
System/physDefines.cpp
|
||||
System/physDefines.h
|
||||
System/physParamSet.cpp
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "KingSystem/Physics/System/physContactInfoParam.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
ContactInfoParam::ContactInfoParam()
|
||||
: contact_point_info_num(0, "contact_point_info_num", &obj),
|
||||
collision_info_num(0, "collision_info_num", &obj) {}
|
||||
|
||||
ContactInfoParam::~ContactInfoParam() {
|
||||
contact_point_info.freeBuffer();
|
||||
collision_info.freeBuffer();
|
||||
}
|
||||
|
||||
bool ContactInfoParam::parse(const agl::utl::ResParameterList& res_list, sead::Heap* heap) {
|
||||
if (!res_list || res_list.getResParameterObjNum() < 1)
|
||||
return false;
|
||||
|
||||
obj.applyResParameterObj(res_list.getResParameterObj(0), nullptr);
|
||||
|
||||
const int num_contact_point_info = *contact_point_info_num;
|
||||
const int num_collision_info = *collision_info_num;
|
||||
|
||||
if (num_contact_point_info > 0) {
|
||||
contact_point_info.allocBufferAssert(num_contact_point_info, heap);
|
||||
for (int i = 0; i < num_contact_point_info; ++i) {
|
||||
addObj(&contact_point_info[i],
|
||||
sead::FormatFixedSafeString<32>("ContactPointInfo_%d", i));
|
||||
}
|
||||
}
|
||||
|
||||
if (num_collision_info > 0) {
|
||||
collision_info.allocBufferAssert(num_collision_info, heap);
|
||||
for (int i = 0; i < num_collision_info; ++i) {
|
||||
addObj(&collision_info[i], sead::FormatFixedSafeString<32>("CollisionInfo_%d", i));
|
||||
}
|
||||
}
|
||||
|
||||
applyResParameterList(res_list);
|
||||
return true;
|
||||
}
|
||||
|
||||
ContactPointInfoParam::ContactPointInfoParam()
|
||||
: name(sead::SafeString::cEmptyString, "name", this),
|
||||
type(sead::SafeString::cEmptyString, "type", this), num(0x80, "num", this) {}
|
||||
|
||||
CollisionInfoParam::CollisionInfoParam()
|
||||
: name(sead::SafeString::cEmptyString, "name", this),
|
||||
type(sead::SafeString::cEmptyString, "type", this) {}
|
||||
|
||||
} // namespace ksys::phys
|
||||
@@ -0,0 +1,40 @@
|
||||
#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 ContactPointInfoParam : agl::utl::ParameterObj {
|
||||
ContactPointInfoParam();
|
||||
|
||||
agl::utl::Parameter<sead::FixedSafeString<32>> name;
|
||||
agl::utl::Parameter<sead::FixedSafeString<32>> type;
|
||||
agl::utl::Parameter<int> num;
|
||||
};
|
||||
|
||||
struct CollisionInfoParam : agl::utl::ParameterObj {
|
||||
CollisionInfoParam();
|
||||
|
||||
agl::utl::Parameter<sead::FixedSafeString<32>> name;
|
||||
agl::utl::Parameter<sead::FixedSafeString<32>> type;
|
||||
};
|
||||
|
||||
struct ContactInfoParam : agl::utl::ParameterList {
|
||||
ContactInfoParam();
|
||||
~ContactInfoParam() override;
|
||||
ContactInfoParam(const ContactInfoParam&) = delete;
|
||||
auto operator=(const ContactInfoParam&) = delete;
|
||||
|
||||
bool parse(const agl::utl::ResParameterList& res_list, sead::Heap* heap);
|
||||
|
||||
sead::Buffer<ContactPointInfoParam> contact_point_info;
|
||||
sead::Buffer<CollisionInfoParam> collision_info;
|
||||
agl::utl::ParameterObj obj;
|
||||
agl::utl::Parameter<int> contact_point_info_num;
|
||||
agl::utl::Parameter<int> collision_info_num;
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
||||
Reference in New Issue
Block a user