metaforce/Runtime/Character/CGroundMovement.hpp

69 lines
2.9 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2017-06-19 07:00:50 +00:00
#include <optional>
#include "Runtime/RetroTypes.hpp"
#include "Runtime/rstl.hpp"
#include "Runtime/Collision/CCollisionInfo.hpp"
#include <zeus/CVector3f.hpp>
2017-06-19 07:00:50 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
2017-06-19 07:00:50 +00:00
class CAreaCollisionCache;
class CCollisionInfoList;
class CMaterialFilter;
class CPhysicsActor;
class CStateManager;
2017-06-19 07:00:50 +00:00
2018-12-08 05:30:43 +00:00
class CGroundMovement {
2017-06-19 07:00:50 +00:00
public:
2018-12-08 05:30:43 +00:00
struct SMovementOptions {
bool x0_setWaterLandingForce;
float x4_waterLandingForceCoefficient;
float x8_minimumWaterLandingForce;
float xc_anyZThreshold;
float x10_downwardZThreshold;
float x14_waterLandingVelocityReduction;
bool x18_dampForceAndMomentum;
bool x19_alwaysClip;
bool x1a_disableClipForFloorOnly;
u32 x1c_maxCollisionCycles;
float x20_minimumTranslationDelta;
float x24_dampedNormalCoefficient;
float x28_dampedDeltaCoefficient;
float x2c_floorElasticForce;
float x30_wallElasticConstant;
float x34_wallElasticLinear;
float x38_maxPositiveVerticalVelocity;
std::optional<zeus::CVector3f> x3c_floorPlaneNormal;
2018-12-08 05:30:43 +00:00
};
2017-06-19 07:00:50 +00:00
2018-12-08 05:30:43 +00:00
struct SMoveObjectResult {
std::optional<TUniqueId> x0_id;
std::optional<CCollisionInfo> x8_collision;
2018-12-08 05:30:43 +00:00
u32 x6c_processedCollisions;
float x70_processedDt;
};
2017-06-19 07:00:50 +00:00
2018-12-08 05:30:43 +00:00
static void CheckFalling(CPhysicsActor& actor, CStateManager& mgr, float);
2021-06-07 19:29:18 +00:00
static void MoveGroundCollider(CStateManager& mgr, CPhysicsActor& actor, float dt, const EntityList* nearList);
2018-12-08 05:30:43 +00:00
static bool ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
2021-06-07 19:29:18 +00:00
const CMaterialFilter& filter, EntityList& nearList, float, float, float&,
CCollisionInfoList& list);
2018-12-08 05:30:43 +00:00
static bool MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
2021-06-07 19:29:18 +00:00
const CMaterialFilter& filter, EntityList& nearList, float, float&,
CCollisionInfoList& list, TUniqueId& idOut);
2018-12-08 05:30:43 +00:00
static void MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
2021-06-07 19:29:18 +00:00
const CMaterialFilter& filter, EntityList& nearList, float);
2018-12-08 05:30:43 +00:00
static zeus::CVector3f CollisionDamping(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CVector3f& c,
float d, float e);
2021-06-07 19:29:18 +00:00
static void MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& actor, float, const EntityList* nearList);
2018-12-08 05:30:43 +00:00
static bool RemoveNormalComponent(const zeus::CVector3f&, const zeus::CVector3f&, zeus::CVector3f&, float&);
static bool RemoveNormalComponent(const zeus::CVector3f& a, zeus::CVector3f& b);
2021-06-07 19:29:18 +00:00
static CMaterialList MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float, EntityList& nearList,
2018-12-08 05:30:43 +00:00
CAreaCollisionCache& cache, const SMovementOptions& opts,
SMoveObjectResult& result);
2017-06-19 07:00:50 +00:00
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce