2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-11 01:07:42 +00:00

Finish pathfinding implementations

This commit is contained in:
Jack Andersen
2018-03-02 19:49:13 -10:00
parent 2018ef17d2
commit cb2988c9a4
6 changed files with 562 additions and 129 deletions

View File

@@ -54,14 +54,14 @@ public:
CPFRegionData* Data() const { return x4c_regionData; }
u32 GetIndex() const { return x24_regionIdx; }
float GetHeight() const { return x14_height; }
void GetPathLink() const {}
const CPFLink* GetPathLink() const;
u32 GetNumLinks() const { return x8_numLinks; }
u32 GetFlags() const { return x10_flags; }
const CPFLink* GetLink(u32 i) const { return xc_startLink + i; }
void SetCentroid(const zeus::CVector3f&);
void SetCentroid(const zeus::CVector3f& c) { x28_centroid = c; }
const zeus::CVector3f& GetCentroid() const { return x28_centroid; }
void Fixup(CPFArea& area, u32& maxRegionNodes);
bool IsPointInside(const zeus::CVector3f&);
bool IsPointInside(const zeus::CVector3f& point) const;
const zeus::CVector3f& GetNormal() const { return x18_normal; }
u32 GetNumNodes() const { return x0_numNodes; }
const CPFNode* GetNode(u32 i) const { return x4_startNode + i; }
@@ -69,11 +69,14 @@ public:
bool FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>&, const zeus::CVector3f&,
const zeus::CVector3f&, bool);
bool FindBestPoint(std::vector<zeus::CVector3f>& polyPoints, const zeus::CVector3f& point, u32 flags, float paddingSq);
void SetLinkTo(s32);
void DropToGround(zeus::CVector3f&) const;
void GetLinkMidPoint(const CPFLink&);
zeus::CVector3f FitThroughLink2d(const zeus::CVector3f&, const CPFLink&, const zeus::CVector3f&, float) const;
zeus::CVector3f FitThroughLink3d(const zeus::CVector3f&, const CPFLink&, float, const zeus::CVector3f&, float, float) const;
void SetLinkTo(s32 idx);
void DropToGround(zeus::CVector3f& point) const;
zeus::CVector3f GetLinkMidPoint(const CPFLink& link) const;
zeus::CVector3f FitThroughLink2d(const zeus::CVector3f& p1, const CPFLink& link,
const zeus::CVector3f& p2, float chRadius) const;
zeus::CVector3f FitThroughLink3d(const zeus::CVector3f& p1, const CPFLink& link,
float regionHeight, const zeus::CVector3f& p2,
float chRadius, float chHalfHeight) const;
bool IsPointInsidePaddedAABox(const zeus::CVector3f& point, float padding) const;
};
@@ -82,8 +85,10 @@ class CPFRegionData
float x0_bestPointDistSq = 0.f;
zeus::CVector3f x4_bestPoint;
s32 x10_cookie = -1;
zeus::CVector3f x14_;
s32 x20_ = 0;
float x14_cost = 0.f;
float x18_g = 0.f;
float x1c_h = 0.f;
CPFRegion* x20_parent = nullptr;
CPFRegion* x24_openLess = nullptr;
CPFRegion* x28_openMore = nullptr;
s32 x2c_pathLink = 0;
@@ -94,17 +99,31 @@ public:
void SetOpenMore(CPFRegion* r) { x28_openMore = r; }
CPFRegion* GetOpenLess() const { return x24_openLess; }
CPFRegion* GetOpenMore() const { return x28_openMore; }
void GetCost();
float GetCost() const { return x14_cost; }
float GetG() const { return x18_g; }
s32 GetPathLink() const { return x2c_pathLink; }
void SetPathLink(s32 l) { x2c_pathLink = l; }
void GetParent() const;
void Setup(CPFRegion*, float, float);
CPFRegion* GetParent() const { return x20_parent; }
void SetBestPoint(const zeus::CVector3f& bestPoint) { x4_bestPoint = bestPoint; }
const zeus::CVector3f& GetBestPoint() const { return x4_bestPoint; }
void SetBestPointDistanceSquared(float distSq) { x0_bestPointDistSq = distSq; }
float GetBestPointDistanceSquared() const { return x0_bestPointDistSq; }
void SetCookie(s32 c) { x10_cookie = c; }
s32 GetCookie() const { return x10_cookie; }
void Setup(CPFRegion* parent, float g, float h)
{
x20_parent = parent;
x18_g = g;
x1c_h = h;
x14_cost = x18_g + x1c_h;
}
void Setup(CPFRegion* parent, float g)
{
x20_parent = parent;
x18_g = g;
x14_cost = x18_g + x1c_h;
}
};
}