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.
This commit is contained in:
Robert Müller 2024-07-26 18:23:38 +02:00
parent df0a9811d9
commit 690590ca03
2 changed files with 2 additions and 7 deletions

View file

@ -42,7 +42,6 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir, float Alpha)
pItem->m_Dir = -Dir; pItem->m_Dir = -Dir;
pItem->m_StartAngle = -random_angle(); pItem->m_StartAngle = -random_angle();
pItem->m_Color = ColorRGBA(1.0f, 1.0f, 1.0f, Alpha); pItem->m_Color = ColorRGBA(1.0f, 1.0f, 1.0f, Alpha);
pItem->m_StartAlpha = Alpha;
} }
} }
@ -75,11 +74,8 @@ void CDamageInd::OnRender()
else 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)); 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; const float LifeAlpha = Life / 0.1f;
Graphics()->SetColor(m_aItems[i].m_Color.WithMultipliedAlpha(LifeAlpha));
float LifeAlpha = Life / 0.1f;
Color.a = m_aItems[i].m_StartAlpha * LifeAlpha;
Graphics()->SetColor(Color);
Graphics()->QuadsSetRotation(m_aItems[i].m_StartAngle + Life * 2.0f); Graphics()->QuadsSetRotation(m_aItems[i].m_StartAngle + Life * 2.0f);
Graphics()->RenderQuadContainerAsSprite(m_DmgIndQuadContainerIndex, 0, Pos.x, Pos.y); Graphics()->RenderQuadContainerAsSprite(m_DmgIndQuadContainerIndex, 0, Pos.x, Pos.y);
i++; i++;

View file

@ -15,7 +15,6 @@ class CDamageInd : public CComponent
float m_StartTime; float m_StartTime;
float m_StartAngle; float m_StartAngle;
ColorRGBA m_Color; ColorRGBA m_Color;
float m_StartAlpha;
}; };
enum enum