// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
-//#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
+//#define STRUCT_FROM_LINK(l,t,m) ((t *)((qbyte *)l - (int)&(((t *)0)->m)))
-#define EDICT_FROM_AREA(l) ((edict_t *)((byte *)l - (int)&(((edict_t *)0)->area)))
+#define EDICT_FROM_AREA(l) ((edict_t *)((qbyte *)l - (int)&(((edict_t *)0)->area)))
//============================================================================
for (i=0 ; i<6 ; i++)
{
box_clipnodes[i].planenum = i;
-
+
side = i&1;
-
+
box_clipnodes[i].children[side] = CONTENTS_EMPTY;
if (i != 5)
box_clipnodes[i].children[side^1] = i + 1;
else
box_clipnodes[i].children[side^1] = CONTENTS_SOLID;
-
+
box_planes[i].type = i>>1;
box_planes[i].normal[i>>1] = 1;
}
-
}
if (ent->area.prev)
SV_UnlinkEdict (ent); // unlink from old position
-
+
if (ent == sv.edicts)
return; // don't add the world
VectorAdd (trace.endpos, offset, trace.endpos);
trace.ent = ent;
}
- else if (trace.startsolid)
+ else if (trace.allsolid || trace.startsolid)
trace.ent = ent;
return trace;
edict_t *touch;
trace_t trace;
+loc0:
if (clip->trace.allsolid)
return;
-loc0:
// touch linked edicts
for (l = node->solid_edicts.next ; l != &node->solid_edicts ; l = next)
{
if (PROG_TO_EDICT(clip->passedict->v.owner) == touch)
continue; // don't clip against owner
// LordHavoc: corpse code
- if (clip->passedict->v.solid == SOLID_CORPSE && touch->v.solid == SOLID_SLIDEBOX)
+ if (clip->passedict->v.solid == SOLID_CORPSE && (touch->v.solid == SOLID_SLIDEBOX || touch->v.solid == SOLID_CORPSE))
continue;
if (clip->passedict->v.solid == SOLID_SLIDEBOX && touch->v.solid == SOLID_CORPSE)
continue;
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, clip->maxs2, clip->end);
else
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, clip->maxs, clip->end);
- if (trace.allsolid || trace.startsolid || trace.fraction < clip->trace.fraction)
+ // LordHavoc: take the 'best' answers from the new trace and combine with existing data
+ if (trace.allsolid)
+ clip->trace.allsolid = true;
+ if (trace.startsolid)
+ {
+ clip->trace.startsolid = true;
+ if (!clip->trace.ent)
+ clip->trace.ent = trace.ent;
+ }
+ if (trace.inopen)
+ clip->trace.inopen = true;
+ if (trace.inwater)
+ clip->trace.inwater = true;
+ if (trace.fraction < clip->trace.fraction)
{
- trace.ent = touch;
- if (clip->trace.startsolid)
+ clip->trace.fraction = trace.fraction;
+ VectorCopy(trace.endpos, clip->trace.endpos);
+ clip->trace.plane = trace.plane;
+ clip->trace.endcontents = trace.endcontents;
+ clip->trace.ent = trace.ent;
+ }
+ /*
+ if (trace.allsolid)
+ {
+ clip->trace = trace;
+ return;
+ }
+ if (trace.startsolid || trace.fraction < clip->trace.fraction)
+ {
+ if (clip->trace.startsolid)
{
clip->trace = trace;
clip->trace.startsolid = true;
else
clip->trace = trace;
}
- if (clip->trace.allsolid)
- return;
+ */
}
// recurse down both sides
clip.trace = SV_ClipMoveToEntity (sv.edicts, start, mins, maxs, end);
// clip to entities
- if (!clip.trace.allsolid)
+ //if (!clip.trace.allsolid)
{
// create the bounding box of the entire move
SV_MoveBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );