diff --git a/configure.py b/configure.py index 214b6b68..3f4d5b60 100755 --- a/configure.py +++ b/configure.py @@ -240,7 +240,7 @@ LIBS = [ "MetroidPrime/Weapons/CPlasmaProjectile", "MetroidPrime/Player/CPlayerOrbit", "MetroidPrime/CGameCollision", - "MetroidPrime/CBallFilter", + ["MetroidPrime/CBallFilter", True], "MetroidPrime/CAABoxFilter", "MetroidPrime/CGroundMovement", "MetroidPrime/Enemies/CNewIntroBoss", diff --git a/include/Collision/CollisionUtil.hpp b/include/Collision/CollisionUtil.hpp new file mode 100644 index 00000000..8b829872 --- /dev/null +++ b/include/Collision/CollisionUtil.hpp @@ -0,0 +1,12 @@ +#ifndef _COLLISIONUTIL +#define _COLLISIONUTIL + +class CCollisionInfoList; + +namespace CollisionUtil { + +void AddAverageToFront(const CCollisionInfoList& in, CCollisionInfoList& out); + +} // namespace CollisionUtil + +#endif // _COLLISIONUTIL diff --git a/include/MetroidPrime/CBallFilter.hpp b/include/MetroidPrime/CBallFilter.hpp new file mode 100644 index 00000000..98e91f43 --- /dev/null +++ b/include/MetroidPrime/CBallFilter.hpp @@ -0,0 +1,15 @@ +#ifndef _CBALLFILTER +#define _CBALLFILTER + +#include "MetroidPrime/ICollisionFilter.hpp" + +class CCollisionInfoList; +class CPhysicsActor; + +class CBallFilter : public ICollisionFilter { +public: + explicit CBallFilter(CActor& actor) : ICollisionFilter(actor) {} + void Filter(const CCollisionInfoList& in, CCollisionInfoList& out) const; +}; + +#endif // _CBALLFILTER diff --git a/include/MetroidPrime/ICollisionFilter.hpp b/include/MetroidPrime/ICollisionFilter.hpp new file mode 100644 index 00000000..d0a4195d --- /dev/null +++ b/include/MetroidPrime/ICollisionFilter.hpp @@ -0,0 +1,18 @@ +#ifndef _ICOLLISIONFILTER +#define _ICOLLISIONFILTER + +class CActor; +class CCollisionInfoList; + +class ICollisionFilter { + CActor& x4_actor; + +protected: + explicit ICollisionFilter(CActor& actor) : x4_actor(actor) {} + +public: + virtual ~ICollisionFilter() {}; + virtual void Filter(const CCollisionInfoList& in, CCollisionInfoList& out) const = 0; +}; + +#endif // _ICOLLISIONFILTER diff --git a/obj_files.mk b/obj_files.mk index 588c21ad..4d1d865e 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -207,7 +207,7 @@ METROIDPRIME :=\ $(BUILD_DIR)/asm/MetroidPrime/Weapons/CPlasmaProjectile.o\ $(BUILD_DIR)/asm/MetroidPrime/Player/CPlayerOrbit.o\ $(BUILD_DIR)/asm/MetroidPrime/CGameCollision.o\ - $(BUILD_DIR)/asm/MetroidPrime/CBallFilter.o\ + $(BUILD_DIR)/src/MetroidPrime/CBallFilter.o\ $(BUILD_DIR)/asm/MetroidPrime/CAABoxFilter.o\ $(BUILD_DIR)/asm/MetroidPrime/CGroundMovement.o\ $(BUILD_DIR)/asm/MetroidPrime/Enemies/CNewIntroBoss.o\ diff --git a/src/MetroidPrime/CBallFilter.cpp b/src/MetroidPrime/CBallFilter.cpp new file mode 100644 index 00000000..260b9e7c --- /dev/null +++ b/src/MetroidPrime/CBallFilter.cpp @@ -0,0 +1,7 @@ +#include "MetroidPrime/CBallFilter.hpp" + +#include "Collision/CollisionUtil.hpp" + +void CBallFilter::Filter(const CCollisionInfoList& in, CCollisionInfoList& out) const { + CollisionUtil::AddAverageToFront(in, out); +}