Start of support for rotated bboxes. shouldn't do anything yet

This commit is contained in:
Adam Olsen 2001-07-26 00:01:13 +00:00
parent 8fc5e5e372
commit 619b12375c
3 changed files with 30 additions and 18 deletions

View file

@ -148,6 +148,7 @@ typedef struct
int owner; //int int owner; //int
int message; //string_t int message; //string_t
int sounds; //float int sounds; //float
int rotated_bbox; //int
int alpha; int alpha;
int scale; int scale;

View file

@ -253,6 +253,7 @@ SV_LoadProgs (void)
sv_fields.owner = PR_GetFieldOffset (&sv_pr_state, "owner"); sv_fields.owner = PR_GetFieldOffset (&sv_pr_state, "owner");
sv_fields.message = PR_GetFieldOffset (&sv_pr_state, "message"); sv_fields.message = PR_GetFieldOffset (&sv_pr_state, "message");
sv_fields.sounds = PR_GetFieldOffset (&sv_pr_state, "sounds"); sv_fields.sounds = PR_GetFieldOffset (&sv_pr_state, "sounds");
sv_fields.rotated_bbox = ED_GetFieldOffset (&sv_pr_state, "rotated_bbox");
// Zoid, find the spectator functions // Zoid, find the spectator functions
SpectatorConnect = SpectatorThink = SpectatorDisconnect = 0; SpectatorConnect = SpectatorThink = SpectatorDisconnect = 0;

View file

@ -612,8 +612,8 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
eventually rotation) of the end points eventually rotation) of the end points
*/ */
trace_t trace_t
SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, vec3_t start,
vec3_t end) vec3_t mins, vec3_t maxs, vec3_t end)
{ {
trace_t trace; trace_t trace;
vec3_t offset; vec3_t offset;
@ -627,23 +627,33 @@ SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs,
trace.allsolid = true; trace.allsolid = true;
VectorCopy (end, trace.endpos); VectorCopy (end, trace.endpos);
// get the clipping hull if (sv_fields.rotated_bbox != -1
hull = SV_HullForEntity (ent, mins, maxs, offset); && (SVFIELD (mover, rotated_bbox, integer)
|| SVFIELD (touched, rotated_bbox, integer))) {
// get the hull
// get relative start and end locations
// rotate hull(?) and start/end locations
// run the hull check
// unrotate the trace
} else {
// get the clipping hull
hull = SV_HullForEntity (touched, mins, maxs, offset);
VectorSubtract (start, offset, start_l); VectorSubtract (start, offset, start_l);
VectorSubtract (end, offset, end_l); VectorSubtract (end, offset, end_l);
// trace a line through the apropriate clipping hull // trace a line through the apropriate clipping hull
SV_RecursiveHullCheck (hull, hull->firstclipnode, 0, 1, start_l, end_l, SV_RecursiveHullCheck (hull, hull->firstclipnode, 0, 1, start_l, end_l,
&trace); &trace);
// fix trace up by the offset // fix trace up by the offset
if (trace.fraction != 1) if (trace.fraction != 1)
VectorAdd (trace.endpos, offset, trace.endpos); VectorAdd (trace.endpos, offset, trace.endpos);
}
// did we clip the move? // did we clip the move?
if (trace.fraction < 1 || trace.startsolid) if (trace.fraction < 1 || trace.startsolid)
trace.ent = ent; trace.ent = touched;
return trace; return trace;
} }
@ -701,11 +711,11 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip)
} }
if ((int) SVFIELD (touch, flags, float) & FL_MONSTER) if ((int) SVFIELD (touch, flags, float) & FL_MONSTER)
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, trace = SV_ClipMoveToEntity (touch, clip->passedict, clip->start,
clip->maxs2, clip->end); clip->mins2, clip->maxs2, clip->end);
else else
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, trace = SV_ClipMoveToEntity (touch, clip->passedict, clip->start,
clip->maxs, clip->end); clip->mins, clip->maxs, clip->end);
if (trace.allsolid || trace.startsolid if (trace.allsolid || trace.startsolid
|| trace.fraction < clip->trace.fraction) { || trace.fraction < clip->trace.fraction) {
trace.ent = touch; trace.ent = touch;
@ -763,7 +773,7 @@ SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type,
memset (&clip, 0, sizeof (moveclip_t)); memset (&clip, 0, sizeof (moveclip_t));
// clip to world // clip to world
clip.trace = SV_ClipMoveToEntity (sv.edicts, start, mins, maxs, end); clip.trace = SV_ClipMoveToEntity (sv.edicts, passedict, start, mins, maxs, end);
clip.start = start; clip.start = start;
clip.end = end; clip.end = end;