ksys/phys: Add ContactInfoParam

This commit is contained in:
Léo Lam 2021-04-21 18:37:20 +02:00
parent f59bc21b3a
commit 1631e2aae3
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
4 changed files with 102 additions and 10 deletions

View File

@ -94777,16 +94777,16 @@
0x00000071012829d0,_ZN4sead15FixedSafeStringILi87EEaSERKNS_14SafeStringBaseIcEE,240,
0x0000007101282ac0,j__ZdlPv_1281,4,
0x0000007101282ac4,_ZN4sead19FixedSafeStringBaseIcLi87EEaSERKNS_14SafeStringBaseIcEE,240,
0x0000007101282bb4,sub_7101282BB4,268,
0x0000007101282cc0,sub_7101282CC0,276,
0x0000007101282dd4,sub_7101282DD4,220,
0x0000007101282eb0,sub_7101282EB0,576,
0x00000071012830f0,sub_71012830F0,744,
0x00000071012833d8,sub_71012833D8,660,
0x000000710128366c,sub_710128366C,44,
0x0000007101283698,j__ZdlPv_1282,4,
0x000000710128369c,sub_710128369C,40,
0x00000071012836c4,j__ZdlPv_1283,4,
0x0000007101282bb4,sub_7101282BB4,268,_ZN4ksys4phys16ContactInfoParamC1Ev
0x0000007101282cc0,sub_7101282CC0,276,_ZN4ksys4phys16ContactInfoParamD1Ev
0x0000007101282dd4,sub_7101282DD4,220,_ZN4ksys4phys16ContactInfoParamD0Ev
0x0000007101282eb0,sub_7101282EB0,576,_ZN4ksys4phys16ContactInfoParam5parseERKN3agl3utl16ResParameterListEPN4sead4HeapE
0x00000071012830f0,sub_71012830F0,744,_ZN4ksys4phys21ContactPointInfoParamC1Ev
0x00000071012833d8,sub_71012833D8,660,_ZN4ksys4phys18CollisionInfoParamC1Ev
0x000000710128366c,sub_710128366C,44,_ZN4ksys4phys21ContactPointInfoParamD2Ev
0x0000007101283698,j__ZdlPv_1282,4,_ZN4ksys4phys21ContactPointInfoParamD0Ev
0x000000710128369c,sub_710128369C,40,_ZN4ksys4phys18CollisionInfoParamD2Ev
0x00000071012836c4,j__ZdlPv_1283,4,_ZN4ksys4phys18CollisionInfoParamD0Ev
0x00000071012836c8,bphysicsParseShapeParam,1996,_ZN4ksys4phys10ShapeParamC1Ev
0x0000007101283e94,sub_7101283E94,188,_ZN4ksys4phys10ShapeParamD1Ev
0x0000007101283f50,sub_7101283F50,108,_ZN4ksys4phys10ShapeParamD0Ev

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

View File

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

View File

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

View File

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