From b110b87c0032fb88fc78169a78fd910d4f16e187 Mon Sep 17 00:00:00 2001 From: z411 Date: Fri, 8 Apr 2022 21:22:10 -0400 Subject: [PATCH] Avoid running UpdatePlayerTeams twice per frame --- qcsrc/client/announcer.qc | 3 +++ qcsrc/client/hud/panel/score.qc | 3 +-- qcsrc/client/hud/panel/scoreboard.qc | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) 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) -- 2.39.2