make edict_t.v a union of entvars_t and pr_type_t[]

This commit is contained in:
Bill Currie 2001-02-02 21:22:35 +00:00
parent 175f24020d
commit 4d08e219d9
13 changed files with 485 additions and 482 deletions

View file

@ -46,6 +46,13 @@ typedef union eval_s
int edict;
} eval_t;
typedef union pr_type_u {
float float_var;
int int_var;
string_t string_t_var;
func_t func_t_var;
} pr_type_t;
#define MAX_ENT_LEAFS 16
typedef struct edict_s
{
@ -58,7 +65,10 @@ typedef struct edict_s
entity_state_t baseline;
float freetime; // sv.time when the object was freed
entvars_t v; // C exported fields from progs
union {
entvars_t v; // C exported fields from progs
pr_type_t vv[1];
} v;
// other fields from progs come immediately after
} edict_t;
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
@ -112,13 +122,6 @@ int NUM_FOR_EDICT(progs_t *pr, edict_t *e);
//============================================================================
typedef union pr_type_u {
float float_var;
int int_var;
string_t string_t_var;
func_t func_t_var;
} pr_type_t;
#define G_var(p,o,t) ((p)->pr_globals[o].t##_var)
#define G_FLOAT(p,o) G_var (p, o, float)
@ -129,7 +132,7 @@ typedef union pr_type_u {
#define G_STRING(p,o) PR_GetString (p, G_var (p, o, string_t))
#define G_FUNCTION(p,o) G_var (p, o, func_t)
#define E_var(e,o,t) (((pr_type_t*)&(e)->v)[o].t##_var)
#define E_var(e,o,t) ((e)->v.vv[o].t##_var)
#define E_FLOAT(e,o) E_var (e, o, float)
#define E_INT(e,o) E_var (e, o, int)

View file

@ -138,16 +138,16 @@ ED_Free (progs_t *pr, edict_t *ed)
pr->unlink (ed); // unlink from world bsp
ed->free = true;
ed->v.model = 0;
ed->v.takedamage = 0;
ed->v.modelindex = 0;
ed->v.colormap = 0;
ed->v.skin = 0;
ed->v.frame = 0;
VectorCopy (vec3_origin, ed->v.origin);
VectorCopy (vec3_origin, ed->v.angles);
ed->v.nextthink = -1;
ed->v.solid = 0;
ed->v.v.model = 0;
ed->v.v.takedamage = 0;
ed->v.v.modelindex = 0;
ed->v.v.colormap = 0;
ed->v.v.skin = 0;
ed->v.v.frame = 0;
VectorCopy (vec3_origin, ed->v.v.origin);
VectorCopy (vec3_origin, ed->v.v.angles);
ed->v.v.nextthink = -1;
ed->v.v.solid = 0;
ed->freetime = *(pr)->time;
}
@ -557,11 +557,11 @@ ED_Count (progs_t *pr)
if (ent->free)
continue;
active++;
if (ent->v.solid)
if (ent->v.v.solid)
solid++;
if (ent->v.model)
if (ent->v.v.model)
models++;
if (ent->v.movetype == MOVETYPE_STEP)
if (ent->v.v.movetype == MOVETYPE_STEP)
step++;
}
@ -875,7 +875,7 @@ ED_LoadFromFile (progs_t *pr, char *data)
data = ED_ParseEdict (pr, data, ent);
// remove things from different skill levels or deathmatch
if (((int) ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH)) {
if (((int) ent->v.v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH)) {
ED_Free (pr, ent);
inhibit++;
continue;
@ -883,14 +883,14 @@ ED_LoadFromFile (progs_t *pr, char *data)
//
// immediately call spawn function
//
if (!ent->v.classname) {
if (!ent->v.v.classname) {
Con_Printf ("No classname for:\n");
ED_Print (pr, ent);
ED_Free (pr, ent);
continue;
}
// look for the spawn function
func = ED_FindFunction (pr, PR_GetString (pr, ent->v.classname));
func = ED_FindFunction (pr, PR_GetString (pr, ent->v.v.classname));
if (!func) {
Con_Printf ("No spawn function for:\n");

View file

@ -667,9 +667,9 @@ PR_ExecuteProgram (progs_t *pr, func_t fnum)
break;
case OP_STATE:
ed = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
ed->v.nextthink = pr->pr_global_struct->time + 0.1;
ed->v.frame = OPA->_float;
ed->v.think = OPB->function;
ed->v.v.nextthink = pr->pr_global_struct->time + 0.1;
ed->v.v.frame = OPA->_float;
ed->v.v.think = OPB->function;
break;
// LordHavoc: to be enabled when Progs version 7 (or whatever it will be numbered) is finalized
/*

View file

@ -230,8 +230,8 @@ SV_God_f (void)
if (!SV_SetPlayer ())
return;
sv_player->v.flags = (int) sv_player->v.flags ^ FL_GODMODE;
if (!((int) sv_player->v.flags & FL_GODMODE))
sv_player->v.v.flags = (int) sv_player->v.v.flags ^ FL_GODMODE;
if (!((int) sv_player->v.v.flags & FL_GODMODE))
SV_ClientPrintf (host_client, PRINT_HIGH, "godmode OFF\n");
else
SV_ClientPrintf (host_client, PRINT_HIGH, "godmode ON\n");
@ -250,11 +250,11 @@ SV_Noclip_f (void)
if (!SV_SetPlayer ())
return;
if (sv_player->v.movetype != MOVETYPE_NOCLIP) {
sv_player->v.movetype = MOVETYPE_NOCLIP;
if (sv_player->v.v.movetype != MOVETYPE_NOCLIP) {
sv_player->v.v.movetype = MOVETYPE_NOCLIP;
SV_ClientPrintf (host_client, PRINT_HIGH, "noclip ON\n");
} else {
sv_player->v.movetype = MOVETYPE_WALK;
sv_player->v.v.movetype = MOVETYPE_WALK;
SV_ClientPrintf (host_client, PRINT_HIGH, "noclip OFF\n");
}
}
@ -292,24 +292,24 @@ SV_Give_f (void)
case '7':
case '8':
case '9':
sv_player->v.items =
(int) sv_player->v.items | IT_SHOTGUN << (t[0] - '2');
sv_player->v.v.items =
(int) sv_player->v.v.items | IT_SHOTGUN << (t[0] - '2');
break;
case 's':
sv_player->v.ammo_shells = v;
sv_player->v.v.ammo_shells = v;
break;
case 'n':
sv_player->v.ammo_nails = v;
sv_player->v.v.ammo_nails = v;
break;
case 'r':
sv_player->v.ammo_rockets = v;
sv_player->v.v.ammo_rockets = v;
break;
case 'h':
sv_player->v.health = v;
sv_player->v.v.health = v;
break;
case 'c':
sv_player->v.ammo_cells = v;
sv_player->v.v.ammo_cells = v;
break;
}
}
@ -436,7 +436,7 @@ SV_Status_f (void)
Con_Printf ("%-16.16s ", cl->name);
Con_Printf ("%6i %5i", cl->userid, (int) cl->edict->v.frags);
Con_Printf ("%6i %5i", cl->userid, (int) cl->edict->v.v.frags);
if (cl->spectator)
Con_Printf (" (s)\n");
else
@ -466,7 +466,7 @@ SV_Status_f (void)
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
if (!cl->state)
continue;
Con_Printf ("%5i %6i ", (int) cl->edict->v.frags, cl->userid);
Con_Printf ("%5i %6i ", (int) cl->edict->v.v.frags, cl->userid);
s = NET_BaseAdrToString (cl->netchan.remote_address);

View file

@ -125,8 +125,8 @@ extern int sv_nailmodel, sv_supernailmodel, sv_playermodel;
qboolean
SV_AddNailUpdate (edict_t *ent)
{
if (ent->v.modelindex != sv_nailmodel
&& ent->v.modelindex != sv_supernailmodel) return false;
if (ent->v.v.modelindex != sv_nailmodel
&& ent->v.v.modelindex != sv_supernailmodel) return false;
if (numnails == MAX_NAILS)
return true;
nails[numnails] = ent;
@ -150,11 +150,11 @@ SV_EmitNailUpdate (sizebuf_t *msg)
for (n = 0; n < numnails; n++) {
ent = nails[n];
x = (int) (ent->v.origin[0] + 4096) >> 1;
y = (int) (ent->v.origin[1] + 4096) >> 1;
z = (int) (ent->v.origin[2] + 4096) >> 1;
p = (int) (16 * ent->v.angles[0] / 360) & 15;
yaw = (int) (256 * ent->v.angles[1] / 360) & 255;
x = (int) (ent->v.v.origin[0] + 4096) >> 1;
y = (int) (ent->v.v.origin[1] + 4096) >> 1;
z = (int) (ent->v.v.origin[2] + 4096) >> 1;
p = (int) (16 * ent->v.v.angles[0] / 360) & 15;
yaw = (int) (256 * ent->v.v.angles[1] / 360) & 255;
bits[0] = x;
bits[1] = (x >> 8) | (y << 4);
@ -432,18 +432,18 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
pflags = PF_MSEC | PF_COMMAND;
if (ent->v.modelindex != sv_playermodel)
if (ent->v.v.modelindex != sv_playermodel)
pflags |= PF_MODEL;
for (i = 0; i < 3; i++)
if (ent->v.velocity[i])
if (ent->v.v.velocity[i])
pflags |= PF_VELOCITY1 << i;
if (ent->v.effects)
if (ent->v.v.effects)
pflags |= PF_EFFECTS;
if (ent->v.skin)
if (ent->v.v.skin)
pflags |= PF_SKINNUM;
if (ent->v.health <= 0)
if (ent->v.v.health <= 0)
pflags |= PF_DEAD;
if (ent->v.mins[2] != -24)
if (ent->v.v.mins[2] != -24)
pflags |= PF_GIB;
if (cl->spectator) { // only sent origin and velocity to
@ -452,21 +452,21 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
} else if (ent == clent) { // don't send a lot of data on
// personal entity
pflags &= ~(PF_MSEC | PF_COMMAND);
if (ent->v.weaponframe)
if (ent->v.v.weaponframe)
pflags |= PF_WEAPONFRAME;
}
if (client->spec_track && client->spec_track - 1 == j &&
ent->v.weaponframe) pflags |= PF_WEAPONFRAME;
ent->v.v.weaponframe) pflags |= PF_WEAPONFRAME;
MSG_WriteByte (msg, svc_playerinfo);
MSG_WriteByte (msg, j);
MSG_WriteShort (msg, pflags);
for (i = 0; i < 3; i++)
MSG_WriteCoord (msg, ent->v.origin[i]);
MSG_WriteCoord (msg, ent->v.v.origin[i]);
MSG_WriteByte (msg, ent->v.frame);
MSG_WriteByte (msg, ent->v.v.frame);
if (pflags & PF_MSEC) {
msec = 1000 * (sv.time - cl->localtime);
@ -478,10 +478,10 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
if (pflags & PF_COMMAND) {
cmd = cl->lastcmd;
if (ent->v.health <= 0) { // don't show the corpse looking
if (ent->v.v.health <= 0) { // don't show the corpse looking
// around...
cmd.angles[0] = 0;
cmd.angles[1] = ent->v.angles[1];
cmd.angles[1] = ent->v.v.angles[1];
cmd.angles[0] = 0;
}
@ -493,19 +493,19 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
for (i = 0; i < 3; i++)
if (pflags & (PF_VELOCITY1 << i))
MSG_WriteShort (msg, ent->v.velocity[i]);
MSG_WriteShort (msg, ent->v.v.velocity[i]);
if (pflags & PF_MODEL)
MSG_WriteByte (msg, ent->v.modelindex);
MSG_WriteByte (msg, ent->v.v.modelindex);
if (pflags & PF_SKINNUM)
MSG_WriteByte (msg, ent->v.skin);
MSG_WriteByte (msg, ent->v.v.skin);
if (pflags & PF_EFFECTS)
MSG_WriteByte (msg, ent->v.effects);
MSG_WriteByte (msg, ent->v.v.effects);
if (pflags & PF_WEAPONFRAME)
MSG_WriteByte (msg, ent->v.weaponframe);
MSG_WriteByte (msg, ent->v.v.weaponframe);
}
}
@ -537,7 +537,7 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
// find the client's PVS
clent = client->edict;
VectorAdd (clent->v.origin, clent->v.view_ofs, org);
VectorAdd (clent->v.v.origin, clent->v.v.view_ofs, org);
pvs = SV_FatPVS (org);
// send over the players in the PVS
@ -553,7 +553,7 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
for (e = MAX_CLIENTS + 1, ent = EDICT_NUM (&sv_pr_state, e); e < sv.num_edicts;
e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
// ignore ents without visible models
if (!ent->v.modelindex || !*PR_GetString (&sv_pr_state, ent->v.model))
if (!ent->v.v.modelindex || !*PR_GetString (&sv_pr_state, ent->v.v.model))
continue;
// ignore if not touching a PV leaf
@ -576,13 +576,13 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
state->number = e;
state->flags = 0;
VectorCopy (ent->v.origin, state->origin);
VectorCopy (ent->v.angles, state->angles);
state->modelindex = ent->v.modelindex;
state->frame = ent->v.frame;
state->colormap = ent->v.colormap;
state->skinnum = ent->v.skin;
state->effects = ent->v.effects;
VectorCopy (ent->v.v.origin, state->origin);
VectorCopy (ent->v.v.angles, state->angles);
state->modelindex = ent->v.v.modelindex;
state->frame = ent->v.v.frame;
state->colormap = ent->v.v.colormap;
state->skinnum = ent->v.v.skin;
state->effects = ent->v.v.effects;
// LordHavoc: cleaned up Endy's coding style, shortened the code,
// and implemented missing effects

View file

@ -116,23 +116,23 @@ SV_CreateBaseline (void)
continue;
// create baselines for all player slots,
// and any other edict that has a visible model
if (entnum > MAX_CLIENTS && !svent->v.modelindex)
if (entnum > MAX_CLIENTS && !svent->v.v.modelindex)
continue;
//
// create entity baseline
//
VectorCopy (svent->v.origin, svent->baseline.origin);
VectorCopy (svent->v.angles, svent->baseline.angles);
svent->baseline.frame = svent->v.frame;
svent->baseline.skinnum = svent->v.skin;
VectorCopy (svent->v.v.origin, svent->baseline.origin);
VectorCopy (svent->v.v.angles, svent->baseline.angles);
svent->baseline.frame = svent->v.v.frame;
svent->baseline.skinnum = svent->v.v.skin;
if (entnum > 0 && entnum <= MAX_CLIENTS) {
svent->baseline.colormap = entnum;
svent->baseline.modelindex = SV_ModelIndex ("progs/player.mdl");
} else {
svent->baseline.colormap = 0;
svent->baseline.modelindex =
SV_ModelIndex (PR_GetString (&sv_pr_state, svent->v.model));
SV_ModelIndex (PR_GetString (&sv_pr_state, svent->v.v.model));
}
// LordHavoc: setup baseline to include new effects
svent->baseline.alpha = 255;
@ -401,10 +401,10 @@ SV_SpawnServer (char *server)
ent = EDICT_NUM (&sv_pr_state, 0);
ent->free = false;
ent->v.model = PR_SetString (&sv_pr_state, sv.worldmodel->name);
ent->v.modelindex = 1; // world model
ent->v.solid = SOLID_BSP;
ent->v.movetype = MOVETYPE_PUSH;
ent->v.v.model = PR_SetString (&sv_pr_state, sv.worldmodel->name);
ent->v.v.modelindex = 1; // world model
ent->v.v.solid = SOLID_BSP;
ent->v.v.movetype = MOVETYPE_PUSH;
sv_pr_state.pr_global_struct->mapname = PR_SetString (&sv_pr_state, sv.name);
// serverflags are for cross level information (sigils)

View file

@ -277,7 +277,7 @@ SV_DropClient (client_t *drop)
drop->connection_started = realtime; // for zombie timeout
drop->old_frags = 0;
drop->edict->v.frags = 0;
drop->edict->v.v.frags = 0;
drop->name[0] = 0;
memset (drop->userinfo, 0, sizeof (drop->userinfo));

View file

@ -59,8 +59,8 @@ SV_CheckBottom (edict_t *ent)
int x, y;
float mid, bottom;
VectorAdd (ent->v.origin, ent->v.mins, mins);
VectorAdd (ent->v.origin, ent->v.maxs, maxs);
VectorAdd (ent->v.v.origin, ent->v.v.mins, mins);
VectorAdd (ent->v.v.origin, ent->v.v.maxs, maxs);
// if all of the points under the corners are solid world, don't bother
// with the tougher checks
@ -133,34 +133,34 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
edict_t *enemy;
// try the move
VectorCopy (ent->v.origin, oldorg);
VectorAdd (ent->v.origin, move, neworg);
VectorCopy (ent->v.v.origin, oldorg);
VectorAdd (ent->v.v.origin, move, neworg);
// flying monsters don't step up
if ((int) ent->v.flags & (FL_SWIM | FL_FLY)) {
if ((int) ent->v.v.flags & (FL_SWIM | FL_FLY)) {
// try one move with vertical motion, then one without
for (i = 0; i < 2; i++) {
VectorAdd (ent->v.origin, move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, ent->v.enemy);
VectorAdd (ent->v.v.origin, move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, ent->v.v.enemy);
if (i == 0 && enemy != sv.edicts) {
dz =
ent->v.origin[2] -
PROG_TO_EDICT (&sv_pr_state, ent->v.enemy)->v.origin[2];
ent->v.v.origin[2] -
PROG_TO_EDICT (&sv_pr_state, ent->v.v.enemy)->v.v.origin[2];
if (dz > 40)
neworg[2] -= 8;
if (dz < 30)
neworg[2] += 8;
}
trace =
SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false,
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, neworg, false,
ent);
if (trace.fraction == 1) {
if (((int) ent->v.flags & FL_SWIM)
if (((int) ent->v.v.flags & FL_SWIM)
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
return false; // swim monster left water
VectorCopy (trace.endpos, ent->v.origin);
VectorCopy (trace.endpos, ent->v.v.origin);
if (relink)
SV_LinkEdict (ent, true);
return true;
@ -177,24 +177,24 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
VectorCopy (neworg, end);
end[2] -= STEPSIZE * 2;
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
trace = SV_Move (neworg, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
if (trace.allsolid)
return false;
if (trace.startsolid) {
neworg[2] -= STEPSIZE;
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
trace = SV_Move (neworg, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
if (trace.allsolid || trace.startsolid)
return false;
}
if (trace.fraction == 1) {
// if monster had the ground pulled out, go ahead and fall
if ((int) ent->v.flags & FL_PARTIALGROUND) {
VectorAdd (ent->v.origin, move, ent->v.origin);
if ((int) ent->v.v.flags & FL_PARTIALGROUND) {
VectorAdd (ent->v.v.origin, move, ent->v.v.origin);
if (relink)
SV_LinkEdict (ent, true);
ent->v.flags = (int) ent->v.flags & ~FL_ONGROUND;
ent->v.v.flags = (int) ent->v.v.flags & ~FL_ONGROUND;
// Con_Printf ("fall down\n");
return true;
}
@ -202,10 +202,10 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
return false; // walked off an edge
}
// check point traces down for dangling corners
VectorCopy (trace.endpos, ent->v.origin);
VectorCopy (trace.endpos, ent->v.v.origin);
if (!SV_CheckBottom (ent)) {
if ((int) ent->v.flags & FL_PARTIALGROUND) { // entity had floor
if ((int) ent->v.v.flags & FL_PARTIALGROUND) { // entity had floor
// mostly pulled out
// from underneath it
// and is trying to correct
@ -213,15 +213,15 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
SV_LinkEdict (ent, true);
return true;
}
VectorCopy (oldorg, ent->v.origin);
VectorCopy (oldorg, ent->v.v.origin);
return false;
}
if ((int) ent->v.flags & FL_PARTIALGROUND) {
if ((int) ent->v.v.flags & FL_PARTIALGROUND) {
// Con_Printf ("back on ground\n");
ent->v.flags = (int) ent->v.flags & ~FL_PARTIALGROUND;
ent->v.v.flags = (int) ent->v.v.flags & ~FL_PARTIALGROUND;
}
ent->v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
ent->v.v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
// the move is ok
if (relink)
@ -247,7 +247,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
vec3_t move, oldorigin;
float delta;
ent->v.ideal_yaw = yaw;
ent->v.v.ideal_yaw = yaw;
PF_changeyaw (&sv_pr_state);
yaw = yaw * M_PI * 2 / 360;
@ -255,12 +255,12 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
move[1] = sin (yaw) * dist;
move[2] = 0;
VectorCopy (ent->v.origin, oldorigin);
VectorCopy (ent->v.v.origin, oldorigin);
if (SV_movestep (ent, move, false)) {
delta = ent->v.angles[YAW] - ent->v.ideal_yaw;
delta = ent->v.v.angles[YAW] - ent->v.v.ideal_yaw;
if (delta > 45 && delta < 315) { // not turned far enough, so
// don't take the step
VectorCopy (oldorigin, ent->v.origin);
VectorCopy (oldorigin, ent->v.v.origin);
}
SV_LinkEdict (ent, true);
return true;
@ -281,7 +281,7 @@ SV_FixCheckBottom (edict_t *ent)
{
// Con_Printf ("SV_FixCheckBottom\n");
ent->v.flags = (int) ent->v.flags | FL_PARTIALGROUND;
ent->v.v.flags = (int) ent->v.v.flags | FL_PARTIALGROUND;
}
@ -300,11 +300,11 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
float d[3];
float tdir, olddir, turnaround;
olddir = anglemod ((int) (actor->v.ideal_yaw / 45) * 45);
olddir = anglemod ((int) (actor->v.v.ideal_yaw / 45) * 45);
turnaround = anglemod (olddir - 180);
deltax = enemy->v.origin[0] - actor->v.origin[0];
deltay = enemy->v.origin[1] - actor->v.origin[1];
deltax = enemy->v.v.origin[0] - actor->v.v.origin[0];
deltay = enemy->v.v.origin[1] - actor->v.v.origin[1];
if (deltax > 10)
d[1] = 0;
else if (deltax < -10)
@ -360,7 +360,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
return;
actor->v.ideal_yaw = olddir; // can't move
actor->v.v.ideal_yaw = olddir; // can't move
// if a bridge was pulled out from underneath a monster, it may not have
// a valid standing position at all
@ -382,9 +382,9 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
int i;
for (i = 0; i < 3; i++) {
if (goal->v.absmin[i] > ent->v.absmax[i] + dist)
if (goal->v.v.absmin[i] > ent->v.v.absmax[i] + dist)
return false;
if (goal->v.absmax[i] < ent->v.absmin[i] - dist)
if (goal->v.v.absmax[i] < ent->v.v.absmin[i] - dist)
return false;
}
return true;
@ -403,19 +403,19 @@ SV_MoveToGoal (progs_t *pr)
float dist;
ent = PROG_TO_EDICT (&sv_pr_state, sv_pr_state.pr_global_struct->self);
goal = PROG_TO_EDICT (&sv_pr_state, ent->v.goalentity);
goal = PROG_TO_EDICT (&sv_pr_state, ent->v.v.goalentity);
dist = G_FLOAT (&sv_pr_state, OFS_PARM0);
if (!((int) ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (!((int) ent->v.v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
G_FLOAT (&sv_pr_state, OFS_RETURN) = 0;
return;
}
// if the next step hits the enemy, return immediately
if (PROG_TO_EDICT (&sv_pr_state, ent->v.enemy) != sv.edicts
if (PROG_TO_EDICT (&sv_pr_state, ent->v.v.enemy) != sv.edicts
&& SV_CloseEnough (ent, goal, dist)) return;
// bump around...
if ((rand () & 3) == 1 || !SV_StepDirection (ent, ent->v.ideal_yaw, dist)) {
if ((rand () & 3) == 1 || !SV_StepDirection (ent, ent->v.v.ideal_yaw, dist)) {
SV_NewChaseDir (ent, goal, dist);
}
}

View file

@ -88,9 +88,9 @@ SV_CheckAllEnts (void)
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free)
continue;
if (check->v.movetype == MOVETYPE_PUSH
|| check->v.movetype == MOVETYPE_NONE
|| check->v.movetype == MOVETYPE_NOCLIP) continue;
if (check->v.v.movetype == MOVETYPE_PUSH
|| check->v.v.movetype == MOVETYPE_NONE
|| check->v.v.movetype == MOVETYPE_NOCLIP) continue;
if (SV_TestEntityPosition (check))
Con_Printf ("entity in invalid position\n");
@ -112,23 +112,23 @@ SV_CheckVelocity (edict_t *ent)
// bound velocity
//
for (i = 0; i < 3; i++) {
if (IS_NAN (ent->v.velocity[i])) {
if (IS_NAN (ent->v.v.velocity[i])) {
Con_Printf ("Got a NaN velocity on %s\n",
PR_GetString (&sv_pr_state, ent->v.classname));
ent->v.velocity[i] = 0;
PR_GetString (&sv_pr_state, ent->v.v.classname));
ent->v.v.velocity[i] = 0;
}
if (IS_NAN (ent->v.origin[i])) {
if (IS_NAN (ent->v.v.origin[i])) {
Con_Printf ("Got a NaN origin on %s\n",
PR_GetString (&sv_pr_state, ent->v.classname));
ent->v.origin[i] = 0;
PR_GetString (&sv_pr_state, ent->v.v.classname));
ent->v.v.origin[i] = 0;
}
}
// 1999-10-18 SV_MAXVELOCITY fix by Maddes start
wishspeed = Length (ent->v.velocity);
wishspeed = Length (ent->v.v.velocity);
if (wishspeed > sv_maxvelocity->value) {
VectorScale (ent->v.velocity, sv_maxvelocity->value / wishspeed,
ent->v.velocity);
VectorScale (ent->v.v.velocity, sv_maxvelocity->value / wishspeed,
ent->v.v.velocity);
}
// 1999-10-18 SV_MAXVELOCITY fix by Maddes end
}
@ -149,7 +149,7 @@ SV_RunThink (edict_t *ent)
float thinktime;
do {
thinktime = ent->v.nextthink;
thinktime = ent->v.v.nextthink;
if (thinktime <= 0)
return true;
if (thinktime > sv.time + sv_frametime)
@ -159,11 +159,11 @@ SV_RunThink (edict_t *ent)
thinktime = sv.time; // don't let things stay in the past.
// it is possible to start that way
// by a trigger with a local time.
ent->v.nextthink = 0;
ent->v.v.nextthink = 0;
sv_pr_state.pr_global_struct->time = thinktime;
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
PR_ExecuteProgram (&sv_pr_state, ent->v.think);
PR_ExecuteProgram (&sv_pr_state, ent->v.v.think);
if (ent->free)
return false;
@ -188,16 +188,16 @@ SV_Impact (edict_t *e1, edict_t *e2)
old_other = sv_pr_state.pr_global_struct->other;
sv_pr_state.pr_global_struct->time = sv.time;
if (e1->v.touch && e1->v.solid != SOLID_NOT) {
if (e1->v.v.touch && e1->v.v.solid != SOLID_NOT) {
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, e1);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, e2);
PR_ExecuteProgram (&sv_pr_state, e1->v.touch);
PR_ExecuteProgram (&sv_pr_state, e1->v.v.touch);
}
if (e2->v.touch && e2->v.solid != SOLID_NOT) {
if (e2->v.v.touch && e2->v.v.solid != SOLID_NOT) {
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, e2);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, e1);
PR_ExecuteProgram (&sv_pr_state, e2->v.touch);
PR_ExecuteProgram (&sv_pr_state, e2->v.v.touch);
}
sv_pr_state.pr_global_struct->self = old_self;
@ -270,27 +270,27 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
numbumps = 4;
blocked = 0;
VectorCopy (ent->v.velocity, original_velocity);
VectorCopy (ent->v.velocity, primal_velocity);
VectorCopy (ent->v.v.velocity, original_velocity);
VectorCopy (ent->v.v.velocity, primal_velocity);
numplanes = 0;
time_left = time;
for (bumpcount = 0; bumpcount < numbumps; bumpcount++) {
for (i = 0; i < 3; i++)
end[i] = ent->v.origin[i] + time_left * ent->v.velocity[i];
end[i] = ent->v.v.origin[i] + time_left * ent->v.v.velocity[i];
trace =
SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, false, ent);
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
if (trace.allsolid) { // entity is trapped in another solid
VectorCopy (vec3_origin, ent->v.velocity);
VectorCopy (vec3_origin, ent->v.v.velocity);
return 3;
}
if (trace.fraction > 0) { // actually covered some distance
VectorCopy (trace.endpos, ent->v.origin);
VectorCopy (ent->v.velocity, original_velocity);
VectorCopy (trace.endpos, ent->v.v.origin);
VectorCopy (ent->v.v.velocity, original_velocity);
numplanes = 0;
}
@ -302,10 +302,10 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
if (trace.plane.normal[2] > 0.7) {
blocked |= 1; // floor
if ((trace.ent->v.solid == SOLID_BSP)
|| (trace.ent->v.movetype == MOVETYPE_PPUSH)) {
ent->v.flags = (int) ent->v.flags | FL_ONGROUND;
ent->v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
if ((trace.ent->v.v.solid == SOLID_BSP)
|| (trace.ent->v.v.movetype == MOVETYPE_PPUSH)) {
ent->v.v.flags = (int) ent->v.v.flags | FL_ONGROUND;
ent->v.v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
}
}
if (!trace.plane.normal[2]) {
@ -325,7 +325,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
// cliped to another plane
if (numplanes >= MAX_CLIP_PLANES) { // this shouldn't really happen
VectorCopy (vec3_origin, ent->v.velocity);
VectorCopy (vec3_origin, ent->v.v.velocity);
return 3;
}
@ -347,24 +347,24 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
}
if (i != numplanes) { // go along this plane
VectorCopy (new_velocity, ent->v.velocity);
VectorCopy (new_velocity, ent->v.v.velocity);
} else { // go along the crease
if (numplanes != 2) {
// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
VectorCopy (vec3_origin, ent->v.velocity);
VectorCopy (vec3_origin, ent->v.v.velocity);
return 7;
}
CrossProduct (planes[0], planes[1], dir);
d = DotProduct (dir, ent->v.velocity);
VectorScale (dir, d, ent->v.velocity);
d = DotProduct (dir, ent->v.v.velocity);
VectorScale (dir, d, ent->v.v.velocity);
}
//
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
if (DotProduct (ent->v.velocity, primal_velocity) <= 0) {
VectorCopy (vec3_origin, ent->v.velocity);
if (DotProduct (ent->v.v.velocity, primal_velocity) <= 0) {
VectorCopy (vec3_origin, ent->v.v.velocity);
return blocked;
}
}
@ -382,7 +382,7 @@ SV_AddGravity
void
SV_AddGravity (edict_t *ent, float scale)
{
ent->v.velocity[2] -= scale * movevars.gravity * sv_frametime;
ent->v.v.velocity[2] -= scale * movevars.gravity * sv_frametime;
}
/*
@ -406,23 +406,23 @@ SV_PushEntity (edict_t *ent, vec3_t push)
trace_t trace;
vec3_t end;
VectorAdd (ent->v.origin, push, end);
VectorAdd (ent->v.v.origin, push, end);
if (ent->v.movetype == MOVETYPE_FLYMISSILE)
if (ent->v.v.movetype == MOVETYPE_FLYMISSILE)
trace =
SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_MISSILE,
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, MOVE_MISSILE,
ent);
else if (ent->v.solid == SOLID_TRIGGER || ent->v.solid == SOLID_NOT)
else if (ent->v.v.solid == SOLID_TRIGGER || ent->v.v.solid == SOLID_NOT)
// only clip against bmodels
trace =
SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end,
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end,
MOVE_NOMONSTERS, ent);
else
trace =
SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL,
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, MOVE_NORMAL,
ent);
VectorCopy (trace.endpos, ent->v.origin);
VectorCopy (trace.endpos, ent->v.v.origin);
SV_LinkEdict (ent, true);
if (trace.ent)
@ -453,15 +453,15 @@ SV_Push (edict_t *pusher, vec3_t move)
// --KB
for (i = 0; i < 3; i++) {
mins[i] = pusher->v.absmin[i] + move[i];
maxs[i] = pusher->v.absmax[i] + move[i];
mins[i] = pusher->v.v.absmin[i] + move[i];
maxs[i] = pusher->v.v.absmax[i] + move[i];
}
VectorCopy (pusher->v.origin, pushorig);
VectorCopy (pusher->v.v.origin, pushorig);
// move the pusher to it's final position
VectorAdd (pusher->v.origin, move, pusher->v.origin);
VectorAdd (pusher->v.v.origin, move, pusher->v.v.origin);
SV_LinkEdict (pusher, false);
// see if any solid entities are inside the final position
@ -470,30 +470,30 @@ SV_Push (edict_t *pusher, vec3_t move)
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free)
continue;
if (check->v.movetype == MOVETYPE_PUSH
|| check->v.movetype == MOVETYPE_NONE
|| check->v.movetype == MOVETYPE_PPUSH
|| check->v.movetype == MOVETYPE_NOCLIP) continue;
if (check->v.v.movetype == MOVETYPE_PUSH
|| check->v.v.movetype == MOVETYPE_NONE
|| check->v.v.movetype == MOVETYPE_PPUSH
|| check->v.v.movetype == MOVETYPE_NOCLIP) continue;
// Don't assume SOLID_BSP ! --KB
solid_save = pusher->v.solid;
pusher->v.solid = SOLID_NOT;
solid_save = pusher->v.v.solid;
pusher->v.v.solid = SOLID_NOT;
block = SV_TestEntityPosition (check);
// pusher->v.solid = SOLID_BSP;
pusher->v.solid = solid_save;
// pusher->v.v.solid = SOLID_BSP;
pusher->v.v.solid = solid_save;
if (block)
continue;
// if the entity is standing on the pusher, it will definately be
// moved
if (!(((int) check->v.flags & FL_ONGROUND)
&& PROG_TO_EDICT (&sv_pr_state, check->v.groundentity) == pusher)) {
if (check->v.absmin[0] >= maxs[0]
|| check->v.absmin[1] >= maxs[1]
|| check->v.absmin[2] >= maxs[2]
|| check->v.absmax[0] <= mins[0]
|| check->v.absmax[1] <= mins[1]
|| check->v.absmax[2] <= mins[2])
if (!(((int) check->v.v.flags & FL_ONGROUND)
&& PROG_TO_EDICT (&sv_pr_state, check->v.v.groundentity) == pusher)) {
if (check->v.v.absmin[0] >= maxs[0]
|| check->v.v.absmin[1] >= maxs[1]
|| check->v.v.absmin[2] >= maxs[2]
|| check->v.v.absmax[0] <= mins[0]
|| check->v.v.absmax[1] <= mins[1]
|| check->v.v.absmax[2] <= mins[2])
continue;
// see if the ent's bbox is inside the pusher's final position
@ -501,49 +501,49 @@ SV_Push (edict_t *pusher, vec3_t move)
continue;
}
VectorCopy (check->v.origin, moved_from[num_moved]);
VectorCopy (check->v.v.origin, moved_from[num_moved]);
moved_edict[num_moved] = check;
num_moved++;
// try moving the contacted entity
VectorAdd (check->v.origin, move, check->v.origin);
VectorAdd (check->v.v.origin, move, check->v.v.origin);
block = SV_TestEntityPosition (check);
if (!block) { // pushed ok
SV_LinkEdict (check, false);
continue;
}
// if it is ok to leave in the old position, do it
VectorSubtract (check->v.origin, move, check->v.origin);
VectorSubtract (check->v.v.origin, move, check->v.v.origin);
block = SV_TestEntityPosition (check);
if (!block) {
num_moved--;
continue;
}
// if it is still inside the pusher, block
if (check->v.mins[0] == check->v.maxs[0]) {
if (check->v.v.mins[0] == check->v.v.maxs[0]) {
SV_LinkEdict (check, false);
continue;
}
if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER) { // corpse
check->v.mins[0] = check->v.mins[1] = 0;
VectorCopy (check->v.mins, check->v.maxs);
if (check->v.v.solid == SOLID_NOT || check->v.v.solid == SOLID_TRIGGER) { // corpse
check->v.v.mins[0] = check->v.v.mins[1] = 0;
VectorCopy (check->v.v.mins, check->v.v.maxs);
SV_LinkEdict (check, false);
continue;
}
VectorCopy (pushorig, pusher->v.origin);
VectorCopy (pushorig, pusher->v.v.origin);
SV_LinkEdict (pusher, false);
// if the pusher has a "blocked" function, call it
// otherwise, just stay in place until the obstacle is gone
if (pusher->v.blocked) {
if (pusher->v.v.blocked) {
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, pusher);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, check);
PR_ExecuteProgram (&sv_pr_state, pusher->v.blocked);
PR_ExecuteProgram (&sv_pr_state, pusher->v.v.blocked);
}
// move back any entities we already moved
for (i = 0; i < num_moved; i++) {
VectorCopy (moved_from[i], moved_edict[i]->v.origin);
VectorCopy (moved_from[i], moved_edict[i]->v.v.origin);
SV_LinkEdict (moved_edict[i], false);
}
return false;
@ -564,17 +564,17 @@ SV_PushMove (edict_t *pusher, float movetime)
int i;
vec3_t move;
if (!pusher->v.velocity[0] && !pusher->v.velocity[1]
&& !pusher->v.velocity[2]) {
pusher->v.ltime += movetime;
if (!pusher->v.v.velocity[0] && !pusher->v.v.velocity[1]
&& !pusher->v.v.velocity[2]) {
pusher->v.v.ltime += movetime;
return;
}
for (i = 0; i < 3; i++)
move[i] = pusher->v.velocity[i] * movetime;
move[i] = pusher->v.v.velocity[i] * movetime;
if (SV_Push (pusher, move))
pusher->v.ltime += movetime;
pusher->v.v.ltime += movetime;
}
@ -593,36 +593,36 @@ SV_Physics_Pusher (edict_t *ent)
vec3_t oldorg, move;
float l;
oldltime = ent->v.ltime;
oldltime = ent->v.v.ltime;
thinktime = ent->v.nextthink;
if (thinktime < ent->v.ltime + sv_frametime) {
movetime = thinktime - ent->v.ltime;
thinktime = ent->v.v.nextthink;
if (thinktime < ent->v.v.ltime + sv_frametime) {
movetime = thinktime - ent->v.v.ltime;
if (movetime < 0)
movetime = 0;
} else
movetime = sv_frametime;
if (movetime) {
SV_PushMove (ent, movetime); // advances ent->v.ltime if not
SV_PushMove (ent, movetime); // advances ent->v.v.ltime if not
// blocked
}
if (thinktime > oldltime && thinktime <= ent->v.ltime) {
VectorCopy (ent->v.origin, oldorg);
ent->v.nextthink = 0;
if (thinktime > oldltime && thinktime <= ent->v.v.ltime) {
VectorCopy (ent->v.v.origin, oldorg);
ent->v.v.nextthink = 0;
sv_pr_state.pr_global_struct->time = sv.time;
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
PR_ExecuteProgram (&sv_pr_state, ent->v.think);
PR_ExecuteProgram (&sv_pr_state, ent->v.v.think);
if (ent->free)
return;
VectorSubtract (ent->v.origin, oldorg, move);
VectorSubtract (ent->v.v.origin, oldorg, move);
l = Length (move);
if (l > 1.0 / 64) {
// Con_Printf ("**** snap: %f\n", Length (l));
VectorCopy (oldorg, ent->v.origin);
VectorCopy (oldorg, ent->v.v.origin);
SV_Push (ent, move);
}
}
@ -657,8 +657,8 @@ SV_Physics_Noclip (edict_t *ent)
if (!SV_RunThink (ent))
return;
VectorMA (ent->v.angles, sv_frametime, ent->v.avelocity, ent->v.angles);
VectorMA (ent->v.origin, sv_frametime, ent->v.velocity, ent->v.origin);
VectorMA (ent->v.v.angles, sv_frametime, ent->v.v.avelocity, ent->v.v.angles);
VectorMA (ent->v.v.origin, sv_frametime, ent->v.v.velocity, ent->v.v.origin);
SV_LinkEdict (ent, false);
}
@ -682,27 +682,27 @@ SV_CheckWaterTransition (edict_t *ent)
{
int cont;
cont = SV_PointContents (ent->v.origin);
if (!ent->v.watertype) { // just spawned here
ent->v.watertype = cont;
ent->v.waterlevel = 1;
cont = SV_PointContents (ent->v.v.origin);
if (!ent->v.v.watertype) { // just spawned here
ent->v.v.watertype = cont;
ent->v.v.waterlevel = 1;
return;
}
if (cont <= CONTENTS_WATER) {
if (ent->v.watertype == CONTENTS_EMPTY) { // just crossed into
if (ent->v.v.watertype == CONTENTS_EMPTY) { // just crossed into
// water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
}
ent->v.watertype = cont;
ent->v.waterlevel = 1;
ent->v.v.watertype = cont;
ent->v.v.waterlevel = 1;
} else {
if (ent->v.watertype != CONTENTS_EMPTY) { // just crossed into
if (ent->v.v.watertype != CONTENTS_EMPTY) { // just crossed into
// water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
}
ent->v.watertype = CONTENTS_EMPTY;
ent->v.waterlevel = cont;
ent->v.v.watertype = CONTENTS_EMPTY;
ent->v.v.waterlevel = cont;
}
}
@ -724,45 +724,45 @@ SV_Physics_Toss (edict_t *ent)
if (!SV_RunThink (ent))
return;
if (ent->v.velocity[2] > 0)
ent->v.flags = (int) ent->v.flags & ~FL_ONGROUND;
if (ent->v.v.velocity[2] > 0)
ent->v.v.flags = (int) ent->v.v.flags & ~FL_ONGROUND;
// if onground, return without moving
if (((int) ent->v.flags & FL_ONGROUND))
if (((int) ent->v.v.flags & FL_ONGROUND))
return;
SV_CheckVelocity (ent);
// add gravity
if (ent->v.movetype != MOVETYPE_FLY
&& ent->v.movetype != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0);
if (ent->v.v.movetype != MOVETYPE_FLY
&& ent->v.v.movetype != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0);
// move angles
VectorMA (ent->v.angles, sv_frametime, ent->v.avelocity, ent->v.angles);
VectorMA (ent->v.v.angles, sv_frametime, ent->v.v.avelocity, ent->v.v.angles);
// move origin
VectorScale (ent->v.velocity, sv_frametime, move);
VectorScale (ent->v.v.velocity, sv_frametime, move);
trace = SV_PushEntity (ent, move);
if (trace.fraction == 1)
return;
if (ent->free)
return;
if (ent->v.movetype == MOVETYPE_BOUNCE)
if (ent->v.v.movetype == MOVETYPE_BOUNCE)
backoff = 1.5;
else
backoff = 1;
ClipVelocity (ent->v.velocity, trace.plane.normal, ent->v.velocity,
ClipVelocity (ent->v.v.velocity, trace.plane.normal, ent->v.v.velocity,
backoff);
// stop if on ground
if (trace.plane.normal[2] > 0.7) {
if (ent->v.velocity[2] < 60 || ent->v.movetype != MOVETYPE_BOUNCE) {
ent->v.flags = (int) ent->v.flags | FL_ONGROUND;
ent->v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
VectorCopy (vec3_origin, ent->v.velocity);
VectorCopy (vec3_origin, ent->v.avelocity);
if (ent->v.v.velocity[2] < 60 || ent->v.v.movetype != MOVETYPE_BOUNCE) {
ent->v.v.flags = (int) ent->v.v.flags | FL_ONGROUND;
ent->v.v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
VectorCopy (vec3_origin, ent->v.v.velocity);
VectorCopy (vec3_origin, ent->v.v.avelocity);
}
}
// check for in water
@ -795,8 +795,8 @@ SV_Physics_Step (edict_t *ent)
qboolean hitsound;
// freefall if not on ground
if (!((int) ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (ent->v.velocity[2] < movevars.gravity * -0.1)
if (!((int) ent->v.v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (ent->v.v.velocity[2] < movevars.gravity * -0.1)
hitsound = true;
else
hitsound = false;
@ -806,7 +806,7 @@ SV_Physics_Step (edict_t *ent)
SV_FlyMove (ent, sv_frametime, NULL);
SV_LinkEdict (ent, true);
if ((int) ent->v.flags & FL_ONGROUND) // just hit ground
if ((int) ent->v.v.flags & FL_ONGROUND) // just hit ground
{
if (hitsound)
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
@ -829,27 +829,27 @@ SV_PPushMove (edict_t *pusher, float movetime) // player push
SV_CheckVelocity (pusher);
for (i = 0; i < 3; i++) {
move[i] = pusher->v.velocity[i] * movetime;
mins[i] = pusher->v.absmin[i] + move[i];
maxs[i] = pusher->v.absmax[i] + move[i];
move[i] = pusher->v.v.velocity[i] * movetime;
mins[i] = pusher->v.v.absmin[i] + move[i];
maxs[i] = pusher->v.v.absmax[i] + move[i];
}
VectorCopy (pusher->v.origin, pusher->v.oldorigin); // Backup origin
VectorCopy (pusher->v.v.origin, pusher->v.v.oldorigin); // Backup origin
trace =
SV_Move (pusher->v.origin, pusher->v.mins, pusher->v.maxs, move,
SV_Move (pusher->v.v.origin, pusher->v.v.mins, pusher->v.v.maxs, move,
MOVE_NOMONSTERS, pusher);
if (trace.fraction == 1) {
VectorCopy (pusher->v.origin, pusher->v.oldorigin); // Revert
VectorCopy (pusher->v.v.origin, pusher->v.v.oldorigin); // Revert
return;
}
VectorAdd (pusher->v.origin, move, pusher->v.origin); // Move
VectorAdd (pusher->v.v.origin, move, pusher->v.v.origin); // Move
SV_LinkEdict (pusher, false);
pusher->v.ltime += movetime;
pusher->v.v.ltime += movetime;
oldsolid = pusher->v.solid;
oldsolid = pusher->v.v.solid;
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
@ -861,25 +861,25 @@ SV_PPushMove (edict_t *pusher, float movetime) // player push
continue;
// Stage 2: Is it a player we can push?
if (check->v.movetype == MOVETYPE_WALK) {
if (check->v.v.movetype == MOVETYPE_WALK) {
Con_Printf ("Pusher encountered a player\n"); // Yes!@#!@
pusher->v.solid = SOLID_NOT;
pusher->v.v.solid = SOLID_NOT;
SV_PushEntity (check, move);
pusher->v.solid = oldsolid;
pusher->v.v.solid = oldsolid;
continue;
}
// Stage 3: No.. Is it something that blocks us?
if (check->v.mins[0] == check->v.maxs[0])
if (check->v.v.mins[0] == check->v.v.maxs[0])
continue;
if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER)
if (check->v.v.solid == SOLID_NOT || check->v.v.solid == SOLID_TRIGGER)
continue;
// Stage 4: Yes, it must be. Fail the move.
VectorCopy (pusher->v.origin, pusher->v.oldorigin); // Revert
if (pusher->v.blocked) { // Blocked func?
VectorCopy (pusher->v.v.origin, pusher->v.v.oldorigin); // Revert
if (pusher->v.v.blocked) { // Blocked func?
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, pusher);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, check);
PR_ExecuteProgram (&sv_pr_state, pusher->v.blocked);
PR_ExecuteProgram (&sv_pr_state, pusher->v.v.blocked);
}
return;
@ -895,11 +895,11 @@ SV_Physics_PPusher (edict_t *ent)
// float l;
oldltime = ent->v.ltime;
oldltime = ent->v.v.ltime;
thinktime = ent->v.nextthink;
if (thinktime < ent->v.ltime + sv_frametime) {
movetime = thinktime - ent->v.ltime;
thinktime = ent->v.v.nextthink;
if (thinktime < ent->v.v.ltime + sv_frametime) {
movetime = thinktime - ent->v.v.ltime;
if (movetime < 0)
movetime = 0;
} else
@ -907,16 +907,16 @@ SV_Physics_PPusher (edict_t *ent)
// if (movetime)
// {
SV_PPushMove (ent, 0.0009); // advances ent->v.ltime if not
SV_PPushMove (ent, 0.0009); // advances ent->v.v.ltime if not
// blocked
// }
if (thinktime > oldltime && thinktime <= ent->v.ltime) {
ent->v.nextthink = 0;
if (thinktime > oldltime && thinktime <= ent->v.v.ltime) {
ent->v.v.nextthink = 0;
sv_pr_state.pr_global_struct->time = sv.time;
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
PR_ExecuteProgram (&sv_pr_state, ent->v.think);
PR_ExecuteProgram (&sv_pr_state, ent->v.v.think);
if (ent->free)
return;
}
@ -943,11 +943,11 @@ SV_RunEntity
void
SV_RunEntity (edict_t *ent)
{
if (ent->v.lastruntime == (float) realtime)
if (ent->v.v.lastruntime == (float) realtime)
return;
ent->v.lastruntime = (float) realtime;
ent->v.v.lastruntime = (float) realtime;
switch ((int) ent->v.movetype) {
switch ((int) ent->v.v.movetype) {
case MOVETYPE_PUSH:
SV_Physics_Pusher (ent);
break;
@ -970,7 +970,7 @@ SV_RunEntity (edict_t *ent)
SV_Physics_Toss (ent);
break;
default:
SV_Error ("SV_Physics: bad movetype %i", (int) ent->v.movetype);
SV_Error ("SV_Physics: bad movetype %i", (int) ent->v.v.movetype);
}
}

View file

@ -142,7 +142,7 @@ PF_setorigin (progs_t *pr)
e = G_EDICT (pr, OFS_PARM0);
org = G_VECTOR (pr, OFS_PARM1);
VectorCopy (org, e->v.origin);
VectorCopy (org, e->v.v.origin);
SV_LinkEdict (e, false);
}
@ -163,9 +163,9 @@ PF_setsize (progs_t *pr)
e = G_EDICT (pr, OFS_PARM0);
min = G_VECTOR (pr, OFS_PARM1);
max = G_VECTOR (pr, OFS_PARM2);
VectorCopy (min, e->v.mins);
VectorCopy (max, e->v.maxs);
VectorSubtract (max, min, e->v.size);
VectorCopy (min, e->v.v.mins);
VectorCopy (max, e->v.v.maxs);
VectorSubtract (max, min, e->v.v.size);
SV_LinkEdict (e, false);
}
@ -195,15 +195,15 @@ PF_setmodel (progs_t *pr)
if (!*check)
PR_RunError (pr, "no precache: %s\n", m);
e->v.model = PR_SetString (pr, m);
e->v.modelindex = i;
e->v.v.model = PR_SetString (pr, m);
e->v.v.modelindex = i;
// if it is an inline model, get the size information for it
if (m[0] == '*') {
mod = Mod_ForName (m, true);
VectorCopy (mod->mins, e->v.mins);
VectorCopy (mod->maxs, e->v.maxs);
VectorSubtract (mod->maxs, mod->mins, e->v.size);
VectorCopy (mod->mins, e->v.v.mins);
VectorCopy (mod->maxs, e->v.v.maxs);
VectorSubtract (mod->maxs, mod->mins, e->v.v.size);
SV_LinkEdict (e, false);
}
@ -584,9 +584,9 @@ PF_newcheckclient (progs_t *pr, int check)
if (ent->free)
continue;
if (ent->v.health <= 0)
if (ent->v.v.health <= 0)
continue;
if ((int) ent->v.flags & FL_NOTARGET)
if ((int) ent->v.v.flags & FL_NOTARGET)
continue;
// anything that is a client, or has a client as an enemy
@ -594,7 +594,7 @@ PF_newcheckclient (progs_t *pr, int check)
}
// get the PVS for the entity
VectorAdd (ent->v.origin, ent->v.view_ofs, org);
VectorAdd (ent->v.v.origin, ent->v.v.view_ofs, org);
leaf = Mod_PointInLeaf (org, sv.worldmodel);
pvs = Mod_LeafPVS (leaf, sv.worldmodel);
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3);
@ -632,13 +632,13 @@ PF_checkclient (progs_t *pr)
}
// return check if it might be visible
ent = EDICT_NUM (pr, sv.lastcheck);
if (ent->free || ent->v.health <= 0) {
if (ent->free || ent->v.v.health <= 0) {
RETURN_EDICT (pr, sv.edicts);
return;
}
// if current entity can't possibly see the check entity, return 0
self = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
VectorAdd (self->v.origin, self->v.view_ofs, view);
VectorAdd (self->v.v.origin, self->v.v.view_ofs, view);
leaf = Mod_PointInLeaf (view, sv.worldmodel);
l = (leaf - sv.worldmodel->leafs) - 1;
if ((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7)))) {
@ -782,16 +782,16 @@ PF_findradius (progs_t *pr)
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
if (ent->free)
continue;
if (ent->v.solid == SOLID_NOT)
if (ent->v.v.solid == SOLID_NOT)
continue;
for (j = 0; j < 3; j++)
eorg[j] =
org[j] - (ent->v.origin[j] +
(ent->v.mins[j] + ent->v.maxs[j]) * 0.5);
org[j] - (ent->v.v.origin[j] +
(ent->v.v.mins[j] + ent->v.v.maxs[j]) * 0.5);
if (Length (eorg) > rad)
continue;
ent->v.chain = EDICT_TO_PROG (pr, chain);
ent->v.v.chain = EDICT_TO_PROG (pr, chain);
chain = ent;
}
@ -1009,7 +1009,7 @@ PF_walkmove (progs_t *pr)
yaw = G_FLOAT (pr, OFS_PARM0);
dist = G_FLOAT (pr, OFS_PARM1);
if (!((int) ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (!((int) ent->v.v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
G_FLOAT (pr, OFS_RETURN) = 0;
return;
}
@ -1046,18 +1046,18 @@ PF_droptofloor (progs_t *pr)
ent = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
VectorCopy (ent->v.origin, end);
VectorCopy (ent->v.v.origin, end);
end[2] -= 256;
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, false, ent);
trace = SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
if (trace.fraction == 1 || trace.allsolid)
G_FLOAT (pr, OFS_RETURN) = 0;
else {
VectorCopy (trace.endpos, ent->v.origin);
VectorCopy (trace.endpos, ent->v.v.origin);
SV_LinkEdict (ent, false);
ent->v.flags = (int) ent->v.flags | FL_ONGROUND;
ent->v.groundentity = EDICT_TO_PROG (pr, trace.ent);
ent->v.v.flags = (int) ent->v.v.flags | FL_ONGROUND;
ent->v.v.groundentity = EDICT_TO_PROG (pr, trace.ent);
G_FLOAT (pr, OFS_RETURN) = 1;
}
}
@ -1192,7 +1192,7 @@ PF_aim (progs_t *pr)
ent = G_EDICT (pr, OFS_PARM0);
speed = G_FLOAT (pr, OFS_PARM1);
VectorCopy (ent->v.origin, start);
VectorCopy (ent->v.v.origin, start);
start[2] += 20;
// noaim option
@ -1208,9 +1208,9 @@ PF_aim (progs_t *pr)
VectorCopy (pr->pr_global_struct->v_forward, dir);
VectorMA (start, 2048, dir, end);
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
if (tr.ent && tr.ent->v.takedamage == DAMAGE_AIM
&& (!teamplay->int_val || ent->v.team <= 0
|| ent->v.team != tr.ent->v.team)) {
if (tr.ent && tr.ent->v.v.takedamage == DAMAGE_AIM
&& (!teamplay->int_val || ent->v.v.team <= 0
|| ent->v.v.team != tr.ent->v.v.team)) {
VectorCopy (pr->pr_global_struct->v_forward, G_VECTOR (pr, OFS_RETURN));
return;
}
@ -1222,16 +1222,16 @@ PF_aim (progs_t *pr)
check = NEXT_EDICT (pr, sv.edicts);
for (i = 1; i < sv.num_edicts; i++, check = NEXT_EDICT (pr, check)) {
if (check->v.takedamage != DAMAGE_AIM)
if (check->v.v.takedamage != DAMAGE_AIM)
continue;
if (check == ent)
continue;
if (teamplay->int_val && ent->v.team > 0
&& ent->v.team == check->v.team) continue; // don't aim at
if (teamplay->int_val && ent->v.v.team > 0
&& ent->v.v.team == check->v.v.team) continue; // don't aim at
// teammate
for (j = 0; j < 3; j++)
end[j] = check->v.origin[j]
+ 0.5 * (check->v.mins[j] + check->v.maxs[j]);
end[j] = check->v.v.origin[j]
+ 0.5 * (check->v.v.mins[j] + check->v.v.maxs[j]);
VectorSubtract (end, start, dir);
VectorNormalize (dir);
dist = DotProduct (dir, pr->pr_global_struct->v_forward);
@ -1245,7 +1245,7 @@ PF_aim (progs_t *pr)
}
if (bestent) {
VectorSubtract (bestent->v.origin, ent->v.origin, dir);
VectorSubtract (bestent->v.v.origin, ent->v.v.origin, dir);
dist = DotProduct (dir, pr->pr_global_struct->v_forward);
VectorScale (pr->pr_global_struct->v_forward, dist, end);
end[2] = dir[2];
@ -1268,9 +1268,9 @@ PF_changeyaw (progs_t *pr)
float ideal, current, move, speed;
ent = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
current = anglemod (ent->v.angles[1]);
ideal = ent->v.ideal_yaw;
speed = ent->v.yaw_speed;
current = anglemod (ent->v.v.angles[1]);
ideal = ent->v.v.ideal_yaw;
speed = ent->v.v.yaw_speed;
if (current == ideal)
return;
@ -1290,7 +1290,7 @@ PF_changeyaw (progs_t *pr)
move = -speed;
}
ent->v.angles[1] = anglemod (current + move);
ent->v.v.angles[1] = anglemod (current + move);
}
/*
@ -1472,14 +1472,14 @@ PF_makestatic (progs_t *pr)
MSG_WriteByte (&sv.signon, svc_spawnstatic);
MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, ent->v.model)));
MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, ent->v.v.model)));
MSG_WriteByte (&sv.signon, ent->v.frame);
MSG_WriteByte (&sv.signon, ent->v.colormap);
MSG_WriteByte (&sv.signon, ent->v.skin);
MSG_WriteByte (&sv.signon, ent->v.v.frame);
MSG_WriteByte (&sv.signon, ent->v.v.colormap);
MSG_WriteByte (&sv.signon, ent->v.v.skin);
for (i = 0; i < 3; i++) {
MSG_WriteCoord (&sv.signon, ent->v.origin[i]);
MSG_WriteAngle (&sv.signon, ent->v.angles[i]);
MSG_WriteCoord (&sv.signon, ent->v.v.origin[i]);
MSG_WriteAngle (&sv.signon, ent->v.v.angles[i]);
}
// throw the entity away now

View file

@ -354,12 +354,12 @@ SV_Multicast (vec3_t origin, int to)
if (to == MULTICAST_PHS_R || to == MULTICAST_PHS) {
vec3_t delta;
VectorSubtract (origin, client->edict->v.origin, delta);
VectorSubtract (origin, client->edict->v.v.origin, delta);
if (Length (delta) <= 1024)
goto inrange;
}
leaf = Mod_PointInLeaf (client->edict->v.origin, sv.worldmodel);
leaf = Mod_PointInLeaf (client->edict->v.v.origin, sv.worldmodel);
if (leaf) {
// -1 is because pvs rows are 1 based, not 0 based like leafs
leafnum = leaf - sv.worldmodel->leafs - 1;
@ -454,13 +454,13 @@ SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
channel |= SND_ATTENUATION;
// use the entity origin unless it is a bmodel
if (entity->v.solid == SOLID_BSP) {
if (entity->v.v.solid == SOLID_BSP) {
for (i = 0; i < 3; i++)
origin[i] =
entity->v.origin[i] + 0.5 * (entity->v.mins[i] +
entity->v.maxs[i]);
entity->v.v.origin[i] + 0.5 * (entity->v.v.mins[i] +
entity->v.v.maxs[i]);
} else {
VectorCopy (entity->v.origin, origin);
VectorCopy (entity->v.v.origin, origin);
}
MSG_WriteByte (&sv.multicast, svc_sound);
@ -534,25 +534,25 @@ SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
client->chokecount = 0;
}
// send a damage message if the player got hit this frame
if (ent->v.dmg_take || ent->v.dmg_save) {
other = PROG_TO_EDICT (&sv_pr_state, ent->v.dmg_inflictor);
if (ent->v.v.dmg_take || ent->v.v.dmg_save) {
other = PROG_TO_EDICT (&sv_pr_state, ent->v.v.dmg_inflictor);
MSG_WriteByte (msg, svc_damage);
MSG_WriteByte (msg, ent->v.dmg_save);
MSG_WriteByte (msg, ent->v.dmg_take);
MSG_WriteByte (msg, ent->v.v.dmg_save);
MSG_WriteByte (msg, ent->v.v.dmg_take);
for (i = 0; i < 3; i++)
MSG_WriteCoord (msg,
other->v.origin[i] + 0.5 * (other->v.mins[i] +
other->v.maxs[i]));
other->v.v.origin[i] + 0.5 * (other->v.v.mins[i] +
other->v.v.maxs[i]));
ent->v.dmg_take = 0;
ent->v.dmg_save = 0;
ent->v.v.dmg_take = 0;
ent->v.v.dmg_save = 0;
}
// a fixangle might get lost in a dropped packet. Oh well.
if (ent->v.fixangle) {
if (ent->v.v.fixangle) {
MSG_WriteByte (msg, svc_setangle);
for (i = 0; i < 3; i++)
MSG_WriteAngle (msg, ent->v.angles[i]);
ent->v.fixangle = 0;
MSG_WriteAngle (msg, ent->v.v.angles[i]);
ent->v.v.fixangle = 0;
}
}
@ -579,29 +579,29 @@ SV_UpdateClientStats (client_t *client)
if (client->spectator && client->spec_track > 0)
ent = svs.clients[client->spec_track - 1].edict;
stats[STAT_HEALTH] = ent->v.health;
stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, ent->v.weaponmodel));
stats[STAT_AMMO] = ent->v.currentammo;
stats[STAT_ARMOR] = ent->v.armorvalue;
stats[STAT_SHELLS] = ent->v.ammo_shells;
stats[STAT_NAILS] = ent->v.ammo_nails;
stats[STAT_ROCKETS] = ent->v.ammo_rockets;
stats[STAT_CELLS] = ent->v.ammo_cells;
stats[STAT_HEALTH] = ent->v.v.health;
stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, ent->v.v.weaponmodel));
stats[STAT_AMMO] = ent->v.v.currentammo;
stats[STAT_ARMOR] = ent->v.v.armorvalue;
stats[STAT_SHELLS] = ent->v.v.ammo_shells;
stats[STAT_NAILS] = ent->v.v.ammo_nails;
stats[STAT_ROCKETS] = ent->v.v.ammo_rockets;
stats[STAT_CELLS] = ent->v.v.ammo_cells;
if (!client->spectator)
stats[STAT_ACTIVEWEAPON] = ent->v.weapon;
stats[STAT_ACTIVEWEAPON] = ent->v.v.weapon;
// stuff the sigil bits into the high bits of items for sbar
stats[STAT_ITEMS] =
(int) ent->v.items | ((int) sv_pr_state.pr_global_struct->serverflags << 28);
(int) ent->v.v.items | ((int) sv_pr_state.pr_global_struct->serverflags << 28);
// Extensions to the QW 2.40 protocol for Mega2k --KB
stats[STAT_VIEWHEIGHT] = (int) ent->v.view_ofs[2];
stats[STAT_VIEWHEIGHT] = (int) ent->v.v.view_ofs[2];
// FIXME: this should become a * key! --KB
if (ent->v.movetype == MOVETYPE_FLY && !atoi (Info_ValueForKey
if (ent->v.v.movetype == MOVETYPE_FLY && !atoi (Info_ValueForKey
(svs.info, "playerfly")))
ent->v.movetype = MOVETYPE_WALK;
ent->v.v.movetype = MOVETYPE_WALK;
stats[STAT_FLYMODE] = (ent->v.movetype == MOVETYPE_FLY);
stats[STAT_FLYMODE] = (ent->v.v.movetype == MOVETYPE_FLY);
for (i = 0; i < MAX_CL_STATS; i++)
@ -687,16 +687,16 @@ SV_UpdateToReliableMessages (void)
host_client->sendinfo = false;
SV_FullClientUpdate (host_client, &sv.reliable_datagram);
}
if (host_client->old_frags != host_client->edict->v.frags) {
if (host_client->old_frags != host_client->edict->v.v.frags) {
for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) {
if (client->state < cs_connected)
continue;
ClientReliableWrite_Begin (client, svc_updatefrags, 4);
ClientReliableWrite_Byte (client, i);
ClientReliableWrite_Short (client, host_client->edict->v.frags);
ClientReliableWrite_Short (client, host_client->edict->v.v.frags);
}
host_client->old_frags = host_client->edict->v.frags;
host_client->old_frags = host_client->edict->v.v.frags;
}
// maxspeed/entgravity changes
ent = host_client->edict;

View file

@ -135,7 +135,7 @@ SV_New_f (void)
// send full levelname
MSG_WriteString (&host_client->netchan.message,
PR_GetString (&sv_pr_state, sv.edicts->v.message));
PR_GetString (&sv_pr_state, sv.edicts->v.v.message));
// send the movevars
MSG_WriteFloat (&host_client->netchan.message, movevars.gravity);
@ -151,7 +151,7 @@ SV_New_f (void)
// send music
MSG_WriteByte (&host_client->netchan.message, svc_cdtrack);
MSG_WriteByte (&host_client->netchan.message, sv.edicts->v.sounds);
MSG_WriteByte (&host_client->netchan.message, sv.edicts->v.v.sounds);
// send server info string
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
@ -390,9 +390,9 @@ SV_Spawn_f (void)
ent = host_client->edict;
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
ent->v.colormap = NUM_FOR_EDICT (&sv_pr_state, ent);
ent->v.team = 0; // FIXME
ent->v.netname = PR_SetString (&sv_pr_state, host_client->name);
ent->v.v.colormap = NUM_FOR_EDICT (&sv_pr_state, ent);
ent->v.v.team = 0; // FIXME
ent->v.v.netname = PR_SetString (&sv_pr_state, host_client->name);
host_client->entgravity = 1.0;
val = GetEdictFieldValue (&sv_pr_state, ent, "gravity");
@ -441,15 +441,15 @@ SV_SpawnSpectator (void)
int i;
edict_t *e;
VectorCopy (vec3_origin, sv_player->v.origin);
VectorCopy (vec3_origin, sv_player->v.view_ofs);
sv_player->v.view_ofs[2] = 22;
VectorCopy (vec3_origin, sv_player->v.v.origin);
VectorCopy (vec3_origin, sv_player->v.v.view_ofs);
sv_player->v.v.view_ofs[2] = 22;
// search for an info_playerstart to spawn the spectator at
for (i = MAX_CLIENTS - 1; i < sv.num_edicts; i++) {
e = EDICT_NUM (&sv_pr_state, i);
if (!strcmp (PR_GetString (&sv_pr_state, e->v.classname), "info_player_start")) {
VectorCopy (e->v.origin, sv_player->v.origin);
if (!strcmp (PR_GetString (&sv_pr_state, e->v.v.classname), "info_player_start")) {
VectorCopy (e->v.v.origin, sv_player->v.v.origin);
return;
}
}
@ -540,7 +540,7 @@ SV_Begin_f (void)
ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients));
MSG_WriteByte (&host_client->netchan.message, svc_setangle);
for (i = 0; i < 2; i++)
MSG_WriteAngle (&host_client->netchan.message, ent->v.angles[i]);
MSG_WriteAngle (&host_client->netchan.message, ent->v.v.angles[i]);
MSG_WriteAngle (&host_client->netchan.message, 0);
#endif
}
@ -930,7 +930,7 @@ SV_Kill_f
void
SV_Kill_f (void)
{
if (sv_player->v.health <= 0) {
if (sv_player->v.v.health <= 0) {
SV_BeginRedirect (RD_CLIENT);
SV_ClientPrintf (host_client, PRINT_HIGH,
"Can't suicide -- allready dead!\n");
@ -1047,7 +1047,7 @@ SV_PTrack_f (void)
host_client->spec_track = 0;
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
tent = EDICT_NUM (&sv_pr_state, 0);
ent->v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
ent->v.v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
return;
}
@ -1058,14 +1058,14 @@ SV_PTrack_f (void)
host_client->spec_track = 0;
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
tent = EDICT_NUM (&sv_pr_state, 0);
ent->v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
ent->v.v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
return;
}
host_client->spec_track = i + 1; // now tracking
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
tent = EDICT_NUM (&sv_pr_state, i + 1);
ent->v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
ent->v.v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
}
@ -1335,16 +1335,16 @@ AddLinksToPmove (areanode_t *node)
next = l->next;
check = EDICT_FROM_AREA (l);
if (check->v.owner == pl)
if (check->v.v.owner == pl)
continue; // player's own missile
if (check->v.solid == SOLID_BSP
|| check->v.solid == SOLID_BBOX || check->v.solid == SOLID_SLIDEBOX) {
if (check->v.v.solid == SOLID_BSP
|| check->v.v.solid == SOLID_BBOX || check->v.v.solid == SOLID_SLIDEBOX) {
if (check == sv_player)
continue;
for (i = 0; i < 3; i++)
if (check->v.absmin[i] > pmove_maxs[i]
|| check->v.absmax[i] < pmove_mins[i])
if (check->v.v.absmin[i] > pmove_maxs[i]
|| check->v.v.absmax[i] < pmove_mins[i])
break;
if (i != 3)
continue;
@ -1353,15 +1353,15 @@ AddLinksToPmove (areanode_t *node)
pe = &pmove.physents[pmove.numphysent];
pmove.numphysent++;
VectorCopy (check->v.origin, pe->origin);
VectorCopy (check->v.v.origin, pe->origin);
pe->info = NUM_FOR_EDICT (&sv_pr_state, check);
if (check->v.solid == SOLID_BSP) {
pe->model = sv.models[(int) (check->v.modelindex)];
if (check->v.v.solid == SOLID_BSP) {
pe->model = sv.models[(int) (check->v.v.modelindex)];
} else {
pe->model = NULL;
VectorCopy (check->v.mins, pe->mins);
VectorCopy (check->v.maxs, pe->maxs);
VectorCopy (check->v.v.mins, pe->mins);
VectorCopy (check->v.v.maxs, pe->maxs);
}
}
}
@ -1399,29 +1399,29 @@ AddAllEntsToPmove (void)
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free)
continue;
if (check->v.owner == pl)
if (check->v.v.owner == pl)
continue;
if (check->v.solid == SOLID_BSP
|| check->v.solid == SOLID_BBOX || check->v.solid == SOLID_SLIDEBOX) {
if (check->v.v.solid == SOLID_BSP
|| check->v.v.solid == SOLID_BBOX || check->v.v.solid == SOLID_SLIDEBOX) {
if (check == sv_player)
continue;
for (i = 0; i < 3; i++)
if (check->v.absmin[i] > pmove_maxs[i]
|| check->v.absmax[i] < pmove_mins[i])
if (check->v.v.absmin[i] > pmove_maxs[i]
|| check->v.v.absmax[i] < pmove_mins[i])
break;
if (i != 3)
continue;
pe = &pmove.physents[pmove.numphysent];
VectorCopy (check->v.origin, pe->origin);
VectorCopy (check->v.v.origin, pe->origin);
pmove.physents[pmove.numphysent].info = e;
if (check->v.solid == SOLID_BSP)
pe->model = sv.models[(int) (check->v.modelindex)];
if (check->v.v.solid == SOLID_BSP)
pe->model = sv.models[(int) (check->v.v.modelindex)];
else {
pe->model = NULL;
VectorCopy (check->v.mins, pe->mins);
VectorCopy (check->v.maxs, pe->maxs);
VectorCopy (check->v.v.mins, pe->mins);
VectorCopy (check->v.v.maxs, pe->maxs);
}
if (++pmove.numphysent == MAX_PHYSENTS)
@ -1507,29 +1507,29 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
return;
}
if (!sv_player->v.fixangle)
VectorCopy (ucmd->angles, sv_player->v.v_angle);
if (!sv_player->v.v.fixangle)
VectorCopy (ucmd->angles, sv_player->v.v.v_angle);
sv_player->v.button0 = ucmd->buttons & 1;
sv_player->v.v.button0 = ucmd->buttons & 1;
// 1999-10-29 +USE fix by Maddes start
if (!nouse) {
sv_player->v.button1 = (ucmd->buttons & 4) >> 2;
sv_player->v.v.button1 = (ucmd->buttons & 4) >> 2;
}
// 1999-10-29 +USE fix by Maddes end
sv_player->v.button2 = (ucmd->buttons & 2) >> 1;
sv_player->v.v.button2 = (ucmd->buttons & 2) >> 1;
if (ucmd->impulse)
sv_player->v.impulse = ucmd->impulse;
sv_player->v.v.impulse = ucmd->impulse;
//
// angles
// show 1/3 the pitch angle and all the roll angle
if (sv_player->v.health > 0) {
if (!sv_player->v.fixangle) {
sv_player->v.angles[PITCH] = -sv_player->v.v_angle[PITCH] / 3;
sv_player->v.angles[YAW] = sv_player->v.v_angle[YAW];
if (sv_player->v.v.health > 0) {
if (!sv_player->v.v.fixangle) {
sv_player->v.v.angles[PITCH] = -sv_player->v.v.v_angle[PITCH] / 3;
sv_player->v.v.angles[YAW] = sv_player->v.v.v_angle[YAW];
}
sv_player->v.angles[ROLL] =
SV_CalcRoll (sv_player->v.angles, sv_player->v.velocity) * 4;
sv_player->v.v.angles[ROLL] =
SV_CalcRoll (sv_player->v.v.angles, sv_player->v.v.velocity) * 4;
}
sv_frametime = min (0.1, ucmd->msec * 0.001);
@ -1546,17 +1546,17 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
for (i = 0; i < 3; i++)
pmove.origin[i] =
sv_player->v.origin[i] + (sv_player->v.mins[i] - player_mins[i]);
VectorCopy (sv_player->v.velocity, pmove.velocity);
VectorCopy (sv_player->v.v_angle, pmove.angles);
sv_player->v.v.origin[i] + (sv_player->v.v.mins[i] - player_mins[i]);
VectorCopy (sv_player->v.v.velocity, pmove.velocity);
VectorCopy (sv_player->v.v.v_angle, pmove.angles);
pmove.flying = sv_player->v.movetype == MOVETYPE_FLY;
pmove.flying = sv_player->v.v.movetype == MOVETYPE_FLY;
pmove.spectator = host_client->spectator;
pmove.waterjumptime = sv_player->v.teleport_time;
pmove.waterjumptime = sv_player->v.v.teleport_time;
pmove.numphysent = 1;
pmove.physents[0].model = sv.worldmodel;
pmove.cmd = *ucmd;
pmove.dead = sv_player->v.health <= 0;
pmove.dead = sv_player->v.v.health <= 0;
pmove.oldbuttons = host_client->oldbuttons;
movevars.entgravity = host_client->entgravity;
@ -1581,7 +1581,7 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
PlayerMove ();
after = PM_TestPlayerPosition (pmove.origin);
if (sv_player->v.health > 0 && before && !after)
if (sv_player->v.v.health > 0 && before && !after)
Con_Printf ("player %s got stuck in playermove!!!!\n",
host_client->name);
}
@ -1590,29 +1590,29 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
#endif
host_client->oldbuttons = pmove.oldbuttons;
sv_player->v.teleport_time = pmove.waterjumptime;
sv_player->v.waterlevel = waterlevel;
sv_player->v.watertype = watertype;
sv_player->v.v.teleport_time = pmove.waterjumptime;
sv_player->v.v.waterlevel = waterlevel;
sv_player->v.v.watertype = watertype;
if (onground != -1) {
sv_player->v.flags = (int) sv_player->v.flags | FL_ONGROUND;
sv_player->v.groundentity =
sv_player->v.v.flags = (int) sv_player->v.v.flags | FL_ONGROUND;
sv_player->v.v.groundentity =
EDICT_TO_PROG (&sv_pr_state, EDICT_NUM (&sv_pr_state, pmove.physents[onground].info));
} else {
sv_player->v.flags = (int) sv_player->v.flags & ~FL_ONGROUND;
sv_player->v.v.flags = (int) sv_player->v.v.flags & ~FL_ONGROUND;
}
for (i = 0; i < 3; i++)
sv_player->v.origin[i] =
pmove.origin[i] - (sv_player->v.mins[i] - player_mins[i]);
sv_player->v.v.origin[i] =
pmove.origin[i] - (sv_player->v.v.mins[i] - player_mins[i]);
#if 0
// truncate velocity the same way the net protocol will
for (i = 0; i < 3; i++)
sv_player->v.velocity[i] = (int) pmove.velocity[i];
sv_player->v.v.velocity[i] = (int) pmove.velocity[i];
#else
VectorCopy (pmove.velocity, sv_player->v.velocity);
VectorCopy (pmove.velocity, sv_player->v.v.velocity);
#endif
VectorCopy (pmove.angles, sv_player->v.v_angle);
VectorCopy (pmove.angles, sv_player->v.v.v_angle);
if (!host_client->spectator) {
// link into place and touch triggers
@ -1622,11 +1622,11 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
for (i = 0; i < pmove.numtouch; i++) {
n = pmove.physents[pmove.touchindex[i]].info;
ent = EDICT_NUM (&sv_pr_state, n);
if (!ent->v.touch || (playertouch[n / 8] & (1 << (n % 8))))
if (!ent->v.v.touch || (playertouch[n / 8] & (1 << (n % 8))))
continue;
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv_player);
PR_ExecuteProgram (&sv_pr_state, ent->v.touch);
PR_ExecuteProgram (&sv_pr_state, ent->v.v.touch);
playertouch[n / 8] |= 1 << (n % 8);
}
}
@ -1794,7 +1794,7 @@ SV_ExecuteClientMessage (client_t *cl)
o[2] = MSG_ReadCoord ();
// only allowed by spectators
if (host_client->spectator) {
VectorCopy (o, sv_player->v.origin);
VectorCopy (o, sv_player->v.v.origin);
SV_LinkEdict (sv_player, false);
}
break;

View file

@ -161,12 +161,12 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
hull_t *hull;
// decide which clipping hull to use, based on the size
if (ent->v.solid == SOLID_BSP) {
if (ent->v.v.solid == SOLID_BSP) {
// explicit hulls in the BSP model
if (ent->v.movetype != MOVETYPE_PUSH)
if (ent->v.v.movetype != MOVETYPE_PUSH)
SV_Error ("SOLID_BSP without MOVETYPE_PUSH");
model = sv.models[(int) ent->v.modelindex];
model = sv.models[(int) ent->v.v.modelindex];
if (!model || model->type != mod_brush)
SV_Error ("SOLID_BSP with a non bsp model");
@ -181,15 +181,15 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
// calculate an offset value to center the origin
VectorSubtract (hull->clip_mins, mins, offset);
VectorAdd (offset, ent->v.origin, offset);
VectorAdd (offset, ent->v.v.origin, offset);
} else { // create a temp hull from bounding
// box sizes
VectorSubtract (ent->v.mins, maxs, hullmins);
VectorSubtract (ent->v.maxs, mins, hullmaxs);
VectorSubtract (ent->v.v.mins, maxs, hullmins);
VectorSubtract (ent->v.v.maxs, mins, hullmaxs);
hull = SV_HullForBox (hullmins, hullmaxs);
VectorCopy (ent->v.origin, offset);
VectorCopy (ent->v.v.origin, offset);
}
@ -304,14 +304,14 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
touch = EDICT_FROM_AREA (l);
if (touch == ent)
continue;
if (!touch->v.touch || touch->v.solid != SOLID_TRIGGER)
if (!touch->v.v.touch || touch->v.v.solid != SOLID_TRIGGER)
continue;
if (ent->v.absmin[0] > touch->v.absmax[0]
|| ent->v.absmin[1] > touch->v.absmax[1]
|| ent->v.absmin[2] > touch->v.absmax[2]
|| ent->v.absmax[0] < touch->v.absmin[0]
|| ent->v.absmax[1] < touch->v.absmin[1]
|| ent->v.absmax[2] < touch->v.absmin[2])
if (ent->v.v.absmin[0] > touch->v.v.absmax[0]
|| ent->v.v.absmin[1] > touch->v.v.absmax[1]
|| ent->v.v.absmin[2] > touch->v.v.absmax[2]
|| ent->v.v.absmax[0] < touch->v.v.absmin[0]
|| ent->v.v.absmax[1] < touch->v.v.absmin[1]
|| ent->v.v.absmax[2] < touch->v.v.absmin[2])
continue;
old_self = sv_pr_state.pr_global_struct->self;
@ -320,7 +320,7 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, touch);
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, ent);
sv_pr_state.pr_global_struct->time = sv.time;
PR_ExecuteProgram (&sv_pr_state, touch->v.touch);
PR_ExecuteProgram (&sv_pr_state, touch->v.v.touch);
sv_pr_state.pr_global_struct->self = old_self;
sv_pr_state.pr_global_struct->other = old_other;
@ -330,9 +330,9 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
if (node->axis == -1)
return;
if (ent->v.absmax[node->axis] > node->dist)
if (ent->v.v.absmax[node->axis] > node->dist)
SV_TouchLinks (ent, node->children[0]);
if (ent->v.absmin[node->axis] < node->dist)
if (ent->v.v.absmin[node->axis] < node->dist)
SV_TouchLinks (ent, node->children[1]);
}
@ -370,7 +370,7 @@ SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
// NODE_MIXED
splitplane = node->plane;
sides = BOX_ON_PLANE_SIDE (ent->v.absmin, ent->v.absmax, splitplane);
sides = BOX_ON_PLANE_SIDE (ent->v.v.absmin, ent->v.v.absmax, splitplane);
// recurse down the contacted sides
if (sides & 1)
@ -401,35 +401,35 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
return;
// set the abs box
VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin);
VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax);
VectorAdd (ent->v.v.origin, ent->v.v.mins, ent->v.v.absmin);
VectorAdd (ent->v.v.origin, ent->v.v.maxs, ent->v.v.absmax);
//
// to make items easier to pick up and allow them to be grabbed off
// of shelves, the abs sizes are expanded
//
if ((int) ent->v.flags & FL_ITEM) {
ent->v.absmin[0] -= 15;
ent->v.absmin[1] -= 15;
ent->v.absmax[0] += 15;
ent->v.absmax[1] += 15;
if ((int) ent->v.v.flags & FL_ITEM) {
ent->v.v.absmin[0] -= 15;
ent->v.v.absmin[1] -= 15;
ent->v.v.absmax[0] += 15;
ent->v.v.absmax[1] += 15;
} else { // because movement is clipped an
// epsilon away from an actual edge,
// we must fully check even when bounding boxes don't quite touch
ent->v.absmin[0] -= 1;
ent->v.absmin[1] -= 1;
ent->v.absmin[2] -= 1;
ent->v.absmax[0] += 1;
ent->v.absmax[1] += 1;
ent->v.absmax[2] += 1;
ent->v.v.absmin[0] -= 1;
ent->v.v.absmin[1] -= 1;
ent->v.v.absmin[2] -= 1;
ent->v.v.absmax[0] += 1;
ent->v.v.absmax[1] += 1;
ent->v.v.absmax[2] += 1;
}
// link to PVS leafs
ent->num_leafs = 0;
if (ent->v.modelindex)
if (ent->v.v.modelindex)
SV_FindTouchedLeafs (ent, sv.worldmodel->nodes);
if (ent->v.solid == SOLID_NOT)
if (ent->v.v.solid == SOLID_NOT)
return;
// find the first node that the ent's box crosses
@ -437,9 +437,9 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
while (1) {
if (node->axis == -1)
break;
if (ent->v.absmin[node->axis] > node->dist)
if (ent->v.v.absmin[node->axis] > node->dist)
node = node->children[0];
else if (ent->v.absmax[node->axis] < node->dist)
else if (ent->v.v.absmax[node->axis] < node->dist)
node = node->children[1];
else
break; // crosses the node
@ -447,7 +447,7 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
// link it in
if (ent->v.solid == SOLID_TRIGGER)
if (ent->v.v.solid == SOLID_TRIGGER)
InsertLinkBefore (&ent->area, &node->trigger_edicts);
else
InsertLinkBefore (&ent->area, &node->solid_edicts);
@ -533,7 +533,7 @@ SV_TestEntityPosition (edict_t *ent)
trace_t trace;
trace =
SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, 0,
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, ent->v.v.origin, 0,
ent);
if (trace.startsolid)
@ -753,38 +753,38 @@ 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 (touch->v.solid == SOLID_NOT)
if (touch->v.v.solid == SOLID_NOT)
continue;
if (touch == clip->passedict)
continue;
if (touch->v.solid == SOLID_TRIGGER)
if (touch->v.v.solid == SOLID_TRIGGER)
SV_Error ("Trigger in clipping list");
if (clip->type == MOVE_NOMONSTERS && touch->v.solid != SOLID_BSP)
if (clip->type == MOVE_NOMONSTERS && touch->v.v.solid != SOLID_BSP)
continue;
if (clip->boxmins[0] > touch->v.absmax[0]
|| clip->boxmins[1] > touch->v.absmax[1]
|| clip->boxmins[2] > touch->v.absmax[2]
|| clip->boxmaxs[0] < touch->v.absmin[0]
|| clip->boxmaxs[1] < touch->v.absmin[1]
|| clip->boxmaxs[2] < touch->v.absmin[2])
if (clip->boxmins[0] > touch->v.v.absmax[0]
|| clip->boxmins[1] > touch->v.v.absmax[1]
|| clip->boxmins[2] > touch->v.v.absmax[2]
|| clip->boxmaxs[0] < touch->v.v.absmin[0]
|| clip->boxmaxs[1] < touch->v.v.absmin[1]
|| clip->boxmaxs[2] < touch->v.v.absmin[2])
continue;
if (clip->passedict != 0 && clip->passedict->v.size[0]
&& !touch->v.size[0]) continue; // points never interact
if (clip->passedict != 0 && clip->passedict->v.v.size[0]
&& !touch->v.v.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, touch->v.owner) == clip->passedict)
if (PROG_TO_EDICT (&sv_pr_state, touch->v.v.owner) == clip->passedict)
continue; // don't clip against own missiles
if (PROG_TO_EDICT (&sv_pr_state, clip->passedict->v.owner) == touch)
if (PROG_TO_EDICT (&sv_pr_state, clip->passedict->v.v.owner) == touch)
continue; // don't clip against owner
}
if ((int) touch->v.flags & FL_MONSTER)
if ((int) touch->v.v.flags & FL_MONSTER)
trace =
SV_ClipMoveToEntity (touch, clip->start, clip->mins2,
clip->maxs2, clip->end);
@ -910,30 +910,30 @@ SV_TestPlayerPosition (edict_t *ent, vec3_t origin)
CONTENTS_EMPTY) return sv.edicts;
// check all entities
VectorAdd (origin, ent->v.mins, boxmins);
VectorAdd (origin, ent->v.maxs, boxmaxs);
VectorAdd (origin, ent->v.v.mins, boxmins);
VectorAdd (origin, ent->v.v.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)) {
if (check->free)
continue;
if (check->v.solid != SOLID_BSP &&
check->v.solid != SOLID_BBOX && check->v.solid != SOLID_SLIDEBOX)
if (check->v.v.solid != SOLID_BSP &&
check->v.v.solid != SOLID_BBOX && check->v.v.solid != SOLID_SLIDEBOX)
continue;
if (boxmins[0] > check->v.absmax[0]
|| boxmins[1] > check->v.absmax[1]
|| boxmins[2] > check->v.absmax[2]
|| boxmaxs[0] < check->v.absmin[0]
|| boxmaxs[1] < check->v.absmin[1]
|| boxmaxs[2] < check->v.absmin[2])
if (boxmins[0] > check->v.v.absmax[0]
|| boxmins[1] > check->v.v.absmax[1]
|| boxmins[2] > check->v.v.absmax[2]
|| boxmaxs[0] < check->v.v.absmin[0]
|| boxmaxs[1] < check->v.v.absmin[1]
|| boxmaxs[2] < check->v.v.absmin[2])
continue;
if (check == ent)
continue;
// get the clipping hull
hull = SV_HullForEntity (check, ent->v.mins, ent->v.maxs, offset);
hull = SV_HullForEntity (check, ent->v.v.mins, ent->v.v.maxs, offset);
VectorSubtract (origin, offset, offset);