]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_subs.qc
Merge branch 'master' into terencehill/dynamic_hud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_subs.qc
index ecba3669a389e60df7a3bfdfea89efae2b45fccf..97450cd4ca107333c5255e9e024d26f4bc6f5a13 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "antilag.qh"
 #include "command/common.qh"
+#include "../common/state.qh"
 #include "../lib/warpzone/common.qh"
 #include "../common/triggers/subs.qh"
 
@@ -49,11 +50,11 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
        if (lag)
        {
                // take players back into the past
-               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_takeback(it, time - lag)));
-               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_takeback(it, CS(it), time - lag));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
                        if(it != forent)
-                               antilag_takeback(it, time - lag);
-               ));
+                               antilag_takeback(it, it, time - lag);
+               });
        }
 
        // do the trace
@@ -65,11 +66,11 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
        // restore players to current positions
        if (lag)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_restore(it)));
-               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
-                       if(it != forent)
-                               antilag_restore(it);
-               ));
+               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_restore(it, CS(it)));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+                       if (it != forent)
+                               antilag_restore(it, it);
+               });
        }
 
        // restore shooter solid type
@@ -235,11 +236,9 @@ vector findbetterlocation (vector org, float mindist)
 
 float LOD_customize()
 {SELFPARAM();
-       float d;
-
        if(autocvar_loddebug)
        {
-               d = autocvar_loddebug;
+               int d = autocvar_loddebug;
                if(d == 1)
                        self.modelindex = self.lodmodelindex0;
                else if(d == 2 || !self.lodmodelindex2)
@@ -250,10 +249,10 @@ float LOD_customize()
        }
 
        // TODO csqc network this so it only gets sent once
-       d = vlen(NearestPointOnBox(self, other.origin) - other.origin);
-       if(d < self.loddistance1)
+       vector near_point = NearestPointOnBox(self, other.origin);
+       if(vdist(near_point - other.origin, <, self.loddistance1))
                self.modelindex = self.lodmodelindex0;
-       else if(!self.lodmodelindex2 || d < self.loddistance2)
+       else if(!self.lodmodelindex2 || vdist(near_point - other.origin, <, self.loddistance2))
                self.modelindex = self.lodmodelindex1;
        else
                self.modelindex = self.lodmodelindex2;