2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-06-06 23:13:27 +00:00

Implement CPFArea constructor

This commit is contained in:
Jack Andersen 2018-02-13 21:51:18 -10:00
parent 74ce62726d
commit 98518e7d44
20 changed files with 375 additions and 216 deletions

View File

@ -805,17 +805,17 @@ bool MREA::CookPath(const hecl::ProjectPath& outPath,
{ {
PATH path = {}; PATH path = {};
path.version = 4; path.version = 4;
path.unkStructCount = 1; path.octreeNodeCount = 1;
path.unkStructs.emplace_back(); path.octree.emplace_back();
PATH::UnknownStruct& s = path.unkStructs.back(); PATH::OctreeNode& s = path.octree.back();
s.unk1 = 1; s.isLeaf = 1;
s.unk2[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX}; s.points[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX};
s.unk2[1] = atVec3f{-FLT_MAX, -FLT_MAX, -FLT_MAX}; s.points[1] = atVec3f{-FLT_MAX, -FLT_MAX, -FLT_MAX};
s.unk2[2] = atVec3f{0.f, 0.f, 0.f}; s.points[2] = atVec3f{0.f, 0.f, 0.f};
for (int i=0 ; i<8 ; ++i) for (int i=0 ; i<8 ; ++i)
s.unk3[i] = ~0; s.children[i] = 0xffffffff;
s.unk4 = 0; s.regionCount = 0;
s.unk5 = 0; s.regionStart = 0;
athena::io::FileWriter w(outPath.getAbsolutePath()); athena::io::FileWriter w(outPath.getAbsolutePath());
path.write(w); path.write(w);

View File

@ -9,64 +9,63 @@ struct PATH : BigDNA
{ {
DECL_DNA DECL_DNA
Value<atUint32> version; Value<atUint32> version;
struct Vertex : BigDNA
struct Node : BigDNA
{ {
DECL_DNA DECL_DNA
Value<atVec3f> position; Value<atVec3f> position;
Value<atVec3f> normal; Value<atVec3f> normal;
}; };
Value<atUint32> vertexCount; Value<atUint32> nodeCount;
Vector<Vertex, DNA_COUNT(vertexCount)> nodes; Vector<Node, DNA_COUNT(nodeCount)> nodes;
struct Edge : BigDNA
struct Link : BigDNA
{ {
DECL_DNA DECL_DNA
Value<atUint32> polyA; Value<atUint32> regionIdx;
Value<atUint32> polyB; Value<atUint32> nodeIdx;
Value<float> width1; Value<float> width2d;
Value<float> width2; Value<float> oneOverWidth2d;
}; };
Value<atUint32> linkCount;
Vector<Link, DNA_COUNT(linkCount)> links;
Value<atUint32> edgeCount; struct Region : BigDNA
Vector<Edge, DNA_COUNT(edgeCount)> edges;
struct Polygon : BigDNA
{ {
DECL_DNA DECL_DNA
Value<atUint32> vertCount; Value<atUint32> nodeCount;
Value<atUint32> vertStart; Value<atUint32> nodeStart;
Value<atUint32> edgeCount; Value<atUint32> linkCount;
Value<atUint32> edgeStart; Value<atUint32> linkStart;
Value<atUint32> flags; Value<atUint32> flags;
Value<float> area; Value<float> height;
Value<atVec3f> normal; Value<atVec3f> normal;
Value<atUint32> selfIdx1; Value<atUint32> regionIdx;
Value<atVec3f> center; Value<atVec3f> centroid;
Value<atVec3f> aabb[2]; Value<atVec3f> aabb[2];
Value<atUint32> selfIdx2; Value<atUint32> regionIdxPtr;
}; };
Value<atUint32> regionCount;
Vector<Region, DNA_COUNT(regionCount)> regions;
Value<atUint32> polyCount; Vector<atUint32, DNA_COUNT((((regionCount * (regionCount - 1)) / 2) + 31) / 32)> bitmap1;
Vector<Polygon, DNA_COUNT(polyCount)> polygons;
Vector<atUint32, DNA_COUNT((((polyCount * (polyCount - 1)) / 2) + 31) / 32)> bitmap1;
Vector<atUint32, DNA_COUNT(bitmap1.size())> bitmap2; Vector<atUint32, DNA_COUNT(bitmap1.size())> bitmap2;
Vector<atUint32, DNA_COUNT(((((polyCount * polyCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3; Vector<atUint32, DNA_COUNT(((((regionCount * regionCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3;
Value<atUint32> unkIntCount; Value<atUint32> octreeRegionLookupCount;
Vector<atUint32, DNA_COUNT(unkIntCount)> unkInts; Vector<atUint32, DNA_COUNT(octreeRegionLookupCount)> octreeRegionLookup;
struct UnknownStruct : BigDNA struct OctreeNode : BigDNA
{ {
DECL_DNA DECL_DNA
Value<atUint32> unk1; Value<atUint32> isLeaf;
Value<atVec3f> unk2[3]; Value<atVec3f> points[3];
Value<atUint32> unk3[8]; // Usually 0xFF Value<atUint32> children[8];
Value<atUint32> unk4; Value<atUint32> regionCount;
Value<atUint32> unk5; Value<atUint32> regionStart;
}; };
Value<atUint32> octreeNodeCount;
Value<atUint32> unkStructCount; Vector<OctreeNode, DNA_COUNT(octreeNodeCount)> octree;
Vector<UnknownStruct, DNA_COUNT(unkStructCount)> unkStructs;
}; };
} }

View File

@ -28,6 +28,7 @@
#include "Runtime/AutoMapper/CMapArea.hpp" #include "Runtime/AutoMapper/CMapArea.hpp"
#include "Runtime/AutoMapper/CMapUniverse.hpp" #include "Runtime/AutoMapper/CMapUniverse.hpp"
#include "Runtime/CScannableObjectInfo.hpp" #include "Runtime/CScannableObjectInfo.hpp"
#include "Runtime/World/CPathFindArea.hpp"
#include "Audio/CAudioGroupSet.hpp" #include "Audio/CAudioGroupSet.hpp"
#include "Audio/CSfxManager.hpp" #include "Audio/CSfxManager.hpp"
#include "Audio/CMidiManager.hpp" #include "Audio/CMidiManager.hpp"
@ -77,6 +78,7 @@ ProjectResourceFactoryMP1::ProjectResourceFactoryMP1(hecl::ClientProcess& client
m_factoryMgr.AddFactory(FOURCC('DPSC'), FFactoryFunc(FDecalDataFactory)); m_factoryMgr.AddFactory(FOURCC('DPSC'), FFactoryFunc(FDecalDataFactory));
m_factoryMgr.AddFactory(FOURCC('MAPA'), FFactoryFunc(FMapAreaFactory)); m_factoryMgr.AddFactory(FOURCC('MAPA'), FFactoryFunc(FMapAreaFactory));
m_factoryMgr.AddFactory(FOURCC('MAPU'), FFactoryFunc(FMapUniverseFactory)); m_factoryMgr.AddFactory(FOURCC('MAPU'), FFactoryFunc(FMapUniverseFactory));
m_factoryMgr.AddFactory(FOURCC('PATH'), FMemFactoryFunc(FPathFindAreaFactory));
} }
void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj, CSimplePool& sp) void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj, CSimplePool& sp)

View File

@ -17,10 +17,9 @@ set(WORLD_SOURCES
CPatterned.hpp CPatterned.cpp CPatterned.hpp CPatterned.cpp
CPathFindArea.hpp CPathFindArea.cpp CPathFindArea.hpp CPathFindArea.cpp
CPathFindRegion.hpp CPathFindRegion.cpp CPathFindRegion.hpp CPathFindRegion.cpp
CPathFindSearch.hpp CPathFindSearch.cpp
CPathFindSpline.hpp CPathFindSpline.cpp
CPathFindDraw.hpp CPathFindDraw.cpp CPathFindDraw.hpp CPathFindDraw.cpp
CPathFindAreaOctree.hpp CPathFindAreaOctree.cpp
CPathFindOpenList.hpp CPathFindOpenList.cpp
CPathFindLink.hpp CPathFindLink.cpp
CPhysicsActor.hpp CPhysicsActor.cpp CPhysicsActor.hpp CPhysicsActor.cpp
CEntity.hpp CEntity.cpp CEntity.hpp CEntity.cpp
CPhysicsActor.hpp CPhysicsActor.cpp CPhysicsActor.hpp CPhysicsActor.cpp

View File

@ -4,14 +4,108 @@
namespace urde namespace urde
{ {
CPFArea::CPFArea(const std::unique_ptr<u8[]>&& buf, int len)
CPFAreaOctree::CPFAreaOctree(CMemoryInStream& in)
{ {
x0_isLeaf = in.readUint32Big();
for (int i=0 ; i<3 ; ++i)
x4_points[i] = in.readVec3fBig();
for (int i=0 ; i<8 ; ++i)
x28_children[i] = reinterpret_cast<CPFAreaOctree*>(in.readUint32Big());
x48_regionCount = in.readUint32Big();
x4c_regions = reinterpret_cast<CPFRegion**>(in.readUint32Big());
} }
std::unique_ptr<IObj> FPathFindAreaFactory(const SObjectTag& /*tag*/, const std::unique_ptr<u8[]>& buf, void CPFAreaOctree::Fixup(CPFArea& area)
const CVParamTransfer &xfer)
{ {
return TToken<CPFArea>::GetIObjObjectFor( x0_isLeaf = x0_isLeaf != 0 ? 1 : 0;
std::make_unique<CPFArea>(std::move(buf), *reinterpret_cast<int*>(xfer.GetObj()))); if (x0_isLeaf)
{
if (!x48_regionCount)
return;
x4c_regions = &area.x160_octreeRegionLookup[reinterpret_cast<uintptr_t>(x4c_regions)];
return;
}
for (int i=0 ; i<8 ; ++i)
{
if ((reinterpret_cast<uintptr_t>(x28_children[i]) & 0x80000000) == 0)
x28_children[i] = &area.x158_octree[reinterpret_cast<uintptr_t>(x28_children[i])];
else
x28_children[i] = nullptr;
}
}
CPFOpenList::CPFOpenList()
{
}
void CPFOpenList::Clear()
{
}
CPFArea::CPFArea(std::unique_ptr<u8[]>&& buf, u32 len)
{
CMemoryInStream r(buf.get(), len);
u32 numNodes = r.readUint32Big();
x140_nodes.reserve(numNodes);
for (u32 i=0 ; i<numNodes ; ++i)
x140_nodes.emplace_back(r);
u32 numLinks = r.readUint32Big();
x148_links.reserve(numLinks);
for (u32 i=0 ; i<numLinks ; ++i)
x148_links.emplace_back(r);
u32 numRegions = r.readUint32Big();
x150_regions.reserve(numRegions);
for (u32 i=0 ; i<numRegions ; ++i)
x150_regions.emplace_back(r);
x178_regionDatas.resize(numRegions);
u32 maxRegionNodes = 0;
for (CPFRegion& region : x150_regions)
region.Fixup(*this, maxRegionNodes);
maxRegionNodes = std::max(maxRegionNodes, 4u);
x10_.reserve(maxRegionNodes);
u32 numBitfieldWords = (numRegions * (numRegions - 1) / 2 + 31) / 32;
x168_connectionsA.reserve(numBitfieldWords);
for (u32 i=0 ; i<numBitfieldWords ; ++i)
x168_connectionsA.push_back(r.readUint32Big());
x170_connectionsB.reserve(numBitfieldWords);
for (u32 i=0 ; i<numBitfieldWords ; ++i)
x170_connectionsB.push_back(r.readUint32Big());
r.seek(((((numRegions * numRegions) + 31) / 32) - numBitfieldWords) * 2 * sizeof(u32));
u32 numRegionLookups = r.readUint32Big();
x160_octreeRegionLookup.reserve(numRegionLookups);
for (u32 i=0 ; i<numRegionLookups ; ++i)
x160_octreeRegionLookup.push_back(reinterpret_cast<CPFRegion*>(r.readUint32Big()));
for (CPFRegion*& rl : x160_octreeRegionLookup)
rl = &x150_regions[reinterpret_cast<uintptr_t>(rl)];
u32 numOctreeNodes = r.readUint32Big();
x158_octree.reserve(numOctreeNodes);
for (u32 i=0 ; i<numOctreeNodes ; ++i)
x158_octree.emplace_back(r);
for (CPFAreaOctree& node : x158_octree)
node.Fixup(*this);
}
CFactoryFnReturn FPathFindAreaFactory(const urde::SObjectTag& tag,
std::unique_ptr<u8[]>&& in, u32 len,
const urde::CVParamTransfer& vparms,
CObjectReference* selfRef)
{
return TToken<CPFArea>::GetIObjObjectFor(std::make_unique<CPFArea>(std::move(in), len));
} }
} }

View File

@ -4,11 +4,13 @@
#include "IObj.hpp" #include "IObj.hpp"
#include "zeus/CTransform.hpp" #include "zeus/CTransform.hpp"
#include "zeus/CAABox.hpp" #include "zeus/CAABox.hpp"
#include "CPathFindOpenList.hpp" #include "IFactory.hpp"
#include "CPathFindRegion.hpp"
namespace urde namespace urde
{ {
class CVParamTransfer; class CVParamTransfer;
class CObjectReference;
class CPFBitSet class CPFBitSet
{ {
@ -20,25 +22,65 @@ public:
void Rmv(s32); void Rmv(s32);
}; };
class CPFNode class CPFAreaOctree
{ {
zeus::CVector3f x0_position; u32 x0_isLeaf;
zeus::CVector3f xc_normal; zeus::CVector3f x4_points[3];
CPFAreaOctree* x28_children[8];
u32 x48_regionCount;
CPFRegion** x4c_regions;
public: public:
const zeus::CVector3f& GetPos() const { return x0_position; } CPFAreaOctree(CMemoryInStream& in);
const zeus::CVector3f& GetNormal() const { return xc_normal; } void Fixup(CPFArea& area);
void GetChildIndex(const zeus::CVector3f&) const;
void GetRegionList(const zeus::CVector3f&) const;
//void GetRegionListList(rstl::reserved_vector<rstl::prereserved_vector<CPFRegion>, 32>, const zeus::CVector3f&, float);
bool IsPointInPaddedAABox(const zeus::CVector3f&, float);
void Render();
}; };
class CPFAreaOctree; class CPFOpenList
class CPFArea
{ {
float x0_ = FLT_MAX; friend class CPFArea;
zeus::CVector3f x4_; u32 x0_ = 0;
std::vector<zeus::CVector3f> x10_; u32 x4_ = 0;
u32 x8_ = 0;
u32 xc_ = 0;
u32 x10_ = 0;
u32 x14_ = 0;
u32 x18_ = 0;
u32 x1c_ = 0;
u32 x20_ = 0; u32 x20_ = 0;
u32 x24_ = 0; u32 x24_ = 0;
u32 x28_ = 0; u32 x28_ = 0;
u32 x2c_ = 0; u32 x2c_ = 0;
u32 x30_ = 0;
u32 x34_ = 0;
u32 x38_ = 0;
u32 x3c_ = 0;
CPFRegion x40_region;
CPFRegionData x90_regionData;
public:
CPFOpenList();
void Clear();
void Push(CPFRegion*);
void Pop();
void Pop(CPFRegion*);
void Test(CPFRegion*);
};
class CPFArea
{
friend class CPFRegion;
friend class CPFAreaOctree;
float x0_ = FLT_MAX;
zeus::CVector3f x4_;
std::vector<zeus::CVector3f> x10_;
u32 x20_ = 0;
zeus::CVector3f x24_;
bool x30_ = false; bool x30_ = false;
u32 x34_ = 0; u32 x34_ = 0;
u32 x38_ = 0; u32 x38_ = 0;
@ -59,31 +101,30 @@ class CPFArea
u32 x74_ = 0; u32 x74_ = 0;
CPFOpenList x78_; CPFOpenList x78_;
u32 x138_; u32 x138_;
std::unique_ptr<u8[]> x13c_data = nullptr; //std::unique_ptr<u8[]> x13c_data;
std::vector<CPFNode> x140_nodes; std::vector<CPFNode> x140_nodes; // x140: count, x144: ptr
/*std::vector<> x150_;*/ std::vector<CPFLink> x148_links; // x148: count, x14c: ptr
u32 x160_ = 0; std::vector<CPFRegion> x150_regions; // x150: count, x154: ptr
u32 x164_ = 0; std::vector<CPFAreaOctree> x158_octree; // x158: count, x15c: ptr
u32 x168_ = 0; std::vector<CPFRegion*> x160_octreeRegionLookup; // x160: count, x164: ptr
u32 x16c_ = 0; std::vector<u32> x168_connectionsA; // x168: word_count, x16c: ptr
u32 x170_ = 0; std::vector<u32> x170_connectionsB; // x170: word_count, x174: ptr
u32 x174_ = 0; std::vector<CPFRegionData> x178_regionDatas;
std::vector<CPFRegionData> x178_;
zeus::CTransform x188_transform; zeus::CTransform x188_transform;
public: public:
CPFArea(const std::unique_ptr<u8[]>&& buf, int len); CPFArea(std::unique_ptr<u8[]>&& buf, u32 len);
void SetTransform(const zeus::CTransform& xf) { x188_transform = xf; } void SetTransform(const zeus::CTransform& xf) { x188_transform = xf; }
const zeus::CTransform& GetTransform() const { return x188_transform; } const zeus::CTransform& GetTransform() const { return x188_transform; }
CPFRegion* GetRegion(s32) const { return nullptr; } const CPFRegion& GetRegion(s32 i) const { return x150_regions[i]; }
void GetClosestPoint() const; void GetClosestPoint() const;
void OpenList(); void OpenList();
void ClosedSet(); void ClosedSet();
CPFRegionData* GetRegionData() const; const CPFRegionData& GetRegionData(s32 i) const { return x178_regionDatas[i]; }
CPFLink* GetLink(s32); const CPFLink& GetLink(s32 i) const { return x148_links[i]; }
CPFNode* GetNode(s32) const; const CPFNode& GetNode(s32 i) const { return x140_nodes[i]; }
CPFAreaOctree* GetOctree(s32); const CPFAreaOctree& GetOctree(s32 i) const { return x158_octree[i]; }
void GetOctreeRegionPtrs(s32); const CPFRegion* GetOctreeRegionPtrs(s32 i) const { return x160_octreeRegionLookup[i]; }
void GetOctreeRegionList(const zeus::CVector3f&); void GetOctreeRegionList(const zeus::CVector3f&);
void FindRegions(rstl::reserved_vector<CPFRegion, 4>&, const zeus::CVector3f&, u32); void FindRegions(rstl::reserved_vector<CPFRegion, 4>&, const zeus::CVector3f&, u32);
void FindClosestRegion(const zeus::CVector3f&, u32, float); void FindClosestRegion(const zeus::CVector3f&, u32, float);
@ -91,7 +132,10 @@ public:
}; };
std::unique_ptr<IObj> FPathFindAreaFactory(const SObjectTag& /*tag*/, const std::unique_ptr<u8[]>& buf, const CVParamTransfer& xfer); CFactoryFnReturn FPathFindAreaFactory(const urde::SObjectTag& tag,
std::unique_ptr<u8[]>&& in, u32 len,
const urde::CVParamTransfer& vparms,
CObjectReference* selfRef);
} }
#endif // CPATHFINDAREA_HPP #endif // CPATHFINDAREA_HPP

View File

@ -1,23 +0,0 @@
#ifndef __URDE_CPATHFINDAREAOCTREE_HPP__
#define __URDE_CPATHFINDAREAOCTREE_HPP__
#include "rstl.hpp"
#include "CPathFindRegion.hpp"
#include "zeus/CVector3f.hpp"
namespace urde
{
class CPFArea;
class CPFAreaOctree
{
public:
void Fixup(CPFArea&);
void GetChildIndex(const zeus::CVector3f&) const;
void GetRegionList(const zeus::CVector3f&) const;
void GetRegionListList(rstl::reserved_vector<rstl::prereserved_vector<CPFRegion>, 32>, const zeus::CVector3f&, float);
bool IsPointInPaddedAABox(const zeus::CVector3f&, float);
void Render();
};
}
#endif // __URDE_CPATHFINDAREAOCTREE_HPP__

View File

@ -1,18 +0,0 @@
#ifndef __URDE_CPATHFINDLINK_HPP__
#define __URDE_CPATHFINDLINK_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CPFLink
{
public:
void GetRegion() const;
void GetNode() const;
void Get2dWidth() const;
void GetOO2dWidth() const;
};
}
#endif // __URDE_CPATHFINDLINK_HPP__

View File

@ -1,8 +0,0 @@
#include "CPathFindOpenList.hpp"
namespace urde
{
CPFOpenList::CPFOpenList()
{}
void CPFOpenList::Clear() {}
}

View File

@ -1,42 +0,0 @@
#ifndef __URDE_CPATHFINDOPENLIST_HPP__
#define __URDE_CPATHFINDOPENLIST_HPP__
#include "RetroTypes.hpp"
#include "CPathFindRegion.hpp"
namespace urde
{
class CPFOpenList
{
friend class CPFArea;
u32 x0_ = 0;
u32 x4_ = 0;
u32 x8_ = 0;
u32 xc_ = 0;
u32 x10_ = 0;
u32 x14_ = 0;
u32 x18_ = 0;
u32 x1c_ = 0;
u32 x20_ = 0;
u32 x24_ = 0;
u32 x28_ = 0;
u32 x2c_ = 0;
u32 x30_ = 0;
u32 x34_ = 0;
u32 x38_ = 0;
u32 x3c_ = 0;
CPFRegion x40_region;
CPFRegionData x90_regionData;
public:
CPFOpenList();
void Clear();
void Push(CPFRegion*);
void Pop();
void Pop(CPFRegion*);
void Test(CPFRegion*);
};
}
#endif // __URDE_CPATHFINDOPENLIST_HPP__

View File

@ -3,15 +3,49 @@
namespace urde namespace urde
{ {
void CPFRegion::Fixup(CPFArea& area, s32& r5)
CPFNode::CPFNode(CMemoryInStream& in)
{ {
x0_position.readBig(in);
xc_normal.readBig(in);
}
CPFLink::CPFLink(CMemoryInStream& in)
{
x0_region = in.readUint32Big();
x4_node = in.readUint32Big();
x8_2dWidth = in.readFloatBig();
xc_oo2dWidth = in.readFloatBig();
}
CPFRegion::CPFRegion(CMemoryInStream& in)
{
x0_numNodes = in.readUint32Big();
x4_startNode = reinterpret_cast<CPFNode*>(in.readUint32Big());
x8_numLinks = in.readUint32Big();
xc_startLink = reinterpret_cast<CPFLink*>(in.readUint32Big());
x10_flags = in.readUint32Big();
x14_height = in.readFloatBig();
x18_normal.readBig(in);
x24_regionIdx = in.readUint32Big();
x28_centroid.readBig(in);
x34_aabb.readBoundingBoxBig(in);
x4c_regionData = reinterpret_cast<CPFRegionData*>(in.readUint32Big());
}
void CPFRegion::Fixup(CPFArea& area, u32& maxRegionNodes)
{
if (x0_numNodes)
x4_startNode = &area.x140_nodes[reinterpret_cast<uintptr_t>(x4_startNode)];
else
x4_startNode = nullptr;
if (x8_numLinks)
xc_startLink = &area.x148_links[reinterpret_cast<uintptr_t>(xc_startLink)];
else
xc_startLink = nullptr;
x4c_regionData = &area.x178_regionDatas[x24_regionIdx];
if (x0_numNodes > maxRegionNodes)
maxRegionNodes = x0_numNodes;
} }
void CPFRegionData::SetOpenLess(CPFRegion* region) { x24_openLess = region; }
void CPFRegionData::SetOpenMore(CPFRegion* region) { x28_openMore = region; }
CPFRegion* CPFRegionData::GetOpenLess() { return x24_openLess; }
CPFRegion* CPFRegionData::GetOpenMore() { return x28_openMore; }
} }

View File

@ -9,39 +9,65 @@ namespace urde
class CPFArea; class CPFArea;
class CPFLink; class CPFLink;
class CPFRegionData; class CPFRegionData;
class CPFNode
{
zeus::CVector3f x0_position;
zeus::CVector3f xc_normal;
public:
CPFNode(CMemoryInStream& in);
const zeus::CVector3f& GetPos() const { return x0_position; }
const zeus::CVector3f& GetNormal() const { return xc_normal; }
};
class CPFLink
{
u32 x0_region;
u32 x4_node;
float x8_2dWidth;
float xc_oo2dWidth;
public:
CPFLink(CMemoryInStream& in);
u32 GetRegion() const { return x0_region; }
u32 GetNode() const { return x4_node; }
float Get2dWidth() const { return x8_2dWidth; }
float GetOO2dWidth() const { return xc_oo2dWidth; }
};
class CPFRegion class CPFRegion
{ {
u32 x0_ = 0; u32 x0_numNodes = 0;
u32 x4_ = 0; CPFNode* x4_startNode = nullptr;
u32 x8_ = 0; u32 x8_numLinks = 0;
u32 xc_ = 0; CPFLink* xc_startLink = nullptr;
u32 x10_ = 0; u32 x10_flags = 0;
float x14_ = 0.f; float x14_height = 0.f;
zeus::CVector3f x18_; zeus::CVector3f x18_normal;
u32 x24_ = 0; u32 x24_regionIdx = 0;
zeus::CVector3f x28_; zeus::CVector3f x28_centroid;
zeus::CAABox x34_; zeus::CAABox x34_aabb;
u32 x4c_; CPFRegionData* x4c_regionData;
public: public:
CPFRegion() = default; CPFRegion() = default;
void SetData(CPFRegionData*) {} CPFRegion(CMemoryInStream& in);
CPFRegionData* Data() const; void SetData(CPFRegionData* data) { x4c_regionData = data; }
CPFRegionData* Data() const { return x4c_regionData; }
void GetIndex() const; void GetIndex() const;
float GetHeight() const; float GetHeight() const { return x14_height; }
void GetPathLink() const; void GetPathLink() const {}
void GetNumLinks() const; u32 GetNumLinks() const { return x8_numLinks; }
void GetFlags() const; u32 GetFlags() const { return x10_flags; }
void GetLink(s32) const; const CPFLink* GetLink(u32 i) const { return xc_startLink + i; }
void SetCentroid(const zeus::CVector3f&); void SetCentroid(const zeus::CVector3f&);
zeus::CVector3f GetCentroid() const; const zeus::CVector3f& GetCentroid() const { return x28_centroid; }
void Fixup(CPFArea&, s32&); void Fixup(CPFArea& area, u32& maxRegionNodes);
bool IsPointInside(const zeus::CVector3f&); bool IsPointInside(const zeus::CVector3f&);
zeus::CVector3f GetNormal(); const zeus::CVector3f& GetNormal() const { return x18_normal; }
s32 GetNumNodes() const; u32 GetNumNodes() const { return x0_numNodes; }
void GetNode(s32) const; const CPFNode* GetNode(u32 i) const { return x4_startNode + i; }
void PointHeight(const zeus::CVector3f&); void PointHeight(const zeus::CVector3f&);
void FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>&, const zeus::CVector3f&, const zeus::CVector3f&, void FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>&, const zeus::CVector3f&,
bool); const zeus::CVector3f&, bool);
void FindBestPoint(std::vector<zeus::CVector3f>&, const zeus::CVector3f&, u32, float); void FindBestPoint(std::vector<zeus::CVector3f>&, const zeus::CVector3f&, u32, float);
void SetLinkTo(s32); void SetLinkTo(s32);
void DropToGround(zeus::CVector3f&) const; void DropToGround(zeus::CVector3f&) const;
@ -64,10 +90,10 @@ class CPFRegionData
public: public:
CPFRegionData() = default; CPFRegionData() = default;
void SetOpenLess(CPFRegion*); void SetOpenLess(CPFRegion* r) { x24_openLess = r; }
void SetOpenMore(CPFRegion*); void SetOpenMore(CPFRegion* r) { x28_openMore = r; }
CPFRegion* GetOpenLess(); CPFRegion* GetOpenLess() const { return x24_openLess; }
CPFRegion* GetOpenMore(); CPFRegion* GetOpenMore() const { return x28_openMore; }
void GetCost(); void GetCost();
void GetPathLink() const; void GetPathLink() const;
void GetParent() const; void GetParent() const;

View File

@ -0,0 +1,12 @@
#include "CPathFindSearch.hpp"
namespace urde
{
CPathFindSearch::CPathFindSearch(CPFArea* area, u32 w1, u32 w2, float f1, float f2)
: x0_area(area), xd0_f2(f2), xd4_f1(f1), xdc_w1(w1), xe0_w2(1u << w2)
{
}
}

View File

@ -0,0 +1,26 @@
#ifndef __URDE_CPATHFINDSEARCH_HPP__
#define __URDE_CPATHFINDSEARCH_HPP__
#include "RetroTypes.hpp"
#include "CPathFindArea.hpp"
namespace urde
{
class CPathFindSearch
{
CPFArea* x0_area;
u32 x4_ = 0;
u32 xc8_ = 0;
float xd0_f2;
float xd4_f1;
float xd8_ = 10.f;
u32 xdc_w1;
u32 xe0_w2;
public:
CPathFindSearch(CPFArea* area, u32 w1, u32 w2, float f1, float f2);
};
}
#endif // __URDE_CPATHFINDSEARCH_HPP__

View File

@ -0,0 +1,14 @@
#ifndef __URDE_CPATHFINDSPLINE_HPP__
#define __URDE_CPATHFINDSPLINE_HPP__
namespace urde
{
class CPathFindSpline
{
};
}
#endif // __URDE_CPATHFINDSPLINE_HPP__

View File

@ -26,7 +26,7 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount)
, xc8_height(in.readFloatBig()) , xc8_height(in.readFloatBig())
, xcc_bodyOrigin(zeus::CVector3f::ReadBig(in)) , xcc_bodyOrigin(zeus::CVector3f::ReadBig(in))
, xd8_stepUpHeight(in.readFloatBig()) , xd8_stepUpHeight(in.readFloatBig())
, xdc_(in.readFloatBig()) , xdc_xDamage(in.readFloatBig())
, xe0_(in.readFloatBig()) , xe0_(in.readFloatBig())
, xe4_(in.readFloatBig()) , xe4_(in.readFloatBig())
, xe8_deathSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) , xe8_deathSfx(CSfxManager::TranslateSFXID(in.readUint32Big()))

View File

@ -35,7 +35,7 @@ class CPatternedInfo
float xc8_height; float xc8_height;
zeus::CVector3f xcc_bodyOrigin; zeus::CVector3f xcc_bodyOrigin;
float xd8_stepUpHeight; float xd8_stepUpHeight;
float xdc_; float xdc_xDamage;
float xe0_; float xe0_;
float xe4_; float xe4_;
u16 xe8_deathSfx; u16 xe8_deathSfx;
@ -52,9 +52,9 @@ class CPatternedInfo
u32 x120_particle2Frames; u32 x120_particle2Frames;
zeus::CVector3f x124_particle2Scale; zeus::CVector3f x124_particle2Scale;
CAssetId x130_particle2 = -1; CAssetId x130_particle2;
u16 x134_iceShatterSfx = -1; u16 x134_iceShatterSfx = 0xffff;
public: public:
CPatternedInfo(CInputStream& in, u32 pcount); CPatternedInfo(CInputStream& in, u32 pcount);

@ -1 +1 @@
Subproject commit 28680c1636036eb2c0e45c7a8934d0687090e870 Subproject commit 7488e8cbc504be018bd29e8993c39eea4cb30ff8