2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-13 21:11:21 +00:00

Runtime/GuiSys: Replace bitfield unions with constructor initializers

This commit is contained in:
Luke Street 2020-04-10 15:11:10 -04:00
parent 232823ae69
commit e38a7f97bd
12 changed files with 54 additions and 81 deletions

View File

@ -5,6 +5,7 @@
namespace urde { namespace urde {
CErrorOutputWindow::CErrorOutputWindow(bool flag) : CIOWin("Error Output Window") { CErrorOutputWindow::CErrorOutputWindow(bool flag) : CIOWin("Error Output Window") {
x18_24_ = false;
x18_25_ = true; x18_25_ = true;
x18_26_ = true; x18_26_ = true;
x18_27_ = true; x18_27_ = true;

View File

@ -11,16 +11,11 @@ public:
private: private:
State x14_state = State::Zero; State x14_state = State::Zero;
union { bool x18_24_;
struct { bool x18_25_;
bool x18_24_; bool x18_26_;
bool x18_25_; bool x18_27_;
bool x18_26_; bool x18_28_;
bool x18_27_;
bool x18_28_;
};
u16 dummy = 0;
};
const wchar_t* x1c_msg; const wchar_t* x1c_msg;
public: public:

View File

@ -11,7 +11,10 @@ CGuiSliderGroup::CGuiSliderGroup(const CGuiWidgetParms& parms, float min, float
, xbc_maxVal(max) , xbc_maxVal(max)
, xc0_roundedCurVal(def) , xc0_roundedCurVal(def)
, xc4_curVal(def) , xc4_curVal(def)
, xc8_increment(inc) {} , xc8_increment(inc)
, xf4_24_inputPending(false)
, m_mouseInside(false)
, m_mouseDown(false) {}
void CGuiSliderGroup::SetSelectionChangedCallback(std::function<void(CGuiSliderGroup*, float)>&& func) { void CGuiSliderGroup::SetSelectionChangedCallback(std::function<void(CGuiSliderGroup*, float)>&& func) {
xd8_changeCallback = std::move(func); xd8_changeCallback = std::move(func);

View File

@ -22,14 +22,9 @@ private:
std::array<CGuiWidget*, 2> xcc_sliderRangeWidgets{}; std::array<CGuiWidget*, 2> xcc_sliderRangeWidgets{};
std::function<void(CGuiSliderGroup*, float)> xd8_changeCallback; std::function<void(CGuiSliderGroup*, float)> xd8_changeCallback;
EState xf0_state = EState::None; EState xf0_state = EState::None;
union { bool xf4_24_inputPending : 1;
struct { mutable bool m_mouseInside : 1;
bool xf4_24_inputPending : 1; bool m_mouseDown : 1;
mutable bool m_mouseInside : 1;
bool m_mouseDown : 1;
};
u32 _dummy = 0;
};
mutable float m_mouseT = 0.f; mutable float m_mouseT = 0.f;

View File

@ -27,12 +27,11 @@ CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, in
: x0_hudType(hudType) : x0_hudType(hudType)
, xc_tankEnergy(tankEnergy) , xc_tankEnergy(tankEnergy)
, x10_totalEnergyTanks(totalEnergyTanks) , x10_totalEnergyTanks(totalEnergyTanks)
, x14_numTanksFilled(numTanksFilled) { , x14_numTanksFilled(numTanksFilled)
x1c_24_ = true; , x1c_24_(true)
x1c_25_ = true; , x1c_25_(true)
x1c_26_barDirty = true; , x1c_26_barDirty(true)
x1c_27_energyLow = energyLow; , x1c_27_energyLow(energyLow) {
x20_textpane_energydigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energydigits")); x20_textpane_energydigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energydigits"));
x24_meter_energytanks = static_cast<CAuiMeter*>(selHud.FindWidget("meter_energytanks")); x24_meter_energytanks = static_cast<CAuiMeter*>(selHud.FindWidget("meter_energytanks"));
x28_textpane_energywarning = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energywarning")); x28_textpane_energywarning = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energywarning"));
@ -100,7 +99,7 @@ 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::string string = std::string string =
fmt::format(fmt("{:02d}"), int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity()))); fmt::format(fmt("{:02d}"), int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity())));
x20_textpane_energydigits->TextSupport().SetText(string); x20_textpane_energydigits->TextSupport().SetText(string);
} }

View File

@ -19,15 +19,10 @@ class CHudEnergyInterface {
int x10_totalEnergyTanks; int x10_totalEnergyTanks;
int x14_numTanksFilled; int x14_numTanksFilled;
float x18_cachedBarEnergy = 0.f; float x18_cachedBarEnergy = 0.f;
union { bool x1c_24_ : 1;
struct { bool x1c_25_ : 1;
bool x1c_24_ : 1; bool x1c_26_barDirty : 1;
bool x1c_25_ : 1; bool x1c_27_energyLow : 1;
bool x1c_26_barDirty : 1;
bool x1c_27_energyLow : 1;
};
u16 _dummy = 0;
};
CGuiTextPane* x20_textpane_energydigits; CGuiTextPane* x20_textpane_energydigits;
CAuiMeter* x24_meter_energytanks; CAuiMeter* x24_meter_energytanks;
CGuiTextPane* x28_textpane_energywarning; CGuiTextPane* x28_textpane_energywarning;

View File

@ -8,12 +8,12 @@ namespace urde {
CHudFreeLookInterface::CHudFreeLookInterface(CGuiFrame& selHud, EHudType hudType, bool inFreeLook, bool lookControlHeld, CHudFreeLookInterface::CHudFreeLookInterface(CGuiFrame& selHud, EHudType hudType, bool inFreeLook, bool lookControlHeld,
bool lockedOnObj) bool lockedOnObj)
: x4_hudType(hudType) { : x4_hudType(hudType)
x70_24_inFreeLook = inFreeLook; , x70_24_inFreeLook(inFreeLook)
x70_25_lookControlHeld = lookControlHeld; , x70_25_lookControlHeld(lookControlHeld)
x70_26_lockedOnObj = lockedOnObj; , x70_26_lockedOnObj(lockedOnObj)
x70_27_visibleDebug = true; , x70_27_visibleDebug(true)
x70_28_visibleGame = true; , x70_28_visibleGame(true) {
x6c_lockOnInterp = (lockedOnObj && hudType == EHudType::Scan) ? 0.f : 1.f; x6c_lockOnInterp = (lockedOnObj && hudType == EHudType::Scan) ? 0.f : 1.f;
x74_basewidget_freelookleft = selHud.FindWidget("basewidget_freelookleft"); x74_basewidget_freelookleft = selHud.FindWidget("basewidget_freelookleft");

View File

@ -24,16 +24,11 @@ class CHudFreeLookInterface : public IFreeLookInterface {
zeus::CTransform x38_freeLookRightXf; zeus::CTransform x38_freeLookRightXf;
float x68_freeLookInterp = 0.f; float x68_freeLookInterp = 0.f;
float x6c_lockOnInterp; float x6c_lockOnInterp;
union { bool x70_24_inFreeLook : 1;
struct { bool x70_25_lookControlHeld : 1;
bool x70_24_inFreeLook : 1; bool x70_26_lockedOnObj : 1;
bool x70_25_lookControlHeld : 1; bool x70_27_visibleDebug : 1;
bool x70_26_lockedOnObj : 1; bool x70_28_visibleGame : 1;
bool x70_27_visibleDebug : 1;
bool x70_28_visibleGame : 1;
};
u16 _dummy = 0;
};
CGuiWidget* x74_basewidget_freelookleft; CGuiWidget* x74_basewidget_freelookleft;
CGuiModel* x78_model_shieldleft; CGuiModel* x78_model_shieldleft;
CGuiModel* x7c_model_freelookleft; CGuiModel* x7c_model_freelookleft;

View File

@ -7,11 +7,12 @@
namespace urde { namespace urde {
CHudHelmetInterface::CHudHelmetInterface(CGuiFrame& helmetFrame) { CHudHelmetInterface::CHudHelmetInterface(CGuiFrame& helmetFrame)
x3c_24_helmetVisibleDebug = true; : x3c_24_helmetVisibleDebug(true)
x3c_25_helmetVisibleGame = true; , x3c_25_helmetVisibleGame(true)
x3c_26_glowVisibleDebug = true; , x3c_26_glowVisibleDebug(true)
x3c_27_glowVisibleGame = true; , x3c_27_glowVisibleGame(true)
, x3c_28_hudLagDirty(false) {
x40_camera = helmetFrame.GetFrameCamera(); x40_camera = helmetFrame.GetFrameCamera();
x44_BaseWidget_Pivot = helmetFrame.FindWidget("BaseWidget_Pivot"); x44_BaseWidget_Pivot = helmetFrame.FindWidget("BaseWidget_Pivot");
x48_BaseWidget_Helmet = helmetFrame.FindWidget("BaseWidget_Helmet"); x48_BaseWidget_Helmet = helmetFrame.FindWidget("BaseWidget_Helmet");

View File

@ -12,16 +12,11 @@ class CHudHelmetInterface {
zeus::CMatrix3f x0_hudLagRotation; zeus::CMatrix3f x0_hudLagRotation;
zeus::CVector3f x24_pivotPosition; zeus::CVector3f x24_pivotPosition;
zeus::CVector3f x30_hudLagPosition; zeus::CVector3f x30_hudLagPosition;
union { bool x3c_24_helmetVisibleDebug : 1;
struct { bool x3c_25_helmetVisibleGame : 1;
bool x3c_24_helmetVisibleDebug : 1; bool x3c_26_glowVisibleDebug : 1;
bool x3c_25_helmetVisibleGame : 1; bool x3c_27_glowVisibleGame : 1;
bool x3c_26_glowVisibleDebug : 1; bool x3c_28_hudLagDirty : 1;
bool x3c_27_glowVisibleGame : 1;
bool x3c_28_hudLagDirty : 1;
};
u16 _dummy = 0;
};
CGuiCamera* x40_camera; CGuiCamera* x40_camera;
CGuiWidget* x44_BaseWidget_Pivot; CGuiWidget* x44_BaseWidget_Pivot;
CGuiWidget* x48_BaseWidget_Helmet; CGuiWidget* x48_BaseWidget_Helmet;

View File

@ -26,11 +26,10 @@ CHudMissileInterface::CHudMissileInterface(CGuiFrame& selHud, int missileCapacit
: x0_hudType(hudType) : x0_hudType(hudType)
, x4_missileCapacity(missileCapacity) , x4_missileCapacity(missileCapacity)
, x8_numMissles(numMissiles) , x8_numMissles(numMissiles)
, x4c_chargeBeamFactor(chargeFactor) { , x4c_chargeBeamFactor(chargeFactor)
x58_24_missilesActive = missilesActive; , x58_24_missilesActive(missilesActive)
x58_25_visibleDebug = true; , x58_25_visibleDebug(true)
x58_26_visibleGame = true; , x58_26_visibleGame(true) {
x5c_basewidget_missileicon = selHud.FindWidget("basewidget_missileicon"); x5c_basewidget_missileicon = selHud.FindWidget("basewidget_missileicon");
x60_textpane_missiledigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_missiledigits")); x60_textpane_missiledigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_missiledigits"));
x64_energybart01_missilebar = static_cast<CAuiEnergyBarT01*>(selHud.FindWidget("energybart01_missilebar")); x64_energybart01_missilebar = static_cast<CAuiEnergyBarT01*>(selHud.FindWidget("energybart01_missilebar"));

View File

@ -26,16 +26,11 @@ class CHudMissileInterface {
float x4c_chargeBeamFactor; float x4c_chargeBeamFactor;
float x50_missileIconAltDeplete = 0.f; float x50_missileIconAltDeplete = 0.f;
float x54_missileIconIncrement = 0.f; float x54_missileIconIncrement = 0.f;
union { bool x58_24_missilesActive : 1;
struct { bool x58_25_visibleDebug : 1;
bool x58_24_missilesActive : 1; bool x58_26_visibleGame : 1;
bool x58_25_visibleDebug : 1; bool x58_27_hasArrows : 1;
bool x58_26_visibleGame : 1; bool x58_28_notXRay : 1;
bool x58_27_hasArrows : 1;
bool x58_28_notXRay : 1;
};
u16 _dummy = 0;
};
CGuiWidget* x5c_basewidget_missileicon; CGuiWidget* x5c_basewidget_missileicon;
CGuiTextPane* x60_textpane_missiledigits; CGuiTextPane* x60_textpane_missiledigits;
CAuiEnergyBarT01* x64_energybart01_missilebar; CAuiEnergyBarT01* x64_energybart01_missilebar;