This commit is contained in:
Jack Andersen 2016-08-10 11:55:28 -10:00
commit bc8daa1d50
21 changed files with 309 additions and 57 deletions

View File

@ -9,6 +9,7 @@ make_dnalist(liblist
CINF
CSKR
EVNT
PATH
CMDLMaterials
MREA
DeafBabe

0
DataSpec/DNAMP1/PATH.cpp Normal file
View File

73
DataSpec/DNAMP1/PATH.hpp Normal file
View File

@ -0,0 +1,73 @@
#ifndef __DNACOMMON_PATH_HPP__
#define __DNACOMMON_PATH_HPP__
#include "../DNACommon/DNACommon.hpp"
namespace DataSpec
{
struct PATH : BigDNA
{
DECL_DNA
Value<atUint32> version;
struct Vertex : BigDNA
{
DECL_DNA
Value<atVec3f> position;
Value<atVec3f> normal;
};
Value<atUint32> vertexCount;
Vector<Vertex, DNA_COUNT(vertexCount)> nodes;
struct Edge : BigDNA
{
DECL_DNA
Value<atUint32> polyA;
Value<atUint32> polyB;
Value<float> width1;
Value<float> width2;
};
Value<atUint32> edgeCount;
Vector<Edge, DNA_COUNT(edgeCount)> edges;
struct Polygon : BigDNA
{
DECL_DNA
Value<atUint32> vertCount;
Value<atUint32> vertStart;
Value<atUint32> edgeCount;
Value<atUint32> edgeStart;
Value<atUint32> flags;
Value<float> area;
Value<atVec3f> normal;
Value<atUint32> selfIdx1;
Value<atVec3f> center;
Value<atVec3f> aabb[2];
Value<atUint32> selfIdx2;
};
Value<atUint32> polyCount;
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(((((polyCount * polyCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3;
Value<atUint32> unkIntCount;
Vector<atUint32, DNA_COUNT(unkIntCount)> unkInts;
struct UnknownStruct : BigDNA
{
DECL_DNA
Value<atUint32> unk1;
Value<atVec3f> unk2[3];
Value<atUint32> unk3[8]; // Usually 0xFF
Value<atUint32> unk4;
Value<atUint32> unk5;
};
Value<atUint32> unkStructCount;
Vector<UnknownStruct, DNA_COUNT(unkStructCount)> unkStructs;
};
}
#endif // __DNACOMMON_PATH_HPP__

View File

@ -167,7 +167,7 @@ public:
TUniqueId x4_uid = kInvalidUniqueId;
} xa8_map[1024];
u32 x10a8_pvsVersion = 0;
TLockedToken<CPathFindArea> x10ac_path;
TLockedToken<CPFArea> x10ac_path;
// bool x10b8_ = 0; optional flag for CToken
u32 x10bc_ = 0;
std::unique_ptr<CObjectList> x10c0_areaObjs;

View File

@ -10,6 +10,11 @@ set(WORLD_SOURCES
CAiFuncMap.hpp CAiFuncMap.cpp
CPatterned.hpp CPatterned.cpp
CPathFindArea.hpp CPathFindArea.cpp
CPathFindRegion.hpp CPathFindRegion.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

View File

@ -4,13 +4,15 @@
namespace urde
{
CPathFindArea::CPathFindArea(const std::unique_ptr<u8[]>&& buf, int len)
CPFArea::CPFArea(const std::unique_ptr<u8[]>&& buf, int len)
{
x13c_data = buf.get();
x13c_ = buf.get();
}
std::unique_ptr<IObj> FPathFindAreaFactory(const SObjectTag& /*tag*/, const std::unique_ptr<u8[]>& buf, const CVParamTransfer &xfer)
std::unique_ptr<IObj> FPathFindAreaFactory(const SObjectTag& /*tag*/, const std::unique_ptr<u8[]>& buf,
const CVParamTransfer &xfer)
{
return TToken<CPathFindArea>::GetIObjObjectFor(std::unique_ptr<CPathFindArea>(new CPathFindArea(std::move(buf), *reinterpret_cast<int*>(xfer.GetObj()))));
return TToken<CPFArea>::GetIObjObjectFor(
std::unique_ptr<CPFArea>(new CPFArea(std::move(buf), *reinterpret_cast<int*>(xfer.GetObj()))));
}
}

View File

@ -4,77 +4,70 @@
#include "IObj.hpp"
#include "zeus/CTransform.hpp"
#include "zeus/CAABox.hpp"
#include "CPathFindOpenList.hpp"
namespace urde
{
class CVParamTransfer;
class CPFRegion
class CPFBitSet
{
friend class CPFOpenList;
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_;
public:
CPFBitSet() = default;
void Clear();
void Add(s32);
bool Test(s32);
void Rmv(s32);
};
class CPFRegionData
class CPFArea
{
friend class CPFOpenList;
float x0_ = 0.f;
float x0_ = FLT_MAX;
zeus::CVector3f x4_;
s32 x10_ = -1;
zeus::CVector3f x14_;
s32 x20_ = 0;
s32 x24_ = 0;
s32 x28_ = 0;
s32 x2c_ = 0;
};
class CPFOpenList
{
friend class CPathFindArea;
u32 x0_ = 0;
u32 x4_ = 0;
u32 x8_ = 0;
u32 xc_ = 0;
u32 x10_ = 0;
u32 x14_ = 0;
u32 x18_ = 0;
u32 x1c_ = 0;
std::vector<zeus::CVector3f> x10_;
u32 x20_ = 0;
u32 x24_ = 0;
u32 x28_ = 0;
u32 x2c_ = 0;
u32 x30_ = 0;
bool x30_ = false;
u32 x34_ = 0;
u32 x38_ = 0;
u32 x3c_ = 0;
std::vector<CPFRegion> x40_region;
std::vector<CPFRegionData> x90_regionData;
public:
CPFOpenList()
{
}
};
class CPathFindArea
{
zeus::CVector3f x0_;
float xc_ = 0.f;
std::vector<zeus::CVector3f> x10_;
bool x30_ = false;
std::vector<CPFOpenList> x78_;
u8* x13c_data;
u32 x40_ = 0;
u32 x44_ = 0;
u32 x48_ = 0;
u32 x4c_ = 0;
u32 x50_ = 0;
u32 x54_ = 0;
u32 x58_ = 0;
u32 x5c_ = 0;
u32 x60_ = 0;
u32 x64_ = 0;
u32 x68_ = 0;
u32 x6c_ = 0;
u32 x70_ = 0;
u32 x74_ = 0;
CPFOpenList x78_;
u32 x138_;
u8* x13c_ = nullptr;
u32 x140_ = 0;
u8* x144_ = nullptr;
u32 x148_ = 0;
u8* x14c_ = nullptr;
u32 x150_ = 0;
u8* x154_ = nullptr;
u32 x158_ = 0;
u32 x15c_ = 0;
u32 x160_ = 0;
u32 x164_ = 0;
u32 x168_ = 0;
u32 x16c_ = 0;
u32 x170_ = 0;
u32 x174_ = 0;
std::vector<CPFRegionData> x178_;
zeus::CTransform x188_;
public:
CPathFindArea(const std::unique_ptr<u8[]>&& buf, int len);
CPFArea(const std::unique_ptr<u8[]>&& buf, int len);
};

View File

View File

View File

View File

View File

View File

@ -0,0 +1,18 @@
#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

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

View File

@ -0,0 +1,41 @@
#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

@ -0,0 +1,24 @@
#include "CPathFindRegion.hpp"
namespace urde
{
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

@ -0,0 +1,84 @@
#ifndef __URDE_CPATHFINDREGION_HPP__
#define __URDE_CPATHFINDREGION_HPP__
#include "RetroTypes.hpp"
#include "zeus/CAABox.hpp"
namespace urde
{
class CPFArea;
class CPFLink;
class CPFRegionData;
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_;
public:
CPFRegion() = default;
void SetData(CPFRegionData*) {}
CPFRegionData* Data() const;
void GetIndex() const;
float GetHeight() const;
void GetPathLink() const;
void GetNumLinks() const;
void GetFlags() const;
void GetLink(s32) const;
void SetCentroid(const zeus::CVector3f&);
zeus::CVector3f GetCentroid() const;
void Fixup(CPFArea&, s32);
bool IsPointInside(const zeus::CVector3f&);
zeus::CVector3f GetNormal();
s32 GetNumNodes() const;
void GetNode(s32) const;
void PointHeight(const zeus::CVector3f&);
void FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>&,
const zeus::CVector3f&, const zeus::CVector3f&, bool);
void FindBestPoint(std::vector<zeus::CVector3f>&, const zeus::CVector3f&, u32, float);
void SetLinkTo(s32);
void DropToGround(zeus::CVector3f&) const;
void GetLinkMidPoint(const CPFLink&);
void FitThroughLink2d(const zeus::CVector3f&, const CPFLink&, const zeus::CVector3f&, float) const;
void FitThroughLink3d(const zeus::CVector3f&, const CPFLink&, float, const zeus::CVector3f&, float, float) const;
void IsPointInsidePaddedAABox(const zeus::CVector3f&, float) const;
};
class CPFRegionData
{
float x0_ = 0.f;
zeus::CVector3f x4_;
s32 x10_ = -1;
zeus::CVector3f x14_;
s32 x20_ = 0;
CPFRegion* x24_openLess = nullptr;
CPFRegion* x28_openMore = nullptr;
s32 x2c_ = 0;
public:
CPFRegionData() = default;
void SetOpenLess(CPFRegion*);
void SetOpenMore(CPFRegion*);
CPFRegion* GetOpenLess();
CPFRegion* GetOpenMore();
void GetCost();
void GetPathLink() const;
void GetParent() const;
void Setup(CPFRegion*, float, float);
void SetBestPoint(const zeus::CVector3f&);
void SetBestPointDistanceSquared(float);
float GetBestPointDistanceSquared() const;
void SetPathLink(s32);
void SetCookie(s32);
zeus::CVector3f GetBestPoint() const;
void GetCookie() const;
};
}
#endif // __URDE_CPATHFINDREGION_HPP__

View File

View File

View File

View File