Use OnReset function to reset damage indicators

The additional indirection with the `CEffects::ResetDamageIndicator` and `CDamageInd::Reset` functions to reset damage indicators is confusing and unnecessary. Always reset the damage indicators when disconnecting (in `OnReset`) instead of when entering the next game.
This commit is contained in:
Robert Müller 2024-07-26 18:13:35 +02:00
parent dac12c7afd
commit cd2a20f1f4
5 changed files with 2 additions and 9 deletions

View file

@ -105,7 +105,7 @@ void CDamageInd::OnInit()
Graphics()->QuadContainerUpload(m_DmgIndQuadContainerIndex); Graphics()->QuadContainerUpload(m_DmgIndQuadContainerIndex);
} }
void CDamageInd::Reset() void CDamageInd::OnReset()
{ {
for(int i = 0; i < m_NumItems;) for(int i = 0; i < m_NumItems;)
{ {

View file

@ -37,7 +37,7 @@ public:
virtual int Sizeof() const override { return sizeof(*this); } virtual int Sizeof() const override { return sizeof(*this); }
void Create(vec2 Pos, vec2 Dir, float Alpha); void Create(vec2 Pos, vec2 Dir, float Alpha);
void Reset(); virtual void OnReset() override;
virtual void OnRender() override; virtual void OnRender() override;
virtual void OnInit() override; virtual void OnInit() override;
}; };

View file

@ -53,11 +53,6 @@ void CEffects::DamageIndicator(vec2 Pos, vec2 Dir, float Alpha)
m_pClient->m_DamageInd.Create(Pos, Dir, Alpha); m_pClient->m_DamageInd.Create(Pos, Dir, Alpha);
} }
void CEffects::ResetDamageIndicator()
{
m_pClient->m_DamageInd.Reset();
}
void CEffects::PowerupShine(vec2 Pos, vec2 Size, float Alpha) void CEffects::PowerupShine(vec2 Pos, vec2 Size, float Alpha)
{ {
if(!m_Add50hz) if(!m_Add50hz)

View file

@ -26,7 +26,6 @@ public:
void HammerHit(vec2 Pos, float Alpha = 1.0f); void HammerHit(vec2 Pos, float Alpha = 1.0f);
void AirJump(vec2 Pos, float Alpha = 1.0f); void AirJump(vec2 Pos, float Alpha = 1.0f);
void DamageIndicator(vec2 Pos, vec2 Dir, float Alpha = 1.0f); void DamageIndicator(vec2 Pos, vec2 Dir, float Alpha = 1.0f);
void ResetDamageIndicator();
void PlayerSpawn(vec2 Pos, float Alpha = 1.0f); void PlayerSpawn(vec2 Pos, float Alpha = 1.0f);
void PlayerDeath(vec2 Pos, int ClientId, float Alpha = 1.0f); void PlayerDeath(vec2 Pos, int ClientId, float Alpha = 1.0f);
void PowerupShine(vec2 Pos, vec2 Size, float Alpha = 1.0f); void PowerupShine(vec2 Pos, vec2 Size, float Alpha = 1.0f);

View file

@ -1010,7 +1010,6 @@ void CGameClient::OnShutdown()
void CGameClient::OnEnterGame() void CGameClient::OnEnterGame()
{ {
m_Effects.ResetDamageIndicator();
} }
void CGameClient::OnGameOver() void CGameClient::OnGameOver()