Merge pull request #1741 from LordSk/fix/broadcast_scoreboard

Fixed broadcast not being shown when scoreboard/motd is active
This commit is contained in:
oy 2018-11-30 17:01:19 +01:00 committed by GitHub
commit 2f1646f5b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,7 @@ void CBroadcast::RenderServerBroadcast()
if(m_aSrvBroadcastMsg[0] == 0 || DeltaTime > DisplayDuration)
return;
if(m_pClient->m_pChat->IsActive())
if(m_pClient->m_pChat->IsActive() || m_pClient->Client()->State() != IClient::STATE_ONLINE)
return;
const float Fade = 1.0f - max(0.0f, (DeltaTime - DisplayStartFade) / (DisplayDuration - DisplayStartFade));
@ -251,6 +251,7 @@ void CBroadcast::DoBroadcast(const char *pText)
void CBroadcast::OnReset()
{
m_BroadcastTime = 0;
m_SrvBroadcastReceivedTime = 0;
}
void CBroadcast::OnMessage(int MsgType, void* pRawMsg)
@ -409,12 +410,15 @@ void CBroadcast::OnMessage(int MsgType, void* pRawMsg)
void CBroadcast::OnRender()
{
// server broadcast
RenderServerBroadcast();
// client broadcast
if(m_pClient->m_pScoreboard->Active() || m_pClient->m_pMotd->IsActive())
return;
Graphics()->MapScreen(0, 0, 300*Graphics()->ScreenAspect(), 300);
// client broadcast
if(Client()->LocalTime() < m_BroadcastTime)
{
CTextCursor Cursor;
@ -422,8 +426,5 @@ void CBroadcast::OnRender()
Cursor.m_LineWidth = 300*Graphics()->ScreenAspect()-m_BroadcastRenderOffset;
TextRender()->TextEx(&Cursor, m_aBroadcastText, -1);
}
// server broadcast
RenderServerBroadcast();
}