2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-07-29 17:00:23 +00:00
|
|
|
|
2020-04-05 10:14:01 +00:00
|
|
|
#include <array>
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <optional>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "Runtime/GameGlobalObjects.hpp"
|
|
|
|
#include "Runtime/Graphics/CLineRenderer.hpp"
|
|
|
|
#include "Runtime/Graphics/Shaders/CMapSurfaceShader.hpp"
|
|
|
|
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
|
2022-02-01 00:06:54 +00:00
|
|
|
#include "Runtime/RetroTypes.hpp"
|
2019-09-28 02:53:03 +00:00
|
|
|
|
|
|
|
#include <zeus/CAABox.hpp>
|
|
|
|
#include <zeus/CTransform.hpp>
|
2016-07-29 17:00:23 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2017-04-22 06:42:32 +00:00
|
|
|
class CMapWorldInfo;
|
2019-09-28 02:53:03 +00:00
|
|
|
class CStateManager;
|
2017-04-22 06:42:32 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CMappableObject {
|
2016-07-29 17:00:23 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
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,
|
|
|
|
PlasmaDoorCeiling = 11,
|
|
|
|
PlasmaDoorFloor = 12,
|
|
|
|
IceDoorFloor2 = 13,
|
|
|
|
WaveDoorFloor2 = 14,
|
|
|
|
PlasmaDoorFloor2 = 15,
|
|
|
|
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
|
|
|
|
};
|
2016-07-29 17:00:23 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EVisMode { Always, MapStationOrVisit, Visit, Never, MapStationOrVisit2 };
|
2017-04-22 21:46:18 +00:00
|
|
|
|
2016-07-29 17:00:23 +00:00
|
|
|
private:
|
2020-04-05 10:14:01 +00:00
|
|
|
static std::array<zeus::CVector3f, 8> skDoorVerts;
|
2022-02-01 00:06:54 +00:00
|
|
|
static std::array<u16, 24> skDoorIndices;
|
2016-07-29 17:00:23 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
EMappableObjectType x0_type;
|
|
|
|
EVisMode x4_visibilityMode;
|
|
|
|
TEditorId x8_objId;
|
|
|
|
u32 xc_;
|
|
|
|
zeus::CTransform x10_transform;
|
2017-04-22 06:42:32 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
struct DoorSurface {
|
|
|
|
CMapSurfaceShader m_surface;
|
|
|
|
CLineRenderer m_outline;
|
2022-02-01 00:06:54 +00:00
|
|
|
explicit DoorSurface()
|
|
|
|
: m_surface(aurora::ArrayRef{skDoorVerts}, aurora::ArrayRef{skDoorIndices})
|
|
|
|
, m_outline(CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false, false, true) {}
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
2019-06-12 02:05:17 +00:00
|
|
|
std::optional<DoorSurface> m_doorSurface;
|
|
|
|
std::optional<CTexturedQuadFilter> m_texQuadFilter;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-08-14 10:04:11 +00:00
|
|
|
zeus::CTransform AdjustTransformForType() const;
|
2018-12-08 05:30:43 +00:00
|
|
|
std::pair<zeus::CColor, zeus::CColor> GetDoorColors(int idx, const CMapWorldInfo& mwInfo, float alpha) const;
|
2017-04-22 06:42:32 +00:00
|
|
|
|
2016-07-29 17:00:23 +00:00
|
|
|
public:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CMappableObject(const void* buf);
|
2018-12-08 05:30:43 +00:00
|
|
|
CMappableObject(CMappableObject&&) = default;
|
|
|
|
void PostConstruct(const void*);
|
|
|
|
const zeus::CTransform& GetTransform() const { return x10_transform; }
|
|
|
|
EMappableObjectType GetType() const { return x0_type; }
|
2020-03-31 10:24:54 +00:00
|
|
|
void Draw(int, const CMapWorldInfo&, float, bool);
|
|
|
|
void DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo, float alpha, int surfIdx, bool needsVtxLoad);
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CVector3f BuildSurfaceCenterPoint(int surfIdx) const;
|
|
|
|
bool IsDoorConnectedToArea(int idx, const CStateManager&) const;
|
|
|
|
bool IsDoorConnectedToVisitedArea(const CStateManager&) const;
|
|
|
|
bool IsVisibleToAutoMapper(bool worldVis, const CMapWorldInfo& mwInfo) const;
|
|
|
|
bool GetIsSeen() const;
|
2022-02-01 00:06:54 +00:00
|
|
|
void CreateDoorSurface() { m_doorSurface.emplace(); }
|
2016-07-29 17:00:23 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static void ReadAutoMapperTweaks(const ITweakAutoMapper&);
|
|
|
|
static bool GetTweakIsMapVisibilityCheat();
|
|
|
|
static bool IsDoorType(EMappableObjectType type) {
|
|
|
|
return type >= EMappableObjectType::BlueDoor && type <= EMappableObjectType::PlasmaDoorFloor2;
|
|
|
|
}
|
|
|
|
static void Shutdown();
|
2016-07-29 17:00:23 +00:00
|
|
|
};
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|