Additional HUD interfaces

This commit is contained in:
Jack Andersen 2017-04-03 19:48:13 -10:00
parent 67ed82bc52
commit dc781f5c67
23 changed files with 631 additions and 54 deletions

View File

@ -35,11 +35,14 @@ struct ITweakGui : ITweak
virtual atUint32 GetHudCamFovTweak() const=0; virtual atUint32 GetHudCamFovTweak() const=0;
virtual atUint32 GetHudCamYTweak() const=0; virtual atUint32 GetHudCamYTweak() const=0;
virtual atUint32 GetHudCamZTweak() const=0; virtual atUint32 GetHudCamZTweak() const=0;
virtual float GetMissileArrowVisTime() const=0;
virtual EHudVisMode GetHudVisMode() const=0; virtual EHudVisMode GetHudVisMode() const=0;
virtual EHelmetVisMode GetHelmetVisMode() const=0; virtual EHelmetVisMode GetHelmetVisMode() const=0;
virtual atUint32 GetEnableAutoMapper() const=0; virtual atUint32 GetEnableAutoMapper() const=0;
virtual atUint32 GetEnableTargetingManager() const=0; virtual atUint32 GetEnableTargetingManager() const=0;
virtual atUint32 GetEnablePlayerVisor() const=0; virtual atUint32 GetEnablePlayerVisor() const=0;
virtual float GetMissileWarningFraction() const=0;
virtual float GetMissileWarningPulseTime() const=0;
virtual float GetScanAppearanceOffset() const=0; virtual float GetScanAppearanceOffset() const=0;
virtual float GetBallViewportYReduction() const=0; virtual float GetBallViewportYReduction() const=0;
virtual float GetScanSpeed(int idx) const=0; virtual float GetScanSpeed(int idx) const=0;

View File

@ -25,16 +25,29 @@ struct ITweakGuiColors : BigYAML
virtual zeus::CColor GetHudMessageFill() const=0; virtual zeus::CColor GetHudMessageFill() const=0;
virtual zeus::CColor GetHudMessageOutline() const=0; virtual zeus::CColor GetHudMessageOutline() const=0;
virtual zeus::CColor GetHudFrameColor() const=0; virtual zeus::CColor GetHudFrameColor() const=0;
virtual zeus::CColor GetMissileIconColorActive() const=0;
virtual zeus::CColor GetEnergyBarFilledLowEnergy() const=0; virtual zeus::CColor GetEnergyBarFilledLowEnergy() const=0;
virtual zeus::CColor GetEnergyBarShadowLowEnergy() const=0; virtual zeus::CColor GetEnergyBarShadowLowEnergy() const=0;
virtual zeus::CColor GetEnergyBarEmptyLowEnergy() const=0; virtual zeus::CColor GetEnergyBarEmptyLowEnergy() const=0;
virtual zeus::CColor GetEnergyWarningFont() const=0; virtual zeus::CColor GetEnergyWarningFont() const=0;
virtual zeus::CColor GetMissileWarningFont() const=0;
virtual zeus::CColor GetMissileBarFilled() const=0;
virtual zeus::CColor GetMissileBarShadow() const=0;
virtual zeus::CColor GetMissileBarEmpty() const=0;
virtual zeus::CColor GetTickDecoColor() const=0; virtual zeus::CColor GetTickDecoColor() const=0;
virtual zeus::CColor GetHelmetLightColor() const=0;
virtual zeus::CColor GetMissileIconColorInactive() const=0;
virtual zeus::CColor GetMissileIconColorChargedCanAlt() const=0;
virtual zeus::CColor GetMissileIconColorChargedNoAlt() const=0;
virtual zeus::CColor GetMissileIconColorDepleteAlt() const=0;
virtual zeus::CColor GetEnergyWarningOutline() const=0; virtual zeus::CColor GetEnergyWarningOutline() const=0;
virtual zeus::CColor GetMissileWarningOutline() const=0;
virtual zeus::CColor GetEnergyBarFlashColor() const=0; virtual zeus::CColor GetEnergyBarFlashColor() const=0;
virtual zeus::CColor GetXRayEnergyDecoColor() const=0; virtual zeus::CColor GetXRayEnergyDecoColor() const=0;
virtual zeus::CColor GetHudCounterFill() const=0; virtual zeus::CColor GetHudCounterFill() const=0;
virtual zeus::CColor GetHudCounterOutline() const=0; virtual zeus::CColor GetHudCounterOutline() const=0;
virtual zeus::CColor GetMissileDigitsFont() const=0;
virtual zeus::CColor GetMissileDigitsOutline() const=0;
virtual zeus::CColor GetThermalDecoColor() const=0; virtual zeus::CColor GetThermalDecoColor() const=0;
virtual zeus::CColor GetThermalOutlinesColor() const=0; virtual zeus::CColor GetThermalOutlinesColor() const=0;
virtual zeus::CColor GetThermalLockColor() const=0; virtual zeus::CColor GetThermalLockColor() const=0;

View File

@ -66,7 +66,7 @@ struct CTweakGui : ITweakGui
Value<float> xe8_; Value<float> xe8_;
Value<float> xec_; Value<float> xec_;
Value<float> xf0_; Value<float> xf0_;
Value<float> xf4_; Value<float> xf4_missileArrowVisTime;
Value<EHudVisMode> xf8_hudVisMode; Value<EHudVisMode> xf8_hudVisMode;
Value<EHelmetVisMode> xfc_helmetVisMode; Value<EHelmetVisMode> xfc_helmetVisMode;
Value<atUint32> x100_enableAutoMapper; Value<atUint32> x100_enableAutoMapper;
@ -74,7 +74,7 @@ struct CTweakGui : ITweakGui
Value<atUint32> x108_enableTargetingManager; Value<atUint32> x108_enableTargetingManager;
Value<atUint32> x10c_enablePlayerVisor; Value<atUint32> x10c_enablePlayerVisor;
Value<float> x110_; Value<float> x110_;
Value<float> x114_; Value<float> x114_missileWarningFraction;
Value<float> x118_; Value<float> x118_;
Value<float> x11c_; Value<float> x11c_;
Value<float> x120_; Value<float> x120_;
@ -94,7 +94,7 @@ struct CTweakGui : ITweakGui
String<-1> x170_; String<-1> x170_;
String<-1> x180_; String<-1> x180_;
String<-1> x190_; String<-1> x190_;
Value<float> x1a0_; Value<float> x1a0_missileWarningPulseTime;
Value<float> x1a4_; Value<float> x1a4_;
Value<float> x1a8_; Value<float> x1a8_;
Value<float> x1ac_; Value<float> x1ac_;
@ -203,11 +203,14 @@ struct CTweakGui : ITweakGui
atUint32 GetHudCamFovTweak() const { return xa8_hudCamFovTweak; } atUint32 GetHudCamFovTweak() const { return xa8_hudCamFovTweak; }
atUint32 GetHudCamYTweak() const { return xac_hudCamYTweak; } atUint32 GetHudCamYTweak() const { return xac_hudCamYTweak; }
atUint32 GetHudCamZTweak() const { return xb0_hudCamZTweak; } atUint32 GetHudCamZTweak() const { return xb0_hudCamZTweak; }
float GetMissileArrowVisTime() const { return xf4_missileArrowVisTime; }
EHudVisMode GetHudVisMode() const { return xf8_hudVisMode; } EHudVisMode GetHudVisMode() const { return xf8_hudVisMode; }
EHelmetVisMode GetHelmetVisMode() const { return xfc_helmetVisMode; } EHelmetVisMode GetHelmetVisMode() const { return xfc_helmetVisMode; }
atUint32 GetEnableAutoMapper() const { return x100_enableAutoMapper; } atUint32 GetEnableAutoMapper() const { return x100_enableAutoMapper; }
atUint32 GetEnableTargetingManager() const { return x108_enableTargetingManager; } atUint32 GetEnableTargetingManager() const { return x108_enableTargetingManager; }
atUint32 GetEnablePlayerVisor() const { return x10c_enablePlayerVisor; } atUint32 GetEnablePlayerVisor() const { return x10c_enablePlayerVisor; }
float GetMissileWarningFraction() const { return x114_missileWarningFraction; }
float GetMissileWarningPulseTime() const { return x1a0_missileWarningPulseTime; }
float GetScanAppearanceOffset() const { return x244_scanAppearanceOffset; } float GetScanAppearanceOffset() const { return x244_scanAppearanceOffset; }
float GetBallViewportYReduction() const { return x254_ballViewportYReduction; } float GetBallViewportYReduction() const { return x254_ballViewportYReduction; }
float GetXrayBlurScaleLinear() const { return x204_xrayBlurScaleLinear; } float GetXrayBlurScaleLinear() const { return x204_xrayBlurScaleLinear; }

View File

@ -19,7 +19,7 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor x1c_hudFrameColor; DNAColor x1c_hudFrameColor;
DNAColor x20_; DNAColor x20_;
DNAColor x24_; DNAColor x24_;
DNAColor x28_; DNAColor x28_missileIconColorActive;
DNAColor x2c_; DNAColor x2c_;
DNAColor x30_; DNAColor x30_;
DNAColor x34_energyBarFilledLowEnergy; DNAColor x34_energyBarFilledLowEnergy;
@ -34,29 +34,29 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor x58_; DNAColor x58_;
DNAColor x5c_energyWarningFont; DNAColor x5c_energyWarningFont;
DNAColor x60_; DNAColor x60_;
DNAColor x64_; DNAColor x64_missileWarningFont;
DNAColor x68_; DNAColor x68_;
DNAColor x6c_; DNAColor x6c_;
DNAColor x70_; DNAColor x70_;
DNAColor x74_; DNAColor x74_missileBarFilled;
DNAColor x78_; DNAColor x78_missileBarShadow;
DNAColor x7c_; DNAColor x7c_missileBarEmpty;
DNAColor x80_; DNAColor x80_;
DNAColor x84_; DNAColor x84_;
DNAColor x88_tickDecoColor; DNAColor x88_tickDecoColor;
DNAColor x8c_; DNAColor x8c_helmetLightColor;
DNAColor x90_; DNAColor x90_;
DNAColor x94_; DNAColor x94_missileIconColorInactive;
DNAColor x98_; DNAColor x98_missileIconColorChargedCanAlt;
DNAColor x9c_; DNAColor x9c_missileIconColorChargedNoAlt;
DNAColor xa0_; DNAColor xa0_missileIconColorDepleteAlt;
DNAColor xa4_; DNAColor xa4_;
DNAColor xa8_; DNAColor xa8_;
DNAColor xac_; DNAColor xac_;
DNAColor xb0_; DNAColor xb0_;
DNAColor xb4_energyWarningOutline; DNAColor xb4_energyWarningOutline;
DNAColor xb8_; DNAColor xb8_;
DNAColor xbc_; DNAColor xbc_missileWarningOutline;
DNAColor xc0_; DNAColor xc0_;
DNAColor xc4_; DNAColor xc4_;
DNAColor xc8_; DNAColor xc8_;
@ -114,8 +114,8 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor x198_; DNAColor x198_;
DNAColor x19c_; DNAColor x19c_;
DNAColor x1a0_; DNAColor x1a0_;
DNAColor x1a4_; DNAColor x1a4_missileDigitsFont;
DNAColor x1a8_; DNAColor x1a8_missileDigitsOutline;
DNAColor x1ac_thermalDecoColor; DNAColor x1ac_thermalDecoColor;
DNAColor x1b0_thermalOutlinesColor; DNAColor x1b0_thermalOutlinesColor;
DNAColor x1b4_; DNAColor x1b4_;
@ -143,16 +143,29 @@ struct CTweakGuiColors : public ITweakGuiColors
zeus::CColor GetHudMessageFill() const { return x14_hudMessageFill; } zeus::CColor GetHudMessageFill() const { return x14_hudMessageFill; }
zeus::CColor GetHudMessageOutline() const { return x18_hudMessageOutline; } zeus::CColor GetHudMessageOutline() const { return x18_hudMessageOutline; }
zeus::CColor GetHudFrameColor() const { return x1c_hudFrameColor; } zeus::CColor GetHudFrameColor() const { return x1c_hudFrameColor; }
zeus::CColor GetMissileIconColorActive() const { return x28_missileIconColorActive; }
zeus::CColor GetEnergyBarFilledLowEnergy() const { return x34_energyBarFilledLowEnergy; } zeus::CColor GetEnergyBarFilledLowEnergy() const { return x34_energyBarFilledLowEnergy; }
zeus::CColor GetEnergyBarShadowLowEnergy() const { return x38_energyBarShadowLowEnergy; } zeus::CColor GetEnergyBarShadowLowEnergy() const { return x38_energyBarShadowLowEnergy; }
zeus::CColor GetEnergyBarEmptyLowEnergy() const { return x3c_energyBarEmptyLowEnergy; } zeus::CColor GetEnergyBarEmptyLowEnergy() const { return x3c_energyBarEmptyLowEnergy; }
zeus::CColor GetEnergyWarningFont() const { return x5c_energyWarningFont; } zeus::CColor GetEnergyWarningFont() const { return x5c_energyWarningFont; }
zeus::CColor GetMissileWarningFont() const { return x64_missileWarningFont; }
zeus::CColor GetMissileBarFilled() const { return x74_missileBarFilled; }
zeus::CColor GetMissileBarShadow() const { return x78_missileBarShadow; }
zeus::CColor GetMissileBarEmpty() const { return x7c_missileBarEmpty; }
zeus::CColor GetTickDecoColor() const { return x88_tickDecoColor; } zeus::CColor GetTickDecoColor() const { return x88_tickDecoColor; }
zeus::CColor GetHelmetLightColor() const { return x8c_helmetLightColor; }
zeus::CColor GetMissileIconColorInactive() const { return x94_missileIconColorInactive; }
zeus::CColor GetMissileIconColorChargedCanAlt() const { return x98_missileIconColorChargedCanAlt; }
zeus::CColor GetMissileIconColorChargedNoAlt() const { return x9c_missileIconColorChargedNoAlt; }
zeus::CColor GetMissileIconColorDepleteAlt() const { return xa0_missileIconColorDepleteAlt; }
zeus::CColor GetEnergyWarningOutline() const { return xb4_energyWarningOutline; } zeus::CColor GetEnergyWarningOutline() const { return xb4_energyWarningOutline; }
zeus::CColor GetMissileWarningOutline() const { return xbc_missileWarningOutline; }
zeus::CColor GetEnergyBarFlashColor() const { return xe8_energyBarFlashColor; } zeus::CColor GetEnergyBarFlashColor() const { return xe8_energyBarFlashColor; }
zeus::CColor GetXRayEnergyDecoColor() const { return x100_xrayEnergyDecoColor; } zeus::CColor GetXRayEnergyDecoColor() const { return x100_xrayEnergyDecoColor; }
zeus::CColor GetHudCounterFill() const { return x180_hudCounterFill; } zeus::CColor GetHudCounterFill() const { return x180_hudCounterFill; }
zeus::CColor GetHudCounterOutline() const { return x184_hudCounterOutline; } zeus::CColor GetHudCounterOutline() const { return x184_hudCounterOutline; }
zeus::CColor GetMissileDigitsFont() const { return x1a4_missileDigitsFont; }
zeus::CColor GetMissileDigitsOutline() const { return x1a8_missileDigitsOutline; }
zeus::CColor GetThermalDecoColor() const { return x1ac_thermalDecoColor; } zeus::CColor GetThermalDecoColor() const { return x1ac_thermalDecoColor; }
zeus::CColor GetThermalOutlinesColor() const { return x1b0_thermalOutlinesColor; } zeus::CColor GetThermalOutlinesColor() const { return x1b0_thermalOutlinesColor; }
zeus::CColor GetThermalLockColor() const { return x1b8_thermalLockColor; } zeus::CColor GetThermalLockColor() const { return x1b8_thermalLockColor; }

View File

@ -131,6 +131,7 @@ public:
float sub_80091204() const; float sub_80091204() const;
u32 GetMissileCostForAltAttack() const; u32 GetMissileCostForAltAttack() const;
static float GetMissileComboChargeFactor() { return 1.8f; }
u32 CalculateItemCollectionRate() const; u32 CalculateItemCollectionRate() const;
CHealthInfo& HealthInfo(); CHealthInfo& HealthInfo();

View File

@ -2620,6 +2620,13 @@ std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const
return {num, denom}; return {num, denom};
} }
void CStateManager::SetBossParams(TUniqueId bossId, float maxEnergy, u32 stringIdx)
{
xf18_bossId = bossId;
xf1c_totalBossEnergy = maxEnergy;
xf20_bossStringIdx = stringIdx;
}
float CStateManager::g_EscapeShakeCountdown; float CStateManager::g_EscapeShakeCountdown;
bool CStateManager::g_EscapeShakeCountdownInit = false; bool CStateManager::g_EscapeShakeCountdownInit = false;
} }

View File

@ -210,9 +210,9 @@ private:
float xf0c_escapeTimer = 0.f; float xf0c_escapeTimer = 0.f;
float xf10_escapeTotalTime = 0.f; float xf10_escapeTotalTime = 0.f;
float xf14_curTimeMod900 = 0.f; float xf14_curTimeMod900 = 0.f;
TUniqueId xf18_ = kInvalidUniqueId; TUniqueId xf18_bossId = kInvalidUniqueId;
float xf1c_ = 0.f; float xf1c_totalBossEnergy = 0.f;
u32 xf20_ = 0; u32 xf20_bossStringIdx = 0;
float xf24_thermColdScale1 = 0.f; float xf24_thermColdScale1 = 0.f;
float xf28_thermColdScale2 = 0.f; float xf28_thermColdScale2 = 0.f;
zeus::CVector2f xf2c_viewportScale = {1.f, 1.f}; zeus::CVector2f xf2c_viewportScale = {1.f, 1.f};
@ -447,6 +447,7 @@ public:
void SetIsGeneratingObject(bool gen) { xf94_26_generatingObject = gen; } void SetIsGeneratingObject(bool gen) { xf94_26_generatingObject = gen; }
u32 GetParticleFlags() const { return xf34_particleFlags; } u32 GetParticleFlags() const { return xf34_particleFlags; }
const CFinalInput& GetFinalInput() const { return xb54_finalInput; } const CFinalInput& GetFinalInput() const { return xb54_finalInput; }
void SetBossParams(TUniqueId bossId, float maxEnergy, u32 stringIdx);
static float g_EscapeShakeCountdown; static float g_EscapeShakeCountdown;
static bool g_EscapeShakeCountdownInit; static bool g_EscapeShakeCountdownInit;

View File

@ -47,6 +47,7 @@ public:
void Update(float dt); void Update(float dt);
void Draw(const CGuiWidgetDrawParms& drawParms) const; void Draw(const CGuiWidgetDrawParms& drawParms) const;
float GetActualFraction() const { return xe0_maxEnergy == 0.f ? 0.f : xf4_setEnergy / xe0_maxEnergy; } float GetActualFraction() const { return xe0_maxEnergy == 0.f ? 0.f : xf4_setEnergy / xe0_maxEnergy; }
float GetSetEnergy() const { return xf4_setEnergy; }
float GetFilledEnergy() const { return xf8_filledEnergy; } float GetFilledEnergy() const { return xf8_filledEnergy; }
void SetCurrEnergy(float e, ESetMode mode); void SetCurrEnergy(float e, ESetMode mode);
void SetCoordFunc(FCoordFunc func) { xd8_coordFunc = func; } void SetCoordFunc(FCoordFunc func) { xd8_coordFunc = func; }

View File

@ -115,6 +115,12 @@ bool CGuiWidget::GetIsFinishedLoadingWidgetSpecific() const
return true; return true;
} }
void CGuiWidget::SetTransform(const zeus::CTransform& xf)
{
x74_transform = xf;
ReapplyXform();
}
void CGuiWidget::SetIdlePosition(const zeus::CVector3f& pos, bool reapply) void CGuiWidget::SetIdlePosition(const zeus::CVector3f& pos, bool reapply)
{ {
x74_transform.origin = pos; x74_transform.origin = pos;

View File

@ -113,6 +113,7 @@ public:
const zeus::CTransform& GetTransform() const {return x74_transform;} const zeus::CTransform& GetTransform() const {return x74_transform;}
zeus::CTransform& GetTransform() {return x74_transform;} zeus::CTransform& GetTransform() {return x74_transform;}
const zeus::CVector3f& GetIdlePosition() const {return x74_transform.origin;} const zeus::CVector3f& GetIdlePosition() const {return x74_transform.origin;}
void SetTransform(const zeus::CTransform& xf);
const zeus::CColor& GetGeometryColor() const { return xa8_color2; } const zeus::CColor& GetGeometryColor() const { return xa8_color2; }
void SetIdlePosition(const zeus::CVector3f& pos, bool reapply); void SetIdlePosition(const zeus::CVector3f& pos, bool reapply);
void ReapplyXform(); void ReapplyXform();

View File

@ -1,11 +1,66 @@
#include "CHudBossEnergyInterface.hpp" #include "CHudBossEnergyInterface.hpp"
#include "CGuiFrame.hpp"
#include "CAuiEnergyBarT01.hpp"
#include "GameGlobalObjects.hpp"
#include "CGuiTextPane.hpp"
namespace urde namespace urde
{ {
CHudBossEnergyInterface::CHudBossEnergyInterface(CGuiFrame& selHud)
{
x10_24_visible = false;
x14_basewidget_bossenergystuff = selHud.FindWidget("basewidget_bossenergystuff");
x18_energybart01_bossbar = static_cast<CAuiEnergyBarT01*>(selHud.FindWidget("energybart01_bossbar"));
x1c_textpane_boss = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_boss"));
x18_energybart01_bossbar->SetCoordFunc(BossEnergyCoordFunc);
x18_energybart01_bossbar->SetTesselation(0.2f);
ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(0);
x18_energybart01_bossbar->SetFilledColor(barColors.filled);
x18_energybart01_bossbar->SetShadowColor(barColors.shadow);
x18_energybart01_bossbar->SetEmptyColor(barColors.empty);
}
void CHudBossEnergyInterface::Update(float dt) void CHudBossEnergyInterface::Update(float dt)
{ {
if (x10_24_visible)
x4_fader = std::min(x4_fader + dt, 1.f);
else
x4_fader = std::max(0.f, x4_fader - dt);
if (x4_fader > 0.f)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = x0_alpha * x4_fader;
x14_basewidget_bossenergystuff->SetColor(color);
x14_basewidget_bossenergystuff->SetVisibility(true, ETraversalMode::Children);
}
else
{
x14_basewidget_bossenergystuff->SetVisibility(false, ETraversalMode::Children);
}
}
void CHudBossEnergyInterface::SetBossParams(bool visible, const std::u16string& name,
float curEnergy, float maxEnergy)
{
x10_24_visible = visible;
if (visible)
{
x18_energybart01_bossbar->SetFilledDrainSpeed(maxEnergy);
x18_energybart01_bossbar->SetCurrEnergy(curEnergy, CAuiEnergyBarT01::ESetMode::Normal);
x18_energybart01_bossbar->SetMaxEnergy(maxEnergy);
x1c_textpane_boss->TextSupport()->SetText(name);
}
x8_curEnergy = curEnergy;
xc_maxEnergy = maxEnergy;
}
std::pair<zeus::CVector3f, zeus::CVector3f> CHudBossEnergyInterface::BossEnergyCoordFunc(float t)
{
float x = 9.25f * t - 4.625f;
return {zeus::CVector3f(x, 0.f, 0.f), zeus::CVector3f(x, 0.f, 0.4f)};
} }
} }

View File

@ -1,15 +1,32 @@
#ifndef __URDE_CHUDBOSSENERGYINTERFACE_HPP__ #ifndef __URDE_CHUDBOSSENERGYINTERFACE_HPP__
#define __URDE_CHUDBOSSENERGYINTERFACE_HPP__ #define __URDE_CHUDBOSSENERGYINTERFACE_HPP__
#include "RetroTypes.hpp"
namespace urde namespace urde
{ {
class CGuiFrame;
class CGuiWidget;
class CAuiEnergyBarT01;
class CGuiTextPane;
class CHudBossEnergyInterface class CHudBossEnergyInterface
{ {
float x0_alpha; float x0_alpha;
float x4_fader = 0.f;
float x8_curEnergy = 0.f;
float xc_maxEnergy = 0.f;
bool x10_24_visible : 1;
CGuiWidget* x14_basewidget_bossenergystuff;
CAuiEnergyBarT01* x18_energybart01_bossbar;
CGuiTextPane* x1c_textpane_boss;
public: public:
void SetAlpha(float a) { x0_alpha = a; } CHudBossEnergyInterface(CGuiFrame& selHud);
void Update(float dt); void Update(float dt);
void SetAlpha(float a) { x0_alpha = a; }
void SetBossParams(bool visible, const std::u16string& name,
float curEnergy, float maxEnergy);
static std::pair<zeus::CVector3f, zeus::CVector3f> BossEnergyCoordFunc(float t);
}; };
} }

View File

@ -21,12 +21,12 @@ static const CAuiEnergyBarT01::FCoordFunc CoordFuncs[] =
static const float Tesselations[] = static const float Tesselations[] =
{ {
0.2f, 0.2f, 0.1f, 0.2f, 0.1f 0.2f, 0.2f, 0.1f, 0.2f, 1.f
}; };
CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, int totalEnergyTanks, CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, int totalEnergyTanks,
int numTanksFilled, bool energyLow, EBarType barType) int numTanksFilled, bool energyLow, EHudType hudType)
: x0_barType(barType), xc_tankEnergy(tankEnergy), x10_totalEnergyTanks(totalEnergyTanks), : x0_hudType(hudType), xc_tankEnergy(tankEnergy), x10_totalEnergyTanks(totalEnergyTanks),
x14_numTanksFilled(numTanksFilled) x14_numTanksFilled(numTanksFilled)
{ {
x1c_24_ = true; x1c_24_ = true;
@ -39,11 +39,11 @@ CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, in
x28_textpane_energywarning = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energywarning")); x28_textpane_energywarning = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energywarning"));
x2c_energybart01_energybar = static_cast<CAuiEnergyBarT01*>(selHud.FindWidget("energybart01_energybar")); x2c_energybart01_energybar = static_cast<CAuiEnergyBarT01*>(selHud.FindWidget("energybart01_energybar"));
x2c_energybart01_energybar->SetCoordFunc(CoordFuncs[int(barType)]); x2c_energybart01_energybar->SetCoordFunc(CoordFuncs[int(hudType)]);
x2c_energybart01_energybar->SetTesselation(Tesselations[int(barType)]); x2c_energybart01_energybar->SetTesselation(Tesselations[int(hudType)]);
ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(barType)); ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(hudType));
ITweakGuiColors::VisorEnergyInitColors initColors = g_tweakGuiColors->GetVisorEnergyInitColors(int(barType)); ITweakGuiColors::VisorEnergyInitColors initColors = g_tweakGuiColors->GetVisorEnergyInitColors(int(hudType));
x20_textpane_energydigits->TextSupport()->SetFontColor(initColors.digitsFont); x20_textpane_energydigits->TextSupport()->SetFontColor(initColors.digitsFont);
x20_textpane_energydigits->TextSupport()->SetOutlineColor(initColors.digitsOutline); x20_textpane_energydigits->TextSupport()->SetOutlineColor(initColors.digitsOutline);
@ -108,12 +108,12 @@ void CHudEnergyInterface::Update(float dt, float energyLowPulse)
{ {
x1c_26_barDirty = false; x1c_26_barDirty = false;
x18_cachedBarEnergy = x2c_energybart01_energybar->GetFilledEnergy(); x18_cachedBarEnergy = x2c_energybart01_energybar->GetFilledEnergy();
std::u16string string = hecl::UTF8ToChar16(hecl::Format("%02d", std::string string = hecl::Format("%02d",
int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity())))); int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity())));
x20_textpane_energydigits->TextSupport()->SetText(string); x20_textpane_energydigits->TextSupport()->SetText(string);
} }
ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(x0_barType)); ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(x0_hudType));
zeus::CColor emptyColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarEmptyLowEnergy() : barColors.empty; zeus::CColor emptyColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarEmptyLowEnergy() : barColors.empty;
zeus::CColor filledColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarFilledLowEnergy() : barColors.filled; zeus::CColor filledColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarFilledLowEnergy() : barColors.filled;
zeus::CColor shadowColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarShadowLowEnergy() : barColors.shadow; zeus::CColor shadowColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarShadowLowEnergy() : barColors.shadow;

View File

@ -2,6 +2,7 @@
#define __URDE_CHUDENERGYINTERFACE_HPP__ #define __URDE_CHUDENERGYINTERFACE_HPP__
#include "RetroTypes.hpp" #include "RetroTypes.hpp"
#include "CHudInterface.hpp"
namespace urde namespace urde
{ {
@ -13,17 +14,7 @@ class CAuiEnergyBarT01;
class CHudEnergyInterface class CHudEnergyInterface
{ {
public: EHudType x0_hudType;
enum class EBarType
{
Combat,
Scan,
XRay,
Thermal,
Ball
};
private:
EBarType x0_barType;
float x4_energyLowFader = 0.f; float x4_energyLowFader = 0.f;
float x8_flashMag = 0.f; float x8_flashMag = 0.f;
float xc_tankEnergy; float xc_tankEnergy;
@ -47,7 +38,7 @@ private:
CAuiEnergyBarT01* x2c_energybart01_energybar; CAuiEnergyBarT01* x2c_energybart01_energybar;
public: public:
CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, int totalEnergyTanks, CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, int totalEnergyTanks,
int numTanksFilled, bool energyLow, EBarType barType); int numTanksFilled, bool energyLow, EHudType hudType);
void Update(float dt, float energyLowPulse); void Update(float dt, float energyLowPulse);
void SetEnergyLow(bool energyLow); void SetEnergyLow(bool energyLow);
void SetFlashMagnitude(float mag); void SetFlashMagnitude(float mag);

View File

@ -1,31 +1,77 @@
#include "CHudHelmetInterface.hpp" #include "CHudHelmetInterface.hpp"
#include "CGuiFrame.hpp"
#include "CGuiCamera.hpp"
#include "GameGlobalObjects.hpp"
#include "CGameState.hpp"
namespace urde namespace urde
{ {
CHudHelmetInterface::CHudHelmetInterface(CGuiFrame& helmetFrame) CHudHelmetInterface::CHudHelmetInterface(CGuiFrame& helmetFrame)
{ {
x3c_24_helmetVisibleDebug = true;
x3c_25_helmetVisibleGame = true;
x3c_26_glowVisibleDebug = true;
x3c_27_glowVisibleGame = true;
x40_camera = helmetFrame.GetFrameCamera();
x44_BaseWidget_Pivot = helmetFrame.FindWidget("BaseWidget_Pivot");
x48_BaseWidget_Helmet = helmetFrame.FindWidget("BaseWidget_Helmet");
x4c_BaseWidget_Glow = helmetFrame.FindWidget("BaseWidget_Glow");
x50_BaseWidget_HelmetLight = helmetFrame.FindWidget("BaseWidget_HelmetLight");
x24_pivotPosition = x44_BaseWidget_Pivot->GetIdlePosition();
x50_BaseWidget_HelmetLight->SetColor(g_tweakGuiColors->GetHelmetLightColor());
}
void CHudHelmetInterface::UpdateVisibility()
{
x48_BaseWidget_Helmet->SetVisibility(x3c_24_helmetVisibleDebug && x3c_25_helmetVisibleGame, ETraversalMode::Children);
x4c_BaseWidget_Glow->SetVisibility(x3c_26_glowVisibleDebug && x3c_27_glowVisibleGame, ETraversalMode::Children);
} }
void CHudHelmetInterface::Update(float dt) void CHudHelmetInterface::Update(float dt)
{ {
if (x3c_28_hudLagDirty)
{
x3c_28_hudLagDirty = false;
x44_BaseWidget_Pivot->SetTransform(zeus::CTransform(x0_hudLagRotation, x24_pivotPosition + x30_hudLagPosition));
}
} }
void CHudHelmetInterface::SetIsVisibleDebug(bool helmet, bool glow) void CHudHelmetInterface::SetHudLagOffset(const zeus::CVector3f& off)
{ {
x30_hudLagPosition = off;
x3c_28_hudLagDirty = true;
}
void CHudHelmetInterface::SetHudLagRotation(const zeus::CMatrix3f& rot)
{
x0_hudLagRotation = rot;
x3c_28_hudLagDirty = true;
}
void CHudHelmetInterface::AddHelmetLightValue(float val)
{
x50_BaseWidget_HelmetLight->SetColor(g_tweakGuiColors->GetHelmetLightColor() + zeus::CColor(val, val));
} }
void CHudHelmetInterface::UpdateCameraDebugSettings(float fov, float y, float z) void CHudHelmetInterface::UpdateCameraDebugSettings(float fov, float y, float z)
{ {
x40_camera->SetFov(fov);
x40_camera->SetTransform(zeus::CTransform(x40_camera->GetTransform().buildMatrix3f(), zeus::CVector3f(0.f, y, z)));
} }
void CHudHelmetInterface::UpdateHelmetAlpha() void CHudHelmetInterface::UpdateHelmetAlpha()
{ {
zeus::CColor color = zeus::CColor::skWhite;
color.a = g_GameState->GameOptions().GetHelmetAlpha() / 255.f;
x44_BaseWidget_Pivot->SetColor(color);
}
void CHudHelmetInterface::SetIsVisibleDebug(bool helmet, bool glow)
{
x3c_24_helmetVisibleDebug = helmet;
x3c_26_glowVisibleDebug = glow;
UpdateVisibility();
} }
} }

View File

@ -1,18 +1,47 @@
#ifndef __URDE_CHUDHELMETINTERFACE_HPP__ #ifndef __URDE_CHUDHELMETINTERFACE_HPP__
#define __URDE_CHUDHELMETINTERFACE_HPP__ #define __URDE_CHUDHELMETINTERFACE_HPP__
#include "zeus/CMatrix3f.hpp"
#include "RetroTypes.hpp"
namespace urde namespace urde
{ {
class CGuiFrame; class CGuiFrame;
class CGuiWidget;
class CGuiCamera;
class CHudHelmetInterface class CHudHelmetInterface
{ {
zeus::CMatrix3f x0_hudLagRotation;
zeus::CVector3f x24_pivotPosition;
zeus::CVector3f x30_hudLagPosition;
union
{
struct
{
bool x3c_24_helmetVisibleDebug : 1;
bool x3c_25_helmetVisibleGame : 1;
bool x3c_26_glowVisibleDebug : 1;
bool x3c_27_glowVisibleGame : 1;
bool x3c_28_hudLagDirty : 1;
};
u16 _dummy = 0;
};
CGuiCamera* x40_camera;
CGuiWidget* x44_BaseWidget_Pivot;
CGuiWidget* x48_BaseWidget_Helmet;
CGuiWidget* x4c_BaseWidget_Glow;
CGuiWidget* x50_BaseWidget_HelmetLight;
void UpdateVisibility();
public: public:
CHudHelmetInterface(CGuiFrame& helmetFrame); CHudHelmetInterface(CGuiFrame& helmetFrame);
void Update(float dt); void Update(float dt);
void SetIsVisibleDebug(bool helmet, bool glow); void SetHudLagOffset(const zeus::CVector3f& off);
void SetHudLagRotation(const zeus::CMatrix3f& rot);
void AddHelmetLightValue(float val);
void UpdateCameraDebugSettings(float fov, float y, float z); void UpdateCameraDebugSettings(float fov, float y, float z);
void UpdateHelmetAlpha(); void UpdateHelmetAlpha();
void SetIsVisibleDebug(bool helmet, bool glow);
}; };
} }

View File

@ -0,0 +1,18 @@
#ifndef __URDE_CHUDINTERFACE_HPP__
#define __URDE_CHUDINTERFACE_HPP__
namespace urde
{
enum class EHudType
{
Combat,
Scan,
XRay,
Thermal,
Ball
};
}
#endif // __URDE_CHUDINTERFACE_HPP__

View File

@ -1,11 +1,314 @@
#include "CHudMissileInterface.hpp" #include "CHudMissileInterface.hpp"
#include "CGuiFrame.hpp"
#include "CAuiEnergyBarT01.hpp"
#include "CGuiTextPane.hpp"
#include "GameGlobalObjects.hpp"
#include "CStateManager.hpp"
#include "CGuiModel.hpp"
#include "CStringTable.hpp"
namespace urde namespace urde
{ {
void CHudMissileInterfaceCombat::Update(float dt, const CStateManager& mgr) static const CAuiEnergyBarT01::FCoordFunc CoordFuncs[] =
{ {
CHudMissileInterface::CombatMissileBarCoordFunc,
nullptr,
CHudMissileInterface::XRayMissileBarCoordFunc,
CHudMissileInterface::ThermalMissileBarCoordFunc,
nullptr
};
static const float IconTranslateRanges[] =
{
6.05f, 0.f, 0.f, 8.4f, 0.f
};
CHudMissileInterface::CHudMissileInterface(CGuiFrame& selHud, int missileCapacity, int numMissiles,
float chargeFactor, bool missilesActive, EHudType hudType,
const CStateManager& mgr)
: x0_hudType(hudType), x4_missileCapacity(missileCapacity),
x8_numMissles(numMissiles), x4c_chargeBeamFactor(chargeFactor)
{
x58_24_missilesActive = missilesActive;
x58_25_visibleDebug = true;
x58_26_visibleGame = true;
x5c_basewidget_missileicon = selHud.FindWidget("basewidget_missileicon");
x60_textpane_missiledigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_missiledigits"));
x64_energybart01_missilebar = static_cast<CAuiEnergyBarT01*>(selHud.FindWidget("energybart01_missilebar"));
x68_textpane_missilewarning = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_missilewarning"));
x6c_model_missilearrowup = static_cast<CGuiModel*>(selHud.FindWidget("model_missilearrowup"));
x70_model_missilearrowdown = static_cast<CGuiModel*>(selHud.FindWidget("model_missilearrowdown"));
x74_basewidget_missileicon = selHud.FindWidget("basewidget_missileicon");
x58_27_hasArrows = x6c_model_missilearrowup && x70_model_missilearrowdown;
x58_28_notXRay = hudType != EHudType::XRay;
x10_missleIconXf = x74_basewidget_missileicon->GetLocalTransform();
x60_textpane_missiledigits->TextSupport()->SetFontColor(g_tweakGuiColors->GetMissileDigitsFont());
x60_textpane_missiledigits->TextSupport()->SetOutlineColor(g_tweakGuiColors->GetMissileDigitsOutline());
x74_basewidget_missileicon->SetColor(g_tweakGuiColors->GetMissileIconColorInactive());
x64_energybart01_missilebar->SetEmptyColor(g_tweakGuiColors->GetMissileBarEmpty());
x64_energybart01_missilebar->SetFilledColor(g_tweakGuiColors->GetMissileBarFilled());
x64_energybart01_missilebar->SetShadowColor(g_tweakGuiColors->GetMissileBarShadow());
x64_energybart01_missilebar->SetCoordFunc(CoordFuncs[int(hudType)]);
x64_energybart01_missilebar->SetTesselation(hudType == EHudType::Combat ? 1.f : 0.1f);
x64_energybart01_missilebar->SetMaxEnergy(5.f);
x64_energybart01_missilebar->SetFilledDrainSpeed(g_tweakGui->GetEnergyBarFilledSpeed());
x64_energybart01_missilebar->SetShadowDrainSpeed(g_tweakGui->GetEnergyBarShadowSpeed());
x64_energybart01_missilebar->SetShadowDrainDelay(g_tweakGui->GetEnergyBarDrainDelay());
x64_energybart01_missilebar->SetIsAlwaysResetTimer(true);
if (x68_textpane_missilewarning)
{
x68_textpane_missilewarning->TextSupport()->SetFontColor(g_tweakGuiColors->GetMissileWarningFont());
x68_textpane_missilewarning->TextSupport()->SetOutlineColor(g_tweakGuiColors->GetMissileWarningOutline());
}
SetNumMissiles(x8_numMissles, mgr);
x44_latestStatus = GetMissileInventoryStatus();
}
void CHudMissileInterface::UpdateVisibility(const CStateManager& mgr)
{
bool vis = x58_25_visibleDebug && x58_26_visibleGame;
x5c_basewidget_missileicon->SetVisibility(vis, ETraversalMode::Children);
x64_energybart01_missilebar->SetVisibility(vis, ETraversalMode::Children);
if (vis)
Update(0.f, mgr);
}
void CHudMissileInterface::Update(float dt, const CStateManager& mgr)
{
if (x4_missileCapacity < 1)
x5c_basewidget_missileicon->SetIsVisible(false);
else
x5c_basewidget_missileicon->SetIsVisible(true);
if (x54_missileIconIncrement < 0.f)
{
x54_missileIconIncrement -= 3.f * dt;
if (x54_missileIconIncrement <= -1.f)
x54_missileIconIncrement = 1.f;
}
else if (x54_missileIconIncrement > 0.f)
{
x54_missileIconIncrement = std::max(0.f, x54_missileIconIncrement - dt);
}
zeus::CColor addColor = g_tweakGuiColors->GetMissileIconColorActive() * x54_missileIconIncrement;
if (x50_missileIconAltDeplete > 0.f)
{
x74_basewidget_missileicon->SetColor(
zeus::CColor::lerp(g_tweakGuiColors->GetMissileIconColorInactive(),
g_tweakGuiColors->GetMissileIconColorDepleteAlt(), x50_missileIconAltDeplete) + addColor);
}
else
{
if (x4c_chargeBeamFactor > 0.f)
{
float factor = std::min(x4c_chargeBeamFactor / CPlayerState::GetMissileComboChargeFactor(), 1.f);
if (x8_numMissles > mgr.GetPlayerState()->GetMissileCostForAltAttack())
{
x74_basewidget_missileicon->SetColor(
zeus::CColor::lerp(g_tweakGuiColors->GetMissileIconColorInactive(),
g_tweakGuiColors->GetMissileIconColorChargedCanAlt(), factor) + addColor);
}
else
{
x74_basewidget_missileicon->SetColor(
zeus::CColor::lerp(g_tweakGuiColors->GetMissileIconColorInactive(),
g_tweakGuiColors->GetMissileIconColorChargedNoAlt(), factor) + addColor);
}
}
else
{
if (x58_24_missilesActive)
x74_basewidget_missileicon->SetColor(g_tweakGuiColors->GetMissileIconColorActive() + addColor);
else
x74_basewidget_missileicon->SetColor(g_tweakGuiColors->GetMissileIconColorInactive() + addColor);
}
}
x50_missileIconAltDeplete = std::max(0.f, x50_missileIconAltDeplete - dt);
x64_energybart01_missilebar->SetMaxEnergy(x4_missileCapacity);
x64_energybart01_missilebar->SetCurrEnergy(x8_numMissles, CAuiEnergyBarT01::ESetMode::Normal);
if (x58_28_notXRay)
{
x74_basewidget_missileicon->SetLocalTransform(x10_missleIconXf *
zeus::CTransform::Translate(0.f, 0.f, x8_numMissles *
IconTranslateRanges[int(x0_hudType)] / float(x4_missileCapacity)));
}
if (x58_27_hasArrows)
{
if (xc_arrowTimer > 0.f)
{
xc_arrowTimer = std::max(0.f, xc_arrowTimer - dt);
zeus::CColor color = g_tweakGuiColors->GetMissileIconColorActive();
color.a *= xc_arrowTimer / g_tweakGui->GetMissileArrowVisTime();
x6c_model_missilearrowup->SetColor(color);
x70_model_missilearrowdown->SetIsVisible(false);
}
else if (xc_arrowTimer < 0.f)
{
xc_arrowTimer = std::min(0.f, xc_arrowTimer + dt);
zeus::CColor color = g_tweakGuiColors->GetMissileIconColorActive();
color.a *= -xc_arrowTimer / g_tweakGui->GetMissileArrowVisTime();
x70_model_missilearrowdown->SetColor(color);
x6c_model_missilearrowup->SetIsVisible(false);
}
else
{
x6c_model_missilearrowup->SetIsVisible(false);
x70_model_missilearrowdown->SetIsVisible(false);
}
}
if (x68_textpane_missilewarning)
{
EInventoryStatus curStatus = GetMissileInventoryStatus();
if (curStatus != x44_latestStatus)
{
std::u16string string;
switch (curStatus)
{
case EInventoryStatus::Warning:
string = g_MainStringTable->GetString(12); // Missiles Low
case EInventoryStatus::Depleted:
string = g_MainStringTable->GetString(13); // Depleted
default: break;
}
x68_textpane_missilewarning->TextSupport()->SetText(string);
if (x44_latestStatus == EInventoryStatus::Normal && curStatus == EInventoryStatus::Warning)
{
CSfxManager::SfxStart(1397, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x48_missileWarningPulse = g_tweakGui->GetMissileWarningPulseTime();
}
else if (curStatus == EInventoryStatus::Depleted)
{
CSfxManager::SfxStart(1397, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x48_missileWarningPulse = g_tweakGui->GetMissileWarningPulseTime();
}
x44_latestStatus = curStatus;
}
x48_missileWarningPulse = std::max(0.f, x48_missileWarningPulse - dt);
float warnPulse = std::min(x48_missileWarningPulse, 1.f);
if (x44_latestStatus != EInventoryStatus::Normal)
x40_missileWarningAlpha = std::min(x40_missileWarningAlpha + 2.f * dt, 1.f);
else
x40_missileWarningAlpha = std::max(0.f, x40_missileWarningAlpha - 2.f * dt);
float tmp = std::fabs(std::fmod(CGraphics::GetSecondsMod900(), 0.5f));
if (tmp < 0.25f)
tmp = tmp / 0.25f;
else
tmp = (0.5f - tmp) / 0.25f;
zeus::CColor color = zeus::CColor::skWhite;
color.a = x40_missileWarningAlpha * tmp * warnPulse;
x68_textpane_missilewarning->SetColor(color);
if (x68_textpane_missilewarning->GetGeometryColor().a)
x68_textpane_missilewarning->SetIsVisible(true);
else
x68_textpane_missilewarning->SetIsVisible(false);
}
}
void CHudMissileInterface::SetIsVisibleGame(bool v, const CStateManager& mgr)
{
x58_26_visibleGame = v;
UpdateVisibility(mgr);
}
void CHudMissileInterface::SetIsVisibleDebug(bool v, const CStateManager& mgr)
{
x58_25_visibleDebug = v;
UpdateVisibility(mgr);
}
void CHudMissileInterface::SetIsMissilesActive(bool active)
{
x58_24_missilesActive = active;
}
void CHudMissileInterface::SetChargeBeamFactor(float t)
{
x4c_chargeBeamFactor = t;
}
void CHudMissileInterface::SetNumMissiles(int numMissiles, const CStateManager& mgr)
{
numMissiles = zeus::clamp(0, numMissiles, 999);
x60_textpane_missiledigits->TextSupport()->SetText(hecl::Format("%3d", numMissiles));
if (x8_numMissles < numMissiles)
{
xc_arrowTimer = g_tweakGui->GetMissileArrowVisTime();
x54_missileIconIncrement = -FLT_EPSILON;
}
else if (x8_numMissles > numMissiles)
{
xc_arrowTimer = -g_tweakGui->GetMissileArrowVisTime();
}
if (mgr.GetPlayerState()->GetMissileCostForAltAttack() + numMissiles <= x8_numMissles)
x50_missileIconAltDeplete = 1.f;
x8_numMissles = numMissiles;
}
void CHudMissileInterface::SetMissileCapacity(int missileCapacity)
{
x4_missileCapacity = missileCapacity;
}
CHudMissileInterface::EInventoryStatus CHudMissileInterface::GetMissileInventoryStatus()
{
if (x64_energybart01_missilebar->GetSetEnergy() == 0.f)
return EInventoryStatus::Depleted;
return EInventoryStatus(x64_energybart01_missilebar->GetActualFraction() <
g_tweakGui->GetMissileWarningFraction());
}
std::pair<zeus::CVector3f, zeus::CVector3f> CHudMissileInterface::CombatMissileBarCoordFunc(float t)
{
float z = t * IconTranslateRanges[int(EHudType::Combat)];
return {zeus::CVector3f(0.f, 0.f, z), zeus::CVector3f(0.3f, 0.f, z)};
}
std::pair<zeus::CVector3f, zeus::CVector3f> CHudMissileInterface::XRayMissileBarCoordFunc(float t)
{
float theta = 0.8f * (t - 0.5f);
float x = 9.55f * std::cos(theta);
float z = 9.55f * std::sin(theta);
return {zeus::CVector3f(x - 0.4f, 0.f, z), zeus::CVector3f(x, 0.f, z)};
}
std::pair<zeus::CVector3f, zeus::CVector3f> CHudMissileInterface::ThermalMissileBarCoordFunc(float t)
{
float transRange = IconTranslateRanges[int(EHudType::Thermal)];
float a = 0.08f * transRange;
float b = t * transRange;
float c;
if (b < a)
c = b / a;
else if (b < transRange - a)
c = 1.f;
else
c = 1.f - (b - (transRange - a)) / a;
return {zeus::CVector3f(-0.5f * c - 0.1f, 0.f, b), zeus::CVector3f(-0.1f, 0.f, b)};
} }
} }

View File

@ -1,14 +1,74 @@
#ifndef __URDE_CHUDMISSILEINTERFACE_HPP__ #ifndef __URDE_CHUDMISSILEINTERFACE_HPP__
#define __URDE_CHUDMISSILEINTERFACE_HPP__ #define __URDE_CHUDMISSILEINTERFACE_HPP__
#include "RetroTypes.hpp"
#include "CHudInterface.hpp"
#include "zeus/CTransform.hpp"
namespace urde namespace urde
{ {
class CStateManager; class CStateManager;
class CGuiFrame;
class CGuiWidget;
class CGuiTextPane;
class CAuiEnergyBarT01;
class CGuiModel;
class CHudMissileInterfaceCombat class CHudMissileInterface
{ {
enum class EInventoryStatus
{
Normal,
Warning,
Depleted
};
EHudType x0_hudType;
int x4_missileCapacity;
int x8_numMissles;
float xc_arrowTimer = 0.f;
zeus::CTransform x10_missleIconXf;
float x40_missileWarningAlpha = 0.f;
EInventoryStatus x44_latestStatus = EInventoryStatus::Normal;
float x48_missileWarningPulse = 0.f;
float x4c_chargeBeamFactor;
float x50_missileIconAltDeplete = 0.f;
float x54_missileIconIncrement = 0.f;
union
{
struct
{
bool x58_24_missilesActive : 1;
bool x58_25_visibleDebug : 1;
bool x58_26_visibleGame : 1;
bool x58_27_hasArrows : 1;
bool x58_28_notXRay : 1;
};
u16 _dummy = 0;
};
CGuiWidget* x5c_basewidget_missileicon;
CGuiTextPane* x60_textpane_missiledigits;
CAuiEnergyBarT01* x64_energybart01_missilebar;
CGuiTextPane* x68_textpane_missilewarning;
CGuiModel* x6c_model_missilearrowup;
CGuiModel* x70_model_missilearrowdown;
CGuiWidget* x74_basewidget_missileicon;
void UpdateVisibility(const CStateManager& mgr);
public: public:
CHudMissileInterface(CGuiFrame& selHud, int missileCapacity, int numMissiles,
float chargeFactor, bool missilesActive, EHudType hudType,
const CStateManager& mgr);
void Update(float dt, const CStateManager& mgr); void Update(float dt, const CStateManager& mgr);
void SetIsVisibleGame(bool v, const CStateManager& mgr);
void SetIsVisibleDebug(bool v, const CStateManager& mgr);
void SetIsMissilesActive(bool active);
void SetChargeBeamFactor(float t);
void SetNumMissiles(int numMissiles, const CStateManager& mgr);
void SetMissileCapacity(int missileCapacity);
EInventoryStatus GetMissileInventoryStatus();
static std::pair<zeus::CVector3f, zeus::CVector3f> CombatMissileBarCoordFunc(float t);
static std::pair<zeus::CVector3f, zeus::CVector3f> XRayMissileBarCoordFunc(float t);
static std::pair<zeus::CVector3f, zeus::CVector3f> ThermalMissileBarCoordFunc(float t);
}; };
} }

View File

@ -48,6 +48,7 @@ set(GUISYS_SOURCES
CHudVisorBeamMenu.hpp CHudVisorBeamMenu.cpp CHudVisorBeamMenu.hpp CHudVisorBeamMenu.cpp
CHudRadarInterface.hpp CHudRadarInterface.cpp CHudRadarInterface.hpp CHudRadarInterface.cpp
CHudBallInterface.hpp CHudBallInterface.cpp CHudBallInterface.hpp CHudBallInterface.cpp
CHudInterface.hpp
CScanDisplay.hpp CScanDisplay.cpp) CScanDisplay.hpp CScanDisplay.cpp)
runtime_add_list(GuiSys GUISYS_SOURCES) runtime_add_list(GuiSys GUISYS_SOURCES)

View File

@ -460,8 +460,8 @@ void CSamusHud::Update(float dt, const CStateManager& mgr,
int minutes = mgr.GetEscapeSequenceTimer() / 60.f; int minutes = mgr.GetEscapeSequenceTimer() / 60.f;
int seconds = std::fmod(mgr.GetEscapeSequenceTimer(), 60.f); int seconds = std::fmod(mgr.GetEscapeSequenceTimer(), 60.f);
int hundredths = std::fmod(mgr.GetEscapeSequenceTimer() * 100.f, 100.f); int hundredths = std::fmod(mgr.GetEscapeSequenceTimer() * 100.f, 100.f);
std::u16string timeStr = hecl::UTF8ToChar16(hecl::Format("%02d:%02d:%02d", std::string timeStr = hecl::Format("%02d:%02d:%02d",
int(minutes), int(seconds), int(hundredths))); int(minutes), int(seconds), int(hundredths));
x594_base_textpane_counter->TextSupport()->SetText(timeStr); x594_base_textpane_counter->TextSupport()->SetText(timeStr);
x594_base_textpane_counter->SetIsVisible(true); x594_base_textpane_counter->SetIsVisible(true);

View File

@ -106,7 +106,7 @@ class CSamusHud
CGuiFrame* x288_loadedSelectedHud = nullptr; CGuiFrame* x288_loadedSelectedHud = nullptr;
std::unique_ptr<CHudEnergyInterface> x28c_ballEnergyIntf; std::unique_ptr<CHudEnergyInterface> x28c_ballEnergyIntf;
std::unique_ptr<IHudThreatInterface> x290_threatIntf; std::unique_ptr<IHudThreatInterface> x290_threatIntf;
std::unique_ptr<CHudMissileInterfaceCombat> x294_missileIntf; std::unique_ptr<CHudMissileInterface> x294_missileIntf;
std::unique_ptr<IFreeLookInterface> x298_freeLookIntf; std::unique_ptr<IFreeLookInterface> x298_freeLookIntf;
std::unique_ptr<IHudDecoInterface> x29c_decoIntf; std::unique_ptr<IHudDecoInterface> x29c_decoIntf;
std::unique_ptr<CHudHelmetInterface> x2a0_helmetIntf; std::unique_ptr<CHudHelmetInterface> x2a0_helmetIntf;

View File

@ -24,6 +24,13 @@ namespace urde
class CPlayerGun class CPlayerGun
{ {
public:
enum class EMissleMode
{
Inactive,
Active
};
private:
struct CGunMorph struct CGunMorph
{ {
float x0_ = 0.f; float x0_ = 0.f;
@ -66,7 +73,7 @@ class CPlayerGun
u32 x310_ = 0; u32 x310_ = 0;
u32 x314_ = 0; u32 x314_ = 0;
u32 x318_ = 0; u32 x318_ = 0;
u32 x31c_missilesActive = 0; EMissleMode x31c_missileMode = EMissleMode::Inactive;
u32 x320_ = 0; u32 x320_ = 0;
u32 x324_ = 4; u32 x324_ = 4;
u32 x328_ = 0x2000; u32 x328_ = 0x2000;
@ -75,7 +82,7 @@ class CPlayerGun
u32 x334_ = 0; u32 x334_ = 0;
u32 x338_ = 0; u32 x338_ = 0;
u32 x33c_ = 0; u32 x33c_ = 0;
float x340_chargeTime = 0.f; float x340_chargeBeamFactor = 0.f;
float x344_ = 0.f; float x344_ = 0.f;
float x348_ = 0.f; float x348_ = 0.f;
float x34c_ = 0.f; float x34c_ = 0.f;
@ -175,7 +182,7 @@ class CPlayerGun
bool x833_30_ : 1; bool x833_30_ : 1;
bool x833_31_ : 1; bool x833_31_ : 1;
bool x834_24_ : 1; bool x834_24_charging : 1;
bool x834_25_ : 1; bool x834_25_ : 1;
bool x834_26_ : 1; bool x834_26_ : 1;
bool x834_27_ : 1; bool x834_27_ : 1;
@ -201,6 +208,7 @@ public:
void AsyncLoadSuit(CStateManager& mgr); void AsyncLoadSuit(CStateManager& mgr);
void TouchModel(CStateManager& stateMgr); void TouchModel(CStateManager& stateMgr);
EMissleMode GetMissleMode() const { return x31c_missileMode; }
}; };
} }