mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
add cl_nameplates_friendmark 2
This commit is contained in:
parent
90d1a93f40
commit
e0616b38d7
|
@ -135,47 +135,58 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
TOutlineColor.m_A *= Alpha;
|
||||
TColor.m_A *= Alpha;
|
||||
|
||||
float YOffSet = Position.y - 38;
|
||||
float YOffset = Position.y-38;
|
||||
|
||||
if(m_aNamePlates[ClientID].m_NameTextContainerIndex != -1)
|
||||
{
|
||||
YOffSet -= FontSize;
|
||||
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_NameTextContainerIndex, &TColor, &TOutlineColor, Position.x - tw / 2.0f, YOffSet);
|
||||
YOffset -= FontSize;
|
||||
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_NameTextContainerIndex, &TColor, &TOutlineColor, Position.x - tw / 2.0f, YOffset);
|
||||
}
|
||||
|
||||
if(g_Config.m_ClNameplatesClan)
|
||||
{
|
||||
YOffSet -= FontSizeClan;
|
||||
YOffset -= FontSizeClan;
|
||||
if(m_aNamePlates[ClientID].m_ClanNameTextContainerIndex != -1)
|
||||
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_ClanNameTextContainerIndex, &TColor, &TOutlineColor, Position.x - m_aNamePlates[ClientID].m_ClanNameTextWidth / 2.0f, YOffSet);
|
||||
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_ClanNameTextContainerIndex, &TColor, &TOutlineColor, Position.x - m_aNamePlates[ClientID].m_ClanNameTextWidth / 2.0f, YOffset);
|
||||
}
|
||||
|
||||
if (g_Config.m_ClNameplatesFriendMark && m_pClient->m_aClients[ClientID].m_Friend)
|
||||
{
|
||||
YOffSet -= FontSize;
|
||||
YOffset -= FontSize;
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf),"[F]");
|
||||
|
||||
if (g_Config.m_ClNameplatesFriendMark == 1)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf),"♥");
|
||||
TextRender()->TextColor(ColorRGBA(1.0f, 0.0f, 0.0f));
|
||||
}
|
||||
else if (g_Config.m_ClNameplatesFriendMark == 2)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf),"[F]");
|
||||
TextRender()->TextColor(rgb);
|
||||
}
|
||||
|
||||
float XOffSet = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f)/2.0f;
|
||||
TextRender()->TextColor(rgb);
|
||||
TextRender()->Text(0, Position.x-XOffSet, YOffSet, FontSize, aBuf, -1.0f);
|
||||
TextRender()->Text(0, Position.x-XOffSet, YOffset, FontSize, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
if(g_Config.m_Debug || g_Config.m_ClNameplatesIDs) // render client id when in debug as well
|
||||
{
|
||||
YOffSet -= FontSize;
|
||||
YOffset -= FontSize;
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf),"%d", pPlayerInfo->m_ClientID);
|
||||
float XOffSet = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f)/2.0f;
|
||||
float XOffset = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f)/2.0f;
|
||||
TextRender()->TextColor(rgb);
|
||||
TextRender()->Text(0, Position.x-XOffSet, YOffSet, FontSize, aBuf, -1.0f);
|
||||
TextRender()->Text(0, Position.x-XOffset, YOffset, FontSize, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
if(g_Config.m_ClNameplatesHA) // render health and armor in nameplate
|
||||
{
|
||||
int Health = m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_Health;
|
||||
if(Health > 0)
|
||||
int Armor = m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_Armor;
|
||||
|
||||
if(Health > 0 || Armor > 0)
|
||||
{
|
||||
int Armor = m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_Armor;
|
||||
float HFontSize = 5.0f + 20.0f * g_Config.m_ClNameplatesHASize / 100.0f;
|
||||
float AFontSize = 6.0f + 24.0f * g_Config.m_ClNameplatesHASize / 100.0f;
|
||||
char aHealth[40] = "\0";
|
||||
|
@ -191,24 +202,16 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
str_append(aArmor, "⚪", sizeof(aArmor));
|
||||
str_append(aArmor, "\0", sizeof(aArmor));
|
||||
|
||||
float Offset;
|
||||
|
||||
if(g_Config.m_ClNameplatesClan && (g_Config.m_Debug || g_Config.m_ClNameplatesIDs))
|
||||
Offset = (FontSize * 3 + FontSizeClan);
|
||||
else if (g_Config.m_ClNameplatesClan)
|
||||
Offset = (FontSize * 2 + FontSizeClan);
|
||||
else if (g_Config.m_Debug || g_Config.m_ClNameplatesIDs)
|
||||
Offset = (FontSize * 3);
|
||||
else
|
||||
Offset = (FontSize * 2);
|
||||
|
||||
YOffset -= HFontSize+AFontSize;
|
||||
float PosHealth = TextRender()->TextWidth(0, HFontSize, aHealth, -1, -1.0f);
|
||||
TextRender()->TextColor(ColorRGBA(1.0f, 0.0f, 0.0f));
|
||||
TextRender()->Text(0, Position.x-PosHealth/2.0f, Position.y-Offset-HFontSize-AFontSize, HFontSize, aHealth, -1);
|
||||
TextRender()->Text(0, Position.x-PosHealth/2.0f, YOffset, HFontSize, aHealth, -1);
|
||||
|
||||
YOffset -= -AFontSize+3.0f;
|
||||
float PosArmor = TextRender()->TextWidth(0, AFontSize, aArmor, -1, -1.0f);
|
||||
TextRender()->TextColor(ColorRGBA(1.0f, 1.0f, 0.0f));
|
||||
TextRender()->Text(0, Position.x-PosArmor/2.0f, Position.y-Offset-AFontSize-3.0f, AFontSize, aArmor, -1);
|
||||
TextRender()->Text(0, Position.x-PosArmor/2.0f, YOffset, AFontSize, aArmor, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ MACRO_CONFIG_INT(ClNameplatesIDs, cl_nameplates_ids, 0, 0, 1, CFGFLAG_CLIENT|CFG
|
|||
MACRO_CONFIG_INT(ClNameplatesHA, cl_nameplates_ha, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show Health and Armor in name plates")
|
||||
MACRO_CONFIG_INT(ClNameplatesHASize, cl_nameplates_ha_size, 50, 0, 100, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Size of the health and armor nameplates from 0 to 100%")
|
||||
MACRO_CONFIG_INT(ClNameplatesOwn, cl_nameplates_own, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show own name plate (useful for demo recording)")
|
||||
MACRO_CONFIG_INT(ClNameplatesFriendMark, cl_nameplates_friendmark, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show friend mark under nameplate")
|
||||
MACRO_CONFIG_INT(ClNameplatesFriendMark, cl_nameplates_friendmark, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show friend mark in name plates (1 - show heart, 2 - show '[F]')")
|
||||
MACRO_CONFIG_INT(ClTextEntities, cl_text_entities, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Render textual entity data")
|
||||
MACRO_CONFIG_INT(ClTextEntitiesSize, cl_text_entities_size, 100, 0, 100, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Size of textual entity data from 0 to 100%")
|
||||
|
||||
|
|
Loading…
Reference in a new issue