]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
For sanity, split the scoreboard name field into a separate function
authorMario <mario@smbclan.net>
Sun, 12 Feb 2017 10:28:37 +0000 (20:28 +1000)
committerMario <mario@smbclan.net>
Sun, 12 Feb 2017 10:28:37 +0000 (20:28 +1000)
qcsrc/client/hud/panel/scoreboard.qc

index 9f14b575aa2bd06c661c8cc2888ecfa862a0efe1..b8c9a3ea1579cae0e226eff1dc647572dd099c5b 100644 (file)
@@ -569,6 +569,25 @@ string sbt_field_icon2;
 vector sbt_field_icon0_rgb;
 vector sbt_field_icon1_rgb;
 vector sbt_field_icon2_rgb;
+string Scoreboard_GetName(entity pl)
+{
+       if(ready_waiting && pl.ready)
+       {
+               sbt_field_icon0 = "gfx/scoreboard/player_ready";
+       }
+       else if(!teamplay)
+       {
+               int f = entcs_GetClientColors(pl.sv_entnum);
+               {
+                       sbt_field_icon0 = "gfx/scoreboard/playercolor_base";
+                       sbt_field_icon1 = "gfx/scoreboard/playercolor_shirt";
+                       sbt_field_icon1_rgb = colormapPaletteColor(floor(f / 16), 0);
+                       sbt_field_icon2 = "gfx/scoreboard/playercolor_pants";
+                       sbt_field_icon2_rgb = colormapPaletteColor(f % 16, 1);
+               }
+       }
+       return entcs_GetName(pl.sv_entnum);
+}
 string Scoreboard_GetField(entity pl, PlayerScoreField field)
 {
        float tmp, num, denom;
@@ -609,22 +628,7 @@ string Scoreboard_GetField(entity pl, PlayerScoreField field)
                        return str;
 
                case SP_NAME:
-                       if(ready_waiting && pl.ready)
-                       {
-                               sbt_field_icon0 = "gfx/scoreboard/player_ready";
-                       }
-                       else if(!teamplay)
-                       {
-                               f = entcs_GetClientColors(pl.sv_entnum);
-                               {
-                                       sbt_field_icon0 = "gfx/scoreboard/playercolor_base";
-                                       sbt_field_icon1 = "gfx/scoreboard/playercolor_shirt";
-                                       sbt_field_icon1_rgb = colormapPaletteColor(floor(f / 16), 0);
-                                       sbt_field_icon2 = "gfx/scoreboard/playercolor_pants";
-                                       sbt_field_icon2_rgb = colormapPaletteColor(f % 16, 1);
-                               }
-                       }
-                       return entcs_GetName(pl.sv_entnum);
+                       return Scoreboard_GetName(pl);
 
                case SP_FRAGS:
                        f = pl.(scores(SP_KILLS));