Reworked networking a little, separating out common code for separate server/master processes.

Reworked glsl bones, so they work based upon the shader's version instead of the driver's version (more robust).
Fix te_teleport shader.
Track angles for antilag.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5372 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-12-28 00:04:36 +00:00
parent 18280be6e9
commit c6ed692871
56 changed files with 2026 additions and 964 deletions

View file

@ -1241,7 +1241,7 @@ Handles selection or creation of a clipping hull, and offseting (and
eventually rotation) of the end points
==================
*/
static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int hullnum, qboolean hitmodel, qboolean capsule, unsigned int hitcontentsmask) //hullnum overrides min/max for q1 style bsps
static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, vec3_t eang, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int hullnum, qboolean hitmodel, qboolean capsule, unsigned int hitcontentsmask) //hullnum overrides min/max for q1 style bsps
{
trace_t trace;
model_t *model;
@ -1285,16 +1285,16 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
if (ent->v->solid == SOLID_PORTAL)
{
//solid_portal cares only about origins and as such has no mins/max
World_TransformedTrace(model, 0, &framestate, start, end, vec3_origin, vec3_origin, capsule, &trace, eorg, ent->v->angles, hitcontentsmask);
World_TransformedTrace(model, 0, &framestate, start, end, vec3_origin, vec3_origin, capsule, &trace, eorg, eang, hitcontentsmask);
if (trace.startsolid) //portals should not block traces. this prevents infinite looping
trace.startsolid = false;
hitmodel = false;
}
else if (ent->v->solid != SOLID_BSP)
{
ent->v->angles[0]*=r_meshpitch.value; //carmack made bsp models rotate wrongly.
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, ent->v->angles, hitcontentsmask);
ent->v->angles[0]*=r_meshpitch.value;
eang[0]*=r_meshpitch.value; //carmack made bsp models rotate wrongly.
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, hitcontentsmask);
eang[0]*=r_meshpitch.value;
}
else
{
@ -1315,7 +1315,7 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
}
if (hitcontentsmask & forcedcontents)
{
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, ent->v->angles, ~0u);
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, ~0u);
if (trace.contents)
trace.contents = forcedcontents;
}
@ -1330,7 +1330,7 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
}
}
else
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, ent->v->angles, hitcontentsmask);
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, hitcontentsmask);
}
// if using hitmodel, we know it hit the bounding box, so try a proper trace now.
@ -1342,7 +1342,7 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
if (model && model->funcs.NativeTrace && model->loadstate == MLS_LOADED)
{
//do the second trace, using the actual mesh.
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, ent->v->angles, hitcontentsmask);
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, hitcontentsmask);
}
}
@ -1687,9 +1687,9 @@ void WorldQ2_ClipMoveToEntities (world_t *w, moveclip_t *clip )
angles = vec3_origin; // boxes don't rotate
if (touch->svflags & SVF_MONSTER)
World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins2, clip->maxs2, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
World_TransformedTrace (model, 0, NULL, clip->start, clip->end, clip->mins2, clip->maxs2, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
else
World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins, clip->maxs, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
World_TransformedTrace (model, 0, NULL, clip->start, clip->end, clip->mins, clip->maxs, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
if (trace.allsolid || trace.startsolid ||
trace.fraction < clip->trace.fraction)
@ -1875,9 +1875,9 @@ static void World_ClipToEverything (world_t *w, moveclip_t *clip)
}
if ((int)touch->v->flags & FL_MONSTER)
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, clip->start, clip->mins2, clip->maxs2, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, touch->v->angles, clip->start, clip->mins2, clip->maxs2, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
else
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, clip->start, clip->mins, clip->maxs, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, touch->v->angles, clip->start, clip->mins, clip->maxs, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
if (trace.allsolid || trace.startsolid ||
trace.fraction < clip->trace.fraction)
{
@ -2034,9 +2034,9 @@ static void World_ClipToLinks (world_t *w, areagridlink_t *node, moveclip_t *cli
}
if ((int)touch->v->flags & FL_MONSTER)
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, clip->start, clip->mins2, clip->maxs2, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, touch->v->angles, clip->start, clip->mins2, clip->maxs2, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
else
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, clip->start, clip->mins, clip->maxs, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
trace = World_ClipMoveToEntity (w, touch, touch->v->origin, touch->v->angles, clip->start, clip->mins, clip->maxs, clip->end, clip->hullnum, clip->type & MOVE_HITMODEL, clip->capsule, clip->hitcontentsmask);
if (trace.fraction < clip->trace.fraction)
{
@ -2561,18 +2561,18 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
if (type & MOVE_OTHERONLY)
{
wedict_t *other = WEDICT_NUM_UB(w->progs, *w->g.other);
return World_ClipMoveToEntity (w, other, other->v->origin, start, mins, maxs, end, hullnum, type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
return World_ClipMoveToEntity (w, other, other->v->origin, other->v->angles, start, mins, maxs, end, hullnum, type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
}
#ifndef NOLEGACY
if ((type&MOVE_WORLDONLY) == MOVE_WORLDONLY)
{ //for compat with DP
wedict_t *other = w->edicts;
return World_ClipMoveToEntity (w, other, other->v->origin, start, mins, maxs, end, hullnum, type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
return World_ClipMoveToEntity (w, other, other->v->origin, other->v->angles, start, mins, maxs, end, hullnum, type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
}
#endif
// clip to world
clip.trace = World_ClipMoveToEntity (w, w->edicts, w->edicts->v->origin, start, mins, maxs, end, hullnum, false, clip.capsule, clip.hitcontentsmask);
clip.trace = World_ClipMoveToEntity (w, w->edicts, w->edicts->v->origin, w->edicts->v->angles, start, mins, maxs, end, hullnum, false, clip.capsule, clip.hitcontentsmask);
clip.start = start;
clip.end = end;
@ -2622,6 +2622,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
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;
w->lagentstime = svs.clients[passedict->entnum-1].laggedents_time;
}
else if (passedict->v->owner)
{
@ -2631,6 +2632,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
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;
w->lagentstime = svs.clients[passedict->entnum-1].laggedents_time;
}
}
}
@ -2640,7 +2642,8 @@ 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;
vec3_t lp, la;
int j;
#ifdef USEAREAGRID
World_ClipToAllLinks (w, &clip);
@ -2686,7 +2689,18 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
continue;
}
VectorInterpolate(touch->v->origin, w->lagentsfrac, w->lagents[i].laggedpos, lp);
VectorInterpolate(touch->v->origin, w->lagentsfrac, w->lagents[i].origin, lp);
//I hate working with angles
VectorSubtract(w->lagents[i].angles, touch->v->angles, la);
for (j = 0; j < 3; j++)
{
la[j] = (360.0/65536) * ((int)(la[j]*(65536/360.0)) & 65535);
if (la[j]<-180)
la[j] += 360;
if (la[j]>180)
la[j] -= 360;
}
VectorMA(touch->v->angles, 1, la, la);
if (clip.boxmins[0] > lp[0]+touch->v->maxs[0]
|| clip.boxmins[1] > lp[1]+touch->v->maxs[1]
@ -2707,7 +2721,13 @@ 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, lp, clip.start, clip.mins, clip.maxs, clip.end, clip.hullnum, clip.type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
if ((clip.type & MOVE_HITMODEL) && w->Event_Backdate)
{
w->Event_Backdate(w, touch, w->lagentstime);
trace = World_ClipMoveToEntity (w, touch, lp, la, clip.start, clip.mins, clip.maxs, clip.end, clip.hullnum, clip.type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
}
else
trace = World_ClipMoveToEntity (w, touch, lp, la, clip.start, clip.mins, clip.maxs, clip.end, clip.hullnum, clip.type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
if (trace.allsolid || trace.startsolid || trace.fraction < clip.trace.fraction)
{