mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
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:
parent
e25d43aaf6
commit
9daa3beacd
|
@ -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];
|
||||
|
|
|
@ -8,7 +8,7 @@ class CBroadcast : public CComponent
|
|||
{
|
||||
// broadcasts
|
||||
char m_aBroadcastText[1024];
|
||||
int64 m_BroadcastTime;
|
||||
int m_BroadcastTick;
|
||||
float m_BroadcastRenderOffset;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue