From: Des Date: Tue, 3 Sep 2024 14:07:45 +0000 (-0300) Subject: First approach to speed in racetimer. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3644720da6f719c7d47b6af7af60127295310b2d;p=xonotic%2Fxonotic-data.pk3dir.git First approach to speed in racetimer. --- diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index 4a76dbbd5..b79b76cb6 100644 --- a/qcsrc/client/hud/panel/racetimer.qc +++ b/qcsrc/client/hud/panel/racetimer.qc @@ -217,11 +217,18 @@ void HUD_RaceTimer () } else { + float speed_conversion_factor; + string speed_text = string_null; + if(autocvar_cl_race_cptimes_showspeed) + { + speed_conversion_factor = GetSpeedUnitFactor(autocvar_hud_speed_unit); + speed_text = sprintf(" @%d%s",vlen(vec2(csqcplayer.velocity)) * speed_conversion_factor, autocvar_cl_race_cptimes_showspeed_unit ? GetSpeedUnit(autocvar_hud_speed_unit) : ""); + } // build checkpoint split strings if(race_time && race_previousbesttime) - s = MakeRaceString(race_checkpoint, TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime), 0, ((race_mypreviousbesttime) ? TIME_DECODE(race_time) - TIME_DECODE(race_mypreviousbesttime) : 0), 0, race_previousbestname); + s = strcat(MakeRaceString(race_checkpoint, TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime), 0, ((race_mypreviousbesttime) ? TIME_DECODE(race_time) - TIME_DECODE(race_mypreviousbesttime) : 0), 0, race_previousbestname), speed_text); else - s = MakeRaceString(race_checkpoint, 0, -1, 0, 0, race_previousbestname); + s = strcat(MakeRaceString(race_checkpoint, 0, -1, 0, 0, race_previousbestname), speed_text); if(race_time) forcetime = TIME_ENCODED_TOSTRING(race_time, false); diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 8b96b0833..71e965b76 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -23,9 +23,13 @@ bool autocvar_developer_csqcentities; // this can't be done now as players would lack these from their configs then bool autocvar_cl_race_checkpoint_splits_console; bool autocvar_cl_race_checkpoint_splits_hud; +bool autocvar_cl_race_cptimes_showspeed = false; +bool autocvar_cl_race_cptimes_showspeed_unit = false; #else AUTOCVAR_SAVE(cl_race_checkpoint_splits_console, bool, 1, "Print checkpoint splits to console"); AUTOCVAR_SAVE(cl_race_checkpoint_splits_hud, bool, 1, "Show race checkpoint splits on HUD in infomessages"); +AUTOCVAR_SAVE(cl_race_cptimes_showspeed, bool, 0, "Show race checkpoint speed"); +AUTOCVAR_SAVE(cl_race_cptimes_showspeed_unit, bool, 0, "Show race checkpoint speed units"); #endif bool autocvar_cl_race_cptimes_onlyself; // TODO: move to race gamemode bool autocvar_cl_race_cptimes_showself = false;