]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 e7677dfd6d80f851d386a9a694c32cda45acb545..232a9a4123555b4a0e079c7e08b80883b5ee4eea 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);
        /** 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 acd4bc371003009951cbafbe9235ff1fe09bde62..e44e18f753b881a2969ad6887427c4d7727becc7 100644 (file)
@@ -127,7 +127,8 @@ void Draw_ShowNames(entity this)
                if (f < 0) f = 0;
                a *= f;
        }
                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)
        if (vdist(this.origin - view_origin, >=, max_shot_distance)) return;
        float dist = vlen(this.origin - view_origin);
        if (autocvar_hud_shownames_maxdistance)
index 05d2306695076006f86478c26d5852bc74760b77..c9ad52ef93bf66cdd64ee0a04c2065bd244af937 100644 (file)
@@ -953,7 +953,7 @@ void HUD_Draw(entity this)
        if(autocvar_r_letterbox == 0)
                if(autocvar_viewsize < 120)
                {
        if(autocvar_r_letterbox == 0)
                if(autocvar_viewsize < 120)
                {
-                       if(!(ISGAMETYPE(RACE) || ISGAMETYPE(CTS)))
+                       if(!MUTATOR_CALLHOOK(DrawScoreboardAccuracy))
                                Accuracy_LoadLevels();
 
                        HUD_Main();
                                Accuracy_LoadLevels();
 
                        HUD_Main();
index 194461054e2303ee8e04a89a7ad2ad639a92c9c9..d20bcfa5406baa8206040b1b0383ff0446319a70 100644 (file)
@@ -30,3 +30,8 @@ MUTATOR_HOOKFUNCTION(cl_cts, ShowRankings)
                return true;
        }
 }
                return true;
        }
 }
+
+MUTATOR_HOOKFUNCTION(cl_cts, ShowNames_Draw)
+{
+       return (ISGAMETYPE(CTS) && M_ARGV(1, float) < ALPHA_MIN_VISIBLE);
+}