From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Wed, 25 Jan 2023 21:25:49 +0000 (+0100) Subject: remove excessive precision from new cts scoreboard entries and round them properly X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c385576e428b1f60f142a441ee1a1cf4765a5cc9;p=xonotic%2Fxonotic-data.pk3dir.git remove excessive precision from new cts scoreboard entries and round them properly --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 404ca60ac..36370a7b0 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1076,31 +1076,19 @@ string Scoreboard_GetField(entity pl, PlayerScoreField field) case SP_CTS_STRAFE: { - float strafe_efficiency = pl.(scores(field)) / 10000; + float strafe_efficiency = pl.(scores(field)) / 1000; if(strafe_efficiency < -1) return ""; sbt_field_rgb = '1 1 1' - (strafe_efficiency > 0 ? '1 0 1' : '0 1 1') * fabs(strafe_efficiency); - return sprintf("%.2f%%", strafe_efficiency * 100); + return sprintf("%.1f%%", strafe_efficiency * 100); } case SP_CTS_STARTSPEED: - { - float startspeed = pl.(scores(field)) / 100; - if(startspeed < 0) return ""; - return sprintf("%.2f qu/s", startspeed); - } - case SP_CTS_AVGSPEED: - { - float avgspeed = pl.(scores(field)) / 100; - if(avgspeed < 0) return ""; - return sprintf("%.2f qu/s", avgspeed); - } - case SP_CTS_TOPSPEED: { - float topspeed = pl.(scores(field)) / 100; - if(topspeed < 0) return ""; - return sprintf("%.2f qu/s", topspeed); + float speed = pl.(scores(field)) * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit); + if(speed < 0) return ""; + return sprintf("%d%s", speed, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit)); } default: case SP_SCORE: diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 45ed1c837..6d6447dcc 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -499,16 +499,16 @@ void race_SendTime(entity e, float cp, float t, float tvalid) GameRules_scoring_add(e, RACE_FASTEST, t - s); e.strafe_efficiency_best = e.strafe_efficiency_sum / e.strafe_efficiency_time; - PlayerScore_Set(e, SP_CTS_STRAFE, e.strafe_efficiency_best * 10000); + PlayerScore_Set(e, SP_CTS_STRAFE, floor(e.strafe_efficiency_best * 1000 + .5)); e.race_startspeed_best = e.race_startspeed; - PlayerScore_Set(e, SP_CTS_STARTSPEED, e.race_startspeed_best * 100); + PlayerScore_Set(e, SP_CTS_STARTSPEED, floor(e.race_startspeed_best + .5)); e.race_avgspeed_best = e.race_avgspeed_sum / e.race_avgspeed_time; - PlayerScore_Set(e, SP_CTS_AVGSPEED, e.race_avgspeed_best * 100); + PlayerScore_Set(e, SP_CTS_AVGSPEED, floor(e.race_avgspeed_best + .5)); e.race_topspeed_best = e.race_topspeed; - PlayerScore_Set(e, SP_CTS_TOPSPEED, e.race_topspeed_best * 100); + PlayerScore_Set(e, SP_CTS_TOPSPEED, floor(e.race_topspeed_best + .5)); } if(!g_race_qualifying) {