From: LegendaryGuard Date: Tue, 6 Apr 2021 17:57:35 +0000 (+0200) Subject: Fixed Country flags in Scoreboard (for the sake of z411's request) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=421c916f002497a454358dbd1b7c63a41ab3a5b9;p=xonotic%2Fxonotic-data.pk3dir.git Fixed Country flags in Scoreboard (for the sake of z411's request) --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index ffbf0868b..9af6ace3f 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -627,7 +627,6 @@ vector sbt_field_rgb; string sbt_field_icon0; string sbt_field_icon1; string sbt_field_icon2; -string sbt_field_icon3; //LegendGuard adds for Country player flags 05-04-2021 vector sbt_field_icon0_rgb; vector sbt_field_icon1_rgb; vector sbt_field_icon2_rgb; @@ -657,9 +656,12 @@ string Scoreboard_GetCountrycode(entity pl) { int ccode = entcs_GetCountryCode(pl.sv_entnum); if(ccode) - sbt_field_icon3 = strcat("gfx/flags/", ftos(ccode)); - - return ftos(entcs_GetCountryCode(pl.sv_entnum)); + sbt_field_icon0 = strcat("gfx/flags/", ftos(ccode)); + else + sbt_field_icon0 = strcat("gfx/flags/", ftos(0)); //if user hasn't assigned country flag + + return ""; + //return ftos(entcs_GetCountryCode(pl.sv_entnum)); //returns a number } vector getPingColor(float f) @@ -681,7 +683,6 @@ string Scoreboard_GetField(entity pl, PlayerScoreField field) sbt_field_icon0 = ""; sbt_field_icon1 = ""; sbt_field_icon2 = ""; - sbt_field_icon3 = ""; //LegendGuard adds for Country column 05-04-2021 sbt_field_icon0_rgb = '1 1 1'; sbt_field_icon1_rgb = '1 1 1'; sbt_field_icon2_rgb = '1 1 1'; @@ -715,10 +716,8 @@ string Scoreboard_GetField(entity pl, PlayerScoreField field) //LegendGuard adds Country REGISTER in the switch 05-04-2021 case SP_COUNTRY: - { str = Scoreboard_GetCountrycode(pl); return str; - } case SP_NAME: str = Scoreboard_GetName(pl); @@ -835,15 +834,6 @@ string Scoreboard_FixColumnWidth(int i, string str) sbt_fixcolumnwidth_iconlen = f; } - //LegendGuard adds conditional for Country column 05-04-2021 - if(sbt_field_icon3 != "") - { - sz = draw_getimagesize(sbt_field_icon3); - f = sz.x / sz.y; - if(sbt_fixcolumnwidth_iconlen < f) - sbt_fixcolumnwidth_iconlen = f; - } - if(sbt_fixcolumnwidth_iconlen != 0) { sbt_fixcolumnwidth_iconlen *= hud_fontsize.y / hud_fontsize.x; // fix icon aspect @@ -1007,8 +997,6 @@ void Scoreboard_DrawItem(vector item_pos, vector rgb, entity pl, bool is_self, i drawpic(pos - tmp, sbt_field_icon1, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL); if(sbt_field_icon2 != "") drawpic(pos - tmp, sbt_field_icon2, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon2_rgb, fg_alpha, DRAWFLAG_NORMAL); - if(sbt_field_icon3 != "") //LegendGuard adds conditional for Country column 05-04-2021 - drawpic(pos - tmp, sbt_field_icon3, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL); } if(sbt_field[i] == SP_SEPARATOR) @@ -1043,9 +1031,6 @@ void Scoreboard_DrawItem(vector item_pos, vector rgb, entity pl, bool is_self, i drawpic(pos - tmp, sbt_field_icon1, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL); if(sbt_field_icon2 != "") drawpic(pos - tmp, sbt_field_icon2, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon2_rgb, fg_alpha, DRAWFLAG_NORMAL); - if(sbt_field_icon3 != "") //LegendGuard adds conditional for Country column 05-04-2021 - drawpic(pos - tmp, sbt_field_icon3, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL); - pos.x -= sbt_field_size[i] + hud_fontsize.x; } } @@ -1275,19 +1260,6 @@ void Scoreboard_Duel_DrawTable(vector pos, bool invert, entity pl, entity tm) tmp_in.y += (duel_name_fontsize.y - hud_fontsize.y) / 2; drawpic(tmp_in, sbt_field_icon0, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon1_rgb, panel_fg_alpha, DRAWFLAG_NORMAL); } - - //LegendGuard adds a conditional sentence for country column 05-04-2021 - // Player country icon/flag - if(sbt_field_icon3 != "") { - vector rsz = draw_getimagesize(sbt_field_icon3); - sbt_fixcolumnwidth_iconlen = rsz.x / rsz.y; - if(invert) - tmp_in.x -= hud_fontsize.x * sbt_fixcolumnwidth_iconlen + duel_name_fontsize.x * 0.5; - else - tmp_in.x += stringwidth_colors(tmp_str, duel_name_fontsize) + duel_name_fontsize.x * 0.5; - tmp_in.y += (duel_name_fontsize.y - hud_fontsize.y) / 2; - drawpic(tmp_in, sbt_field_icon3, vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y), sbt_field_icon1_rgb, panel_fg_alpha, DRAWFLAG_NORMAL); - } // Header float column_width = panel_size.x / 5;