From 98518e7d44dcd9b2693b7b9997f8046278b7b75a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 13 Feb 2018 21:51:18 -1000 Subject: [PATCH] Implement CPFArea constructor --- DataSpec/DNAMP1/MREA.cpp | 20 ++--- DataSpec/DNAMP1/PATH.hpp | 71 +++++++++--------- Editor/ProjectResourceFactoryMP1.cpp | 2 + Runtime/World/CMakeLists.txt | 5 +- Runtime/World/CPathFindArea.cpp | 104 ++++++++++++++++++++++++-- Runtime/World/CPathFindArea.hpp | 102 ++++++++++++++++++------- Runtime/World/CPathFindAreaOctree.cpp | 0 Runtime/World/CPathFindAreaOctree.hpp | 23 ------ Runtime/World/CPathFindLink.cpp | 0 Runtime/World/CPathFindLink.hpp | 18 ----- Runtime/World/CPathFindOpenList.cpp | 8 -- Runtime/World/CPathFindOpenList.hpp | 42 ----------- Runtime/World/CPathFindRegion.cpp | 50 +++++++++++-- Runtime/World/CPathFindRegion.hpp | 84 ++++++++++++++------- Runtime/World/CPathFindSearch.cpp | 12 +++ Runtime/World/CPathFindSearch.hpp | 26 +++++++ Runtime/World/CPathFindSpline.hpp | 14 ++++ Runtime/World/CPatternedInfo.cpp | 2 +- Runtime/World/CPatternedInfo.hpp | 6 +- hecl-gui | 2 +- 20 files changed, 375 insertions(+), 216 deletions(-) delete mode 100644 Runtime/World/CPathFindAreaOctree.cpp delete mode 100644 Runtime/World/CPathFindAreaOctree.hpp delete mode 100644 Runtime/World/CPathFindLink.cpp delete mode 100644 Runtime/World/CPathFindLink.hpp delete mode 100644 Runtime/World/CPathFindOpenList.cpp delete mode 100644 Runtime/World/CPathFindOpenList.hpp diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index f8e0b49d2..08ee60943 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -805,17 +805,17 @@ bool MREA::CookPath(const hecl::ProjectPath& outPath, { PATH path = {}; path.version = 4; - path.unkStructCount = 1; - path.unkStructs.emplace_back(); - PATH::UnknownStruct& s = path.unkStructs.back(); - s.unk1 = 1; - s.unk2[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX}; - s.unk2[1] = atVec3f{-FLT_MAX, -FLT_MAX, -FLT_MAX}; - s.unk2[2] = atVec3f{0.f, 0.f, 0.f}; + path.octreeNodeCount = 1; + path.octree.emplace_back(); + PATH::OctreeNode& s = path.octree.back(); + s.isLeaf = 1; + s.points[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX}; + s.points[1] = atVec3f{-FLT_MAX, -FLT_MAX, -FLT_MAX}; + s.points[2] = atVec3f{0.f, 0.f, 0.f}; for (int i=0 ; i<8 ; ++i) - s.unk3[i] = ~0; - s.unk4 = 0; - s.unk5 = 0; + s.children[i] = 0xffffffff; + s.regionCount = 0; + s.regionStart = 0; athena::io::FileWriter w(outPath.getAbsolutePath()); path.write(w); diff --git a/DataSpec/DNAMP1/PATH.hpp b/DataSpec/DNAMP1/PATH.hpp index 4b015c74b..7ae59c25f 100644 --- a/DataSpec/DNAMP1/PATH.hpp +++ b/DataSpec/DNAMP1/PATH.hpp @@ -9,64 +9,63 @@ struct PATH : BigDNA { DECL_DNA Value version; - struct Vertex : BigDNA + + struct Node : BigDNA { DECL_DNA Value position; Value normal; }; - Value vertexCount; - Vector nodes; - struct Edge : BigDNA + Value nodeCount; + Vector nodes; + + struct Link : BigDNA { DECL_DNA - Value polyA; - Value polyB; - Value width1; - Value width2; + Value regionIdx; + Value nodeIdx; + Value width2d; + Value oneOverWidth2d; }; + Value linkCount; + Vector links; - Value edgeCount; - Vector edges; - - struct Polygon : BigDNA + struct Region : BigDNA { DECL_DNA - Value vertCount; - Value vertStart; - Value edgeCount; - Value edgeStart; + Value nodeCount; + Value nodeStart; + Value linkCount; + Value linkStart; Value flags; - Value area; + Value height; Value normal; - Value selfIdx1; - Value center; + Value regionIdx; + Value centroid; Value aabb[2]; - Value selfIdx2; + Value regionIdxPtr; }; + Value regionCount; + Vector regions; - Value polyCount; - Vector polygons; - - Vector bitmap1; + Vector bitmap1; Vector bitmap2; - Vector bitmap3; + Vector bitmap3; - Value unkIntCount; - Vector unkInts; + Value octreeRegionLookupCount; + Vector octreeRegionLookup; - struct UnknownStruct : BigDNA + struct OctreeNode : BigDNA { DECL_DNA - Value unk1; - Value unk2[3]; - Value unk3[8]; // Usually 0xFF - Value unk4; - Value unk5; + Value isLeaf; + Value points[3]; + Value children[8]; + Value regionCount; + Value regionStart; }; - - Value unkStructCount; - Vector unkStructs; + Value octreeNodeCount; + Vector octree; }; } diff --git a/Editor/ProjectResourceFactoryMP1.cpp b/Editor/ProjectResourceFactoryMP1.cpp index a3fbfc369..80c4c6475 100644 --- a/Editor/ProjectResourceFactoryMP1.cpp +++ b/Editor/ProjectResourceFactoryMP1.cpp @@ -28,6 +28,7 @@ #include "Runtime/AutoMapper/CMapArea.hpp" #include "Runtime/AutoMapper/CMapUniverse.hpp" #include "Runtime/CScannableObjectInfo.hpp" +#include "Runtime/World/CPathFindArea.hpp" #include "Audio/CAudioGroupSet.hpp" #include "Audio/CSfxManager.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('MAPA'), FFactoryFunc(FMapAreaFactory)); m_factoryMgr.AddFactory(FOURCC('MAPU'), FFactoryFunc(FMapUniverseFactory)); + m_factoryMgr.AddFactory(FOURCC('PATH'), FMemFactoryFunc(FPathFindAreaFactory)); } void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj, CSimplePool& sp) diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 51be0f4b0..faba5148b 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -17,10 +17,9 @@ set(WORLD_SOURCES CPatterned.hpp CPatterned.cpp CPathFindArea.hpp CPathFindArea.cpp CPathFindRegion.hpp CPathFindRegion.cpp + CPathFindSearch.hpp CPathFindSearch.cpp + CPathFindSpline.hpp CPathFindSpline.cpp CPathFindDraw.hpp CPathFindDraw.cpp - CPathFindAreaOctree.hpp CPathFindAreaOctree.cpp - CPathFindOpenList.hpp CPathFindOpenList.cpp - CPathFindLink.hpp CPathFindLink.cpp CPhysicsActor.hpp CPhysicsActor.cpp CEntity.hpp CEntity.cpp CPhysicsActor.hpp CPhysicsActor.cpp diff --git a/Runtime/World/CPathFindArea.cpp b/Runtime/World/CPathFindArea.cpp index fdfc7192c..5ea8ad5bf 100644 --- a/Runtime/World/CPathFindArea.cpp +++ b/Runtime/World/CPathFindArea.cpp @@ -4,14 +4,108 @@ namespace urde { -CPFArea::CPFArea(const std::unique_ptr&& 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(in.readUint32Big()); + x48_regionCount = in.readUint32Big(); + x4c_regions = reinterpret_cast(in.readUint32Big()); } -std::unique_ptr FPathFindAreaFactory(const SObjectTag& /*tag*/, const std::unique_ptr& buf, - const CVParamTransfer &xfer) +void CPFAreaOctree::Fixup(CPFArea& area) { - return TToken::GetIObjObjectFor( - std::make_unique(std::move(buf), *reinterpret_cast(xfer.GetObj()))); + x0_isLeaf = x0_isLeaf != 0 ? 1 : 0; + if (x0_isLeaf) + { + if (!x48_regionCount) + return; + x4c_regions = &area.x160_octreeRegionLookup[reinterpret_cast(x4c_regions)]; + return; + } + + for (int i=0 ; i<8 ; ++i) + { + if ((reinterpret_cast(x28_children[i]) & 0x80000000) == 0) + x28_children[i] = &area.x158_octree[reinterpret_cast(x28_children[i])]; + else + x28_children[i] = nullptr; + } +} + +CPFOpenList::CPFOpenList() +{ + +} + +void CPFOpenList::Clear() +{ + +} + +CPFArea::CPFArea(std::unique_ptr&& buf, u32 len) +{ + CMemoryInStream r(buf.get(), len); + + u32 numNodes = r.readUint32Big(); + x140_nodes.reserve(numNodes); + for (u32 i=0 ; i(r.readUint32Big())); + + for (CPFRegion*& rl : x160_octreeRegionLookup) + rl = &x150_regions[reinterpret_cast(rl)]; + + u32 numOctreeNodes = r.readUint32Big(); + x158_octree.reserve(numOctreeNodes); + for (u32 i=0 ; i&& in, u32 len, + const urde::CVParamTransfer& vparms, + CObjectReference* selfRef) +{ + return TToken::GetIObjObjectFor(std::make_unique(std::move(in), len)); } } diff --git a/Runtime/World/CPathFindArea.hpp b/Runtime/World/CPathFindArea.hpp index fde400ba8..9c6282249 100644 --- a/Runtime/World/CPathFindArea.hpp +++ b/Runtime/World/CPathFindArea.hpp @@ -4,11 +4,13 @@ #include "IObj.hpp" #include "zeus/CTransform.hpp" #include "zeus/CAABox.hpp" -#include "CPathFindOpenList.hpp" +#include "IFactory.hpp" +#include "CPathFindRegion.hpp" namespace urde { class CVParamTransfer; +class CObjectReference; class CPFBitSet { @@ -20,25 +22,65 @@ public: void Rmv(s32); }; -class CPFNode +class CPFAreaOctree { - zeus::CVector3f x0_position; - zeus::CVector3f xc_normal; + u32 x0_isLeaf; + zeus::CVector3f x4_points[3]; + CPFAreaOctree* x28_children[8]; + u32 x48_regionCount; + CPFRegion** x4c_regions; public: - const zeus::CVector3f& GetPos() const { return x0_position; } - const zeus::CVector3f& GetNormal() const { return xc_normal; } + CPFAreaOctree(CMemoryInStream& in); + void Fixup(CPFArea& area); + void GetChildIndex(const zeus::CVector3f&) const; + void GetRegionList(const zeus::CVector3f&) const; + //void GetRegionListList(rstl::reserved_vector, 32>, const zeus::CVector3f&, float); + bool IsPointInPaddedAABox(const zeus::CVector3f&, float); + void Render(); }; -class CPFAreaOctree; -class CPFArea +class CPFOpenList { - float x0_ = FLT_MAX; - zeus::CVector3f x4_; - std::vector x10_; + 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*); +}; + +class CPFArea +{ + friend class CPFRegion; + friend class CPFAreaOctree; + + float x0_ = FLT_MAX; + zeus::CVector3f x4_; + std::vector x10_; + u32 x20_ = 0; + zeus::CVector3f x24_; bool x30_ = false; u32 x34_ = 0; u32 x38_ = 0; @@ -59,31 +101,30 @@ class CPFArea u32 x74_ = 0; CPFOpenList x78_; u32 x138_; - std::unique_ptr x13c_data = nullptr; - std::vector x140_nodes; - /*std::vector<> x150_;*/ - u32 x160_ = 0; - u32 x164_ = 0; - u32 x168_ = 0; - u32 x16c_ = 0; - u32 x170_ = 0; - u32 x174_ = 0; - std::vector x178_; + //std::unique_ptr x13c_data; + std::vector x140_nodes; // x140: count, x144: ptr + std::vector x148_links; // x148: count, x14c: ptr + std::vector x150_regions; // x150: count, x154: ptr + std::vector x158_octree; // x158: count, x15c: ptr + std::vector x160_octreeRegionLookup; // x160: count, x164: ptr + std::vector x168_connectionsA; // x168: word_count, x16c: ptr + std::vector x170_connectionsB; // x170: word_count, x174: ptr + std::vector x178_regionDatas; zeus::CTransform x188_transform; public: - CPFArea(const std::unique_ptr&& buf, int len); + CPFArea(std::unique_ptr&& buf, u32 len); void SetTransform(const zeus::CTransform& xf) { x188_transform = xf; } 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 OpenList(); void ClosedSet(); - CPFRegionData* GetRegionData() const; - CPFLink* GetLink(s32); - CPFNode* GetNode(s32) const; - CPFAreaOctree* GetOctree(s32); - void GetOctreeRegionPtrs(s32); + const CPFRegionData& GetRegionData(s32 i) const { return x178_regionDatas[i]; } + const CPFLink& GetLink(s32 i) const { return x148_links[i]; } + const CPFNode& GetNode(s32 i) const { return x140_nodes[i]; } + const CPFAreaOctree& GetOctree(s32 i) const { return x158_octree[i]; } + const CPFRegion* GetOctreeRegionPtrs(s32 i) const { return x160_octreeRegionLookup[i]; } void GetOctreeRegionList(const zeus::CVector3f&); void FindRegions(rstl::reserved_vector&, const zeus::CVector3f&, u32); void FindClosestRegion(const zeus::CVector3f&, u32, float); @@ -91,7 +132,10 @@ public: }; -std::unique_ptr FPathFindAreaFactory(const SObjectTag& /*tag*/, const std::unique_ptr& buf, const CVParamTransfer& xfer); +CFactoryFnReturn FPathFindAreaFactory(const urde::SObjectTag& tag, + std::unique_ptr&& in, u32 len, + const urde::CVParamTransfer& vparms, + CObjectReference* selfRef); } #endif // CPATHFINDAREA_HPP diff --git a/Runtime/World/CPathFindAreaOctree.cpp b/Runtime/World/CPathFindAreaOctree.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/Runtime/World/CPathFindAreaOctree.hpp b/Runtime/World/CPathFindAreaOctree.hpp deleted file mode 100644 index 0f6655889..000000000 --- a/Runtime/World/CPathFindAreaOctree.hpp +++ /dev/null @@ -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, 32>, const zeus::CVector3f&, float); - bool IsPointInPaddedAABox(const zeus::CVector3f&, float); - void Render(); -}; -} - -#endif // __URDE_CPATHFINDAREAOCTREE_HPP__ \ No newline at end of file diff --git a/Runtime/World/CPathFindLink.cpp b/Runtime/World/CPathFindLink.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/Runtime/World/CPathFindLink.hpp b/Runtime/World/CPathFindLink.hpp deleted file mode 100644 index 8f3741567..000000000 --- a/Runtime/World/CPathFindLink.hpp +++ /dev/null @@ -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__ diff --git a/Runtime/World/CPathFindOpenList.cpp b/Runtime/World/CPathFindOpenList.cpp deleted file mode 100644 index fbdbf7dd5..000000000 --- a/Runtime/World/CPathFindOpenList.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "CPathFindOpenList.hpp" -namespace urde -{ -CPFOpenList::CPFOpenList() -{} - -void CPFOpenList::Clear() {} -} diff --git a/Runtime/World/CPathFindOpenList.hpp b/Runtime/World/CPathFindOpenList.hpp deleted file mode 100644 index 2eadeed80..000000000 --- a/Runtime/World/CPathFindOpenList.hpp +++ /dev/null @@ -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__ diff --git a/Runtime/World/CPathFindRegion.cpp b/Runtime/World/CPathFindRegion.cpp index 776c2d362..c89b8fd7f 100644 --- a/Runtime/World/CPathFindRegion.cpp +++ b/Runtime/World/CPathFindRegion.cpp @@ -3,15 +3,49 @@ 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(in.readUint32Big()); + x8_numLinks = in.readUint32Big(); + xc_startLink = reinterpret_cast(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(in.readUint32Big()); +} + +void CPFRegion::Fixup(CPFArea& area, u32& maxRegionNodes) +{ + if (x0_numNodes) + x4_startNode = &area.x140_nodes[reinterpret_cast(x4_startNode)]; + else + x4_startNode = nullptr; + if (x8_numLinks) + xc_startLink = &area.x148_links[reinterpret_cast(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; } } diff --git a/Runtime/World/CPathFindRegion.hpp b/Runtime/World/CPathFindRegion.hpp index 385ecea36..401d2b503 100644 --- a/Runtime/World/CPathFindRegion.hpp +++ b/Runtime/World/CPathFindRegion.hpp @@ -9,39 +9,65 @@ namespace urde class CPFArea; class CPFLink; 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 { - u32 x0_ = 0; - u32 x4_ = 0; - u32 x8_ = 0; - u32 xc_ = 0; - u32 x10_ = 0; - float x14_ = 0.f; - zeus::CVector3f x18_; - u32 x24_ = 0; - zeus::CVector3f x28_; - zeus::CAABox x34_; - u32 x4c_; + u32 x0_numNodes = 0; + CPFNode* x4_startNode = nullptr; + u32 x8_numLinks = 0; + CPFLink* xc_startLink = nullptr; + u32 x10_flags = 0; + float x14_height = 0.f; + zeus::CVector3f x18_normal; + u32 x24_regionIdx = 0; + zeus::CVector3f x28_centroid; + zeus::CAABox x34_aabb; + CPFRegionData* x4c_regionData; public: CPFRegion() = default; - void SetData(CPFRegionData*) {} - CPFRegionData* Data() const; + CPFRegion(CMemoryInStream& in); + void SetData(CPFRegionData* data) { x4c_regionData = data; } + CPFRegionData* Data() const { return x4c_regionData; } void GetIndex() const; - float GetHeight() const; - void GetPathLink() const; - void GetNumLinks() const; - void GetFlags() const; - void GetLink(s32) const; + float GetHeight() const { return x14_height; } + void 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&); - zeus::CVector3f GetCentroid() const; - void Fixup(CPFArea&, s32&); + const zeus::CVector3f& GetCentroid() const { return x28_centroid; } + void Fixup(CPFArea& area, u32& maxRegionNodes); bool IsPointInside(const zeus::CVector3f&); - zeus::CVector3f GetNormal(); - s32 GetNumNodes() const; - void GetNode(s32) 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; } void PointHeight(const zeus::CVector3f&); - void FindClosestPointOnPolygon(const std::vector&, const zeus::CVector3f&, const zeus::CVector3f&, - bool); + void FindClosestPointOnPolygon(const std::vector&, const zeus::CVector3f&, + const zeus::CVector3f&, bool); void FindBestPoint(std::vector&, const zeus::CVector3f&, u32, float); void SetLinkTo(s32); void DropToGround(zeus::CVector3f&) const; @@ -64,10 +90,10 @@ class CPFRegionData public: CPFRegionData() = default; - void SetOpenLess(CPFRegion*); - void SetOpenMore(CPFRegion*); - CPFRegion* GetOpenLess(); - CPFRegion* GetOpenMore(); + void SetOpenLess(CPFRegion* r) { x24_openLess = r; } + void SetOpenMore(CPFRegion* r) { x28_openMore = r; } + CPFRegion* GetOpenLess() const { return x24_openLess; } + CPFRegion* GetOpenMore() const { return x28_openMore; } void GetCost(); void GetPathLink() const; void GetParent() const; diff --git a/Runtime/World/CPathFindSearch.cpp b/Runtime/World/CPathFindSearch.cpp index e69de29bb..cdd7a0699 100644 --- a/Runtime/World/CPathFindSearch.cpp +++ b/Runtime/World/CPathFindSearch.cpp @@ -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) +{ + +} + +} diff --git a/Runtime/World/CPathFindSearch.hpp b/Runtime/World/CPathFindSearch.hpp index e69de29bb..687382151 100644 --- a/Runtime/World/CPathFindSearch.hpp +++ b/Runtime/World/CPathFindSearch.hpp @@ -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__ diff --git a/Runtime/World/CPathFindSpline.hpp b/Runtime/World/CPathFindSpline.hpp index e69de29bb..e93b274a2 100644 --- a/Runtime/World/CPathFindSpline.hpp +++ b/Runtime/World/CPathFindSpline.hpp @@ -0,0 +1,14 @@ +#ifndef __URDE_CPATHFINDSPLINE_HPP__ +#define __URDE_CPATHFINDSPLINE_HPP__ + +namespace urde +{ + +class CPathFindSpline +{ + +}; + +} + +#endif // __URDE_CPATHFINDSPLINE_HPP__ \ No newline at end of file diff --git a/Runtime/World/CPatternedInfo.cpp b/Runtime/World/CPatternedInfo.cpp index 9f6ce6c30..d5a80acab 100644 --- a/Runtime/World/CPatternedInfo.cpp +++ b/Runtime/World/CPatternedInfo.cpp @@ -26,7 +26,7 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount) , xc8_height(in.readFloatBig()) , xcc_bodyOrigin(zeus::CVector3f::ReadBig(in)) , xd8_stepUpHeight(in.readFloatBig()) -, xdc_(in.readFloatBig()) +, xdc_xDamage(in.readFloatBig()) , xe0_(in.readFloatBig()) , xe4_(in.readFloatBig()) , xe8_deathSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) diff --git a/Runtime/World/CPatternedInfo.hpp b/Runtime/World/CPatternedInfo.hpp index 654dc999a..4ed3941c3 100644 --- a/Runtime/World/CPatternedInfo.hpp +++ b/Runtime/World/CPatternedInfo.hpp @@ -35,7 +35,7 @@ class CPatternedInfo float xc8_height; zeus::CVector3f xcc_bodyOrigin; float xd8_stepUpHeight; - float xdc_; + float xdc_xDamage; float xe0_; float xe4_; u16 xe8_deathSfx; @@ -52,9 +52,9 @@ class CPatternedInfo u32 x120_particle2Frames; zeus::CVector3f x124_particle2Scale; - CAssetId x130_particle2 = -1; + CAssetId x130_particle2; - u16 x134_iceShatterSfx = -1; + u16 x134_iceShatterSfx = 0xffff; public: CPatternedInfo(CInputStream& in, u32 pcount); diff --git a/hecl-gui b/hecl-gui index 28680c163..7488e8cbc 160000 --- a/hecl-gui +++ b/hecl-gui @@ -1 +1 @@ -Subproject commit 28680c1636036eb2c0e45c7a8934d0687090e870 +Subproject commit 7488e8cbc504be018bd29e8993c39eea4cb30ff8