mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Don't show wrong decisecs in game time in HUD
This commit is contained in:
parent
6beab4a42b
commit
1b1d8f7964
|
@ -288,7 +288,6 @@ MACRO_CONFIG_INT(ClRaceGhostServerControl, cl_race_ghost_server_control, 1, 0, 1
|
|||
MACRO_CONFIG_INT(ClRaceShowGhost, cl_race_show_ghost, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show ghost")
|
||||
MACRO_CONFIG_INT(ClRaceSaveGhost, cl_race_save_ghost, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Save ghost")
|
||||
MACRO_CONFIG_INT(ClDDRaceScoreBoard, cl_ddrace_scoreboard, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Enable DDRace Scoreboard")
|
||||
MACRO_CONFIG_INT(ClShowDecisecs, cl_show_decisecs, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Show deciseconds in game time")
|
||||
MACRO_CONFIG_INT(SvResetPickups, sv_reset_pickups, 0, 0, 1, CFGFLAG_SERVER | CFGFLAG_GAME, "Whether the weapons are reset on passing the start tile or not")
|
||||
MACRO_CONFIG_INT(ClShowOthers, cl_show_others, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show players in other teams (2 to show own team only)")
|
||||
MACRO_CONFIG_INT(ClShowOthersAlpha, cl_show_others_alpha, 40, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show players in other teams (alpha value, 0 invisible, 100 fully visible)")
|
||||
|
|
|
@ -70,7 +70,6 @@ void CHud::OnReset()
|
|||
m_DDRaceTime = 0;
|
||||
m_LastReceivedTimeTick = 0;
|
||||
m_CheckpointTick = 0;
|
||||
m_DDRaceTick = 0;
|
||||
m_FinishTime = false;
|
||||
m_DDRaceTimeReceived = false;
|
||||
m_ServerRecord = -1.0f;
|
||||
|
@ -122,19 +121,12 @@ void CHud::RenderGameTimer()
|
|||
else
|
||||
Time = (Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / Client()->GameTickSpeed();
|
||||
|
||||
if(Time <= 0 && g_Config.m_ClShowDecisecs)
|
||||
str_format(aBuf, sizeof(aBuf), "00:00.0");
|
||||
else if(Time <= 0)
|
||||
if(Time <= 0)
|
||||
str_format(aBuf, sizeof(aBuf), "00:00");
|
||||
else if(g_Config.m_ClShowDecisecs)
|
||||
str_format(aBuf, sizeof(aBuf), "%02d:%02d.%d", Time / 60, Time % 60, m_DDRaceTick / 10);
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%02d:%02d", Time / 60, Time % 60);
|
||||
float FontSize = 10.0f;
|
||||
float w;
|
||||
if(g_Config.m_ClShowDecisecs)
|
||||
w = TextRender()->TextWidth(0, 12, "00:00.0", -1, -1.0f);
|
||||
else
|
||||
w = TextRender()->TextWidth(0, 12, "00:00", -1, -1.0f);
|
||||
// last 60 sec red, last 10 sec blink
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit && Time <= 60 && (m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer <= 0))
|
||||
|
@ -804,16 +796,6 @@ void CHud::OnRender()
|
|||
RenderRecord();
|
||||
}
|
||||
RenderCursor();
|
||||
|
||||
static int LastChangeTick = 0;
|
||||
if(LastChangeTick != Client()->PredGameTick(g_Config.m_ClDummy))
|
||||
{
|
||||
m_DDRaceTick += 100 / Client()->GameTickSpeed();
|
||||
LastChangeTick = Client()->PredGameTick(g_Config.m_ClDummy);
|
||||
}
|
||||
|
||||
if(m_DDRaceTick >= 100)
|
||||
m_DDRaceTick = 0;
|
||||
}
|
||||
|
||||
void CHud::OnMessage(int MsgType, void *pRawMsg)
|
||||
|
@ -825,7 +807,6 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
|
|||
CNetMsg_Sv_DDRaceTime *pMsg = (CNetMsg_Sv_DDRaceTime *)pRawMsg;
|
||||
|
||||
m_DDRaceTime = pMsg->m_Time;
|
||||
m_DDRaceTick = 0;
|
||||
|
||||
m_LastReceivedTimeTick = Client()->GameTick(g_Config.m_ClDummy);
|
||||
|
||||
|
@ -856,7 +837,6 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
|
|||
m_DDRaceTimeReceived = true;
|
||||
|
||||
m_DDRaceTime = pMsg->m_ServerTimeBest; // First value: m_Time
|
||||
m_DDRaceTick = 0;
|
||||
|
||||
m_LastReceivedTimeTick = Client()->GameTick(g_Config.m_ClDummy);
|
||||
|
||||
|
@ -915,11 +895,6 @@ void CHud::RenderDDRaceEffects()
|
|||
TextRender()->TextColor(1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
/*else if(m_DDRaceTimeReceived)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%02d:%02d.%d", m_DDRaceTime/60, m_DDRaceTime%60, m_DDRaceTick/10);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 12, "00:00.0", -1, -1.0f)/2, 20, 12, aBuf, -1.0f); // use fixed value for text width so its not shaky
|
||||
}*/
|
||||
}
|
||||
|
||||
void CHud::RenderRecord()
|
||||
|
|
Loading…
Reference in a new issue