diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 04fa5a8ac..c026fa688 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -662,6 +662,18 @@ void CHud::RenderSpectatorHud() 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() { if(!m_pClient->m_Snap.m_pGameData) @@ -684,6 +696,7 @@ void CHud::OnRender() 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); RenderSpectatorHud(); + RenderSpectatorNotification(); } RenderGameTimer(); diff --git a/src/game/client/components/hud.h b/src/game/client/components/hud.h index 68b1b1770..a743c97a8 100644 --- a/src/game/client/components/hud.h +++ b/src/game/client/components/hud.h @@ -25,6 +25,7 @@ class CHud : public CComponent void RenderSuddenDeath(); void RenderScoreHud(); void RenderSpectatorHud(); + void RenderSpectatorNotification(); void RenderWarmupTimer(); public: CHud(); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 7dd80aeaa..32938a021 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -367,6 +367,7 @@ void CGameClient::OnReset() m_LocalClientID = -1; m_TeamCooldownTick = 0; + m_TeamChangeTime = 0.0f; mem_zero(&m_GameInfo, sizeof(m_GameInfo)); m_DemoSpecMode = SPEC_FREEVIEW; m_DemoSpecID = -1; @@ -623,6 +624,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) return; } m_LocalClientID = pMsg->m_ClientID; + m_TeamChangeTime = Client()->LocalTime(); } else { @@ -744,6 +746,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) if(pMsg->m_ClientID == m_LocalClientID) m_TeamCooldownTick = pMsg->m_CooldownTick; + m_TeamChangeTime = Client()->LocalTime(); } if(pMsg->m_Silent == 0) diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 05dd360d4..31c88560e 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -195,6 +195,7 @@ public: int m_LocalClientID; int m_TeamCooldownTick; bool m_MuteServerBroadcast; + float m_TeamChangeTime; struct CGameInfo {