2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2018-02-14 07:51:18 +00:00
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "CPathFindArea.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
class CPathFindSearch
|
|
|
|
{
|
2018-03-01 06:17:16 +00:00
|
|
|
public:
|
|
|
|
enum class EResult
|
|
|
|
{
|
2018-03-03 05:49:13 +00:00
|
|
|
Success,
|
|
|
|
InvalidArea,
|
|
|
|
NoSourcePoint,
|
|
|
|
NoDestPoint,
|
|
|
|
NoPath
|
2018-03-01 06:17:16 +00:00
|
|
|
};
|
|
|
|
private:
|
2018-02-14 07:51:18 +00:00
|
|
|
CPFArea* x0_area;
|
2018-03-03 05:49:13 +00:00
|
|
|
rstl::reserved_vector<zeus::CVector3f, 16> x4_waypoints;
|
2018-03-04 04:25:57 +00:00
|
|
|
u32 xc8_curWaypoint = 0;
|
2018-03-01 06:17:16 +00:00
|
|
|
EResult xcc_result;
|
2018-03-03 05:49:13 +00:00
|
|
|
float xd0_chHeight;
|
|
|
|
float xd4_chRadius;
|
|
|
|
float xd8_padding = 10.f;
|
|
|
|
u32 xdc_flags; // 0x2: flyer, 0x4: path-always-exists (swimmers)
|
2018-03-01 06:17:16 +00:00
|
|
|
u32 xe0_indexMask;
|
2018-03-03 05:49:13 +00:00
|
|
|
bool Search(rstl::reserved_vector<CPFRegion*, 4>& regs1, const zeus::CVector3f& p1,
|
|
|
|
rstl::reserved_vector<CPFRegion*, 4>& regs2, const zeus::CVector3f& p2);
|
2018-03-04 04:25:57 +00:00
|
|
|
void GetSplinePoint(zeus::CVector3f& pOut, const zeus::CVector3f& p1, u32 wpIdx) const;
|
|
|
|
void GetSplinePointWithLookahead(zeus::CVector3f& pOut, const zeus::CVector3f& p1,
|
|
|
|
u32 wpIdx, float lookahead) const;
|
2018-02-14 07:51:18 +00:00
|
|
|
public:
|
2018-03-03 05:49:13 +00:00
|
|
|
CPathFindSearch(CPFArea* area, u32 flags, u32 index, float chRadius, float chHeight);
|
2018-03-01 06:17:16 +00:00
|
|
|
EResult Search(const zeus::CVector3f& p1, const zeus::CVector3f& p2);
|
2018-03-03 05:49:13 +00:00
|
|
|
EResult FindClosestReachablePoint(const zeus::CVector3f& p1, zeus::CVector3f& p2) const;
|
2018-03-04 04:25:57 +00:00
|
|
|
EResult PathExists(const zeus::CVector3f& p1, const zeus::CVector3f& p2) const;
|
|
|
|
EResult OnPath(const zeus::CVector3f& p1) const;
|
2018-11-11 03:27:54 +00:00
|
|
|
EResult GetResult() const { return xcc_result; }
|
|
|
|
u32 GetCurrentWaypoint() const { return xc8_curWaypoint; }
|
|
|
|
void SetCurrentWaypoint(u32 wp) { xc8_curWaypoint = wp; }
|
|
|
|
const rstl::reserved_vector<zeus::CVector3f, 16>& GetWaypoints() const { return x4_waypoints; }
|
|
|
|
bool IsOver() const { return GetCurrentWaypoint() >= x4_waypoints.size(); }
|
|
|
|
bool IsShagged() const { return GetResult() != EResult::Success; }
|
2018-03-04 04:25:57 +00:00
|
|
|
bool SegmentOver(const zeus::CVector3f& p1) const;
|
|
|
|
void GetSplinePoint(zeus::CVector3f& pOut, const zeus::CVector3f& p1) const;
|
|
|
|
void GetSplinePointWithLookahead(zeus::CVector3f& pOut, const zeus::CVector3f& p1, float lookahead) const;
|
2018-11-17 05:05:57 +00:00
|
|
|
void SetArea(CPFArea* area) { x0_area = area; }
|
2018-02-14 07:51:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|