Add size variable for clan plates

This commit is contained in:
def 2015-06-29 02:06:27 +02:00
parent d846583ba7
commit 4c3b97d6ba
4 changed files with 20 additions and 6 deletions

View file

@ -127,6 +127,17 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
if(DoButton_CheckBox(&g_Config.m_ClNameplatesClan, Localize("Show clan above name plates"), g_Config.m_ClNameplatesClan, &Button))
g_Config.m_ClNameplatesClan ^= 1;
}
if(g_Config.m_ClNameplatesClan)
{
Right.HSplitTop(2.5f, 0, &Right);
Right.HSplitTop(20.0f, &Label, &Right);
Right.HSplitTop(20.0f, &Button, &Right);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Clan plates size"), g_Config.m_ClNameplatesClanSize);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
Button.HMargin(2.0f, &Button);
g_Config.m_ClNameplatesClanSize = (int)(DoScrollbarH(&g_Config.m_ClNameplatesClanSize, &Button, g_Config.m_ClNameplatesClanSize/100.0f)*100.0f+0.1f);
}
}
// client

View file

@ -30,6 +30,7 @@ void CNamePlates::RenderNameplate(
OtherTeam = m_pClient->m_Teams.Team(pPlayerInfo->m_ClientID) != m_pClient->m_Teams.Team(m_pClient->m_Snap.m_LocalClientID);
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
float FontSizeClan = 18.0f + 20.0f * g_Config.m_ClNameplatesClanSize / 100.0f;
// render name plate
if(!pPlayerInfo->m_Local)
{
@ -67,15 +68,15 @@ void CNamePlates::RenderNameplate(
if(g_Config.m_ClNameplatesClan)
{
const char *pClan = m_pClient->m_aClients[pPlayerInfo->m_ClientID].m_aClan;
float tw_clan = TextRender()->TextWidth(0, FontSize, pClan, -1);
TextRender()->Text(0, Position.x-tw_clan/2.0f, Position.y-FontSize*2-38.0f, FontSize, pClan, -1);
float tw_clan = TextRender()->TextWidth(0, FontSizeClan, pClan, -1);
TextRender()->Text(0, Position.x-tw_clan/2.0f, Position.y-FontSize-FontSizeClan-38.0f, FontSizeClan, pClan, -1);
}
if(g_Config.m_Debug) // render client id when in debug aswell
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf),"%d", pPlayerInfo->m_ClientID);
float Offset = g_Config.m_ClNameplatesClan ? FontSize * 3 : FontSize * 2;
float Offset = g_Config.m_ClNameplatesClan ? (FontSize * 2 + FontSizeClan) : (FontSize * 2);
float tw_id = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, Position.x-tw_id/2.0f, Position.y-Offset-38.0f, 28.0f, aBuf, -1);
}

View file

@ -882,6 +882,7 @@ void CPlayers::RenderPlayer(
if(g_Config.m_ClNameplates && g_Config.m_ClAntiPingPlayers)
{
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
float FontSizeClan = 18.0f + 20.0f * g_Config.m_ClNameplatesClanSize / 100.0f;
// render name plate
if(!pPlayerInfo->m_Local)
{
@ -919,15 +920,15 @@ void CPlayers::RenderPlayer(
if(g_Config.m_ClNameplatesClan)
{
const char *pClan = m_pClient->m_aClients[pPlayerInfo->m_ClientID].m_aClan;
float tw_clan = TextRender()->TextWidth(0, FontSize, pClan, -1);
TextRender()->Text(0, Position.x-tw_clan/2.0f, Position.y-FontSize*2-38.0f, FontSize, pClan, -1);
float tw_clan = TextRender()->TextWidth(0, FontSizeClan, pClan, -1);
TextRender()->Text(0, Position.x-tw_clan/2.0f, Position.y-FontSize-FontSizeClan-38.0f, FontSizeClan, pClan, -1);
}
if(g_Config.m_Debug) // render client id when in debug aswell
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf),"%d", pPlayerInfo->m_ClientID);
float Offset = g_Config.m_ClNameplatesClan ? FontSize * 3 : FontSize * 2;
float Offset = g_Config.m_ClNameplatesClan ? (FontSize * 2 + FontSizeClan) : (FontSize * 2);
float tw_id = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, Position.x-tw_id/2.0f, Position.y-Offset-38.0f, 28.0f, aBuf, -1);
}

View file

@ -16,6 +16,7 @@ MACRO_CONFIG_INT(ClNameplatesAlways, cl_nameplates_always, 1, 0, 1, CFGFLAG_CLIE
MACRO_CONFIG_INT(ClNameplatesTeamcolors, cl_nameplates_teamcolors, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Use team colors for name plates")
MACRO_CONFIG_INT(ClNameplatesSize, cl_nameplates_size, 50, 0, 100, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Size of the name plates from 0 to 100%")
MACRO_CONFIG_INT(ClNameplatesClan, cl_nameplates_clan, 0, 1, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show clan in name plates")
MACRO_CONFIG_INT(ClNameplatesClanSize, cl_nameplates_clan_size, 30, 0, 100, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Size of the clan plates from 0 to 100%")
#if defined(__ANDROID__)
MACRO_CONFIG_INT(ClAutoswitchWeapons, cl_autoswitch_weapons, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup")
MACRO_CONFIG_INT(ClAutoswitchWeaponsOutOfAmmo, cl_autoswitch_weapons_out_of_ammo, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon when out of ammo")