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.
This commit is contained in:
def 2019-04-02 23:28:10 +02:00
parent e25d43aaf6
commit 9daa3beacd
2 changed files with 4 additions and 4 deletions

View file

@ -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];

View file

@ -8,7 +8,7 @@ class CBroadcast : public CComponent
{
// broadcasts
char m_aBroadcastText[1024];
int64 m_BroadcastTime;
int m_BroadcastTick;
float m_BroadcastRenderOffset;
public: