]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify spawnpoint distance culling (particles aren't affected by entity alpha)...
authorMario <mario.mario@y7mail.com>
Fri, 29 May 2020 11:43:38 +0000 (21:43 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 29 May 2020 11:43:38 +0000 (21:43 +1000)
qcsrc/client/autocvars.qh
qcsrc/client/main.qc
xonotic-client.cfg

index 90bf6fb91ffa0cccbb9ef81320af6047ed59e7ba..06d89929ac961a0fd849d5f74888f0be3d772f7e 100644 (file)
@@ -70,7 +70,6 @@ bool autocvar_cl_spawn_event_particles;
 bool autocvar_cl_spawn_event_sound = 1;
 // float autocvar_cl_spawn_point_model;
 bool autocvar_cl_spawn_point_particles;
-float autocvar_cl_spawn_point_dist_min = 800;
 float autocvar_cl_spawn_point_dist_max = 1200;
 bool autocvar_cl_spawnzoom = 1;
 float autocvar_cl_spawnzoom_speed = 1;
index 39201fd72e6a90501281cd6f46e5041e9b1c41f5..9f95530d105622516caae76cc1d6aadad7456445 100644 (file)
@@ -674,7 +674,7 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew)
 
 void Spawn_Draw(entity this)
 {
-       if(this.alpha <= 0)
+       if(!this.alpha)
                return;
 
        __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
@@ -682,25 +682,15 @@ void Spawn_Draw(entity this)
 
 void Spawn_PreDraw(entity this)
 {
-       float alph;
-       vector org = getpropertyvec(VF_ORIGIN);
-       if(this.fade_start)
+       bool dodraw = true;
+       if(autocvar_cl_spawn_point_dist_max)
        {
-               if(vdist(org - this.origin, >, this.fade_end))
-                       alph = 0; // save on some processing
-               else if(vdist(org - this.origin, <, this.fade_start))
-                       alph = 1; // more processing saved
-               else
-                       alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+               vector org = getpropertyvec(VF_ORIGIN);
+               dodraw = vdist(org - this.origin, <, autocvar_cl_spawn_point_dist_max);
        }
-       else
-               alph = 1;
        //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
-       this.alpha = alph;
-       if(alph <= 0)
-               this.drawmask = 0;
-       else
-               this.drawmask = MASK_NORMAL;
+       this.alpha = dodraw;
+       this.drawmask = (dodraw) ? MASK_NORMAL : 0;
 }
 
 NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new)
@@ -745,8 +735,6 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new)
                        this.draw = Spawn_Draw;
                        if (is_new) IL_PUSH(g_drawables, this);
                        setpredraw(this, Spawn_PreDraw);
-                       this.fade_start = autocvar_cl_spawn_point_dist_min;
-                       this.fade_end = autocvar_cl_spawn_point_dist_max;
                }
        //}
 
index 389da6f74cb35b5340e0644530f2ce2291da9bcd..089d86802198152f6042ef2143b0bd57b3459816 100644 (file)
@@ -67,8 +67,7 @@ seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns"
 seta cl_spawn_event_sound 1 "sound effect whenever a player spawns"
 //seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model
 seta cl_spawn_point_particles 1 "pointparticles effect at all spawn points" // managed by effects-.cfg files
-seta cl_spawn_point_dist_min 800
-seta cl_spawn_point_dist_max 1200
+seta cl_spawn_point_dist_max 1200 "maximum distance from which spawnpoint particles will be visible"
 
 freelook 1
 sensitivity 6