From: LegendaryGuard Date: Tue, 6 Apr 2021 20:39:47 +0000 (+0200) Subject: Fix scoreboard bug, don't delete the variable and its conditionals X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0a38ea0932e5911a72e4666198fef8548cfbecb1;p=xonotic%2Fxonotic-data.pk3dir.git Fix scoreboard bug, don't delete the variable and its conditionals --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 867b91a46..8a346c096 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -613,6 +613,7 @@ 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; @@ -642,9 +643,9 @@ string Scoreboard_GetCountrycode(entity pl) { int ccode = entcs_GetCountryCode(pl.sv_entnum); if(ccode) - sbt_field_icon0 = strcat("gfx/flags/", ftos(ccode)); + sbt_field_icon3 = strcat("gfx/flags/", ftos(ccode)); else - sbt_field_icon0 = strcat("gfx/flags/", ftos(0)); //if user hasn't assigned country flag + sbt_field_icon3 = strcat("gfx/flags/", ftos(0)); //if user hasn't assigned country flag return ""; //return ftos(entcs_GetCountryCode(pl.sv_entnum)); //returns a number @@ -669,6 +670,7 @@ 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'; @@ -820,6 +822,16 @@ 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 @@ -983,6 +995,9 @@ 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) @@ -1017,6 +1032,9 @@ 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; } } @@ -1247,6 +1265,19 @@ void Scoreboard_Duel_DrawTable(vector pos, bool invert, entity pl, entity tm) 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; tmp.x = pos.x + panel_bg_padding;