Fix CTS score display
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 15 Apr 2011 11:17:08 +0000 (14:17 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 15 Apr 2011 11:17:08 +0000 (14:17 +0300)
data/qcsrc/client/sbar.qc

index b7a7d20..0996ca8 100644 (file)
@@ -1649,7 +1649,7 @@ void Sbar_Score()
 {\r
        float score, distribution, leader;\r
        vector score_pos, secondary_score_pos, race_score_pos, distribution_color;\r
-       string racetime;\r
+       string racetime, secondary_racetime;\r
        entity tm, pl, me;\r
        me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];\r
 \r
@@ -1675,7 +1675,7 @@ void Sbar_Score()
                score = me.(scores[ps_primary]);\r
 \r
                float racemin, racesec, racemsec;\r
-               float distsec, distmsec, minusplus;\r
+               float distsec, distmsec;\r
                string s_racemin, s_racesec, s_racemsec;\r
                \r
                racemin = floor(score/(60 * TIME_FACTOR));\r
@@ -1696,28 +1696,27 @@ void Sbar_Score()
                        if (distribution < TIME_FACTOR && distribution > -TIME_FACTOR)\r
                                distmsec = fabs(distribution);\r
                        else {\r
-                               distsec = floor(fabs(distribution)/TIME_FACTOR);\r
-                               distmsec = fabs(distribution) - distsec*TIME_FACTOR;\r
-                               if (distribution < 0)\r
-                                       distsec = -distsec;\r
+                               distsec = floor(fabs(distribution) / TIME_FACTOR);\r
+                               distmsec = fabs(distribution) - distsec * TIME_FACTOR;\r
                        }\r
 \r
-                       if (distribution <= 0) {\r
+                       if (distribution < 0) {\r
                                distribution_color = '0 1 0';\r
-                               minusplus = 1; // minusplus 1: always prefix with minus sign\r
+                               secondary_racetime = "-"; // always prefix with minus sign\r
                        }\r
-                       else {\r
+                       else if (distribution > 0) {\r
                                distribution_color = '1 0 0';\r
-                               minusplus = 2; // minusplus 1: always prefix with plus sign\r
+                               secondary_racetime = "+"; // minusplus 1: always prefix with plus sign\r
                        }\r
-                       Sbar_DrawXNum(score_pos + '222 -6 0' - '14 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 14, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-                       Sbar_DrawXNum(score_pos + '222 6 0' - '14 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 14, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+\r
+                       secondary_racetime = strcat(secondary_racetime, ftos(distsec), ".", ftos(distmsec));\r
+                       drawstring(score_pos + '222 0 0' - '14 0 0', secondary_racetime, '14 14 0', distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
 \r
                racetime = strcat(s_racemin, " : ", s_racesec, " . ", s_racemsec);\r
                race_score_pos = top + '0 0 0';\r
                race_score_pos -= '1 0 0' * stringwidth(racetime, FALSE, '30 30 0') * 0.5;\r
-               drawstring(race_score_pos, racetime, '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
+               drawstring(race_score_pos, racetime, '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
        } else if (!teamplay) { // non-teamgames, except race/cts\r
                // me vector := [team/connected frags id]\r