From 9daa3beacdbcf449de4a0b56bf30ef7beef587ca Mon Sep 17 00:00:00 2001 From: def Date: Tue, 2 Apr 2019 23:28:10 +0200 Subject: [PATCH] Broadcast: Fix display time during demo replay Only show for the same amount of ticks as originally, not number of seconds, otherwise at high demo speeds you will see the broadcast for a much longer game play time than originally. --- src/game/client/components/broadcast.cpp | 6 +++--- src/game/client/components/broadcast.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/client/components/broadcast.cpp b/src/game/client/components/broadcast.cpp index 81b7cf21f..8b33994b7 100644 --- a/src/game/client/components/broadcast.cpp +++ b/src/game/client/components/broadcast.cpp @@ -15,7 +15,7 @@ void CBroadcast::OnReset() { - m_BroadcastTime = 0; + m_BroadcastTick = 0; } void CBroadcast::OnRender() @@ -25,7 +25,7 @@ void CBroadcast::OnRender() Graphics()->MapScreen(0, 0, 300*Graphics()->ScreenAspect(), 300); - if(time_get() < m_BroadcastTime) + if(Client()->GameTick() < m_BroadcastTick) { CTextCursor Cursor; TextRender()->SetCursor(&Cursor, m_BroadcastRenderOffset, 40.0f, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); @@ -45,7 +45,7 @@ void CBroadcast::OnMessage(int MsgType, void *pRawMsg) Cursor.m_LineWidth = 300*Graphics()->ScreenAspect(); TextRender()->TextEx(&Cursor, m_aBroadcastText, -1); m_BroadcastRenderOffset = 150*Graphics()->ScreenAspect()-Cursor.m_X/2; - m_BroadcastTime = time_get()+time_freq()*10; + m_BroadcastTick = Client()->GameTick()+Client()->GameTickSpeed()*10; if (g_Config.m_ClPrintBroadcasts) { char aBuf[1024]; diff --git a/src/game/client/components/broadcast.h b/src/game/client/components/broadcast.h index 47c666161..6e9555f86 100644 --- a/src/game/client/components/broadcast.h +++ b/src/game/client/components/broadcast.h @@ -8,7 +8,7 @@ class CBroadcast : public CComponent { // broadcasts char m_aBroadcastText[1024]; - int64 m_BroadcastTime; + int m_BroadcastTick; float m_BroadcastRenderOffset; public: