4976: fix rendering of nameplates for spectating tees r=def- a=C0D3D3V

bug was introduced by #4870

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
bors[bot] 2022-04-12 21:48:45 +00:00 committed by GitHub
commit f60ae47be1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -327,6 +327,10 @@ void CNamePlates::OnRender()
// don't render offscreen
vec2 *pRenderPos = &m_pClient->m_aClients[i].m_RenderPos;
if(m_pClient->m_aClients[i].m_SpecCharPresent)
{
pRenderPos = &m_pClient->m_aClients[i].m_SpecChar;
}
if(pRenderPos->x < ScreenX0 || pRenderPos->x > ScreenX1 || pRenderPos->y < ScreenY0 || pRenderPos->y > ScreenY1)
{
continue;
@ -336,10 +340,9 @@ void CNamePlates::OnRender()
{
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, 0.4f, true);
}
// only render active characters
if(m_pClient->m_Snap.m_aCharacters[i].m_Active)
else if(m_pClient->m_Snap.m_aCharacters[i].m_Active)
{
// only render nameplates for active characters
RenderNameplate(
&m_pClient->m_Snap.m_aCharacters[i].m_Prev,
&m_pClient->m_Snap.m_aCharacters[i].m_Cur,