From 32205c47c046b78ecfad958f855a3786fa18b1e5 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 13 Jul 2020 18:58:57 +1000 Subject: [PATCH] Add a mutator hook to hide the accuracy panel in the scoreboard --- qcsrc/client/hud/panel/scoreboard.qc | 2 +- qcsrc/client/mutators/events.qh | 3 +++ qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc | 5 +++++ qcsrc/common/gamemodes/gamemode/nexball/cl_nexball.qc | 5 +++++ qcsrc/common/gamemodes/gamemode/race/cl_race.qc | 5 +++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index c863d1115..fc49d5601 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1505,7 +1505,7 @@ float scoreboard_time; bool have_weapon_stats; bool Scoreboard_AccuracyStats_WouldDraw(float ypos) { - if (ISGAMETYPE(CTS) || ISGAMETYPE(RACE) || ISGAMETYPE(NEXBALL)) + if (MUTATOR_CALLHOOK(DrawScoreboardAccuracy)) return false; if (!autocvar_hud_panel_scoreboard_accuracy || warmup_stage || ypos > 0.91 * vid_conheight) return false; diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index e8c374ee4..e7677dfd6 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -172,6 +172,9 @@ MUTATOR_HOOKABLE(DrawScoreboard, EV_NO_ARGS); /** Return true to not draw scoreboard while dead */ MUTATOR_HOOKABLE(DrawDeathScoreboard, EV_NO_ARGS); +/** Return true to not show accuracy stats in the scoreboard */ +MUTATOR_HOOKABLE(DrawScoreboardAccuracy, EV_NO_ARGS); + /** Called when drawing info messages, allows adding new info messages. Return true to hide the standard join message */ #define EV_DrawInfoMessages(i, o) \ /** pos */ i(vector, MUTATOR_ARGV_0_vector) \ diff --git a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc index f85035d81..194461054 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc +++ b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc @@ -17,6 +17,11 @@ MUTATOR_HOOKFUNCTION(cl_cts, DrawDeathScoreboard) return ISGAMETYPE(CTS); // no scoreboard shown while dead } +MUTATOR_HOOKFUNCTION(cl_cts, DrawScoreboardAccuracy) +{ + return ISGAMETYPE(CTS); // accuracy is not a factor in this gamemode +} + MUTATOR_HOOKFUNCTION(cl_cts, ShowRankings) { if(ISGAMETYPE(CTS)) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/cl_nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/cl_nexball.qc index 5a6b42dc4..19b7b63ce 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/cl_nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/cl_nexball.qc @@ -42,3 +42,8 @@ MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase) return true; return false; } + +MUTATOR_HOOKFUNCTION(cl_nb, DrawScoreboardAccuracy) +{ + return ISGAMETYPE(NEXBALL); // accuracy is not a factor in this gamemode +} diff --git a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc index 820d7cc3f..e8b5516d0 100644 --- a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc @@ -166,3 +166,8 @@ MUTATOR_HOOKFUNCTION(cl_race, ShowRankings) return true; } } + +MUTATOR_HOOKFUNCTION(cl_race, DrawScoreboardAccuracy) +{ + return ISGAMETYPE(RACE); // accuracy is not a factor in this gamemode +} -- 2.39.2