From 7ebaf1b9ad91ea0bc8405ceff4553eda5fd3c61f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 9 Nov 2024 10:56:06 +0100 Subject: [PATCH] Use quad container for race flag in finish infomessages Avoid uploading quad for race flag in finish infomessages every frame by adding it to the existing quad container. --- src/game/client/components/infomessages.cpp | 13 +++++++------ src/game/client/components/infomessages.h | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game/client/components/infomessages.cpp b/src/game/client/components/infomessages.cpp index 243072568..d5783d3bd 100644 --- a/src/game/client/components/infomessages.cpp +++ b/src/game/client/components/infomessages.cpp @@ -16,6 +16,7 @@ static constexpr float ROW_HEIGHT = 46.0f; static constexpr float FONT_SIZE = 36.0f; +static constexpr float RACE_FLAG_SIZE = 52.0f; void CInfoMessages::OnWindowResize() { @@ -65,6 +66,10 @@ void CInfoMessages::OnInit() RenderTools()->GetSpriteScale(g_pData->m_Weapons.m_aId[i].m_pSpriteBody, ScaleX, ScaleY); RenderTools()->QuadContainerAddSprite(m_SpriteQuadContainerIndex, 96.f * ScaleX, 96.f * ScaleY); } + + Graphics()->QuadsSetSubset(0, 0, 1, 1); + m_QuadOffsetRaceFlag = RenderTools()->QuadContainerAddSprite(m_SpriteQuadContainerIndex, 0.0f, 0.0f, RACE_FLAG_SIZE, RACE_FLAG_SIZE); + Graphics()->QuadContainerUpload(m_SpriteQuadContainerIndex); } @@ -389,13 +394,9 @@ void CInfoMessages::RenderFinishMsg(const CInfoMsg &InfoMsg, float x, float y) } // render flag - const float FlagSize = 52.0f; - x -= FlagSize; + x -= RACE_FLAG_SIZE; Graphics()->TextureSet(g_pData->m_aImages[IMAGE_RACEFLAG].m_Id); - Graphics()->QuadsBegin(); - IGraphics::CQuadItem QuadItem(x, y, FlagSize, FlagSize); - Graphics()->QuadsDrawTL(&QuadItem, 1); - Graphics()->QuadsEnd(); + Graphics()->RenderQuadContainerAsSprite(m_SpriteQuadContainerIndex, m_QuadOffsetRaceFlag, x, y); // render victim name if(InfoMsg.m_VictimTextContainerIndex.Valid()) diff --git a/src/game/client/components/infomessages.h b/src/game/client/components/infomessages.h index 03d953db8..29540d00d 100644 --- a/src/game/client/components/infomessages.h +++ b/src/game/client/components/infomessages.h @@ -8,7 +8,8 @@ #include class CInfoMessages : public CComponent { - int m_SpriteQuadContainerIndex; + int m_SpriteQuadContainerIndex = -1; + int m_QuadOffsetRaceFlag = -1; enum {