]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
remove excessive precision from new cts scoreboard entries and round them properly
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 25 Jan 2023 21:25:49 +0000 (22:25 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 25 Jan 2023 21:25:49 +0000 (22:25 +0100)
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/server/race.qc

index 404ca60ac491d751f285c11725603f11269fe17a..36370a7b0b6a7080a4d01608b36bb880903cd390 100644 (file)
@@ -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:
index 45ed1c8376a2f71b46db9a2ff086ef90ae651b1f..6d6447dcca921740fd6cba87a4227e13d6e3210a 100644 (file)
@@ -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)
                {