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 90bf6fb..06d8992 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 39201fd..9f95530 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 389da6f..089d868 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