]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Avoid running UpdatePlayerTeams twice per frame
authorz411 <z411@omaera.org>
Sat, 9 Apr 2022 01:22:10 +0000 (21:22 -0400)
committerz411 <z411@omaera.org>
Sat, 9 Apr 2022 01:22:10 +0000 (21:22 -0400)
qcsrc/client/announcer.qc
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/scoreboard.qc

index 2a66615d9d060872ce5e5b54f60033667ef40765..59f977818748240387cc9cca1bc569093a9623d4 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <client/draw.qh>
 #include <client/hud/panel/centerprint.qh>
+#include <client/hud/panel/scoreboard.qh>
 #include <client/mutators/_mod.qh>
 #include <common/notifications/all.qh>
 #include <common/stats.qh>
@@ -27,6 +28,8 @@ string prev_pl1_name;
 string prev_pl2_name;
 void Announcer_Duel()
 {
+       Scoreboard_UpdatePlayerTeams();
+
        entity pl1 = players.sort_next;
        entity pl2 = pl1.sort_next;
        string pl1_name = (pl1 && pl1.team != NUM_SPECTATOR ? entcs_GetName(pl1.sv_entnum) : "???");
index 24a059a6c9460592fec67b461b411b21c3026fd9..164f60534d5138ee42310131e10af4dc5eb47944 100644 (file)
@@ -77,8 +77,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
                return;
        }
 
-       if (!scoreboard_fade_alpha) // the scoreboard too calls Scoreboard_UpdatePlayerTeams
-               Scoreboard_UpdatePlayerTeams();
+       Scoreboard_UpdatePlayerTeams();
        if (team_count)
        {
                // show team scores in the first line
index b3d24e59db7d8d9bd102ff42ce3ca66874380873..ed8715e022909cd1545784a29c222d3d1d130c92 100644 (file)
@@ -209,6 +209,11 @@ void Scoreboard_InitScores()
 //float lastpnum;
 void Scoreboard_UpdatePlayerTeams()
 {
+       static float update_time;
+       if (time <= update_time)
+               return;
+       update_time = time;
+
        entity pl, tmp;
        //int num = 0;
        for(pl = players.sort_next; pl; pl = pl.sort_next)