diff --git a/data/uking_functions.csv b/data/uking_functions.csv index e893922b..d00a1ae4 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -94809,17 +94809,17 @@ Address,Quality,Size,Name 0x0000007101283698,O,000004,_ZN4ksys4phys21ContactPointInfoParamD0Ev 0x000000710128369c,O,000040,_ZN4ksys4phys18CollisionInfoParamD2Ev 0x00000071012836c4,O,000004,_ZN4ksys4phys18CollisionInfoParamD0Ev -0x00000071012836c8,O,001996,_ZN4ksys4phys10ShapeParamC1Ev -0x0000007101283e94,O,000188,_ZN4ksys4phys10ShapeParamD1Ev -0x0000007101283f50,O,000108,_ZN4ksys4phys10ShapeParamD0Ev -0x0000007101283fbc,O,000508,_ZN4ksys4phys10ShapeParam5parseERKN3agl3utl15ResParameterObjEPN4sead4HeapE -0x00000071012841b8,O,000664,_ZNK4ksys4phys10ShapeParam8getShapeEv -0x0000007101284450,O,000132,_ZNK4ksys4phys10ShapeParam9getSphereEPNS0_11SphereParamE -0x00000071012844d4,O,000156,_ZNK4ksys4phys10ShapeParam10getCapsuleEPNS0_12CapsuleParamE -0x0000007101284570,O,000164,_ZNK4ksys4phys10ShapeParam11getCylinderEPNS0_13CylinderParamE -0x0000007101284614,O,000180,_ZNK4ksys4phys10ShapeParam6getBoxEPNS0_8BoxParamE -0x00000071012846c8,O,000108,_ZNK4ksys4phys10ShapeParam11getPolytopeEPNS0_13PolytopeParamE -0x0000007101284734,O,000156,_ZNK4ksys4phys10ShapeParam17getCharacterPrismEPNS0_19CharacterPrismParamE +0x00000071012836c8,O,001996,_ZN4ksys4phys13ShapeParamObjC1Ev +0x0000007101283e94,O,000188,_ZN4ksys4phys13ShapeParamObjD1Ev +0x0000007101283f50,O,000108,_ZN4ksys4phys13ShapeParamObjD0Ev +0x0000007101283fbc,O,000508,_ZN4ksys4phys13ShapeParamObj5parseERKN3agl3utl15ResParameterObjEPN4sead4HeapE +0x00000071012841b8,O,000664,_ZNK4ksys4phys13ShapeParamObj12getShapeTypeEv +0x0000007101284450,O,000132,_ZNK4ksys4phys13ShapeParamObj9getSphereEPNS0_11SphereParamE +0x00000071012844d4,O,000156,_ZNK4ksys4phys13ShapeParamObj10getCapsuleEPNS0_12CapsuleParamE +0x0000007101284570,O,000164,_ZNK4ksys4phys13ShapeParamObj11getCylinderEPNS0_13CylinderParamE +0x0000007101284614,O,000180,_ZNK4ksys4phys13ShapeParamObj6getBoxEPNS0_8BoxParamE +0x00000071012846c8,O,000108,_ZNK4ksys4phys13ShapeParamObj11getPolytopeEPNS0_13PolytopeParamE +0x0000007101284734,O,000156,_ZNK4ksys4phys13ShapeParamObj17getCharacterPrismEPNS0_19CharacterPrismParamE 0x00000071012847d0,U,000032, 0x00000071012847f0,U,000004,nullsub_4756 0x00000071012847f4,U,000004,j__ZdlPv_1284 diff --git a/src/KingSystem/Physics/CMakeLists.txt b/src/KingSystem/Physics/CMakeLists.txt index 29597c74..4e849abb 100644 --- a/src/KingSystem/Physics/CMakeLists.txt +++ b/src/KingSystem/Physics/CMakeLists.txt @@ -46,6 +46,8 @@ target_sources(uking PRIVATE RigidBody/Shape/physCylinderShape.cpp RigidBody/Shape/physCylinderShape.h RigidBody/Shape/physShape.h + RigidBody/Shape/physShapeParamObj.cpp + RigidBody/Shape/physShapeParamObj.h RigidBody/Shape/physSphereShape.cpp RigidBody/Shape/physSphereShape.h RigidBody/Shape/physWaterCylinderShape.cpp @@ -99,8 +101,6 @@ target_sources(uking PRIVATE System/physRigidContactPointsEx.h System/physSensorGroupFilter.cpp System/physSensorGroupFilter.h - System/physShapeParam.cpp - System/physShapeParam.h System/physSystem.cpp System/physSystem.h System/physSystemData.cpp diff --git a/src/KingSystem/Physics/RigidBody/Shape/physShape.h b/src/KingSystem/Physics/RigidBody/Shape/physShape.h index 521d3443..c84175ea 100644 --- a/src/KingSystem/Physics/RigidBody/Shape/physShape.h +++ b/src/KingSystem/Physics/RigidBody/Shape/physShape.h @@ -6,6 +6,16 @@ class hkpShape; namespace ksys::phys { +enum class ShapeType { + Sphere = 0, + Capsule = 1, + Box = 2, + Cylinder = 3, + Polytope = 4, + CharacterPrism = 6, + Unknown = -1, +}; + class Shape { SEAD_RTTI_BASE(Shape) diff --git a/src/KingSystem/Physics/System/physShapeParam.cpp b/src/KingSystem/Physics/RigidBody/Shape/physShapeParamObj.cpp similarity index 71% rename from src/KingSystem/Physics/System/physShapeParam.cpp rename to src/KingSystem/Physics/RigidBody/Shape/physShapeParamObj.cpp index b6aae2a5..5b7d89e4 100644 --- a/src/KingSystem/Physics/System/physShapeParam.cpp +++ b/src/KingSystem/Physics/RigidBody/Shape/physShapeParamObj.cpp @@ -1,8 +1,9 @@ -#include "KingSystem/Physics/System/physShapeParam.h" +#include "KingSystem/Physics/RigidBody/Shape/physShapeParamObj.h" +#include "KingSystem/Physics/RigidBody/Shape/physShape.h" namespace ksys::phys { -ShapeParam::ShapeParam() +ShapeParamObj::ShapeParamObj() : shape_type(sead::SafeString::cEmptyString, "shape_type", this), radius(1.0, "radius", this), convex_radius(0.05, "convex_radius", this), translate_0(sead::Vector3f::zero, "translate_0", this), @@ -13,11 +14,11 @@ ShapeParam::ShapeParam() wall_code({"None"}, "wall_code", this), floor_code({"None"}, "floor_code", this), item_code_disable_stick(false, "item_code_disable_stick", this) {} -ShapeParam::~ShapeParam() { +ShapeParamObj::~ShapeParamObj() { vertices.freeBuffer(); } -bool ShapeParam::parse(const agl::utl::ResParameterObj& res_obj, sead::Heap* heap) { +bool ShapeParamObj::parse(const agl::utl::ResParameterObj& res_obj, sead::Heap* heap) { vertices.freeBuffer(); applyResParameterObj(res_obj); @@ -36,24 +37,24 @@ bool ShapeParam::parse(const agl::utl::ResParameterObj& res_obj, sead::Heap* hea return true; } -ShapeParam::Shape ShapeParam::getShape() const { +ShapeType ShapeParamObj::getShapeType() const { if (*shape_type == "sphere") - return Shape::Sphere; + return ShapeType::Sphere; if (*shape_type == "capsule") - return Shape::Capsule; + return ShapeType::Capsule; if (*shape_type == "cylinder") - return Shape::Cylinder; + return ShapeType::Cylinder; if (*shape_type == "box") - return Shape::Box; + return ShapeType::Box; if (*shape_type == "polytope") - return Shape::Polytope; + return ShapeType::Polytope; if (*shape_type == "character_prism") - return Shape::CharacterPrism; + return ShapeType::CharacterPrism; - return Shape::Unknown; + return ShapeType::Unknown; } -void ShapeParam::getCommon(CommonShapeParam* param) const { +void ShapeParamObj::getCommon(CommonShapeParam* param) const { param->material = materialFromText(*material); param->sub_material = sub_material->cstr(); param->floor_code = floorCodeFromText(*floor_code); @@ -61,20 +62,20 @@ void ShapeParam::getCommon(CommonShapeParam* param) const { param->item_code_disable_stick = *item_code_disable_stick; } -void ShapeParam::getSphere(SphereParam* param) const { +void ShapeParamObj::getSphere(SphereParam* param) const { param->radius = *radius; param->translate = *translate_0; getCommon(¶m->common); } -void ShapeParam::getCapsule(CapsuleParam* param) const { +void ShapeParamObj::getCapsule(CapsuleParam* param) const { param->radius = *radius; param->translate_0 = *translate_0; param->translate_1 = *translate_1; getCommon(¶m->common); } -void ShapeParam::getCylinder(CylinderParam* param) const { +void ShapeParamObj::getCylinder(CylinderParam* param) const { param->radius = *radius; param->convex_radius = *convex_radius; param->translate_0 = *translate_0; @@ -82,7 +83,7 @@ void ShapeParam::getCylinder(CylinderParam* param) const { getCommon(¶m->common); } -void ShapeParam::getBox(BoxParam* param) const { +void ShapeParamObj::getBox(BoxParam* param) const { param->translate_0 = *translate_0; param->translate_1 = *translate_1; param->rotate = *rotate; @@ -90,12 +91,12 @@ void ShapeParam::getBox(BoxParam* param) const { getCommon(¶m->common); } -void ShapeParam::getPolytope(PolytopeParam* param) const { +void ShapeParamObj::getPolytope(PolytopeParam* param) const { param->vertex_num = *vertex_num; getCommon(¶m->common); } -void ShapeParam::getCharacterPrism(CharacterPrismParam* param) const { +void ShapeParamObj::getCharacterPrism(CharacterPrismParam* param) const { param->radius = *radius; param->translate_0 = *translate_0; param->translate_1 = *translate_1; diff --git a/src/KingSystem/Physics/System/physShapeParam.h b/src/KingSystem/Physics/RigidBody/Shape/physShapeParamObj.h similarity index 87% rename from src/KingSystem/Physics/System/physShapeParam.h rename to src/KingSystem/Physics/RigidBody/Shape/physShapeParamObj.h index 850afc7d..6193ba0a 100644 --- a/src/KingSystem/Physics/System/physShapeParam.h +++ b/src/KingSystem/Physics/RigidBody/Shape/physShapeParamObj.h @@ -9,6 +9,8 @@ namespace ksys::phys { +enum class ShapeType; + struct CommonShapeParam { Material material; const char* sub_material; @@ -64,25 +66,15 @@ struct CharacterPrismParam { }; KSYS_CHECK_SIZE_NX150(CharacterPrismParam, 0x40); -struct ShapeParam : agl::utl::ParameterObj { - enum class Shape { - Sphere = 0, - Capsule = 1, - Box = 2, - Cylinder = 3, - Polytope = 4, - CharacterPrism = 6, - Unknown = -1, - }; - - ShapeParam(); - ~ShapeParam() override; - ShapeParam(const ShapeParam&) = delete; - auto operator=(const ShapeParam&) = delete; +struct ShapeParamObj : agl::utl::ParameterObj { + ShapeParamObj(); + ~ShapeParamObj() override; + ShapeParamObj(const ShapeParamObj&) = delete; + auto operator=(const ShapeParamObj&) = delete; bool parse(const agl::utl::ResParameterObj& res_obj, sead::Heap* heap); - Shape getShape() const; + ShapeType getShapeType() const; void getCommon(CommonShapeParam* param) const; void getSphere(SphereParam* param) const; void getCapsule(CapsuleParam* param) const; diff --git a/src/KingSystem/Physics/RigidBody/physRigidBodyFromShape.h b/src/KingSystem/Physics/RigidBody/physRigidBodyFromShape.h index eca6e12d..d0693895 100644 --- a/src/KingSystem/Physics/RigidBody/physRigidBodyFromShape.h +++ b/src/KingSystem/Physics/RigidBody/physRigidBodyFromShape.h @@ -4,6 +4,8 @@ namespace ksys::phys { +class Shape; + class RigidBodyFromShape : public RigidBody { SEAD_RTTI_OVERRIDE(RigidBodyFromShape, RigidBody) public: @@ -15,8 +17,8 @@ protected: const hkpShape* getNewHavokShape_() override; float updateScale_(float scale, float old_scale) override; - virtual void m15() = 0; - virtual void m16() = 0; + virtual Shape* getShape_() = 0; + virtual const Shape* getShape_() const = 0; }; } // namespace ksys::phys diff --git a/src/KingSystem/Physics/RigidBody/physRigidBodyParam.cpp b/src/KingSystem/Physics/RigidBody/physRigidBodyParam.cpp index 9948cf83..143d8158 100644 --- a/src/KingSystem/Physics/RigidBody/physRigidBodyParam.cpp +++ b/src/KingSystem/Physics/RigidBody/physRigidBodyParam.cpp @@ -1,6 +1,6 @@ #include "KingSystem/Physics/RigidBody/physRigidBodyParam.h" +#include "KingSystem/Physics/RigidBody/Shape/physShapeParamObj.h" #include "KingSystem/Physics/System/physEntityGroupFilter.h" -#include "KingSystem/Physics/System/physShapeParam.h" namespace ksys::phys { diff --git a/src/KingSystem/Physics/RigidBody/physRigidBodyParam.h b/src/KingSystem/Physics/RigidBody/physRigidBodyParam.h index 544457c3..46638668 100644 --- a/src/KingSystem/Physics/RigidBody/physRigidBodyParam.h +++ b/src/KingSystem/Physics/RigidBody/physRigidBodyParam.h @@ -44,7 +44,7 @@ enum class NavMeshSubMaterial { None = 0x15, }; -struct ShapeParam; +struct ShapeParamObj; struct RigidBodyInstanceParam { SEAD_RTTI_BASE(RigidBodyInstanceParam) @@ -161,7 +161,7 @@ struct RigidBodyParam : agl::utl::ParameterList { MotionType getMotionType() const; Info info; - sead::Buffer shapes; + sead::Buffer shapes; }; } // namespace ksys::phys diff --git a/src/KingSystem/Physics/System/physCharacterControllerParam.cpp b/src/KingSystem/Physics/System/physCharacterControllerParam.cpp index 64d3dc1b..4ae3cf76 100644 --- a/src/KingSystem/Physics/System/physCharacterControllerParam.cpp +++ b/src/KingSystem/Physics/System/physCharacterControllerParam.cpp @@ -1,5 +1,5 @@ #include "KingSystem/Physics/System/physCharacterControllerParam.h" -#include "KingSystem/Physics/System/physShapeParam.h" +#include "KingSystem/Physics/RigidBody/Shape/physShapeParamObj.h" namespace ksys::phys { diff --git a/src/KingSystem/Physics/System/physCharacterControllerParam.h b/src/KingSystem/Physics/System/physCharacterControllerParam.h index ef8c65c5..d2279dd1 100644 --- a/src/KingSystem/Physics/System/physCharacterControllerParam.h +++ b/src/KingSystem/Physics/System/physCharacterControllerParam.h @@ -8,7 +8,7 @@ namespace ksys::phys { -struct ShapeParam; +struct ShapeParamObj; SEAD_ENUM(NavMeshCharacterType, Player, @@ -56,7 +56,7 @@ struct CharacterControllerParam : agl::utl::ParameterList, ICharacterControllerP agl::utl::ParameterObj form_header_obj; agl::utl::Parameter shape_num; agl::utl::Parameter> form_type; - sead::Buffer shape_params; + sead::Buffer shape_params; }; CharacterControllerParam();