mirror of https://github.com/AxioDL/metaforce.git
Runtime: Replace bitfield unions with constructor initializers
This commit is contained in:
parent
89e2e65100
commit
346d110b79
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
public:
|
||||
CPersistentOptions() = default;
|
||||
|
@ -116,22 +110,15 @@ class CGameOptions {
|
|||
u32 x5c_musicVol = 0x7f;
|
||||
u32 x60_hudAlpha = 0xff;
|
||||
u32 x64_helmetAlpha = 0xff;
|
||||
|
||||
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<std::pair<CAssetId, CAssetId>> x6c_controlTxtrMap;
|
||||
|
||||
s32 m_gamma = 0;
|
||||
|
||||
public:
|
||||
CGameOptions();
|
||||
explicit CGameOptions(CBitStreamReader& stream);
|
||||
|
|
|
@ -137,6 +137,7 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) {
|
|||
CGameState::CGameState() {
|
||||
x98_playerState = std::make_shared<CPlayerState>();
|
||||
x9c_transManager = std::make_shared<CWorldTransManager>();
|
||||
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<CWorldTransManager>();
|
||||
x228_24_hardMode = false;
|
||||
x228_25_initPowerupsAtFirstSpawn = true;
|
||||
|
||||
for (bool& value : x0_) {
|
||||
|
|
|
@ -81,14 +81,8 @@ class CGameState {
|
|||
u32 x20c_saveFileIdx = 0;
|
||||
u64 x210_cardSerial = 0;
|
||||
std::vector<u8> x218_backupBuf;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool x228_24_hardMode : 1;
|
||||
bool x228_25_initPowerupsAtFirstSpawn : 1;
|
||||
};
|
||||
u8 _dummy = 0;
|
||||
};
|
||||
|
||||
public:
|
||||
CGameState();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
enum class EAsyncPhase {
|
||||
Warmup = 0,
|
||||
InitialHeader = 1,
|
||||
|
|
|
@ -74,13 +74,13 @@ constexpr std::array<float, 5> 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));
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
u32 x4_enabledItems = 0;
|
||||
EBeamId x8_currentBeam = EBeamId::Power;
|
||||
CHealthInfo xc_health = {99.f, 50.f};
|
||||
|
|
|
@ -62,7 +62,14 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& 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<CStateManagerContainer>();
|
||||
x870_cameraManager = &x86c_stateManagerContainer->x0_cameraManager;
|
||||
x874_sortedListManager = &x86c_stateManagerContainer->x3c0_sortedListManager;
|
||||
|
|
|
@ -202,9 +202,6 @@ 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;
|
||||
|
@ -212,9 +209,6 @@ private:
|
|||
bool xf94_28_inSaveUI : 1;
|
||||
bool xf94_29_cinematicPause : 1;
|
||||
bool xf94_30_fullThreat : 1;
|
||||
};
|
||||
u32 xf94_ = 0;
|
||||
};
|
||||
|
||||
CColoredQuadFilter m_deathWhiteout{EFilterType::Add};
|
||||
CColoredQuadFilter m_escapeWhiteout{EFilterType::Add};
|
||||
|
|
Loading…
Reference in New Issue