Added fractional antilerp, and fixed a bug in the antilag stuff (potential showstopper).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3445 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-11-13 16:54:21 +00:00
parent 25b5732ec7
commit 14ed1fe230
3 changed files with 20 additions and 9 deletions

View file

@ -399,8 +399,9 @@ typedef struct client_s
double connection_started; // or time of disconnect for zombies
qboolean send_message; // set on frames a datagram arived on
laggedentinfo_t laggedents[MAX_CLIENTS];
unsigned int laggedents_count;
laggedentinfo_t laggedents[MAX_CLIENTS];
unsigned int laggedents_count;
float laggedents_frac;
// spawn parms are carried from level to level
float spawn_parms[NUM_SPAWN_PARMS];
@ -895,6 +896,7 @@ typedef enum multicast_e
extern cvar_t sv_mintic, sv_maxtic;
extern cvar_t sv_maxspeed;
extern cvar_t sv_antilag;
extern cvar_t sv_antilag_frac;
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server

View file

@ -45,6 +45,7 @@ cvar_t sv_spectalk = SCVAR("sv_spectalk", "1");
cvar_t sv_mapcheck = SCVAR("sv_mapcheck", "1");
cvar_t sv_antilag = SCVARF("sv_antilag", "0", CVAR_SERVERINFO);
cvar_t sv_antilag_frac = SCVARF("sv_antilag_frac", "1", CVAR_SERVERINFO);
cvar_t sv_cheatpc = SCVAR("sv_cheatpc", "125");
cvar_t sv_cheatspeedchecktime = SCVAR("sv_cheatspeedchecktime", "30");
cvar_t sv_playermodelchecks = SCVAR("sv_playermodelchecks", "1");
@ -5542,6 +5543,8 @@ void SV_ExecuteClientMessage (client_t *cl)
VectorCopy(frame->playerpositions[i], cl->laggedents[i].laggedpos);
}
cl->laggedents_count = sv.allocated_client_slots;
cl->laggedents_frac = sv_antilag_frac.value;
}
else
cl->laggedents_count = 0;
@ -6175,6 +6178,7 @@ void SV_UserInit (void)
Cvar_Register (&sv_mapcheck, cvargroup_servercontrol);
Cvar_Register (&sv_antilag, cvargroup_servercontrol);
Cvar_Register (&sv_antilag_frac, cvargroup_servercontrol);
Cvar_Register (&sv_cheatpc, cvargroup_servercontrol);
Cvar_Register (&sv_cheatspeedchecktime, cvargroup_servercontrol);
Cvar_Register (&sv_playermodelchecks, cvargroup_servercontrol);

View file

@ -1865,6 +1865,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
clip.type |= MOVE_LAGGED;
w->lagents = svs.clients[passedict->entnum-1].laggedents;
w->maxlagents = svs.clients[passedict->entnum-1].laggedents_count;
w->lagentsfrac = svs.clients[passedict->entnum-1].laggedents_frac;
}
else if (passedict->v->owner)
{
@ -1873,6 +1874,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
clip.type |= MOVE_LAGGED;
w->lagents = svs.clients[passedict->v->owner-1].laggedents;
w->maxlagents = svs.clients[passedict->v->owner-1].laggedents_count;
w->lagentsfrac = svs.clients[passedict->v->owner-1].laggedents_frac;
}
}
}
@ -1880,6 +1882,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
{
trace_t trace;
wedict_t *touch;
vec3_t lp;
World_ClipToLinks (w, w->areanodes, &clip );
@ -1914,12 +1917,14 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
continue;
}
if (clip.boxmins[0] > touch->v->absmax[0]
|| clip.boxmins[1] > touch->v->absmax[1]
|| clip.boxmins[2] > touch->v->absmax[2]
|| clip.boxmaxs[0] < touch->v->absmin[0]
|| clip.boxmaxs[1] < touch->v->absmin[1]
|| clip.boxmaxs[2] < touch->v->absmin[2] )
VectorInterpolate(touch->v->origin, w->lagentsfrac, w->lagents[i].laggedpos, lp);
if (clip.boxmins[0] > lp[0]+touch->v->maxs[0]
|| clip.boxmins[1] > lp[1]+touch->v->maxs[1]
|| clip.boxmins[2] > lp[2]+touch->v->maxs[2]
|| clip.boxmaxs[0] < lp[0]+touch->v->mins[0]
|| clip.boxmaxs[1] < lp[1]+touch->v->mins[1]
|| clip.boxmaxs[2] < lp[2]+touch->v->mins[2] )
continue;
if (clip.passedict && clip.passedict->v->size[0] && !touch->v->size[0])
@ -1933,7 +1938,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
continue; // don't clip against owner
}
trace = World_ClipMoveToEntity (w, touch, w->lagents[i].laggedpos, clip.start, clip.mins, clip.maxs, clip.end, clip.hullnum, clip.type & MOVE_HITMODEL);
trace = World_ClipMoveToEntity (w, touch, lp, clip.start, clip.mins, clip.maxs, clip.end, clip.hullnum, clip.type & MOVE_HITMODEL);
if (trace.allsolid || trace.startsolid || trace.fraction < clip.trace.fraction)
{