From 22880abb7e706558aa76187a38483998709b9ee4 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 11 Apr 2020 00:49:02 -0400 Subject: [PATCH] Runtime/Weapon: Replace bitfield unions with constructor initializers --- Runtime/Weapon/CBurstFire.cpp | 3 +- Runtime/Weapon/CBurstFire.hpp | 9 +-- Runtime/Weapon/CEnergyProjectile.cpp | 12 ++-- Runtime/Weapon/CEnergyProjectile.hpp | 13 ++--- Runtime/Weapon/CFlameThrower.cpp | 6 +- Runtime/Weapon/CFlameThrower.hpp | 14 ++--- Runtime/Weapon/CGSComboFire.hpp | 12 ++-- Runtime/Weapon/CGameProjectile.cpp | 21 +++---- Runtime/Weapon/CGameProjectile.hpp | 19 +++---- Runtime/Weapon/CGrappleArm.cpp | 8 ++- Runtime/Weapon/CGrappleArm.hpp | 17 ++---- Runtime/Weapon/CGunWeapon.cpp | 8 ++- Runtime/Weapon/CGunWeapon.hpp | 19 +++---- Runtime/Weapon/CPlasmaProjectile.cpp | 14 +++-- Runtime/Weapon/CPlasmaProjectile.hpp | 17 ++---- Runtime/Weapon/CPlayerGun.cpp | 37 ++++++++++-- Runtime/Weapon/CPlayerGun.hpp | 84 +++++++++++++--------------- Runtime/Weapon/CProjectileWeapon.cpp | 11 +++- Runtime/Weapon/CProjectileWeapon.hpp | 21 +++---- 19 files changed, 174 insertions(+), 171 deletions(-) diff --git a/Runtime/Weapon/CBurstFire.cpp b/Runtime/Weapon/CBurstFire.cpp index fe5af34e8..4d0cc7334 100644 --- a/Runtime/Weapon/CBurstFire.cpp +++ b/Runtime/Weapon/CBurstFire.cpp @@ -9,7 +9,8 @@ #include namespace urde { -CBurstFire::CBurstFire(const SBurst* const* burstDefs, s32 firstBurstCount) : x10_firstBurstCounter(firstBurstCount) { +CBurstFire::CBurstFire(const SBurst* const* burstDefs, s32 firstBurstCount) +: x10_firstBurstCounter(firstBurstCount), x14_24_shouldFire(false), x14_25_avoidAccuracy(false) { while (*burstDefs) { x1c_burstDefs.push_back(*burstDefs); ++burstDefs; diff --git a/Runtime/Weapon/CBurstFire.hpp b/Runtime/Weapon/CBurstFire.hpp index a46bed4fd..3ed99890a 100644 --- a/Runtime/Weapon/CBurstFire.hpp +++ b/Runtime/Weapon/CBurstFire.hpp @@ -23,13 +23,8 @@ class CBurstFire { float x8_timeToNextShot = 0.f; s32 xc_firstBurstIdx = 0; s32 x10_firstBurstCounter; - union { - struct { - bool x14_24_shouldFire : 1; - bool x14_25_avoidAccuracy : 1; - }; - u32 _dummy = 0; - }; + bool x14_24_shouldFire : 1; + bool x14_25_avoidAccuracy : 1; const SBurst* x18_curBursts = nullptr; rstl::reserved_vector x1c_burstDefs; diff --git a/Runtime/Weapon/CEnergyProjectile.cpp b/Runtime/Weapon/CEnergyProjectile.cpp index cfc6e12d0..bd0c83d8f 100644 --- a/Runtime/Weapon/CEnergyProjectile.cpp +++ b/Runtime/Weapon/CEnergyProjectile.cpp @@ -20,13 +20,17 @@ CEnergyProjectile::CEnergyProjectile(bool active, const TToken>& visorParticle, - u16 visorSfx, bool sendCollideMsg) + const std::optional>& visorParticle, u16 visorSfx, + bool sendCollideMsg) : CGameProjectile(active, desc, "GameProjectile", type, xf, excludeMat, damage, uid, aid, owner, homingTarget, attribs, underwater, scale, visorParticle, visorSfx, sendCollideMsg) -, x2ec_dir(xf.basis[1]) +, x2ec_dir(xf.frontVector()) , x2f8_mag(x2ec_dir.magnitude()) -, x2fc_camShake(CCameraShakeData::BuildProjectileCameraShake(0.5f, 0.75f)) { +, x2fc_camShake(CCameraShakeData::BuildProjectileCameraShake(0.5f, 0.75f)) +, x3d0_24_dead(false) +, x3d0_25_(false) +, x3d0_26_(false) +, x3d0_27_camShakeDirty(false) { xe6_27_thermalVisorFlags = 2; } diff --git a/Runtime/Weapon/CEnergyProjectile.hpp b/Runtime/Weapon/CEnergyProjectile.hpp index 6156e0e0f..0413f086a 100644 --- a/Runtime/Weapon/CEnergyProjectile.hpp +++ b/Runtime/Weapon/CEnergyProjectile.hpp @@ -10,15 +10,10 @@ class CEnergyProjectile : public CGameProjectile { zeus::CVector3f x2ec_dir; float x2f8_mag; CCameraShakeData x2fc_camShake; - union { - struct { - bool x3d0_24_dead : 1; - bool x3d0_25_ : 1; - bool x3d0_26_ : 1; - bool x3d0_27_camShakeDirty : 1; - }; - u32 _dummy = 0; - }; + bool x3d0_24_dead : 1; + bool x3d0_25_ : 1; + bool x3d0_26_ : 1; + bool x3d0_27_camShakeDirty : 1; float x3d4_curTime = 0.f; void StopProjectile(CStateManager& mgr); diff --git a/Runtime/Weapon/CFlameThrower.cpp b/Runtime/Weapon/CFlameThrower.cpp index 154c80e31..14d8b799a 100644 --- a/Runtime/Weapon/CFlameThrower.cpp +++ b/Runtime/Weapon/CFlameThrower.cpp @@ -33,10 +33,8 @@ CFlameThrower::CFlameThrower(const TToken& wDesc, std::strin , x3fc_playerIceTxtr(playerIceTxtr) , x400_24_active(false) , x400_25_particlesActive(false) -, x400_26_(!(flameInfo.GetAttributes() & 1)) -, x400_27_coneCollision((flameInfo.GetAttributes() & 0x2) != 0) { - -} +, x400_26_((flameInfo.GetAttributes() & 1) == 0) +, x400_27_coneCollision((flameInfo.GetAttributes() & 0x2) != 0) {} void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/Weapon/CFlameThrower.hpp b/Runtime/Weapon/CFlameThrower.hpp index 423f8e7d4..2b824cc40 100644 --- a/Runtime/Weapon/CFlameThrower.hpp +++ b/Runtime/Weapon/CFlameThrower.hpp @@ -31,16 +31,10 @@ private: CAssetId x3f4_playerSteamTxtr; s16 x3f8_playerHitSfx; CAssetId x3fc_playerIceTxtr; - - union { - struct { - bool x400_24_active : 1; - bool x400_25_particlesActive : 1; - bool x400_26_ : 1; - bool x400_27_coneCollision : 1; /* Z-sort and finer collision detection */ - }; - u32 _dummy = 0; - }; + bool x400_24_active : 1; + bool x400_25_particlesActive : 1; + bool x400_26_ : 1; + bool x400_27_coneCollision : 1; /* Z-sort and finer collision detection */ void CreateFlameParticles(CStateManager&); void SetFlameLightActive(CStateManager&, bool); diff --git a/Runtime/Weapon/CGSComboFire.hpp b/Runtime/Weapon/CGSComboFire.hpp index bdac15732..2c789475d 100644 --- a/Runtime/Weapon/CGSComboFire.hpp +++ b/Runtime/Weapon/CGSComboFire.hpp @@ -11,16 +11,12 @@ class CGSComboFire { s32 x4_loopState = -1; // In, loop, out s32 x8_cueAnimId = -1; s32 xc_gunId = -1; - - union { - struct { - bool x10_24_over : 1; - bool x10_25_idle : 1; - }; - u8 _dummy = 0; - }; + bool x10_24_over : 1; + bool x10_25_idle : 1; public: + CGSComboFire() : x10_24_over(false), x10_25_idle(false) {} + bool IsComboOver() const { return x10_24_over; } s32 GetLoopState() const { return x4_loopState; } void SetLoopState(s32 l) { x4_loopState = l; } diff --git a/Runtime/Weapon/CGameProjectile.cpp b/Runtime/Weapon/CGameProjectile.cpp index 312c3cb32..83dc6a2ac 100644 --- a/Runtime/Weapon/CGameProjectile.cpp +++ b/Runtime/Weapon/CGameProjectile.cpp @@ -1,5 +1,7 @@ #include "Runtime/Weapon/CGameProjectile.hpp" +#include + #include "Runtime/CStateManager.hpp" #include "Runtime/Collision/CCollisionActor.hpp" #include "Runtime/Collision/CInternalRayCastStructure.hpp" @@ -19,15 +21,15 @@ CGameProjectile::CGameProjectile(bool active, const TToken& const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, TUniqueId homingTarget, EProjectileAttrib attribs, bool underwater, const zeus::CVector3f& scale, - const std::optional>& visorParticle, - u16 visorSfx, bool sendCollideMsg) + std::optional> visorParticle, u16 visorSfx, + bool sendCollideMsg) : CWeapon(uid, aid, active, owner, wType, name, xf, CMaterialFilter::MakeIncludeExclude( {EMaterialTypes::Solid, EMaterialTypes::NonSolidDamageable}, {EMaterialTypes::Projectile, EMaterialTypes::ProjectilePassthrough, excludeMat}), CMaterialList(EMaterialTypes::Projectile), dInfo, attribs | GetBeamAttribType(wType), CModelData::CModelDataNull()) -, x158_visorParticle(visorParticle) +, x158_visorParticle(std::move(visorParticle)) , x168_visorSfx(visorSfx) , x170_projectile(wDesc, xf.origin, xf.basis, scale, (attribs & EProjectileAttrib::ParticleOPTS) == EProjectileAttrib::ParticleOPTS) @@ -35,13 +37,12 @@ CGameProjectile::CGameProjectile(bool active, const TToken& , x2a4_projExtent((xe8_projectileAttribs & EProjectileAttrib::BigProjectile) == EProjectileAttrib::BigProjectile ? 0.25f : 0.1f) , x2c0_homingTargetId(homingTarget) -, x2cc_wpscId(wDesc.GetObjectTag()->id) { - x2e4_24_active = true; - x2e4_25_startedUnderwater = underwater; - x2e4_26_waterUpdate = underwater; - x2e4_27_inWater = underwater; - x2e4_28_sendProjectileCollideMsg = sendCollideMsg; -} +, x2cc_wpscId(wDesc.GetObjectTag()->id) +, x2e4_24_active(true) +, x2e4_25_startedUnderwater(underwater) +, x2e4_26_waterUpdate(underwater) +, x2e4_27_inWater(underwater) +, x2e4_28_sendProjectileCollideMsg(sendCollideMsg) {} void CGameProjectile::Accept(urde::IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/Weapon/CGameProjectile.hpp b/Runtime/Weapon/CGameProjectile.hpp index c3ea5e75d..06748ee5a 100644 --- a/Runtime/Weapon/CGameProjectile.hpp +++ b/Runtime/Weapon/CGameProjectile.hpp @@ -49,23 +49,18 @@ protected: CAssetId x2cc_wpscId; std::vector x2d0_touchResults; float x2e0_minHomingDist = 0.f; - union { - struct { - bool x2e4_24_active : 1; - bool x2e4_25_startedUnderwater : 1; - bool x2e4_26_waterUpdate : 1; - bool x2e4_27_inWater : 1; - bool x2e4_28_sendProjectileCollideMsg : 1; - }; - }; + bool x2e4_24_active : 1; + bool x2e4_25_startedUnderwater : 1; + bool x2e4_26_waterUpdate : 1; + bool x2e4_27_inWater : 1; + bool x2e4_28_sendProjectileCollideMsg : 1; public: CGameProjectile(bool active, const TToken&, std::string_view name, EWeaponType wType, const zeus::CTransform& xf, EMaterialTypes excludeMat, const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, TUniqueId homingTarget, EProjectileAttrib attribs, bool underwater, - const zeus::CVector3f& scale, - const std::optional>& visorParticle, u16 visorSfx, - bool sendCollideMsg); + const zeus::CVector3f& scale, std::optional> visorParticle, + u16 visorSfx, bool sendCollideMsg); void Accept(IVisitor& visitor) override; virtual void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr); diff --git a/Runtime/Weapon/CGrappleArm.cpp b/Runtime/Weapon/CGrappleArm.cpp index 9f6985968..2f1d90efa 100644 --- a/Runtime/Weapon/CGrappleArm.cpp +++ b/Runtime/Weapon/CGrappleArm.cpp @@ -37,7 +37,13 @@ CGrappleArm::CGrappleArm(const zeus::CVector3f& scale) , x398_grappleHitGen(std::make_unique(x36c_grappleHitDesc)) , x39c_grappleMuzzleGen(std::make_unique(x378_grappleMuzzleDesc)) , x3a0_grappleSwooshGen(std::make_unique(x384_grappleSwooshDesc, 0)) -, x3a4_rainSplashGenerator(std::make_unique(scale, 20, 2, 0.f, 0.125f)) { +, x3a4_rainSplashGenerator(std::make_unique(scale, 20, 2, 0.f, 0.125f)) +, x3b2_24_active(false) +, x3b2_25_beamActive(false) +, x3b2_26_grappleHit(false) +, x3b2_27_armMoving(false) +, x3b2_28_isGrappling(false) +, x3b2_29_suitLoading(false) { x0_grappleArmModel->SetSortThermal(true); xa0_grappleGearModel.SetSortThermal(true); xec_grapNoz1Model.SetSortThermal(true); diff --git a/Runtime/Weapon/CGrappleArm.hpp b/Runtime/Weapon/CGrappleArm.hpp index 87873faf5..f3192ee14 100644 --- a/Runtime/Weapon/CGrappleArm.hpp +++ b/Runtime/Weapon/CGrappleArm.hpp @@ -75,17 +75,12 @@ private: CPlayerState::EPlayerSuit x3a8_loadedSuit = CPlayerState::EPlayerSuit::Invalid; float x3ac_pitchBend = 0.f; s16 x3b0_rumbleHandle = -1; - union { - struct { - bool x3b2_24_active : 1; - bool x3b2_25_beamActive : 1; - bool x3b2_26_grappleHit : 1; - bool x3b2_27_armMoving : 1; - bool x3b2_28_isGrappling : 1; - bool x3b2_29_suitLoading : 1; - }; - u32 _dummy = 0; - }; + bool x3b2_24_active : 1; + bool x3b2_25_beamActive : 1; + bool x3b2_26_grappleHit : 1; + bool x3b2_27_armMoving : 1; + bool x3b2_28_isGrappling : 1; + bool x3b2_29_suitLoading : 1; static float g_GrappleBeamAnglePhaseDelta; static float g_GrappleBeamXWaveAmplitude; diff --git a/Runtime/Weapon/CGunWeapon.cpp b/Runtime/Weapon/CGunWeapon.cpp index 5ff1215c1..803d3afb6 100644 --- a/Runtime/Weapon/CGunWeapon.cpp +++ b/Runtime/Weapon/CGunWeapon.cpp @@ -70,7 +70,13 @@ CGunWeapon::CGunWeapon(CAssetId ancsId, EWeaponType type, TUniqueId playerId, EM , x1c8_playerMaterial(playerMaterial) , x200_beamId(GetWeaponIndex(type)) , x20c_shaderIdx(u32(x200_beamId)) -, x214_ancsId(ancsId) { +, x214_ancsId(ancsId) +, x218_24(false) +, x218_25_enableCharge(false) +, x218_26_loaded(false) +, x218_27_subtypeBasePose(false) +, x218_28_suitArmLocked(false) +, x218_29_drawHologram(false) { AllocResPools(x200_beamId); BuildDependencyList(x200_beamId); } diff --git a/Runtime/Weapon/CGunWeapon.hpp b/Runtime/Weapon/CGunWeapon.hpp index 30328d686..a4d099cde 100644 --- a/Runtime/Weapon/CGunWeapon.hpp +++ b/Runtime/Weapon/CGunWeapon.hpp @@ -84,18 +84,13 @@ protected: // 0x1: load request, 0x2: muzzle fx, 0x4: projectile data, 0x8: anims, 0x10: everything else u32 x210_loadFlags = 0; CAssetId x214_ancsId; - union { - struct { - bool x218_24 : 1; - bool x218_25_enableCharge : 1; - bool x218_26_loaded : 1; - // Initialize in selected beam's pose, rather than power beam's pose - bool x218_27_subtypeBasePose : 1; - bool x218_28_suitArmLocked : 1; - bool x218_29_drawHologram : 1; - }; - u32 _dummy = 0; - }; + bool x218_24 : 1; + bool x218_25_enableCharge : 1; + bool x218_26_loaded : 1; + // Initialize in selected beam's pose, rather than power beam's pose + bool x218_27_subtypeBasePose : 1; + bool x218_28_suitArmLocked : 1; + bool x218_29_drawHologram : 1; void AllocResPools(CPlayerState::EBeamId beam); void FreeResPools(); diff --git a/Runtime/Weapon/CPlasmaProjectile.cpp b/Runtime/Weapon/CPlasmaProjectile.cpp index fd999d5bd..dfb559bec 100644 --- a/Runtime/Weapon/CPlasmaProjectile.cpp +++ b/Runtime/Weapon/CPlasmaProjectile.cpp @@ -29,8 +29,8 @@ CPlasmaProjectile::CPlasmaProjectile(const TToken& wDesc, st const CBeamInfo& bInfo, const zeus::CTransform& xf, EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, const PlayerEffectResoures& res, bool growingBeam, EProjectileAttrib attribs) -: CBeamProjectile(wDesc, name, wType, xf, bInfo.GetLength(), bInfo.GetRadius(), bInfo.GetTravelSpeed(), matType, - dInfo, uid, aid, owner, attribs, growingBeam) +: CBeamProjectile(wDesc, name, wType, xf, bInfo.GetLength(), bInfo.GetRadius(), bInfo.GetTravelSpeed(), matType, dInfo, + uid, aid, owner, attribs, growingBeam) , x478_beamAttributes(bInfo.GetBeamAttributes()) , x47c_lifeTime(bInfo.GetLifeTime()) , x480_pulseSpeed(bInfo.GetPulseSpeed()) @@ -38,7 +38,13 @@ CPlasmaProjectile::CPlasmaProjectile(const TToken& wDesc, st , x488_expansionSpeed(bInfo.GetExpansionSpeed()) , x48c_(bInfo.GetLength() / 32.f) , x490_innerColor(bInfo.GetInnerColor()) -, x494_outerColor(bInfo.GetOuterColor()) { +, x494_outerColor(bInfo.GetOuterColor()) +, x548_24_(false) +, x548_25_enableEnergyPulse(true) +, x548_26_firing(false) +, x548_27_texturesLoaded(false) +, x548_28_drawOwnerFirst(growingBeam) +, x548_29_activePlayerPhazon(false) { x4e8_texture = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), bInfo.GetTextureId()}); x4f4_glowTexture = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), bInfo.GetGlowTextureId()}); x500_contactFxDesc = g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), bInfo.GetContactFxId()}); @@ -53,8 +59,6 @@ CPlasmaProjectile::CPlasmaProjectile(const TToken& wDesc, st x538_visorParticle = g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), res[3]}); x544_freezeSfx = CSfxManager::TranslateSFXID(res[4]); x546_electricSfx = CSfxManager::TranslateSFXID(res[5]); - x548_25_enableEnergyPulse = true; - x548_28_drawOwnerFirst = growingBeam; x518_contactGen->SetGlobalScale(zeus::CVector3f(bInfo.GetContactFxScale())); x51c_pulseGen->SetGlobalScale(zeus::CVector3f(bInfo.GetPulseFxScale())); x518_contactGen->SetParticleEmission(false); diff --git a/Runtime/Weapon/CPlasmaProjectile.hpp b/Runtime/Weapon/CPlasmaProjectile.hpp index 6634ca849..a0a0747ee 100644 --- a/Runtime/Weapon/CPlasmaProjectile.hpp +++ b/Runtime/Weapon/CPlasmaProjectile.hpp @@ -67,17 +67,12 @@ private: TToken x538_visorParticle; // Used to be optional u16 x544_freezeSfx; u16 x546_electricSfx; - union { - struct { - bool x548_24_ : 1; - bool x548_25_enableEnergyPulse : 1; - bool x548_26_firing : 1; - bool x548_27_texturesLoaded : 1; - bool x548_28_drawOwnerFirst : 1; - bool x548_29_activePlayerPhazon : 1; - }; - u32 _dummy3 = 0; - }; + bool x548_24_ : 1; + bool x548_25_enableEnergyPulse : 1; + bool x548_26_firing : 1; + bool x548_27_texturesLoaded : 1; + bool x548_28_drawOwnerFirst : 1; + bool x548_29_activePlayerPhazon : 1; struct RenderObjects { CColoredStripShader m_beamStrip1; diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 8a279abc3..b0159965d 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -131,7 +131,39 @@ CPlayerGun::CPlayerGun(TUniqueId playerId) , x678_morph(g_tweakPlayerGun->GetGunTransformTime(), g_tweakPlayerGun->GetHoloHoldTime()) , x6c8_hologramClipCube(zeus::CVector3f(-0.29329199f, 0.f, -0.2481945f), zeus::CVector3f(0.29329199f, 1.292392f, 0.2481945f)) -, x6e0_rightHandModel(CAnimRes(g_tweakGunRes->xc_rightHand, 0, zeus::CVector3f(3.f), 0, true)) { +, x6e0_rightHandModel(CAnimRes(g_tweakGunRes->xc_rightHand, 0, zeus::CVector3f(3.f), 0, true)) +, x832_24_coolingCharge(false) +, x832_25_chargeEffectVisible(false) +, x832_26_comboFiring(false) +, x832_27_chargeAnimStarted(false) +, x832_28_readyForShot(false) +, x832_29_lockedOn(false) +, x832_30_requestReturnToDefault(false) +, x832_31_inRestPose(true) +, x833_24_notFidgeting(true) +, x833_25_(false) +, x833_26_(false) +, x833_27_(false) +, x833_28_phazonBeamActive(false) +, x833_29_pointBlankWorldSurface(false) +, x833_30_canShowAuxMuzzleEffect(true) +, x833_31_inFreeLook(false) +, x834_24_charging(false) +, x834_25_gunMotionFidgeting(false) +, x834_26_animPlaying(false) +, x834_27_underwater(false) +, x834_28_requestImmediateRecharge(false) +, x834_29_frozen(false) +, x834_30_inBigStrike(false) +, x834_31_gunMotionInFidgetBasePosition(false) +, x835_24_canFirePhazon(false) +, x835_25_inPhazonBeam(false) +, x835_26_phazonBeamMorphing(false) +, x835_27_intoPhazonBeam(false) +, x835_28_bombReady(false) +, x835_29_powerBombReady(false) +, x835_30_inPhazonPool(false) +, x835_31_actorAttached(false) { x354_bombFuseTime = g_tweakPlayerGun->GetBombFuseTime(); x358_bombDropDelayTime = g_tweakPlayerGun->GetBombDropDelayTime(); x668_aimVerticalSpeed = g_tweakPlayerGun->GetAimVerticalSpeed(); @@ -155,9 +187,6 @@ CPlayerGun::CPlayerGun(TUniqueId playerId) g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->x24_holoTransition})); x82c_shadow = std::make_unique(256, 256, true); - x832_31_inRestPose = true; - x833_24_notFidgeting = true; - x833_30_canShowAuxMuzzleEffect = true; x6e0_rightHandModel.SetSortThermal(true); kVerticalAngleTable[2] = g_tweakPlayerGun->GetUpLookAngle(); diff --git a/Runtime/Weapon/CPlayerGun.hpp b/Runtime/Weapon/CPlayerGun.hpp index 8140fbb99..fb88549cb 100644 --- a/Runtime/Weapon/CPlayerGun.hpp +++ b/Runtime/Weapon/CPlayerGun.hpp @@ -82,18 +82,15 @@ private: float x18_transitionFactor = 1.f; EDir x1c_dir = EDir::Done; EGunState x20_gunState = EGunState::OutWipeDone; - - union { - struct { - bool x24_24_morphing : 1; - bool x24_25_weaponChanged : 1; - }; - u32 _dummy = 0; - }; + bool x24_24_morphing : 1; + bool x24_25_weaponChanged : 1; public: CGunMorph(float gunTransformTime, float holoHoldTime) - : x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(std::fabs(holoHoldTime)) {} + : x4_gunTransformTime(gunTransformTime) + , x10_holoHoldTime(std::fabs(holoHoldTime)) + , x24_24_morphing(false) + , x24_25_weaponChanged(false) {} float GetYLerp() const { return x0_yLerp; } float GetTransitionFactor() const { return x18_transitionFactor; } EGunState GetGunState() const { return x20_gunState; } @@ -225,46 +222,41 @@ private: std::unique_ptr x82c_shadow; s16 x830_chargeRumbleHandle = -1; - union { - struct { - bool x832_24_coolingCharge : 1; - bool x832_25_chargeEffectVisible : 1; - bool x832_26_comboFiring : 1; - bool x832_27_chargeAnimStarted : 1; - bool x832_28_readyForShot : 1; - bool x832_29_lockedOn : 1; - bool x832_30_requestReturnToDefault : 1; - bool x832_31_inRestPose : 1; + bool x832_24_coolingCharge : 1; + bool x832_25_chargeEffectVisible : 1; + bool x832_26_comboFiring : 1; + bool x832_27_chargeAnimStarted : 1; + bool x832_28_readyForShot : 1; + bool x832_29_lockedOn : 1; + bool x832_30_requestReturnToDefault : 1; + bool x832_31_inRestPose : 1; - bool x833_24_notFidgeting : 1; - bool x833_25_ : 1; - bool x833_26_ : 1; - bool x833_27_ : 1; - bool x833_28_phazonBeamActive : 1; - bool x833_29_pointBlankWorldSurface : 1; - bool x833_30_canShowAuxMuzzleEffect : 1; - bool x833_31_inFreeLook : 1; + bool x833_24_notFidgeting : 1; + bool x833_25_ : 1; + bool x833_26_ : 1; + bool x833_27_ : 1; + bool x833_28_phazonBeamActive : 1; + bool x833_29_pointBlankWorldSurface : 1; + bool x833_30_canShowAuxMuzzleEffect : 1; + bool x833_31_inFreeLook : 1; - bool x834_24_charging : 1; - bool x834_25_gunMotionFidgeting : 1; - bool x834_26_animPlaying : 1; - bool x834_27_underwater : 1; - bool x834_28_requestImmediateRecharge : 1; - bool x834_29_frozen : 1; - bool x834_30_inBigStrike : 1; - bool x834_31_gunMotionInFidgetBasePosition : 1; + bool x834_24_charging : 1; + bool x834_25_gunMotionFidgeting : 1; + bool x834_26_animPlaying : 1; + bool x834_27_underwater : 1; + bool x834_28_requestImmediateRecharge : 1; + bool x834_29_frozen : 1; + bool x834_30_inBigStrike : 1; + bool x834_31_gunMotionInFidgetBasePosition : 1; - bool x835_24_canFirePhazon : 1; - bool x835_25_inPhazonBeam : 1; - bool x835_26_phazonBeamMorphing : 1; - bool x835_27_intoPhazonBeam : 1; - bool x835_28_bombReady : 1; - bool x835_29_powerBombReady : 1; - bool x835_30_inPhazonPool : 1; - bool x835_31_actorAttached : 1; - }; - u32 _dummy = 0; - }; + bool x835_24_canFirePhazon : 1; + bool x835_25_inPhazonBeam : 1; + bool x835_26_phazonBeamMorphing : 1; + bool x835_27_intoPhazonBeam : 1; + bool x835_28_bombReady : 1; + bool x835_29_powerBombReady : 1; + bool x835_30_inPhazonPool : 1; + bool x835_31_actorAttached : 1; CTexturedQuadFilter m_screenQuad{EFilterType::Blend, CGraphics::g_SpareTexture.get(), CTexturedQuadFilter::ZTest::GEqualZWrite}; diff --git a/Runtime/Weapon/CProjectileWeapon.cpp b/Runtime/Weapon/CProjectileWeapon.cpp index f3b816c04..f73090744 100644 --- a/Runtime/Weapon/CProjectileWeapon.cpp +++ b/Runtime/Weapon/CProjectileWeapon.cpp @@ -15,8 +15,15 @@ CProjectileWeapon::CProjectileWeapon(const TToken& wDesc, co , x10_random(g_GlobalSeed) , x14_localToWorldXf(localToWorld) , x74_worldOffset(worldOffset) -, xe4_flags(flags) { - x124_24_active = true; +, xe4_flags(flags) +, x124_24_active(true) +, x124_25_APSO(false) +, x124_26_AP11(false) +, x124_27_AP21(false) +, x124_28_AS11(false) +, x124_29_AS12(false) +, x124_30_AS13(false) +, x124_31_VMD2(false) { CGlobalRandom gr(x10_random); x124_31_VMD2 = x4_weaponDesc->x10_VMD2; x124_25_APSO = x4_weaponDesc->x28_APSO; diff --git a/Runtime/Weapon/CProjectileWeapon.hpp b/Runtime/Weapon/CProjectileWeapon.hpp index 1b83e1816..6ff083fde 100644 --- a/Runtime/Weapon/CProjectileWeapon.hpp +++ b/Runtime/Weapon/CProjectileWeapon.hpp @@ -53,19 +53,14 @@ class CProjectileWeapon { std::unique_ptr x118_swoosh1; std::unique_ptr x11c_swoosh2; std::unique_ptr x120_swoosh3; - union { - struct { - bool x124_24_active : 1; - bool x124_25_APSO : 1; - bool x124_26_AP11 : 1; - bool x124_27_AP21 : 1; - bool x124_28_AS11 : 1; - bool x124_29_AS12 : 1; - bool x124_30_AS13 : 1; - bool x124_31_VMD2 : 1; - }; - u32 _dummy = 0; - }; + bool x124_24_active : 1; + bool x124_25_APSO : 1; + bool x124_26_AP11 : 1; + bool x124_27_AP21 : 1; + bool x124_28_AS11 : 1; + bool x124_29_AS12 : 1; + bool x124_30_AS13 : 1; + bool x124_31_VMD2 : 1; public: CProjectileWeapon(const TToken& wDesc, const zeus::CVector3f& worldOffset,