mirror of https://github.com/AxioDL/metaforce.git
Several CGameArea PostConstruct imps
This commit is contained in:
parent
204969965e
commit
73573c84ea
|
@ -9,6 +9,7 @@ namespace urde
|
||||||
|
|
||||||
enum class EGameObjectList
|
enum class EGameObjectList
|
||||||
{
|
{
|
||||||
|
Invalid = -1,
|
||||||
All,
|
All,
|
||||||
Actor,
|
Actor,
|
||||||
PhysicsActor,
|
PhysicsActor,
|
||||||
|
@ -21,6 +22,8 @@ enum class EGameObjectList
|
||||||
|
|
||||||
class CObjectList
|
class CObjectList
|
||||||
{
|
{
|
||||||
|
friend class CGameArea;
|
||||||
|
|
||||||
struct SObjectListEntry
|
struct SObjectListEntry
|
||||||
{
|
{
|
||||||
CEntity* entity = nullptr;
|
CEntity* entity = nullptr;
|
||||||
|
@ -31,6 +34,7 @@ class CObjectList
|
||||||
EGameObjectList m_listEnum;
|
EGameObjectList m_listEnum;
|
||||||
TUniqueId m_lastId = -1;
|
TUniqueId m_lastId = -1;
|
||||||
u16 m_count = 0;
|
u16 m_count = 0;
|
||||||
|
int m_areaIdx = 0;
|
||||||
public:
|
public:
|
||||||
CObjectList(EGameObjectList listEnum);
|
CObjectList(EGameObjectList listEnum);
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,8 @@ public:
|
||||||
CCameraManager* GetCameraManager() { return x870_cameraManager.get(); }
|
CCameraManager* GetCameraManager() { return x870_cameraManager.get(); }
|
||||||
|
|
||||||
std::shared_ptr<CMapWorldInfo> MapWorldInfo() { return x8c0_mapWorldInfo; }
|
std::shared_ptr<CMapWorldInfo> MapWorldInfo() { return x8c0_mapWorldInfo; }
|
||||||
|
|
||||||
|
bool IsLayerActive(TAreaId area, int layerIdx) { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,20 +130,6 @@ public:
|
||||||
const u16* GetTriangleEdgeIndices(u16 idx) const;
|
const u16* GetTriangleEdgeIndices(u16 idx) const;
|
||||||
|
|
||||||
static std::unique_ptr<CAreaOctTree> MakeFromMemory(void* buf, unsigned int size);
|
static std::unique_ptr<CAreaOctTree> MakeFromMemory(void* buf, unsigned int size);
|
||||||
|
|
||||||
void RecursiveMatchXray(std::vector<u32>& out, const zeus::CAABox& inner, const zeus::CAABox& outer)
|
|
||||||
{
|
|
||||||
if (outer.intersects(inner))
|
|
||||||
{
|
|
||||||
if (inner.inside(outer))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MatchXray(std::vector<u32>& out, const zeus::CAABox&)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ void Buckets::Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
CBooRenderer::CAreaListItem::CAreaListItem
|
CBooRenderer::CAreaListItem::CAreaListItem
|
||||||
(const std::vector<CMetroidModelInstance>* geom, const CAreaOctTree* octTree,
|
(const std::vector<CMetroidModelInstance>* geom, const CAreaRenderOctTree* octTree,
|
||||||
std::vector<CBooModel*>&& models, int areaIdx)
|
std::vector<CBooModel*>&& models, int areaIdx)
|
||||||
: x0_geometry(geom), x4_octTree(octTree), x10_models(std::move(models)), x18_areaIdx(areaIdx) {}
|
: x0_geometry(geom), x4_octTree(octTree), x10_models(std::move(models)), x18_areaIdx(areaIdx) {}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ CBooRenderer::FindStaticGeometry(const std::vector<CMetroidModelInstance>* geome
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::AddStaticGeometry(const std::vector<CMetroidModelInstance>* geometry,
|
void CBooRenderer::AddStaticGeometry(const std::vector<CMetroidModelInstance>* geometry,
|
||||||
const CAreaOctTree* octTree, int areaIdx)
|
const CAreaRenderOctTree* octTree, int areaIdx)
|
||||||
{
|
{
|
||||||
auto search = FindStaticGeometry(geometry);
|
auto search = FindStaticGeometry(geometry);
|
||||||
if (search == x1c_areaListItems.end())
|
if (search == x1c_areaListItems.end())
|
||||||
|
@ -598,12 +598,36 @@ void CBooRenderer::DrawThermalModel(const CModel& model, const zeus::CColor& mul
|
||||||
model.Draw(flags);
|
model.Draw(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::DrawXRayOutline(const zeus::CAABox&, const float*, const float*)
|
void CBooRenderer::DrawXRayOutline(const zeus::CAABox& aabb)
|
||||||
{
|
{
|
||||||
|
CModelFlags flags;
|
||||||
|
flags.m_extendedShaderIdx = 3;
|
||||||
|
|
||||||
for (CAreaListItem& item : x1c_areaListItems)
|
for (CAreaListItem& item : x1c_areaListItems)
|
||||||
{
|
{
|
||||||
if (item.x4_octTree)
|
if (item.x4_octTree)
|
||||||
{
|
{
|
||||||
|
std::vector<u32> bitmap;
|
||||||
|
item.x4_octTree->FindOverlappingModels(bitmap, aabb);
|
||||||
|
|
||||||
|
for (u32 c=0 ; c<item.x4_octTree->x14_bitmapWordCount ; ++c)
|
||||||
|
{
|
||||||
|
for (u32 b=0 ; b<32 ; ++b)
|
||||||
|
{
|
||||||
|
if (bitmap[c] & (1 << b))
|
||||||
|
{
|
||||||
|
CBooModel* model = item.x10_models[c * 32 + b];
|
||||||
|
model->UpdateUniformData(flags);
|
||||||
|
const CBooSurface* surf = model->x38_firstUnsortedSurface;
|
||||||
|
while (surf)
|
||||||
|
{
|
||||||
|
if (surf->GetBounds().intersects(aabb))
|
||||||
|
model->DrawSurface(*surf, flags);
|
||||||
|
surf = surf->m_next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "CRandom16.hpp"
|
#include "CRandom16.hpp"
|
||||||
#include "CPVSVisSet.hpp"
|
#include "CPVSVisSet.hpp"
|
||||||
#include "zeus/CRectangle.hpp"
|
#include "zeus/CRectangle.hpp"
|
||||||
|
#include "World/CGameArea.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -51,13 +52,13 @@ class CBooRenderer : public IRenderer
|
||||||
struct CAreaListItem
|
struct CAreaListItem
|
||||||
{
|
{
|
||||||
const std::vector<CMetroidModelInstance>* x0_geometry;
|
const std::vector<CMetroidModelInstance>* x0_geometry;
|
||||||
const CAreaOctTree* x4_octTree;
|
const CAreaRenderOctTree* x4_octTree;
|
||||||
//std::vector<TCachedToken<CTexture>> x8_textures;
|
//std::vector<TCachedToken<CTexture>> x8_textures;
|
||||||
std::vector<CBooModel*> x10_models;
|
std::vector<CBooModel*> x10_models;
|
||||||
int x18_areaIdx;
|
int x18_areaIdx;
|
||||||
std::vector<u32> x20_;
|
std::vector<u32> x20_;
|
||||||
|
|
||||||
CAreaListItem(const std::vector<CMetroidModelInstance>* geom, const CAreaOctTree* octTree,
|
CAreaListItem(const std::vector<CMetroidModelInstance>* geom, const CAreaRenderOctTree* octTree,
|
||||||
std::vector<CBooModel*>&& models, int areaIdx);
|
std::vector<CBooModel*>&& models, int areaIdx);
|
||||||
~CAreaListItem();
|
~CAreaListItem();
|
||||||
};
|
};
|
||||||
|
@ -140,7 +141,7 @@ public:
|
||||||
void AddWorldSurfaces(CBooModel& model);
|
void AddWorldSurfaces(CBooModel& model);
|
||||||
|
|
||||||
std::list<CAreaListItem>::iterator FindStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
std::list<CAreaListItem>::iterator FindStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
||||||
void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaOctTree*, int areaIdx);
|
void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaRenderOctTree*, int areaIdx);
|
||||||
void EnablePVS(const CPVSVisSet*, u32);
|
void EnablePVS(const CPVSVisSet*, u32);
|
||||||
void DisablePVS();
|
void DisablePVS();
|
||||||
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
||||||
|
@ -187,7 +188,7 @@ public:
|
||||||
//void CacheReflection(TReflectionCallback, void*, bool);
|
//void CacheReflection(TReflectionCallback, void*, bool);
|
||||||
void DrawSpaceWarp(const zeus::CVector3f&, float);
|
void DrawSpaceWarp(const zeus::CVector3f&, float);
|
||||||
void DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol);
|
void DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol);
|
||||||
void DrawXRayOutline(const zeus::CAABox&, const float*, const float*);
|
void DrawXRayOutline(const zeus::CAABox&);
|
||||||
void SetWireframeFlags(int);
|
void SetWireframeFlags(int);
|
||||||
void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&);
|
void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&);
|
||||||
void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*);
|
void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*);
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CPVSAreaSet::CPVSAreaHolder::CPVSAreaHolder(CInputStream& in)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
CPVSAreaSet::CPVSAreaSet(CInputStream& in)
|
CPVSAreaSet::CPVSAreaSet(CInputStream& in)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,12 @@ namespace urde
|
||||||
|
|
||||||
class CPVSAreaSet
|
class CPVSAreaSet
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
struct CPVSAreaHolder
|
struct CPVSAreaHolder
|
||||||
{
|
{
|
||||||
CPVSAreaHolder(CInputStream& in);
|
CPVSAreaHolder(CInputStream& in);
|
||||||
};
|
};
|
||||||
|
private:
|
||||||
std::vector<CPVSAreaHolder> xunk;
|
std::vector<CPVSAreaHolder> xunk;
|
||||||
public:
|
public:
|
||||||
CPVSAreaSet(CInputStream& in);
|
CPVSAreaSet(CInputStream& in);
|
||||||
|
|
|
@ -18,6 +18,7 @@ class CParticleGen;
|
||||||
class CModel;
|
class CModel;
|
||||||
class CSkinnedModel;
|
class CSkinnedModel;
|
||||||
class CPVSVisSet;
|
class CPVSVisSet;
|
||||||
|
class CAreaRenderOctTree;
|
||||||
|
|
||||||
class IRenderer
|
class IRenderer
|
||||||
{
|
{
|
||||||
|
@ -41,7 +42,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~IRenderer() = default;
|
virtual ~IRenderer() = default;
|
||||||
virtual void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaOctTree*, int)=0;
|
virtual void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaRenderOctTree*, int)=0;
|
||||||
virtual void EnablePVS(const CPVSVisSet*, u32)=0;
|
virtual void EnablePVS(const CPVSVisSet*, u32)=0;
|
||||||
virtual void DisablePVS()=0;
|
virtual void DisablePVS()=0;
|
||||||
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*)=0;
|
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*)=0;
|
||||||
|
@ -88,7 +89,7 @@ public:
|
||||||
//virtual void CacheReflection(TReflectionCallback, void*, bool)=0;
|
//virtual void CacheReflection(TReflectionCallback, void*, bool)=0;
|
||||||
virtual void DrawSpaceWarp(const zeus::CVector3f&, float)=0;
|
virtual void DrawSpaceWarp(const zeus::CVector3f&, float)=0;
|
||||||
virtual void DrawThermalModel(const CModel&, const zeus::CColor&, const zeus::CColor&)=0;
|
virtual void DrawThermalModel(const CModel&, const zeus::CColor&, const zeus::CColor&)=0;
|
||||||
virtual void DrawXRayOutline(const zeus::CAABox&, const float*, const float*)=0;
|
virtual void DrawXRayOutline(const zeus::CAABox&)=0;
|
||||||
virtual void SetWireframeFlags(int)=0;
|
virtual void SetWireframeFlags(int)=0;
|
||||||
virtual void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&)=0;
|
virtual void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&)=0;
|
||||||
virtual void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*)=0;
|
virtual void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*)=0;
|
||||||
|
|
|
@ -4,10 +4,177 @@
|
||||||
#include "CGameArea.hpp"
|
#include "CGameArea.hpp"
|
||||||
#include "GameGlobalObjects.hpp"
|
#include "GameGlobalObjects.hpp"
|
||||||
#include "Graphics/CBooRenderer.hpp"
|
#include "Graphics/CBooRenderer.hpp"
|
||||||
|
#include "CSimplePool.hpp"
|
||||||
|
#include "CStateManager.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CAreaRenderOctTree::CAreaRenderOctTree(std::unique_ptr<u8[]>&& buf)
|
||||||
|
: x0_buf(std::move(buf))
|
||||||
|
{
|
||||||
|
athena::io::MemoryReader r(x0_buf.get() + 8, INT32_MAX);
|
||||||
|
x8_bitmapCount = r.readUint32Big();
|
||||||
|
xc_meshCount = r.readUint32Big();
|
||||||
|
x10_nodeCount = r.readUint32Big();
|
||||||
|
x14_bitmapWordCount = (xc_meshCount + 31) / 32;
|
||||||
|
x18_aabb.readBoundingBoxBig(r);
|
||||||
|
|
||||||
|
x30_bitmaps = reinterpret_cast<u32*>(x0_buf.get() + 64);
|
||||||
|
u32 wc = x14_bitmapWordCount * x8_bitmapCount;
|
||||||
|
for (int i=0 ; i<wc ; ++i)
|
||||||
|
x30_bitmaps[i] = hecl::SBig(x30_bitmaps[i]);
|
||||||
|
|
||||||
|
x34_indirectionTable = x30_bitmaps + wc;
|
||||||
|
x38_entries = reinterpret_cast<u8*>(x34_indirectionTable) + x10_nodeCount;
|
||||||
|
for (int i=0 ; i<x10_nodeCount ; ++i)
|
||||||
|
{
|
||||||
|
x34_indirectionTable[i] = hecl::SBig(x34_indirectionTable[i]);
|
||||||
|
Node* n = reinterpret_cast<Node*>(x38_entries + x34_indirectionTable[i]);
|
||||||
|
n->x0_bitmapIdx = hecl::SBig(n->x0_bitmapIdx);
|
||||||
|
n->x2_flags = hecl::SBig(n->x2_flags);
|
||||||
|
if (n->x2_flags)
|
||||||
|
{
|
||||||
|
u32 childCount = n->GetChildCount();
|
||||||
|
for (u32 c=0 ; c<childCount ; ++c)
|
||||||
|
n->x4_children[c] = hecl::SBig(n->x4_children[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const u32 ChildCounts[] = { 0, 2, 2, 4, 2, 4, 4, 8 };
|
||||||
|
u32 CAreaRenderOctTree::Node::GetChildCount() const
|
||||||
|
{
|
||||||
|
return ChildCounts[x2_flags];
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAABox CAreaRenderOctTree::Node::GetNodeBounds(const zeus::CAABox& curAABB, int idx) const
|
||||||
|
{
|
||||||
|
zeus::CVector3f center = curAABB.center();
|
||||||
|
switch (x2_flags)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return curAABB;
|
||||||
|
case 1:
|
||||||
|
if (idx == 0)
|
||||||
|
return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
else
|
||||||
|
return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
case 2:
|
||||||
|
if (idx == 0)
|
||||||
|
return {curAABB.min.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, curAABB.max.z};
|
||||||
|
else
|
||||||
|
return {curAABB.min.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, center.y, curAABB.max.z};
|
||||||
|
case 1:
|
||||||
|
return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, curAABB.max.z};
|
||||||
|
case 2:
|
||||||
|
return {curAABB.min.x, center.y, curAABB.min.z, center.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
case 3:
|
||||||
|
return {center.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
if (idx == 0)
|
||||||
|
return {curAABB.min.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z};
|
||||||
|
else
|
||||||
|
return {curAABB.min.x, curAABB.min.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, curAABB.max.y, center.z};
|
||||||
|
case 1:
|
||||||
|
return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z};
|
||||||
|
case 2:
|
||||||
|
return {curAABB.min.x, curAABB.min.y, center.z, center.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
case 3:
|
||||||
|
return {center.x, curAABB.min.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return {curAABB.min.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, center.z};
|
||||||
|
case 1:
|
||||||
|
return {curAABB.min.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z};
|
||||||
|
case 2:
|
||||||
|
return {curAABB.min.x, curAABB.min.y, center.z, curAABB.max.x, center.y, curAABB.max.z};
|
||||||
|
case 3:
|
||||||
|
return {curAABB.min.x, center.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 7:
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, center.y, center.z};
|
||||||
|
case 1:
|
||||||
|
return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, center.z};
|
||||||
|
case 2:
|
||||||
|
return {curAABB.min.x, center.y, curAABB.min.z, center.x, curAABB.max.y, center.z};
|
||||||
|
case 3:
|
||||||
|
return {center.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z};
|
||||||
|
case 4:
|
||||||
|
return {curAABB.min.x, curAABB.min.y, center.z, center.x, center.y, curAABB.max.z};
|
||||||
|
case 5:
|
||||||
|
return {center.x, curAABB.min.y, center.z, curAABB.max.x, center.y, curAABB.max.z};
|
||||||
|
case 6:
|
||||||
|
return {curAABB.min.x, center.y, center.z, center.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
case 7:
|
||||||
|
return {center.x, center.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAreaRenderOctTree::Node::RecursiveBuildOverlaps(u32* bmpOut,
|
||||||
|
const CAreaRenderOctTree& parent,
|
||||||
|
const zeus::CAABox& curAABB,
|
||||||
|
const zeus::CAABox& testAABB) const
|
||||||
|
{
|
||||||
|
if (testAABB.intersects(curAABB))
|
||||||
|
{
|
||||||
|
if (curAABB.inside(testAABB))
|
||||||
|
{
|
||||||
|
const u32* bmp = &parent.x30_bitmaps[x0_bitmapIdx * parent.x14_bitmapWordCount];
|
||||||
|
for (u32 c=0 ; c<parent.x14_bitmapWordCount ; ++c)
|
||||||
|
bmpOut[c] |= bmp[c];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
u32 childCount = GetChildCount();
|
||||||
|
for (u32 c=0 ; c<childCount ; ++c)
|
||||||
|
{
|
||||||
|
zeus::CAABox childAABB = GetNodeBounds(curAABB, c);
|
||||||
|
reinterpret_cast<Node*>(parent.x38_entries[parent.x34_indirectionTable[x4_children[c]]])->
|
||||||
|
RecursiveBuildOverlaps(bmpOut, parent, childAABB, testAABB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAreaRenderOctTree::FindOverlappingModels(std::vector<u32>& out, const zeus::CAABox& testAABB) const
|
||||||
|
{
|
||||||
|
out.resize(x14_bitmapWordCount);
|
||||||
|
reinterpret_cast<Node*>(x38_entries[x34_indirectionTable[0]])->
|
||||||
|
RecursiveBuildOverlaps(out.data(), *this, x18_aabb, testAABB);
|
||||||
|
}
|
||||||
|
|
||||||
void CGameArea::CAreaFog::SetCurrent() const
|
void CGameArea::CAreaFog::SetCurrent() const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -39,6 +206,19 @@ void CGameArea::CAreaFog::DisableFog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::vector<SObjectTag> ReadDependencyList(CInputStream& in)
|
||||||
|
{
|
||||||
|
std::vector<SObjectTag> ret;
|
||||||
|
u32 count = in.readUint32Big();
|
||||||
|
ret.reserve(count);
|
||||||
|
for (u32 i=0 ; i<count ; ++i)
|
||||||
|
{
|
||||||
|
ret.emplace_back();
|
||||||
|
ret.back().readMLVL(in);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion)
|
CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion)
|
||||||
{
|
{
|
||||||
x8_nameSTRG = in.readUint32Big();
|
x8_nameSTRG = in.readUint32Big();
|
||||||
|
@ -54,9 +234,15 @@ CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion)
|
||||||
for (u32 i=0 ; i<attachAreaCount ; ++i)
|
for (u32 i=0 ; i<attachAreaCount ; ++i)
|
||||||
x44_attachedAreaIndices.push_back(in.readUint16Big());
|
x44_attachedAreaIndices.push_back(in.readUint16Big());
|
||||||
|
|
||||||
u32 depCount = in.readUint32Big();
|
::urde::ReadDependencyList(in);
|
||||||
for (u32 i=0 ; i<depCount ; ++i)
|
::urde::ReadDependencyList(in);
|
||||||
in.readUint32Big();
|
|
||||||
|
if (mlvlVersion > 13)
|
||||||
|
{
|
||||||
|
u32 depCount = in.readUint32Big();
|
||||||
|
for (u32 i=0 ; i<depCount ; ++i)
|
||||||
|
in.readUint32Big();
|
||||||
|
}
|
||||||
|
|
||||||
u32 dockCount = in.readUint32Big();
|
u32 dockCount = in.readUint32Big();
|
||||||
x54_docks.reserve(dockCount);
|
x54_docks.reserve(dockCount);
|
||||||
|
@ -105,19 +291,6 @@ const zeus::CTransform& CDummyGameArea::IGetTM() const
|
||||||
return identityXf;
|
return identityXf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<SObjectTag> ReadDependencyList(CInputStream& in)
|
|
||||||
{
|
|
||||||
std::vector<SObjectTag> ret;
|
|
||||||
u32 count = in.readUint32Big();
|
|
||||||
ret.reserve(count);
|
|
||||||
for (u32 i=0 ; i<count ; ++i)
|
|
||||||
{
|
|
||||||
ret.emplace_back();
|
|
||||||
ret.back().readMLVL(in);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion)
|
CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion)
|
||||||
: x4_selfIdx(idx), xf0_25_active(true)
|
: x4_selfIdx(idx), xf0_25_active(true)
|
||||||
{
|
{
|
||||||
|
@ -140,6 +313,28 @@ CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion)
|
||||||
x9c_deps1 = ::urde::ReadDependencyList(in);
|
x9c_deps1 = ::urde::ReadDependencyList(in);
|
||||||
xac_deps2 = ::urde::ReadDependencyList(in);
|
xac_deps2 = ::urde::ReadDependencyList(in);
|
||||||
|
|
||||||
|
zeus::CAABox aabb = x6c_aabb.getTransformedAABox(xc_transform);
|
||||||
|
x6c_aabb = aabb;
|
||||||
|
|
||||||
|
if (mlvlVersion > 13)
|
||||||
|
{
|
||||||
|
u32 depCount = in.readUint32Big();
|
||||||
|
xbc_layerDepOffsets.reserve(depCount);
|
||||||
|
for (u32 i=0 ; i<depCount ; ++i)
|
||||||
|
xbc_layerDepOffsets.push_back(in.readUint32Big());
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 dockCount = in.readUint32Big();
|
||||||
|
xcc_docks.reserve(dockCount);
|
||||||
|
for (u32 i=0 ; i<dockCount ; ++i)
|
||||||
|
xcc_docks.emplace_back(in, xc_transform);
|
||||||
|
|
||||||
|
ClearTokenList();
|
||||||
|
|
||||||
|
for (CToken& tok : xdc_tokens)
|
||||||
|
xec_totalResourcesSize += g_ResFactory->ResourceSize(*tok.GetObjectTag());
|
||||||
|
|
||||||
|
xec_totalResourcesSize += g_ResFactory->ResourceSize(SObjectTag{FOURCC('MREA'), x84_mrea});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameArea::IGetScriptingMemoryAlways() const
|
bool CGameArea::IGetScriptingMemoryAlways() const
|
||||||
|
@ -306,18 +501,172 @@ bool CGameArea::Validate(CStateManager& mgr)
|
||||||
|
|
||||||
void CGameArea::PostConstructArea()
|
void CGameArea::PostConstructArea()
|
||||||
{
|
{
|
||||||
|
MREAHeader header = VerifyHeader();
|
||||||
|
|
||||||
|
auto secIt = x110_mreaSecBufs.begin() + 2;
|
||||||
|
|
||||||
|
/* Models */
|
||||||
|
if (header.modelCount)
|
||||||
|
{
|
||||||
|
for (int i=0 ; i<header.modelCount ; ++i)
|
||||||
|
{
|
||||||
|
u32 surfCount = hecl::SBig(*reinterpret_cast<u32*>((secIt+6)->first.get()));
|
||||||
|
secIt += 7 + surfCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Render octree */
|
||||||
|
if (header.version == 15 && header.arotSecIdx != -1)
|
||||||
|
{
|
||||||
|
x12c_postConstructed->xc_octTree.emplace(std::move(secIt->first));
|
||||||
|
++secIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scriptable layer section */
|
||||||
|
x12c_postConstructed->x10c8_sclyBuf = std::move(secIt->first);
|
||||||
|
x12c_postConstructed->x10d0_sclySize = secIt->second;
|
||||||
|
++secIt;
|
||||||
|
|
||||||
|
/* Collision section */
|
||||||
|
std::unique_ptr<CAreaOctTree> collision = CAreaOctTree::MakeFromMemory(secIt->first.get(), secIt->second);
|
||||||
|
if (collision)
|
||||||
|
{
|
||||||
|
x12c_postConstructed->x0_collision = std::move(collision);
|
||||||
|
x12c_postConstructed->x8_collisionSize = secIt->second;
|
||||||
|
}
|
||||||
|
++secIt;
|
||||||
|
|
||||||
|
/* Unknown section */
|
||||||
|
++secIt;
|
||||||
|
|
||||||
|
/* Lights section */
|
||||||
|
if (header.version > 6)
|
||||||
|
{
|
||||||
|
athena::io::MemoryReader r(secIt->first.get(), secIt->second);
|
||||||
|
u32 magic = r.readUint32Big();
|
||||||
|
if (magic == 0xBABEDEAD)
|
||||||
|
{
|
||||||
|
u32 aCount = r.readUint32Big();
|
||||||
|
x12c_postConstructed->x60_lightsA.reserve(aCount);
|
||||||
|
x12c_postConstructed->x70_gfxLightsA.reserve(aCount);
|
||||||
|
for (u32 i=0 ; i<aCount ; ++i)
|
||||||
|
{
|
||||||
|
x12c_postConstructed->x60_lightsA.emplace_back(r);
|
||||||
|
x12c_postConstructed->x70_gfxLightsA.push_back(
|
||||||
|
x12c_postConstructed->x60_lightsA.back().GetAsCGraphicsLight());
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 bCount = r.readUint32Big();
|
||||||
|
x12c_postConstructed->x80_lightsB.reserve(bCount);
|
||||||
|
x12c_postConstructed->x90_gfxLightsB.reserve(bCount);
|
||||||
|
for (u32 i=0 ; i<bCount ; ++i)
|
||||||
|
{
|
||||||
|
x12c_postConstructed->x80_lightsB.emplace_back(r);
|
||||||
|
x12c_postConstructed->x90_gfxLightsB.push_back(
|
||||||
|
x12c_postConstructed->x80_lightsB.back().GetAsCGraphicsLight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++secIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PVS section */
|
||||||
|
if (header.version > 7)
|
||||||
|
{
|
||||||
|
athena::io::MemoryReader r(secIt->first.get(), secIt->second);
|
||||||
|
u32 magic = r.readUint32Big();
|
||||||
|
if (magic == 'VISI')
|
||||||
|
{
|
||||||
|
x12c_postConstructed->x10a8_pvsVersion = r.readUint32Big();
|
||||||
|
if (x12c_postConstructed->x10a8_pvsVersion == 2)
|
||||||
|
{
|
||||||
|
x12c_postConstructed->x1108_29_ = r.readBool();
|
||||||
|
x12c_postConstructed->x1108_30_ = r.readBool();
|
||||||
|
x12c_postConstructed->xa0_pvs.reset(new CPVSAreaSet::CPVSAreaHolder(r));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++secIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pathfinding section */
|
||||||
|
if (header.version > 9)
|
||||||
|
{
|
||||||
|
athena::io::MemoryReader r(secIt->first.get(), secIt->second);
|
||||||
|
ResId pathId = r.readUint32Big();
|
||||||
|
x12c_postConstructed->x10ac_path = g_SimplePool->GetObj(SObjectTag{FOURCC('PATH'), pathId});
|
||||||
|
++secIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
x12c_postConstructed->x10c0_areaObjs.reset(new CObjectList(EGameObjectList::Invalid));
|
||||||
|
x12c_postConstructed->x10c0_areaObjs->m_areaIdx = x4_selfIdx;
|
||||||
|
|
||||||
|
x12c_postConstructed->x10c4_areaFog.reset(new CAreaFog());
|
||||||
|
|
||||||
|
xf0_24_postConstructed = true;
|
||||||
|
|
||||||
|
/* Resolve layer pointers */
|
||||||
|
if (x12c_postConstructed->x10c8_sclyBuf)
|
||||||
|
{
|
||||||
|
athena::io::MemoryReader r(x12c_postConstructed->x10c8_sclyBuf.get(), x12c_postConstructed->x10d0_sclySize);
|
||||||
|
u32 magic = r.readUint32Big();
|
||||||
|
if (magic == 'SCLY')
|
||||||
|
{
|
||||||
|
r.readUint32Big();
|
||||||
|
u32 layerCount = r.readUint32Big();
|
||||||
|
x12c_postConstructed->x110c_layerPtrs.resize(layerCount);
|
||||||
|
for (u32 l=0 ; l<layerCount ; ++l)
|
||||||
|
x12c_postConstructed->x110c_layerPtrs[l].second = r.readUint32Big();
|
||||||
|
u8* ptr = x12c_postConstructed->x10c8_sclyBuf.get() + r.position();
|
||||||
|
for (u32 l=0 ; l<layerCount ; ++l)
|
||||||
|
{
|
||||||
|
x12c_postConstructed->x110c_layerPtrs[l].first = ptr;
|
||||||
|
ptr += x12c_postConstructed->x110c_layerPtrs[l].second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameArea::FillInStaticGeometry()
|
void CGameArea::FillInStaticGeometry()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameArea::VerifyTokenList()
|
void CGameArea::VerifyTokenList(CStateManager& stateMgr)
|
||||||
{
|
{
|
||||||
|
if (xdc_tokens.empty())
|
||||||
|
return;
|
||||||
|
ClearTokenList();
|
||||||
|
|
||||||
|
if (xac_deps2.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
u32 lastOff = 0;
|
||||||
|
int lidx = 0;
|
||||||
|
for (u32 off : xbc_layerDepOffsets)
|
||||||
|
{
|
||||||
|
if (stateMgr.IsLayerActive(x4_selfIdx, lidx))
|
||||||
|
{
|
||||||
|
auto it = xac_deps2.begin() + lastOff;
|
||||||
|
auto end = xac_deps2.begin() + off;
|
||||||
|
for (; it != end ; ++it)
|
||||||
|
{
|
||||||
|
xdc_tokens.push_back(g_SimplePool->GetObj(*it));
|
||||||
|
xdc_tokens.back().Lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastOff = off;
|
||||||
|
++lidx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameArea::ClearTokenList()
|
void CGameArea::ClearTokenList()
|
||||||
{
|
{
|
||||||
|
if (xdc_tokens.empty())
|
||||||
|
xdc_tokens.reserve(xac_deps2.size());
|
||||||
|
else
|
||||||
|
xdc_tokens.clear();
|
||||||
|
|
||||||
|
xf0_26_tokensReady = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CGameArea::GetPreConstructedSize() const
|
u32 CGameArea::GetPreConstructedSize() const
|
||||||
|
@ -325,9 +674,37 @@ u32 CGameArea::GetPreConstructedSize() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameArea::VerifyHeader() const
|
CGameArea::MREAHeader CGameArea::VerifyHeader() const
|
||||||
{
|
{
|
||||||
return false;
|
if (x110_mreaSecBufs.empty())
|
||||||
|
return {};
|
||||||
|
if (*reinterpret_cast<u32*>(x110_mreaSecBufs[0].first.get()) != SBIG(0xDEADBEEF))
|
||||||
|
return {};
|
||||||
|
|
||||||
|
MREAHeader header;
|
||||||
|
athena::io::MemoryReader r(x110_mreaSecBufs[0].first.get() + 4, INT32_MAX);
|
||||||
|
u32 version = r.readUint32Big();
|
||||||
|
header.version = (version >= 12 && version <= 15) ? version : 0;
|
||||||
|
if (!header.version)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
header.xf.read34RowMajor(r);
|
||||||
|
header.modelCount = r.readUint32Big();
|
||||||
|
header.secCount = r.readUint32Big();
|
||||||
|
header.geomSecIdx = r.readUint32Big();
|
||||||
|
header.sclySecIdx = r.readUint32Big();
|
||||||
|
header.collisionSecIdx = r.readUint32Big();
|
||||||
|
header.unkSecIdx = r.readUint32Big();
|
||||||
|
header.lightSecIdx = r.readUint32Big();
|
||||||
|
header.visiSecIdx = r.readUint32Big();
|
||||||
|
header.pathSecIdx = r.readUint32Big();
|
||||||
|
header.arotSecIdx = r.readUint32Big();
|
||||||
|
|
||||||
|
header.secSizes.reserve(header.secCount);
|
||||||
|
for (int i=0 ; i<header.secCount ; ++i)
|
||||||
|
header.secSizes.push_back(r.readUint32Big());
|
||||||
|
|
||||||
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,14 @@
|
||||||
#include "Collision/CAreaOctTree.hpp"
|
#include "Collision/CAreaOctTree.hpp"
|
||||||
#include "hecl/ClientProcess.hpp"
|
#include "hecl/ClientProcess.hpp"
|
||||||
#include "Graphics/CMetroidModelInstance.hpp"
|
#include "Graphics/CMetroidModelInstance.hpp"
|
||||||
|
#include "CObjectList.hpp"
|
||||||
|
#include "CWorldLight.hpp"
|
||||||
|
#include "Graphics/CPVSAreaSet.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class CStateManager;
|
class CStateManager;
|
||||||
|
class CPFArea;
|
||||||
|
|
||||||
enum class ERglFogMode
|
enum class ERglFogMode
|
||||||
{
|
{
|
||||||
|
@ -45,6 +49,36 @@ public:
|
||||||
const zeus::CTransform& IGetTM() const;
|
const zeus::CTransform& IGetTM() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CAreaRenderOctTree
|
||||||
|
{
|
||||||
|
struct Node
|
||||||
|
{
|
||||||
|
u16 x0_bitmapIdx;
|
||||||
|
u16 x2_flags;
|
||||||
|
u16 x4_children[];
|
||||||
|
|
||||||
|
u32 GetChildCount() const;
|
||||||
|
zeus::CAABox GetNodeBounds(const zeus::CAABox& curAABB, int idx) const;
|
||||||
|
|
||||||
|
void RecursiveBuildOverlaps(u32* out, const CAreaRenderOctTree& parent, const zeus::CAABox& curAABB,
|
||||||
|
const zeus::CAABox& testAABB) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<u8[]> x0_buf;
|
||||||
|
u32 x8_bitmapCount;
|
||||||
|
u32 xc_meshCount;
|
||||||
|
u32 x10_nodeCount;
|
||||||
|
u32 x14_bitmapWordCount;
|
||||||
|
zeus::CAABox x18_aabb;
|
||||||
|
u32* x30_bitmaps;
|
||||||
|
u32* x34_indirectionTable;
|
||||||
|
u8* x38_entries;
|
||||||
|
|
||||||
|
CAreaRenderOctTree(std::unique_ptr<u8[]>&& buf);
|
||||||
|
|
||||||
|
void FindOverlappingModels(std::vector<u32>& out, const zeus::CAABox& testAABB) const;
|
||||||
|
};
|
||||||
|
|
||||||
class CGameArea : public IGameArea
|
class CGameArea : public IGameArea
|
||||||
{
|
{
|
||||||
friend class CWorld;
|
friend class CWorld;
|
||||||
|
@ -60,7 +94,7 @@ class CGameArea : public IGameArea
|
||||||
std::vector<SObjectTag> x9c_deps1;
|
std::vector<SObjectTag> x9c_deps1;
|
||||||
std::vector<SObjectTag> xac_deps2;
|
std::vector<SObjectTag> xac_deps2;
|
||||||
|
|
||||||
std::vector<u32> xbc_;
|
std::vector<u32> xbc_layerDepOffsets;
|
||||||
std::vector<Dock> xcc_docks;
|
std::vector<Dock> xcc_docks;
|
||||||
std::vector<CToken> xdc_tokens;
|
std::vector<CToken> xdc_tokens;
|
||||||
|
|
||||||
|
@ -72,7 +106,7 @@ class CGameArea : public IGameArea
|
||||||
{
|
{
|
||||||
bool xf0_24_postConstructed : 1;
|
bool xf0_24_postConstructed : 1;
|
||||||
bool xf0_25_active : 1;
|
bool xf0_25_active : 1;
|
||||||
bool xf0_26_ : 1;
|
bool xf0_26_tokensReady : 1;
|
||||||
bool xf0_27_ : 1;
|
bool xf0_27_ : 1;
|
||||||
bool xf0_28_ : 1;
|
bool xf0_28_ : 1;
|
||||||
};
|
};
|
||||||
|
@ -82,32 +116,51 @@ class CGameArea : public IGameArea
|
||||||
std::list<std::shared_ptr<const hecl::ClientProcess::BufferTransaction>> xf8_loadTransactions;
|
std::list<std::shared_ptr<const hecl::ClientProcess::BufferTransaction>> xf8_loadTransactions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
class CAreaFog
|
||||||
|
{
|
||||||
|
zeus::CVector2f x4_ = {0.f, 1024.f};
|
||||||
|
zeus::CVector2f xc_ = {0.f, 1024.f};
|
||||||
|
zeus::CVector2f x14_;
|
||||||
|
zeus::CVector3f x1c_ = {0.5f};
|
||||||
|
zeus::CVector3f x28_ = {0.5f};
|
||||||
|
float x34_ = 0.f;
|
||||||
|
public:
|
||||||
|
void SetCurrent() const;
|
||||||
|
void Update(float dt);
|
||||||
|
void RollFogOut(float, float, const zeus::CColor& color);
|
||||||
|
void FadeFog(ERglFogMode, const zeus::CColor& color, const zeus::CVector2f& vec1,
|
||||||
|
float, const zeus::CVector2f& vec2);
|
||||||
|
void SetFogExplicit(ERglFogMode, const zeus::CColor& color, const zeus::CVector2f& vec);
|
||||||
|
bool IsFogDisabled() const;
|
||||||
|
void DisableFog();
|
||||||
|
};
|
||||||
|
|
||||||
struct CPostConstructed
|
struct CPostConstructed
|
||||||
{
|
{
|
||||||
std::unique_ptr<uint8_t[]> x0_;
|
std::unique_ptr<CAreaOctTree> x0_collision;
|
||||||
u32 x8_ = 0;
|
u32 x8_collisionSize = 0;
|
||||||
std::experimental::optional<CAreaOctTree> xc_octTree;
|
std::experimental::optional<CAreaRenderOctTree> xc_octTree;
|
||||||
std::vector<CMetroidModelInstance> x4c_insts;
|
std::vector<CMetroidModelInstance> x4c_insts;
|
||||||
std::unique_ptr<uint8_t> x5c_;
|
//std::unique_ptr<from unknown, pointless MREA section> x5c_;
|
||||||
//std::vector<Something 68 bytes> x60_;
|
std::vector<CWorldLight> x60_lightsA;
|
||||||
//std::vector<Something 80 bytes> x70_;
|
std::vector<CLight> x70_gfxLightsA;
|
||||||
//std::vector<Something 68 bytes> x80_;
|
std::vector<CWorldLight> x80_lightsB;
|
||||||
//std::vector<Something 80 bytes> x90_;
|
std::vector<CLight> x90_gfxLightsB;
|
||||||
std::unique_ptr<uint8_t> xa0_;
|
std::unique_ptr<CPVSAreaSet::CPVSAreaHolder> xa0_pvs;
|
||||||
u32 xa4_elemCount = 1024;
|
u32 xa4_elemCount = 1024;
|
||||||
struct MapEntry
|
struct MapEntry
|
||||||
{
|
{
|
||||||
s16 x0_id = -1;
|
s16 x0_id = -1;
|
||||||
TUniqueId x4_uid = kInvalidUniqueId;
|
TUniqueId x4_uid = kInvalidUniqueId;
|
||||||
} xa8_map[1024];
|
} xa8_map[1024];
|
||||||
u32 x10a8_ = 0;
|
u32 x10a8_pvsVersion = 0;
|
||||||
CToken x10ac_;
|
TLockedToken<CPFArea> x10ac_path;
|
||||||
// bool x10b8_ = 0; optional flag for CToken
|
// bool x10b8_ = 0; optional flag for CToken
|
||||||
u32 x10bc_ = 0;
|
u32 x10bc_ = 0;
|
||||||
std::unique_ptr<uint8_t[]> x10c0_;
|
std::unique_ptr<CObjectList> x10c0_areaObjs;
|
||||||
std::unique_ptr<uint8_t[]> x10c4_;
|
std::unique_ptr<CAreaFog> x10c4_areaFog;
|
||||||
std::unique_ptr<uint8_t> x10c8_;
|
std::unique_ptr<u8[]> x10c8_sclyBuf;
|
||||||
u32 x10d0_ = 0;
|
u32 x10d0_sclySize = 0;
|
||||||
u32 x10d4_ = 0;
|
u32 x10d4_ = 0;
|
||||||
u32 x10d8_ = 0;
|
u32 x10d8_ = 0;
|
||||||
u32 x10dc_ = 0;
|
u32 x10dc_ = 0;
|
||||||
|
@ -131,7 +184,7 @@ public:
|
||||||
};
|
};
|
||||||
u8 _dummy = 0;
|
u8 _dummy = 0;
|
||||||
};
|
};
|
||||||
// std::vector<Something 8 bytes> x110c_;
|
std::vector<std::pair<u8*, u32>> x110c_layerPtrs;
|
||||||
float x111c_thermalCurrent = 0.f;
|
float x111c_thermalCurrent = 0.f;
|
||||||
float x1120_thermalSpeed = 0.f;
|
float x1120_thermalSpeed = 0.f;
|
||||||
float x1124_thermalTarget = 0.f;
|
float x1124_thermalTarget = 0.f;
|
||||||
|
@ -143,11 +196,29 @@ public:
|
||||||
u32 x113c_ = 0;
|
u32 x113c_ = 0;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
|
std::vector<std::pair<std::unique_ptr<u8[]>, int>> x110_mreaSecBufs;
|
||||||
std::unique_ptr<CPostConstructed> x12c_postConstructed;
|
std::unique_ptr<CPostConstructed> x12c_postConstructed;
|
||||||
|
|
||||||
void UpdateFog(float dt);
|
void UpdateFog(float dt);
|
||||||
void UpdateThermalVisor(float dt);
|
void UpdateThermalVisor(float dt);
|
||||||
|
|
||||||
|
struct MREAHeader
|
||||||
|
{
|
||||||
|
u32 version = 0;
|
||||||
|
zeus::CTransform xf;
|
||||||
|
u32 modelCount;
|
||||||
|
u32 secCount;
|
||||||
|
u32 geomSecIdx;
|
||||||
|
u32 sclySecIdx;
|
||||||
|
u32 collisionSecIdx;
|
||||||
|
u32 unkSecIdx;
|
||||||
|
u32 lightSecIdx;
|
||||||
|
u32 visiSecIdx;
|
||||||
|
u32 pathSecIdx;
|
||||||
|
u32 arotSecIdx;
|
||||||
|
std::vector<u32> secSizes;
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct CAreaObjectList : public IAreaObjectList
|
struct CAreaObjectList : public IAreaObjectList
|
||||||
|
@ -159,25 +230,6 @@ public:
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
class CAreaFog
|
|
||||||
{
|
|
||||||
zeus::CVector2f x4_ = {0.f, 1024.f};
|
|
||||||
zeus::CVector2f xc_ = {0.f, 1024.f};
|
|
||||||
zeus::CVector2f x14_;
|
|
||||||
zeus::CVector3f x1c_ = {0.5f};
|
|
||||||
zeus::CVector3f x28_ = {0.5f};
|
|
||||||
float x34_ = 0.f;
|
|
||||||
public:
|
|
||||||
void SetCurrent() const;
|
|
||||||
void Update(float dt);
|
|
||||||
void RollFogOut(float, float, const zeus::CColor& color);
|
|
||||||
void FadeFog(ERglFogMode, const zeus::CColor& color, const zeus::CVector2f& vec1,
|
|
||||||
float, const zeus::CVector2f& vec2);
|
|
||||||
void SetFogExplicit(ERglFogMode, const zeus::CColor& color, const zeus::CVector2f& vec);
|
|
||||||
bool IsFogDisabled() const;
|
|
||||||
void DisableFog();
|
|
||||||
};
|
|
||||||
|
|
||||||
CGameArea(CInputStream& in, int idx, int mlvlVersion);
|
CGameArea(CInputStream& in, int idx, int mlvlVersion);
|
||||||
|
|
||||||
bool IsFinishedOccluding() const;
|
bool IsFinishedOccluding() const;
|
||||||
|
@ -215,10 +267,10 @@ public:
|
||||||
bool Validate(CStateManager& mgr);
|
bool Validate(CStateManager& mgr);
|
||||||
void PostConstructArea();
|
void PostConstructArea();
|
||||||
void FillInStaticGeometry();
|
void FillInStaticGeometry();
|
||||||
void VerifyTokenList();
|
void VerifyTokenList(CStateManager& stateMgr);
|
||||||
void ClearTokenList();
|
void ClearTokenList();
|
||||||
u32 GetPreConstructedSize() const;
|
u32 GetPreConstructedSize() const;
|
||||||
bool VerifyHeader() const;
|
MREAHeader VerifyHeader() const;
|
||||||
|
|
||||||
const zeus::CTransform& GetTransform() const {return xc_transform;}
|
const zeus::CTransform& GetTransform() const {return xc_transform;}
|
||||||
const zeus::CTransform& GetInverseTransform() const {return x3c_invTransform;}
|
const zeus::CTransform& GetInverseTransform() const {return x3c_invTransform;}
|
||||||
|
|
Loading…
Reference in New Issue