diff --git a/Runtime/GuiSys/CRasterFont.cpp b/Runtime/GuiSys/CRasterFont.cpp index 4f2c5f894..0808b848f 100644 --- a/Runtime/GuiSys/CRasterFont.cpp +++ b/Runtime/GuiSys/CRasterFont.cpp @@ -97,8 +97,10 @@ void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, in if (opts.x0_direction == ETextDirection::Horizontal) { x += glyph->GetLeftPadding(); - if (prevGlyph != 0) + if (prevGlyph != nullptr) { x += KernLookup(x1c_kerning, prevGlyph->GetKernStart(), *chr); + } + int left = 0; int top = 0; diff --git a/Runtime/Particle/CFlameWarp.cpp b/Runtime/Particle/CFlameWarp.cpp index f87d44b76..9cf18a04e 100644 --- a/Runtime/Particle/CFlameWarp.cpp +++ b/Runtime/Particle/CFlameWarp.cpp @@ -5,8 +5,9 @@ namespace urde { void CFlameWarp::ModifyParticles(std::vector& particles) { - if (x9c_stateMgr == 0 || particles.size() < 9) + if (x9c_stateMgr == nullptr || particles.size() < 9) { return; + } std::vector> vec; vec.reserve(particles.size()); diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 1dbe59115..d13a0f51a 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -1785,36 +1785,35 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C void CPlayerGun::Update(float grappleSwingT, float cameraBobT, float dt, CStateManager& mgr) { CPlayer& player = mgr.GetPlayer(); CPlayerState& playerState = *mgr.GetPlayerState(); - bool isUnmorphed = player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed; + const bool isUnmorphed = player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed; - bool becameFrozen; - if (isUnmorphed) + bool becameFrozen = false; + if (isUnmorphed) { becameFrozen = !x834_29_frozen && player.GetFrozenState(); - else - becameFrozen = false; + } - bool becameThawed; - if (isUnmorphed) + bool becameThawed = false; + if (isUnmorphed) { becameThawed = x834_29_frozen && !player.GetFrozenState(); - else - becameThawed = false; + } x834_29_frozen = isUnmorphed && player.GetFrozenState(); - float advDt; - if (x834_29_frozen) + float advDt = dt; + if (x834_29_frozen) { advDt = 0.f; - else - advDt = dt; + } - bool r23 = x678_morph.GetGunState() != CGunMorph::EGunState::OutWipeDone; - if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay || r23) + const bool r23 = x678_morph.GetGunState() != CGunMorph::EGunState::OutWipeDone; + if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay || r23) { x6e0_rightHandModel.AdvanceAnimation(advDt, mgr, kInvalidAreaId, true); - if (r23 && x734_loadingBeam != 0 && x734_loadingBeam != x72c_currentBeam) { + } + if (r23 && x734_loadingBeam != nullptr && x734_loadingBeam != x72c_currentBeam) { x744_auxWeapon->LoadIdle(); x734_loadingBeam->Update(advDt, mgr); } - if (!x744_auxWeapon->IsLoaded()) + if (!x744_auxWeapon->IsLoaded()) { x744_auxWeapon->LoadIdle(); + } if (becameFrozen) { x72c_currentBeam->EnableSecondaryFx(CGunWeapon::ESecondaryFxType::None); diff --git a/Runtime/World/CMorphBall.hpp b/Runtime/World/CMorphBall.hpp index c0f7e8b90..bc52fcc17 100644 --- a/Runtime/World/CMorphBall.hpp +++ b/Runtime/World/CMorphBall.hpp @@ -233,7 +233,7 @@ public: void RenderMorphBallTransitionFlash(const CStateManager&) const; void UpdateIceBreakEffect(float dt); void RenderIceBreakEffect(const CStateManager& mgr) const; - bool IsMorphBallTransitionFlashValid() const { return x19dc_morphBallTransitionFlashGen != 0; } + bool IsMorphBallTransitionFlashValid() const { return x19dc_morphBallTransitionFlashGen != nullptr; } void RenderDamageEffects(const CStateManager& mgr, const zeus::CTransform& xf) const; void UpdateHalfPipeStatus(CStateManager& mgr, float dt); bool GetIsInHalfPipeMode() const { return x1df8_24_inHalfPipeMode; } diff --git a/Runtime/World/CSnakeWeedSwarm.hpp b/Runtime/World/CSnakeWeedSwarm.hpp index 1dcb9096d..def7ca182 100644 --- a/Runtime/World/CSnakeWeedSwarm.hpp +++ b/Runtime/World/CSnakeWeedSwarm.hpp @@ -80,7 +80,7 @@ private: u16 x1d0_sfx1; u16 x1d2_sfx2; u16 x1d4_sfx3; - CSfxHandle x1d8_sfxHandle = 0; + CSfxHandle x1d8_sfxHandle; TLockedToken x1dc_particleGenDesc; // TLockedToken x1e4_; both assign to x1dc_ std::unique_ptr x1ec_particleGen1; diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index c7670a387..a7acd5c9c 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -1013,15 +1013,18 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop } CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo")) - return 0; - std::string name = mgr.HashInstanceName(in); - CHUDMemoParms hParms(in); - CScriptHUDMemo::EDisplayType displayType = CScriptHUDMemo::EDisplayType::MessageBox; - if (propCount == 6) + if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo")) { + return nullptr; + } + + const std::string name = mgr.HashInstanceName(in); + const CHUDMemoParms hParms(in); + auto displayType = CScriptHUDMemo::EDisplayType::MessageBox; + if (propCount == 6) { displayType = CScriptHUDMemo::EDisplayType(in.readUint32Big()); - CAssetId message = in.readUint32Big(); - bool active = in.readBool(); + } + const CAssetId message = in.readUint32Big(); + const bool active = in.readBool(); return new CScriptHUDMemo(mgr.AllocateUniqueId(), name, info, hParms, displayType, message, active); }