2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 // world.c -- world query functions
26 entities never clip against themselves, or their owner
28 line of sight checks trace->inopen and trace->inwater, but bullets don't
32 cvar_t sv_debugmove = {CVAR_NOTIFY, "sv_debugmove", "0"};
33 cvar_t sv_polygoncollisions = {CVAR_NOTIFY, "sv_polygoncollisions", "0"};
34 cvar_t sv_areagrid_mingridsize = {CVAR_NOTIFY, "sv_areagrid_mingridsize", "64"};
36 void SV_AreaStats_f(void);
38 void SV_World_Init(void)
40 Cvar_RegisterVariable(&sv_debugmove);
41 Cvar_RegisterVariable(&sv_polygoncollisions);
42 Cvar_RegisterVariable(&sv_areagrid_mingridsize);
43 Cmd_AddCommand("sv_areastats", SV_AreaStats_f);
49 // bounding box of entire move area
50 vec3_t boxmins, boxmaxs;
52 // size of the moving object
55 // size when clipping against monsters
58 // size when clipping against brush models
59 vec3_t hullmins, hullmaxs;
61 // start and end origin of move
67 // type of move (like ignoring monsters, or similar)
70 // the edict that is moving (if any)
75 //============================================================================
77 // ClearLink is used for new headnodes
78 static void ClearLink (link_t *l)
81 l->prev = l->next = l;
84 static void RemoveLink (link_t *l)
86 l->next->prev = l->prev;
87 l->prev->next = l->next;
90 static void InsertLinkBefore (link_t *l, link_t *before, int entitynumber)
92 l->entitynumber = entitynumber;
94 l->prev = before->prev;
101 ===============================================================================
105 ===============================================================================
108 int sv_areagrid_stats_calls = 0;
109 int sv_areagrid_stats_nodechecks = 0;
110 int sv_areagrid_stats_entitychecks = 0;
112 void SV_AreaStats_f(void)
114 Con_Printf("areagrid check stats: %d calls %d nodes (%f per call) %d entities (%f per call)\n", sv_areagrid_stats_calls, sv_areagrid_stats_nodechecks, (double) sv_areagrid_stats_nodechecks / (double) sv_areagrid_stats_calls, sv_areagrid_stats_entitychecks, (double) sv_areagrid_stats_entitychecks / (double) sv_areagrid_stats_calls);
115 sv_areagrid_stats_calls = 0;
116 sv_areagrid_stats_nodechecks = 0;
117 sv_areagrid_stats_entitychecks = 0;
120 typedef struct areagrid_s
122 link_t trigger_edicts;
127 #define AREA_GRID 512
128 #define AREA_GRIDNODES (AREA_GRID * AREA_GRID)
130 static areagrid_t sv_areagrid[AREA_GRIDNODES], sv_areagrid_outside;
131 static vec3_t sv_areagrid_bias, sv_areagrid_scale, sv_areagrid_mins, sv_areagrid_maxs, sv_areagrid_size;
132 static int sv_areagrid_marknumber = 1;
134 void SV_CreateAreaGrid (vec3_t mins, vec3_t maxs)
137 ClearLink (&sv_areagrid_outside.trigger_edicts);
138 ClearLink (&sv_areagrid_outside.solid_edicts);
139 // choose either the world box size, or a larger box to ensure the grid isn't too fine
140 sv_areagrid_size[0] = max(maxs[0] - mins[0], AREA_GRID * sv_areagrid_mingridsize.value);
141 sv_areagrid_size[1] = max(maxs[1] - mins[1], AREA_GRID * sv_areagrid_mingridsize.value);
142 sv_areagrid_size[2] = max(maxs[2] - mins[2], AREA_GRID * sv_areagrid_mingridsize.value);
143 // figure out the corners of such a box, centered at the center of the world box
144 sv_areagrid_mins[0] = (mins[0] + maxs[0] - sv_areagrid_size[0]) * 0.5f;
145 sv_areagrid_mins[1] = (mins[1] + maxs[1] - sv_areagrid_size[1]) * 0.5f;
146 sv_areagrid_mins[2] = (mins[2] + maxs[2] - sv_areagrid_size[2]) * 0.5f;
147 sv_areagrid_maxs[0] = (mins[0] + maxs[0] + sv_areagrid_size[0]) * 0.5f;
148 sv_areagrid_maxs[1] = (mins[1] + maxs[1] + sv_areagrid_size[1]) * 0.5f;
149 sv_areagrid_maxs[2] = (mins[2] + maxs[2] + sv_areagrid_size[2]) * 0.5f;
150 // now calculate the actual useful info from that
151 VectorNegate(sv_areagrid_mins, sv_areagrid_bias);
152 sv_areagrid_scale[0] = AREA_GRID / sv_areagrid_size[0];
153 sv_areagrid_scale[1] = AREA_GRID / sv_areagrid_size[1];
154 sv_areagrid_scale[2] = AREA_GRID / sv_areagrid_size[2];
155 for (i = 0;i < AREA_GRIDNODES;i++)
157 ClearLink (&sv_areagrid[i].trigger_edicts);
158 ClearLink (&sv_areagrid[i].solid_edicts);
160 Con_DPrintf("sv_areagrid settings: divisions %ix%ix1 : box %f %f %f : %f %f %f size %f %f %f grid %f %f %f (mingrid %f)\n", AREA_GRID, AREA_GRID, sv_areagrid_mins[0], sv_areagrid_mins[1], sv_areagrid_mins[2], sv_areagrid_maxs[0], sv_areagrid_maxs[1], sv_areagrid_maxs[2], sv_areagrid_size[0], sv_areagrid_size[1], sv_areagrid_size[2], 1.0f / sv_areagrid_scale[0], 1.0f / sv_areagrid_scale[1], 1.0f / sv_areagrid_scale[2], sv_areagrid_mingridsize.value);
169 void SV_ClearWorld (void)
171 Mod_CheckLoaded(sv.worldmodel);
172 SV_CreateAreaGrid(sv.worldmodel->normalmins, sv.worldmodel->normalmaxs);
182 void SV_UnlinkEdict (edict_t *ent)
185 for (i = 0;i < ENTITYGRIDAREAS;i++)
187 if (ent->e->areagrid[i].prev)
189 RemoveLink (&ent->e->areagrid[i]);
190 ent->e->areagrid[i].prev = ent->e->areagrid[i].next = NULL;
196 void SV_TouchAreaGrid(edict_t *ent)
201 int old_self, old_other, igrid[3], igridmins[3], igridmaxs[3];
203 sv_areagrid_marknumber++;
204 igridmins[0] = (int) ((ent->v->absmin[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
205 igridmins[1] = (int) ((ent->v->absmin[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);
206 //igridmins[2] = (int) ((ent->v->absmin[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]);
207 igridmaxs[0] = (int) ((ent->v->absmax[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]) + 1;
208 igridmaxs[1] = (int) ((ent->v->absmax[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]) + 1;
209 //igridmaxs[2] = (int) ((ent->v->absmax[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]) + 1;
210 igridmins[0] = max(0, igridmins[0]);
211 igridmins[1] = max(0, igridmins[1]);
212 //igridmins[2] = max(0, igridmins[2]);
213 igridmaxs[0] = min(AREA_GRID, igridmaxs[0]);
214 igridmaxs[1] = min(AREA_GRID, igridmaxs[1]);
215 //igridmaxs[2] = min(AREA_GRID, igridmaxs[2]);
217 for (l = sv_areagrid_outside.trigger_edicts.next;l != &sv_areagrid_outside.trigger_edicts;l = next)
220 touch = EDICT_NUM(l->entitynumber);
221 if (ent->v->absmin[0] > touch->v->absmax[0]
222 || ent->v->absmax[0] < touch->v->absmin[0]
223 || ent->v->absmin[1] > touch->v->absmax[1]
224 || ent->v->absmax[1] < touch->v->absmin[1]
225 || ent->v->absmin[2] > touch->v->absmax[2]
226 || ent->v->absmax[2] < touch->v->absmin[2])
230 if (!touch->v->touch || touch->v->solid != SOLID_TRIGGER)
232 old_self = pr_global_struct->self;
233 old_other = pr_global_struct->other;
235 pr_global_struct->self = EDICT_TO_PROG(touch);
236 pr_global_struct->other = EDICT_TO_PROG(ent);
237 pr_global_struct->time = sv.time;
238 PR_ExecuteProgram (touch->v->touch, "");
240 pr_global_struct->self = old_self;
241 pr_global_struct->other = old_other;
244 for (igrid[1] = igridmins[1];igrid[1] < igridmaxs[1];igrid[1]++)
246 grid = sv_areagrid + igrid[1] * AREA_GRID + igridmins[0];
247 for (igrid[0] = igridmins[0];igrid[0] < igridmaxs[0];igrid[0]++, grid++)
249 for (l = grid->trigger_edicts.next;l != &grid->trigger_edicts;l = next)
252 touch = EDICT_NUM(l->entitynumber);
253 if (touch->e->areagridmarknumber == sv_areagrid_marknumber)
255 touch->e->areagridmarknumber = sv_areagrid_marknumber;
256 if (ent->v->absmin[0] > touch->v->absmax[0]
257 || ent->v->absmax[0] < touch->v->absmin[0]
258 || ent->v->absmin[1] > touch->v->absmax[1]
259 || ent->v->absmax[1] < touch->v->absmin[1]
260 || ent->v->absmin[2] > touch->v->absmax[2]
261 || ent->v->absmax[2] < touch->v->absmin[2])
263 // LordHavoc: id bug that won't be fixed: triggers do not ignore their owner like solid objects do
266 if (!touch->v->touch || touch->v->solid != SOLID_TRIGGER)
268 old_self = pr_global_struct->self;
269 old_other = pr_global_struct->other;
271 pr_global_struct->self = EDICT_TO_PROG(touch);
272 pr_global_struct->other = EDICT_TO_PROG(ent);
273 pr_global_struct->time = sv.time;
274 PR_ExecuteProgram (touch->v->touch, "");
276 pr_global_struct->self = old_self;
277 pr_global_struct->other = old_other;
283 void SV_LinkEdict_AreaGrid(edict_t *ent)
286 int igrid[3], igridmins[3], igridmaxs[3], gridnum, entitynumber = NUM_FOR_EDICT(ent);
288 if (entitynumber <= 0 || entitynumber >= sv.max_edicts || EDICT_NUM(entitynumber) != ent)
289 Host_Error("SV_LinkEdict_AreaGrid: invalid edict %p (sv.edicts is %p, edict compared to sv.edicts is %i)\n", ent, sv.edicts, entitynumber);
291 igridmins[0] = (int) ((ent->v->absmin[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
292 igridmins[1] = (int) ((ent->v->absmin[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);
293 //igridmins[2] = (int) ((ent->v->absmin[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]);
294 igridmaxs[0] = (int) ((ent->v->absmax[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]) + 1;
295 igridmaxs[1] = (int) ((ent->v->absmax[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]) + 1;
296 //igridmaxs[2] = (int) ((ent->v->absmax[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]) + 1;
297 if (igridmins[0] < 0 || igridmaxs[0] > AREA_GRID || igridmins[1] < 0 || igridmaxs[1] > AREA_GRID || ((igridmaxs[0] - igridmins[0]) * (igridmaxs[1] - igridmins[1])) > ENTITYGRIDAREAS)
299 // wow, something outside the grid, store it as such
300 if (ent->v->solid == SOLID_TRIGGER)
301 InsertLinkBefore (&ent->e->areagrid[0], &sv_areagrid_outside.trigger_edicts, NUM_FOR_EDICT(ent));
303 InsertLinkBefore (&ent->e->areagrid[0], &sv_areagrid_outside.solid_edicts, NUM_FOR_EDICT(ent));
308 for (igrid[1] = igridmins[1];igrid[1] < igridmaxs[1];igrid[1]++)
310 grid = sv_areagrid + igrid[1] * AREA_GRID + igridmins[0];
311 for (igrid[0] = igridmins[0];igrid[0] < igridmaxs[0];igrid[0]++, grid++, gridnum++)
313 if (ent->v->solid == SOLID_TRIGGER)
314 InsertLinkBefore (&ent->e->areagrid[gridnum], &grid->trigger_edicts, NUM_FOR_EDICT(ent));
316 InsertLinkBefore (&ent->e->areagrid[gridnum], &grid->solid_edicts, NUM_FOR_EDICT(ent));
327 void SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
331 if (ent->e->areagrid[0].prev)
332 SV_UnlinkEdict (ent); // unlink from old position
334 if (ent == sv.edicts)
335 return; // don't add the world
342 if (ent->v->solid == SOLID_BSP)
344 if (ent->v->modelindex < 0 || ent->v->modelindex > MAX_MODELS)
345 Host_Error("SOLID_BSP with invalid modelindex!\n");
346 model = sv.models[(int) ent->v->modelindex];
349 Mod_CheckLoaded(model);
350 if (model->type != mod_brush)
351 Host_Error("SOLID_BSP with non-BSP model\n");
353 if (ent->v->angles[0] || ent->v->angles[2] || ent->v->avelocity[0] || ent->v->avelocity[2])
355 VectorAdd(ent->v->origin, model->rotatedmins, ent->v->absmin);
356 VectorAdd(ent->v->origin, model->rotatedmaxs, ent->v->absmax);
358 else if (ent->v->angles[1] || ent->v->avelocity[1])
360 VectorAdd(ent->v->origin, model->yawmins, ent->v->absmin);
361 VectorAdd(ent->v->origin, model->yawmaxs, ent->v->absmax);
365 VectorAdd(ent->v->origin, model->normalmins, ent->v->absmin);
366 VectorAdd(ent->v->origin, model->normalmaxs, ent->v->absmax);
371 // SOLID_BSP with no model is valid, mainly because some QC setup code does so temporarily
372 VectorAdd(ent->v->origin, ent->v->mins, ent->v->absmin);
373 VectorAdd(ent->v->origin, ent->v->maxs, ent->v->absmax);
378 VectorAdd(ent->v->origin, ent->v->mins, ent->v->absmin);
379 VectorAdd(ent->v->origin, ent->v->maxs, ent->v->absmax);
383 // to make items easier to pick up and allow them to be grabbed off
384 // of shelves, the abs sizes are expanded
386 if ((int)ent->v->flags & FL_ITEM)
388 ent->v->absmin[0] -= 15;
389 ent->v->absmin[1] -= 15;
390 ent->v->absmin[2] -= 1;
391 ent->v->absmax[0] += 15;
392 ent->v->absmax[1] += 15;
393 ent->v->absmax[2] += 1;
397 // because movement is clipped an epsilon away from an actual edge,
398 // we must fully check even when bounding boxes don't quite touch
399 ent->v->absmin[0] -= 1;
400 ent->v->absmin[1] -= 1;
401 ent->v->absmin[2] -= 1;
402 ent->v->absmax[0] += 1;
403 ent->v->absmax[1] += 1;
404 ent->v->absmax[2] += 1;
407 if (ent->v->solid == SOLID_NOT)
410 SV_LinkEdict_AreaGrid(ent);
412 // if touch_triggers, touch all entities at this node and descend for more
414 SV_TouchAreaGrid(ent);
420 ===============================================================================
422 POINT TESTING IN HULLS
424 ===============================================================================
429 SV_TestEntityPosition
431 This could be a lot more efficient...
434 int SV_TestEntityPosition (edict_t *ent)
436 return SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, ent->v->origin, MOVE_NORMAL, ent).startsolid;
441 ===============================================================================
443 LINE TESTING IN HULLS
445 ===============================================================================
452 Handles selection or creation of a clipping hull, and offseting (and
453 eventually rotation) of the end points
456 trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
460 model_t *model = NULL;
462 if ((int) ent->v->solid == SOLID_BSP)
464 i = ent->v->modelindex;
465 if ((unsigned int) i >= MAX_MODELS)
466 Host_Error("SV_ClipMoveToEntity: invalid modelindex\n");
467 model = sv.models[i];
468 if (i != 0 && model == NULL)
469 Host_Error("SV_ClipMoveToEntity: invalid modelindex\n");
471 Mod_CheckLoaded(model);
472 if (model->type != mod_brush)
474 Con_Printf ("SV_ClipMoveToEntity: SOLID_BSP with a non bsp model, entity dump:\n");
476 Host_Error ("SV_ClipMoveToEntity: SOLID_BSP with a non bsp model\n");
478 if (ent->v->movetype != MOVETYPE_PUSH)
479 Host_Error ("SV_ClipMoveToEntity: SOLID_BSP without MOVETYPE_PUSH");
482 if (sv_polygoncollisions.integer && (mins[0] != maxs[0] || mins[1] != maxs[1] || mins[2] != maxs[2]))
483 Collision_PolygonClipTrace(&trace, ent, model, ent->v->origin, ent->v->angles, ent->v->mins, ent->v->maxs, start, mins, maxs, end);
485 Collision_ClipTrace(&trace, ent, model, ent->v->origin, ent->v->angles, ent->v->mins, ent->v->maxs, start, mins, maxs, end);
490 //===========================================================================
492 void SV_ClipToNode(moveclip_t *clip, link_t *list)
498 sv_areagrid_stats_nodechecks++;
499 for (l = list->next;l != list;l = next)
502 touch = EDICT_NUM(l->entitynumber);
503 if (touch->e->areagridmarknumber == sv_areagrid_marknumber)
505 touch->e->areagridmarknumber = sv_areagrid_marknumber;
506 sv_areagrid_stats_entitychecks++;
508 if (clip->boxmins[0] > touch->v->absmax[0]
509 || clip->boxmaxs[0] < touch->v->absmin[0]
510 || clip->boxmins[1] > touch->v->absmax[1]
511 || clip->boxmaxs[1] < touch->v->absmin[1]
512 || clip->boxmins[2] > touch->v->absmax[2]
513 || clip->boxmaxs[2] < touch->v->absmin[2])
516 if (clip->type == MOVE_NOMONSTERS && touch->v->solid != SOLID_BSP)
519 if (touch->v->solid == SOLID_NOT)
524 if (clip->passedict->v->size[0] && !touch->v->size[0])
525 continue; // points never interact
526 if (PROG_TO_EDICT(touch->v->owner) == clip->passedict)
527 continue; // don't clip against own missiles
528 if (PROG_TO_EDICT(clip->passedict->v->owner) == touch)
529 continue; // don't clip against owner
530 // LordHavoc: corpse code
531 if (clip->passedict->v->solid == SOLID_CORPSE && (touch->v->solid == SOLID_SLIDEBOX || touch->v->solid == SOLID_CORPSE))
533 if (clip->passedict->v->solid == SOLID_SLIDEBOX && touch->v->solid == SOLID_CORPSE)
537 if (touch == clip->passedict)
539 if (touch->v->solid == SOLID_TRIGGER)
542 Host_Error ("Trigger in clipping list");
545 // might interact, so do an exact clip
546 if (touch->v->solid == SOLID_BSP)
547 trace = SV_ClipMoveToEntity (touch, clip->start, clip->hullmins, clip->hullmaxs, clip->end);
548 else if ((int)touch->v->flags & FL_MONSTER)
549 trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, clip->maxs2, clip->end);
551 trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, clip->maxs, clip->end);
552 // LordHavoc: take the 'best' answers from the new trace and combine with existing data
554 clip->trace.allsolid = true;
555 if (trace.startsolid)
557 clip->trace.startsolid = true;
558 if (!clip->trace.ent)
559 clip->trace.ent = trace.ent;
562 clip->trace.inopen = true;
564 clip->trace.inwater = true;
565 if (trace.fraction < clip->trace.fraction)
567 clip->trace.fraction = trace.fraction;
568 VectorCopy(trace.endpos, clip->trace.endpos);
569 clip->trace.plane = trace.plane;
570 clip->trace.endcontents = trace.endcontents;
571 clip->trace.ent = trace.ent;
573 if (clip->trace.allsolid)
582 Mins and maxs enclose the entire area swept by the move
585 void SV_ClipToAreaGrid(moveclip_t *clip)
588 int igrid[3], igridmins[3], igridmaxs[3];
590 if (clip->trace.allsolid)
593 sv_areagrid_stats_calls++;
594 sv_areagrid_marknumber++;
595 igridmins[0] = (int) ((clip->boxmins[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
596 igridmins[1] = (int) ((clip->boxmins[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);
597 //igridmins[2] = (int) ((clip->boxmins[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]);
598 igridmaxs[0] = (int) ((clip->boxmaxs[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]) + 1;
599 igridmaxs[1] = (int) ((clip->boxmaxs[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]) + 1;
600 //igridmaxs[2] = (int) ((clip->boxmaxs[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]) + 1;
601 igridmins[0] = max(0, igridmins[0]);
602 igridmins[1] = max(0, igridmins[1]);
603 //igridmins[2] = max(0, igridmins[2]);
604 igridmaxs[0] = min(AREA_GRID, igridmaxs[0]);
605 igridmaxs[1] = min(AREA_GRID, igridmaxs[1]);
606 //igridmaxs[2] = min(AREA_GRID, igridmaxs[2]);
608 if (sv_areagrid_outside.solid_edicts.next != &sv_areagrid_outside.solid_edicts)
609 SV_ClipToNode(clip, &sv_areagrid_outside.solid_edicts);
611 for (igrid[1] = igridmins[1];igrid[1] < igridmaxs[1];igrid[1]++)
612 for (grid = sv_areagrid + igrid[1] * AREA_GRID + igridmins[0], igrid[0] = igridmins[0];igrid[0] < igridmaxs[0];igrid[0]++, grid++)
613 if (grid->solid_edicts.next != &grid->solid_edicts)
614 SV_ClipToNode(clip, &grid->solid_edicts);
623 void SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, vec3_t boxmins, vec3_t boxmaxs)
625 if (!sv_debugmove.integer)
629 for (i=0 ; i<3 ; i++)
631 if (end[i] > start[i])
633 boxmins[i] = start[i] + mins[i] - 1;
634 boxmaxs[i] = end[i] + maxs[i] + 1;
638 boxmins[i] = end[i] + mins[i] - 1;
639 boxmaxs[i] = start[i] + maxs[i] + 1;
645 // debug to test against everything
646 boxmins[0] = boxmins[1] = boxmins[2] = -999999999;
647 boxmaxs[0] = boxmaxs[1] = boxmaxs[2] = 999999999;
656 trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict)
659 vec3_t bigmins, bigmaxs;
662 memset ( &clip, 0, sizeof ( moveclip_t ) );
664 VectorCopy(start, clip.start);
665 VectorCopy(end, clip.end);
666 VectorCopy(mins, clip.mins);
667 VectorCopy(maxs, clip.maxs);
669 clip.passedict = passedict;
671 Collision_RoundUpToHullSize(sv.worldmodel, clip.mins, clip.maxs, clip.hullmins, clip.hullmaxs);
673 if (type == MOVE_MISSILE)
675 // LordHavoc: modified this, was = -15, now = clip.mins[i] - 15
676 for (i=0 ; i<3 ; i++)
678 clip.mins2[i] = clip.mins[i] - 15;
679 clip.maxs2[i] = clip.maxs[i] + 15;
684 VectorCopy (clip.mins, clip.mins2);
685 VectorCopy (clip.maxs, clip.maxs2);
688 bigmins[0] = min(clip.mins2[0], clip.hullmins[0]);
689 bigmaxs[0] = max(clip.maxs2[0], clip.hullmaxs[0]);
690 bigmins[1] = min(clip.mins2[1], clip.hullmins[1]);
691 bigmaxs[1] = max(clip.maxs2[1], clip.hullmaxs[1]);
692 bigmins[2] = min(clip.mins2[2], clip.hullmins[2]);
693 bigmaxs[2] = max(clip.maxs2[2], clip.hullmaxs[2]);
696 clip.trace = SV_ClipMoveToEntity (sv.edicts, start, mins, maxs, end);
699 // create the bounding box of the entire move
700 SV_MoveBounds ( start, bigmins, bigmaxs, end, clip.boxmins, clip.boxmaxs );
702 SV_ClipToAreaGrid(&clip);