]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_subs.qc
Remove uses of Static_Team_ColorName
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_subs.qc
index 871a20bbda648d2c7019644bef46f40a0b3fb412..723087a96380634bb539a613145338aa2c96d571 100644 (file)
@@ -1,5 +1,12 @@
+#include "g_subs.qh"
+#include "_all.qh"
+
+#include "antilag.qh"
+#include "command/common.qh"
+#include "../warpzonelib/common.qh"
+
 void spawnfunc_info_null (void)
-{
+{SELFPARAM();
        remove(self);
        // if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately.
 }
@@ -9,22 +16,22 @@ void setanim(entity e, vector anim, float looping, float override, float restart
        if (!anim)
                return; // no animation was given to us! We can't use this.
 
-       if (anim_x == e.animstate_startframe)
-       if (anim_y == e.animstate_numframes)
-       if (anim_z == e.animstate_framerate)
+       if (anim.x == e.animstate_startframe)
+       if (anim.y == e.animstate_numframes)
+       if (anim.z == e.animstate_framerate)
        {
                if(restart)
                {
                        if(restart > 0)
-                       if(anim_y == 1) // ZYM animation
+                       if(anim.y == 1) // ZYM animation
                                BITXOR_ASSIGN(e.effects, EF_RESTARTANIM_BIT);
                }
                else
                        return;
        }
-       e.animstate_startframe = anim_x;
-       e.animstate_numframes = anim_y;
-       e.animstate_framerate = anim_z;
+       e.animstate_startframe = anim.x;
+       e.animstate_numframes = anim.y;
+       e.animstate_framerate = anim.z;
        e.animstate_starttime = servertime - 0.1 * serverframetime; // shift it a little bit into the past to prevent float inaccuracy hiccups
        e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate;
        e.animstate_looping = looping;
@@ -42,13 +49,12 @@ void updateanim(entity e)
                        e.animstate_starttime = e.animstate_endtime;
                        e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate;
                }
-               e.animstate_override = FALSE;
+               e.animstate_override = false;
        }
        e.frame = e.animstate_startframe + bound(0, (time - e.animstate_starttime) * e.animstate_framerate, e.animstate_numframes - 1);
        //print(ftos(time), " -> ", ftos(e.frame), "\n");
 }
 
-
 /*
 ==================
 main
@@ -119,7 +125,7 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
 }
 void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, FALSE);
+       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, false);
 }
 void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
@@ -131,11 +137,11 @@ void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2
 {
        if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
                lag = 0;
-       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, FALSE);
+       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, false);
 }
 void WarpZone_traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, TRUE);
+       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, true);
 }
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
@@ -147,7 +153,7 @@ void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma,
 {
        if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
                lag = 0;
-       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, TRUE);
+       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, true);
 }
 
 float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity) // returns the number of traces done, for benchmarking
@@ -166,7 +172,7 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon
        float c;
        c = 0;
 
-       for(;;)
+       for (;;)
        {
                if(pos * dir >= v2 * dir)
                {
@@ -181,10 +187,10 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon
 
                if(c == 50)
                {
-                       dprint("HOLY SHIT! When tracing from ", vtos(v1), " to ", vtos(v2), "\n");
-                       dprint("  Nudging gets us nowhere at ", vtos(pos), "\n");
-                       dprint("  trace_endpos is ", vtos(trace_endpos), "\n");
-                       dprint("  trace distance is ", ftos(vlen(pos - trace_endpos)), "\n");
+                       LOG_TRACE("HOLY SHIT! When tracing from ", vtos(v1), " to ", vtos(v2), "\n");
+                       LOG_TRACE("  Nudging gets us nowhere at ", vtos(pos), "\n");
+                       LOG_TRACE("  trace_endpos is ", vtos(trace_endpos), "\n");
+                       LOG_TRACE("  trace distance is ", ftos(vlen(pos - trace_endpos)), "\n");
                }
 
                stopentity = trace_ent;
@@ -252,21 +258,21 @@ vector findbetterlocation (vector org, float mindist)
        c = 0;
        while (c < 6)
        {
-               traceline (org, org + vec, TRUE, world);
+               traceline (org, org + vec, true, world);
                vec = vec * -1;
                if (trace_fraction < 1)
                {
                        loc = trace_endpos;
-                       traceline (loc, loc + vec, TRUE, world);
+                       traceline (loc, loc + vec, true, world);
                        if (trace_fraction >= 1)
                                org = loc + vec;
                }
                if (c & 1)
                {
-                       h = vec_y;
-                       vec_y = vec_x;
-                       vec_x = vec_z;
-                       vec_z = h;
+                       h = vec.y;
+                       vec.y = vec.x;
+                       vec.x = vec.z;
+                       vec.z = h;
                }
                c = c + 1;
        }
@@ -274,60 +280,8 @@ vector findbetterlocation (vector org, float mindist)
        return org;
 }
 
-/*
-==================
-crandom
-
-Returns a random number between -1.0 and 1.0
-==================
-*/
-float crandom (void)
-{
-       return 2 * (random () - 0.5);
-}
-
-/*
-==================
-Angc used for animations
-==================
-*/
-
-
-float angc (float a1, float a2)
-{
-       float   a;
-
-       while (a1 > 180)
-               a1 = a1 - 360;
-       while (a1 < -179)
-               a1 = a1 + 360;
-
-       while (a2 > 180)
-               a2 = a2 - 360;
-       while (a2 < -179)
-               a2 = a2 + 360;
-
-       a = a1 - a2;
-       while (a > 180)
-               a = a - 360;
-       while (a < -179)
-               a = a + 360;
-
-       return a;
-}
-
-.string lodtarget1;
-.string lodtarget2;
-.string lodmodel1;
-.string lodmodel2;
-.float lodmodelindex0;
-.float lodmodelindex1;
-.float lodmodelindex2;
-.float loddistance1;
-.float loddistance2;
-
 float LOD_customize()
-{
+{SELFPARAM();
        float d;
 
        if(autocvar_loddebug)
@@ -339,7 +293,7 @@ float LOD_customize()
                        self.modelindex = self.lodmodelindex1;
                else // if(d == 3)
                        self.modelindex = self.lodmodelindex2;
-               return TRUE;
+               return true;
        }
 
        // TODO csqc network this so it only gets sent once
@@ -351,16 +305,16 @@ float LOD_customize()
        else
                self.modelindex = self.lodmodelindex2;
 
-       return TRUE;
+       return true;
 }
 
 void LOD_uncustomize()
-{
+{SELFPARAM();
        self.modelindex = self.lodmodelindex0;
 }
 
 void LODmodel_attach()
-{
+{SELFPARAM();
        entity e;
 
        if(!self.loddistance1)
@@ -400,13 +354,13 @@ void LODmodel_attach()
                ma = self.maxs;
 
                precache_model(self.lodmodel1);
-               setmodel(self, self.lodmodel1);
+               _setmodel(self, self.lodmodel1);
                self.lodmodelindex1 = self.modelindex;
 
                if(self.lodmodel2 != "")
                {
                        precache_model(self.lodmodel2);
-                       setmodel(self, self.lodmodel2);
+                       _setmodel(self, self.lodmodel2);
                        self.lodmodelindex2 = self.modelindex;
                }
 
@@ -420,25 +374,25 @@ void LODmodel_attach()
 }
 
 void ApplyMinMaxScaleAngles(entity e)
-{
-       if(e.angles_x != 0 || e.angles_z != 0 || self.avelocity_x != 0 || self.avelocity_z != 0) // "weird" rotation
+{SELFPARAM();
+       if(e.angles.x != 0 || e.angles.z != 0 || self.avelocity.x != 0 || self.avelocity.z != 0) // "weird" rotation
        {
                e.maxs = '1 1 1' * vlen(
-                       '1 0 0' * max(-e.mins_x, e.maxs_x) +
-                       '0 1 0' * max(-e.mins_y, e.maxs_y) +
-                       '0 0 1' * max(-e.mins_z, e.maxs_z)
+                       '1 0 0' * max(-e.mins.x, e.maxs.x) +
+                       '0 1 0' * max(-e.mins.y, e.maxs.y) +
+                       '0 0 1' * max(-e.mins.z, e.maxs.z)
                );
                e.mins = -e.maxs;
        }
-       else if(e.angles_y != 0 || self.avelocity_y != 0) // yaw only is a bit better
+       else if(e.angles.y != 0 || self.avelocity.y != 0) // yaw only is a bit better
        {
                e.maxs_x = vlen(
-                       '1 0 0' * max(-e.mins_x, e.maxs_x) +
-                       '0 1 0' * max(-e.mins_y, e.maxs_y)
+                       '1 0 0' * max(-e.mins.x, e.maxs.x) +
+                       '0 1 0' * max(-e.mins.y, e.maxs.y)
                );
-               e.maxs_y = e.maxs_x;
-               e.mins_x = -e.maxs_x;
-               e.mins_y = -e.maxs_x;
+               e.maxs_y = e.maxs.x;
+               e.mins_x = -e.maxs.x;
+               e.mins_y = -e.maxs.x;
        }
        if(e.scale)
                setsize(e, e.mins * e.scale, e.maxs * e.scale);
@@ -447,7 +401,7 @@ void ApplyMinMaxScaleAngles(entity e)
 }
 
 void SetBrushEntityModel()
-{
+{SELFPARAM();
        if(self.model != "")
        {
                precache_model(self.model);
@@ -455,11 +409,11 @@ void SetBrushEntityModel()
                {
                        vector mi = self.mins;
                        vector ma = self.maxs;
-                       setmodel(self, self.model); // no precision needed
+                       _setmodel(self, self.model); // no precision needed
                        setsize(self, mi, ma);
                }
                else
-                       setmodel(self, self.model); // no precision needed
+                       _setmodel(self, self.model); // no precision needed
                InitializeEntity(self, LODmodel_attach, INITPRIO_FINDTARGET);
        }
        setorigin(self, self.origin);
@@ -467,7 +421,7 @@ void SetBrushEntityModel()
 }
 
 void SetBrushEntityModelNoLOD()
-{
+{SELFPARAM();
        if(self.model != "")
        {
                precache_model(self.model);
@@ -475,11 +429,11 @@ void SetBrushEntityModelNoLOD()
                {
                        vector mi = self.mins;
                        vector ma = self.maxs;
-                       setmodel(self, self.model); // no precision needed
+                       _setmodel(self, self.model); // no precision needed
                        setsize(self, mi, ma);
                }
                else
-                       setmodel(self, self.model); // no precision needed
+                       _setmodel(self, self.model); // no precision needed
        }
        setorigin(self, self.origin);
        ApplyMinMaxScaleAngles(self);
@@ -492,7 +446,7 @@ InitTrigger
 */
 
 void SetMovedir()
-{
+{SELFPARAM();
        if (self.movedir != '0 0 0')
                self.movedir = normalize(self.movedir);
        else
@@ -505,7 +459,7 @@ void SetMovedir()
 }
 
 void InitTrigger()
-{
+{SELFPARAM();
 // trigger angles are used for one-way touches.  An angle of 0 is assumed
 // to mean no restrictions, so use a yaw of 360 instead.
        SetMovedir ();
@@ -517,7 +471,7 @@ void InitTrigger()
 }
 
 void InitSolidBSPTrigger()
-{
+{SELFPARAM();
 // trigger angles are used for one-way touches.  An angle of 0 is assumed
 // to mean no restrictions, so use a yaw of 360 instead.
        SetMovedir ();
@@ -529,7 +483,7 @@ void InitSolidBSPTrigger()
 }
 
 float InitMovingBrushTrigger()
-{
+{SELFPARAM();
 // trigger angles are used for one-way touches.  An angle of 0 is assumed
 // to mean no restrictions, so use a yaw of 360 instead.
        self.solid = SOLID_BSP;