From d0c85acc0d5f29dd628b73d263705b1227601cb6 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 2 Dec 2014 13:19:06 +0100 Subject: [PATCH] Add cl_show_centisecs --- src/engine/shared/config_variables.h | 1 + src/game/client/components/hud.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 614eefb38..9fd463f69 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -278,6 +278,7 @@ MACRO_CONFIG_INT(ClRaceGhost, cl_race_ghost, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAV 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(ClShowCentisecs, cl_show_centisecs, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Show centiseconds in game time") MACRO_CONFIG_INT(SvResetPickups, sv_reset_pickups, 0, 0, 1, CFGFLAG_SERVER, "Whether the weapons are reset on passing the start tile or not") MACRO_CONFIG_INT(ClShowOthers, cl_show_others, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show players in other teams") 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)") diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 2595e6bec..482be6347 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -62,14 +62,22 @@ void CHud::RenderGameTimer() bool IsGameTypeRace = str_find_nocase(Info.m_aGameType, "race") || str_find_nocase(Info.m_aGameType, "fastcap"); bool IsGameTypeDDRace = str_find_nocase(Info.m_aGameType, "ddrace") || str_find_nocase(Info.m_aGameType, "mkrace"); - if(Time <= 0) + if(Time <= 0 && g_Config.m_ClShowCentisecs) str_format(Buf, sizeof(Buf), "00:00.0"); + else if(Time <= 0) + str_format(Buf, sizeof(Buf), "00:00"); else if(IsGameTypeRace && !IsGameTypeDDRace && m_ServerRecord >= 0) str_format(Buf, sizeof(Buf), "%02d:%02d", (int)(m_ServerRecord*100)/60, ((int)(m_ServerRecord*100)%60)); - else + else if(g_Config.m_ClShowCentisecs) str_format(Buf, sizeof(Buf), "%02d:%02d.%d", Time/60, Time%60, m_DDRaceTick/10); + else + str_format(Buf, sizeof(Buf), "%02d:%02d", Time/60, Time%60); float FontSize = 10.0f; - float w = TextRender()->TextWidth(0, 12,"00:00.0",-1); + float w; + if(g_Config.m_ClShowCentisecs) + w = TextRender()->TextWidth(0, 12,"00:00.0",-1); + else + w = TextRender()->TextWidth(0, 12,"00:00",-1); // 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) {