From: Mario Date: Mon, 13 Jul 2020 09:34:40 +0000 (+1000) Subject: Add a mutator hook to shownames to allow hiding it per-player, also don't load accura... X-Git-Tag: xonotic-v0.8.5~855^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=43839845a0cab8d18e6583ee6a07d5e607e81fea;p=xonotic%2Fxonotic-data.pk3dir.git Add a mutator hook to shownames to allow hiding it per-player, also don't load accuracy levels in nexball --- diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index e7677dfd6..232a9a412 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -217,3 +217,11 @@ MUTATOR_HOOKABLE(DrawReticle, EV_NO_ARGS); /** rankings title */ o(string, MUTATOR_ARGV_0_string) \ /**/ MUTATOR_HOOKABLE(ShowRankings, EV_ShowRankings); + +/** Called when drawing a player's nameplate, return true to hide it */ +#define EV_ShowNames_Draw(i, o) \ + /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \ + /** alpha */ i(float, MUTATOR_ARGV_1_float) \ + /***/ o(float, MUTATOR_ARGV_1_float) \ + /**/ +MUTATOR_HOOKABLE(ShowNames_Draw, EV_ShowNames_Draw); diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index acd4bc371..e44e18f75 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -127,7 +127,8 @@ void Draw_ShowNames(entity this) if (f < 0) f = 0; a *= f; } - if (a < ALPHA_MIN_VISIBLE && ISGAMETYPE(CTS)) return; + if (MUTATOR_CALLHOOK(ShowNames_Draw, this, a)) return; + a = M_ARGV(1, float); if (vdist(this.origin - view_origin, >=, max_shot_distance)) return; float dist = vlen(this.origin - view_origin); if (autocvar_hud_shownames_maxdistance) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 05d230669..c9ad52ef9 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -953,7 +953,7 @@ void HUD_Draw(entity this) if(autocvar_r_letterbox == 0) if(autocvar_viewsize < 120) { - if(!(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) + if(!MUTATOR_CALLHOOK(DrawScoreboardAccuracy)) Accuracy_LoadLevels(); HUD_Main(); diff --git a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc index 194461054..d20bcfa54 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc +++ b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc @@ -30,3 +30,8 @@ MUTATOR_HOOKFUNCTION(cl_cts, ShowRankings) return true; } } + +MUTATOR_HOOKFUNCTION(cl_cts, ShowNames_Draw) +{ + return (ISGAMETYPE(CTS) && M_ARGV(1, float) < ALPHA_MIN_VISIBLE); +}