mirror of https://github.com/zeldaret/botw.git
ksys/phys: Implement ListShapeRigidBody
This commit is contained in:
parent
bc66305e3d
commit
2dc8daf02f
|
|
@ -83202,25 +83202,25 @@ Address,Quality,Size,Name
|
|||
0x0000007100f97cbc,O,000068,_ZN4ksys4phys16CapsuleRigidBody17getCollisionMasksEPNS0_9RigidBody14CollisionMasksEPKj
|
||||
0x0000007100f97d00,O,000288,_ZNK4ksys4phys16CapsuleRigidBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||
0x0000007100f97e20,O,000092,_ZNK4ksys4phys16CapsuleRigidBody18getRuntimeTypeInfoEv
|
||||
0x0000007100f97e7c,U,000004,
|
||||
0x0000007100f97e80,U,000084,
|
||||
0x0000007100f97ed4,U,000088,
|
||||
0x0000007100f97f2c,U,000088,
|
||||
0x0000007100f97f84,U,000096,
|
||||
0x0000007100f97fe4,U,000096,
|
||||
0x0000007100f98044,U,000008,
|
||||
0x0000007100f9804c,U,000008,
|
||||
0x0000007100f98054,U,000008,
|
||||
0x0000007100f9805c,U,000008,
|
||||
0x0000007100f98064,U,000008,
|
||||
0x0000007100f9806c,U,000008,
|
||||
0x0000007100f98074,U,000024,
|
||||
0x0000007100f9808c,U,000016,
|
||||
0x0000007100f9809c,U,000008,
|
||||
0x0000007100f980a4,U,000008,
|
||||
0x0000007100f980ac,U,000100,
|
||||
0x0000007100f98110,U,000288,
|
||||
0x0000007100f98230,U,000092,
|
||||
0x0000007100f97e7c,O,000004,_ZN4ksys4phys18ListShapeRigidBody4makeEPNS0_22RigidBodyInstanceParamEPN4sead4HeapE
|
||||
0x0000007100f97e80,O,000084,_ZN4ksys4phys18ListShapeRigidBodyC1EP12hkpRigidBodyPNS0_9ListShapeENS0_16ContactLayerTypeERKN4sead14SafeStringBaseIcEEbPNS7_4HeapE
|
||||
0x0000007100f97ed4,O,000088,_ZN4ksys4phys18ListShapeRigidBodyD1Ev
|
||||
0x0000007100f97f2c,O,000088,_ZThn32_N4ksys4phys18ListShapeRigidBodyD1Ev
|
||||
0x0000007100f97f84,O,000096,_ZN4ksys4phys18ListShapeRigidBodyD0Ev
|
||||
0x0000007100f97fe4,O,000096,_ZThn32_N4ksys4phys18ListShapeRigidBodyD0Ev
|
||||
0x0000007100f98044,O,000008,_ZN4ksys4phys18ListShapeRigidBody20replaceWithNewSphereEiRKNS0_16SphereShapeParamEPN4sead4HeapE
|
||||
0x0000007100f9804c,O,000008,_ZN4ksys4phys18ListShapeRigidBody21replaceWithNewCapsuleEiRKNS0_17CapsuleShapeParamEPN4sead4HeapE
|
||||
0x0000007100f98054,O,000008,_ZN4ksys4phys18ListShapeRigidBody22replaceWithNewCylinderEiRKNS0_18CylinderShapeParamEPN4sead4HeapE
|
||||
0x0000007100f9805c,O,000008,_ZN4ksys4phys18ListShapeRigidBody17replaceWithNewBoxEiRKNS0_13BoxShapeParamEPN4sead4HeapE
|
||||
0x0000007100f98064,O,000008,_ZN4ksys4phys18ListShapeRigidBody22replaceWithNewPolytopeEiRKNS0_18PolytopeShapeParamEPN4sead4HeapE
|
||||
0x0000007100f9806c,O,000008,_ZN4ksys4phys18ListShapeRigidBody15setMaterialMaskERKNS0_12MaterialMaskEi
|
||||
0x0000007100f98074,O,000024,_ZNK4ksys4phys18ListShapeRigidBody15getMaterialMaskEi
|
||||
0x0000007100f9808c,O,000016,_ZN4ksys4phys18ListShapeRigidBody9getVolumeEv
|
||||
0x0000007100f9809c,O,000008,_ZN4ksys4phys18ListShapeRigidBody9getShape_Ev
|
||||
0x0000007100f980a4,O,000008,_ZNK4ksys4phys18ListShapeRigidBody9getShape_Ev
|
||||
0x0000007100f980ac,O,000100,_ZN4ksys4phys18ListShapeRigidBody17getCollisionMasksEPNS0_9RigidBody14CollisionMasksEPKj
|
||||
0x0000007100f98110,O,000288,_ZNK4ksys4phys18ListShapeRigidBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||
0x0000007100f98230,O,000092,_ZNK4ksys4phys18ListShapeRigidBody18getRuntimeTypeInfoEv
|
||||
0x0000007100f9828c,O,000004,_ZN4ksys4phys17CylinderRigidBody4makeEPNS0_22RigidBodyInstanceParamEPN4sead4HeapE
|
||||
0x0000007100f98290,O,000084,_ZN4ksys4phys17CylinderRigidBodyC1EP12hkpRigidBodyPNS0_13CylinderShapeENS0_16ContactLayerTypeERKN4sead14SafeStringBaseIcEEbPNS7_4HeapE
|
||||
0x0000007100f982e4,O,000088,_ZN4ksys4phys17CylinderRigidBodyD1Ev
|
||||
|
|
@ -83279,7 +83279,7 @@ Address,Quality,Size,Name
|
|||
0x0000007100f99470,O,000188,_ZN4ksys4phys16RigidBodyFactory9createBoxEPNS0_22RigidBodyInstanceParamEPN4sead4HeapE
|
||||
0x0000007100f9952c,O,000188,_ZN4ksys4phys16RigidBodyFactory14createBoxWaterEPNS0_22RigidBodyInstanceParamEPN4sead4HeapE
|
||||
0x0000007100f995e8,O,000188,_ZN4ksys4phys16RigidBodyFactory14createPolytopeEPNS0_22RigidBodyInstanceParamEPN4sead4HeapE
|
||||
0x0000007100f996a4,U,000188,
|
||||
0x0000007100f996a4,O,000188,_ZN4ksys4phys16RigidBodyFactory10createListEPNS0_22RigidBodyInstanceParamEPN4sead4HeapE
|
||||
0x0000007100f99760,U,000264,
|
||||
0x0000007100f99868,U,000036,
|
||||
0x0000007100f9988c,U,000652,
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -100,7 +100,6 @@ private:
|
|||
class ListShapeRigidBodyParam : public RigidBodyInstanceParam {
|
||||
SEAD_RTTI_OVERRIDE(ListShapeRigidBodyParam, RigidBodyInstanceParam)
|
||||
public:
|
||||
u8 _90;
|
||||
ListShapeParam shape;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,81 @@
|
|||
#include "KingSystem/Physics/RigidBody/Shape/List/physListShapeRigidBody.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/List/physListShape.h"
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodyFactory.h"
|
||||
#include "KingSystem/Utils/SafeDelete.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
ListShapeRigidBody* ListShapeRigidBody::make(RigidBodyInstanceParam* param, sead::Heap* heap) {
|
||||
return RigidBodyFactory::createList(param, heap);
|
||||
}
|
||||
|
||||
ListShapeRigidBody::ListShapeRigidBody(hkpRigidBody* hk_body, ListShape* shape,
|
||||
ContactLayerType layer_type, const sead::SafeString& name,
|
||||
bool set_flag_10, sead::Heap* heap)
|
||||
: RigidBodyFromShape(hk_body, layer_type, name, set_flag_10, heap), mShape(shape) {}
|
||||
|
||||
ListShapeRigidBody::~ListShapeRigidBody() {
|
||||
if (hasFlag(RigidBody::Flag::_10) && mShape) {
|
||||
util::safeDelete(mShape);
|
||||
}
|
||||
}
|
||||
|
||||
Shape* ListShapeRigidBody::replaceWithNewSphere(int index, const SphereShapeParam& param,
|
||||
sead::Heap* heap) {
|
||||
return mShape->replaceWithNewSphere(index, param, heap);
|
||||
}
|
||||
|
||||
Shape* ListShapeRigidBody::replaceWithNewCapsule(int index, const CapsuleShapeParam& param,
|
||||
sead::Heap* heap) {
|
||||
return mShape->replaceWithNewCapsule(index, param, heap);
|
||||
}
|
||||
|
||||
Shape* ListShapeRigidBody::replaceWithNewCylinder(int index, const CylinderShapeParam& param,
|
||||
sead::Heap* heap) {
|
||||
return mShape->replaceWithNewCylinder(index, param, heap);
|
||||
}
|
||||
|
||||
Shape* ListShapeRigidBody::replaceWithNewBox(int index, const BoxShapeParam& param,
|
||||
sead::Heap* heap) {
|
||||
return mShape->replaceWithNewBox(index, param, heap);
|
||||
}
|
||||
|
||||
Shape* ListShapeRigidBody::replaceWithNewPolytope(int index, const PolytopeShapeParam& param,
|
||||
sead::Heap* heap) {
|
||||
return mShape->replaceWithNewPolytope(index, param, heap);
|
||||
}
|
||||
|
||||
Shape* ListShapeRigidBody::replaceWithNewCharacterPrism(int index,
|
||||
const CharacterPrismShapeParam& param,
|
||||
sead::Heap* heap) {
|
||||
return mShape->replaceWithNewCharacterPrism(index, param, heap);
|
||||
}
|
||||
|
||||
void ListShapeRigidBody::setMaterialMask(const MaterialMask& mask, int index) {
|
||||
mShape->setMaterialMask(mask, index);
|
||||
}
|
||||
|
||||
const MaterialMask& ListShapeRigidBody::getMaterialMask(int index) const {
|
||||
return mShape->getMaterialMask(index);
|
||||
}
|
||||
|
||||
float ListShapeRigidBody::getVolume() {
|
||||
return mShape->getVolume();
|
||||
}
|
||||
|
||||
Shape* ListShapeRigidBody::getShape_() {
|
||||
return mShape;
|
||||
}
|
||||
|
||||
const Shape* ListShapeRigidBody::getShape_() const {
|
||||
return mShape;
|
||||
}
|
||||
|
||||
u32 ListShapeRigidBody::getCollisionMasks(RigidBody::CollisionMasks* masks, const u32* unk) {
|
||||
masks->ignored_layers = ~mContactMask;
|
||||
masks->collision_filter_info = getCollisionFilterInfo();
|
||||
masks->material_mask = getMaterialMask(unk != nullptr ? int(*unk) : 0).getRawData();
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
|
|||
|
|
@ -4,10 +4,64 @@
|
|||
|
||||
namespace ksys::phys {
|
||||
|
||||
struct BoxShapeParam;
|
||||
struct CapsuleShapeParam;
|
||||
struct CharacterPrismShapeParam;
|
||||
struct CylinderShapeParam;
|
||||
struct PolytopeShapeParam;
|
||||
struct SphereShapeParam;
|
||||
|
||||
class ListShape;
|
||||
|
||||
class ListShapeRigidBody : public RigidBodyFromShape {
|
||||
SEAD_RTTI_OVERRIDE(ListShapeRigidBody, RigidBodyFromShape)
|
||||
public:
|
||||
static ListShapeRigidBody* make(RigidBodyInstanceParam* param, sead::Heap* heap);
|
||||
|
||||
ListShapeRigidBody(hkpRigidBody* hk_body, ListShape* shape, ContactLayerType layer_type,
|
||||
const sead::SafeString& name, bool set_flag_10, sead::Heap* heap);
|
||||
~ListShapeRigidBody() override;
|
||||
|
||||
/// Replace the shape at the specified index with a new sphere shape.
|
||||
/// The shape that is being replaced will be deleted.
|
||||
Shape* replaceWithNewSphere(int index, const SphereShapeParam& param, sead::Heap* heap);
|
||||
|
||||
/// Replace the shape at the specified index with a new capsule shape.
|
||||
/// The shape that is being replaced will be deleted.
|
||||
Shape* replaceWithNewCapsule(int index, const CapsuleShapeParam& param, sead::Heap* heap);
|
||||
|
||||
/// Replace the shape at the specified index with a new cylinder shape.
|
||||
/// The shape that is being replaced will be deleted.
|
||||
Shape* replaceWithNewCylinder(int index, const CylinderShapeParam& param, sead::Heap* heap);
|
||||
|
||||
/// Replace the shape at the specified index with a new box shape.
|
||||
/// The shape that is being replaced will be deleted.
|
||||
Shape* replaceWithNewBox(int index, const BoxShapeParam& param, sead::Heap* heap);
|
||||
|
||||
/// Replace the shape at the specified index with a new polytope shape.
|
||||
/// The shape that is being replaced will be deleted.
|
||||
Shape* replaceWithNewPolytope(int index, const PolytopeShapeParam& param, sead::Heap* heap);
|
||||
|
||||
/// Replace the shape at the specified index with a new character prism.
|
||||
/// The shape that is being replaced will be deleted.
|
||||
Shape* replaceWithNewCharacterPrism(int index, const CharacterPrismShapeParam& param,
|
||||
sead::Heap* heap);
|
||||
|
||||
/// Set the material mask for the shape at the specified index.
|
||||
void setMaterialMask(const MaterialMask& mask, int index);
|
||||
|
||||
/// Get the material mask for the shape at the specified index.
|
||||
const MaterialMask& getMaterialMask(int index) const;
|
||||
|
||||
float getVolume() override;
|
||||
|
||||
protected:
|
||||
Shape* getShape_() override;
|
||||
const Shape* getShape_() const override;
|
||||
u32 getCollisionMasks(RigidBody::CollisionMasks* masks, const u32* unk) override;
|
||||
|
||||
private:
|
||||
ListShape* mShape{};
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "KingSystem/Physics/RigidBody/Shape/Cylinder/physCylinderShape.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/CylinderWater/physCylinderWaterRigidBody.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/CylinderWater/physCylinderWaterShape.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/List/physListShape.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/Polytope/physPolytopeShape.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/Sphere/physSphereShape.h"
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodyFromShape.h"
|
||||
|
|
@ -56,4 +57,8 @@ PolytopeRigidBody* RigidBodyFactory::createPolytope(RigidBodyInstanceParam* para
|
|||
return createRigidBody<PolytopeRigidBody, PolytopeShape, PolytopeParam>(params, heap);
|
||||
}
|
||||
|
||||
ListShapeRigidBody* RigidBodyFactory::createList(RigidBodyInstanceParam* params, sead::Heap* heap) {
|
||||
return createRigidBody<ListShapeRigidBody, ListShape, ListShapeRigidBodyParam>(params, heap);
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class BoxWaterRigidBody;
|
|||
class CapsuleRigidBody;
|
||||
class CylinderRigidBody;
|
||||
class CylinderWaterRigidBody;
|
||||
class ListShapeRigidBody;
|
||||
class PolytopeRigidBody;
|
||||
class RigidBody;
|
||||
struct RigidBodyInstanceParam;
|
||||
|
|
@ -28,7 +29,7 @@ public:
|
|||
static BoxRigidBody* createBox(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static BoxWaterRigidBody* createBoxWater(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static PolytopeRigidBody* createPolytope(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static RigidBody* createCollection(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static ListShapeRigidBody* createList(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
|
|||
Loading…
Reference in New Issue