]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't render items at all if their alpha is <= 0
authorMario <mario@smbclan.net>
Sun, 25 Jun 2017 09:20:42 +0000 (19:20 +1000)
committerMario <mario@smbclan.net>
Sun, 25 Jun 2017 09:20:42 +0000 (19:20 +1000)
qcsrc/common/t_items.qc

index 2746eabfc3fa048f681dd0ce0030075a6bdec8c3..5e03def2447d5132661edd66caa031f681b32f3e 100644 (file)
@@ -63,6 +63,8 @@ void Item_SetAlpha(entity this)
                this.colormod = this.glowmod = autocvar_cl_weapon_stay_color;
                this.alpha = autocvar_cl_weapon_stay_alpha;
        }
+
+       this.drawmask = ((this.alpha <= 0) ? 0 : MASK_NORMAL);
 }
 
 void ItemDraw(entity this)
@@ -127,9 +129,7 @@ void Item_PreDraw(entity this)
 {
        if(warpzone_warpzones_exist)
        {
-               // just incase warpzones were initialized last, reset these
-               //this.alpha = 1; // alpha is already set by the draw function
-               this.drawmask = MASK_NORMAL;
+               setpredraw(this, func_null); // no need to keep running this
                return;
        }
        float alph;
@@ -145,8 +145,8 @@ void Item_PreDraw(entity this)
                this.alpha = alph;
        if(alph <= 0)
                this.drawmask = 0;
-       else
-               this.drawmask = MASK_NORMAL;
+       //else
+               //this.drawmask = MASK_NORMAL; // reset by the setalpha function
 }
 
 void ItemRemove(entity this)
@@ -213,7 +213,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
 
         this.fade_end = ReadShort();
         this.fade_start = ReadShort();
-        if(this.fade_start && !autocvar_cl_items_nofade)
+        if(!warpzone_warpzones_exist && this.fade_start && !autocvar_cl_items_nofade)
                setpredraw(this, Item_PreDraw);
 
         if(this.mdl)