From: z411 Date: Sat, 9 Apr 2022 01:22:10 +0000 (-0400) Subject: Avoid running UpdatePlayerTeams twice per frame X-Git-Tag: xonotic-v0.8.5~94^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b110b87c0032fb88fc78169a78fd910d4f16e187;p=xonotic%2Fxonotic-data.pk3dir.git Avoid running UpdatePlayerTeams twice per frame --- diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 2a66615d9..59f977818 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -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) : "???"); diff --git a/qcsrc/client/hud/panel/score.qc b/qcsrc/client/hud/panel/score.qc index 24a059a6c..164f60534 100644 --- a/qcsrc/client/hud/panel/score.qc +++ b/qcsrc/client/hud/panel/score.qc @@ -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 diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index b3d24e59d..ed8715e02 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -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)