2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2018-03-21 14:53:29 +00:00
|
|
|
#include <engine/graphics.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <engine/shared/config.h>
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <engine/textrender.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/generated/client_data.h>
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <game/generated/protocol.h>
|
2008-09-04 18:54:37 +00:00
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
#include "camera.h"
|
2020-09-26 19:41:58 +00:00
|
|
|
#include "controls.h"
|
|
|
|
#include "nameplates.h"
|
|
|
|
#include <game/client/animstate.h>
|
|
|
|
#include <game/client/gameclient.h>
|
2008-09-04 18:54:37 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
#include "players.h"
|
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
void CNamePlates::MapscreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup)
|
|
|
|
{
|
|
|
|
float Points[4];
|
2019-04-02 23:05:38 +00:00
|
|
|
RenderTools()->MapscreenToWorld(CenterX, CenterY, pGroup->m_ParallaxX, pGroup->m_ParallaxY, pGroup->m_OffsetX, pGroup->m_OffsetY, Graphics()->ScreenAspect(), 1.0f, Points);
|
2018-03-21 14:53:29 +00:00
|
|
|
Graphics()->MapScreen(Points[0], Points[1], Points[2], Points[3]);
|
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void CNamePlates::RenderNameplate(
|
|
|
|
const CNetObj_Character *pPrevChar,
|
|
|
|
const CNetObj_Character *pPlayerChar,
|
2020-09-26 19:41:58 +00:00
|
|
|
const CNetObj_PlayerInfo *pPlayerInfo)
|
2008-09-04 18:54:37 +00:00
|
|
|
{
|
2018-03-13 20:55:47 +00:00
|
|
|
int ClientID = pPlayerInfo->m_ClientID;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
vec2 Position;
|
2019-04-11 22:46:54 +00:00
|
|
|
if(ClientID >= 0 && ClientID < MAX_CLIENTS)
|
|
|
|
Position = m_pClient->m_aClients[ClientID].m_RenderPos;
|
2018-03-13 20:55:47 +00:00
|
|
|
else
|
2020-02-19 10:24:58 +00:00
|
|
|
Position = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-06-25 12:56:23 +00:00
|
|
|
RenderNameplatePos(Position, pPlayerInfo, 1.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha)
|
|
|
|
{
|
|
|
|
int ClientID = pPlayerInfo->m_ClientID;
|
2020-06-24 17:01:01 +00:00
|
|
|
|
2019-07-16 20:34:18 +00:00
|
|
|
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
|
2014-01-24 22:11:33 +00:00
|
|
|
|
2011-01-04 12:11:01 +00:00
|
|
|
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
|
2015-06-29 00:06:27 +00:00
|
|
|
float FontSizeClan = 18.0f + 20.0f * g_Config.m_ClNameplatesClanSize / 100.0f;
|
2019-07-13 10:25:54 +00:00
|
|
|
|
2021-01-05 13:25:49 +00:00
|
|
|
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_NO_FIRST_CHARACTER_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_LAST_CHARACTER_ADVANCE);
|
|
|
|
float YOffset = Position.y - 38;
|
|
|
|
ColorRGBA rgb = ColorRGBA(1.0f, 1.0f, 1.0f);
|
|
|
|
|
2008-09-04 18:54:37 +00:00
|
|
|
// render name plate
|
2018-06-26 20:30:23 +00:00
|
|
|
if(!pPlayerInfo->m_Local || g_Config.m_ClNameplatesOwn)
|
2008-09-04 18:54:37 +00:00
|
|
|
{
|
|
|
|
float a = 1;
|
2010-05-29 07:25:38 +00:00
|
|
|
if(g_Config.m_ClNameplatesAlways == 0)
|
2020-09-26 19:41:58 +00:00
|
|
|
a = clamp(1 - powf(distance(m_pClient->m_pControls->m_TargetPos[g_Config.m_ClDummy], Position) / 200.0f, 16.0f), 0.0f, 1.0f);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-08-03 21:40:03 +00:00
|
|
|
const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientID].m_aName;
|
2018-03-13 20:55:47 +00:00
|
|
|
if(str_comp(pName, m_aNamePlates[ClientID].m_aName) != 0 || FontSize != m_aNamePlates[ClientID].m_NameTextFontSize)
|
|
|
|
{
|
|
|
|
mem_copy(m_aNamePlates[ClientID].m_aName, pName, sizeof(m_aNamePlates[ClientID].m_aName));
|
|
|
|
m_aNamePlates[ClientID].m_NameTextFontSize = FontSize;
|
|
|
|
|
|
|
|
if(m_aNamePlates[ClientID].m_NameTextContainerIndex != -1)
|
|
|
|
TextRender()->DeleteTextContainer(m_aNamePlates[ClientID].m_NameTextContainerIndex);
|
|
|
|
|
|
|
|
CTextCursor Cursor;
|
|
|
|
TextRender()->SetCursor(&Cursor, 0, 0, FontSize, TEXTFLAG_RENDER);
|
|
|
|
Cursor.m_LineWidth = -1;
|
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
// create nameplates at standard zoom
|
|
|
|
float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
|
|
|
|
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
|
|
|
|
MapscreenToGroup(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y, Layers()->GameGroup());
|
2019-06-28 18:23:01 +00:00
|
|
|
|
2020-07-15 19:10:13 +00:00
|
|
|
m_aNamePlates[ClientID].m_NameTextWidth = TextRender()->TextWidth(0, FontSize, pName, -1, -1.0f);
|
2019-06-28 18:23:01 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
m_aNamePlates[ClientID].m_NameTextContainerIndex = TextRender()->CreateTextContainer(&Cursor, pName);
|
2018-03-21 14:53:29 +00:00
|
|
|
Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
|
2018-03-13 20:55:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(g_Config.m_ClNameplatesClan)
|
|
|
|
{
|
|
|
|
const char *pClan = m_pClient->m_aClients[ClientID].m_aClan;
|
|
|
|
if(str_comp(pClan, m_aNamePlates[ClientID].m_aClanName) != 0 || FontSizeClan != m_aNamePlates[ClientID].m_ClanNameTextFontSize)
|
|
|
|
{
|
|
|
|
mem_copy(m_aNamePlates[ClientID].m_aClanName, pClan, sizeof(m_aNamePlates[ClientID].m_aClanName));
|
|
|
|
m_aNamePlates[ClientID].m_ClanNameTextFontSize = FontSizeClan;
|
|
|
|
|
|
|
|
if(m_aNamePlates[ClientID].m_ClanNameTextContainerIndex != -1)
|
|
|
|
TextRender()->DeleteTextContainer(m_aNamePlates[ClientID].m_ClanNameTextContainerIndex);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
CTextCursor Cursor;
|
|
|
|
TextRender()->SetCursor(&Cursor, 0, 0, FontSizeClan, TEXTFLAG_RENDER);
|
|
|
|
Cursor.m_LineWidth = -1;
|
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
// create nameplates at standard zoom
|
|
|
|
float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
|
|
|
|
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
|
|
|
|
MapscreenToGroup(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y, Layers()->GameGroup());
|
2019-06-28 18:23:01 +00:00
|
|
|
|
2020-07-15 19:10:13 +00:00
|
|
|
m_aNamePlates[ClientID].m_ClanNameTextWidth = TextRender()->TextWidth(0, FontSizeClan, pClan, -1, -1.0f);
|
2019-07-03 10:29:42 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
m_aNamePlates[ClientID].m_ClanNameTextContainerIndex = TextRender()->CreateTextContainer(&Cursor, pClan);
|
2018-03-21 14:53:29 +00:00
|
|
|
Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
|
2018-03-13 20:55:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float tw = m_aNamePlates[ClientID].m_NameTextWidth;
|
|
|
|
if(g_Config.m_ClNameplatesTeamcolors && m_pClient->m_Teams.Team(ClientID))
|
2019-04-26 12:06:32 +00:00
|
|
|
rgb = color_cast<ColorRGBA>(ColorHSLA(m_pClient->m_Teams.Team(ClientID) / 64.0f, 1.0f, 0.75f));
|
2018-03-13 20:55:47 +00:00
|
|
|
|
|
|
|
STextRenderColor TColor;
|
|
|
|
STextRenderColor TOutlineColor;
|
2014-04-12 14:55:01 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
if(OtherTeam)
|
2014-01-24 22:11:33 +00:00
|
|
|
{
|
2019-07-03 10:29:42 +00:00
|
|
|
TOutlineColor.Set(0.0f, 0.0f, 0.0f, 0.2f * g_Config.m_ClShowOthersAlpha / 100.0f);
|
2018-03-13 20:55:47 +00:00
|
|
|
TColor.Set(rgb.r, rgb.g, rgb.b, g_Config.m_ClShowOthersAlpha / 100.0f);
|
2014-01-24 22:11:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
TOutlineColor.Set(0.0f, 0.0f, 0.0f, 0.5f * a);
|
2020-06-25 12:56:23 +00:00
|
|
|
TColor.Set(rgb.r, rgb.g, rgb.b, a);
|
2014-01-24 22:11:33 +00:00
|
|
|
}
|
2020-09-26 19:41:58 +00:00
|
|
|
if(g_Config.m_ClNameplatesTeamcolors && m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS)
|
2010-12-15 12:31:27 +00:00
|
|
|
{
|
2018-03-13 20:55:47 +00:00
|
|
|
if(m_pClient->m_aClients[ClientID].m_Team == TEAM_RED)
|
|
|
|
TColor.Set(1.0f, 0.5f, 0.5f, a);
|
|
|
|
else if(m_pClient->m_aClients[ClientID].m_Team == TEAM_BLUE)
|
|
|
|
TColor.Set(0.7f, 0.7f, 1.0f, a);
|
2010-12-15 12:31:27 +00:00
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-06-25 12:56:23 +00:00
|
|
|
TOutlineColor.m_A *= Alpha;
|
|
|
|
TColor.m_A *= Alpha;
|
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
if(m_aNamePlates[ClientID].m_NameTextContainerIndex != -1)
|
2020-08-29 23:06:31 +00:00
|
|
|
{
|
2020-08-30 11:54:42 +00:00
|
|
|
YOffset -= FontSize;
|
|
|
|
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_NameTextContainerIndex, &TColor, &TOutlineColor, Position.x - tw / 2.0f, YOffset);
|
2020-08-29 23:06:31 +00:00
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2015-06-21 22:34:10 +00:00
|
|
|
if(g_Config.m_ClNameplatesClan)
|
2015-06-21 22:44:26 +00:00
|
|
|
{
|
2020-08-30 11:54:42 +00:00
|
|
|
YOffset -= FontSizeClan;
|
2018-03-13 20:55:47 +00:00
|
|
|
if(m_aNamePlates[ClientID].m_ClanNameTextContainerIndex != -1)
|
2020-08-30 11:54:42 +00:00
|
|
|
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_ClanNameTextContainerIndex, &TColor, &TOutlineColor, Position.x - m_aNamePlates[ClientID].m_ClanNameTextWidth / 2.0f, YOffset);
|
2020-08-29 23:06:31 +00:00
|
|
|
}
|
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
if(g_Config.m_ClNameplatesFriendMark && m_pClient->m_aClients[ClientID].m_Friend)
|
2020-08-29 23:06:31 +00:00
|
|
|
{
|
2020-08-30 11:54:42 +00:00
|
|
|
YOffset -= FontSize;
|
2020-09-26 19:41:58 +00:00
|
|
|
char aFriendMark[] = "♥";
|
2020-09-02 16:10:48 +00:00
|
|
|
TextRender()->TextColor(ColorRGBA(1.0f, 0.0f, 0.0f));
|
2020-09-26 19:41:58 +00:00
|
|
|
float XOffSet = TextRender()->TextWidth(0, FontSize, aFriendMark, -1, -1.0f) / 2.0f;
|
|
|
|
TextRender()->Text(0, Position.x - XOffSet, YOffset, FontSize, aFriendMark, -1.0f);
|
2015-06-21 22:44:26 +00:00
|
|
|
}
|
2015-06-21 22:34:10 +00:00
|
|
|
|
2020-05-30 10:37:42 +00:00
|
|
|
if(g_Config.m_Debug || g_Config.m_ClNameplatesIDs) // render client id when in debug as well
|
2008-09-04 18:54:37 +00:00
|
|
|
{
|
2020-08-30 11:54:42 +00:00
|
|
|
YOffset -= FontSize;
|
2010-05-29 07:25:38 +00:00
|
|
|
char aBuf[128];
|
2020-09-26 19:41:58 +00:00
|
|
|
str_format(aBuf, sizeof(aBuf), "%d", pPlayerInfo->m_ClientID);
|
|
|
|
float XOffset = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) / 2.0f;
|
2020-05-30 10:37:42 +00:00
|
|
|
TextRender()->TextColor(rgb);
|
2020-09-26 19:41:58 +00:00
|
|
|
TextRender()->Text(0, Position.x - XOffset, YOffset, FontSize, aBuf, -1.0f);
|
2008-09-04 18:54:37 +00:00
|
|
|
}
|
|
|
|
|
2020-07-08 06:32:24 +00:00
|
|
|
if(g_Config.m_ClNameplatesHA) // render health and armor in nameplate
|
2020-07-08 05:34:24 +00:00
|
|
|
{
|
|
|
|
int Health = m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_Health;
|
2020-08-30 11:54:42 +00:00
|
|
|
int Armor = m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_Armor;
|
2020-09-26 19:41:58 +00:00
|
|
|
|
2020-08-30 11:54:42 +00:00
|
|
|
if(Health > 0 || Armor > 0)
|
2020-07-08 05:34:24 +00:00
|
|
|
{
|
2020-07-08 07:41:44 +00:00
|
|
|
float HFontSize = 5.0f + 20.0f * g_Config.m_ClNameplatesHASize / 100.0f;
|
|
|
|
float AFontSize = 6.0f + 24.0f * g_Config.m_ClNameplatesHASize / 100.0f;
|
2020-07-13 16:12:03 +00:00
|
|
|
char aHealth[40] = "\0";
|
|
|
|
char aArmor[40] = "\0";
|
2020-07-08 05:34:24 +00:00
|
|
|
for(int i = 0; i < Health; i++)
|
2020-07-13 16:12:03 +00:00
|
|
|
str_append(aHealth, "♥", sizeof(aHealth));
|
2020-07-08 05:34:24 +00:00
|
|
|
for(int i = Health; i < 10; i++)
|
2020-07-13 16:12:03 +00:00
|
|
|
str_append(aHealth, "♡", sizeof(aHealth));
|
|
|
|
str_append(aHealth, "\0", sizeof(aHealth));
|
2020-07-08 05:34:24 +00:00
|
|
|
for(int i = 0; i < Armor; i++)
|
2020-07-13 16:12:03 +00:00
|
|
|
str_append(aArmor, "⚫", sizeof(aArmor));
|
2020-07-08 05:34:24 +00:00
|
|
|
for(int i = Armor; i < 10; i++)
|
2020-07-13 16:12:03 +00:00
|
|
|
str_append(aArmor, "⚪", sizeof(aArmor));
|
2020-07-14 02:45:03 +00:00
|
|
|
str_append(aArmor, "\0", sizeof(aArmor));
|
2020-07-08 05:34:24 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
YOffset -= HFontSize + AFontSize;
|
2020-07-16 13:07:41 +00:00
|
|
|
float PosHealth = TextRender()->TextWidth(0, HFontSize, aHealth, -1, -1.0f);
|
2020-07-08 05:34:24 +00:00
|
|
|
TextRender()->TextColor(ColorRGBA(1.0f, 0.0f, 0.0f));
|
2020-09-26 19:41:58 +00:00
|
|
|
TextRender()->Text(0, Position.x - PosHealth / 2.0f, YOffset, HFontSize, aHealth, -1);
|
2020-07-08 05:34:24 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
YOffset -= -AFontSize + 3.0f;
|
2020-07-16 13:07:41 +00:00
|
|
|
float PosArmor = TextRender()->TextWidth(0, AFontSize, aArmor, -1, -1.0f);
|
2020-07-08 05:34:24 +00:00
|
|
|
TextRender()->TextColor(ColorRGBA(1.0f, 1.0f, 0.0f));
|
2020-09-26 19:41:58 +00:00
|
|
|
TextRender()->Text(0, Position.x - PosArmor / 2.0f, YOffset, AFontSize, aArmor, -1);
|
2020-07-08 05:34:24 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-05 13:25:49 +00:00
|
|
|
}
|
2020-07-08 05:34:24 +00:00
|
|
|
|
2021-01-05 13:25:49 +00:00
|
|
|
if(g_Config.m_Debug)
|
|
|
|
{
|
|
|
|
CCharacter *pCharacter = m_pClient->m_GameWorld.GetCharacterByID(pPlayerInfo->m_ClientID);
|
|
|
|
if(pCharacter)
|
|
|
|
{
|
|
|
|
YOffset -= FontSize;
|
|
|
|
char aBuf[128];
|
|
|
|
str_format(aBuf, sizeof(aBuf), "%d", pCharacter->GetStrongWeakID());
|
|
|
|
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);
|
|
|
|
}
|
2008-09-04 18:54:37 +00:00
|
|
|
}
|
2021-01-05 13:25:49 +00:00
|
|
|
|
|
|
|
TextRender()->TextColor(TextRender()->DefaultTextColor());
|
|
|
|
TextRender()->TextOutlineColor(TextRender()->DefaultTextOutlineColor());
|
|
|
|
|
|
|
|
TextRender()->SetRenderFlags(0);
|
2008-09-04 18:54:37 +00:00
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void CNamePlates::OnRender()
|
2008-09-04 18:54:37 +00:00
|
|
|
{
|
2018-03-13 20:55:47 +00:00
|
|
|
if(!g_Config.m_ClNameplates)
|
2008-09-04 18:54:37 +00:00
|
|
|
return;
|
2008-09-23 08:42:38 +00:00
|
|
|
|
|
|
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
2008-09-04 18:54:37 +00:00
|
|
|
{
|
2020-10-15 13:35:00 +00:00
|
|
|
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_paPlayerInfos[i];
|
2020-06-25 12:56:23 +00:00
|
|
|
if(!pInfo)
|
|
|
|
{
|
2008-09-23 08:42:38 +00:00
|
|
|
continue;
|
2020-06-25 12:56:23 +00:00
|
|
|
}
|
2008-09-04 18:54:37 +00:00
|
|
|
|
2020-06-25 12:56:23 +00:00
|
|
|
if(m_pClient->m_aClients[i].m_SpecCharPresent)
|
|
|
|
{
|
2020-06-30 09:43:06 +00:00
|
|
|
bool OtherTeam = m_pClient->IsOtherTeam(i);
|
|
|
|
float Alpha = 0.4f * (OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f);
|
|
|
|
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, Alpha);
|
2020-06-25 12:56:23 +00:00
|
|
|
}
|
2008-09-04 18:54:37 +00:00
|
|
|
|
2020-06-25 12:56:23 +00:00
|
|
|
// only render active characters
|
|
|
|
if(m_pClient->m_Snap.m_aCharacters[i].m_Active)
|
2008-09-23 08:42:38 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
RenderNameplate(
|
|
|
|
&m_pClient->m_Snap.m_aCharacters[i].m_Prev,
|
|
|
|
&m_pClient->m_Snap.m_aCharacters[i].m_Cur,
|
2020-06-25 12:56:23 +00:00
|
|
|
pInfo);
|
2008-09-04 18:54:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-03-13 20:55:47 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
void CNamePlates::SetPlayers(CPlayers *pPlayers)
|
2018-03-13 20:55:47 +00:00
|
|
|
{
|
|
|
|
m_pPlayers = pPlayers;
|
|
|
|
}
|
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
void CNamePlates::ResetNamePlates()
|
2018-03-13 20:55:47 +00:00
|
|
|
{
|
2020-10-26 14:14:07 +00:00
|
|
|
for(auto &NamePlate : m_aNamePlates)
|
2018-03-13 20:55:47 +00:00
|
|
|
{
|
2020-10-26 14:14:07 +00:00
|
|
|
if(NamePlate.m_NameTextContainerIndex != -1)
|
|
|
|
TextRender()->DeleteTextContainer(NamePlate.m_NameTextContainerIndex);
|
|
|
|
if(NamePlate.m_ClanNameTextContainerIndex != -1)
|
|
|
|
TextRender()->DeleteTextContainer(NamePlate.m_ClanNameTextContainerIndex);
|
2018-03-13 20:55:47 +00:00
|
|
|
|
2020-10-26 14:14:07 +00:00
|
|
|
NamePlate.Reset();
|
2018-03-13 20:55:47 +00:00
|
|
|
}
|
2018-03-21 14:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CNamePlates::OnWindowResize()
|
|
|
|
{
|
|
|
|
ResetNamePlates();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNamePlates::OnInit()
|
|
|
|
{
|
|
|
|
ResetNamePlates();
|
2018-03-13 20:55:47 +00:00
|
|
|
}
|