Merge pull request #1893 from Dune-jr/feature-ready-notification

Notify players which key they should press to set themselves ready
This commit is contained in:
oy 2018-12-17 15:52:04 +01:00 committed by GitHub
commit c92f044f39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -84,6 +84,7 @@ void CHud::RenderPauseTimer()
str_format(aBuf, sizeof(aBuf), Localize("%d players not ready"), m_pClient->m_Snap.m_NotReadyCount);
else
return;
RenderReadyUpNotification();
}
else
{
@ -344,9 +345,15 @@ void CHud::RenderWarmupTimer()
if(m_pClient->m_Snap.m_pGameData->m_GameStateEndTick == 0)
{
if(m_pClient->m_Snap.m_NotReadyCount == 1)
{
str_format(aBuf, sizeof(aBuf), Localize("%d player not ready"), m_pClient->m_Snap.m_NotReadyCount);
RenderReadyUpNotification();
}
else if(m_pClient->m_Snap.m_NotReadyCount > 1)
{
str_format(aBuf, sizeof(aBuf), Localize("%d players not ready"), m_pClient->m_Snap.m_NotReadyCount);
RenderReadyUpNotification();
}
else
{
str_format(aBuf, sizeof(aBuf), Localize("wait for more players"));
@ -674,6 +681,19 @@ void CHud::RenderSpectatorNotification()
}
}
void CHud::RenderReadyUpNotification()
{
if(!(m_pClient->m_Snap.m_paPlayerInfos[m_pClient->m_LocalClientID]->m_PlayerFlags&PLAYERFLAG_READY))
{
char aKey[64], aText[128];
m_pClient->m_pBinds->GetKey("ready_change", aKey, sizeof(aKey));
str_format(aText, sizeof(aText), Localize("When ready, press <%s>"), aKey);
float FontSize = 16.0f;
float w = TextRender()->TextWidth(0, FontSize, aText, -1);
TextRender()->Text(0, 150 * Graphics()->ScreenAspect() + -w / 2, 30, FontSize, aText, -1);
}
}
void CHud::OnRender()
{
if(!m_pClient->m_Snap.m_pGameData)

View file

@ -26,6 +26,7 @@ class CHud : public CComponent
void RenderScoreHud();
void RenderSpectatorHud();
void RenderSpectatorNotification();
void RenderReadyUpNotification();
void RenderWarmupTimer();
public:
CHud();