]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix scoreboard bug, don't delete the variable and its conditionals
authorLegendaryGuard <rootuser999@gmail.com>
Tue, 6 Apr 2021 20:39:47 +0000 (22:39 +0200)
committerz411 <z411@omaera.org>
Thu, 15 Apr 2021 16:46:31 +0000 (12:46 -0400)
qcsrc/client/hud/panel/scoreboard.qc

index 9af6ace3fbd9a61269a1740b22ada1ab457cdf6c..1dd00cc66639088108c05b1029f7677bad87e104 100644 (file)
@@ -627,6 +627,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;
@@ -656,9 +657,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
@@ -683,6 +684,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';
@@ -834,6 +836,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
@@ -997,6 +1009,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)
@@ -1031,6 +1046,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;
                }
        }
 
@@ -1261,6 +1279,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;