]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
client: remove _all
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 87f3a1bb4afff6f94c43b6df8a7d32c76193b065..479dd7e8eab8486ed14e23b1b333a58df3a1ac59 100644 (file)
@@ -1,6 +1,10 @@
 #include "main.qh"
 
+#include "miscfunctions.qh"
+#include <common/effects/effect.qh>
 #include <common/effects/qc/all.qh>
+#include <common/effects/all.qh>
+#include <common/effects/all.inc>
 #include "hud/_mod.qh"
 #include "mapvoting.qh"
 #include "mutators/events.qh"
@@ -17,6 +21,7 @@
 #include <common/minigames/cl_minigames_hud.qh>
 #include <common/net_linked.qh>
 #include <common/net_notice.qh>
+#include <common/scores.qh>
 #include <common/triggers/include.qh>
 #include <common/vehicles/all.qh>
 #include <lib/csqcmodel/cl_model.qh>
@@ -131,8 +136,6 @@ void CSQC_Init()
 
        registercvar("cl_spawn_near_teammate", "1");
 
-       registercvar("cl_race_cptimes_onlyself", "0");
-
        if(autocvar_cl_lockview)
                cvar_set("cl_lockview", "0");
 
@@ -658,6 +661,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));
 }
 
@@ -666,7 +672,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));
@@ -855,7 +868,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;
        }
 
@@ -977,6 +990,7 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
        forcefog = strzone(ReadString());
 
        armorblockpercent = ReadByte() / 255.0;
+       damagepush_speedfactor = ReadByte() / 255.0;
 
        serverflags = ReadByte();
 
@@ -1035,25 +1049,18 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_checkpoint = ReadByte();
                        race_time = ReadInt24_t();
                        race_previousbesttime = ReadInt24_t();
+                       race_mypreviousbesttime = ReadInt24_t();
                        if(race_previousbestname)
                                strunzone(race_previousbestname);
-                       race_previousbestname = strzone(ReadString());
-
-                       race_checkpointtime = time;
-
-                       if(race_checkpoint == 0 || race_checkpoint == 254)
+                       string pbestname = ReadString();
+                       if(autocvar_cl_race_cptimes_onlyself)
                        {
-                               race_penaltyaccumulator = 0;
-                               race_laptime = time; // valid
+                               race_previousbesttime = race_mypreviousbesttime;
+                               race_mypreviousbesttime = 0;
+                               race_previousbestname = strzone("");
                        }
-                       break;
-               case RACE_NET_CHECKPOINT_HIT_SELF_QUALIFYING:
-                       race_checkpoint = ReadByte();
-                       race_time = ReadInt24_t();
-                       race_previousbesttime = ReadInt24_t();
-                       if(race_previousbestname)
-                               strunzone(race_previousbestname);
-                       race_previousbestname = strzone(""); // handled by MakeRaceString
+                       else
+                               race_previousbestname = strzone(pbestname);
 
                        race_checkpointtime = time;
 
@@ -1077,18 +1084,19 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        race_nextcheckpoint = ReadByte();
 
                        race_nextbesttime = 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);
-                       race_nextbestname = strzone(ReadString());
-                       break;
-
-               case RACE_NET_CHECKPOINT_NEXT_SELF_QUALIFYING:
-                       race_nextcheckpoint = ReadByte();
-
-                       race_nextbesttime = ReadInt24_t();
-                       if(race_nextbestname)
-                               strunzone(race_nextbestname);
-                       race_nextbestname = strzone(""); // handled by MakeRaceString
+                       string newname = ReadString();
+                       if(autocvar_cl_race_cptimes_onlyself && b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING)
+                       {
+                               race_nextbesttime = race_mybesttime;
+                               race_mybesttime = 0;
+                               race_nextbestname = strzone("");
+                       }
+                       else
+                               race_nextbestname = strzone(newname);
                        break;
 
                case RACE_NET_CHECKPOINT_HIT_RACE: