#include "antilag.qh"
#include "command/common.qh"
+#include "../common/state.qh"
#include "../lib/warpzone/common.qh"
#include "../common/triggers/subs.qh"
*/
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;
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
// 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
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)
}
// 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;