From 690590ca03c4d1acc33e53faeaec1c0eea80fb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 26 Jul 2024 18:23:38 +0200 Subject: [PATCH] Remove unnecessary `m_StartAlpha` variable The `m_Color` variable already stores the initial alpha value and should not be modified, so the separate `m_StartAlpha` variable is unnecessary. --- src/game/client/components/damageind.cpp | 8 ++------ src/game/client/components/damageind.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/game/client/components/damageind.cpp b/src/game/client/components/damageind.cpp index 90664bbf0..0ce173f38 100644 --- a/src/game/client/components/damageind.cpp +++ b/src/game/client/components/damageind.cpp @@ -42,7 +42,6 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir, float Alpha) pItem->m_Dir = -Dir; pItem->m_StartAngle = -random_angle(); pItem->m_Color = ColorRGBA(1.0f, 1.0f, 1.0f, Alpha); - pItem->m_StartAlpha = Alpha; } } @@ -75,11 +74,8 @@ void CDamageInd::OnRender() else { vec2 Pos = mix(m_aItems[i].m_Pos + m_aItems[i].m_Dir * 75.0f, m_aItems[i].m_Pos, clamp((Life - 0.60f) / 0.15f, 0.0f, 1.0f)); - ColorRGBA Color = m_aItems[i].m_Color; - - float LifeAlpha = Life / 0.1f; - Color.a = m_aItems[i].m_StartAlpha * LifeAlpha; - Graphics()->SetColor(Color); + const float LifeAlpha = Life / 0.1f; + Graphics()->SetColor(m_aItems[i].m_Color.WithMultipliedAlpha(LifeAlpha)); Graphics()->QuadsSetRotation(m_aItems[i].m_StartAngle + Life * 2.0f); Graphics()->RenderQuadContainerAsSprite(m_DmgIndQuadContainerIndex, 0, Pos.x, Pos.y); i++; diff --git a/src/game/client/components/damageind.h b/src/game/client/components/damageind.h index bf35bc920..75c3eec66 100644 --- a/src/game/client/components/damageind.h +++ b/src/game/client/components/damageind.h @@ -15,7 +15,6 @@ class CDamageInd : public CComponent float m_StartTime; float m_StartAngle; ColorRGBA m_Color; - float m_StartAlpha; }; enum