From bb7e94f30487b09dc0185d36e89f0a4a96d02519 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 11 Apr 2020 01:50:10 -0400 Subject: [PATCH] Runtime/World: Replace bitfield unions with constructor initializers --- Runtime/World/CActor.cpp | 42 ++++++----- Runtime/World/CActor.hpp | 53 +++++++------- Runtime/World/CActorModelParticles.cpp | 7 +- Runtime/World/CActorModelParticles.hpp | 9 +-- Runtime/World/CActorParameters.hpp | 13 ++-- Runtime/World/CAmbientAI.cpp | 4 +- Runtime/World/CAmbientAI.hpp | 10 +-- Runtime/World/CEntity.cpp | 9 +-- Runtime/World/CEntity.hpp | 14 ++-- Runtime/World/CFishCloud.cpp | 13 ++-- Runtime/World/CFishCloud.hpp | 21 +++--- Runtime/World/CGameArea.hpp | 28 ++++---- Runtime/World/CKnockBackController.cpp | 22 +++--- Runtime/World/CKnockBackController.hpp | 37 +++++----- Runtime/World/CPatterned.cpp | 46 +++++++++--- Runtime/World/CPatterned.hpp | 83 +++++++++------------- Runtime/World/CPlayer.cpp | 32 +++++++-- Runtime/World/CPlayer.hpp | 59 +++++++-------- Runtime/World/CScriptActorKeyframe.cpp | 15 ++-- Runtime/World/CScriptActorKeyframe.hpp | 17 ++--- Runtime/World/CScriptActorRotate.hpp | 14 ++-- Runtime/World/CScriptAiJumpPoint.cpp | 3 +- Runtime/World/CScriptAiJumpPoint.hpp | 7 +- Runtime/World/CScriptCameraHintTrigger.cpp | 9 +-- Runtime/World/CScriptCameraHintTrigger.hpp | 13 ++-- Runtime/World/CScriptCameraPitchVolume.cpp | 4 +- Runtime/World/CScriptCameraPitchVolume.hpp | 10 +-- Runtime/World/CScriptColorModulate.cpp | 21 +++--- Runtime/World/CScriptColorModulate.hpp | 23 +++--- Runtime/World/CScriptControllerAction.cpp | 10 +-- Runtime/World/CScriptControllerAction.hpp | 11 +-- Runtime/World/CScriptCoverPoint.cpp | 9 ++- Runtime/World/CScriptCoverPoint.hpp | 21 ++---- Runtime/World/CScriptDamageableTrigger.cpp | 8 ++- Runtime/World/CScriptDamageableTrigger.hpp | 16 ++--- Runtime/World/CScriptDebris.cpp | 26 ++++--- Runtime/World/CScriptDebris.hpp | 23 +++--- Runtime/World/CScriptDock.cpp | 13 ++-- Runtime/World/CScriptDock.hpp | 11 +-- Runtime/World/CScriptEffect.cpp | 23 +++--- Runtime/World/CScriptEffect.hpp | 27 +++---- Runtime/World/CScriptGenerator.hpp | 9 +-- Runtime/World/CScriptGunTurret.cpp | 18 ++--- Runtime/World/CScriptGunTurret.hpp | 21 +++--- Runtime/World/CScriptMazeNode.cpp | 7 +- Runtime/World/CScriptMazeNode.hpp | 11 +-- Runtime/World/CScriptMemoryRelay.hpp | 11 +-- Runtime/World/CScriptPlayerActor.cpp | 14 ++-- Runtime/World/CScriptPlayerActor.hpp | 23 +++--- Runtime/World/CScriptShadowProjector.cpp | 8 +-- Runtime/World/CScriptShadowProjector.hpp | 10 +-- Runtime/World/CScriptSound.cpp | 19 ++--- Runtime/World/CScriptSound.hpp | 25 +++---- Runtime/World/CScriptSpawnPoint.hpp | 9 +-- Runtime/World/CScriptSpecialFunction.cpp | 14 +++- Runtime/World/CScriptSpecialFunction.hpp | 27 +++---- Runtime/World/CScriptTargetingPoint.cpp | 3 +- Runtime/World/CScriptTargetingPoint.hpp | 7 +- Runtime/World/CScriptTrigger.cpp | 14 ++-- Runtime/World/CScriptTrigger.hpp | 18 ++--- Runtime/World/CScriptWater.cpp | 12 ++-- Runtime/World/CScriptWater.hpp | 20 +++--- Runtime/World/CScriptWorldTeleporter.hpp | 12 +--- Runtime/World/CStateMachine.hpp | 9 +-- Runtime/World/CWallCrawlerSwarm.cpp | 8 +-- Runtime/World/CWallCrawlerSwarm.hpp | 30 ++++---- Runtime/World/CWorld.cpp | 9 ++- Runtime/World/CWorld.hpp | 14 ++-- Runtime/World/CWorldTransManager.hpp | 22 +++--- 69 files changed, 583 insertions(+), 657 deletions(-) diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index 37fa2b6d4..1d538dfc8 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -34,27 +34,37 @@ CActor::CActor(TUniqueId uid, bool active, std::string_view name, const CEntityI , x34_transform(xf) , x68_material(MakeActorMaterialList(list, params)) , x70_materialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull})) -, xc6_nextDrawNode(otherUid) { +, xc6_nextDrawNode(otherUid) +, xe4_24_nextNonLoopingSfxHandle(0) +, xe4_27_notInSortedLists(true) +, xe4_28_transformDirty(true) +, xe4_29_actorLightsDirty(true) +, xe4_30_outOfFrustum(false) +, xe4_31_calculateLighting(true) +, xe5_24_shadowEnabled(false) +, xe5_25_shadowDirty(false) +, xe5_26_muted(false) +, xe5_27_useInSortedLists(true) +, xe5_28_callTouch(true) +, xe5_29_globalTimeProvider(params.x58_24_globalTimeProvider) +, xe5_30_renderUnsorted(params.x58_26_renderUnsorted) +, xe5_31_pointGeneratorParticles(false) +, xe6_24_fluidCounter(0) +, xe6_27_thermalVisorFlags(u8(params.x58_25_thermalHeat ? 2 : 1)) +, xe6_29_renderParticleDBInside(true) +, xe6_30_enablePitchBend(false) +, xe6_31_targetableVisorFlags(params.GetVisorParameters().GetMask()) +, xe7_27_enableRender(true) +, xe7_28_worldLightingDirty(false) +, xe7_29_drawEnabled(active) +, xe7_30_doTargetDistanceTest(true) +, xe7_31_targetable(true) { x90_actorLights = mData.IsNull() ? nullptr : params.x0_lightParms.MakeActorLights(); if (mData.x10_animData || mData.x1c_normalModel) x64_modelData = std::make_unique(std::move(mData)); xd0_damageMag = params.x64_thermalMag; xd8_nonLoopingSfxHandles.resize(2); - xe4_27_notInSortedLists = true; - xe4_28_transformDirty = true; - xe4_29_actorLightsDirty = true; - xe4_31_calculateLighting = true; - xe5_27_useInSortedLists = true; - xe5_28_callTouch = true; - xe5_29_globalTimeProvider = params.x58_24_globalTimeProvider; - xe5_30_renderUnsorted = params.x58_26_renderUnsorted; - xe6_27_thermalVisorFlags = u8(params.x58_25_thermalHeat ? 2 : 1); - xe6_29_renderParticleDBInside = true; - xe6_31_targetableVisorFlags = params.GetVisorParameters().GetMask(); - xe7_27_enableRender = true; - xe7_29_drawEnabled = active; - xe7_30_doTargetDistanceTest = true; - xe7_31_targetable = true; + if (x64_modelData) { if (params.x44_xrayAssets.first.IsValid()) x64_modelData->SetXRayModel(params.x44_xrayAssets); diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index 69e0abbd4..5913d3279 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -48,35 +48,30 @@ protected: float xd0_damageMag; float xd4_maxVol = 1.f; rstl::reserved_vector xd8_nonLoopingSfxHandles; - union { - struct { - u8 xe4_24_nextNonLoopingSfxHandle : 3; - bool xe4_27_notInSortedLists : 1; - bool xe4_28_transformDirty : 1; - bool xe4_29_actorLightsDirty : 1; - bool xe4_30_outOfFrustum : 1; - bool xe4_31_calculateLighting : 1; - bool xe5_24_shadowEnabled : 1; - bool xe5_25_shadowDirty : 1; - bool xe5_26_muted : 1; - bool xe5_27_useInSortedLists : 1; - bool xe5_28_callTouch : 1; - bool xe5_29_globalTimeProvider : 1; - bool xe5_30_renderUnsorted : 1; - bool xe5_31_pointGeneratorParticles : 1; - u8 xe6_24_fluidCounter : 3; - u8 xe6_27_thermalVisorFlags : 2; // 1: thermal cold, 2: thermal hot - bool xe6_29_renderParticleDBInside : 1; - bool xe6_30_enablePitchBend : 1; - u8 xe6_31_targetableVisorFlags : 4; - bool xe7_27_enableRender : 1; - bool xe7_28_worldLightingDirty : 1; - bool xe7_29_drawEnabled : 1; - bool xe7_30_doTargetDistanceTest : 1; - bool xe7_31_targetable : 1; - }; - u32 dummy = 0; - }; + u8 xe4_24_nextNonLoopingSfxHandle : 3; + bool xe4_27_notInSortedLists : 1; + bool xe4_28_transformDirty : 1; + bool xe4_29_actorLightsDirty : 1; + bool xe4_30_outOfFrustum : 1; + bool xe4_31_calculateLighting : 1; + bool xe5_24_shadowEnabled : 1; + bool xe5_25_shadowDirty : 1; + bool xe5_26_muted : 1; + bool xe5_27_useInSortedLists : 1; + bool xe5_28_callTouch : 1; + bool xe5_29_globalTimeProvider : 1; + bool xe5_30_renderUnsorted : 1; + bool xe5_31_pointGeneratorParticles : 1; + u8 xe6_24_fluidCounter : 3; + u8 xe6_27_thermalVisorFlags : 2; // 1: thermal cold, 2: thermal hot + bool xe6_29_renderParticleDBInside : 1; + bool xe6_30_enablePitchBend : 1; + u8 xe6_31_targetableVisorFlags : 4; + bool xe7_27_enableRender : 1; + bool xe7_28_worldLightingDirty : 1; + bool xe7_29_drawEnabled : 1; + bool xe7_30_doTargetDistanceTest : 1; + bool xe7_31_targetable : 1; boo::ObjToken m_reflectionCube; diff --git a/Runtime/World/CActorModelParticles.cpp b/Runtime/World/CActorModelParticles.cpp index ceb99f7d5..d531b7670 100644 --- a/Runtime/World/CActorModelParticles.cpp +++ b/Runtime/World/CActorModelParticles.cpp @@ -25,7 +25,12 @@ static bool IsMediumOrLarge(CActor& act) { } CActorModelParticles::CItem::CItem(const CEntity& ent, CActorModelParticles& parent) -: x0_id(ent.GetUniqueId()), x4_areaId(ent.GetAreaIdAlways()), xdc_ashy(parent.x48_ashy), x128_parent(parent) { +: x0_id(ent.GetUniqueId()) +, x4_areaId(ent.GetAreaIdAlways()) +, xdc_ashy(parent.x48_ashy) +, x128_parent(parent) +, x12c_24_thermalCold(false) +, x12c_25_thermalHot(false) { x8_onFireGens.resize(8); } diff --git a/Runtime/World/CActorModelParticles.hpp b/Runtime/World/CActorModelParticles.hpp index df191ab5d..bb27fa909 100644 --- a/Runtime/World/CActorModelParticles.hpp +++ b/Runtime/World/CActorModelParticles.hpp @@ -56,13 +56,8 @@ public: zeus::CVector3f xec_particleOffsetScale = zeus::skOne3f; zeus::CTransform xf8_iceXf; CActorModelParticles& x128_parent; - union { - struct { - bool x12c_24_thermalCold : 1; - bool x12c_25_thermalHot : 1; - }; - u16 _dummy = 0; - }; + bool x12c_24_thermalCold : 1; + bool x12c_25_thermalHot : 1; float x130_remTime = 10.f; mutable u8 x134_lockDeps = 0; bool UpdateOnFire(float dt, CActor* actor, CStateManager& mgr); diff --git a/Runtime/World/CActorParameters.hpp b/Runtime/World/CActorParameters.hpp index b7b395b43..8ab6be70f 100644 --- a/Runtime/World/CActorParameters.hpp +++ b/Runtime/World/CActorParameters.hpp @@ -18,15 +18,10 @@ class CActorParameters { std::pair x44_xrayAssets = {}; std::pair x4c_thermalAssets = {}; CVisorParameters x54_visorParms; - union { - struct { - bool x58_24_globalTimeProvider : 1; - bool x58_25_thermalHeat : 1; - bool x58_26_renderUnsorted : 1; - bool x58_27_noSortThermal : 1; - }; - u32 _dummy = 0; - }; + bool x58_24_globalTimeProvider : 1; + bool x58_25_thermalHeat : 1; + bool x58_26_renderUnsorted : 1; + bool x58_27_noSortThermal : 1; float x5c_fadeInTime = 0.f; float x60_fadeOutTime = 0.f; float x64_thermalMag = 0.f; diff --git a/Runtime/World/CAmbientAI.cpp b/Runtime/World/CAmbientAI.cpp index 4fc4ae2e9..462854a0b 100644 --- a/Runtime/World/CAmbientAI.cpp +++ b/Runtime/World/CAmbientAI.cpp @@ -19,7 +19,9 @@ CAmbientAI::CAmbientAI(TUniqueId uid, std::string_view name, const CEntityInfo& , x2d8_impactRange(impactRange) , x2dc_defaultAnim(GetModelData()->GetAnimationData()->GetDefaultAnimation()) , x2e0_alertAnim(alertAnim) -, x2e4_impactAnim(impactAnim) { +, x2e4_impactAnim(impactAnim) +, x2e8_24_dead(false) +, x2e8_25_animating(false) { GetModelData()->GetAnimationData()->EnableLooping(true); } diff --git a/Runtime/World/CAmbientAI.hpp b/Runtime/World/CAmbientAI.hpp index 8ba3dbb03..37c979955 100644 --- a/Runtime/World/CAmbientAI.hpp +++ b/Runtime/World/CAmbientAI.hpp @@ -26,14 +26,8 @@ class CAmbientAI : public CPhysicsActor { s32 x2dc_defaultAnim; s32 x2e0_alertAnim; s32 x2e4_impactAnim; - - union { - struct { - bool x2e8_24_dead : 1; - bool x2e8_25_animating : 1; - }; - u32 _dummy = 0; - }; + bool x2e8_24_dead : 1; + bool x2e8_25_animating : 1; public: CAmbientAI(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, diff --git a/Runtime/World/CEntity.cpp b/Runtime/World/CEntity.cpp index 850b3ec5e..0194ca907 100644 --- a/Runtime/World/CEntity.cpp +++ b/Runtime/World/CEntity.cpp @@ -10,10 +10,11 @@ CEntity::CEntity(TUniqueId uniqueId, const CEntityInfo& info, bool active, std:: , x8_uid(uniqueId) , xc_editorId(info.GetEditorId()) , x10_name(name) -, x20_conns(info.GetConnectionList()) { - x30_24_active = active; - x30_27_inUse = x4_areaId != kInvalidAreaId; -} +, x20_conns(info.GetConnectionList()) +, x30_24_active(active) +, x30_25_inGraveyard(false) +, x30_26_scriptingBlocked(false) +, x30_27_inUse(x4_areaId != kInvalidAreaId) {} void CEntity::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) { switch (msg) { diff --git a/Runtime/World/CEntity.hpp b/Runtime/World/CEntity.hpp index fd8dd406a..debd13f68 100644 --- a/Runtime/World/CEntity.hpp +++ b/Runtime/World/CEntity.hpp @@ -21,16 +21,10 @@ protected: TEditorId xc_editorId; std::string x10_name; std::vector x20_conns; - - union { - struct { - bool x30_24_active : 1; - bool x30_25_inGraveyard : 1; - bool x30_26_scriptingBlocked : 1; - bool x30_27_inUse : 1; - }; - u8 _dummy = 0; - }; + bool x30_24_active : 1; + bool x30_25_inGraveyard : 1; + bool x30_26_scriptingBlocked : 1; + bool x30_27_inUse : 1; public: static const std::vector NullConnectionList; diff --git a/Runtime/World/CFishCloud.cpp b/Runtime/World/CFishCloud.cpp index 16f86f27d..80d16c219 100644 --- a/Runtime/World/CFishCloud.cpp +++ b/Runtime/World/CFishCloud.cpp @@ -46,11 +46,16 @@ CFishCloud::CFishCloud(TUniqueId uid, bool active, std::string_view name, const , x16c_color(color) , x170_weaponKillRadius(weaponKillRadius) , x174_containmentRadius(containmentRadius) -, x234_deathSfx(deathSfx != 0xffffffff ? CSfxManager::TranslateSFXID(u16(deathSfx & 0xffff)) : u16(0xffff)) { - x250_28_killable = killable; - x250_29_repelFromThreats = repelFromThreats; +, x234_deathSfx(deathSfx != 0xffffffff ? CSfxManager::TranslateSFXID(u16(deathSfx & 0xffff)) : u16(0xffff)) +, x250_24_randomMovement(false) +, x250_25_worldSpace(true) // The result of a close_enough paradox (weird inlined test?) +, x250_26_enableWeaponRepelDamping(false) +, x250_27_validModel(false) +, x250_28_killable(killable) +, x250_29_repelFromThreats(repelFromThreats) +, x250_30_enablePlayerRepelDamping(false) +, x250_31_updateWithoutPartitions(false) { x108_modifierSources.reserve(10); - x250_25_worldSpace = true; // The result of a close_enough paradox (weird inlined test?) if (aRes.GetId().IsValid()) { x1b0_models.emplace_back(std::make_unique(aRes)); x1b0_models.emplace_back(std::make_unique(aRes)); diff --git a/Runtime/World/CFishCloud.hpp b/Runtime/World/CFishCloud.hpp index f6c13f3bf..a26eaef6f 100644 --- a/Runtime/World/CFishCloud.hpp +++ b/Runtime/World/CFishCloud.hpp @@ -84,19 +84,14 @@ class CFishCloud : public CActor { u16 x234_deathSfx; zeus::CVector3f x238_partitionPitch; zeus::CVector3f x244_ooPartitionPitch; - union { - struct { - bool x250_24_randomMovement : 1; - bool x250_25_worldSpace : 1; - bool x250_26_enableWeaponRepelDamping : 1; - bool x250_27_validModel : 1; - bool x250_28_killable : 1; - bool x250_29_repelFromThreats : 1; - bool x250_30_enablePlayerRepelDamping : 1; - bool x250_31_updateWithoutPartitions : 1; - }; - u32 _dummy = 0; - }; + bool x250_24_randomMovement : 1; + bool x250_25_worldSpace : 1; + bool x250_26_enableWeaponRepelDamping : 1; + bool x250_27_validModel : 1; + bool x250_28_killable : 1; + bool x250_29_repelFromThreats : 1; + bool x250_30_enablePlayerRepelDamping : 1; + bool x250_31_updateWithoutPartitions : 1; void UpdateParticles(float dt); void UpdatePartitionList(); diff --git a/Runtime/World/CGameArea.hpp b/Runtime/World/CGameArea.hpp index ea0ae48c0..b8571699c 100644 --- a/Runtime/World/CGameArea.hpp +++ b/Runtime/World/CGameArea.hpp @@ -229,18 +229,13 @@ public: // std::vector x10f0_tokens; u32 x1100_ = 0; u32 x1104_ = 0; - union { - struct { - bool x1108_24_ : 1; - bool x1108_25_modelsConstructed : 1; - bool x1108_26_ : 1; - bool x1108_27_ : 1; - bool x1108_28_occlusionPinged : 1; - bool x1108_29_pvsHasActors : 1; - bool x1108_30_ : 1; - }; - u32 _dummy = 0; - }; + bool x1108_24_ : 1; + bool x1108_25_modelsConstructed : 1; + bool x1108_26_ : 1; + bool x1108_27_ : 1; + bool x1108_28_occlusionPinged : 1; + bool x1108_29_pvsHasActors : 1; + bool x1108_30_ : 1; std::vector> x110c_layerPtrs; float x111c_thermalCurrent = 0.f; float x1120_thermalSpeed = 0.f; @@ -251,6 +246,15 @@ public: float x1134_weaponWorldLightingSpeed = 0.f; float x1138_weaponWorldLightingTarget = 1.f; u32 x113c_playerActorsLoading = 0; + + CPostConstructed() + : x1108_24_(false) + , x1108_25_modelsConstructed(false) + , x1108_26_(false) + , x1108_27_(false) + , x1108_28_occlusionPinged(false) + , x1108_29_pvsHasActors(false) + , x1108_30_(false) {} }; private: diff --git a/Runtime/World/CKnockBackController.cpp b/Runtime/World/CKnockBackController.cpp index 9c56b6042..4815c56d7 100644 --- a/Runtime/World/CKnockBackController.cpp +++ b/Runtime/World/CKnockBackController.cpp @@ -357,15 +357,19 @@ static const CKnockBackController::KnockBackParms KnockBackParmsTable[3][19][4] }, }; -CKnockBackController::CKnockBackController(EKnockBackVariant variant) : x0_variant(variant) { - x81_24_autoResetImpulse = true; - x81_25_enableFreeze = true; - x81_27_enableBurn = true; - x81_28_enableBurnDeath = true; - x81_29_enableExplodeDeath = true; - x81_30_enableLaggedBurnDeath = true; - x81_31_ = true; - x82_24_ = true; +CKnockBackController::CKnockBackController(EKnockBackVariant variant) +: x0_variant(variant) +, x81_24_autoResetImpulse(true) +, x81_25_enableFreeze(true) +, x81_26_enableShock(false) +, x81_27_enableBurn(true) +, x81_28_enableBurnDeath(true) +, x81_29_enableExplodeDeath(true) +, x81_30_enableLaggedBurnDeath(true) +, x81_31_(true) +, x82_24_(true) +, x82_25_inDeferredKnockBack(false) +, x82_26_locomotionDuringElectrocution(false) { for (int i = 0; i < 5; ++i) { x24_.push_back(std::make_pair(0.f, FLT_MAX)); x80_availableStates.set(i); diff --git a/Runtime/World/CKnockBackController.hpp b/Runtime/World/CKnockBackController.hpp index e3f4339ac..b4a9601e9 100644 --- a/Runtime/World/CKnockBackController.hpp +++ b/Runtime/World/CKnockBackController.hpp @@ -61,16 +61,16 @@ enum class EKnockBackAnimationFollowUp { class CKnockBackController { public: struct KnockBackParms { - EKnockBackAnimationState x0_animState; - EKnockBackAnimationFollowUp x4_animFollowup; - float x8_followupDuration; - float xc_intoFreezeDur; + EKnockBackAnimationState x0_animState = EKnockBackAnimationState::None; + EKnockBackAnimationFollowUp x4_animFollowup = EKnockBackAnimationFollowUp::None; + float x8_followupDuration = 0.f; + float xc_intoFreezeDur = 0.f; }; private: friend class CPatterned; EKnockBackVariant x0_variant; - KnockBackParms x4_activeParms; + KnockBackParms x4_activeParms{}; EWeaponType x14_deferWeaponType = EWeaponType::None; EKnockBackAnimationState x18_minAnimState = EKnockBackAnimationState::None; EKnockBackAnimationState x1c_maxAnimState = EKnockBackAnimationState::Fall; @@ -86,22 +86,17 @@ private: u32 x74_ = 0; pas::ESeverity x7c_severity = pas::ESeverity::One; std::bitset<5> x80_availableStates; - union { - struct { - bool x81_24_autoResetImpulse : 1; // t - bool x81_25_enableFreeze : 1; // t - bool x81_26_enableShock : 1; - bool x81_27_enableBurn : 1; // t - bool x81_28_enableBurnDeath : 1; // t - bool x81_29_enableExplodeDeath : 1; // t - bool x81_30_enableLaggedBurnDeath : 1; // t - bool x81_31_ : 1; // t - bool x82_24_ : 1; // t - bool x82_25_inDeferredKnockBack : 1; - bool x82_26_locomotionDuringElectrocution : 1; - }; - u32 dummy = 0; - }; + bool x81_24_autoResetImpulse : 1; // t + bool x81_25_enableFreeze : 1; // t + bool x81_26_enableShock : 1; + bool x81_27_enableBurn : 1; // t + bool x81_28_enableBurnDeath : 1; // t + bool x81_29_enableExplodeDeath : 1; // t + bool x81_30_enableLaggedBurnDeath : 1; // t + bool x81_31_ : 1; // t + bool x82_24_ : 1; // t + bool x82_25_inDeferredKnockBack : 1; + bool x82_26_locomotionDuringElectrocution : 1; void ApplyImpulse(float dt, CPatterned& parent); bool TickDeferredTimer(float dt); EKnockBackCharacterState GetKnockBackCharacterState(CPatterned& parent); diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index 1360075e3..d1f502c2c 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -47,6 +47,15 @@ CPatterned::CPatterned(ECharacter character, TUniqueId uid, std::string_view nam , x300_maxAttackRange(pInfo.x1c_maxAttackRange) , x304_averageAttackTime(pInfo.x20_averageAttackTime) , x308_attackTimeVariation(pInfo.x24_attackTimeVariation) +, x328_24_inPosition(false) +, x328_25_verticalMovement(moveType == EMovementType::Flyer) +, x328_26_solidCollision(false) +, x328_27_onGround(moveType != EMovementType::Flyer) +, x328_28_prevOnGround(true) +, x328_29_noPatternShagging(false) +, x328_30_lookAtDeathDir(true) +, x328_31_energyAttractor(false) +, x329_24_(true) , x34c_character(character) , x388_anim(pInfo.GetAnimationParameters().GetInitialAnimation()) , x3b4_speed(pInfo.x4_speed) @@ -61,18 +70,33 @@ CPatterned::CPatterned(ECharacter character, TUniqueId uid, std::string_view nam , x3dc_frozenXDamageThreshold(pInfo.xe0_frozenXDamage) , x3e0_xDamageDelay(pInfo.xe4_xDamageDelay) , x3fc_flavor(flavor) +, x400_24_hitByPlayerProjectile(false) +, x400_25_alive(true) +, x400_26_(false) +, x400_27_fadeToDeath(false) +, x400_28_pendingMassiveDeath(false) +, x400_29_pendingMassiveFrozenDeath(false) +, x400_30_patternShagged(false) +, x400_31_isFlyer(moveType == CPatterned::EMovementType::Flyer) +, x401_24_pathOverCount(0) +, x401_26_disableMove(false) +, x401_27_phazingOut(false) +, x401_28_burning(false) +, x401_29_laggedBurnDeath(false) +, x401_30_pendingDeath(false) +, x401_31_nextPendingShock(false) +, x402_24_pendingShock(false) +, x402_25_lostMassiveFrozenHP(false) +, x402_26_dieIf80PercFrozen(false) +, x402_27_noXrayModel(false) +, x402_28_isMakingBigStrike(false) +, x402_29_drawParticles(true) +, x402_30_updateThermalFrozenState(x402_31_thawed = actorParms.HasThermalHeat()) +, x402_31_thawed(false) +, x403_24_keepThermalVisorState(false) +, x403_25_enableStateMachine(true) // t +, x403_26_stateControlledMassiveDeath(true) , x460_knockBackController(kbVariant) { - x328_25_verticalMovement = moveType == EMovementType::Flyer; - x328_27_onGround = moveType != EMovementType::Flyer; - x328_28_prevOnGround = true; - x328_30_lookAtDeathDir = true; - x329_24_ = true; - x400_25_alive = true; - x400_31_isFlyer = moveType == CPatterned::EMovementType::Flyer; - x402_29_drawParticles = true; - x402_30_updateThermalFrozenState = x402_31_thawed = actorParms.HasThermalHeat(); - x403_25_enableStateMachine = true; - x403_26_stateControlledMassiveDeath = true; x404_contactDamage = pInfo.x34_contactDamageInfo; x424_damageWaitTime = pInfo.x50_damageWaitTime; x454_deathSfx = pInfo.xe8_deathSfx; diff --git a/Runtime/World/CPatterned.hpp b/Runtime/World/CPatterned.hpp index 812675b6e..e008cfdd1 100644 --- a/Runtime/World/CPatterned.hpp +++ b/Runtime/World/CPatterned.hpp @@ -125,21 +125,15 @@ protected: EBehaviourOrient x30c_behaviourOrient = EBehaviourOrient::MoveDir; zeus::CVector3f x310_moveVec; zeus::CVector3f x31c_faceVec; - union { - struct { - bool x328_24_inPosition : 1; - bool x328_25_verticalMovement : 1; - bool x328_26_solidCollision : 1; - bool x328_27_onGround : 1; - bool x328_28_prevOnGround : 1; - bool x328_29_noPatternShagging : 1; - bool x328_30_lookAtDeathDir : 1; - bool x328_31_energyAttractor : 1; - bool x329_24_ : 1; - }; - u32 _dummy = 0; - }; - + bool x328_24_inPosition : 1; + bool x328_25_verticalMovement : 1; + bool x328_26_solidCollision : 1; + bool x328_27_onGround : 1; + bool x328_28_prevOnGround : 1; + bool x328_29_noPatternShagging : 1; + bool x328_30_lookAtDeathDir : 1; + bool x328_31_energyAttractor : 1; + bool x329_24_ : 1; EAnimState x32c_animState = EAnimState::NotReady; CStateMachineState x330_stateMachineState; ECharacter x34c_character; @@ -176,39 +170,32 @@ protected: float x3f4_burnThinkRateTimer = 0.f; EMoveState x3f8_moveState = EMoveState::Zero; EFlavorType x3fc_flavor; - - union { - struct { - bool x400_24_hitByPlayerProjectile : 1; - bool x400_25_alive : 1; // t - bool x400_26_ : 1; - bool x400_27_fadeToDeath : 1; - bool x400_28_pendingMassiveDeath : 1; - bool x400_29_pendingMassiveFrozenDeath : 1; - bool x400_30_patternShagged : 1; - bool x400_31_isFlyer : 1; - uint32_t x401_24_pathOverCount : 2; - bool x401_26_disableMove : 1; - bool x401_27_phazingOut : 1; - bool x401_28_burning : 1; - bool x401_29_laggedBurnDeath : 1; - bool x401_30_pendingDeath : 1; - bool x401_31_nextPendingShock : 1; - bool x402_24_pendingShock : 1; - bool x402_25_lostMassiveFrozenHP : 1; - bool x402_26_dieIf80PercFrozen : 1; - bool x402_27_noXrayModel : 1; - bool x402_28_isMakingBigStrike : 1; - bool x402_29_drawParticles : 1; // t - bool x402_30_updateThermalFrozenState : 1; - bool x402_31_thawed : 1; - bool x403_24_keepThermalVisorState : 1; - bool x403_25_enableStateMachine : 1; // t - bool x403_26_stateControlledMassiveDeath : 1; // t - }; - u32 _dummy2 = 0; - }; - + bool x400_24_hitByPlayerProjectile : 1; + bool x400_25_alive : 1; // t + bool x400_26_ : 1; + bool x400_27_fadeToDeath : 1; + bool x400_28_pendingMassiveDeath : 1; + bool x400_29_pendingMassiveFrozenDeath : 1; + bool x400_30_patternShagged : 1; + bool x400_31_isFlyer : 1; + uint32_t x401_24_pathOverCount : 2; + bool x401_26_disableMove : 1; + bool x401_27_phazingOut : 1; + bool x401_28_burning : 1; + bool x401_29_laggedBurnDeath : 1; + bool x401_30_pendingDeath : 1; + bool x401_31_nextPendingShock : 1; + bool x402_24_pendingShock : 1; + bool x402_25_lostMassiveFrozenHP : 1; + bool x402_26_dieIf80PercFrozen : 1; + bool x402_27_noXrayModel : 1; + bool x402_28_isMakingBigStrike : 1; + bool x402_29_drawParticles : 1; // t + bool x402_30_updateThermalFrozenState : 1; + bool x402_31_thawed : 1; + bool x403_24_keepThermalVisorState : 1; + bool x403_25_enableStateMachine : 1; // t + bool x403_26_stateControlledMassiveDeath : 1; // t CDamageInfo x404_contactDamage; float x420_curDamageRemTime = 0.f; float x424_damageWaitTime; diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 812085fe1..ea281b5e8 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -221,17 +221,39 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& stepDown) , x2d8_fpBounds(aabb) , x7d0_animRes(resId, 0, playerScale, 0, true) -, x7d8_beamScale(playerScale) { +, x7d8_beamScale(playerScale) +, x9c4_24_visorChangeRequested(false) +, x9c4_25_showCrosshairs(false) +, x9c4_26_(true) +, x9c4_27_canEnterMorphBall(true) +, x9c4_28_canLeaveMorphBall(true) +, x9c4_29_spiderBallControlXY(false) +, x9c4_30_controlDirOverride(false) +, x9c4_31_inWaterMovement(false) +, x9c5_24_(false) +, x9c5_25_splashUpdated(false) +, x9c5_26_(false) +, x9c5_27_camSubmerged(false) +, x9c5_28_slidingOnWall(false) +, x9c5_29_hitWall(false) +, x9c5_30_selectFluidBallSound(false) +, x9c5_31_stepCameraZBiasDirty(true) +, x9c6_24_extendTargetDistance(false) +, x9c6_25_interpolatingControlDir(false) +, x9c6_26_outOfBallLookAtHint(false) +, x9c6_27_aimingAtProjectile(false) +, x9c6_28_aligningGrappleSwingTurn(false) +, x9c6_29_disableInput(false) +, x9c6_30_newScanScanning(false) +, x9c6_31_overrideRadarRadius(false) +, x9c7_24_noDamageLoopSfx(false) +, x9c7_25_outOfBallLookAtHintActor(false) { x490_gun = std::make_unique(uid); x49c_gunHolsterRemTime = g_tweakPlayerGun->GetGunNotFiringTime(); x4a0_failsafeTest = std::make_unique(); x76c_cameraBob = std::make_unique(CPlayerCameraBob::ECameraBobType::One, CPlayerCameraBob::GetCameraBobExtent(), CPlayerCameraBob::GetCameraBobPeriod()); - x9c4_26_ = true; - x9c4_27_canEnterMorphBall = true; - x9c4_28_canLeaveMorphBall = true; - x9c5_31_stepCameraZBiasDirty = true; const CAssetId beamId = g_tweakPlayerRes->GetBeamBallTransitionModel(x7ec_beam); x7f0_ballTransitionBeamModel = std::make_unique(CStaticRes(beamId, playerScale)); x730_transitionModels.reserve(3); diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index bbe098bd5..b36616ea7 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -285,39 +285,32 @@ private: rstl::reserved_vector, 32> x838_playerHints; rstl::reserved_vector x93c_playerHintsToRemove; rstl::reserved_vector x980_playerHintsToAdd; - - union { - struct { - bool x9c4_24_visorChangeRequested : 1; - bool x9c4_25_showCrosshairs : 1; - bool x9c4_26_ : 1; - bool x9c4_27_canEnterMorphBall : 1; - bool x9c4_28_canLeaveMorphBall : 1; - bool x9c4_29_spiderBallControlXY : 1; - bool x9c4_30_controlDirOverride : 1; - bool x9c4_31_inWaterMovement : 1; - bool x9c5_24_ : 1; - bool x9c5_25_splashUpdated : 1; - bool x9c5_26_ : 1; - bool x9c5_27_camSubmerged : 1; - bool x9c5_28_slidingOnWall : 1; - bool x9c5_29_hitWall : 1; - bool x9c5_30_selectFluidBallSound : 1; - bool x9c5_31_stepCameraZBiasDirty : 1; - bool x9c6_24_extendTargetDistance : 1; - bool x9c6_25_interpolatingControlDir : 1; - bool x9c6_26_outOfBallLookAtHint : 1; - bool x9c6_27_aimingAtProjectile : 1; - bool x9c6_28_aligningGrappleSwingTurn : 1; - bool x9c6_29_disableInput : 1; - bool x9c6_30_newScanScanning : 1; - bool x9c6_31_overrideRadarRadius : 1; - bool x9c7_24_noDamageLoopSfx : 1; - bool x9c7_25_outOfBallLookAtHintActor : 1; - }; - u32 _dummy = 0; - }; - + bool x9c4_24_visorChangeRequested : 1; + bool x9c4_25_showCrosshairs : 1; + bool x9c4_26_ : 1; + bool x9c4_27_canEnterMorphBall : 1; + bool x9c4_28_canLeaveMorphBall : 1; + bool x9c4_29_spiderBallControlXY : 1; + bool x9c4_30_controlDirOverride : 1; + bool x9c4_31_inWaterMovement : 1; + bool x9c5_24_ : 1; + bool x9c5_25_splashUpdated : 1; + bool x9c5_26_ : 1; + bool x9c5_27_camSubmerged : 1; + bool x9c5_28_slidingOnWall : 1; + bool x9c5_29_hitWall : 1; + bool x9c5_30_selectFluidBallSound : 1; + bool x9c5_31_stepCameraZBiasDirty : 1; + bool x9c6_24_extendTargetDistance : 1; + bool x9c6_25_interpolatingControlDir : 1; + bool x9c6_26_outOfBallLookAtHint : 1; + bool x9c6_27_aimingAtProjectile : 1; + bool x9c6_28_aligningGrappleSwingTurn : 1; + bool x9c6_29_disableInput : 1; + bool x9c6_30_newScanScanning : 1; + bool x9c6_31_overrideRadarRadius : 1; + bool x9c7_24_noDamageLoopSfx : 1; + bool x9c7_25_outOfBallLookAtHintActor : 1; float x9c8_eyeZBias = 0.f; float x9cc_stepCameraZBias = 0.f; u32 x9d0_bombJumpCount = 0; diff --git a/Runtime/World/CScriptActorKeyframe.cpp b/Runtime/World/CScriptActorKeyframe.cpp index ef5237923..4da536cfd 100644 --- a/Runtime/World/CScriptActorKeyframe.cpp +++ b/Runtime/World/CScriptActorKeyframe.cpp @@ -15,14 +15,13 @@ CScriptActorKeyframe::CScriptActorKeyframe(TUniqueId uid, std::string_view name, , x34_animationId(animId) , x38_initialLifetime(lifetime) , x3c_playbackRate(totalPlayback) -, x40_lifetime(lifetime) { - x44_24_looping = looping; - x44_25_isPassive = isPassive; - x44_26_fadeOut = fadeOut; - x44_27_timedLoop = fadeOut; - x44_28_playing = false; - x44_29_ = false; -} +, x40_lifetime(lifetime) +, x44_24_looping(looping) +, x44_25_isPassive(isPassive) +, x44_26_fadeOut(fadeOut != 0u) +, x44_27_timedLoop(fadeOut != 0u) +, x44_28_playing(false) +, x44_29_(false) {} void CScriptActorKeyframe::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptActorKeyframe.hpp b/Runtime/World/CScriptActorKeyframe.hpp index 659ff4f36..ac6b78aed 100644 --- a/Runtime/World/CScriptActorKeyframe.hpp +++ b/Runtime/World/CScriptActorKeyframe.hpp @@ -12,17 +12,12 @@ private: float x38_initialLifetime; float x3c_playbackRate; float x40_lifetime; - union { - struct { - bool x44_24_looping : 1; - bool x44_25_isPassive : 1; - bool x44_26_fadeOut : 1; - bool x44_27_timedLoop : 1; - bool x44_28_playing : 1; - bool x44_29_ : 1; - }; - u8 _dummy = 0; - }; + bool x44_24_looping : 1; + bool x44_25_isPassive : 1; + bool x44_26_fadeOut : 1; + bool x44_27_timedLoop : 1; + bool x44_28_playing : 1; + bool x44_29_ : 1; public: CScriptActorKeyframe(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 animId, bool looping, diff --git a/Runtime/World/CScriptActorRotate.hpp b/Runtime/World/CScriptActorRotate.hpp index 8f1893679..89c03d50d 100644 --- a/Runtime/World/CScriptActorRotate.hpp +++ b/Runtime/World/CScriptActorRotate.hpp @@ -18,16 +18,10 @@ class CScriptActorRotate : public CEntity { float x40_maxTime; float x44_currentTime = 0.f; std::map x48_actors; - - union { - struct { - bool x58_24_updateRotation : 1; - bool x58_25_skipSpiderBallWaypoints : 1; - bool x58_26_updateActors : 1; - bool x58_27_updateOnCreation : 1; - }; - u32 dummy = 0; - }; + bool x58_24_updateRotation : 1; + bool x58_25_skipSpiderBallWaypoints : 1; + bool x58_26_updateActors : 1; + bool x58_27_updateOnCreation : 1; void UpdateActors(bool, CStateManager&); void UpdateSpiderBallWaypoints(CStateManager&); diff --git a/Runtime/World/CScriptAiJumpPoint.cpp b/Runtime/World/CScriptAiJumpPoint.cpp index 934e7371c..f49f08566 100644 --- a/Runtime/World/CScriptAiJumpPoint.cpp +++ b/Runtime/World/CScriptAiJumpPoint.cpp @@ -12,7 +12,8 @@ CScriptAiJumpPoint::CScriptAiJumpPoint(TUniqueId uid, std::string_view name, con : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::NoStepLogic), CActorParameters::None(), kInvalidUniqueId) , xe8_apex(apex) -, xec_touchBounds(xf.origin, xf.origin) {} +, xec_touchBounds(xf.origin, xf.origin) +, x108_24(false) {} void CScriptAiJumpPoint::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptAiJumpPoint.hpp b/Runtime/World/CScriptAiJumpPoint.hpp index 1f62259a8..74a8224fd 100644 --- a/Runtime/World/CScriptAiJumpPoint.hpp +++ b/Runtime/World/CScriptAiJumpPoint.hpp @@ -12,12 +12,7 @@ class CScriptAiJumpPoint : public CActor { private: float xe8_apex; zeus::CAABox xec_touchBounds; - union { - struct { - bool x108_24 : 1; - }; - u8 dummy = 0; - }; + bool x108_24 : 1; TUniqueId x10a_occupant = kInvalidUniqueId; TUniqueId x10c_currentWaypoint = kInvalidUniqueId; TUniqueId x10e_nextWaypoint = kInvalidUniqueId; diff --git a/Runtime/World/CScriptCameraHintTrigger.cpp b/Runtime/World/CScriptCameraHintTrigger.cpp index 0498fb39d..d52ed6b0f 100644 --- a/Runtime/World/CScriptCameraHintTrigger.cpp +++ b/Runtime/World/CScriptCameraHintTrigger.cpp @@ -14,10 +14,11 @@ CScriptCameraHintTrigger::CScriptCameraHintTrigger(TUniqueId uid, bool active, s : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Trigger), CActorParameters::None(), kInvalidUniqueId) , xe8_obb(xf, scale) -, x124_scale(scale) { - x130_24_deactivateOnEnter = deactivateOnEnter; - x130_25_deactivateOnExit = deactivateOnExit; -} +, x124_scale(scale) +, x130_24_deactivateOnEnter(deactivateOnEnter) +, x130_25_deactivateOnExit(deactivateOnExit) +, x130_26_playerInside(false) +, x130_27_playerWasInside(false) {} void CScriptCameraHintTrigger::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptCameraHintTrigger.hpp b/Runtime/World/CScriptCameraHintTrigger.hpp index 68497d278..b1a0067f2 100644 --- a/Runtime/World/CScriptCameraHintTrigger.hpp +++ b/Runtime/World/CScriptCameraHintTrigger.hpp @@ -12,15 +12,10 @@ namespace urde { class CScriptCameraHintTrigger : public CActor { zeus::COBBox xe8_obb; zeus::CVector3f x124_scale; - union { - struct { - bool x130_24_deactivateOnEnter : 1; - bool x130_25_deactivateOnExit : 1; - bool x130_26_playerInside : 1; - bool x130_27_playerWasInside : 1; - }; - u32 _dummy = 0; - }; + bool x130_24_deactivateOnEnter : 1; + bool x130_25_deactivateOnExit : 1; + bool x130_26_playerInside : 1; + bool x130_27_playerWasInside : 1; public: CScriptCameraHintTrigger(TUniqueId uid, bool active, std::string_view name, diff --git a/Runtime/World/CScriptCameraPitchVolume.cpp b/Runtime/World/CScriptCameraPitchVolume.cpp index 7bbbc76a9..ac19a0e77 100644 --- a/Runtime/World/CScriptCameraPitchVolume.cpp +++ b/Runtime/World/CScriptCameraPitchVolume.cpp @@ -22,7 +22,9 @@ CScriptCameraPitchVolume::CScriptCameraPitchVolume(TUniqueId uid, bool active, s , x124_upPitch(upPitch) , x128_downPitch(downPitch) , x12c_scale(scale * skScaleFactor) -, x138_maxInterpDistance(maxInterpDistance) {} +, x138_maxInterpDistance(maxInterpDistance) +, x13c_24_entered(false) +, x13c_25_occupied(false) {} void CScriptCameraPitchVolume::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptCameraPitchVolume.hpp b/Runtime/World/CScriptCameraPitchVolume.hpp index 2b84d2816..b50dfa3ad 100644 --- a/Runtime/World/CScriptCameraPitchVolume.hpp +++ b/Runtime/World/CScriptCameraPitchVolume.hpp @@ -17,14 +17,8 @@ class CScriptCameraPitchVolume : public CActor { zeus::CRelAngle x128_downPitch; zeus::CVector3f x12c_scale; float x138_maxInterpDistance; - - union { - struct { - bool x13c_24_entered : 1; - bool x13c_25_occupied : 1; - }; - u32 _dummy = 0; - }; + bool x13c_24_entered : 1; + bool x13c_25_occupied : 1; public: CScriptCameraPitchVolume(TUniqueId, bool, std::string_view, const CEntityInfo&, const zeus::CVector3f&, diff --git a/Runtime/World/CScriptColorModulate.cpp b/Runtime/World/CScriptColorModulate.cpp index b194417ba..7c9226dd6 100644 --- a/Runtime/World/CScriptColorModulate.cpp +++ b/Runtime/World/CScriptColorModulate.cpp @@ -15,17 +15,16 @@ CScriptColorModulate::CScriptColorModulate(TUniqueId uid, std::string_view name, , x44_colorB(colorB) , x48_blendMode(blendMode) , x4c_timeA2B(timeA2B) -, x50_timeB2A(timeB2A) { - x54_24_doReverse = doReverse; - x54_25_resetTargetWhenDone = resetTargetWhenDone; - x54_26_depthCompare = depthCompare; - x54_27_depthUpdate = depthUpdate; - x54_28_depthBackwards = depthBackwards; - x54_29_reversing = false; - x54_30_enable = false; - x54_31_dieOnEnd = false; - x55_24_isFadeOutHelper = false; -} +, x50_timeB2A(timeB2A) +, x54_24_doReverse(doReverse) +, x54_25_resetTargetWhenDone(resetTargetWhenDone) +, x54_26_depthCompare(depthCompare) +, x54_27_depthUpdate(depthUpdate) +, x54_28_depthBackwards(depthBackwards) +, x54_29_reversing(false) +, x54_30_enable(false) +, x54_31_dieOnEnd(false) +, x55_24_isFadeOutHelper(false) {} void CScriptColorModulate::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptColorModulate.hpp b/Runtime/World/CScriptColorModulate.hpp index bd60316f9..750fbb46a 100644 --- a/Runtime/World/CScriptColorModulate.hpp +++ b/Runtime/World/CScriptColorModulate.hpp @@ -30,20 +30,15 @@ private: EBlendMode x48_blendMode; float x4c_timeA2B; float x50_timeB2A; - union { - struct { - bool x54_24_doReverse : 1; - bool x54_25_resetTargetWhenDone : 1; - bool x54_26_depthCompare : 1; - bool x54_27_depthUpdate : 1; - bool x54_28_depthBackwards : 1; - bool x54_29_reversing : 1; - bool x54_30_enable : 1; - bool x54_31_dieOnEnd : 1; - bool x55_24_isFadeOutHelper : 1; - }; - u32 _dummy = 0; - }; + bool x54_24_doReverse : 1; + bool x54_25_resetTargetWhenDone : 1; + bool x54_26_depthCompare : 1; + bool x54_27_depthUpdate : 1; + bool x54_28_depthBackwards : 1; + bool x54_29_reversing : 1; + bool x54_30_enable : 1; + bool x54_31_dieOnEnd : 1; + bool x55_24_isFadeOutHelper : 1; public: CScriptColorModulate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CColor& colorA, diff --git a/Runtime/World/CScriptControllerAction.cpp b/Runtime/World/CScriptControllerAction.cpp index c1f5b4fa0..57c89676b 100644 --- a/Runtime/World/CScriptControllerAction.cpp +++ b/Runtime/World/CScriptControllerAction.cpp @@ -10,10 +10,12 @@ namespace urde { CScriptControllerAction::CScriptControllerAction(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active, ControlMapper::ECommands command, bool mapScreenResponse, u32 w1, bool deactivateOnClose) -: CEntity(uid, info, active, name), x34_command(command), x38_mapScreenSubaction(w1) { - x3c_24_mapScreenResponse = mapScreenResponse; - x3c_25_deactivateOnClose = deactivateOnClose; -} +: CEntity(uid, info, active, name) +, x34_command(command) +, x38_mapScreenSubaction(w1) +, x3c_24_mapScreenResponse(mapScreenResponse) +, x3c_25_deactivateOnClose(deactivateOnClose) +, x3c_26_pressed(false) {} void CScriptControllerAction::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptControllerAction.hpp b/Runtime/World/CScriptControllerAction.hpp index a18dd5838..e7e0c2486 100644 --- a/Runtime/World/CScriptControllerAction.hpp +++ b/Runtime/World/CScriptControllerAction.hpp @@ -11,14 +11,9 @@ namespace urde { class CScriptControllerAction : public CEntity { ControlMapper::ECommands x34_command; u32 x38_mapScreenSubaction; - union { - struct { - bool x3c_24_mapScreenResponse : 1; - bool x3c_25_deactivateOnClose : 1; - bool x3c_26_pressed : 1; - }; - u8 _dummy = 0; - }; + bool x3c_24_mapScreenResponse : 1; + bool x3c_25_deactivateOnClose : 1; + bool x3c_26_pressed : 1; public: CScriptControllerAction(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active, diff --git a/Runtime/World/CScriptCoverPoint.cpp b/Runtime/World/CScriptCoverPoint.cpp index 44af6ac16..f55cc93b1 100644 --- a/Runtime/World/CScriptCoverPoint.cpp +++ b/Runtime/World/CScriptCoverPoint.cpp @@ -11,9 +11,12 @@ CScriptCoverPoint::CScriptCoverPoint(TUniqueId uid, std::string_view name, const float coverTime) : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::NoStepLogic), CActorParameters::None(), kInvalidUniqueId) -, xe8_flags(flags) -, xf4_coverTime(coverTime) { - xf8_24_crouch = crouch; +, xe8_26_landHere((flags & 0x20) != 0u) +, xe8_27_wallHang((flags & 0x10) != 0u) +, xe8_28_stay((flags & 0x8) != 0u) +, xf4_coverTime(coverTime) +, xf8_24_crouch(crouch) +, xf8_25_inUse(false) { xec_cosHorizontalAngle = std::cos(zeus::degToRad(horizontalAngle) * 0.5f); xf0_sinVerticalAngle = std::sin(zeus::degToRad(verticalAngle) * 0.5f); x100_touchBounds.emplace(xf.origin, xf.origin); diff --git a/Runtime/World/CScriptCoverPoint.hpp b/Runtime/World/CScriptCoverPoint.hpp index 176636db9..98f938c29 100644 --- a/Runtime/World/CScriptCoverPoint.hpp +++ b/Runtime/World/CScriptCoverPoint.hpp @@ -10,25 +10,14 @@ namespace urde { class CScriptCoverPoint : public CActor { - union { - struct { - bool xe8_26_landHere : 1; - bool xe8_27_wallHang : 1; - bool xe8_28_stay : 1; - }; - u32 xe8_flags; - }; - + bool xe8_26_landHere : 1; + bool xe8_27_wallHang : 1; + bool xe8_28_stay : 1; float xec_cosHorizontalAngle; float xf0_sinVerticalAngle; float xf4_coverTime; - union { - struct { - bool xf8_24_crouch : 1; - bool xf8_25_inUse : 1; - }; - u32 xf8_flags = 0; - }; + bool xf8_24_crouch : 1; + bool xf8_25_inUse : 1; TUniqueId xfa_occupant = kInvalidUniqueId; TUniqueId xfc_retreating = kInvalidUniqueId; std::optional x100_touchBounds; diff --git a/Runtime/World/CScriptDamageableTrigger.cpp b/Runtime/World/CScriptDamageableTrigger.cpp index 3b0a6040b..71fd94ef8 100644 --- a/Runtime/World/CScriptDamageableTrigger.cpp +++ b/Runtime/World/CScriptDamageableTrigger.cpp @@ -36,8 +36,12 @@ CScriptDamageableTrigger::CScriptDamageableTrigger(TUniqueId uid, std::string_vi , x16c_hInfo(hInfo) , x174_dVuln(dVuln) , x1dc_faceFlag(faceFlag) -, x254_fluidPlane(patternTex1, patternTex2, colorTex, 1.f, 2, EFluidType::NormalWater, 1.f, CFluidUVMotion(6.f, 0.f)) { - x300_28_canOrbit = canOrbit == ECanOrbit::Orbit; +, x254_fluidPlane(patternTex1, patternTex2, colorTex, 1.f, 2, EFluidType::NormalWater, 1.f, CFluidUVMotion(6.f, 0.f)) +, x300_24_notOccluded(false) +, x300_25_alphaOut(false) +, x300_26_outOfFrustum(false) +, x300_27_invulnerable(false) +, x300_28_canOrbit(canOrbit == ECanOrbit::Orbit) { if (x1dc_faceFlag & 0x1) { x244_faceTranslate = zeus::CVector3f(0.f, x14c_bounds.max.y(), 0.f); x1e4_faceDir = zeus::CTransform::RotateX(-M_PIF / 2.f); diff --git a/Runtime/World/CScriptDamageableTrigger.hpp b/Runtime/World/CScriptDamageableTrigger.hpp index 991bbdb0b..378385231 100644 --- a/Runtime/World/CScriptDamageableTrigger.hpp +++ b/Runtime/World/CScriptDamageableTrigger.hpp @@ -30,16 +30,12 @@ private: zeus::CVector3f x244_faceTranslate; float x250_alphaTimer = 0.f; CFluidPlaneDoor x254_fluidPlane; - union { - struct { - bool x300_24_notOccluded : 1; - bool x300_25_alphaOut : 1; - bool x300_26_outOfFrustum : 1; - bool x300_27_invulnerable : 1; - bool x300_28_canOrbit : 1; - }; - u32 _dummy = 0; - }; + bool x300_24_notOccluded : 1; + bool x300_25_alphaOut : 1; + bool x300_26_outOfFrustum : 1; + bool x300_27_invulnerable : 1; + bool x300_28_canOrbit : 1; + void SetLinkedObjectAlpha(float a, CStateManager& mgr); float GetPuddleAlphaScale() const; diff --git a/Runtime/World/CScriptDebris.cpp b/Runtime/World/CScriptDebris.cpp index 740c2bda1..7cdc46d56 100644 --- a/Runtime/World/CScriptDebris.cpp +++ b/Runtime/World/CScriptDebris.cpp @@ -27,9 +27,17 @@ CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntity , x278_ooDuration(1.f / x274_duration) , x27c_restitution(restitution) , x280_scaleType(scaleType) +, x281_24_randomAngImpulse(randomAngImpulse) +, x281_25_particle1GlobalTranslation(false) +, x281_26_deferDeleteTillParticle1Done(false) +, x281_27_particle2GlobalTranslation(false) +, x281_28_deferDeleteTillParticle2Done(false) +, x281_29_particle3Active(false) +, x281_30_debrisExtended(false) +, x281_31_dieOnProjectile(false) +, x282_24_noBounce(false) , x2b0_scale(mData.GetScale()) , x2e0_speedAvg(2.f) { - x281_24_randomAngImpulse = randomAngImpulse; if (scaleType == EScaleType::NoScale) x2bc_endScale = mData.GetScale(); else if (scaleType == EScaleType::EndsToZero) @@ -80,6 +88,15 @@ CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntity , x264_color(color) , x268_endsColor(endsColor) , x27c_restitution(restitution) +, x281_24_randomAngImpulse(false) +, x281_25_particle1GlobalTranslation(particle1GlobalTranslation) +, x281_26_deferDeleteTillParticle1Done(deferDeleteTillParticle1Done) +, x281_27_particle2GlobalTranslation(particle2GlobalTranslation) +, x281_28_deferDeleteTillParticle2Done(deferDeleteTillParticle2Done) +, x281_29_particle3Active(false) +, x281_30_debrisExtended(true) +, x281_31_dieOnProjectile(false) +, x282_24_noBounce(noBounce) , x288_linConeAngle(linConeAngle) , x28c_linMinMag(linMinMag) , x290_linMaxMag(linMaxMag) @@ -93,13 +110,6 @@ CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntity , x2b0_scale(scale) , x2bc_endScale(scale * endScale) , x2e0_speedAvg(2.f) { - x281_25_particle1GlobalTranslation = particle1GlobalTranslation; - x281_26_deferDeleteTillParticle1Done = deferDeleteTillParticle1Done; - x281_27_particle2GlobalTranslation = particle2GlobalTranslation; - x281_28_deferDeleteTillParticle2Done = deferDeleteTillParticle2Done; - x281_30_debrisExtended = true; - x281_31_dieOnProjectile = dieOnProjectile; - x282_24_noBounce = noBounce; x283_particleOrs[0] = particle1Or; x283_particleOrs[1] = particle2Or; x283_particleOrs[2] = particle3Or; diff --git a/Runtime/World/CScriptDebris.hpp b/Runtime/World/CScriptDebris.hpp index bf7ca8cfa..3fe94ac1a 100644 --- a/Runtime/World/CScriptDebris.hpp +++ b/Runtime/World/CScriptDebris.hpp @@ -27,20 +27,15 @@ private: float x278_ooDuration = 0.f; float x27c_restitution; CScriptDebris::EScaleType x280_scaleType = CScriptDebris::EScaleType::NoScale; - union { - struct { - bool x281_24_randomAngImpulse : 1; - bool x281_25_particle1GlobalTranslation : 1; - bool x281_26_deferDeleteTillParticle1Done : 1; - bool x281_27_particle2GlobalTranslation : 1; - bool x281_28_deferDeleteTillParticle2Done : 1; - bool x281_29_particle3Active : 1; - bool x281_30_debrisExtended : 1; - bool x281_31_dieOnProjectile : 1; - bool x282_24_noBounce : 1; - }; - u32 _dummy = 0; - }; + bool x281_24_randomAngImpulse : 1; + bool x281_25_particle1GlobalTranslation : 1; + bool x281_26_deferDeleteTillParticle1Done : 1; + bool x281_27_particle2GlobalTranslation : 1; + bool x281_28_deferDeleteTillParticle2Done : 1; + bool x281_29_particle3Active : 1; + bool x281_30_debrisExtended : 1; + bool x281_31_dieOnProjectile : 1; + bool x282_24_noBounce : 1; EOrientationType x283_particleOrs[3] = {}; float x288_linConeAngle = 0.f; float x28c_linMinMag = 0.f; diff --git a/Runtime/World/CScriptDock.cpp b/Runtime/World/CScriptDock.cpp index 9440242a9..8b5707568 100644 --- a/Runtime/World/CScriptDock.cpp +++ b/Runtime/World/CScriptDock.cpp @@ -23,14 +23,15 @@ CMaterialList MakeDockMaterialList() { CScriptDock::CScriptDock(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& position, const zeus::CVector3f& extents, s32 dock, TAreaId area, bool active, s32 dockReferenceCount, bool loadConnected) -: CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f(), position), - CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f), - SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f) +: CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f(), position), CModelData::CModelDataNull(), + MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f), SMoverData(1.f), + CActorParameters::None(), 0.3f, 0.1f) , x258_dockReferenceCount(dockReferenceCount) , x25c_dock(dock) -, x260_area(area) { - x268_25_loadConnected = loadConnected; -} +, x260_area(area) +, x268_24_dockReferenced(false) +, x268_25_loadConnected(loadConnected) +, x268_26_areaPostConstructed(false) {} void CScriptDock::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptDock.hpp b/Runtime/World/CScriptDock.hpp index 42d7605e8..f34d71a73 100644 --- a/Runtime/World/CScriptDock.hpp +++ b/Runtime/World/CScriptDock.hpp @@ -15,14 +15,9 @@ class CScriptDock : public CPhysicsActor { s32 x25c_dock; TAreaId x260_area; EDockState x264_dockState = EDockState::Three; - union { - struct { - bool x268_24_dockReferenced : 1; - bool x268_25_loadConnected : 1; - bool x268_26_areaPostConstructed : 1; - }; - u8 dummy = 0; - }; + bool x268_24_dockReferenced : 1; + bool x268_25_loadConnected : 1; + bool x268_26_areaPostConstructed : 1; public: CScriptDock(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& position, diff --git a/Runtime/World/CScriptEffect.cpp b/Runtime/World/CScriptEffect.cpp index 523ae2ace..f5a84c874 100644 --- a/Runtime/World/CScriptEffect.cpp +++ b/Runtime/World/CScriptEffect.cpp @@ -32,6 +32,17 @@ CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntity : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None().HotInThermal(hotInThermal), kInvalidUniqueId) , x10c_partId(partId) +, x110_24_enable(active) +, x110_25_noTimerUnlessAreaOccluded(noTimerUnlessAreaOccluded) +, x110_26_rebuildSystemsOnActivate(rebuildSystemsOnActivate) +, x110_27_useRateInverseCamDist(useRateInverseCamDist) +, x110_28_combatVisorVisible(combatVisorVisible) +, x110_29_thermalVisorVisible(thermalVisorVisible) +, x110_30_xrayVisorVisible(xrayVisorVisible) +, x110_31_anyVisorVisible(xrayVisorVisible && thermalVisorVisible && combatVisorVisible) +, x111_24_useRateCamDistRange(useRateCamDistRange) +, x111_25_dieWhenSystemsDone(dieWhenSystemsDone) +, x111_26_canRender(false) , x114_rateInverseCamDist(rateInverseCamDist) , x118_rateInverseCamDistSq(rateInverseCamDist * rateInverseCamDist) , x11c_rateInverseCamDistRate(rateInverseCamDistRate) @@ -42,18 +53,6 @@ CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntity , x130_duration(duration) , x134_durationResetWhileVisible(durationResetWhileVisible) , x138_actorLights(lParms.MakeActorLights()) { - x110_24_enable = active; - x110_25_noTimerUnlessAreaOccluded = noTimerUnlessAreaOccluded; - x110_26_rebuildSystemsOnActivate = rebuildSystemsOnActivate; - x110_27_useRateInverseCamDist = useRateInverseCamDist; - x110_28_combatVisorVisible = combatVisorVisible; - x110_29_thermalVisorVisible = thermalVisorVisible; - x110_30_xrayVisorVisible = xrayVisorVisible; - x110_31_anyVisorVisible = xrayVisorVisible && thermalVisorVisible && combatVisorVisible; - x111_24_useRateCamDistRange = useRateCamDistRange; - x111_25_dieWhenSystemsDone = dieWhenSystemsDone; - x111_26_canRender = false; - if (partId.IsValid()) { xf8_particleSystemToken = g_SimplePool->GetObj({FOURCC('PART'), partId}); x104_particleSystem = std::make_unique(xf8_particleSystemToken); diff --git a/Runtime/World/CScriptEffect.hpp b/Runtime/World/CScriptEffect.hpp index 384b62130..261486754 100644 --- a/Runtime/World/CScriptEffect.hpp +++ b/Runtime/World/CScriptEffect.hpp @@ -19,22 +19,17 @@ class CScriptEffect : public CActor { std::unique_ptr x104_particleSystem; TUniqueId x108_lightId = kInvalidUniqueId; CAssetId x10c_partId; - union { - struct { - bool x110_24_enable : 1; - bool x110_25_noTimerUnlessAreaOccluded : 1; - bool x110_26_rebuildSystemsOnActivate : 1; - bool x110_27_useRateInverseCamDist : 1; - bool x110_28_combatVisorVisible : 1; - bool x110_29_thermalVisorVisible : 1; - bool x110_30_xrayVisorVisible : 1; - bool x110_31_anyVisorVisible : 1; - bool x111_24_useRateCamDistRange : 1; - bool x111_25_dieWhenSystemsDone : 1; - bool x111_26_canRender : 1; - }; - u32 _dummy = 0; - }; + bool x110_24_enable : 1; + bool x110_25_noTimerUnlessAreaOccluded : 1; + bool x110_26_rebuildSystemsOnActivate : 1; + bool x110_27_useRateInverseCamDist : 1; + bool x110_28_combatVisorVisible : 1; + bool x110_29_thermalVisorVisible : 1; + bool x110_30_xrayVisorVisible : 1; + bool x110_31_anyVisorVisible : 1; + bool x111_24_useRateCamDistRange : 1; + bool x111_25_dieWhenSystemsDone : 1; + bool x111_26_canRender : 1; float x114_rateInverseCamDist; float x118_rateInverseCamDistSq; float x11c_rateInverseCamDistRate; diff --git a/Runtime/World/CScriptGenerator.hpp b/Runtime/World/CScriptGenerator.hpp index 3b98b7101..76b154b20 100644 --- a/Runtime/World/CScriptGenerator.hpp +++ b/Runtime/World/CScriptGenerator.hpp @@ -11,13 +11,8 @@ namespace urde { class CScriptGenerator : public CEntity { u32 x34_spawnCount; - union { - struct { - bool x38_24_noReuseFollowers : 1; - bool x38_25_noInheritTransform : 1; - }; - u8 dummy1 = 0; - }; + bool x38_24_noReuseFollowers : 1; + bool x38_25_noInheritTransform : 1; zeus::CVector3f x3c_offset; float x48_minScale; float x4c_maxScale; diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index 774a4319e..dde720de5 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -158,7 +158,15 @@ CScriptGunTurret::CScriptGunTurret(TUniqueId uid, std::string_view name, ETurret , x428_targettingLightDesc(g_SimplePool->GetObj({SBIG('PART'), turretData.GetTargettingLightRes()})) , x434_frozenEffectDesc(g_SimplePool->GetObj({SBIG('PART'), turretData.GetFrozenEffectRes()})) , x440_chargingEffectDesc(g_SimplePool->GetObj({SBIG('PART'), turretData.GetChargingEffectRes()})) -, x44c_panningEffectDesc(g_SimplePool->GetObj({SBIG('PART'), turretData.GetPanningEffectRes()})) { +, x44c_panningEffectDesc(g_SimplePool->GetObj({SBIG('PART'), turretData.GetPanningEffectRes()})) +, x560_24_dead(false) +, x560_25_frozen(false) +, x560_26_firedWithSetBurst(false) +, x560_27_burstSet(false) +, x560_28_hasBeenActivated(false) +, x560_29_scriptedStart(false) +, x560_30_needsStopClankSound(true) +, x560_31_frenzyReverse(false) { if (turretData.GetVisorEffectRes().IsValid()) x458_visorEffectDesc = g_SimplePool->GetObj({SBIG('PART'), turretData.GetVisorEffectRes()}); x468_idleLight = std::make_unique(x410_idleLightDesc); @@ -171,14 +179,6 @@ CScriptGunTurret::CScriptGunTurret(TUniqueId uid, std::string_view name, ETurret x514_lastFrontVector = xf.frontVector(); x544_originalFrontVec = xf.frontVector(); x550_originalRightVec = xf.rightVector(); - x560_24_dead = false; - x560_25_frozen = false; - x560_26_firedWithSetBurst = false; - x560_27_burstSet = false; - x560_28_hasBeenActivated = false; - x560_29_scriptedStart = false; - x560_30_needsStopClankSound = true; - x560_31_frenzyReverse = false; if (comp == ETurretComponent::Base && HasModelData() && GetModelData()->HasAnimData()) GetModelData()->EnableLooping(true); diff --git a/Runtime/World/CScriptGunTurret.hpp b/Runtime/World/CScriptGunTurret.hpp index 779005a86..47935993a 100644 --- a/Runtime/World/CScriptGunTurret.hpp +++ b/Runtime/World/CScriptGunTurret.hpp @@ -170,19 +170,14 @@ private: zeus::CVector3f x544_originalFrontVec; zeus::CVector3f x550_originalRightVec; s32 x55c_additiveChargeAnim = -1; - union { - struct { - bool x560_24_dead : 1; - bool x560_25_frozen : 1; - bool x560_26_firedWithSetBurst : 1; - bool x560_27_burstSet : 1; - bool x560_28_hasBeenActivated : 1; - bool x560_29_scriptedStart : 1; - bool x560_30_needsStopClankSound : 1; - bool x560_31_frenzyReverse : 1; - }; - u32 _dummy = 0; - }; + bool x560_24_dead : 1; + bool x560_25_frozen : 1; + bool x560_26_firedWithSetBurst : 1; + bool x560_27_burstSet : 1; + bool x560_28_hasBeenActivated : 1; + bool x560_29_scriptedStart : 1; + bool x560_30_needsStopClankSound : 1; + bool x560_31_frenzyReverse : 1; private: void SetupCollisionManager(CStateManager&); diff --git a/Runtime/World/CScriptMazeNode.cpp b/Runtime/World/CScriptMazeNode.cpp index 2ed75e9b7..198a1f7fe 100644 --- a/Runtime/World/CScriptMazeNode.cpp +++ b/Runtime/World/CScriptMazeNode.cpp @@ -20,9 +20,10 @@ CScriptMazeNode::CScriptMazeNode(TUniqueId uid, std::string_view name, const CEn , xf0_(w2) , x100_(vec1) , x110_(vec2) -, x120_(vec3) { - x13c_24_ = true; -} +, x120_(vec3) +, x13c_24_(true) +, x13c_25_(false) +, x13c_26_(false) {} void CScriptMazeNode::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptMazeNode.hpp b/Runtime/World/CScriptMazeNode.hpp index f9e147d5a..18072f7d0 100644 --- a/Runtime/World/CScriptMazeNode.hpp +++ b/Runtime/World/CScriptMazeNode.hpp @@ -24,14 +24,9 @@ class CScriptMazeNode : public CActor { s32 x130_ = 0; s32 x134_ = 0; s32 x138_ = 0; - union { - struct { - bool x13c_24_ : 1; - bool x13c_25_ : 1; - bool x13c_26_ : 1; - }; - u8 dummy = 0; - }; + bool x13c_24_ : 1; + bool x13c_25_ : 1; + bool x13c_26_ : 1; public: CScriptMazeNode(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, bool, s32, s32, s32, diff --git a/Runtime/World/CScriptMemoryRelay.hpp b/Runtime/World/CScriptMemoryRelay.hpp index 594b6da71..2f0b31c64 100644 --- a/Runtime/World/CScriptMemoryRelay.hpp +++ b/Runtime/World/CScriptMemoryRelay.hpp @@ -7,14 +7,9 @@ namespace urde { class CScriptMemoryRelay : public CEntity { - union { - struct { - bool x34_24_defaultActive; - bool x34_25_skipSendActive; - bool x34_26_ignoreMessages; - }; - u8 dummy = 0; - }; + bool x34_24_defaultActive; + bool x34_25_skipSendActive; + bool x34_26_ignoreMessages; public: CScriptMemoryRelay(TUniqueId, std::string_view name, const CEntityInfo&, bool, bool, bool); diff --git a/Runtime/World/CScriptPlayerActor.cpp b/Runtime/World/CScriptPlayerActor.cpp index 781d72767..d99824f1e 100644 --- a/Runtime/World/CScriptPlayerActor.cpp +++ b/Runtime/World/CScriptPlayerActor.cpp @@ -25,10 +25,16 @@ CScriptPlayerActor::CScriptPlayerActor(TUniqueId uid, std::string_view name, con 0, 1.f, false, false, false, false) , x2e8_suitRes(animRes) , x304_beam(beam) -, x350_flags(flags) { - x354_24_setBoundingBox = setBoundingBox; - x354_29_loading = true; - x354_30_enableLoading = true; +, x350_flags(flags) +, x354_24_setBoundingBox(setBoundingBox) +, x354_25_deferOnlineModelData(false) +, x354_26_deferOfflineModelData(false) +, x354_27_beamModelLoading(false) +, x354_28_suitModelLoading(false) +, x354_29_loading(true) +, x354_30_enableLoading(true) +, x354_31_deferOnlineLoad(false) +, x355_24_areaTrackingLoad(false) { CMaterialList exclude = GetMaterialFilter().GetExcludeList(); CMaterialList include = GetMaterialFilter().GetIncludeList(); include.Add(EMaterialTypes::Player); diff --git a/Runtime/World/CScriptPlayerActor.hpp b/Runtime/World/CScriptPlayerActor.hpp index 041f1a05a..bdbd13890 100644 --- a/Runtime/World/CScriptPlayerActor.hpp +++ b/Runtime/World/CScriptPlayerActor.hpp @@ -25,20 +25,15 @@ class CScriptPlayerActor : public CScriptActor { float x34c_phazonOffsetAngle = 0.f; u32 x350_flags; /* 0x1: suit transition, 0x2: previous suit, 0x4: force reset * 0x8: track in area data, 0x10: keep in state manager */ - union { - struct { - bool x354_24_setBoundingBox : 1; - bool x354_25_deferOnlineModelData : 1; - bool x354_26_deferOfflineModelData : 1; - bool x354_27_beamModelLoading : 1; - bool x354_28_suitModelLoading : 1; - bool x354_29_loading : 1; - bool x354_30_enableLoading : 1; - bool x354_31_deferOnlineLoad : 1; - bool x355_24_areaTrackingLoad : 1; - }; - u32 _dummy = 0; - }; + bool x354_24_setBoundingBox : 1; + bool x354_25_deferOnlineModelData : 1; + bool x354_26_deferOfflineModelData : 1; + bool x354_27_beamModelLoading : 1; + bool x354_28_suitModelLoading : 1; + bool x354_29_loading : 1; + bool x354_30_enableLoading : 1; + bool x354_31_deferOnlineLoad : 1; + bool x355_24_areaTrackingLoad : 1; TUniqueId x356_nextPlayerActor = kInvalidUniqueId; u32 GetSuitCharIdx(const CStateManager& mgr, CPlayerState::EPlayerSuit suit) const; diff --git a/Runtime/World/CScriptShadowProjector.cpp b/Runtime/World/CScriptShadowProjector.cpp index 63831af1c..652d47e76 100644 --- a/Runtime/World/CScriptShadowProjector.cpp +++ b/Runtime/World/CScriptShadowProjector.cpp @@ -10,7 +10,7 @@ namespace urde { CScriptShadowProjector::CScriptShadowProjector(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, bool active, const zeus::CVector3f& offset, - bool b2, float scale, float f2, float opacity, float opacityQ, + bool persistent, float scale, float f2, float opacity, float opacityQ, s32 textureSize) : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(), kInvalidUniqueId) @@ -19,9 +19,9 @@ CScriptShadowProjector::CScriptShadowProjector(TUniqueId uid, std::string_view n , xf8_zOffsetAdjust(f2) , xfc_opacity(opacity) , x100_opacityRecip(opacity < 0.00001 ? 1.f : opacityQ / opacity) -, x10c_textureSize(textureSize) { - x110_24_persistent = b2; -} +, x10c_textureSize(textureSize) +, x110_24_persistent(persistent) +, x110_25_shadowInvalidated(false) {} void CScriptShadowProjector::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptShadowProjector.hpp b/Runtime/World/CScriptShadowProjector.hpp index 54a521def..2480ca17e 100644 --- a/Runtime/World/CScriptShadowProjector.hpp +++ b/Runtime/World/CScriptShadowProjector.hpp @@ -20,14 +20,8 @@ class CScriptShadowProjector : public CActor { TUniqueId x104_target; std::unique_ptr x108_projectedShadow; u32 x10c_textureSize; - - union { - struct { - bool x110_24_persistent : 1; - bool x110_25_shadowInvalidated : 1; - }; - u8 x110_dummy = 0; - }; + bool x110_24_persistent : 1; + bool x110_25_shadowInvalidated : 1; public: CScriptShadowProjector(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, bool, diff --git a/Runtime/World/CScriptSound.cpp b/Runtime/World/CScriptSound.cpp index 8fcc6504f..39247989a 100644 --- a/Runtime/World/CScriptSound.cpp +++ b/Runtime/World/CScriptSound.cpp @@ -27,14 +27,17 @@ CScriptSound::CScriptSound(TUniqueId uid, std::string_view name, const CEntityIn , x112_prio(s16(prio)) , x114_pan(pan / 64.f - 1.f) , x116_(w6) -, x118_pitch(pitch / 8192.f) { - x11c_25_looped = looped; - x11c_26_nonEmitter = nonEmitter; - x11c_27_autoStart = autoStart; - x11c_28_occlusionTest = occlusionTest; - x11c_29_acoustics = acoustics; - x11c_30_worldSfx = worldSfx; - x11d_24_allowDuplicates = allowDuplicates; +, x118_pitch(pitch / 8192.f) +, x11c_24_playRequested(false) +, x11c_25_looped(looped) +, x11c_26_nonEmitter(nonEmitter) +, x11c_27_autoStart(autoStart) +, x11c_28_occlusionTest(occlusionTest) +, x11c_29_acoustics(acoustics) +, x11c_30_worldSfx(worldSfx) +, x11c_31_selfFree(false) +, x11d_24_allowDuplicates(allowDuplicates) +, x11d_25_processedThisFrame(false) { if (x11c_30_worldSfx && (!x11c_26_nonEmitter || !x11c_25_looped)) x11c_30_worldSfx = false; } diff --git a/Runtime/World/CScriptSound.hpp b/Runtime/World/CScriptSound.hpp index 63e33e989..70addc700 100644 --- a/Runtime/World/CScriptSound.hpp +++ b/Runtime/World/CScriptSound.hpp @@ -28,21 +28,16 @@ class CScriptSound : public CActor { float x114_pan; bool x116_; float x118_pitch; - union { - struct { - bool x11c_24_playRequested : 1; - bool x11c_25_looped : 1; - bool x11c_26_nonEmitter : 1; - bool x11c_27_autoStart : 1; - bool x11c_28_occlusionTest : 1; - bool x11c_29_acoustics : 1; - bool x11c_30_worldSfx : 1; - bool x11c_31_selfFree : 1; - bool x11d_24_allowDuplicates : 1; - bool x11d_25_processedThisFrame : 1; - }; - u32 x11c_dummy = 0; - }; + bool x11c_24_playRequested : 1; + bool x11c_25_looped : 1; + bool x11c_26_nonEmitter : 1; + bool x11c_27_autoStart : 1; + bool x11c_28_occlusionTest : 1; + bool x11c_29_acoustics : 1; + bool x11c_30_worldSfx : 1; + bool x11c_31_selfFree : 1; + bool x11d_24_allowDuplicates : 1; + bool x11d_25_processedThisFrame : 1; static float GetOccludedVolumeAmount(const zeus::CVector3f& pos, const CStateManager& mgr); diff --git a/Runtime/World/CScriptSpawnPoint.hpp b/Runtime/World/CScriptSpawnPoint.hpp index ab867ec6c..20a488de5 100644 --- a/Runtime/World/CScriptSpawnPoint.hpp +++ b/Runtime/World/CScriptSpawnPoint.hpp @@ -14,13 +14,8 @@ namespace urde { class CScriptSpawnPoint : public CEntity { zeus::CTransform x34_xf; rstl::reserved_vector x64_itemCounts; - union { - struct { - bool x10c_24_firstSpawn : 1; - bool x10c_25_morphed : 1; - }; - u8 _dummy = 0; - }; + bool x10c_24_firstSpawn : 1; + bool x10c_25_morphed : 1; public: CScriptSpawnPoint(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, diff --git a/Runtime/World/CScriptSpecialFunction.cpp b/Runtime/World/CScriptSpecialFunction.cpp index 460612f5a..dacc04370 100644 --- a/Runtime/World/CScriptSpecialFunction.cpp +++ b/Runtime/World/CScriptSpecialFunction.cpp @@ -45,8 +45,18 @@ CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, std::string_view n , x184_(0.f) , x1bc_areaSaveId(aId1) , x1c0_layerIdx(aId2) -, x1c4_item(itemType) { - x1e4_26_sfx2Played = true; +, x1c4_item(itemType) +, x1e4_24_(false) +, x1e4_25_spinnerCanMove(false) +, x1e4_26_sfx2Played(true) +, x1e4_27_sfx3Played(false) +, x1e4_28_frustumEntered(false) +, x1e4_29_frustumExited(false) +, x1e4_30_(false) +, x1e4_31_inAreaDamage(false) +, x1e5_24_doSave(false) +, x1e5_25_playerInArea(false) +, x1e5_26_displayBillboard(false) { if (xe8_function == ESpecialFunction::HUDTarget) x1c8_touchBounds = {-1.f, 1.f}; } diff --git a/Runtime/World/CScriptSpecialFunction.hpp b/Runtime/World/CScriptSpecialFunction.hpp index 0d5dc7935..f001d8abe 100644 --- a/Runtime/World/CScriptSpecialFunction.hpp +++ b/Runtime/World/CScriptSpecialFunction.hpp @@ -99,22 +99,17 @@ private: s32 x1c0_layerIdx; CPlayerState::EItemType x1c4_item; std::optional x1c8_touchBounds; - union { - struct { - bool x1e4_24_ : 1; - bool x1e4_25_spinnerCanMove : 1; - bool x1e4_26_sfx2Played : 1; - bool x1e4_27_sfx3Played : 1; - bool x1e4_28_frustumEntered : 1; - bool x1e4_29_frustumExited : 1; - bool x1e4_30_ : 1; - bool x1e4_31_inAreaDamage : 1; - bool x1e5_24_doSave : 1; - bool x1e5_25_playerInArea : 1; - bool x1e5_26_displayBillboard : 1; - }; - u32 x1e4_dummy = 0; - }; + bool x1e4_24_ : 1; + bool x1e4_25_spinnerCanMove : 1; + bool x1e4_26_sfx2Played : 1; + bool x1e4_27_sfx3Played : 1; + bool x1e4_28_frustumEntered : 1; + bool x1e4_29_frustumExited : 1; + bool x1e4_30_ : 1; + bool x1e4_31_inAreaDamage : 1; + bool x1e5_24_doSave : 1; + bool x1e5_25_playerInArea : 1; + bool x1e5_26_displayBillboard : 1; TLockedToken x1e8_; // Used to be optional public: CScriptSpecialFunction(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, ESpecialFunction, diff --git a/Runtime/World/CScriptTargetingPoint.cpp b/Runtime/World/CScriptTargetingPoint.cpp index bc7e59b6f..3924b0cc3 100644 --- a/Runtime/World/CScriptTargetingPoint.cpp +++ b/Runtime/World/CScriptTargetingPoint.cpp @@ -9,7 +9,8 @@ namespace urde { CScriptTargetingPoint::CScriptTargetingPoint(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, bool active) : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::NoStepLogic), - CActorParameters::None(), kInvalidUniqueId) {} + CActorParameters::None(), kInvalidUniqueId) +, xe8_e4_(false) {} void CScriptTargetingPoint::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptTargetingPoint.hpp b/Runtime/World/CScriptTargetingPoint.hpp index 672f7366e..0cbf6132e 100644 --- a/Runtime/World/CScriptTargetingPoint.hpp +++ b/Runtime/World/CScriptTargetingPoint.hpp @@ -8,12 +8,7 @@ namespace urde { class CScriptTargetingPoint : public CActor { private: - union { - struct { - bool xe8_e4_ : 1; - }; - u8 xe8_dummy = 0; - }; + bool xe8_e4_ : 1; TUniqueId xea_; float xec_time = 0.f; diff --git a/Runtime/World/CScriptTrigger.cpp b/Runtime/World/CScriptTrigger.cpp index 666c990ec..5c0dd3f12 100644 --- a/Runtime/World/CScriptTrigger.cpp +++ b/Runtime/World/CScriptTrigger.cpp @@ -20,13 +20,13 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti , x11c_forceField(forceField) , x128_forceMagnitude(forceField.magnitude()) , x12c_flags(triggerFlags) -, x130_bounds(bounds) { - x148_24_detectCamera = false; - x148_25_camSubmerged = false; - x148_26_deactivateOnEntered = deactivateOnEntered; - x148_27_deactivateOnExited = deactivateOnExited; - x148_28_playerTriggerProc = false; - x148_29_didPhazonDamage = false; +, x130_bounds(bounds) +, x148_24_detectCamera(false) +, x148_25_camSubmerged(false) +, x148_26_deactivateOnEntered(deactivateOnEntered) +, x148_27_deactivateOnExited(deactivateOnExited) +, x148_28_playerTriggerProc(false) +, x148_29_didPhazonDamage(false) { SetCallTouch(false); } diff --git a/Runtime/World/CScriptTrigger.hpp b/Runtime/World/CScriptTrigger.hpp index 038ab41f0..f399d6b28 100644 --- a/Runtime/World/CScriptTrigger.hpp +++ b/Runtime/World/CScriptTrigger.hpp @@ -54,18 +54,12 @@ protected: float x128_forceMagnitude; ETriggerFlags x12c_flags; zeus::CAABox x130_bounds; - - union { - struct { - bool x148_24_detectCamera : 1; - bool x148_25_camSubmerged : 1; - bool x148_26_deactivateOnEntered : 1; - bool x148_27_deactivateOnExited : 1; - bool x148_28_playerTriggerProc : 1; - bool x148_29_didPhazonDamage : 1; - }; - u8 dummy = 0; - }; + bool x148_24_detectCamera : 1; + bool x148_25_camSubmerged : 1; + bool x148_26_deactivateOnEntered : 1; + bool x148_27_deactivateOnExited : 1; + bool x148_28_playerTriggerProc : 1; + bool x148_29_didPhazonDamage : 1; public: CScriptTrigger(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos, diff --git a/Runtime/World/CScriptWater.cpp b/Runtime/World/CScriptWater.cpp index 92e1ba2d0..af24d5d80 100644 --- a/Runtime/World/CScriptWater.cpp +++ b/Runtime/World/CScriptWater.cpp @@ -61,14 +61,18 @@ CScriptWater::CScriptWater( , x2b4_alphaInRecip((alphaInTime != 0.f) ? 1.f / alphaInTime : 0.f) , x2b8_alphaOutRecip((alphaOutTime != 0.f) ? 1.f / alphaOutTime : 0.f) , x2bc_alpha(alpha) -, x2c0_tileSize(tileSize) { +, x2c0_tileSize(tileSize) +, x2e8_24_b4(b4) +, x2e8_25_morphIn(false) +, x2e8_26_morphing(false) +, x2e8_27_allowRender(allowRender) +, x2e8_28_recomputeClipping(true) +, x2e8_29_alphaIn(false) +, x2e8_30_alphaOut(false) { zeus::CAABox triggerAABB = GetTriggerBoundsWR(); x2c4_gridDimX = u32((x2c0_tileSize + triggerAABB.max.x() - triggerAABB.min.x() - 0.01f) / x2c0_tileSize); x2c8_gridDimY = u32((x2c0_tileSize + triggerAABB.max.y() - triggerAABB.min.y() - 0.01f) / x2c0_tileSize); x2cc_gridCellCount = (x2c4_gridDimX + 1) * (x2c8_gridDimY + 1); - x2e8_24_b4 = b4; - x2e8_27_allowRender = allowRender; - x2e8_28_recomputeClipping = true; uint32_t maxPatchSize; if (CGraphics::g_BooFactory->isTessellationSupported(maxPatchSize)) diff --git a/Runtime/World/CScriptWater.hpp b/Runtime/World/CScriptWater.hpp index 3751aef0a..0bbe7785e 100644 --- a/Runtime/World/CScriptWater.hpp +++ b/Runtime/World/CScriptWater.hpp @@ -66,18 +66,14 @@ class CScriptWater : public CScriptTrigger { std::unique_ptr x2dc_vertIntersects; std::unique_ptr x2e0_patchIntersects; // 0: all clear, 1: all intersect, 2: partial intersect int x2e4_computedGridCellCount = 0; - union { - struct { - bool x2e8_24_b4 : 1; - bool x2e8_25_morphIn : 1; - bool x2e8_26_morphing : 1; - bool x2e8_27_allowRender : 1; - bool x2e8_28_recomputeClipping : 1; - bool x2e8_29_alphaIn : 1; - bool x2e8_30_alphaOut : 1; - }; - u32 _dummy = 0; - }; + bool x2e8_24_b4 : 1; + bool x2e8_25_morphIn : 1; + bool x2e8_26_morphing : 1; + bool x2e8_27_allowRender : 1; + bool x2e8_28_recomputeClipping : 1; + bool x2e8_29_alphaIn : 1; + bool x2e8_30_alphaOut : 1; + void SetupGrid(bool recomputeClipping); void SetupGridClipping(CStateManager& mgr, int computeVerts); void UpdateSplashInhabitants(CStateManager& mgr); diff --git a/Runtime/World/CScriptWorldTeleporter.hpp b/Runtime/World/CScriptWorldTeleporter.hpp index f76a21763..dc66d9f63 100644 --- a/Runtime/World/CScriptWorldTeleporter.hpp +++ b/Runtime/World/CScriptWorldTeleporter.hpp @@ -16,15 +16,9 @@ class CScriptWorldTeleporter : public CEntity { CAssetId x34_worldId; CAssetId x38_areaId; ETeleporterType x3c_type = ETeleporterType::NoTransition; - union { - struct { - bool x40_24_upElevator : 1; - bool x40_25_inTransition : 1; - bool x40_27_fadeWhite : 1; - }; - u8 _dummy = 0; - }; - + bool x40_24_upElevator : 1; + bool x40_25_inTransition : 1; + bool x40_27_fadeWhite : 1; float x44_charFadeIn = 0.1f; float x48_charsPerSecond = 8.0f; float x4c_showDelay = 0.0f; diff --git a/Runtime/World/CStateMachine.hpp b/Runtime/World/CStateMachine.hpp index 0ddecca84..5de15655a 100644 --- a/Runtime/World/CStateMachine.hpp +++ b/Runtime/World/CStateMachine.hpp @@ -89,15 +89,10 @@ class CStateMachineState { float xc_random = 0.f; float x10_delay = 0.f; float x14_; - union { - struct { - bool x18_24_codeTrigger : 1; - }; - u32 dummy = 0; - }; + bool x18_24_codeTrigger : 1; public: - CStateMachineState() = default; + CStateMachineState() : x18_24_codeTrigger(false) {} CAiState* GetActorState() const { return x4_state; } diff --git a/Runtime/World/CWallCrawlerSwarm.cpp b/Runtime/World/CWallCrawlerSwarm.cpp index 57f9658bb..5faec5c3f 100644 --- a/Runtime/World/CWallCrawlerSwarm.cpp +++ b/Runtime/World/CWallCrawlerSwarm.cpp @@ -69,13 +69,13 @@ CWallCrawlerSwarm::CWallCrawlerSwarm(TUniqueId uid, bool active, std::string_vie , x548_numBoids(numBoids) , x54c_maxCreatedBoids(maxCreatedBoids) , x554_maxLaunches(maxLaunches) -, x558_flavor(flavor) { +, x558_flavor(flavor) +, x560_24_enableLighting(true) +, x560_25_useSoftwareLight(true) +, x560_26_modelAssetDirty(false) { x168_partitionedBoidLists.resize(125); x55c_launchSfx = CSfxManager::TranslateSFXID(launchSfx != -1 ? u16(launchSfx) : u16(0xffff)); x55e_scatterSfx = CSfxManager::TranslateSFXID(scatterSfx != -1 ? u16(scatterSfx) : u16(0xffff)); - x560_24_enableLighting = true; - x560_25_useSoftwareLight = true; - x560_26_modelAssetDirty = false; CAnimRes attractAnimRes(animRes); attractAnimRes.SetCanLoop(true); attractAnimRes.SetDefaultAnim(attractAnim != -1 ? attractAnim : 0); diff --git a/Runtime/World/CWallCrawlerSwarm.hpp b/Runtime/World/CWallCrawlerSwarm.hpp index a7c934f2a..8bc77ee5e 100644 --- a/Runtime/World/CWallCrawlerSwarm.hpp +++ b/Runtime/World/CWallCrawlerSwarm.hpp @@ -42,23 +42,23 @@ public: int x7c_framesNotOnSurface : 8; int x7c_idx : 10; int x7c_remainingLaunchNotOnSurfaceFrames : 8; - - union { - struct { - bool x80_24_active : 1; - bool x80_25_inFrustum : 1; - bool x80_26_launched : 1; - bool x80_27_scarabExplodeTimerEnabled : 1; - bool x80_28_nearPlayer : 1; - }; - u32 x80_ = 0; - }; + bool x80_24_active : 1; + bool x80_25_inFrustum : 1; + bool x80_26_launched : 1; + bool x80_27_scarabExplodeTimerEnabled : 1; + bool x80_28_nearPlayer : 1; public: - CBoid(const zeus::CTransform& xf, int idx) : x0_xf(xf) { - x7c_framesNotOnSurface = 0; - x7c_idx = idx; - } + CBoid(const zeus::CTransform& xf, int idx) + : x0_xf(xf) + , x7c_framesNotOnSurface(0) + , x7c_idx(idx) + , x80_24_active(false) + , x80_25_inFrustum(false) + , x80_26_launched(false) + , x80_27_scarabExplodeTimerEnabled(false) + , x80_28_nearPlayer(false) {} + zeus::CTransform& Transform() { return x0_xf; } zeus::CVector3f& Translation() { return x0_xf.origin; } const zeus::CTransform& GetTransform() const { return x0_xf; } diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index f2499f3ca..3566ac5d7 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -184,8 +184,13 @@ std::string CDummyWorld::IGetDefaultAudioTrack() const { return {}; } int CDummyWorld::IGetAreaCount() const { return x18_areas.size(); } CWorld::CWorld(IObjectStore& objStore, IFactory& resFactory, CAssetId mlvlId) -: x8_mlvlId(mlvlId), x60_objectStore(objStore), x64_resFactory(resFactory) { - x70_24_currentAreaNeedsAllocation = true; +: x8_mlvlId(mlvlId) +, x60_objectStore(objStore) +, x64_resFactory(resFactory) +, x70_24_currentAreaNeedsAllocation(true) +, x70_25_loadPaused(false) +, x70_26_skyboxActive(false) +, x70_27_skyboxVisible(false) { SObjectTag tag{FOURCC('MLVL'), mlvlId}; x44_bufSz = resFactory.ResourceSize(tag); x40_loadBuf.reset(new u8[x44_bufSz]); diff --git a/Runtime/World/CWorld.hpp b/Runtime/World/CWorld.hpp index 2b662179d..17e815ff4 100644 --- a/Runtime/World/CWorld.hpp +++ b/Runtime/World/CWorld.hpp @@ -130,16 +130,10 @@ private: IFactory& x64_resFactory; TAreaId x68_curAreaId = kInvalidAreaId; u32 x6c_loadedAudioGrpCount = 0; - - union { - struct { - bool x70_24_currentAreaNeedsAllocation : 1; - bool x70_25_loadPaused : 1; - bool x70_26_skyboxActive : 1; - bool x70_27_skyboxVisible : 1; - }; - u32 dummy = 0; - }; + bool x70_24_currentAreaNeedsAllocation : 1; + bool x70_25_loadPaused : 1; + bool x70_26_skyboxActive : 1; + bool x70_27_skyboxVisible : 1; std::vector x74_soundGroupData; std::string x84_defAudioTrack; std::optional> x94_skyboxWorld; diff --git a/Runtime/World/CWorldTransManager.hpp b/Runtime/World/CWorldTransManager.hpp index 978d0f447..92f09bed9 100644 --- a/Runtime/World/CWorldTransManager.hpp +++ b/Runtime/World/CWorldTransManager.hpp @@ -69,16 +69,11 @@ private: float x38_textStartTime = 0.f; float x3c_sfxInterval; bool x40_strIdx; - union { - struct { - bool x44_24_transFinished : 1; - bool x44_25_stopSoon : 1; - bool x44_26_goingUp : 1; - bool x44_27_fadeWhite : 1; - bool x44_28_textDirty : 1; - }; - u8 dummy = 0; - }; + bool x44_24_transFinished : 1; + bool x44_25_stopSoon : 1; + bool x44_26_goingUp : 1; + bool x44_27_fadeWhite : 1; + bool x44_28_textDirty : 1; CColoredQuadFilter m_fadeToBlack{EFilterType::Blend}; CTexturedQuadFilter m_dissolve{EFilterType::Blend, CGraphics::g_SpareTexture.get()}; @@ -101,7 +96,12 @@ private: void DrawText(); public: - CWorldTransManager() { x44_24_transFinished = true; } + CWorldTransManager() + : x44_24_transFinished(true) + , x44_25_stopSoon(false) + , x44_26_goingUp(false) + , x44_27_fadeWhite(false) + , x44_28_textDirty(false) {} void Update(float); void Draw();