]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Some optimizations to client side items and spawn points
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 13b63652bb5e8e4c6d470b4d8a040f4f202d35b1..2e55584eda8b0941bbe1ee78c484c879d2c02693 100644 (file)
@@ -657,6 +657,9 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew)
 
 void Spawn_Draw(entity this)
 {
+       if(this.alpha <= 0)
+               return;
+
        __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
@@ -665,7 +668,14 @@ void Spawn_PreDraw(entity this)
        float alph;
        vector org = getpropertyvec(VF_ORIGIN);
        if(this.fade_start)
-               alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+       {
+               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);
+       }
        else
                alph = 1;
        //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
@@ -854,7 +864,7 @@ void Ent_Remove(entity this)
 
        if(this.snd_looping > 0)
        {
-               sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
+               sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
                this.snd_looping = 0;
        }
 
@@ -1070,11 +1080,12 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_nextcheckpoint = ReadByte();
 
                        race_nextbesttime = ReadInt24_t();
-                       race_mybesttime = ReadInt24_t();
+                       if(b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING) // not while spectating (matches server)
+                               race_mybesttime = ReadInt24_t();
                        if(race_nextbestname)
                                strunzone(race_nextbestname);
                        string newname = ReadString();
-                       if(autocvar_cl_race_cptimes_onlyself)
+                       if(autocvar_cl_race_cptimes_onlyself && b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING)
                        {
                                race_nextbesttime = race_mybesttime;
                                race_mybesttime = 0;