diff --git a/Runtime/CGameOptions.cpp b/Runtime/CGameOptions.cpp index fff4226eb..4b2b8e4ee 100644 --- a/Runtime/CGameOptions.cpp +++ b/Runtime/CGameOptions.cpp @@ -212,10 +212,12 @@ void CGameOptions::PutTo(CBitStreamWriter& writer) const { writer.WriteEncoded(x68_27_swapBeamsControls, 1); } -CGameOptions::CGameOptions() { - x68_24_hudLag = true; - x68_26_rumble = true; - x68_28_hintSystem = true; +CGameOptions::CGameOptions() +: x68_24_hudLag(true) +, x68_25_invertY(false) +, x68_26_rumble(true) +, x68_27_swapBeamsControls(false) +, x68_28_hintSystem(true) { InitSoundMode(); } diff --git a/Runtime/CGameOptions.hpp b/Runtime/CGameOptions.hpp index 554ecea86..a77e3e849 100644 --- a/Runtime/CGameOptions.hpp +++ b/Runtime/CGameOptions.hpp @@ -56,18 +56,12 @@ class CPersistentOptions { u32 xc4_frozenBallCount = 0; u32 xc8_powerBombAmmoCount = 0; u32 xcc_logScanPercent = 0; - - union { - struct { - bool xd0_24_fusionLinked : 1; - bool xd0_25_normalModeBeat : 1; - bool xd0_26_hardModeBeat : 1; - bool xd0_27_fusionBeat : 1; - bool xd0_28_fusionSuitActive : 1; - bool xd0_29_allItemsCollected : 1; - }; - u16 _dummy = 0; - }; + bool xd0_24_fusionLinked : 1; + bool xd0_25_normalModeBeat : 1; + bool xd0_26_hardModeBeat : 1; + bool xd0_27_fusionBeat : 1; + bool xd0_28_fusionSuitActive : 1; + bool xd0_29_allItemsCollected : 1; public: CPersistentOptions() = default; @@ -116,22 +110,15 @@ class CGameOptions { u32 x5c_musicVol = 0x7f; u32 x60_hudAlpha = 0xff; u32 x64_helmetAlpha = 0xff; + bool x68_24_hudLag : 1; + bool x68_25_invertY : 1; + bool x68_26_rumble : 1; + bool x68_27_swapBeamsControls : 1; + bool x68_28_hintSystem : 1; + std::vector> x6c_controlTxtrMap; s32 m_gamma = 0; - union { - struct { - bool x68_24_hudLag : 1; - bool x68_25_invertY : 1; - bool x68_26_rumble : 1; - bool x68_27_swapBeamsControls : 1; - bool x68_28_hintSystem : 1; - }; - u16 _dummy = 0; - }; - - std::vector> x6c_controlTxtrMap; - public: CGameOptions(); explicit CGameOptions(CBitStreamReader& stream); diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index 2bd9531f6..ca4d7e469 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -137,6 +137,7 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) { CGameState::CGameState() { x98_playerState = std::make_shared(); x9c_transManager = std::make_shared(); + x228_24_hardMode = false; x228_25_initPowerupsAtFirstSpawn = true; if (g_MemoryCardSys) InitializeMemoryStates(); @@ -144,6 +145,7 @@ CGameState::CGameState() { CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx(saveIdx) { x9c_transManager = std::make_shared(); + x228_24_hardMode = false; x228_25_initPowerupsAtFirstSpawn = true; for (bool& value : x0_) { diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 32349f8d9..ad4146e6d 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -81,14 +81,8 @@ class CGameState { u32 x20c_saveFileIdx = 0; u64 x210_cardSerial = 0; std::vector x218_backupBuf; - - union { - struct { - bool x228_24_hardMode : 1; - bool x228_25_initPowerupsAtFirstSpawn : 1; - }; - u8 _dummy = 0; - }; + bool x228_24_hardMode : 1; + bool x228_25_initPowerupsAtFirstSpawn : 1; public: CGameState(); diff --git a/Runtime/CPakFile.cpp b/Runtime/CPakFile.cpp index 8d29f7367..7cb34c700 100644 --- a/Runtime/CPakFile.cpp +++ b/Runtime/CPakFile.cpp @@ -8,6 +8,7 @@ CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, Log.report(logvisor::Fatal, fmt("{}: Unable to open"), GetPath()); x28_24_buildDepList = buildDepList; //x28_24_buildDepList = true; // Always do this so URDE can rapidly pre-warm shaders + x28_25_aramFile = false; x28_26_worldPak = worldPak; x28_27_stashedInARAM = false; m_override = override; diff --git a/Runtime/CPakFile.hpp b/Runtime/CPakFile.hpp index d978d7fc6..f0b1ec91a 100644 --- a/Runtime/CPakFile.hpp +++ b/Runtime/CPakFile.hpp @@ -36,16 +36,11 @@ public: }; private: - union { - struct { - bool x28_24_buildDepList : 1; - bool x28_25_aramFile : 1; - bool x28_26_worldPak : 1; - bool x28_27_stashedInARAM : 1; - bool m_override : 1; - }; - u32 _dummy = 0; - }; + bool x28_24_buildDepList : 1; + bool x28_25_aramFile : 1; + bool x28_26_worldPak : 1; + bool x28_27_stashedInARAM : 1; + bool m_override : 1; enum class EAsyncPhase { Warmup = 0, InitialHeader = 1, diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp index 38e9e9841..210a7f4e0 100644 --- a/Runtime/CPlayerState.cpp +++ b/Runtime/CPlayerState.cpp @@ -74,13 +74,13 @@ constexpr std::array ComboAmmoPeriods{ }; } // Anonymous namespace -CPlayerState::CPlayerState() : x188_staticIntf(5) { - x0_24_alive = true; +CPlayerState::CPlayerState() +: x0_24_alive(true), x0_25_firingComboBeam(false), x0_26_fusion(false), x188_staticIntf(5) { x24_powerups.resize(41); } -CPlayerState::CPlayerState(CBitStreamReader& stream) : x188_staticIntf(5) { - x0_24_alive = true; +CPlayerState::CPlayerState(CBitStreamReader& stream) +: x0_24_alive(true), x0_25_firingComboBeam(false), x0_26_fusion(false), x188_staticIntf(5) { x4_enabledItems = u32(stream.ReadEncoded(32)); const u32 integralHP = u32(stream.ReadEncoded(32)); diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp index 22134070d..192095668 100644 --- a/Runtime/CPlayerState.hpp +++ b/Runtime/CPlayerState.hpp @@ -94,15 +94,9 @@ private: constexpr CPowerUp() = default; constexpr CPowerUp(u32 amount, u32 capacity) : x0_amount(amount), x4_capacity(capacity) {} }; - union { - struct { - bool x0_24_alive : 1; - bool x0_25_firingComboBeam : 1; - bool x0_26_fusion : 1; - }; - u32 dummy = 0; - }; - + bool x0_24_alive : 1; + bool x0_25_firingComboBeam : 1; + bool x0_26_fusion : 1; u32 x4_enabledItems = 0; EBeamId x8_currentBeam = EBeamId::Power; CHealthInfo xc_health = {99.f, 50.f}; diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index fda9eeb25..45cad7fc9 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -62,7 +62,14 @@ CStateManager::CStateManager(const std::weak_ptr& relayTracker, , x8bc_relayTracker(relayTracker) , x8c0_mapWorldInfo(mwInfo) , x8c4_worldTransManager(wtMgr) -, x8c8_worldLayerState(layerState) { +, x8c8_worldLayerState(layerState) +, xf94_24_readyToRender(false) +, xf94_25_quitGame(false) +, xf94_26_generatingObject(false) +, xf94_27_inMapScreen(false) +, xf94_28_inSaveUI(false) +, xf94_29_cinematicPause(false) +, xf94_30_fullThreat(false) { x86c_stateManagerContainer = std::make_unique(); x870_cameraManager = &x86c_stateManagerContainer->x0_cameraManager; x874_sortedListManager = &x86c_stateManagerContainer->x3c0_sortedListManager; diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 225c79e07..1b138b7b7 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -202,19 +202,13 @@ private: CAssetId xf88_; float xf8c_ = 0.f; EStateManagerTransition xf90_deferredTransition = EStateManagerTransition::InGame; - - union { - struct { - bool xf94_24_readyToRender : 1; - bool xf94_25_quitGame : 1; - bool xf94_26_generatingObject : 1; - bool xf94_27_inMapScreen : 1; - bool xf94_28_inSaveUI : 1; - bool xf94_29_cinematicPause : 1; - bool xf94_30_fullThreat : 1; - }; - u32 xf94_ = 0; - }; + bool xf94_24_readyToRender : 1; + bool xf94_25_quitGame : 1; + bool xf94_26_generatingObject : 1; + bool xf94_27_inMapScreen : 1; + bool xf94_28_inSaveUI : 1; + bool xf94_29_cinematicPause : 1; + bool xf94_30_fullThreat : 1; CColoredQuadFilter m_deathWhiteout{EFilterType::Add}; CColoredQuadFilter m_escapeWhiteout{EFilterType::Add};