mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
show a notification "click a player or flag to follow it" when joining spectator
This commit is contained in:
parent
814c76248a
commit
c5af2a77a5
|
@ -662,6 +662,18 @@ void CHud::RenderSpectatorHud()
|
||||||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHud::RenderSpectatorNotification()
|
||||||
|
{
|
||||||
|
if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team == TEAM_SPECTATORS &&
|
||||||
|
m_pClient->m_TeamChangeTime + 5.0f >= Client()->LocalTime())
|
||||||
|
{
|
||||||
|
const char *pText = Localize("Click on a player or a flag to follow it");
|
||||||
|
float FontSize = 16.0f;
|
||||||
|
float w = TextRender()->TextWidth(0, FontSize, pText, -1);
|
||||||
|
TextRender()->Text(0, 150 * Graphics()->ScreenAspect() + -w / 2, 30, FontSize, pText, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CHud::OnRender()
|
void CHud::OnRender()
|
||||||
{
|
{
|
||||||
if(!m_pClient->m_Snap.m_pGameData)
|
if(!m_pClient->m_Snap.m_pGameData)
|
||||||
|
@ -684,6 +696,7 @@ void CHud::OnRender()
|
||||||
if(m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != -1)
|
if(m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != -1)
|
||||||
RenderHealthAndAmmo(&m_pClient->m_Snap.m_aCharacters[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID].m_Cur);
|
RenderHealthAndAmmo(&m_pClient->m_Snap.m_aCharacters[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID].m_Cur);
|
||||||
RenderSpectatorHud();
|
RenderSpectatorHud();
|
||||||
|
RenderSpectatorNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderGameTimer();
|
RenderGameTimer();
|
||||||
|
|
|
@ -25,6 +25,7 @@ class CHud : public CComponent
|
||||||
void RenderSuddenDeath();
|
void RenderSuddenDeath();
|
||||||
void RenderScoreHud();
|
void RenderScoreHud();
|
||||||
void RenderSpectatorHud();
|
void RenderSpectatorHud();
|
||||||
|
void RenderSpectatorNotification();
|
||||||
void RenderWarmupTimer();
|
void RenderWarmupTimer();
|
||||||
public:
|
public:
|
||||||
CHud();
|
CHud();
|
||||||
|
|
|
@ -367,6 +367,7 @@ void CGameClient::OnReset()
|
||||||
|
|
||||||
m_LocalClientID = -1;
|
m_LocalClientID = -1;
|
||||||
m_TeamCooldownTick = 0;
|
m_TeamCooldownTick = 0;
|
||||||
|
m_TeamChangeTime = 0.0f;
|
||||||
mem_zero(&m_GameInfo, sizeof(m_GameInfo));
|
mem_zero(&m_GameInfo, sizeof(m_GameInfo));
|
||||||
m_DemoSpecMode = SPEC_FREEVIEW;
|
m_DemoSpecMode = SPEC_FREEVIEW;
|
||||||
m_DemoSpecID = -1;
|
m_DemoSpecID = -1;
|
||||||
|
@ -623,6 +624,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_LocalClientID = pMsg->m_ClientID;
|
m_LocalClientID = pMsg->m_ClientID;
|
||||||
|
m_TeamChangeTime = Client()->LocalTime();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -744,6 +746,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
|
||||||
|
|
||||||
if(pMsg->m_ClientID == m_LocalClientID)
|
if(pMsg->m_ClientID == m_LocalClientID)
|
||||||
m_TeamCooldownTick = pMsg->m_CooldownTick;
|
m_TeamCooldownTick = pMsg->m_CooldownTick;
|
||||||
|
m_TeamChangeTime = Client()->LocalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pMsg->m_Silent == 0)
|
if(pMsg->m_Silent == 0)
|
||||||
|
|
|
@ -195,6 +195,7 @@ public:
|
||||||
int m_LocalClientID;
|
int m_LocalClientID;
|
||||||
int m_TeamCooldownTick;
|
int m_TeamCooldownTick;
|
||||||
bool m_MuteServerBroadcast;
|
bool m_MuteServerBroadcast;
|
||||||
|
float m_TeamChangeTime;
|
||||||
|
|
||||||
struct CGameInfo
|
struct CGameInfo
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue