]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show ranks in scoreboard and spect HUD
authorz411 <z411@omaera.org>
Mon, 31 Jan 2022 21:11:54 +0000 (18:11 -0300)
committerz411 <z411@omaera.org>
Mon, 31 Jan 2022 21:11:54 +0000 (18:11 -0300)
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/spect.qc

index b5d3294eba6a6cf3f84204e341a8f97ecc33015b..9a2664b068fb6d3c8f64619e06bf1d513c82be97 100644 (file)
@@ -664,8 +664,10 @@ string Scoreboard_GetName(entity pl)
                        sbt_field_icon2_rgb = colormapPaletteColor(f % 16, 1);
                }
        }
-       
-       return entcs_GetName(pl.sv_entnum);
+       if(entcs_GetRank(pl.sv_entnum) != "")
+               return strcat(entcs_GetRank(pl.sv_entnum), "^7 ", entcs_GetName(pl.sv_entnum));
+       else
+               return entcs_GetName(pl.sv_entnum);
 }
 
 //LegendGuard adds GetCountrycode function 05-04-2021
index 818d4c927be7fb7961fcf442ccc0fba4226cf8c3..fc67de3eb977eae257814fb122f4ed3893b09b16 100644 (file)
@@ -21,14 +21,16 @@ void HUD_SpectHUD_Export(int fh)
 void HUD_SpectHUD_drawCurrentName(vector pos)
 {
        vector tmp;
+       string s;
        
        tmp = pos;
-       string s = entcs_GetName(current_player);
+       
+       s = entcs_GetName(current_player);
        tmp.x -= stringwidth_colors(s, hud_fontsize * 2) / 2;
        drawcolorcodedstring(tmp, s, hud_fontsize * 2, panel_fg_alpha, DRAWFLAG_NORMAL);
-       
+
        tmp = pos;
-       s = "Spectating";
+       s = (entcs_GetRank(current_player) != "" ? entcs_GetRank(current_player) : "Spectating");
        tmp.x -= stringwidth_colors(s, hud_fontsize) / 2;
        tmp.y -= hud_fontsize.y;
        drawcolorcodedstring(tmp, s, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
@@ -107,7 +109,13 @@ void HUD_SpectHUD_drawTeamPlayers(vector pos, entity tm, vector rgb, bool invert
                }
                
                // Get player's name
-               playername = textShortenToWidth(entcs_GetName(pl.sv_entnum), line_sz.x * 0.8, hud_fontsize, stringwidth_colors);
+               string playername;
+               if(entcs_GetRank(pl.sv_entnum) != "")
+                       playername = strcat(entcs_GetRank(pl.sv_entnum), "^7 ", entcs_GetName(pl.sv_entnum));
+               else
+                       playername = entcs_GetName(pl.sv_entnum);
+
+               playername = textShortenToWidth(playername, line_sz.x * 0.8, hud_fontsize, stringwidth_colors);
                
                // Draw health and name
                drawfill(pos, line_sz, rgb * 0.7, a * 0.3, DRAWFLAG_NORMAL);