Merge pull request #8118 from dobrykafe/pr-nameplates-strong

`ClNameplatesStrong` improvements
This commit is contained in:
Robert Müller 2024-03-17 10:43:24 +00:00 committed by GitHub
commit d7f3c4fb6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -220,13 +220,15 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
if((g_Config.m_Debug || g_Config.m_ClNameplatesStrong) && g_Config.m_ClNameplates)
{
if(m_pClient->m_Snap.m_LocalClientId != -1 && m_pClient->m_Snap.m_aCharacters[pPlayerInfo->m_ClientId].m_HasExtendedData && m_pClient->m_Snap.m_aCharacters[m_pClient->m_Snap.m_LocalClientId].m_HasExtendedData)
bool Following = (m_pClient->m_Snap.m_SpecInfo.m_Active && !GameClient()->m_MultiViewActivated && m_pClient->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW);
if(m_pClient->m_Snap.m_LocalClientId != -1 || Following)
{
CCharacter *pLocalChar = m_pClient->m_GameWorld.GetCharacterById(m_pClient->m_Snap.m_LocalClientId);
CCharacter *pCharacter = m_pClient->m_GameWorld.GetCharacterById(pPlayerInfo->m_ClientId);
if(pCharacter && pLocalChar)
int SelectedId = Following ? m_pClient->m_Snap.m_SpecInfo.m_SpectatorId : m_pClient->m_Snap.m_LocalClientId;
const CGameClient::CSnapState::CCharacterInfo &Selected = m_pClient->m_Snap.m_aCharacters[SelectedId];
const CGameClient::CSnapState::CCharacterInfo &Other = m_pClient->m_Snap.m_aCharacters[ClientId];
if(Selected.m_HasExtendedData && Other.m_HasExtendedData)
{
if(pPlayerInfo->m_Local)
if(SelectedId == ClientId)
TextRender()->TextColor(rgb);
else
{
@ -237,7 +239,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
Graphics()->QuadsBegin();
ColorRGBA StrongWeakStatusColor;
int StrongWeakSpriteId;
if(pLocalChar->GetStrongWeakId() > pCharacter->GetStrongWeakId())
if(Selected.m_ExtendedData.m_StrongWeakId > Other.m_ExtendedData.m_StrongWeakId)
{
StrongWeakStatusColor = color_cast<ColorRGBA>(ColorHSLA(6401973));
StrongWeakSpriteId = SPRITE_HOOK_STRONG;
@ -271,7 +273,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
{
YOffset -= FontSize;
char aBuf[12];
str_from_int(pCharacter->GetStrongWeakId(), aBuf);
str_from_int(Other.m_ExtendedData.m_StrongWeakId, aBuf);
float XOffset = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f) / 2.0f;
TextRender()->Text(Position.x - XOffset, YOffset, FontSize, aBuf, -1.0f);
}