#include "g_subs.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "antilag.qh"
#include "command/common.qh"
#include "../common/state.qh"
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)
}
void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
}
void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, false);
}
}
void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
WarpZone_traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
}
void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, true);
}
*/
vector findbetterlocation (vector org, float mindist)
{
- vector loc;
- vector vec;
- float c, h;
-
- vec = mindist * '1 0 0';
- c = 0;
+ vector vec = mindist * '1 0 0';
+ int c = 0;
while (c < 6)
{
traceline (org, org + vec, true, NULL);
vec = vec * -1;
if (trace_fraction < 1)
{
- loc = trace_endpos;
+ vector loc = trace_endpos;
traceline (loc, loc + vec, true, NULL);
if (trace_fraction >= 1)
org = loc + vec;
}
if (c & 1)
{
- h = vec.y;
+ float h = vec.y;
vec.y = vec.x;
vec.x = vec.z;
vec.z = h;