2016-07-29 17:00:23 +00:00
|
|
|
#ifndef __URDE_CMAPPABLEOBJECT_HPP__
|
|
|
|
#define __URDE_CMAPPABLEOBJECT_HPP__
|
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "zeus/CAABox.hpp"
|
|
|
|
#include "zeus/CTransform.hpp"
|
2017-01-26 10:06:18 +00:00
|
|
|
#include "GameGlobalObjects.hpp"
|
2017-04-22 06:42:32 +00:00
|
|
|
#include "Graphics/Shaders/CMapSurfaceShader.hpp"
|
|
|
|
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
|
|
|
|
#include "Graphics/CLineRenderer.hpp"
|
2016-07-29 17:00:23 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CStateManager;
|
2017-04-22 06:42:32 +00:00
|
|
|
class CMapWorldInfo;
|
|
|
|
|
2016-07-29 17:00:23 +00:00
|
|
|
class CMappableObject
|
|
|
|
{
|
2017-04-22 06:42:32 +00:00
|
|
|
friend class CMapArea;
|
2017-11-05 06:17:12 +00:00
|
|
|
static boo::ObjToken<boo::IGraphicsBufferS> g_doorVbo;
|
|
|
|
static boo::ObjToken<boo::IGraphicsBufferS> g_doorIbo;
|
2017-04-22 06:42:32 +00:00
|
|
|
|
2016-07-29 17:00:23 +00:00
|
|
|
public:
|
|
|
|
enum class EMappableObjectType
|
|
|
|
{
|
|
|
|
BlueDoor = 0,
|
|
|
|
ShieldDoor = 1,
|
|
|
|
IceDoor = 2,
|
|
|
|
WaveDoor = 3,
|
|
|
|
PlasmaDoor = 4,
|
|
|
|
BigDoor1 = 5,
|
|
|
|
BigDoor2 = 6,
|
|
|
|
IceDoorCeiling = 7,
|
|
|
|
IceDoorFloor = 8,
|
|
|
|
WaveDoorCeiling = 9,
|
|
|
|
WaveDoorFloor = 10,
|
2016-08-02 06:19:52 +00:00
|
|
|
PlasmaDoorCeiling= 11,
|
|
|
|
PlasmaDoorFloor = 12,
|
2016-07-29 17:00:23 +00:00
|
|
|
IceDoorFloor2 = 13,
|
|
|
|
WaveDoorFloor2 = 14,
|
2017-04-22 06:42:32 +00:00
|
|
|
PlasmaDoorFloor2 = 15,
|
2016-07-29 17:00:23 +00:00
|
|
|
DownArrowYellow = 27, /* Maintenance Tunnel */
|
|
|
|
UpArrowYellow = 28, /* Phazon Processing Center */
|
|
|
|
DownArrowGreen = 29, /* Elevator A */
|
|
|
|
UpArrowGreen = 30, /* Elite Control Access */
|
|
|
|
DownArrowRed = 31, /* Elevator B */
|
|
|
|
UpArrowRed = 32, /* Fungal Hall Access */
|
|
|
|
TransportLift = 33,
|
|
|
|
SaveStation = 34,
|
|
|
|
MissileStation = 37
|
|
|
|
};
|
|
|
|
|
2017-04-22 21:46:18 +00:00
|
|
|
enum class EVisMode
|
|
|
|
{
|
|
|
|
Always,
|
|
|
|
MapStationOrVisit,
|
|
|
|
Visit,
|
|
|
|
Never,
|
|
|
|
MapStationOrVisit2
|
|
|
|
};
|
|
|
|
|
2016-07-29 17:00:23 +00:00
|
|
|
private:
|
|
|
|
static const zeus::CVector3f skDoorVerts[8];
|
|
|
|
|
2016-08-02 06:19:52 +00:00
|
|
|
EMappableObjectType x0_type;
|
2017-04-22 21:46:18 +00:00
|
|
|
EVisMode x4_visibilityMode;
|
2017-04-22 06:42:32 +00:00
|
|
|
TEditorId x8_objId;
|
2016-07-31 01:43:34 +00:00
|
|
|
u32 xc_;
|
2016-08-02 06:19:52 +00:00
|
|
|
zeus::CTransform x10_transform;
|
2017-04-22 06:42:32 +00:00
|
|
|
|
|
|
|
struct DoorSurface
|
|
|
|
{
|
|
|
|
CMapSurfaceShader m_surface;
|
|
|
|
CLineRenderer m_outline;
|
|
|
|
DoorSurface(boo::IGraphicsDataFactory::Context& ctx)
|
|
|
|
: m_surface(ctx, g_doorVbo, g_doorIbo),
|
2018-05-20 06:14:57 +00:00
|
|
|
m_outline(ctx, CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false, false, true)
|
2017-04-22 06:42:32 +00:00
|
|
|
{}
|
|
|
|
};
|
|
|
|
std::experimental::optional<DoorSurface> m_doorSurface;
|
|
|
|
std::experimental::optional<CTexturedQuadFilter> m_texQuadFilter;
|
|
|
|
|
2016-07-31 01:43:34 +00:00
|
|
|
zeus::CTransform AdjustTransformForType();
|
2017-04-22 06:42:32 +00:00
|
|
|
std::pair<zeus::CColor, zeus::CColor> GetDoorColors(int idx, const CMapWorldInfo& mwInfo, float alpha) const;
|
2016-07-29 17:00:23 +00:00
|
|
|
public:
|
2017-04-22 06:42:32 +00:00
|
|
|
CMappableObject(const void* buf);
|
|
|
|
CMappableObject(CMappableObject&&) = default;
|
2016-07-29 17:00:23 +00:00
|
|
|
void PostConstruct(const void*);
|
2017-04-22 06:42:32 +00:00
|
|
|
const zeus::CTransform& GetTransform() const { return x10_transform; }
|
|
|
|
EMappableObjectType GetType() const { return x0_type; }
|
|
|
|
void Draw(int, const CMapWorldInfo&, float, bool) const;
|
|
|
|
void DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo, float alpha,
|
|
|
|
int surfIdx, bool needsVtxLoad) const;
|
|
|
|
zeus::CVector3f BuildSurfaceCenterPoint(int surfIdx) const;
|
|
|
|
bool IsDoorConnectedToArea(int idx, const CStateManager&) const;
|
2016-07-29 17:00:23 +00:00
|
|
|
bool IsDoorConnectedToVisitedArea(const CStateManager&) const;
|
2017-04-22 21:46:18 +00:00
|
|
|
bool IsVisibleToAutoMapper(bool worldVis, const CMapWorldInfo& mwInfo) const;
|
2016-07-29 17:00:23 +00:00
|
|
|
bool GetIsSeen() const;
|
|
|
|
|
2017-04-22 06:42:32 +00:00
|
|
|
static void ReadAutoMapperTweaks(const ITweakAutoMapper&);
|
2016-07-29 17:00:23 +00:00
|
|
|
static bool GetTweakIsMapVisibilityCheat();
|
2017-04-22 06:42:32 +00:00
|
|
|
static bool IsDoorType(EMappableObjectType type) { return type >= EMappableObjectType::BlueDoor &&
|
|
|
|
type <= EMappableObjectType::PlasmaDoorFloor2; }
|
|
|
|
static void Shutdown();
|
2016-07-29 17:00:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // __URDE_CMAPPABLEOBJECT_HPP__
|