]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Darkness nade: avoid drawing another useless color flash
authorterencehill <piuntn@gmail.com>
Wed, 12 Jul 2023 22:18:02 +0000 (00:18 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 12 Jul 2023 22:18:02 +0000 (00:18 +0200)
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/nades/nades.qc

index c9de0d15626ceb79ebf58aadbcf32b523ef5953f..7e944089917d911e8ea005f7b1deabad3c7cc672 100644 (file)
@@ -860,7 +860,10 @@ void HUD_Draw(entity this)
        {
                if (MUTATOR_CALLHOOK(HUD_Draw_overlay))
                {
-                       drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), M_ARGV(0, vector), autocvar_hud_colorflash_alpha * M_ARGV(1, float), DRAWFLAG_ADDITIVE);
+                       vector col = M_ARGV(0, vector);
+                       float alpha_multipl = M_ARGV(1, float);
+                       if (alpha_multipl > 0)
+                               drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), col, autocvar_hud_colorflash_alpha * alpha_multipl, DRAWFLAG_ADDITIVE);
                }
                else if(STAT(FROZEN))
                {
index 6e3f8a23ce2004bd462590af6ac997264dac6ab5..3ee6020cfb53c7a989b2c24fcb7f0920f282e684 100644 (file)
@@ -59,12 +59,11 @@ MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
                if (!darkblink)
                        sound(csqcplayer, CH_PAIN, SND_BLIND, VOL_BASE, ATTEN_NORM);
                darkblink = true;
-               M_ARGV(0, vector) = NADE_TYPE_DARKNESS.m_color;
                HUD_DarkBlinking();
+               M_ARGV(1, float) = 0; // alpha_multipl 0, don't draw normal overlay
                return true;
        }
-       else
-               darkblink = false;
+       darkblink = false;
        return false;
 }