X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_subs.qc;h=97450cd4ca107333c5255e9e024d26f4bc6f5a13;hb=3f397e7bd1b2f66ebd246c8fa7a23256eedcbda7;hp=f7dcf3073a114b4dbf7078bc9e71cd7f0853c925;hpb=2bb4c42f723576432bb2c80e0afe0a09ec7350f3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index f7dcf3073..97450cd4c 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -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" @@ -35,9 +36,6 @@ Additionally it moves players back into the past before the trace and restores t */ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag, float wz) { - entity player; - float oldsolid; - // check whether antilagged traces are enabled if (lag < 0.001) lag = 0; @@ -45,18 +43,18 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, lag = 0; // only antilag for clients // change shooter to SOLID_BBOX so the shot can hit corpses - oldsolid = source.dphitcontentsmask; + int oldsolid = source.dphitcontentsmask; if(source) source.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE; if (lag) { // take players back into the past - FOR_EACH_PLAYER(player) - if(player != forent) - antilag_takeback(player, time - lag); - FOR_EACH_MONSTER(player) - antilag_takeback(player, time - lag); + 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, it, time - lag); + }); } // do the trace @@ -68,11 +66,11 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, // restore players to current positions if (lag) { - FOR_EACH_PLAYER(player) - if(player != forent) - antilag_restore(player); - FOR_EACH_MONSTER(player) - antilag_restore(player); + 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 @@ -238,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) @@ -253,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;