metaforce/Runtime/AutoMapper/CMapUniverse.hpp

125 lines
5.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;
2017-08-13 05:26:14 +00:00
CAssetId x8_wldRes;
2017-04-16 20:56:34 +00:00
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-08-13 05:26:14 +00:00
CMapUniverseDrawParms(float alpha, int wldIdx, CAssetId wldRes, int closestHex,
2017-04-16 20:56:34 +00:00
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; }
2017-08-13 05:26:14 +00:00
CAssetId GetWorldAssetId() const { return x8_wldRes; }
int GetClosestArea() const { return xc_closestHex; }
float GetFlashPulse() const { return x10_flashPulse; }
2016-08-02 06:19:52 +00:00
};
class CMapObjectSortInfo
{
float x0_zDist;
int x4_wldIdx;
int x8_hexIdx;
int xc_surfIdx;
zeus::CColor x10_surfColor;
zeus::CColor x14_outlineColor;
2016-08-02 06:19:52 +00:00
public:
CMapObjectSortInfo(float zDist, int wldIdx, int hexIdx, int surfIdx,
const zeus::CColor& surf, const zeus::CColor& outline)
: x0_zDist(zDist), x4_wldIdx(wldIdx), x8_hexIdx(hexIdx), xc_surfIdx(surfIdx),
x10_surfColor(surf), x14_outlineColor(outline) {}
const zeus::CColor& GetOutlineColor() const { return x14_outlineColor; }
const zeus::CColor& GetSurfaceColor() const { return x10_surfColor; }
int GetObjectIndex() const { return xc_surfIdx; }
int GetAreaIndex() const { return x8_hexIdx; }
int GetWorldIndex() const { return x4_wldIdx; }
float GetZDistance() const { return x0_zDist; }
2016-08-02 06:19:52 +00:00
};
class CMapWorldData
{
std::string x0_label;
2017-08-13 05:26:14 +00:00
CAssetId x10_worldAssetId;
2016-08-02 06:19:52 +00:00
zeus::CTransform x14_transform;
2017-04-15 05:32:25 +00:00
std::vector<zeus::CTransform> x44_hexagonXfs;
zeus::CColor x54_surfColorSelected;
zeus::CColor x58_outlineColorSelected = zeus::CColor(1.0f, 0.0f, 1.0f);
zeus::CColor x5c_surfColorUnselected = zeus::CColor(1.0f, 0.0f, 1.0f);
zeus::CColor x60_outlineColorUnselected = 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-08-13 05:26:14 +00:00
CAssetId 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(); }
const zeus::CColor& GetOutlineColorUnselected() const { return x60_outlineColorUnselected; }
const zeus::CColor& GetOutlineColorSelected() const { return x58_outlineColorSelected; }
const zeus::CColor& GetSurfaceColorUnselected() const { return x5c_surfColorUnselected; }
const zeus::CColor& GetSurfaceColorSelected() const { return x54_surfColorSelected; }
2016-08-02 06:19:52 +00:00
};
private:
2017-08-13 05:26:14 +00:00
CAssetId x0_hexagonId;
2016-08-02 06:19:52 +00:00
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-08-13 05:26:14 +00:00
const CMapWorldData& GetMapWorldDataByWorldId(CAssetId id) const
2017-04-16 05:52:43 +00:00
{
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