metaforce/Runtime/AutoMapper/CMapWorld.hpp

154 lines
5.8 KiB
C++
Raw Normal View History

#ifndef __URDE_CMAPWORLD_HPP__
#define __URDE_CMAPWORLD_HPP__
#include "RetroTypes.hpp"
2016-07-29 17:00:23 +00:00
#include "CToken.hpp"
2016-07-28 07:33:55 +00:00
#include "zeus/CColor.hpp"
#include "zeus/CVector3f.hpp"
#include "zeus/CTransform.hpp"
2017-03-20 06:59:46 +00:00
#include "CMapArea.hpp"
namespace urde
{
class IWorld;
2016-07-28 07:33:55 +00:00
class CMapWorldInfo;
class CStateManager;
class CMapWorld
{
public:
2016-07-28 07:33:55 +00:00
/* skDrawProfileItemNames; */
enum class EMapAreaList
{
};
class CMapAreaBFSInfo
{
2017-04-15 05:32:25 +00:00
s32 x0_areaIdx;
s32 x4_depth;
float x8_;
float xc_;
2016-07-28 07:33:55 +00:00
public:
2017-04-15 05:32:25 +00:00
CMapAreaBFSInfo(s32 areaIdx, s32 depth, float a, float b)
: x0_areaIdx(areaIdx), x4_depth(depth), x8_(a), xc_(b) {}
s32 GetAreaIndex() const { return x0_areaIdx; }
s32 GetDepth() const { return x4_depth; }
2016-07-28 07:33:55 +00:00
float GetOutlineDrawDepth() const;
float GetSurfaceDrawDepth() const;
};
class CMapObjectSortInfo
{
public:
enum class EObjectCode
{
};
private:
public:
CMapObjectSortInfo(float, int, EObjectCode, int, const zeus::CColor&, const zeus::CColor& );
const zeus::CColor& GetOutlineColor() const;
const zeus::CColor& GetSurfaceColor() const;
u32 GetLocalObjectIndex();
EObjectCode GetObjectCode() const;
u32 GetAreaIndex() const;
float GetZDistance() const;
};
class CMapAreaData
{
2016-07-29 17:00:23 +00:00
TCachedToken<CMapArea> x0_area;
2016-07-28 07:33:55 +00:00
public:
CMapAreaData(u32, EMapAreaList, CMapAreaData*);
void Lock();
void Unlock();
bool IsLoaded() const;
2017-03-20 05:09:53 +00:00
const CMapArea* GetMapArea() const { return x0_area.IsLoaded() ? x0_area.GetObj() : nullptr; }
2016-07-28 07:33:55 +00:00
void GetNextMapAreaData() const;
void GetContainingList() const;
void NextMapAreaData();
void SetContainingList(EMapAreaList);
void SetNextMapArea(CMapAreaData*);
};
class CMapWorldDrawParms
{
2017-04-16 20:56:34 +00:00
float x0_alphaSurfVisited;
float x4_alphaOlVisited;
float x8_alphaSurfUnvisited;
float xc_alphaOlUnvisited;
float x10_alpha;
float x14_outlineWidthScale;
const CStateManager& x18_mgr;
const zeus::CTransform& x1c_modelXf;
const zeus::CTransform& x20_viewXf;
const IWorld& x24_wld;
const CMapWorldInfo& x28_mwInfo;
float x2c_flashPulse;
float x30_flashIntensity;
float x34_objectScale;
bool x38_sortDoorSurfs;
2016-07-28 07:33:55 +00:00
public:
2017-04-16 20:56:34 +00:00
CMapWorldDrawParms(float alphaSurfVisited, float alphaOlVisited,
float alphaSurfUnvisited, float alphaOlUnvisited,
float alpha, float outlineWidthScale, const CStateManager& mgr,
const zeus::CTransform& modelXf, const zeus::CTransform& viewXf,
const IWorld& wld, const CMapWorldInfo& mwInfo, float flashPulse,
float flashIntensity, float objectScale, bool sortDoorSurfs)
: x0_alphaSurfVisited(alphaSurfVisited),
x4_alphaOlVisited(alphaOlVisited),
x8_alphaSurfUnvisited(alphaSurfUnvisited),
xc_alphaOlUnvisited(alphaOlUnvisited),
x10_alpha(alpha),
x14_outlineWidthScale(outlineWidthScale),
x18_mgr(mgr),
x1c_modelXf(modelXf),
x20_viewXf(viewXf),
x24_wld(wld),
x28_mwInfo(mwInfo),
x2c_flashPulse(flashPulse),
x30_flashIntensity(flashIntensity),
x34_objectScale(objectScale),
x38_sortDoorSurfs(sortDoorSurfs)
{}
const IWorld& GetWorld() const { return x24_wld; }
float GetOutlineWidthScale() const { return x14_outlineWidthScale; }
const zeus::CTransform& GetPlaneProjectionTransform() const { return x1c_modelXf; }
float GetPlayerAreaFlashIntensity() const { return x30_flashIntensity; }
float GetPlayerAreaFlashPulse() const { return x2c_flashPulse; }
const zeus::CTransform& GetCameraTransform() const { return x20_viewXf; }
float GetAlphaOutlineUnvisited() const { return xc_alphaOlUnvisited; }
float GetAlphaSurfaceUnvisited() const { return x8_alphaSurfUnvisited; }
float GetAlphaOutlineVisited() const { return x4_alphaOlVisited; }
float GetAlphaSurfaceVisited() const { return x0_alphaSurfVisited; }
const CMapWorldInfo& GetMapWorldInfo() const { return x28_mwInfo; }
const CStateManager& GetStateManager() const { return x18_mgr; }
bool GetIsSortDoorSurfaces() const { return x38_sortDoorSurfs; }
2016-07-28 07:33:55 +00:00
};
private:
2016-07-29 17:00:23 +00:00
std::vector<CMapAreaData> x0_areas;
2016-07-28 07:33:55 +00:00
public:
CMapWorld(CInputStream&);
2017-04-15 05:32:25 +00:00
u32 GetNumAreas() const { return x0_areas.size(); }
const CMapArea* GetMapArea(TAreaId aid) const { return x0_areas[aid].GetMapArea(); }
void IsMapAreaInBFSInfoVector(const CMapAreaData*, const std::vector<CMapAreaBFSInfo>&) const;
void SetWhichMapAreasLoaded(const IWorld&, int start, int count);
bool IsMapAreasStreaming() const;
2016-07-28 07:33:55 +00:00
void MoveMapAreaToList(CMapAreaData*, EMapAreaList);
2017-04-15 05:32:25 +00:00
s32 GetCurrentMapAreaDepth(const IWorld&, TAreaId) const;
2017-04-16 05:52:43 +00:00
std::vector<TAreaId> GetVisibleAreas(const IWorld&, const CMapWorldInfo&) const;
2016-07-28 07:33:55 +00:00
void Draw(const CMapWorldDrawParms&, int, int, float, float, bool) const;
2017-04-15 05:32:25 +00:00
void DoBFS(const IWorld&, TAreaId, int, float, float, bool, std::vector<CMapAreaBFSInfo>&) const;
2016-07-28 07:33:55 +00:00
bool IsMapAreaValid(const IWorld&, int, bool) const;
void DrawAreas(const CMapWorldDrawParms&, int, const std::vector<CMapAreaBFSInfo>&, bool) const;
void RecalculateWorldSphere(const CMapWorldInfo&, const IWorld&) const;
2017-04-15 05:32:25 +00:00
zeus::CVector3f ConstrainToWorldVolume(const zeus::CVector3f&, const zeus::CVector3f&) const;
2016-07-28 07:33:55 +00:00
void ClearTraversedFlags() const;
};
CFactoryFnReturn FMapWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,
CObjectReference* selfRef);
}
#endif // __URDE_CMAPWORLD_HPP__