From b9be092635301ae3f1ae82884c33cd0e11de5362 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 15 Mar 2020 21:38:25 -0400 Subject: [PATCH] CPauseScreenBlur: Remove const_cast in Draw() Draw() clearly modifies the internals of the class in a non-caching manner, so this member function should really not have a const qualifier on it. --- Runtime/MP1/CPauseScreenBlur.cpp | 19 +++++++++---------- Runtime/MP1/CPauseScreenBlur.hpp | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Runtime/MP1/CPauseScreenBlur.cpp b/Runtime/MP1/CPauseScreenBlur.cpp index c668f0db6..37dbacbef 100644 --- a/Runtime/MP1/CPauseScreenBlur.cpp +++ b/Runtime/MP1/CPauseScreenBlur.cpp @@ -84,21 +84,20 @@ void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool b) { } } -void CPauseScreenBlur::Draw(const CStateManager&) const { +void CPauseScreenBlur::Draw(const CStateManager&) { SCOPED_GRAPHICS_DEBUG_GROUP("CPauseScreenBlur::Draw", zeus::skPurple); - const_cast(x1c_camBlur).Draw(true); - float t = std::fabs(x18_blurAmt); + x1c_camBlur.Draw(true); + const float t = std::fabs(x18_blurAmt); if (x1c_camBlur.GetCurrType() != EBlurType::NoBlur) { - zeus::CColor filterColor = - zeus::CColor::lerp(zeus::skWhite, g_tweakGuiColors->GetPauseBlurFilterColor(), t); - const_cast(m_quarterFilter).DrawFilter(EFilterShape::FullscreenQuarters, filterColor, t); - zeus::CColor scanLinesColor = zeus::CColor::lerp(zeus::skWhite, zeus::CColor(0.75f, 1.f), t); - const_cast(m_linesFilter).draw(scanLinesColor); + const auto filterColor = zeus::CColor::lerp(zeus::skWhite, g_tweakGuiColors->GetPauseBlurFilterColor(), t); + m_quarterFilter.DrawFilter(EFilterShape::FullscreenQuarters, filterColor, t); + const auto scanLinesColor = zeus::CColor::lerp(zeus::skWhite, zeus::CColor(0.75f, 1.f), t); + m_linesFilter.draw(scanLinesColor); } if (x50_24_blurring /*&& x1c_camBlur.x2d_noPersistentCopy*/) { - const_cast(this)->x50_24_blurring = false; - const_cast(this)->x50_25_gameDraw = false; + x50_24_blurring = false; + x50_25_gameDraw = false; } } diff --git a/Runtime/MP1/CPauseScreenBlur.hpp b/Runtime/MP1/CPauseScreenBlur.hpp index 4debbd6f2..7ea1e5080 100644 --- a/Runtime/MP1/CPauseScreenBlur.hpp +++ b/Runtime/MP1/CPauseScreenBlur.hpp @@ -38,7 +38,7 @@ public: void OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr); bool IsGameDraw() const { return x50_25_gameDraw; } void Update(float dt, const CStateManager& stateMgr, bool); - void Draw(const CStateManager& stateMgr) const; + void Draw(const CStateManager& stateMgr); float GetBlurAmt() const { return std::fabs(x18_blurAmt); } bool IsNotTransitioning() const { return x10_prevState == x14_nextState; } };