metaforce/Runtime/AutoMapper/CMapUniverse.hpp

113 lines
4.2 KiB
C++
Raw Normal View History

2016-08-02 06:19:52 +00:00
#ifndef __URDE_CMAPUNIVERSE_HPP__
#define __URDE_CMAPUNIVERSE_HPP__
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
#include "zeus/CColor.hpp"
#include "zeus/CTransform.hpp"
#include "IFactory.hpp"
#include "CToken.hpp"
2017-03-20 06:59:46 +00:00
#include "CMapArea.hpp"
2016-08-02 06:19:52 +00:00
namespace urde
{
class CStateManager;
class CMapUniverse
{
public:
class CMapUniverseDrawParms
{
2017-04-16 20:56:34 +00:00
float x0_alpha;
int x4_wldIdx;
ResId x8_wldRes;
int xc_closestHex;
float x10_flashPulse;
const CStateManager& x14_mgr;
const zeus::CTransform& x18_model;
const zeus::CTransform& x1c_view;
2016-08-02 06:19:52 +00:00
public:
2017-04-16 20:56:34 +00:00
CMapUniverseDrawParms(float alpha, int wldIdx, ResId wldRes, int closestHex,
float flashPulse, const CStateManager& mgr,
const zeus::CTransform& model, const zeus::CTransform& view)
: x0_alpha(alpha),
x4_wldIdx(wldIdx),
x8_wldRes(wldRes),
xc_closestHex(closestHex),
x10_flashPulse(flashPulse),
x14_mgr(mgr),
x18_model(model),
x1c_view(view)
{}
int GetFocusWorldIndex() const { return x4_wldIdx; }
const zeus::CTransform& GetCameraTransform() const { return x1c_view; }
const zeus::CTransform& GetPaneProjectionTransform() const { return x18_model; }
float GetAlpha() const { return x0_alpha; }
2016-08-02 06:19:52 +00:00
};
class CMapObjectSortInfo
{
public:
CMapObjectSortInfo(float, int, int, int, const zeus::CColor&, const zeus::CColor&);
zeus::CColor GetOutlineColor() const;
zeus::CColor GetSurfaceColor() const;
s32 GetObjectIndex() const;
s32 GetAreaIndex() const;
s32 GetWorldIndex() const;
float GetZDistance() const;
};
class CMapWorldData
{
std::string x0_label;
ResId x10_worldAssetId;
zeus::CTransform x14_transform;
2017-04-15 05:32:25 +00:00
std::vector<zeus::CTransform> x44_hexagonXfs;
2016-08-02 06:19:52 +00:00
zeus::CColor x54_;
zeus::CColor x58_ = zeus::CColor(1.0f, 0.0f, 1.0f);
zeus::CColor x5c_ = zeus::CColor(1.0f, 0.0f, 1.0f);
zeus::CColor x60_ = zeus::CColor(1.0f, 0.0f, 1.0f);
2017-04-15 05:32:25 +00:00
zeus::CVector3f x64_centerPoint = zeus::CVector3f::skZero;
2016-08-02 06:19:52 +00:00
public:
CMapWorldData(CInputStream& in, u32 version);
2017-03-20 05:09:53 +00:00
ResId GetWorldAssetId() const { return x10_worldAssetId; }
2017-04-15 05:32:25 +00:00
const zeus::CVector3f& GetWorldCenterPoint() const { return x64_centerPoint; }
const std::string& GetWorldLabel() const { return x0_label; }
const zeus::CTransform& GetWorldTransform() const { return x14_transform; }
const zeus::CTransform& GetMapAreaData(s32 idx) const { return x44_hexagonXfs[idx]; }
2017-04-16 05:52:43 +00:00
u32 GetNumMapAreaDatas() const { return x44_hexagonXfs.size(); }
2016-08-02 06:19:52 +00:00
zeus::CColor GetOutlineColorUnselected() const;
zeus::CColor GetOutlineColorSelected() const;
zeus::CColor GetSurfaceColorUnselected() const;
zeus::CColor GetSurfaceColorSelected() const;
};
private:
ResId x0_hexagonId;
TLockedToken<CMapArea> x4_hexagonToken;
std::vector<CMapWorldData> x10_worldDatas;
2017-04-15 05:32:25 +00:00
zeus::CVector3f x20_universeCenter = zeus::CVector3f::skZero;
float x2c_universeRadius = 1600.f;
2016-08-02 06:19:52 +00:00
public:
CMapUniverse(CInputStream&, u32);
2017-03-20 05:09:53 +00:00
const CMapWorldData& GetMapWorldData(s32 idx) const { return x10_worldDatas[idx]; }
2017-04-16 05:52:43 +00:00
const CMapWorldData& GetMapWorldDataByWorldId(ResId id) const
{
for (const CMapWorldData& data : x10_worldDatas)
if (data.GetWorldAssetId() == id)
return data;
return x10_worldDatas.front();
}
2017-03-20 05:09:53 +00:00
u32 GetNumMapWorldDatas() const { return x10_worldDatas.size(); }
2017-04-15 05:32:25 +00:00
float GetMapUniverseRadius() const { return x2c_universeRadius; }
const zeus::CVector3f& GetMapUniverseCenterPoint() const { return x20_universeCenter; }
2016-08-02 06:19:52 +00:00
void Draw(const CMapUniverseDrawParms&, const zeus::CVector3f&, float, float) const;
2017-04-15 05:32:25 +00:00
std::vector<CMapWorldData>::const_iterator begin() const { return x10_worldDatas.cbegin(); }
std::vector<CMapWorldData>::const_iterator end() const { return x10_worldDatas.cend(); }
2016-08-02 06:19:52 +00:00
};
2017-03-24 05:30:16 +00:00
CFactoryFnReturn FMapUniverseFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
CObjectReference*);
2016-08-02 06:19:52 +00:00
}
#endif