diff --git a/nq/source/world.c b/nq/source/world.c index 70e8f6905..23c5d7dbd 100644 --- a/nq/source/world.c +++ b/nq/source/world.c @@ -56,15 +56,15 @@ static __attribute__ ((unused)) const char rcsid[] = */ typedef struct { - vec3_t boxmins, boxmaxs; // enclose the test object along + vec3_t boxmins, boxmaxs; // enclose the test object along // entire move - const float *mins, *maxs; // size of the moving object - vec3_t mins2, maxs2; // size when clipping against + const float *mins, *maxs; // size of the moving object + vec3_t mins2, maxs2; // size when clipping against // monsters - const float *start, *end; - trace_t trace; - int type; - edict_t *passedict; + const float *start, *end; + trace_t trace; + int type; + edict_t *passedict; } moveclip_t; /* HULL BOXES */ @@ -106,7 +106,7 @@ SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, mplane_t *planes) } } -static void +static inline void SV_InitBoxHull (void) { SV_InitHull (&box_hull, box_clipnodes, box_planes); @@ -118,7 +118,7 @@ SV_InitBoxHull (void) To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. */ -static hull_t * +static inline hull_t * SV_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; @@ -143,8 +143,8 @@ hull_t * SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs, vec3_t offset) { - hull_t *hull = 0; int hull_index = 0; + hull_t *hull = 0; model_t *model; vec3_t hullmins, hullmaxs, size; @@ -248,7 +248,6 @@ SV_ClearWorld (void) link_t **sv_link_next; link_t **sv_link_prev; - void SV_UnlinkEdict (edict_t *ent) { @@ -262,7 +261,6 @@ SV_UnlinkEdict (edict_t *ent) ent->area.prev = ent->area.next = NULL; } - static void SV_TouchLinks (edict_t *ent, areanode_t *node) { @@ -309,7 +307,6 @@ SV_TouchLinks (edict_t *ent, areanode_t *node) SV_TouchLinks (ent, node->children[1]); } - static void SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) { @@ -356,7 +353,6 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers) if (ent == sv.edicts) return; // don't add the world - if (ent->free) return; @@ -421,9 +417,9 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers) int SV_HullPointContents (hull_t *hull, int num, const vec3_t p) { + float d; dclipnode_t *node; - float d; - mplane_t *plane; + mplane_t *plane; while (num >= 0) { if (num < hull->firstclipnode || num > hull->lastclipnode) @@ -495,9 +491,9 @@ qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, const vec3_t p1, const vec3_t p2, trace_t *trace) { - dclipnode_t *node; float frac, midf, t1, t2; int side, i; + dclipnode_t *node; mplane_t *plane; vec3_t mid; @@ -535,7 +531,7 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, side = (t1 < 0); frac = t1 / (t1 - t2); - //frac = bound (0, frac, 1); // is this needed? +// frac = bound (0, frac, 1); // is this needed? midf = p1f + (p2f - p1f) * frac; for (i = 0; i < 3; i++) @@ -707,7 +703,7 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip) SV_ClipToLinks (node->children[1], clip); } -static void +static inline void SV_MoveBounds (const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs) { @@ -742,7 +738,6 @@ SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs, // clip to world clip.trace = SV_ClipMoveToEntity (sv.edicts, passedict, start, mins, maxs, end); - clip.start = start; clip.end = end; clip.mins = mins; @@ -770,13 +765,12 @@ SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs, return clip.trace; } - edict_t * SV_TestPlayerPosition (edict_t *ent, const vec3_t origin) { + int e; edict_t *check; hull_t *hull; - int e; vec3_t boxmins, boxmaxs, offset; // check world first diff --git a/qw/source/pmovetst.c b/qw/source/pmovetst.c index 1739eefbe..263a6dd53 100644 --- a/qw/source/pmovetst.c +++ b/qw/source/pmovetst.c @@ -51,7 +51,6 @@ static dclipnode_t box_clipnodes[6]; static mplane_t box_planes[6]; - /* PM_InitBoxHull @@ -91,7 +90,7 @@ PM_InitBoxHull (void) To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. */ -static hull_t * +static inline hull_t * PM_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; @@ -107,9 +106,9 @@ PM_HullForBox (const vec3_t mins, const vec3_t maxs) inline int PM_HullPointContents (hull_t *hull, int num, const vec3_t p) { + float d; dclipnode_t *node; - float d; - mplane_t *plane; + mplane_t *plane; while (num >= 0) { node = hull->clipnodes + num; @@ -131,10 +130,10 @@ PM_HullPointContents (hull_t *hull, int num, const vec3_t p) int PM_PointContents (const vec3_t p) { - dclipnode_t *node; float d; - hull_t *hull; int num; + dclipnode_t *node; + hull_t *hull; mplane_t *plane; hull = &pmove.physents[0].model->hulls[0]; @@ -181,9 +180,9 @@ fill_trace (hull_t *hull, int num, int side, const vec3_t p1, const vec3_t p2, float p1f, float p2f, float t1, float t2, pmtrace_t *trace) { - mplane_t *plane; float frac; int i; + mplane_t *plane; // the other side of the node is solid, this is the impact point // put the crosspoint DIST_EPSILON pixels on the near side to guarantee @@ -235,12 +234,10 @@ qboolean PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, const vec3_t p1, const vec3_t p2, pmtrace_t *trace) { - int front, back; + int front, back, side; dclipnode_t *node; - float t1, t2, midf; - int side; - vec3_t mid; - vec3_t _p1; + float midf, t1, t2; + vec3_t mid, _p1; while (1) { while (num >= 0) { diff --git a/qw/source/world.c b/qw/source/world.c index 70e8f6905..d07ea7f67 100644 --- a/qw/source/world.c +++ b/qw/source/world.c @@ -56,14 +56,14 @@ static __attribute__ ((unused)) const char rcsid[] = */ typedef struct { - vec3_t boxmins, boxmaxs; // enclose the test object along + vec3_t boxmins, boxmaxs; // enclose the test object along // entire move - const float *mins, *maxs; // size of the moving object - vec3_t mins2, maxs2; // size when clipping against + const float *mins, *maxs; // size of the moving object + vec3_t mins2, maxs2; // size when clipping against // monsters - const float *start, *end; - trace_t trace; - int type; + const float *start, *end; + trace_t trace; + int type; edict_t *passedict; } moveclip_t; @@ -106,7 +106,7 @@ SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, mplane_t *planes) } } -static void +static inline void SV_InitBoxHull (void) { SV_InitHull (&box_hull, box_clipnodes, box_planes); @@ -118,7 +118,7 @@ SV_InitBoxHull (void) To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. */ -static hull_t * +static inline hull_t * SV_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; @@ -248,7 +248,6 @@ SV_ClearWorld (void) link_t **sv_link_next; link_t **sv_link_prev; - void SV_UnlinkEdict (edict_t *ent) { @@ -262,12 +261,11 @@ SV_UnlinkEdict (edict_t *ent) ent->area.prev = ent->area.next = NULL; } - static void SV_TouchLinks (edict_t *ent, areanode_t *node) { - edict_t *touch; int old_self, old_other; + edict_t *touch; link_t *l, *next; // touch linked edicts @@ -309,7 +307,6 @@ SV_TouchLinks (edict_t *ent, areanode_t *node) SV_TouchLinks (ent, node->children[1]); } - static void SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) { @@ -356,7 +353,6 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers) if (ent == sv.edicts) return; // don't add the world - if (ent->free) return; @@ -421,9 +417,9 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers) int SV_HullPointContents (hull_t *hull, int num, const vec3_t p) { + float d; dclipnode_t *node; - float d; - mplane_t *plane; + mplane_t *plane; while (num >= 0) { if (num < hull->firstclipnode || num > hull->lastclipnode) @@ -482,7 +478,6 @@ SV_TestEntityPosition (edict_t *ent) if (trace.startsolid) return sv.edicts; - return NULL; } @@ -770,7 +765,6 @@ SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs, return clip.trace; } - edict_t * SV_TestPlayerPosition (edict_t *ent, const vec3_t origin) {