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 {
CErrorOutputWindow::CErrorOutputWindow(bool flag) : CIOWin("Error Output Window") {
x18_24_ = false;
x18_25_ = true;
x18_26_ = true;
x18_27_ = true;

View File

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

View File

@ -11,7 +11,10 @@ CGuiSliderGroup::CGuiSliderGroup(const CGuiWidgetParms& parms, float min, float
, xbc_maxVal(max)
, xc0_roundedCurVal(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) {
xd8_changeCallback = std::move(func);

View File

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

View File

@ -27,12 +27,11 @@ CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, in
: x0_hudType(hudType)
, xc_tankEnergy(tankEnergy)
, x10_totalEnergyTanks(totalEnergyTanks)
, x14_numTanksFilled(numTanksFilled) {
x1c_24_ = true;
x1c_25_ = true;
x1c_26_barDirty = true;
x1c_27_energyLow = energyLow;
, x14_numTanksFilled(numTanksFilled)
, x1c_24_(true)
, x1c_25_(true)
, x1c_26_barDirty(true)
, x1c_27_energyLow(energyLow) {
x20_textpane_energydigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energydigits"));
x24_meter_energytanks = static_cast<CAuiMeter*>(selHud.FindWidget("meter_energytanks"));
x28_textpane_energywarning = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_energywarning"));

View File

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

View File

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

View File

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

View File

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

View File

@ -12,16 +12,11 @@ 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;

View File

@ -26,11 +26,10 @@ CHudMissileInterface::CHudMissileInterface(CGuiFrame& selHud, int missileCapacit
: x0_hudType(hudType)
, x4_missileCapacity(missileCapacity)
, x8_numMissles(numMissiles)
, x4c_chargeBeamFactor(chargeFactor) {
x58_24_missilesActive = missilesActive;
x58_25_visibleDebug = true;
x58_26_visibleGame = true;
, 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"));

View File

@ -26,16 +26,11 @@ class CHudMissileInterface {
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;