mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-30 00:10:40 +00:00
change all the SVFIELD calls to SVtype. this should make the code a little
easier to read.
This commit is contained in:
parent
cd522a6f97
commit
fb42199637
23 changed files with 1166 additions and 1150 deletions
|
@ -157,8 +157,8 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
|||
int hull_index = 0;
|
||||
|
||||
if ((sv_fields.rotated_bbox != -1
|
||||
&& SVFIELD (ent, rotated_bbox, integer))
|
||||
|| SVFIELD (ent, solid, float) == SOLID_BSP) {
|
||||
&& SVinteger (ent, rotated_bbox))
|
||||
|| SVfloat (ent, solid) == SOLID_BSP) {
|
||||
VectorSubtract (maxs, mins, size);
|
||||
if (size[0] < 3)
|
||||
hull_index = 0;
|
||||
|
@ -169,16 +169,16 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
|||
}
|
||||
// decide which clipping hull to use, based on the size
|
||||
if (sv_fields.rotated_bbox != -1
|
||||
&& SVFIELD (ent, rotated_bbox, integer)) {
|
||||
&& SVinteger (ent, rotated_bbox)) {
|
||||
extern clip_hull_t *pf_hull_list[];
|
||||
int h = SVFIELD (ent, rotated_bbox, integer) - 1;
|
||||
int h = SVinteger (ent, rotated_bbox) - 1;
|
||||
hull = pf_hull_list[h]->hulls[hull_index];
|
||||
} if (SVFIELD (ent, solid, float) == SOLID_BSP) {
|
||||
} if (SVfloat (ent, solid) == SOLID_BSP) {
|
||||
// explicit hulls in the BSP model
|
||||
if (SVFIELD (ent, movetype, float) != MOVETYPE_PUSH)
|
||||
if (SVfloat (ent, movetype) != MOVETYPE_PUSH)
|
||||
SV_Error ("SOLID_BSP without MOVETYPE_PUSH");
|
||||
|
||||
model = sv.models[(int) SVFIELD (ent, modelindex, float)];
|
||||
model = sv.models[(int) SVfloat (ent, modelindex)];
|
||||
|
||||
if (!model || model->type != mod_brush)
|
||||
SV_Error ("SOLID_BSP with a non bsp model");
|
||||
|
@ -189,13 +189,13 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
|||
if (hull) {
|
||||
// calculate an offset value to center the origin
|
||||
VectorSubtract (hull->clip_mins, mins, offset);
|
||||
VectorAdd (offset, SVFIELD (ent, origin, vector), offset);
|
||||
VectorAdd (offset, SVvector (ent, origin), offset);
|
||||
} else { // create a temp hull from bounding box sizes
|
||||
VectorSubtract (SVFIELD (ent, mins, vector), maxs, hullmins);
|
||||
VectorSubtract (SVFIELD (ent, maxs, vector), mins, hullmaxs);
|
||||
VectorSubtract (SVvector (ent, mins), maxs, hullmins);
|
||||
VectorSubtract (SVvector (ent, maxs), mins, hullmaxs);
|
||||
hull = SV_HullForBox (hullmins, hullmaxs);
|
||||
|
||||
VectorCopy (SVFIELD (ent, origin, vector), offset);
|
||||
VectorCopy (SVvector (ent, origin), offset);
|
||||
}
|
||||
|
||||
return hull;
|
||||
|
@ -284,15 +284,15 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
|
|||
touch = EDICT_FROM_AREA (l);
|
||||
if (touch == ent)
|
||||
continue;
|
||||
if (!SVFIELD (touch, touch, func)
|
||||
|| SVFIELD (touch, solid, float) != SOLID_TRIGGER)
|
||||
if (!SVfunc (touch, touch)
|
||||
|| SVfloat (touch, solid) != SOLID_TRIGGER)
|
||||
continue;
|
||||
if (SVFIELD (ent, absmin, vector)[0] > SVFIELD (touch, absmax, vector)[0]
|
||||
|| SVFIELD (ent, absmin, vector)[1] > SVFIELD (touch, absmax, vector)[1]
|
||||
|| SVFIELD (ent, absmin, vector)[2] > SVFIELD (touch, absmax, vector)[2]
|
||||
|| SVFIELD (ent, absmax, vector)[0] < SVFIELD (touch, absmin, vector)[0]
|
||||
|| SVFIELD (ent, absmax, vector)[1] < SVFIELD (touch, absmin, vector)[1]
|
||||
|| SVFIELD (ent, absmax, vector)[2] < SVFIELD (touch, absmin, vector)[2])
|
||||
if (SVvector (ent, absmin)[0] > SVvector (touch, absmax)[0]
|
||||
|| SVvector (ent, absmin)[1] > SVvector (touch, absmax)[1]
|
||||
|| SVvector (ent, absmin)[2] > SVvector (touch, absmax)[2]
|
||||
|| SVvector (ent, absmax)[0] < SVvector (touch, absmin)[0]
|
||||
|| SVvector (ent, absmax)[1] < SVvector (touch, absmin)[1]
|
||||
|| SVvector (ent, absmax)[2] < SVvector (touch, absmin)[2])
|
||||
continue;
|
||||
|
||||
old_self = *sv_globals.self;
|
||||
|
@ -301,7 +301,7 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
|
|||
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, touch);
|
||||
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, ent);
|
||||
*sv_globals.time = sv.time;
|
||||
PR_ExecuteProgram (&sv_pr_state, SVFIELD (touch, touch, func));
|
||||
PR_ExecuteProgram (&sv_pr_state, SVfunc (touch, touch));
|
||||
|
||||
*sv_globals.self = old_self;
|
||||
*sv_globals.other = old_other;
|
||||
|
@ -311,9 +311,9 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
|
|||
if (node->axis == -1)
|
||||
return;
|
||||
|
||||
if (SVFIELD (ent, absmax, vector)[node->axis] > node->dist)
|
||||
if (SVvector (ent, absmax)[node->axis] > node->dist)
|
||||
SV_TouchLinks (ent, node->children[0]);
|
||||
if (SVFIELD (ent, absmin, vector)[node->axis] < node->dist)
|
||||
if (SVvector (ent, absmin)[node->axis] < node->dist)
|
||||
SV_TouchLinks (ent, node->children[1]);
|
||||
}
|
||||
|
||||
|
@ -344,8 +344,8 @@ SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
|
|||
|
||||
// NODE_MIXED
|
||||
splitplane = node->plane;
|
||||
sides = BOX_ON_PLANE_SIDE (SVFIELD (ent, absmin, vector),
|
||||
SVFIELD (ent, absmax, vector), splitplane);
|
||||
sides = BOX_ON_PLANE_SIDE (SVvector (ent, absmin),
|
||||
SVvector (ent, absmax), splitplane);
|
||||
|
||||
// recurse down the contacted sides
|
||||
if (sides & 1)
|
||||
|
@ -371,34 +371,34 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
|||
return;
|
||||
|
||||
// set the abs box
|
||||
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector),
|
||||
SVFIELD (ent, absmin, vector));
|
||||
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, maxs, vector),
|
||||
SVFIELD (ent, absmax, vector));
|
||||
VectorAdd (SVvector (ent, origin), SVvector (ent, mins),
|
||||
SVvector (ent, absmin));
|
||||
VectorAdd (SVvector (ent, origin), SVvector (ent, maxs),
|
||||
SVvector (ent, absmax));
|
||||
|
||||
// to make items easier to pick up and allow them to be grabbed off
|
||||
// of shelves, the abs sizes are expanded
|
||||
if ((int) SVFIELD (ent, flags, float) & FL_ITEM) {
|
||||
SVFIELD (ent, absmin, vector)[0] -= 15;
|
||||
SVFIELD (ent, absmin, vector)[1] -= 15;
|
||||
SVFIELD (ent, absmax, vector)[0] += 15;
|
||||
SVFIELD (ent, absmax, vector)[1] += 15;
|
||||
if ((int) SVfloat (ent, flags) & FL_ITEM) {
|
||||
SVvector (ent, absmin)[0] -= 15;
|
||||
SVvector (ent, absmin)[1] -= 15;
|
||||
SVvector (ent, absmax)[0] += 15;
|
||||
SVvector (ent, absmax)[1] += 15;
|
||||
} else { // movement is clipped an epsilon away from actual edge, so we
|
||||
// must fully check even when bounding boxes don't quite touch
|
||||
SVFIELD (ent, absmin, vector)[0] -= 1;
|
||||
SVFIELD (ent, absmin, vector)[1] -= 1;
|
||||
SVFIELD (ent, absmin, vector)[2] -= 1;
|
||||
SVFIELD (ent, absmax, vector)[0] += 1;
|
||||
SVFIELD (ent, absmax, vector)[1] += 1;
|
||||
SVFIELD (ent, absmax, vector)[2] += 1;
|
||||
SVvector (ent, absmin)[0] -= 1;
|
||||
SVvector (ent, absmin)[1] -= 1;
|
||||
SVvector (ent, absmin)[2] -= 1;
|
||||
SVvector (ent, absmax)[0] += 1;
|
||||
SVvector (ent, absmax)[1] += 1;
|
||||
SVvector (ent, absmax)[2] += 1;
|
||||
}
|
||||
|
||||
// link to PVS leafs
|
||||
ent->num_leafs = 0;
|
||||
if (SVFIELD (ent, modelindex, float))
|
||||
if (SVfloat (ent, modelindex))
|
||||
SV_FindTouchedLeafs (ent, sv.worldmodel->nodes);
|
||||
|
||||
if (SVFIELD (ent, solid, float) == SOLID_NOT)
|
||||
if (SVfloat (ent, solid) == SOLID_NOT)
|
||||
return;
|
||||
|
||||
// find the first node that the ent's box crosses
|
||||
|
@ -406,16 +406,16 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
|||
while (1) {
|
||||
if (node->axis == -1)
|
||||
break;
|
||||
if (SVFIELD (ent, absmin, vector)[node->axis] > node->dist)
|
||||
if (SVvector (ent, absmin)[node->axis] > node->dist)
|
||||
node = node->children[0];
|
||||
else if (SVFIELD (ent, absmax, vector)[node->axis] < node->dist)
|
||||
else if (SVvector (ent, absmax)[node->axis] < node->dist)
|
||||
node = node->children[1];
|
||||
else
|
||||
break; // crosses the node
|
||||
}
|
||||
|
||||
// link it in
|
||||
if (SVFIELD (ent, solid, float) == SOLID_TRIGGER)
|
||||
if (SVfloat (ent, solid) == SOLID_TRIGGER)
|
||||
InsertLinkBefore (&ent->area, &node->trigger_edicts);
|
||||
else
|
||||
InsertLinkBefore (&ent->area, &node->solid_edicts);
|
||||
|
@ -479,10 +479,10 @@ SV_TestEntityPosition (edict_t *ent)
|
|||
{
|
||||
trace_t trace;
|
||||
|
||||
trace = SV_Move (SVFIELD (ent, origin, vector),
|
||||
SVFIELD (ent, mins, vector),
|
||||
SVFIELD (ent, maxs, vector),
|
||||
SVFIELD (ent, origin, vector), 0, ent);
|
||||
trace = SV_Move (SVvector (ent, origin),
|
||||
SVvector (ent, mins),
|
||||
SVvector (ent, maxs),
|
||||
SVvector (ent, origin), 0, ent);
|
||||
|
||||
if (trace.startsolid)
|
||||
return sv.edicts;
|
||||
|
@ -684,42 +684,42 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip)
|
|||
for (l = node->solid_edicts.next; l != &node->solid_edicts; l = next) {
|
||||
next = l->next;
|
||||
touch = EDICT_FROM_AREA (l);
|
||||
if (SVFIELD (touch, solid, float) == SOLID_NOT)
|
||||
if (SVfloat (touch, solid) == SOLID_NOT)
|
||||
continue;
|
||||
if (touch == clip->passedict)
|
||||
continue;
|
||||
if (SVFIELD (touch, solid, float) == SOLID_TRIGGER)
|
||||
if (SVfloat (touch, solid) == SOLID_TRIGGER)
|
||||
SV_Error ("Trigger in clipping list");
|
||||
|
||||
if (clip->type == MOVE_NOMONSTERS && SVFIELD (touch, solid, float)
|
||||
if (clip->type == MOVE_NOMONSTERS && SVfloat (touch, solid)
|
||||
!= SOLID_BSP)
|
||||
continue;
|
||||
|
||||
if (clip->boxmins[0] > SVFIELD (touch, absmax, vector)[0]
|
||||
|| clip->boxmins[1] > SVFIELD (touch, absmax, vector)[1]
|
||||
|| clip->boxmins[2] > SVFIELD (touch, absmax, vector)[2]
|
||||
|| clip->boxmaxs[0] < SVFIELD (touch, absmin, vector)[0]
|
||||
|| clip->boxmaxs[1] < SVFIELD (touch, absmin, vector)[1]
|
||||
|| clip->boxmaxs[2] < SVFIELD (touch, absmin, vector)[2])
|
||||
if (clip->boxmins[0] > SVvector (touch, absmax)[0]
|
||||
|| clip->boxmins[1] > SVvector (touch, absmax)[1]
|
||||
|| clip->boxmins[2] > SVvector (touch, absmax)[2]
|
||||
|| clip->boxmaxs[0] < SVvector (touch, absmin)[0]
|
||||
|| clip->boxmaxs[1] < SVvector (touch, absmin)[1]
|
||||
|| clip->boxmaxs[2] < SVvector (touch, absmin)[2])
|
||||
continue;
|
||||
|
||||
if (clip->passedict != 0 && SVFIELD (clip->passedict, size, vector)[0]
|
||||
&& !SVFIELD (touch, size, vector)[0])
|
||||
if (clip->passedict != 0 && SVvector (clip->passedict, size)[0]
|
||||
&& !SVvector (touch, size)[0])
|
||||
continue; // points never interact
|
||||
|
||||
// might intersect, so do an exact clip
|
||||
if (clip->trace.allsolid)
|
||||
return;
|
||||
if (clip->passedict) {
|
||||
if (PROG_TO_EDICT (&sv_pr_state, SVFIELD (touch, owner, entity))
|
||||
if (PROG_TO_EDICT (&sv_pr_state, SVentity (touch, owner))
|
||||
== clip->passedict)
|
||||
continue; // don't clip against own missiles
|
||||
if (PROG_TO_EDICT (&sv_pr_state,
|
||||
SVFIELD (clip->passedict, owner, entity)) == touch)
|
||||
SVentity (clip->passedict, owner)) == touch)
|
||||
continue; // don't clip against owner
|
||||
}
|
||||
|
||||
if ((int) SVFIELD (touch, flags, float) & FL_MONSTER)
|
||||
if ((int) SVfloat (touch, flags) & FL_MONSTER)
|
||||
trace = SV_ClipMoveToEntity (touch, clip->passedict, clip->start,
|
||||
clip->mins2, clip->maxs2, clip->end);
|
||||
else
|
||||
|
@ -827,8 +827,8 @@ SV_TestPlayerPosition (edict_t *ent, vec3_t origin)
|
|||
CONTENTS_EMPTY) return sv.edicts;
|
||||
|
||||
// check all entities
|
||||
VectorAdd (origin, SVFIELD (ent, mins, vector), boxmins);
|
||||
VectorAdd (origin, SVFIELD (ent, maxs, vector), boxmaxs);
|
||||
VectorAdd (origin, SVvector (ent, mins), boxmins);
|
||||
VectorAdd (origin, SVvector (ent, maxs), boxmaxs);
|
||||
|
||||
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||
|
@ -837,22 +837,22 @@ SV_TestPlayerPosition (edict_t *ent, vec3_t origin)
|
|||
if (check == ent)
|
||||
continue;
|
||||
|
||||
if (SVFIELD (check, solid, float) != SOLID_BSP
|
||||
&& SVFIELD (check, solid, float) != SOLID_BBOX
|
||||
&& SVFIELD (check, solid, float) != SOLID_SLIDEBOX)
|
||||
if (SVfloat (check, solid) != SOLID_BSP
|
||||
&& SVfloat (check, solid) != SOLID_BBOX
|
||||
&& SVfloat (check, solid) != SOLID_SLIDEBOX)
|
||||
continue;
|
||||
|
||||
if (boxmins[0] > SVFIELD (check, absmax, vector)[0]
|
||||
|| boxmins[1] > SVFIELD (check, absmax, vector)[1]
|
||||
|| boxmins[2] > SVFIELD (check, absmax, vector)[2]
|
||||
|| boxmaxs[0] < SVFIELD (check, absmin, vector)[0]
|
||||
|| boxmaxs[1] < SVFIELD (check, absmin, vector)[1]
|
||||
|| boxmaxs[2] < SVFIELD (check, absmin, vector)[2])
|
||||
if (boxmins[0] > SVvector (check, absmax)[0]
|
||||
|| boxmins[1] > SVvector (check, absmax)[1]
|
||||
|| boxmins[2] > SVvector (check, absmax)[2]
|
||||
|| boxmaxs[0] < SVvector (check, absmin)[0]
|
||||
|| boxmaxs[1] < SVvector (check, absmin)[1]
|
||||
|| boxmaxs[2] < SVvector (check, absmin)[2])
|
||||
continue;
|
||||
|
||||
// get the clipping hull
|
||||
hull = SV_HullForEntity (check, SVFIELD (ent, mins, vector),
|
||||
SVFIELD (ent, maxs, vector), offset);
|
||||
hull = SV_HullForEntity (check, SVvector (ent, mins),
|
||||
SVvector (ent, maxs), offset);
|
||||
|
||||
VectorSubtract (origin, offset, offset);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue