if(autocvar_g_antilag == 0 || noantilag)
lag = 0; // only do hitscan, but no antilag
if(lag)
- {
- FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_takeback(it, CS(it), time - lag));
- IL_EACH(g_monsters, it != actor,
- {
- antilag_takeback(it, it, time - lag);
- });
- }
+ antilag_takeback_all(actor, lag);
while(head)
{
}
if(lag)
- {
- FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_restore(it, CS(it)));
- IL_EACH(g_monsters, it != actor,
- {
- antilag_restore(it, it);
- });
- }
+ antilag_restore_all(actor);
}
METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
}
store.antilag_index = ANTILAG_MAX_ORIGINS - 1; // next one is 0
}
+
+// TODO: use a single intrusive list across all antilagged entities
+void antilag_takeback_all(entity ignore, float lag)
+{
+ FOREACH_CLIENT(IS_PLAYER(it) && it != ignore, antilag_takeback(it, CS(it), time - lag));
+ IL_EACH(g_monsters, it != ignore,
+ {
+ antilag_takeback(it, it, time - lag);
+ });
+ IL_EACH(g_projectiles, it != ignore && it.classname == "nade",
+ {
+ antilag_takeback(it, it, time - lag);
+ });
+}
+
+void antilag_restore_all(entity ignore)
+{
+ FOREACH_CLIENT(IS_PLAYER(it) && it != ignore, antilag_restore(it, CS(it)));
+ IL_EACH(g_monsters, it != ignore,
+ {
+ antilag_restore(it, it);
+ });
+ IL_EACH(g_projectiles, it != ignore && it.classname == "nade",
+ {
+ antilag_restore(it, it);
+ });
+}
void antilag_restore(entity e, entity store);
void antilag_clear(entity e, entity store);
+void antilag_takeback_all(entity ignore, float lag);
+void antilag_restore_all(entity ignore);
+
.float antilag_debug;
#define ANTILAG_LATENCY(e) min(0.4, CS(e).ping * 0.001)
source.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
if (lag)
- {
- // take players back into the past
- FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_takeback(it, CS(it), time - lag));
- IL_EACH(g_monsters, it != forent,
- {
- antilag_takeback(it, it, time - lag);
- });
- }
+ antilag_takeback_all(forent, lag);
// do the trace
if(wz)
// restore players to current positions
if (lag)
- {
- FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_restore(it, CS(it)));
- IL_EACH(g_monsters, it != forent,
- {
- antilag_restore(it, it);
- });
- }
+ antilag_restore_all(forent);
// restore shooter solid type
if(source)
{
antilag_record(it, it, altime);
});
+ IL_EACH(g_projectiles, it.classname == "nade",
+ {
+ antilag_record(it, it, altime);
+ });
systems_update();
IL_ENDFRAME();
}
if(autocvar_g_antilag == 0 || noantilag)
lag = 0; // only do hitscan, but no antilag
if(lag)
- {
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_takeback(it, CS(it), time - lag));
- IL_EACH(g_monsters, it != this,
- {
- antilag_takeback(it, it, time - lag);
- });
- }
+ antilag_takeback_all(this, lag);
// change shooter to SOLID_BBOX so the shot can hit corpses
int oldsolid = this.dphitcontentsmask;
}
if(lag)
- {
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_restore(it, CS(it)));
- IL_EACH(g_monsters, it != this,
- {
- antilag_restore(it, it);
- });
- }
+ antilag_restore_all(this);
// restore shooter solid type
if(this)