From: z411 Date: Mon, 31 Jan 2022 21:11:54 +0000 (-0300) Subject: Show ranks in scoreboard and spect HUD X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7d943c4e5ff58a4e63145bd1ea08b5e3a7090a8e;p=xonotic%2Fxonotic-data.pk3dir.git Show ranks in scoreboard and spect HUD --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index b5d3294eb..9a2664b06 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -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 diff --git a/qcsrc/client/hud/panel/spect.qc b/qcsrc/client/hud/panel/spect.qc index 818d4c927..fc67de3eb 100644 --- a/qcsrc/client/hud/panel/spect.qc +++ b/qcsrc/client/hud/panel/spect.qc @@ -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);