metaforce/Runtime/MP1/CSamusHud.hpp

269 lines
8.8 KiB
C++
Raw Normal View History

2017-02-12 03:17:18 +00:00
#ifndef __URDE_CSAMUSHUD_HPP__
#define __URDE_CSAMUSHUD_HPP__
2017-02-18 02:19:50 +00:00
#include "CInGameGuiManager.hpp"
2017-04-02 03:03:37 +00:00
#include "GuiSys/CTargetingManager.hpp"
#include "GuiSys/CHudBallInterface.hpp"
#include "GuiSys/CHudBossEnergyInterface.hpp"
#include "GuiSys/CHudDecoInterface.hpp"
#include "GuiSys/CHudEnergyInterface.hpp"
#include "GuiSys/CHudFreeLookInterface.hpp"
#include "GuiSys/CHudHelmetInterface.hpp"
#include "GuiSys/CHudMissileInterface.hpp"
#include "GuiSys/CHudRadarInterface.hpp"
#include "GuiSys/CHudThreatInterface.hpp"
#include "GuiSys/CHudVisorBeamMenu.hpp"
2017-02-18 02:19:50 +00:00
2017-02-12 03:17:18 +00:00
namespace urde
{
class CGuiFrame;
class CStateManager;
2017-04-02 03:03:37 +00:00
class CGuiLight;
2017-02-12 03:17:18 +00:00
2017-04-02 03:03:37 +00:00
struct CHUDMemoParms
2017-03-24 05:30:16 +00:00
{
2017-04-03 01:39:23 +00:00
float x0_ = 0.f;
bool x4_ = false;
bool x5_ = false;
bool x6_ = false;
CHUDMemoParms() = default;
CHUDMemoParms(float f1, bool b1, bool b2, bool b3)
: x0_(f1), x4_(b1), x5_(b2), x6_(b3) {}
CHUDMemoParms(CInputStream& in)
{
x0_ = in.readFloatBig();
x4_ = in.readBool();
}
2017-03-24 05:30:16 +00:00
};
2017-04-02 03:03:37 +00:00
enum class EHudState
{
Combat,
XRay,
Thermal,
Scan,
Ball,
None
};
2017-02-12 03:17:18 +00:00
namespace MP1
{
class CSamusHud
{
2017-04-02 03:03:37 +00:00
enum class ELoadPhase
{
2017-04-03 01:39:23 +00:00
Zero,
One,
Two,
Three
2017-04-02 03:03:37 +00:00
};
2017-04-03 01:39:23 +00:00
2017-04-02 03:03:37 +00:00
enum class ETransitionState
{
2017-04-03 01:39:23 +00:00
NotTransitioning,
Countdown,
Loading,
Transitioning
2017-04-02 03:03:37 +00:00
};
struct SCachedHudLight
{
zeus::CVector3f x0_pos;
zeus::CColor xc_color;
float x10_ = 0.f;
float x14_ = 0.f;
float x18_ = 0.f;
float x1c_ = 0.f;
SCachedHudLight(const zeus::CVector3f& pos, const zeus::CColor& color,
float f1, float f2, float f3, float f4)
: x0_pos(pos), xc_color(color), x10_(f1), x14_(f2), x18_(f3), x1c_(f4) {}
};
struct SVideoBand
{
CGuiModel* x0_videoband = nullptr;
float x4_randA = 0.f;
float x8_randB = 0.f;
};
struct SProfileInfo
{
u32 x0_ = 0;
u32 x4_ = 0;
u32 x8_ = 0;
u32 xc_ = 0;
};
2017-02-12 03:17:18 +00:00
friend class CInGameGuiManager;
2017-04-02 03:03:37 +00:00
ELoadPhase x4_loadPhase = ELoadPhase::Zero;
CTargetingManager x8_targetingMgr;
TLockedToken<CGuiFrame> x258_frmeHelmet;
CGuiFrame* x264_loadedFrmeHelmet = nullptr;
TLockedToken<CGuiFrame> x268_frmeBaseHud;
CGuiFrame* x274_loadedFrmeBaseHud = nullptr;
TLockedToken<CGuiFrame> x278_selectedHud; // used to be optional
CGuiFrame* x288_loadedSelectedHud = nullptr;
std::unique_ptr<CHudEnergyInterfaceBall> x28c_ballEnergyIntf;
std::unique_ptr<IHudThreatInterface> x290_threatIntf;
std::unique_ptr<CHudMissileInterfaceCombat> x294_missileIntf;
std::unique_ptr<IFreeLookInterface> x298_freeLookIntf;
std::unique_ptr<IHudDecoInterface> x29c_decoIntf;
std::unique_ptr<CHudHelmetInterface> x2a0_helmetIntf;
std::unique_ptr<CHudVisorBeamMenu> x2a4_visorMenu;
std::unique_ptr<CHudVisorBeamMenu> x2a8_beamMenu;
std::unique_ptr<CHudRadarInterface> x2ac_radarIntf;
std::unique_ptr<CHudBallInterface> x2b0_ballIntf;
std::unique_ptr<CHudBossEnergyInterface> x2b4_bossEnergyIntf;
EHudState x2b8_curState = EHudState::None;
EHudState x2bc_nextState = EHudState::None;
2017-04-03 01:39:23 +00:00
EHudState x2c0_setState = EHudState::None;
ETransitionState x2c4_activeTransState = ETransitionState::NotTransitioning;
float x2c8_transT = 1.f;
u32 x2cc_preLoadCountdown = 0;
2017-04-02 03:03:37 +00:00
float x2d0_ = 0.f;
u32 x2d4_totalEnergyTanks = 0;
u32 x2d8_missileAmount = 0;
u32 x2dc_missileCapacity = 0;
rstl::reserved_vector<SCachedHudLight, 3> x340_lights;
union
{
struct
{
bool x2e0_24_ : 1;
bool x2e0_25_ : 1;
2017-04-03 01:39:23 +00:00
bool x2e0_26_latestFirstPerson : 1;
2017-04-02 03:03:37 +00:00
bool x2e0_27_energyLow : 1;
};
u16 _dummy = 0;
};
u32 x2e4_ = 0;
u32 x2e8_ = 0;
u32 x2ec_missilesActive = 0;
2017-04-03 01:39:23 +00:00
float x2f0_visorBeamMenuAlpha = 1.f;
2017-04-02 03:03:37 +00:00
zeus::CVector3f x2f8_fpCamDir;
zeus::CVector3f x304_basewidgetIdlePos;
zeus::CVector3f x310_cameraPos;
zeus::CQuaternion x31c_;
zeus::CQuaternion x32c_;
std::unique_ptr<CActorLights> x33c_lights;
rstl::reserved_vector<SCachedHudLight, 3> x340_hudLights;
CSfxHandle x3a4_damageSfx;
CCameraFilterPass x3a8_camFilter;
CGuiWidget* x3d4_selected_basewidget_pivot = nullptr;
std::vector<zeus::CTransform> x3d8_lightTransforms;
float x3e8_ = 0.f;
float x3ec_ = 0.f;
float x3f0_ = 1.f;
float x3f4_ = 0.f;
float x3f8_ = 0.f;
float x3fc_ = 0.f;
float x400_ = 0.f;
float x404_ = 0.f;
zeus::CVector3f x408_;
float x414_ = 0.f;
float x418_ = 0.f;
zeus::CVector3f x41c_;
zeus::CMatrix3f x428_;
zeus::CQuaternion x44c_;
float x45c_ = 0.f;
float x460_ = 0.f;
float x464_ = 0.f;
rstl::reserved_vector<zeus::CTransform, 3> x46c_;
2017-04-03 01:39:23 +00:00
zeus::CVector2f x500_viewportScale = {1.f, 1.f};
2017-04-02 03:03:37 +00:00
u32 x508_ = 0;
u32 x50c_ = 0;
float x510_ = 0.f;
float x514_ = 0.f;
float x518_ = 0.f;
CCameraFilterPass x51c_camFilter2;
2017-04-03 01:39:23 +00:00
CHUDMemoParms x548_hudMemoParms;
TLockedToken<CStringTable> x550_hudMemoString;
u32 x554_hudMemoIdx = 0;
float x558_messageTextAlpha = 0.f;
float x55c_lastSfxChars = 0.f;
float x560_messageTextScale = 0.f;
u32 x564_ = 0;
zeus::CVector3f x568_fpCamDir;
float x574_ = 1.f;
float x578_ = 0.f;
float x57c_energyLowTimer = 0.f;
float x580_energyLowPulse = 0.f;
float x584_abuttonPulse = 0.f;
2017-04-02 03:03:37 +00:00
CGuiWidget* x588_base_basewidget_pivot;
CGuiWidget* x58c_helmet_BaseWidget_Pivot;
CGuiModel* x590_base_Model_AutoMapper;
CGuiTextPane* x594_base_textpane_counter;
CGuiWidget* x598_base_basewidget_message;
CGuiTextPane* x59c_base_textpane_message;
CGuiModel* x5a0_base_model_abutton;
rstl::reserved_vector<SVideoBand, 4> x5a4_videoBands;
rstl::reserved_vector<CGuiLight*, 4> x5d8_guiLights;
2017-04-03 01:39:23 +00:00
float x5ec_camFovTweaks[16];
float x62c_camYTweaks[64];
float x72c_camZTweaks[32];
2017-04-02 03:03:37 +00:00
rstl::reserved_vector<SProfileInfo, 15> x7ac_;
2017-03-24 05:30:16 +00:00
static CSamusHud* g_SamusHud;
2017-04-02 03:03:37 +00:00
static rstl::prereserved_vector<bool, 4> BuildPlayerHasVisors(const CStateManager& mgr);
static rstl::prereserved_vector<bool, 4> BuildPlayerHasBeams(const CStateManager& mgr);
void InitializeFrameGluePermanent(const CStateManager& mgr);
void InitializeFrameGlueMutable(const CStateManager& mgr);
2017-04-03 01:39:23 +00:00
void UninitializeFrameGlueMutable();
2017-04-02 03:03:37 +00:00
void UpdateEnergy(float dt, const CStateManager& mgr, bool init);
2017-04-03 01:39:23 +00:00
void UpdateFreeLook(float dt, const CStateManager& mgr);
2017-04-02 03:03:37 +00:00
void UpdateMissile(float dt, const CStateManager& mgr, bool init);
2017-04-03 01:39:23 +00:00
void UpdateVideoBands(float dt, const CStateManager& mgr);
2017-04-02 03:03:37 +00:00
void UpdateBallMode(const CStateManager& mgr, bool init);
2017-04-03 01:39:23 +00:00
void UpdateThreatAssessment(float dt, const CStateManager& mgr);
void UpdateVisorAndBeamMenus(float dt, const CStateManager& mgr);
void UpdateCameraDebugSettings();
void UpdateEnergyLow(float dt, const CStateManager& mgr);
void UpdateHudLag(float dt, const CStateManager& mgr);
void UpdateHudDynamicLights(float dt, const CStateManager& mgr);
void UpdateHudDamage(float dt, const CStateManager& mgr,
DataSpec::ITweakGui::EHelmetVisMode helmetVis);
void UpdateStaticInterference(float dt, const CStateManager& mgr);
void ShowDamage(const zeus::CVector3f& position, float dam, float prevDam, const CStateManager& mgr);
void EnterFirstPerson(const CStateManager& mgr);
void LeaveFirstPerson(const CStateManager& mgr);
2017-04-02 03:03:37 +00:00
static EHudState GetDesiredHudState(const CStateManager& mgr);
2017-02-12 03:17:18 +00:00
public:
CSamusHud(CStateManager& stateMgr);
2017-04-03 01:39:23 +00:00
void Update(float dt, const CStateManager& mgr,
DataSpec::ITweakGui::EHelmetVisMode helmetVis,
bool hudVis, bool targetingManager);
2017-04-02 03:03:37 +00:00
void UpdateStateTransition(float time, const CStateManager& mgr);
2017-02-12 03:17:18 +00:00
bool CheckLoadComplete(CStateManager& stateMgr);
2017-02-18 02:19:50 +00:00
void OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr);
2017-04-02 03:03:37 +00:00
void RefreshHudOptions();
2017-02-12 03:17:18 +00:00
void Touch();
2017-04-02 03:03:37 +00:00
static zeus::CTransform BuildFinalCameraTransform(const zeus::CQuaternion& rot,
const zeus::CVector3f& pos,
const zeus::CVector3f& camPos);
2017-04-03 01:39:23 +00:00
static void DisplayHudMemo(const std::u16string& text, const CHUDMemoParms& info)
{
if (g_SamusHud)
g_SamusHud->InternalDisplayHudMemo(text, info);
}
void InternalDisplayHudMemo(const std::u16string& text, const CHUDMemoParms& info)
{
SetMessage(text, info);
}
void SetMessage(const std::u16string& text, const CHUDMemoParms& info);
2017-04-02 03:03:37 +00:00
static void DeferHintMemo(ResId strg, u32 timePeriods, const CHUDMemoParms& info)
2017-03-24 05:30:16 +00:00
{
if (g_SamusHud)
2017-04-03 01:39:23 +00:00
g_SamusHud->InternalDeferHintMemo(strg, timePeriods, info);
2017-03-24 05:30:16 +00:00
}
2017-04-03 01:39:23 +00:00
void InternalDeferHintMemo(ResId strg, u32 timePeriods, const CHUDMemoParms& info);
2017-02-12 03:17:18 +00:00
};
}
}
#endif // __URDE_CSAMUSHUD_HPP__