Merge pull request #9223 from Robyt3/Client-Infomessages-Quadcontainer

Use quad container for race flag in finish infomessages
This commit is contained in:
Dennis Felsing 2024-11-09 11:02:48 +00:00 committed by GitHub
commit d0fc4af9fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View file

@ -16,6 +16,7 @@
static constexpr float ROW_HEIGHT = 46.0f; static constexpr float ROW_HEIGHT = 46.0f;
static constexpr float FONT_SIZE = 36.0f; static constexpr float FONT_SIZE = 36.0f;
static constexpr float RACE_FLAG_SIZE = 52.0f;
void CInfoMessages::OnWindowResize() void CInfoMessages::OnWindowResize()
{ {
@ -65,6 +66,10 @@ void CInfoMessages::OnInit()
RenderTools()->GetSpriteScale(g_pData->m_Weapons.m_aId[i].m_pSpriteBody, ScaleX, ScaleY); RenderTools()->GetSpriteScale(g_pData->m_Weapons.m_aId[i].m_pSpriteBody, ScaleX, ScaleY);
RenderTools()->QuadContainerAddSprite(m_SpriteQuadContainerIndex, 96.f * ScaleX, 96.f * 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); Graphics()->QuadContainerUpload(m_SpriteQuadContainerIndex);
} }
@ -389,13 +394,9 @@ void CInfoMessages::RenderFinishMsg(const CInfoMsg &InfoMsg, float x, float y)
} }
// render flag // render flag
const float FlagSize = 52.0f; x -= RACE_FLAG_SIZE;
x -= FlagSize;
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_RACEFLAG].m_Id); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_RACEFLAG].m_Id);
Graphics()->QuadsBegin(); Graphics()->RenderQuadContainerAsSprite(m_SpriteQuadContainerIndex, m_QuadOffsetRaceFlag, x, y);
IGraphics::CQuadItem QuadItem(x, y, FlagSize, FlagSize);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
// render victim name // render victim name
if(InfoMsg.m_VictimTextContainerIndex.Valid()) if(InfoMsg.m_VictimTextContainerIndex.Valid())

View file

@ -8,7 +8,8 @@
#include <game/client/render.h> #include <game/client/render.h>
class CInfoMessages : public CComponent class CInfoMessages : public CComponent
{ {
int m_SpriteQuadContainerIndex; int m_SpriteQuadContainerIndex = -1;
int m_QuadOffsetRaceFlag = -1;
enum enum
{ {