Add a mutator hook to shownames to allow hiding it per-player, also don't load accura...
authorMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 09:34:40 +0000 (19:34 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 09:34:40 +0000 (19:34 +1000)
qcsrc/client/mutators/events.qh
qcsrc/client/shownames.qc
qcsrc/client/view.qc
qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc

index e7677df..232a9a4 100644 (file)
@@ -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);
index acd4bc3..e44e18f 100644 (file)
@@ -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)
index 05d2306..c9ad52e 100644 (file)
@@ -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();
index 1944610..d20bcfa 100644 (file)
@@ -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);
+}