change all the SVFIELD calls to SVtype. this should make the code a little

easier to read.
This commit is contained in:
Bill Currie 2001-08-08 20:28:53 +00:00
parent cd522a6f97
commit fb42199637
23 changed files with 1166 additions and 1150 deletions

View file

@ -188,4 +188,11 @@ extern sv_fields_t sv_fields;
#define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
#endif
#define SVfloat(e,f) SVFIELD (e, f, float)
#define SVstring(e,f) SVFIELD (e, f, string)
#define SVfunc(e,f) SVFIELD (e, f, func)
#define SVentity(e,f) SVFIELD (e, f, entity)
#define SVvector(e,f) SVFIELD (e, f, vector)
#define SVinteger(e,f) SVFIELD (e, f, integer)
#endif // __sv_progs_h

View file

@ -117,7 +117,7 @@ Host_Status_f (void)
} else
hours = 0;
print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j + 1, client->name,
(int) SVFIELD (client->edict, frags, float), hours, minutes, seconds);
(int) SVfloat (client->edict, frags), hours, minutes, seconds);
print (" %s\n", client->netconnection->address);
}
}
@ -141,8 +141,8 @@ Host_God_f (void)
if (*sv_globals.deathmatch && !host_client->privileged)
return;
SVFIELD (sv_player, flags, float) = (int) SVFIELD (sv_player, flags, float) ^ FL_GODMODE;
if (!((int) SVFIELD (sv_player, flags, float) & FL_GODMODE))
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ FL_GODMODE;
if (!((int) SVfloat (sv_player, flags) & FL_GODMODE))
SV_ClientPrintf ("godmode OFF\n");
else
SV_ClientPrintf ("godmode ON\n");
@ -159,8 +159,8 @@ Host_Notarget_f (void)
if (*sv_globals.deathmatch && !host_client->privileged)
return;
SVFIELD (sv_player, flags, float) = (int) SVFIELD (sv_player, flags, float) ^ FL_NOTARGET;
if (!((int) SVFIELD (sv_player, flags, float) & FL_NOTARGET))
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ FL_NOTARGET;
if (!((int) SVfloat (sv_player, flags) & FL_NOTARGET))
SV_ClientPrintf ("notarget OFF\n");
else
SV_ClientPrintf ("notarget ON\n");
@ -179,13 +179,13 @@ Host_Noclip_f (void)
if (*sv_globals.deathmatch && !host_client->privileged)
return;
if (SVFIELD (sv_player, movetype, float) != MOVETYPE_NOCLIP) {
if (SVfloat (sv_player, movetype) != MOVETYPE_NOCLIP) {
noclip_anglehack = true;
SVFIELD (sv_player, movetype, float) = MOVETYPE_NOCLIP;
SVfloat (sv_player, movetype) = MOVETYPE_NOCLIP;
SV_ClientPrintf ("noclip ON\n");
} else {
noclip_anglehack = false;
SVFIELD (sv_player, movetype, float) = MOVETYPE_WALK;
SVfloat (sv_player, movetype) = MOVETYPE_WALK;
SV_ClientPrintf ("noclip OFF\n");
}
}
@ -208,11 +208,11 @@ Host_Fly_f (void)
if (*sv_globals.deathmatch && !host_client->privileged)
return;
if (SVFIELD (sv_player, movetype, float) != MOVETYPE_FLY) {
SVFIELD (sv_player, movetype, float) = MOVETYPE_FLY;
if (SVfloat (sv_player, movetype) != MOVETYPE_FLY) {
SVfloat (sv_player, movetype) = MOVETYPE_FLY;
SV_ClientPrintf ("flymode ON\n");
} else {
SVFIELD (sv_player, movetype, float) = MOVETYPE_WALK;
SVfloat (sv_player, movetype) = MOVETYPE_WALK;
SV_ClientPrintf ("flymode OFF\n");
}
}
@ -517,7 +517,7 @@ Host_Savegame_f (void)
}
for (i = 0; i < svs.maxclients; i++) {
if (svs.clients[i].active && (SVFIELD (svs.clients[i].edict, health, float) <= 0)) {
if (svs.clients[i].active && (SVfloat (svs.clients[i].edict, health) <= 0)) {
Con_Printf ("Can't savegame with a dead player\n");
return;
}
@ -755,7 +755,7 @@ SaveGamestate ()
for (i = svs.maxclients + 1; i < sv.num_edicts; i++) {
ent = EDICT_NUM (i);
if ((int) SVFIELD (ent, flags, float) & FL_ARCHIVE_OVERRIDE)
if ((int) SVfloat (ent, flags) & FL_ARCHIVE_OVERRIDE)
continue;
Qprintf (f, "%i\n", i);
ED_Write (f, ent);
@ -942,7 +942,7 @@ Host_Name_f (void)
if (strcmp (host_client->name, newName) != 0)
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
strcpy (host_client->name, newName);
SVFIELD (host_client->edict, netname, string) =
SVstring (host_client->edict, netname) =
PR_SetString (&sv_pr_state, host_client->name);
// send notification to all clients
@ -1009,7 +1009,7 @@ Host_Say (qboolean teamonly)
if (!client || !client->active || !client->spawned)
continue;
if (teamplay->int_val && teamonly
&& SVFIELD (client->edict, team, float) != SVFIELD (save->edict, team, float)) continue;
&& SVfloat (client->edict, team) != SVfloat (save->edict, team)) continue;
host_client = client;
SV_ClientPrintf ("%s", text);
}
@ -1095,7 +1095,7 @@ Host_Kill_f (void)
return;
}
if (SVFIELD (sv_player, health, float) <= 0) {
if (SVfloat (sv_player, health) <= 0) {
SV_ClientPrintf ("Can't suicide -- already dead!\n");
return;
}
@ -1127,10 +1127,10 @@ Host_Pause_f (void)
if (sv.paused) {
SV_BroadcastPrintf ("%s paused the game\n",
PR_GetString (&sv_pr_state, SVFIELD (sv_player, netname, string)));
PR_GetString (&sv_pr_state, SVstring (sv_player, netname)));
} else {
SV_BroadcastPrintf ("%s unpaused the game\n",
PR_GetString (&sv_pr_state, SVFIELD (sv_player, netname, string)));
PR_GetString (&sv_pr_state, SVstring (sv_player, netname)));
}
// send notification to all clients
@ -1197,9 +1197,9 @@ Host_Spawn_f (void)
ent = host_client->edict;
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
SVFIELD (ent, colormap, float) = NUM_FOR_EDICT (&sv_pr_state, ent);
SVFIELD (ent, team, float) = (host_client->colors & 15) + 1;
SVFIELD (ent, netname, string) = PR_SetString (&sv_pr_state, host_client->name);
SVfloat (ent, colormap) = NUM_FOR_EDICT (&sv_pr_state, ent);
SVfloat (ent, team) = (host_client->colors & 15) + 1;
SVstring (ent, netname) = PR_SetString (&sv_pr_state, host_client->name);
// copy spawn parms out of the client_t
@ -1281,7 +1281,7 @@ Host_Spawn_f (void)
ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients));
MSG_WriteByte (&host_client->message, svc_setangle);
for (i = 0; i < 2; i++)
MSG_WriteAngle (&host_client->message, SVFIELD (ent, angles, vector)[i]);
MSG_WriteAngle (&host_client->message, SVvector (ent, angles)[i]);
MSG_WriteAngle (&host_client->message, 0);
SV_WriteClientdataToMessage (sv_player, &host_client->message);
@ -1437,23 +1437,23 @@ Host_Give_f (void)
if (hipnotic) {
if (t[0] == '6') {
if (t[1] == 'a')
SVFIELD (sv_player, items, float) =
(int) SVFIELD (sv_player, items, float) | HIT_PROXIMITY_GUN;
SVfloat (sv_player, items) =
(int) SVfloat (sv_player, items) | HIT_PROXIMITY_GUN;
else
SVFIELD (sv_player, items, float) =
(int) SVFIELD (sv_player, items, float) | IT_GRENADE_LAUNCHER;
SVfloat (sv_player, items) =
(int) SVfloat (sv_player, items) | IT_GRENADE_LAUNCHER;
} else if (t[0] == '9')
SVFIELD (sv_player, items, float) =
(int) SVFIELD (sv_player, items, float) | HIT_LASER_CANNON;
SVfloat (sv_player, items) =
(int) SVfloat (sv_player, items) | HIT_LASER_CANNON;
else if (t[0] == '0')
SVFIELD (sv_player, items, float) = (int) SVFIELD (sv_player, items, float) | HIT_MJOLNIR;
SVfloat (sv_player, items) = (int) SVfloat (sv_player, items) | HIT_MJOLNIR;
else if (t[0] >= '2')
SVFIELD (sv_player, items, float) =
(int) SVFIELD (sv_player, items, float) | (IT_SHOTGUN << (t[0] - '2'));
SVfloat (sv_player, items) =
(int) SVfloat (sv_player, items) | (IT_SHOTGUN << (t[0] - '2'));
} else {
if (t[0] >= '2')
SVFIELD (sv_player, items, float) =
(int) SVFIELD (sv_player, items, float) | (IT_SHOTGUN << (t[0] - '2'));
SVfloat (sv_player, items) =
(int) SVfloat (sv_player, items) | (IT_SHOTGUN << (t[0] - '2'));
}
break;
@ -1464,18 +1464,18 @@ Host_Give_f (void)
val->_float = v;
}
SVFIELD (sv_player, ammo_shells, float) = v;
SVfloat (sv_player, ammo_shells) = v;
break;
case 'n':
if (rogue) {
val = GetEdictFieldValue (&sv_pr_state, sv_player, "ammo_nails1");
if (val) {
val->_float = v;
if (SVFIELD (sv_player, weapon, float) <= IT_LIGHTNING)
SVFIELD (sv_player, ammo_nails, float) = v;
if (SVfloat (sv_player, weapon) <= IT_LIGHTNING)
SVfloat (sv_player, ammo_nails) = v;
}
} else {
SVFIELD (sv_player, ammo_nails, float) = v;
SVfloat (sv_player, ammo_nails) = v;
}
break;
case 'l':
@ -1484,8 +1484,8 @@ Host_Give_f (void)
GetEdictFieldValue (&sv_pr_state, sv_player, "ammo_lava_nails");
if (val) {
val->_float = v;
if (SVFIELD (sv_player, weapon, float) > IT_LIGHTNING)
SVFIELD (sv_player, ammo_nails, float) = v;
if (SVfloat (sv_player, weapon) > IT_LIGHTNING)
SVfloat (sv_player, ammo_nails) = v;
}
}
break;
@ -1494,11 +1494,11 @@ Host_Give_f (void)
val = GetEdictFieldValue (&sv_pr_state, sv_player, "ammo_rockets1");
if (val) {
val->_float = v;
if (SVFIELD (sv_player, weapon, float) <= IT_LIGHTNING)
SVFIELD (sv_player, ammo_rockets, float) = v;
if (SVfloat (sv_player, weapon) <= IT_LIGHTNING)
SVfloat (sv_player, ammo_rockets) = v;
}
} else {
SVFIELD (sv_player, ammo_rockets, float) = v;
SVfloat (sv_player, ammo_rockets) = v;
}
break;
case 'm':
@ -1508,24 +1508,24 @@ Host_Give_f (void)
"ammo_multi_rockets");
if (val) {
val->_float = v;
if (SVFIELD (sv_player, weapon, float) > IT_LIGHTNING)
SVFIELD (sv_player, ammo_rockets, float) = v;
if (SVfloat (sv_player, weapon) > IT_LIGHTNING)
SVfloat (sv_player, ammo_rockets) = v;
}
}
break;
case 'h':
SVFIELD (sv_player, health, float) = v;
SVfloat (sv_player, health) = v;
break;
case 'c':
if (rogue) {
val = GetEdictFieldValue (&sv_pr_state, sv_player, "ammo_cells1");
if (val) {
val->_float = v;
if (SVFIELD (sv_player, weapon, float) <= IT_LIGHTNING)
SVFIELD (sv_player, ammo_cells, float) = v;
if (SVfloat (sv_player, weapon) <= IT_LIGHTNING)
SVfloat (sv_player, ammo_cells) = v;
}
} else {
SVFIELD (sv_player, ammo_cells, float) = v;
SVfloat (sv_player, ammo_cells) = v;
}
break;
case 'p':
@ -1533,8 +1533,8 @@ Host_Give_f (void)
val = GetEdictFieldValue (&sv_pr_state, sv_player, "ammo_plasma");
if (val) {
val->_float = v;
if (SVFIELD (sv_player, weapon, float) > IT_LIGHTNING)
SVFIELD (sv_player, ammo_cells, float) = v;
if (SVfloat (sv_player, weapon) > IT_LIGHTNING)
SVfloat (sv_player, ammo_cells) = v;
}
}
break;
@ -1551,7 +1551,7 @@ FindViewthing (void)
for (i = 0; i < sv.num_edicts; i++) {
e = EDICT_NUM (&sv_pr_state, i);
if (!strcmp (PR_GetString (&sv_pr_state, SVFIELD (e, classname, string)), "viewthing"))
if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)), "viewthing"))
return e;
}
Con_Printf ("No viewthing on map\n");
@ -1579,8 +1579,8 @@ Host_Viewmodel_f (void)
return;
}
SVFIELD (e, frame, float) = 0;
cl.model_precache[(int) SVFIELD (e, modelindex, float)] = m;
SVfloat (e, frame) = 0;
cl.model_precache[(int) SVfloat (e, modelindex)] = m;
}
/*
@ -1598,13 +1598,13 @@ Host_Viewframe_f (void)
e = FindViewthing ();
if (!e)
return;
m = cl.model_precache[(int) SVFIELD (e, modelindex, float)];
m = cl.model_precache[(int) SVfloat (e, modelindex)];
f = atoi (Cmd_Argv (1));
if (f >= m->numframes)
f = m->numframes - 1;
SVFIELD (e, frame, float) = f;
SVfloat (e, frame) = f;
}
@ -1636,13 +1636,13 @@ Host_Viewnext_f (void)
e = FindViewthing ();
if (!e)
return;
m = cl.model_precache[(int) SVFIELD (e, modelindex, float)];
m = cl.model_precache[(int) SVfloat (e, modelindex)];
SVFIELD (e, frame, float) = SVFIELD (e, frame, float) + 1;
if (SVFIELD (e, frame, float) >= m->numframes)
SVFIELD (e, frame, float) = m->numframes - 1;
SVfloat (e, frame) = SVfloat (e, frame) + 1;
if (SVfloat (e, frame) >= m->numframes)
SVfloat (e, frame) = m->numframes - 1;
PrintFrameName (m, SVFIELD (e, frame, float));
PrintFrameName (m, SVfloat (e, frame));
}
/*
@ -1660,13 +1660,13 @@ Host_Viewprev_f (void)
if (!e)
return;
m = cl.model_precache[(int) SVFIELD (e, modelindex, float)];
m = cl.model_precache[(int) SVfloat (e, modelindex)];
SVFIELD (e, frame, float) = SVFIELD (e, frame, float) - 1;
if (SVFIELD (e, frame, float) < 0)
SVFIELD (e, frame, float) = 0;
SVfloat (e, frame) = SVfloat (e, frame) - 1;
if (SVfloat (e, frame) < 0)
SVfloat (e, frame) = 0;
PrintFrameName (m, SVFIELD (e, frame, float));
PrintFrameName (m, SVfloat (e, frame));
}
/*

View file

@ -93,7 +93,7 @@ Host_Color_f (void)
}
host_client->colors = playercolor;
SVFIELD (host_client->edict, team, float) = bottom + 1;
SVfloat (host_client->edict, team) = bottom + 1;
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);

View file

@ -953,7 +953,7 @@ _Datagram_CheckNewConnections (void)
MSG_WriteByte (net_message->message, playerNumber);
MSG_WriteString (net_message->message, client->name);
MSG_WriteLong (net_message->message, client->colors);
MSG_WriteLong (net_message->message, SVFIELD (client->edict, frags, float));
MSG_WriteLong (net_message->message, SVfloat (client->edict, frags));
MSG_WriteLong (net_message->message,
(int) (net_time - client->netconnection->connecttime));
MSG_WriteString (net_message->message, client->netconnection->address);

View file

@ -157,7 +157,7 @@ PF_setorigin (progs_t * pr)
e = G_EDICT (pr, OFS_PARM0);
org = G_VECTOR (pr, OFS_PARM1);
VectorCopy (org, SVFIELD (e, origin, vector));
VectorCopy (org, SVvector (e, origin));
SV_LinkEdict (e, false);
}
@ -188,7 +188,7 @@ SetMinMaxSize (progs_t * pr, edict_t *e, float *min, float *max,
VectorCopy (max, rmax);
} else {
// find min / max for rotations
angles = SVFIELD (e, angles, vector);
angles = SVvector (e, angles);
a = angles[1] / 180 * M_PI;
@ -229,9 +229,9 @@ SetMinMaxSize (progs_t * pr, edict_t *e, float *min, float *max,
}
// set derived values
VectorCopy (rmin, SVFIELD (e, mins, vector));
VectorCopy (rmax, SVFIELD (e, maxs, vector));
VectorSubtract (max, min, SVFIELD (e, size, vector));
VectorCopy (rmin, SVvector (e, mins));
VectorCopy (rmax, SVvector (e, maxs));
VectorSubtract (max, min, SVvector (e, size));
SV_LinkEdict (e, false);
}
@ -285,10 +285,10 @@ PF_setmodel (progs_t * pr)
PR_RunError (pr, "no precache: %s\n", m);
SVFIELD (e, model, string) = PR_SetString (pr, m);
SVFIELD (e, modelindex, float) = i; // SV_ModelIndex (m);
SVstring (e, model) = PR_SetString (pr, m);
SVfloat (e, modelindex) = i; // SV_ModelIndex (m);
mod = sv.models[(int) SVFIELD (e, modelindex, float)]; // Mod_ForName (m, true);
mod = sv.models[(int) SVfloat (e, modelindex)]; // Mod_ForName (m, true);
if (mod)
SetMinMaxSize (pr, e, mod->mins, mod->maxs, true);
@ -756,9 +756,9 @@ PF_newcheckclient (progs_t * pr, int check)
if (ent->free)
continue;
if (SVFIELD (ent, health, float) <= 0)
if (SVfloat (ent, health) <= 0)
continue;
if ((int) SVFIELD (ent, flags, float) & FL_NOTARGET)
if ((int) SVfloat (ent, flags) & FL_NOTARGET)
continue;
// anything that is a client, or has a client as an enemy
@ -766,7 +766,7 @@ PF_newcheckclient (progs_t * pr, int check)
}
// get the PVS for the entity
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, view_ofs, vector), org);
VectorAdd (SVvector (ent, origin), SVvector (ent, view_ofs), org);
leaf = Mod_PointInLeaf (org, sv.worldmodel);
pvs = Mod_LeafPVS (leaf, sv.worldmodel);
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3);
@ -806,13 +806,13 @@ PF_checkclient (progs_t * pr)
}
// return check if it might be visible
ent = EDICT_NUM (pr, sv.lastcheck);
if (ent->free || SVFIELD (ent, health, float) <= 0) {
if (ent->free || SVfloat (ent, 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, *sv_globals.self);
VectorAdd (SVFIELD (self, origin, vector), SVFIELD (self, view_ofs, vector), view);
VectorAdd (SVvector (self, origin), SVvector (self, view_ofs), view);
leaf = Mod_PointInLeaf (view, sv.worldmodel);
l = (leaf - sv.worldmodel->leafs) - 1;
if ((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7)))) {
@ -944,16 +944,16 @@ PF_findradius (progs_t * pr)
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
if (ent->free)
continue;
if (SVFIELD (ent, solid, float) == SOLID_NOT)
if (SVfloat (ent, solid) == SOLID_NOT)
continue;
for (j = 0; j < 3; j++)
eorg[j] =
org[j] - (SVFIELD (ent, origin, vector)[j] +
(SVFIELD (ent, mins, vector)[j] + SVFIELD (ent, maxs, vector)[j]) * 0.5);
org[j] - (SVvector (ent, origin)[j] +
(SVvector (ent, mins)[j] + SVvector (ent, maxs)[j]) * 0.5);
if (Length (eorg) > rad)
continue;
SVFIELD (ent, chain, entity) = EDICT_TO_PROG (pr, chain);
SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);
chain = ent;
}
@ -1068,19 +1068,19 @@ PF_Find (progs_t * pr)
first = ed;
else if (second == (edict_t *) sv.edicts)
second = ed;
SVFIELD (ed, chain, entity) = EDICT_TO_PROG (pr, last);
SVentity (ed, chain) = EDICT_TO_PROG (pr, last);
last = ed;
}
}
if (first != last) {
if (last != second)
SVFIELD (first, chain, entity) = SVFIELD (last, chain, entity);
SVentity (first, chain) = SVentity (last, chain);
else
SVFIELD (first, chain, entity) = EDICT_TO_PROG (pr, last);
SVFIELD (last, chain, entity) = EDICT_TO_PROG (pr, (edict_t *) sv.edicts);
SVentity (first, chain) = EDICT_TO_PROG (pr, last);
SVentity (last, chain) = EDICT_TO_PROG (pr, (edict_t *) sv.edicts);
if (second && second != last)
SVFIELD (second, chain, entity) = EDICT_TO_PROG (pr, last);
SVentity (second, chain) = EDICT_TO_PROG (pr, last);
}
RETURN_EDICT (pr, first);
}
@ -1226,7 +1226,7 @@ PF_walkmove (progs_t * pr)
yaw = G_FLOAT (pr, OFS_PARM0);
dist = G_FLOAT (pr, OFS_PARM1);
if (!((int) SVFIELD (ent, flags, float) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (!((int) SVfloat (ent, flags) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
G_FLOAT (pr, OFS_RETURN) = 0;
return;
}
@ -1265,20 +1265,20 @@ PF_droptofloor (progs_t * pr)
ent = PROG_TO_EDICT (pr, *sv_globals.self);
VectorCopy (SVFIELD (ent, origin, vector), end);
VectorCopy (SVvector (ent, origin), end);
end[2] -= 256;
trace =
SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, false,
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), end, false,
ent);
if (trace.fraction == 1 || trace.allsolid)
G_FLOAT (pr, OFS_RETURN) = 0;
else {
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector));
VectorCopy (trace.endpos, SVvector (ent, origin));
SV_LinkEdict (ent, false);
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (pr, trace.ent);
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVentity (ent, groundentity) = EDICT_TO_PROG (pr, trace.ent);
G_FLOAT (pr, OFS_RETURN) = 1;
}
}
@ -1421,16 +1421,16 @@ PF_aim (progs_t * pr)
ent = G_EDICT (pr, OFS_PARM0);
speed = G_FLOAT (pr, OFS_PARM1);
VectorCopy (SVFIELD (ent, origin, vector), start);
VectorCopy (SVvector (ent, origin), start);
start[2] += 20;
// try sending a trace straight
VectorCopy (*sv_globals.v_forward, dir);
VectorMA (start, 2048, dir, end);
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
if (tr.ent && SVFIELD (tr.ent, takedamage, float) == DAMAGE_AIM
&& (!teamplay->int_val || SVFIELD (ent, team, float) <= 0
|| SVFIELD (ent, team, float) != SVFIELD (tr.ent, team, float))) {
if (tr.ent && SVfloat (tr.ent, takedamage) == DAMAGE_AIM
&& (!teamplay->int_val || SVfloat (ent, team) <= 0
|| SVfloat (ent, team) != SVfloat (tr.ent, team))) {
VectorCopy (*sv_globals.v_forward, G_VECTOR (pr, OFS_RETURN));
return;
}
@ -1441,16 +1441,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 (SVFIELD (check, takedamage, float) != DAMAGE_AIM)
if (SVfloat (check, takedamage) != DAMAGE_AIM)
continue;
if (check == ent)
continue;
if (teamplay->int_val && SVFIELD (ent, team, float) > 0
&& SVFIELD (ent, team, float) == SVFIELD (check, team, float)) continue; // don't aim at
if (teamplay->int_val && SVfloat (ent, team) > 0
&& SVfloat (ent, team) == SVfloat (check, team)) continue; // don't aim at
// teammate
for (j = 0; j < 3; j++)
end[j] = SVFIELD (check, origin, vector)[j]
+ 0.5 * (SVFIELD (check, mins, vector)[j] + SVFIELD (check, maxs, vector)[j]);
end[j] = SVvector (check, origin)[j]
+ 0.5 * (SVvector (check, mins)[j] + SVvector (check, maxs)[j]);
VectorSubtract (end, start, dir);
VectorNormalize (dir);
dist = DotProduct (dir, *sv_globals.v_forward);
@ -1464,7 +1464,7 @@ PF_aim (progs_t * pr)
}
if (bestent) {
VectorSubtract (SVFIELD (bestent, origin, vector), SVFIELD (ent, origin, vector), dir);
VectorSubtract (SVvector (bestent, origin), SVvector (ent, origin), dir);
dist = DotProduct (dir, *sv_globals.v_forward);
VectorScale (*sv_globals.v_forward, dist, end);
end[2] = dir[2];
@ -1489,9 +1489,9 @@ PF_changeyaw (progs_t * pr)
float ideal, current, move, speed;
ent = PROG_TO_EDICT (pr, *sv_globals.self);
current = anglemod (SVFIELD (ent, angles, vector)[1]);
ideal = SVFIELD (ent, ideal_yaw, float);
speed = SVFIELD (ent, yaw_speed, float);
current = anglemod (SVvector (ent, angles)[1]);
ideal = SVfloat (ent, ideal_yaw);
speed = SVfloat (ent, yaw_speed);
if (current == ideal)
return;
@ -1511,7 +1511,7 @@ PF_changeyaw (progs_t * pr)
move = -speed;
}
SVFIELD (ent, angles, vector)[1] = anglemod (current + move);
SVvector (ent, angles)[1] = anglemod (current + move);
}
#ifdef QUAKE2
@ -1527,9 +1527,9 @@ PF_changepitch (progs_t * pr)
float ideal, current, move, speed;
ent = G_EDICT (pr, OFS_PARM0);
current = anglemod (SVFIELD (ent, angles, vector)[0]);
ideal = SVFIELD (ent, idealpitch, float);
speed = SVFIELD (ent, pitch_speed, float);
current = anglemod (SVvector (ent, angles)[0]);
ideal = SVfloat (ent, idealpitch);
speed = SVfloat (ent, pitch_speed);
if (current == ideal)
return;
@ -1549,7 +1549,7 @@ PF_changepitch (progs_t * pr)
move = -speed;
}
SVFIELD (ent, angles, vector)[0] = anglemod (current + move);
SVvector (ent, angles)[0] = anglemod (current + move);
}
#endif
@ -1660,14 +1660,14 @@ PF_makestatic (progs_t * pr)
MSG_WriteByte (&sv.signon, svc_spawnstatic);
MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, SVFIELD (ent, model, string))));
MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, SVstring (ent, model))));
MSG_WriteByte (&sv.signon, SVFIELD (ent, frame, float));
MSG_WriteByte (&sv.signon, SVFIELD (ent, colormap, float));
MSG_WriteByte (&sv.signon, SVFIELD (ent, skin, float));
MSG_WriteByte (&sv.signon, SVfloat (ent, frame));
MSG_WriteByte (&sv.signon, SVfloat (ent, colormap));
MSG_WriteByte (&sv.signon, SVfloat (ent, skin));
for (i = 0; i < 3; i++) {
MSG_WriteCoord (&sv.signon, SVFIELD (ent, origin, vector)[i]);
MSG_WriteAngle (&sv.signon, SVFIELD (ent, angles, vector)[i]);
MSG_WriteCoord (&sv.signon, SVvector (ent, origin)[i]);
MSG_WriteAngle (&sv.signon, SVvector (ent, angles)[i]);
}
// throw the entity away now
@ -1764,49 +1764,49 @@ PF_WaterMove (progs_t * pr)
self = PROG_TO_EDICT (pr, *sv_globals.self);
if (SVFIELD (self, movetype, float) == MOVETYPE_NOCLIP) {
SVFIELD (self, air_finished, float) = sv.time + 12;
if (SVfloat (self, movetype) == MOVETYPE_NOCLIP) {
SVfloat (self, air_finished) = sv.time + 12;
G_FLOAT (pr, OFS_RETURN) = damage;
return;
}
if (SVFIELD (self, health, float) < 0) {
if (SVfloat (self, health) < 0) {
G_FLOAT (pr, OFS_RETURN) = damage;
return;
}
if (SVFIELD (self, deadflag, float) == DEAD_NO)
if (SVfloat (self, deadflag) == DEAD_NO)
drownlevel = 3;
else
drownlevel = 1;
flags = (int) SVFIELD (self, flags, float);
waterlevel = (int) SVFIELD (self, waterlevel, float);
watertype = (int) SVFIELD (self, watertype, float);
flags = (int) SVfloat (self, flags);
waterlevel = (int) SVfloat (self, waterlevel);
watertype = (int) SVfloat (self, watertype);
if (!(flags & (FL_IMMUNE_WATER + FL_GODMODE)))
if (((flags & FL_SWIM) && (waterlevel < drownlevel))
|| (waterlevel >= drownlevel)) {
if (SVFIELD (self, air_finished, float) < sv.time)
if (SVFIELD (self, pain_finished, float) < sv.time) {
SVFIELD (self, dmg, float) = SVFIELD (self, dmg, float) + 2;
if (SVFIELD (self, dmg, float) > 15)
SVFIELD (self, dmg, float) = 10;
if (SVfloat (self, air_finished) < sv.time)
if (SVfloat (self, pain_finished) < sv.time) {
SVfloat (self, dmg) = SVfloat (self, dmg) + 2;
if (SVfloat (self, dmg) > 15)
SVfloat (self, dmg) = 10;
// T_Damage (self, world, world, self.dmg, 0, FALSE);
damage = SVFIELD (self, dmg, float);
SVFIELD (self, pain_finished, float) = sv.time + 1.0;
damage = SVfloat (self, dmg);
SVfloat (self, pain_finished) = sv.time + 1.0;
}
} else {
if (SVFIELD (self, air_finished, float) < sv.time)
if (SVfloat (self, air_finished) < sv.time)
// sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_VOICE, "player/gasp2.wav", 255,
ATTN_NORM);
else if (SVFIELD (self, air_finished, float) < sv.time + 9)
else if (SVfloat (self, air_finished) < sv.time + 9)
// sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_VOICE, "player/gasp1.wav", 255,
ATTN_NORM);
SVFIELD (self, air_finished, float) = sv.time + 12.0;
SVFIELD (self, dmg, float) = 2;
SVfloat (self, air_finished) = sv.time + 12.0;
SVfloat (self, dmg) = 2;
}
if (!waterlevel) {
@ -1815,28 +1815,28 @@ PF_WaterMove (progs_t * pr)
// sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_BODY, "misc/outwater.wav", 255,
ATTN_NORM);
SVFIELD (self, flags, float) = (float) (flags & ~FL_INWATER);
SVfloat (self, flags) = (float) (flags & ~FL_INWATER);
}
SVFIELD (self, air_finished, float) = sv.time + 12.0;
SVfloat (self, air_finished) = sv.time + 12.0;
G_FLOAT (pr, OFS_RETURN) = damage;
return;
}
if (watertype == CONTENT_LAVA) { // do damage
if (!(flags & (FL_IMMUNE_LAVA + FL_GODMODE)))
if (SVFIELD (self, dmgtime, float) < sv.time) {
if (SVFIELD (self, radsuit_finished, float) < sv.time)
SVFIELD (self, dmgtime, float) = sv.time + 0.2;
if (SVfloat (self, dmgtime) < sv.time) {
if (SVfloat (self, radsuit_finished) < sv.time)
SVfloat (self, dmgtime) = sv.time + 0.2;
else
SVFIELD (self, dmgtime, float) = sv.time + 1.0;
SVfloat (self, dmgtime) = sv.time + 1.0;
// T_Damage (self, world, world, 10*self.waterlevel, 0, TRUE);
damage = (float) (10 * waterlevel);
}
} else if (watertype == CONTENT_SLIME) { // do damage
if (!(flags & (FL_IMMUNE_SLIME + FL_GODMODE)))
if (SVFIELD (self, dmgtime, float) < sv.time
&& SVFIELD (self, radsuit_finished, float) < sv.time) {
SVFIELD (self, dmgtime, float) = sv.time + 1.0;
if (SVfloat (self, dmgtime) < sv.time
&& SVfloat (self, radsuit_finished) < sv.time) {
SVfloat (self, dmgtime) = sv.time + 1.0;
// T_Damage (self, world, world, 4*self.waterlevel, 0, TRUE);
damage = (float) (4 * waterlevel);
}
@ -1857,15 +1857,15 @@ PF_WaterMove (progs_t * pr)
SV_StartSound (self, CHAN_BODY, "player/slimbrn2.wav", 255,
ATTN_NORM);
SVFIELD (self, flags, float) = (float) (flags | FL_INWATER);
SVFIELD (self, dmgtime, float) = 0;
SVfloat (self, flags) = (float) (flags | FL_INWATER);
SVfloat (self, dmgtime) = 0;
}
if (!(flags & FL_WATERJUMP)) {
// self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
VectorMA (SVFIELD (self, velocity, vector),
-0.8 * SVFIELD (self, waterlevel, float) * host_frametime,
SVFIELD (self, velocity, vector), SVFIELD (self, velocity, vector));
VectorMA (SVvector (self, velocity),
-0.8 * SVfloat (self, waterlevel) * host_frametime,
SVvector (self, velocity), SVvector (self, velocity));
}
G_FLOAT (pr, OFS_RETURN) = damage;

View file

@ -186,8 +186,8 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
MSG_WriteByte (&sv.datagram, sound_num);
for (i = 0; i < 3; i++)
MSG_WriteCoord (&sv.datagram,
SVFIELD (entity, origin, vector)[i] + 0.5 * (SVFIELD (entity, mins, vector)[i] +
SVFIELD (entity, maxs, vector)[i]));
SVvector (entity, origin)[i] + 0.5 * (SVvector (entity, mins)[i] +
SVvector (entity, maxs)[i]));
}
/*
@ -227,7 +227,7 @@ SV_SendServerinfo (client_t *client)
MSG_WriteByte (&client->message, GAME_COOP);
snprintf (message, sizeof (message),
PR_GetString (&sv_pr_state, SVFIELD (sv.edicts, message, string)));
PR_GetString (&sv_pr_state, SVstring (sv.edicts, message)));
MSG_WriteString (&client->message, message);
@ -241,8 +241,8 @@ SV_SendServerinfo (client_t *client)
// send music
MSG_WriteByte (&client->message, svc_cdtrack);
MSG_WriteByte (&client->message, SVFIELD (sv.edicts, sounds, float));
MSG_WriteByte (&client->message, SVFIELD (sv.edicts, sounds, float));
MSG_WriteByte (&client->message, SVfloat (sv.edicts, sounds));
MSG_WriteByte (&client->message, SVfloat (sv.edicts, sounds));
// set view
MSG_WriteByte (&client->message, svc_setview);
@ -455,7 +455,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
edict_t *ent;
// find the client's PVS
VectorAdd (SVFIELD (clent, origin, vector), SVFIELD (clent, view_ofs, vector), org);
VectorAdd (SVvector (clent, origin), SVvector (clent, view_ofs), org);
pvs = SV_FatPVS (org);
// send over all entities (excpet the client) that touch the pvs
@ -463,7 +463,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
#ifdef QUAKE2
// don't send if flagged for NODRAW and there are no lighting effects
if (SVFIELD (ent, effects, float) == EF_NODRAW)
if (SVfloat (ent, effects) == EF_NODRAW)
continue;
#endif
@ -471,7 +471,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
if (ent != clent) // clent is ALLWAYS sent
{
// ignore ents without visible models
if (!SVFIELD (ent, modelindex, float) || !*PR_GetString (&sv_pr_state, SVFIELD (ent, model, string)))
if (!SVfloat (ent, modelindex) || !*PR_GetString (&sv_pr_state, SVstring (ent, model)))
continue;
for (i = 0; i < ent->num_leafs; i++)
@ -490,36 +490,36 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
bits = 0;
for (i = 0; i < 3; i++) {
miss = SVFIELD (ent, origin, vector)[i] - ((entity_state_t*)ent->data)->origin[i];
miss = SVvector (ent, origin)[i] - ((entity_state_t*)ent->data)->origin[i];
if (miss < -0.1 || miss > 0.1)
bits |= U_ORIGIN1 << i;
}
if (SVFIELD (ent, angles, vector)[0] != ((entity_state_t*)ent->data)->angles[0])
if (SVvector (ent, angles)[0] != ((entity_state_t*)ent->data)->angles[0])
bits |= U_ANGLE1;
if (SVFIELD (ent, angles, vector)[1] != ((entity_state_t*)ent->data)->angles[1])
if (SVvector (ent, angles)[1] != ((entity_state_t*)ent->data)->angles[1])
bits |= U_ANGLE2;
if (SVFIELD (ent, angles, vector)[2] != ((entity_state_t*)ent->data)->angles[2])
if (SVvector (ent, angles)[2] != ((entity_state_t*)ent->data)->angles[2])
bits |= U_ANGLE3;
if (SVFIELD (ent, movetype, float) == MOVETYPE_STEP)
if (SVfloat (ent, movetype) == MOVETYPE_STEP)
bits |= U_NOLERP; // don't mess up the step animation
if (((entity_state_t*)ent->data)->colormap != SVFIELD (ent, colormap, float))
if (((entity_state_t*)ent->data)->colormap != SVfloat (ent, colormap))
bits |= U_COLORMAP;
if (((entity_state_t*)ent->data)->skin != SVFIELD (ent, skin, float))
if (((entity_state_t*)ent->data)->skin != SVfloat (ent, skin))
bits |= U_SKIN;
if (((entity_state_t*)ent->data)->frame != SVFIELD (ent, frame, float))
if (((entity_state_t*)ent->data)->frame != SVfloat (ent, frame))
bits |= U_FRAME;
if (((entity_state_t*)ent->data)->effects != SVFIELD (ent, effects, float))
if (((entity_state_t*)ent->data)->effects != SVfloat (ent, effects))
bits |= U_EFFECTS;
if (((entity_state_t*)ent->data)->modelindex != SVFIELD (ent, modelindex, float))
if (((entity_state_t*)ent->data)->modelindex != SVfloat (ent, modelindex))
bits |= U_MODEL;
if (e >= 256)
@ -541,27 +541,27 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
MSG_WriteByte (msg, e);
if (bits & U_MODEL)
MSG_WriteByte (msg, SVFIELD (ent, modelindex, float));
MSG_WriteByte (msg, SVfloat (ent, modelindex));
if (bits & U_FRAME)
MSG_WriteByte (msg, SVFIELD (ent, frame, float));
MSG_WriteByte (msg, SVfloat (ent, frame));
if (bits & U_COLORMAP)
MSG_WriteByte (msg, SVFIELD (ent, colormap, float));
MSG_WriteByte (msg, SVfloat (ent, colormap));
if (bits & U_SKIN)
MSG_WriteByte (msg, SVFIELD (ent, skin, float));
MSG_WriteByte (msg, SVfloat (ent, skin));
if (bits & U_EFFECTS)
MSG_WriteByte (msg, SVFIELD (ent, effects, float));
MSG_WriteByte (msg, SVfloat (ent, effects));
if (bits & U_ORIGIN1)
MSG_WriteCoord (msg, SVFIELD (ent, origin, vector)[0]);
MSG_WriteCoord (msg, SVvector (ent, origin)[0]);
if (bits & U_ANGLE1)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[0]);
MSG_WriteAngle (msg, SVvector (ent, angles)[0]);
if (bits & U_ORIGIN2)
MSG_WriteCoord (msg, SVFIELD (ent, origin, vector)[1]);
MSG_WriteCoord (msg, SVvector (ent, origin)[1]);
if (bits & U_ANGLE2)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[1]);
MSG_WriteAngle (msg, SVvector (ent, angles)[1]);
if (bits & U_ORIGIN3)
MSG_WriteCoord (msg, SVFIELD (ent, origin, vector)[2]);
MSG_WriteCoord (msg, SVvector (ent, origin)[2]);
if (bits & U_ANGLE3)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[2]);
MSG_WriteAngle (msg, SVvector (ent, angles)[2]);
}
}
@ -579,7 +579,7 @@ SV_CleanupEnts (void)
ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
SVFIELD (ent, effects, float) = (int) SVFIELD (ent, effects, float) & ~EF_MUZZLEFLASH;
SVfloat (ent, effects) = (int) SVfloat (ent, effects) & ~EF_MUZZLEFLASH;
}
}
@ -605,18 +605,18 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
//
// send a damage message
//
if (SVFIELD (ent, dmg_take, float) || SVFIELD (ent, dmg_save, float)) {
other = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, dmg_inflictor, entity));
if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) {
other = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, dmg_inflictor));
MSG_WriteByte (msg, svc_damage);
MSG_WriteByte (msg, SVFIELD (ent, dmg_save, float));
MSG_WriteByte (msg, SVFIELD (ent, dmg_take, float));
MSG_WriteByte (msg, SVfloat (ent, dmg_save));
MSG_WriteByte (msg, SVfloat (ent, dmg_take));
for (i = 0; i < 3; i++)
MSG_WriteCoord (msg,
SVFIELD (other, origin, vector)[i] + 0.5 * (SVFIELD (other, mins, vector)[i] +
SVFIELD (other, maxs, vector)[i]));
SVvector (other, origin)[i] + 0.5 * (SVvector (other, mins)[i] +
SVvector (other, maxs)[i]));
SVFIELD (ent, dmg_take, float) = 0;
SVFIELD (ent, dmg_save, float) = 0;
SVfloat (ent, dmg_take) = 0;
SVfloat (ent, dmg_save) = 0;
}
//
// send the current viewpos offset from the view entity
@ -624,57 +624,57 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
SV_SetIdealPitch (); // how much to look up / down ideally
// a fixangle might get lost in a dropped packet. Oh well.
if (SVFIELD (ent, fixangle, float)) {
if (SVfloat (ent, fixangle)) {
MSG_WriteByte (msg, svc_setangle);
for (i = 0; i < 3; i++)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[i]);
SVFIELD (ent, fixangle, float) = 0;
MSG_WriteAngle (msg, SVvector (ent, angles)[i]);
SVfloat (ent, fixangle) = 0;
}
bits = 0;
if (SVFIELD (ent, view_ofs, vector)[2] != DEFAULT_VIEWHEIGHT)
if (SVvector (ent, view_ofs)[2] != DEFAULT_VIEWHEIGHT)
bits |= SU_VIEWHEIGHT;
if (SVFIELD (ent, idealpitch, float))
if (SVfloat (ent, idealpitch))
bits |= SU_IDEALPITCH;
// stuff the sigil bits into the high bits of items for sbar, or else
// mix in items2
#ifdef QUAKE2
items = (int) SVFIELD (ent, items, float) | ((int) SVFIELD (ent, items2, float) << 23);
items = (int) SVfloat (ent, items) | ((int) SVfloat (ent, items2) << 23);
#else
val = GetEdictFieldValue (&sv_pr_state, ent, "items2");
if (val)
items = (int) SVFIELD (ent, items, float) | ((int) val->float_var << 23);
items = (int) SVfloat (ent, items) | ((int) val->float_var << 23);
else
items =
(int) SVFIELD (ent, items, float) | ((int) *sv_globals.serverflags << 28);
(int) SVfloat (ent, items) | ((int) *sv_globals.serverflags << 28);
#endif
bits |= SU_ITEMS;
if ((int) SVFIELD (ent, flags, float) & FL_ONGROUND)
if ((int) SVfloat (ent, flags) & FL_ONGROUND)
bits |= SU_ONGROUND;
if (SVFIELD (ent, waterlevel, float) >= 2)
if (SVfloat (ent, waterlevel) >= 2)
bits |= SU_INWATER;
for (i = 0; i < 3; i++) {
if (SVFIELD (ent, punchangle, vector)[i])
if (SVvector (ent, punchangle)[i])
bits |= (SU_PUNCH1 << i);
if (SVFIELD (ent, velocity, vector)[i])
if (SVvector (ent, velocity)[i])
bits |= (SU_VELOCITY1 << i);
}
if (SVFIELD (ent, weaponframe, float))
if (SVfloat (ent, weaponframe))
bits |= SU_WEAPONFRAME;
if (SVFIELD (ent, armorvalue, float))
if (SVfloat (ent, armorvalue))
bits |= SU_ARMOR;
// if (SVFIELD (ent, weapon, float))
// if (SVfloat (ent, weapon))
bits |= SU_WEAPON;
// send the data
@ -683,42 +683,42 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
MSG_WriteShort (msg, bits);
if (bits & SU_VIEWHEIGHT)
MSG_WriteChar (msg, SVFIELD (ent, view_ofs, vector)[2]);
MSG_WriteChar (msg, SVvector (ent, view_ofs)[2]);
if (bits & SU_IDEALPITCH)
MSG_WriteChar (msg, SVFIELD (ent, idealpitch, float));
MSG_WriteChar (msg, SVfloat (ent, idealpitch));
for (i = 0; i < 3; i++) {
if (bits & (SU_PUNCH1 << i))
MSG_WriteChar (msg, SVFIELD (ent, punchangle, vector)[i]);
MSG_WriteChar (msg, SVvector (ent, punchangle)[i]);
if (bits & (SU_VELOCITY1 << i))
MSG_WriteChar (msg, SVFIELD (ent, velocity, vector)[i] / 16);
MSG_WriteChar (msg, SVvector (ent, velocity)[i] / 16);
}
// [always sent] if (bits & SU_ITEMS)
MSG_WriteLong (msg, items);
if (bits & SU_WEAPONFRAME)
MSG_WriteByte (msg, SVFIELD (ent, weaponframe, float));
MSG_WriteByte (msg, SVfloat (ent, weaponframe));
if (bits & SU_ARMOR)
MSG_WriteByte (msg, SVFIELD (ent, armorvalue, float));
MSG_WriteByte (msg, SVfloat (ent, armorvalue));
if (bits & SU_WEAPON)
MSG_WriteByte (msg,
SV_ModelIndex (PR_GetString (&sv_pr_state,
SVFIELD (ent, weaponmodel, string))));
SVstring (ent, weaponmodel))));
MSG_WriteShort (msg, SVFIELD (ent, health, float));
MSG_WriteByte (msg, SVFIELD (ent, currentammo, float));
MSG_WriteByte (msg, SVFIELD (ent, ammo_shells, float));
MSG_WriteByte (msg, SVFIELD (ent, ammo_nails, float));
MSG_WriteByte (msg, SVFIELD (ent, ammo_rockets, float));
MSG_WriteByte (msg, SVFIELD (ent, ammo_cells, float));
MSG_WriteShort (msg, SVfloat (ent, health));
MSG_WriteByte (msg, SVfloat (ent, currentammo));
MSG_WriteByte (msg, SVfloat (ent, ammo_shells));
MSG_WriteByte (msg, SVfloat (ent, ammo_nails));
MSG_WriteByte (msg, SVfloat (ent, ammo_rockets));
MSG_WriteByte (msg, SVfloat (ent, ammo_cells));
if (standard_quake) {
MSG_WriteByte (msg, SVFIELD (ent, weapon, float));
MSG_WriteByte (msg, SVfloat (ent, weapon));
} else {
for (i = 0; i < 32; i++) {
if (((int) SVFIELD (ent, weapon, float)) & (1 << i)) {
if (((int) SVfloat (ent, weapon)) & (1 << i)) {
MSG_WriteByte (msg, i);
break;
}
@ -778,17 +778,17 @@ SV_UpdateToReliableMessages (void)
// check for changes to be sent over the reliable streams
for (i = 0, host_client = svs.clients; i < svs.maxclients;
i++, host_client++) {
if (host_client->old_frags != SVFIELD (host_client->edict, frags, float)) {
if (host_client->old_frags != SVfloat (host_client->edict, frags)) {
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) {
if (!client->active)
continue;
MSG_WriteByte (&client->message, svc_updatefrags);
MSG_WriteByte (&client->message, i);
MSG_WriteShort (&client->message,
SVFIELD (host_client->edict, frags, float));
SVfloat (host_client->edict, frags));
}
host_client->old_frags = SVFIELD (host_client->edict, frags, float);
host_client->old_frags = SVfloat (host_client->edict, frags);
}
}
@ -949,23 +949,23 @@ SV_CreateBaseline (void)
svent = EDICT_NUM (&sv_pr_state, entnum);
if (svent->free)
continue;
if (entnum > svs.maxclients && !SVFIELD (svent, modelindex, float))
if (entnum > svs.maxclients && !SVfloat (svent, modelindex))
continue;
//
// create entity baseline
//
VectorCopy (SVFIELD (svent, origin, vector), ((entity_state_t*)svent->data)->origin);
VectorCopy (SVFIELD (svent, angles, vector), ((entity_state_t*)svent->data)->angles);
((entity_state_t*)svent->data)->frame = SVFIELD (svent, frame, float);
((entity_state_t*)svent->data)->skin = SVFIELD (svent, skin, float);
VectorCopy (SVvector (svent, origin), ((entity_state_t*)svent->data)->origin);
VectorCopy (SVvector (svent, angles), ((entity_state_t*)svent->data)->angles);
((entity_state_t*)svent->data)->frame = SVfloat (svent, frame);
((entity_state_t*)svent->data)->skin = SVfloat (svent, skin);
if (entnum > 0 && entnum <= svs.maxclients) {
((entity_state_t*)svent->data)->colormap = entnum;
((entity_state_t*)svent->data)->modelindex = SV_ModelIndex ("progs/player.mdl");
} else {
((entity_state_t*)svent->data)->colormap = 0;
((entity_state_t*)svent->data)->modelindex =
SV_ModelIndex (PR_GetString (&sv_pr_state,SVFIELD (svent, model, string)));
SV_ModelIndex (PR_GetString (&sv_pr_state,SVstring (svent, model)));
}
//
@ -1175,10 +1175,10 @@ SV_SpawnServer (const char *server)
ent = EDICT_NUM (&sv_pr_state, 0);
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
ent->free = false;
SVFIELD (ent, model, string) = PR_SetString (&sv_pr_state, sv.worldmodel->name);
SVFIELD (ent, modelindex, float) = 1; // world model
SVFIELD (ent, solid, float) = SOLID_BSP;
SVFIELD (ent, movetype, float) = MOVETYPE_PUSH;
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->name);
SVfloat (ent, modelindex) = 1; // world model
SVfloat (ent, solid) = SOLID_BSP;
SVfloat (ent, movetype) = MOVETYPE_PUSH;
if (coop->int_val)
*sv_globals.coop = coop->int_val;

View file

@ -52,8 +52,8 @@ SV_CheckBottom (edict_t *ent)
int x, y;
float mid, bottom;
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), mins);
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, maxs, vector), maxs);
VectorAdd (SVvector (ent, origin), SVvector (ent, mins), mins);
VectorAdd (SVvector (ent, origin), SVvector (ent, maxs), maxs);
// if all of the points under the corners are solid world, don't bother
// with the tougher checks
@ -124,32 +124,32 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
edict_t *enemy;
// try the move
VectorCopy (SVFIELD (ent, origin, vector), oldorg);
VectorAdd (SVFIELD (ent, origin, vector), move, neworg);
VectorCopy (SVvector (ent, origin), oldorg);
VectorAdd (SVvector (ent, origin), move, neworg);
// flying monsters don't step up
if ((int) SVFIELD (ent, flags, float) & (FL_SWIM | FL_FLY)) {
if ((int) SVfloat (ent, flags) & (FL_SWIM | FL_FLY)) {
// try one move with vertical motion, then one without
for (i = 0; i < 2; i++) {
VectorAdd (SVFIELD (ent, origin, vector), move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, enemy, entity));
VectorAdd (SVvector (ent, origin), move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, enemy));
if (i == 0 && enemy != sv.edicts) {
dz =
SVFIELD (ent, origin, vector)[2] - SVFIELD (enemy, origin, vector)[2];
SVvector (ent, origin)[2] - SVvector (enemy, origin)[2];
if (dz > 40)
neworg[2] -= 8;
if (dz < 30)
neworg[2] += 8;
}
trace =
SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), neworg, false, ent);
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), neworg, false, ent);
if (trace.fraction == 1) {
if (((int) SVFIELD (ent, flags, float) & FL_SWIM)
if (((int) SVfloat (ent, flags) & FL_SWIM)
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
return false; // swim monster left water
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector));
VectorCopy (trace.endpos, SVvector (ent, origin));
if (relink)
SV_LinkEdict (ent, true);
return true;
@ -166,24 +166,24 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
VectorCopy (neworg, end);
end[2] -= STEPSIZE * 2;
trace = SV_Move (neworg, SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, false, ent);
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, maxs), end, false, ent);
if (trace.allsolid)
return false;
if (trace.startsolid) {
neworg[2] -= STEPSIZE;
trace = SV_Move (neworg, SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, false, ent);
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, 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) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) {
VectorAdd (SVFIELD (ent, origin, vector), move, SVFIELD (ent, origin, vector));
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
VectorAdd (SVvector (ent, origin), move, SVvector (ent, origin));
if (relink)
SV_LinkEdict (ent, true);
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) & ~FL_ONGROUND;
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_ONGROUND;
// Con_Printf ("fall down\n");
return true;
}
@ -191,10 +191,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, SVFIELD (ent, origin, vector));
VectorCopy (trace.endpos, SVvector (ent, origin));
if (!SV_CheckBottom (ent)) {
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) { // entity had floor
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) { // entity had floor
// mostly pulled out
// from underneath it
// and is trying to correct
@ -202,15 +202,15 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
SV_LinkEdict (ent, true);
return true;
}
VectorCopy (oldorg, SVFIELD (ent, origin, vector));
VectorCopy (oldorg, SVvector (ent, origin));
return false;
}
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) {
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
// Con_Printf ("back on ground\n");
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) & ~FL_PARTIALGROUND;
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_PARTIALGROUND;
}
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
// the move is ok
if (relink)
@ -233,7 +233,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
vec3_t move, oldorigin;
float delta;
SVFIELD (ent, ideal_yaw, float) = yaw;
SVfloat (ent, ideal_yaw) = yaw;
PF_changeyaw (&sv_pr_state);
yaw = yaw * M_PI * 2 / 360;
@ -241,12 +241,12 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
move[1] = sin (yaw) * dist;
move[2] = 0;
VectorCopy (SVFIELD (ent, origin, vector), oldorigin);
VectorCopy (SVvector (ent, origin), oldorigin);
if (SV_movestep (ent, move, false)) {
delta = SVFIELD (ent, angles, vector)[YAW] - SVFIELD (ent, ideal_yaw, float);
delta = SVvector (ent, angles)[YAW] - SVfloat (ent, ideal_yaw);
if (delta > 45 && delta < 315) { // not turned far enough, so
// don't take the step
VectorCopy (oldorigin, SVFIELD (ent, origin, vector));
VectorCopy (oldorigin, SVvector (ent, origin));
}
SV_LinkEdict (ent, true);
return true;
@ -264,7 +264,7 @@ SV_FixCheckBottom (edict_t *ent)
{
// Con_Printf ("SV_FixCheckBottom\n");
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_PARTIALGROUND;
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_PARTIALGROUND;
}
@ -280,11 +280,11 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
float d[3];
float tdir, olddir, turnaround;
olddir = anglemod ((int) (SVFIELD (actor, ideal_yaw, float) / 45) * 45);
olddir = anglemod ((int) (SVfloat (actor, ideal_yaw) / 45) * 45);
turnaround = anglemod (olddir - 180);
deltax = SVFIELD (enemy, origin, vector)[0] - SVFIELD (actor, origin, vector)[0];
deltay = SVFIELD (enemy, origin, vector)[1] - SVFIELD (actor, origin, vector)[1];
deltax = SVvector (enemy, origin)[0] - SVvector (actor, origin)[0];
deltay = SVvector (enemy, origin)[1] - SVvector (actor, origin)[1];
if (deltax > 10)
d[1] = 0;
else if (deltax < -10)
@ -340,7 +340,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
return;
SVFIELD (actor, ideal_yaw, float) = olddir; // can't move
SVfloat (actor, 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
@ -359,9 +359,9 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
int i;
for (i = 0; i < 3; i++) {
if (SVFIELD (goal, absmin, vector)[i] > SVFIELD (ent, absmax, vector)[i] + dist)
if (SVvector (goal, absmin)[i] > SVvector (ent, absmax)[i] + dist)
return false;
if (SVFIELD (goal, absmax, vector)[i] < SVFIELD (ent, absmin, vector)[i] - dist)
if (SVvector (goal, absmax)[i] < SVvector (ent, absmin)[i] - dist)
return false;
}
return true;
@ -377,20 +377,20 @@ SV_MoveToGoal (progs_t *pr)
float dist;
ent = PROG_TO_EDICT (pr, *pr->globals.self);
goal = PROG_TO_EDICT (pr, SVFIELD (ent, goalentity, entity));
goal = PROG_TO_EDICT (pr, SVentity (ent, goalentity));
dist = G_FLOAT (pr, OFS_PARM0);
if (!((int) SVFIELD (ent, flags, float) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (!((int) SVfloat (ent, flags) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
G_FLOAT (pr, OFS_RETURN) = 0;
return;
}
// if the next step hits the enemy, return immediately
if (PROG_TO_EDICT (pr, SVFIELD (ent, enemy, entity)) != sv.edicts
if (PROG_TO_EDICT (pr, SVentity (ent, enemy)) != sv.edicts
&& SV_CloseEnough (ent, goal, dist))
return;
// bump around...
if ((rand () & 3) == 1 || !SV_StepDirection (ent, SVFIELD (ent, ideal_yaw, float), dist)) {
if ((rand () & 3) == 1 || !SV_StepDirection (ent, SVfloat (ent, ideal_yaw), dist)) {
SV_NewChaseDir (ent, goal, dist);
}
}

File diff suppressed because it is too large Load diff

View file

@ -73,18 +73,18 @@ prune_edict (progs_t *pr, edict_t *ent)
{
// remove things from different skill levels or deathmatch
if (deathmatch->int_val) {
if (((int) SVFIELD (ent, spawnflags, float)
if (((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_DEATHMATCH)) {
return 1;
}
} else if ((current_skill == 0
&& ((int) SVFIELD (ent, spawnflags, float)
&& ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_EASY))
|| (current_skill == 1
&& ((int) SVFIELD (ent, spawnflags, float)
&& ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_MEDIUM))
|| (current_skill >= 2
&& ((int) SVFIELD (ent, spawnflags, float)
&& ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_HARD))) {
return 1;
}

View file

@ -81,17 +81,17 @@ SV_SetIdealPitch (void)
int i, j;
int step, dir, steps;
if (!((int) SVFIELD (sv_player, flags, float) & FL_ONGROUND))
if (!((int) SVfloat (sv_player, flags) & FL_ONGROUND))
return;
angleval = SVFIELD (sv_player, angles, vector)[YAW] * M_PI * 2 / 360;
angleval = SVvector (sv_player, angles)[YAW] * M_PI * 2 / 360;
sinval = sin (angleval);
cosval = cos (angleval);
for (i = 0; i < MAX_FORWARD; i++) {
top[0] = SVFIELD (sv_player, origin, vector)[0] + cosval * (i + 3) * 12;
top[1] = SVFIELD (sv_player, origin, vector)[1] + sinval * (i + 3) * 12;
top[2] = SVFIELD (sv_player, origin, vector)[2] + SVFIELD (sv_player, view_ofs, vector)[2];
top[0] = SVvector (sv_player, origin)[0] + cosval * (i + 3) * 12;
top[1] = SVvector (sv_player, origin)[1] + sinval * (i + 3) * 12;
top[2] = SVvector (sv_player, origin)[2] + SVvector (sv_player, view_ofs)[2];
bottom[0] = top[0];
bottom[1] = top[1];
@ -124,13 +124,13 @@ SV_SetIdealPitch (void)
}
if (!dir) {
SVFIELD (sv_player, idealpitch, float) = 0;
SVfloat (sv_player, idealpitch) = 0;
return;
}
if (steps < 2)
return;
SVFIELD (sv_player, idealpitch, float) = -dir * sv_idealpitchscale->value;
SVfloat (sv_player, idealpitch) = -dir * sv_idealpitchscale->value;
}
@ -158,7 +158,7 @@ SV_UserFriction (void)
// if the leading edge is over a dropoff, increase friction
start[0] = stop[0] = origin[0] + vel[0] / speed * 16;
start[1] = stop[1] = origin[1] + vel[1] / speed * 16;
start[2] = origin[2] + SVFIELD (sv_player, mins, vector)[2];
start[2] = origin[2] + SVvector (sv_player, mins)[2];
stop[2] = start[2] - 34;
trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, sv_player);
@ -257,12 +257,12 @@ DropPunchAngle (void)
{
float len;
len = VectorNormalize (SVFIELD (sv_player, punchangle, vector));
len = VectorNormalize (SVvector (sv_player, punchangle));
len -= 10 * host_frametime;
if (len < 0)
len = 0;
VectorScale (SVFIELD (sv_player, punchangle, vector), len, SVFIELD (sv_player, punchangle, vector));
VectorScale (SVvector (sv_player, punchangle), len, SVvector (sv_player, punchangle));
}
/*
@ -281,7 +281,7 @@ SV_WaterMove (void)
//
// user intentions
//
AngleVectors (SVFIELD (sv_player, v_angle, vector), forward, right, up);
AngleVectors (SVvector (sv_player, v_angle), forward, right, up);
for (i = 0; i < 3; i++)
wishvel[i] = forward[i] * cmd.forwardmove + right[i] * cmd.sidemove;
@ -332,12 +332,12 @@ SV_WaterMove (void)
void
SV_WaterJump (void)
{
if (sv.time > SVFIELD (sv_player, teleport_time, float) || !SVFIELD (sv_player, waterlevel, float)) {
SVFIELD (sv_player, flags, float) = (int) SVFIELD (sv_player, flags, float) & ~FL_WATERJUMP;
SVFIELD (sv_player, teleport_time, float) = 0;
if (sv.time > SVfloat (sv_player, teleport_time) || !SVfloat (sv_player, waterlevel)) {
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) & ~FL_WATERJUMP;
SVfloat (sv_player, teleport_time) = 0;
}
SVFIELD (sv_player, velocity, vector)[0] = SVFIELD (sv_player, movedir, vector)[0];
SVFIELD (sv_player, velocity, vector)[1] = SVFIELD (sv_player, movedir, vector)[1];
SVvector (sv_player, velocity)[0] = SVvector (sv_player, movedir)[0];
SVvector (sv_player, velocity)[1] = SVvector (sv_player, movedir)[1];
}
@ -354,19 +354,19 @@ SV_AirMove (void)
vec3_t wishvel;
float fmove, smove;
AngleVectors (SVFIELD (sv_player, angles, vector), forward, right, up);
AngleVectors (SVvector (sv_player, angles), forward, right, up);
fmove = cmd.forwardmove;
smove = cmd.sidemove;
// hack to not let you back into teleporter
if (sv.time < SVFIELD (sv_player, teleport_time, float) && fmove < 0)
if (sv.time < SVfloat (sv_player, teleport_time) && fmove < 0)
fmove = 0;
for (i = 0; i < 3; i++)
wishvel[i] = forward[i] * fmove + right[i] * smove;
if ((int) SVFIELD (sv_player, movetype, float) != MOVETYPE_WALK)
if ((int) SVfloat (sv_player, movetype) != MOVETYPE_WALK)
wishvel[2] = cmd.upmove;
else
wishvel[2] = 0;
@ -378,7 +378,7 @@ SV_AirMove (void)
wishspeed = sv_maxspeed->value;
}
if (SVFIELD (sv_player, movetype, float) == MOVETYPE_NOCLIP) { // noclip
if (SVfloat (sv_player, movetype) == MOVETYPE_NOCLIP) { // noclip
VectorCopy (wishvel, velocity);
} else if (onground) {
SV_UserFriction ();
@ -403,45 +403,45 @@ SV_ClientThink (void)
{
vec3_t v_angle;
if (SVFIELD (sv_player, movetype, float) == MOVETYPE_NONE)
if (SVfloat (sv_player, movetype) == MOVETYPE_NONE)
return;
onground = (int) SVFIELD (sv_player, flags, float) & FL_ONGROUND;
onground = (int) SVfloat (sv_player, flags) & FL_ONGROUND;
origin = SVFIELD (sv_player, origin, vector);
velocity = SVFIELD (sv_player, velocity, vector);
origin = SVvector (sv_player, origin);
velocity = SVvector (sv_player, velocity);
DropPunchAngle ();
//
// if dead, behave differently
//
if (SVFIELD (sv_player, health, float) <= 0)
if (SVfloat (sv_player, health) <= 0)
return;
//
// angles
// show 1/3 the pitch angle and all the roll angle
cmd = host_client->cmd;
angles = SVFIELD (sv_player, angles, vector);
angles = SVvector (sv_player, angles);
VectorAdd (SVFIELD (sv_player, v_angle, vector), SVFIELD (sv_player, punchangle, vector), v_angle);
VectorAdd (SVvector (sv_player, v_angle), SVvector (sv_player, punchangle), v_angle);
angles[ROLL] =
V_CalcRoll (SVFIELD (sv_player, angles, vector), SVFIELD (sv_player, velocity, vector)) * 4;
if (!SVFIELD (sv_player, fixangle, float)) {
V_CalcRoll (SVvector (sv_player, angles), SVvector (sv_player, velocity)) * 4;
if (!SVfloat (sv_player, fixangle)) {
angles[PITCH] = -v_angle[PITCH] / 3;
angles[YAW] = v_angle[YAW];
}
if ((int) SVFIELD (sv_player, flags, float) & FL_WATERJUMP) {
if ((int) SVfloat (sv_player, flags) & FL_WATERJUMP) {
SV_WaterJump ();
return;
}
//
// walk
//
if ((SVFIELD (sv_player, waterlevel, float) >= 2)
&& (SVFIELD (sv_player, movetype, float) != MOVETYPE_NOCLIP)) {
if ((SVfloat (sv_player, waterlevel) >= 2)
&& (SVfloat (sv_player, movetype) != MOVETYPE_NOCLIP)) {
SV_WaterMove ();
return;
}
@ -471,7 +471,7 @@ SV_ReadClientMove (usercmd_t *move)
for (i = 0; i < 3; i++)
angle[i] = MSG_ReadAngle (net_message);
VectorCopy (angle, SVFIELD (host_client->edict, v_angle, vector));
VectorCopy (angle, SVvector (host_client->edict, v_angle));
// read movement
move->forwardmove = MSG_ReadShort (net_message);
@ -480,16 +480,16 @@ SV_ReadClientMove (usercmd_t *move)
// read buttons
bits = MSG_ReadByte (net_message);
SVFIELD (host_client->edict, button0, float) = bits & 1;
SVFIELD (host_client->edict, button2, float) = (bits & 2) >> 1;
SVfloat (host_client->edict, button0) = bits & 1;
SVfloat (host_client->edict, button2) = (bits & 2) >> 1;
i = MSG_ReadByte (net_message);
if (i)
SVFIELD (host_client->edict, impulse, float) = i;
SVfloat (host_client->edict, impulse) = i;
#ifdef QUAKE2
// read light level
SVFIELD (host_client->edict, light_level, float) = MSG_ReadByte (net_message);
SVfloat (host_client->edict, light_level) = MSG_ReadByte (net_message);
#endif
}

View file

@ -143,12 +143,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 (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)
Sys_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)
Sys_Error ("MOVETYPE_PUSH with a non bsp model");
@ -163,13 +163,13 @@ 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, 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;
@ -269,15 +269,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;
@ -286,7 +286,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;
@ -296,9 +296,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]);
}
@ -329,8 +329,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)
@ -356,34 +356,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
@ -391,16 +391,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);
@ -475,10 +475,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;
@ -680,42 +680,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)
Sys_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->start, clip->mins2,
clip->maxs2, clip->end);
else

View file

@ -165,6 +165,13 @@ extern sv_fields_t sv_fields;
#define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
#endif
#define SVfloat(e,f) SVFIELD (e, f, float)
#define SVstring(e,f) SVFIELD (e, f, string)
#define SVfunc(e,f) SVFIELD (e, f, func)
#define SVentity(e,f) SVFIELD (e, f, entity)
#define SVvector(e,f) SVFIELD (e, f, vector)
#define SVinteger(e,f) SVFIELD (e, f, integer)
#define PROGHEADER_CRC 54730
extern func_t EndFrame;

View file

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

View file

@ -113,8 +113,8 @@ extern int sv_nailmodel, sv_supernailmodel, sv_playermodel;
qboolean
SV_AddNailUpdate (edict_t *ent)
{
if (SVFIELD (ent, modelindex, float) != sv_nailmodel
&& SVFIELD (ent, modelindex, float) != sv_supernailmodel) return false;
if (SVfloat (ent, modelindex) != sv_nailmodel
&& SVfloat (ent, modelindex) != sv_supernailmodel) return false;
if (numnails == MAX_NAILS)
return true;
nails[numnails] = ent;
@ -138,11 +138,11 @@ SV_EmitNailUpdate (sizebuf_t *msg)
for (n = 0; n < numnails; n++) {
ent = nails[n];
x = (int) (SVFIELD (ent, origin, vector)[0] + 4096) >> 1;
y = (int) (SVFIELD (ent, origin, vector)[1] + 4096) >> 1;
z = (int) (SVFIELD (ent, origin, vector)[2] + 4096) >> 1;
p = (int) (16 * SVFIELD (ent, angles, vector)[0] / 360) & 15;
yaw = (int) (256 * SVFIELD (ent, angles, vector)[1] / 360) & 255;
x = (int) (SVvector (ent, origin)[0] + 4096) >> 1;
y = (int) (SVvector (ent, origin)[1] + 4096) >> 1;
z = (int) (SVvector (ent, origin)[2] + 4096) >> 1;
p = (int) (16 * SVvector (ent, angles)[0] / 360) & 15;
yaw = (int) (256 * SVvector (ent, angles)[1] / 360) & 255;
bits[0] = x;
bits[1] = (x >> 8) | (y << 4);
@ -412,18 +412,18 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
pflags = PF_MSEC | PF_COMMAND;
if (SVFIELD (ent, modelindex, float) != sv_playermodel)
if (SVfloat (ent, modelindex) != sv_playermodel)
pflags |= PF_MODEL;
for (i = 0; i < 3; i++)
if (SVFIELD (ent, velocity, vector)[i])
if (SVvector (ent, velocity)[i])
pflags |= PF_VELOCITY1 << i;
if (SVFIELD (ent, effects, float))
if (SVfloat (ent, effects))
pflags |= PF_EFFECTS;
if (SVFIELD (ent, skin, float))
if (SVfloat (ent, skin))
pflags |= PF_SKINNUM;
if (SVFIELD (ent, health, float) <= 0)
if (SVfloat (ent, health) <= 0)
pflags |= PF_DEAD;
if (SVFIELD (ent, mins, vector)[2] != -24)
if (SVvector (ent, mins)[2] != -24)
pflags |= PF_GIB;
if (cl->spectator) { // only sent origin and velocity to
@ -432,21 +432,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 (SVFIELD (ent, weaponframe, float))
if (SVfloat (ent, weaponframe))
pflags |= PF_WEAPONFRAME;
}
if (client->spec_track && client->spec_track - 1 == j &&
SVFIELD (ent, weaponframe, float)) pflags |= PF_WEAPONFRAME;
SVfloat (ent, 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, SVFIELD (ent, origin, vector)[i]);
MSG_WriteCoord (msg, SVvector (ent, origin)[i]);
MSG_WriteByte (msg, SVFIELD (ent, frame, float));
MSG_WriteByte (msg, SVfloat (ent, frame));
if (pflags & PF_MSEC) {
msec = 1000 * (sv.time - cl->localtime);
@ -458,10 +458,10 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
if (pflags & PF_COMMAND) {
cmd = cl->lastcmd;
if (SVFIELD (ent, health, float) <= 0) { // don't show the corpse looking
if (SVfloat (ent, health) <= 0) { // don't show the corpse looking
// around...
cmd.angles[0] = 0;
cmd.angles[1] = SVFIELD (ent, angles, vector)[1];
cmd.angles[1] = SVvector (ent, angles)[1];
cmd.angles[0] = 0;
}
@ -473,19 +473,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, SVFIELD (ent, velocity, vector)[i]);
MSG_WriteShort (msg, SVvector (ent, velocity)[i]);
if (pflags & PF_MODEL)
MSG_WriteByte (msg, SVFIELD (ent, modelindex, float));
MSG_WriteByte (msg, SVfloat (ent, modelindex));
if (pflags & PF_SKINNUM)
MSG_WriteByte (msg, SVFIELD (ent, skin, float));
MSG_WriteByte (msg, SVfloat (ent, skin));
if (pflags & PF_EFFECTS)
MSG_WriteByte (msg, SVFIELD (ent, effects, float));
MSG_WriteByte (msg, SVfloat (ent, effects));
if (pflags & PF_WEAPONFRAME)
MSG_WriteByte (msg, SVFIELD (ent, weaponframe, float));
MSG_WriteByte (msg, SVfloat (ent, weaponframe));
}
}
@ -515,7 +515,7 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
// find the client's PVS
clent = client->edict;
VectorAdd (SVFIELD (clent, origin, vector), SVFIELD (clent, view_ofs, vector), org);
VectorAdd (SVvector (clent, origin), SVvector (clent, view_ofs), org);
pvs = SV_FatPVS (org);
// send over the players in the PVS
@ -531,7 +531,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 (!SVFIELD (ent, modelindex, float) || !*PR_GetString (&sv_pr_state, SVFIELD (ent, model, string)))
if (!SVfloat (ent, modelindex) || !*PR_GetString (&sv_pr_state, SVstring (ent, model)))
continue;
// ignore if not touching a PV leaf
@ -554,13 +554,13 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
state->number = e;
state->flags = 0;
VectorCopy (SVFIELD (ent, origin, vector), state->origin);
VectorCopy (SVFIELD (ent, angles, vector), state->angles);
state->modelindex = SVFIELD (ent, modelindex, float);
state->frame = SVFIELD (ent, frame, float);
state->colormap = SVFIELD (ent, colormap, float);
state->skinnum = SVFIELD (ent, skin, float);
state->effects = SVFIELD (ent, effects, float);
VectorCopy (SVvector (ent, origin), state->origin);
VectorCopy (SVvector (ent, angles), state->angles);
state->modelindex = SVfloat (ent, modelindex);
state->frame = SVfloat (ent, frame);
state->colormap = SVfloat (ent, colormap);
state->skinnum = SVfloat (ent, skin);
state->effects = SVfloat (ent, effects);
// LordHavoc: cleaned up Endy's coding style, shortened the code,
// and implemented missing effects
@ -572,26 +572,26 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
state->glow_color = 254;
state->colormod = 255;
if (sv_fields.alpha != -1 && SVFIELD (ent, alpha, float))
state->alpha = bound (0, SVFIELD (ent, alpha, float), 1) * 255.0;
if (sv_fields.alpha != -1 && SVfloat (ent, alpha))
state->alpha = bound (0, SVfloat (ent, alpha), 1) * 255.0;
if (sv_fields.scale != -1 && SVFIELD (ent, scale, float))
state->scale = bound (0, SVFIELD (ent, scale, float), 15.9375) * 16.0;
if (sv_fields.scale != -1 && SVfloat (ent, scale))
state->scale = bound (0, SVfloat (ent, scale), 15.9375) * 16.0;
if (sv_fields.glow_size != -1 && SVFIELD (ent, glow_size, float))
state->glow_size = bound (-1024, (int) SVFIELD (ent, glow_size, float), 1016) >> 3;
if (sv_fields.glow_size != -1 && SVfloat (ent, glow_size))
state->glow_size = bound (-1024, (int) SVfloat (ent, glow_size), 1016) >> 3;
if (sv_fields.glow_color != -1 && SVFIELD (ent, glow_color, vector))
state->glow_color = (int) SVFIELD (ent, glow_color, vector);
if (sv_fields.glow_color != -1 && SVvector (ent, glow_color))
state->glow_color = (int) SVvector (ent, glow_color);
if (sv_fields.colormod != -1
&& SVFIELD (ent, colormod, vector)[0]
&& SVFIELD (ent, colormod, vector)[1]
&& SVFIELD (ent, colormod, vector)[2])
&& SVvector (ent, colormod)[0]
&& SVvector (ent, colormod)[1]
&& SVvector (ent, colormod)[2])
state->colormod =
((int) (bound (0, SVFIELD (ent, colormod, vector)[0], 1) * 7.0) << 5) |
((int) (bound (0, SVFIELD (ent, colormod, vector)[1], 1) * 7.0) << 2) |
(int) (bound (0, SVFIELD (ent, colormod, vector)[2], 1) * 3.0);
((int) (bound (0, SVvector (ent, colormod)[0], 1) * 7.0) << 5) |
((int) (bound (0, SVvector (ent, colormod)[1], 1) * 7.0) << 2) |
(int) (bound (0, SVvector (ent, colormod)[2], 1) * 3.0);
}
// Ender: EXTEND (QSG - End)
}

View file

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

View file

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

View file

@ -58,8 +58,8 @@ SV_CheckBottom (edict_t *ent)
int x, y;
float mid, bottom;
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), mins);
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, maxs, vector), maxs);
VectorAdd (SVvector (ent, origin), SVvector (ent, mins), mins);
VectorAdd (SVvector (ent, origin), SVvector (ent, maxs), maxs);
// if all of the points under the corners are solid world, don't bother
// with the tougher checks
@ -130,33 +130,35 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
edict_t *enemy;
// try the move
VectorCopy (SVFIELD (ent, origin, vector), oldorg);
VectorAdd (SVFIELD (ent, origin, vector), move, neworg);
VectorCopy (SVvector (ent, origin), oldorg);
VectorAdd (SVvector (ent, origin), move, neworg);
// flying monsters don't step up
if ((int) SVFIELD (ent, flags, float) & (FL_SWIM | FL_FLY)) {
if ((int) SVfloat (ent, flags) & (FL_SWIM | FL_FLY)) {
// try one move with vertical motion, then one without
for (i = 0; i < 2; i++) {
VectorAdd (SVFIELD (ent, origin, vector), move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, enemy, entity));
VectorAdd (SVvector (ent, origin), move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, enemy));
if (i == 0 && enemy != sv.edicts) {
dz =
SVFIELD (ent, origin, vector)[2] -
SVFIELD (PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, enemy, entity)), origin, vector)[2];
SVvector (ent, origin)[2] -
SVvector (PROG_TO_EDICT (&sv_pr_state,
SVentity (ent, enemy)),
origin)[2];
if (dz > 40)
neworg[2] -= 8;
if (dz < 30)
neworg[2] += 8;
}
trace =
SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), neworg, false, ent);
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), neworg, false, ent);
if (trace.fraction == 1) {
if (((int) SVFIELD (ent, flags, float) & FL_SWIM)
if (((int) SVfloat (ent, flags) & FL_SWIM)
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
return false; // swim monster left water
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector));
VectorCopy (trace.endpos, SVvector (ent, origin));
if (relink)
SV_LinkEdict (ent, true);
return true;
@ -173,24 +175,24 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
VectorCopy (neworg, end);
end[2] -= STEPSIZE * 2;
trace = SV_Move (neworg, SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, false, ent);
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, maxs), end, false, ent);
if (trace.allsolid)
return false;
if (trace.startsolid) {
neworg[2] -= STEPSIZE;
trace = SV_Move (neworg, SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, false, ent);
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, 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) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) {
VectorAdd (SVFIELD (ent, origin, vector), move, SVFIELD (ent, origin, vector));
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
VectorAdd (SVvector (ent, origin), move, SVvector (ent, origin));
if (relink)
SV_LinkEdict (ent, true);
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) & ~FL_ONGROUND;
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_ONGROUND;
// SV_Printf ("fall down\n");
return true;
}
@ -198,10 +200,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, SVFIELD (ent, origin, vector));
VectorCopy (trace.endpos, SVvector (ent, origin));
if (!SV_CheckBottom (ent)) {
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) { // entity had floor
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) { // entity had floor
// mostly pulled out
// from underneath it
// and is trying to correct
@ -209,15 +211,15 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
SV_LinkEdict (ent, true);
return true;
}
VectorCopy (oldorg, SVFIELD (ent, origin, vector));
VectorCopy (oldorg, SVvector (ent, origin));
return false;
}
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) {
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
// SV_Printf ("back on ground\n");
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) & ~FL_PARTIALGROUND;
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_PARTIALGROUND;
}
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
// the move is ok
if (relink)
@ -240,7 +242,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
vec3_t move, oldorigin;
float delta;
SVFIELD (ent, ideal_yaw, float) = yaw;
SVfloat (ent, ideal_yaw) = yaw;
PF_changeyaw (&sv_pr_state);
yaw = yaw * M_PI * 2 / 360;
@ -248,12 +250,12 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
move[1] = sin (yaw) * dist;
move[2] = 0;
VectorCopy (SVFIELD (ent, origin, vector), oldorigin);
VectorCopy (SVvector (ent, origin), oldorigin);
if (SV_movestep (ent, move, false)) {
delta = SVFIELD (ent, angles, vector)[YAW] - SVFIELD (ent, ideal_yaw, float);
delta = SVvector (ent, angles)[YAW] - SVfloat (ent, ideal_yaw);
if (delta > 45 && delta < 315) { // not turned far enough, so
// don't take the step
VectorCopy (oldorigin, SVFIELD (ent, origin, vector));
VectorCopy (oldorigin, SVvector (ent, origin));
}
SV_LinkEdict (ent, true);
return true;
@ -271,7 +273,7 @@ SV_FixCheckBottom (edict_t *ent)
{
// SV_Printf ("SV_FixCheckBottom\n");
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_PARTIALGROUND;
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_PARTIALGROUND;
}
@ -287,11 +289,11 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
float d[3];
float tdir, olddir, turnaround;
olddir = anglemod ((int) (SVFIELD (actor, ideal_yaw, float) / 45) * 45);
olddir = anglemod ((int) (SVfloat (actor, ideal_yaw) / 45) * 45);
turnaround = anglemod (olddir - 180);
deltax = SVFIELD (enemy, origin, vector)[0] - SVFIELD (actor, origin, vector)[0];
deltay = SVFIELD (enemy, origin, vector)[1] - SVFIELD (actor, origin, vector)[1];
deltax = SVvector (enemy, origin)[0] - SVvector (actor, origin)[0];
deltay = SVvector (enemy, origin)[1] - SVvector (actor, origin)[1];
if (deltax > 10)
d[1] = 0;
else if (deltax < -10)
@ -347,7 +349,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
return;
SVFIELD (actor, ideal_yaw, float) = olddir; // can't move
SVfloat (actor, 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
@ -366,9 +368,9 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
int i;
for (i = 0; i < 3; i++) {
if (SVFIELD (goal, absmin, vector)[i] > SVFIELD (ent, absmax, vector)[i] + dist)
if (SVvector (goal, absmin)[i] > SVvector (ent, absmax)[i] + dist)
return false;
if (SVFIELD (goal, absmax, vector)[i] < SVFIELD (ent, absmin, vector)[i] - dist)
if (SVvector (goal, absmax)[i] < SVvector (ent, absmin)[i] - dist)
return false;
}
return true;
@ -384,20 +386,20 @@ SV_MoveToGoal (progs_t *pr)
float dist;
ent = PROG_TO_EDICT (&sv_pr_state, *sv_globals.self);
goal = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, goalentity, entity));
goal = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, goalentity));
dist = G_FLOAT (&sv_pr_state, OFS_PARM0);
if (!((int) SVFIELD (ent, flags, float) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (!((int) SVfloat (ent, 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, SVFIELD (ent, enemy, entity)) != sv.edicts
if (PROG_TO_EDICT (&sv_pr_state, SVentity (ent, enemy)) != sv.edicts
&& SV_CloseEnough (ent, goal, dist))
return;
// bump around...
if ((rand () & 3) == 1 || !SV_StepDirection (ent, SVFIELD (ent, ideal_yaw, float), dist)) {
if ((rand () & 3) == 1 || !SV_StepDirection (ent, SVfloat (ent, ideal_yaw), dist)) {
SV_NewChaseDir (ent, goal, dist);
}
}

View file

@ -87,9 +87,9 @@ SV_CheckAllEnts (void)
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free)
continue;
if (SVFIELD (check, movetype, float) == MOVETYPE_PUSH
|| SVFIELD (check, movetype, float) == MOVETYPE_NONE
|| SVFIELD (check, movetype, float) == MOVETYPE_NOCLIP) continue;
if (SVfloat (check, movetype) == MOVETYPE_PUSH
|| SVfloat (check, movetype) == MOVETYPE_NONE
|| SVfloat (check, movetype) == MOVETYPE_NOCLIP) continue;
if (SV_TestEntityPosition (check))
SV_Printf ("entity in invalid position\n");
@ -109,23 +109,23 @@ SV_CheckVelocity (edict_t *ent)
// bound velocity
//
for (i = 0; i < 3; i++) {
if (IS_NAN (SVFIELD (ent, velocity, vector)[i])) {
if (IS_NAN (SVvector (ent, velocity)[i])) {
SV_Printf ("Got a NaN velocity on %s\n",
PR_GetString (&sv_pr_state, SVFIELD (ent, classname, string)));
SVFIELD (ent, velocity, vector)[i] = 0;
PR_GetString (&sv_pr_state, SVstring (ent, classname)));
SVvector (ent, velocity)[i] = 0;
}
if (IS_NAN (SVFIELD (ent, origin, vector)[i])) {
if (IS_NAN (SVvector (ent, origin)[i])) {
SV_Printf ("Got a NaN origin on %s\n",
PR_GetString (&sv_pr_state, SVFIELD (ent, classname, string)));
SVFIELD (ent, origin, vector)[i] = 0;
PR_GetString (&sv_pr_state, SVstring (ent, classname)));
SVvector (ent, origin)[i] = 0;
}
}
// 1999-10-18 SV_MAXVELOCITY fix by Maddes start
wishspeed = Length (SVFIELD (ent, velocity, vector));
wishspeed = Length (SVvector (ent, velocity));
if (wishspeed > sv_maxvelocity->value) {
VectorScale (SVFIELD (ent, velocity, vector), sv_maxvelocity->value / wishspeed,
SVFIELD (ent, velocity, vector));
VectorScale (SVvector (ent, velocity), sv_maxvelocity->value / wishspeed,
SVvector (ent, velocity));
}
// 1999-10-18 SV_MAXVELOCITY fix by Maddes end
}
@ -144,7 +144,7 @@ SV_RunThink (edict_t *ent)
float thinktime;
do {
thinktime = SVFIELD (ent, nextthink, float);
thinktime = SVfloat (ent, nextthink);
if (thinktime <= 0)
return true;
if (thinktime > sv.time + sv_frametime)
@ -154,11 +154,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.
SVFIELD (ent, nextthink, float) = 0;
SVfloat (ent, nextthink) = 0;
*sv_globals.time = thinktime;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, think, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (ent, think));
if (ent->free)
return false;
@ -181,16 +181,16 @@ SV_Impact (edict_t *e1, edict_t *e2)
old_other = *sv_globals.other;
*sv_globals.time = sv.time;
if (SVFIELD (e1, touch, func) && SVFIELD (e1, solid, float) != SOLID_NOT) {
if (SVfunc (e1, touch) && SVfloat (e1, solid) != SOLID_NOT) {
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, e1);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, e2);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (e1, touch, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (e1, touch));
}
if (SVFIELD (e2, touch, func) && SVFIELD (e2, solid, float) != SOLID_NOT) {
if (SVfunc (e2, touch) && SVfloat (e2, solid) != SOLID_NOT) {
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, e2);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, e1);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (e2, touch, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (e2, touch));
}
*sv_globals.self = old_self;
@ -259,27 +259,27 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
numbumps = 4;
blocked = 0;
VectorCopy (SVFIELD (ent, velocity, vector), original_velocity);
VectorCopy (SVFIELD (ent, velocity, vector), primal_velocity);
VectorCopy (SVvector (ent, velocity), original_velocity);
VectorCopy (SVvector (ent, velocity), primal_velocity);
numplanes = 0;
time_left = time;
for (bumpcount = 0; bumpcount < numbumps; bumpcount++) {
for (i = 0; i < 3; i++)
end[i] = SVFIELD (ent, origin, vector)[i] + time_left * SVFIELD (ent, velocity, vector)[i];
end[i] = SVvector (ent, origin)[i] + time_left * SVvector (ent, velocity)[i];
trace =
SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, false, ent);
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), end, false, ent);
if (trace.allsolid) { // entity is trapped in another solid
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector));
VectorCopy (vec3_origin, SVvector (ent, velocity));
return 3;
}
if (trace.fraction > 0) { // actually covered some distance
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector));
VectorCopy (SVFIELD (ent, velocity, vector), original_velocity);
VectorCopy (trace.endpos, SVvector (ent, origin));
VectorCopy (SVvector (ent, velocity), original_velocity);
numplanes = 0;
}
@ -291,10 +291,10 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
if (trace.plane.normal[2] > 0.7) {
blocked |= 1; // floor
if ((SVFIELD (trace.ent, solid, float) == SOLID_BSP)
|| (SVFIELD (trace.ent, movetype, float) == MOVETYPE_PPUSH)) {
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
if ((SVfloat (trace.ent, solid) == SOLID_BSP)
|| (SVfloat (trace.ent, movetype) == MOVETYPE_PPUSH)) {
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
}
}
if (!trace.plane.normal[2]) {
@ -314,7 +314,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, SVFIELD (ent, velocity, vector));
VectorCopy (vec3_origin, SVvector (ent, velocity));
return 3;
}
@ -336,24 +336,24 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
}
if (i != numplanes) { // go along this plane
VectorCopy (new_velocity, SVFIELD (ent, velocity, vector));
VectorCopy (new_velocity, SVvector (ent, velocity));
} else { // go along the crease
if (numplanes != 2) {
// SV_Printf ("clip velocity, numplanes == %i\n",numplanes);
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector));
VectorCopy (vec3_origin, SVvector (ent, velocity));
return 7;
}
CrossProduct (planes[0], planes[1], dir);
d = DotProduct (dir, SVFIELD (ent, velocity, vector));
VectorScale (dir, d, SVFIELD (ent, velocity, vector));
d = DotProduct (dir, SVvector (ent, velocity));
VectorScale (dir, d, SVvector (ent, velocity));
}
//
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
if (DotProduct (SVFIELD (ent, velocity, vector), primal_velocity) <= 0) {
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector));
if (DotProduct (SVvector (ent, velocity), primal_velocity) <= 0) {
VectorCopy (vec3_origin, SVvector (ent, velocity));
return blocked;
}
}
@ -368,7 +368,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
void
SV_AddGravity (edict_t *ent, float scale)
{
SVFIELD (ent, velocity, vector)[2] -= scale * movevars.gravity * sv_frametime;
SVvector (ent, velocity)[2] -= scale * movevars.gravity * sv_frametime;
}
/*
@ -386,23 +386,23 @@ SV_PushEntity (edict_t *ent, vec3_t push)
trace_t trace;
vec3_t end;
VectorAdd (SVFIELD (ent, origin, vector), push, end);
VectorAdd (SVvector (ent, origin), push, end);
if (SVFIELD (ent, movetype, float) == MOVETYPE_FLYMISSILE)
if (SVfloat (ent, movetype) == MOVETYPE_FLYMISSILE)
trace =
SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, MOVE_MISSILE,
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), end, MOVE_MISSILE,
ent);
else if (SVFIELD (ent, solid, float) == SOLID_TRIGGER || SVFIELD (ent, solid, float) == SOLID_NOT)
else if (SVfloat (ent, solid) == SOLID_TRIGGER || SVfloat (ent, solid) == SOLID_NOT)
// only clip against bmodels
trace =
SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end,
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), end,
MOVE_NOMONSTERS, ent);
else
trace =
SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, MOVE_NORMAL,
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), end, MOVE_NORMAL,
ent);
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector));
VectorCopy (trace.endpos, SVvector (ent, origin));
SV_LinkEdict (ent, true);
if (trace.ent)
@ -430,15 +430,15 @@ SV_Push (edict_t *pusher, vec3_t move)
// --KB
for (i = 0; i < 3; i++) {
mins[i] = SVFIELD (pusher, absmin, vector)[i] + move[i];
maxs[i] = SVFIELD (pusher, absmax, vector)[i] + move[i];
mins[i] = SVvector (pusher, absmin)[i] + move[i];
maxs[i] = SVvector (pusher, absmax)[i] + move[i];
}
VectorCopy (SVFIELD (pusher, origin, vector), pushorig);
VectorCopy (SVvector (pusher, origin), pushorig);
// move the pusher to it's final position
VectorAdd (SVFIELD (pusher, origin, vector), move, SVFIELD (pusher, origin, vector));
VectorAdd (SVvector (pusher, origin), move, SVvector (pusher, origin));
SV_LinkEdict (pusher, false);
// see if any solid entities are inside the final position
@ -447,30 +447,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 (SVFIELD (check, movetype, float) == MOVETYPE_PUSH
|| SVFIELD (check, movetype, float) == MOVETYPE_NONE
|| SVFIELD (check, movetype, float) == MOVETYPE_PPUSH
|| SVFIELD (check, movetype, float) == MOVETYPE_NOCLIP) continue;
if (SVfloat (check, movetype) == MOVETYPE_PUSH
|| SVfloat (check, movetype) == MOVETYPE_NONE
|| SVfloat (check, movetype) == MOVETYPE_PPUSH
|| SVfloat (check, movetype) == MOVETYPE_NOCLIP) continue;
// Don't assume SOLID_BSP ! --KB
solid_save = SVFIELD (pusher, solid, float);
SVFIELD (pusher, solid, float) = SOLID_NOT;
solid_save = SVfloat (pusher, solid);
SVfloat (pusher, solid) = SOLID_NOT;
block = SV_TestEntityPosition (check);
// SVFIELD (pusher, solid, float) = SOLID_BSP;
SVFIELD (pusher, solid, float) = solid_save;
// SVfloat (pusher, solid) = SOLID_BSP;
SVfloat (pusher, solid) = solid_save;
if (block)
continue;
// if the entity is standing on the pusher, it will definately be
// moved
if (!(((int) SVFIELD (check, flags, float) & FL_ONGROUND)
&& PROG_TO_EDICT (&sv_pr_state, SVFIELD (check, groundentity, entity)) == pusher)) {
if (SVFIELD (check, absmin, vector)[0] >= maxs[0]
|| SVFIELD (check, absmin, vector)[1] >= maxs[1]
|| SVFIELD (check, absmin, vector)[2] >= maxs[2]
|| SVFIELD (check, absmax, vector)[0] <= mins[0]
|| SVFIELD (check, absmax, vector)[1] <= mins[1]
|| SVFIELD (check, absmax, vector)[2] <= mins[2])
if (!(((int) SVfloat (check, flags) & FL_ONGROUND)
&& PROG_TO_EDICT (&sv_pr_state, SVentity (check, groundentity)) == pusher)) {
if (SVvector (check, absmin)[0] >= maxs[0]
|| SVvector (check, absmin)[1] >= maxs[1]
|| SVvector (check, absmin)[2] >= maxs[2]
|| SVvector (check, absmax)[0] <= mins[0]
|| SVvector (check, absmax)[1] <= mins[1]
|| SVvector (check, absmax)[2] <= mins[2])
continue;
// see if the ent's bbox is inside the pusher's final position
@ -478,49 +478,49 @@ SV_Push (edict_t *pusher, vec3_t move)
continue;
}
VectorCopy (SVFIELD (check, origin, vector), moved_from[num_moved]);
VectorCopy (SVvector (check, origin), moved_from[num_moved]);
moved_edict[num_moved] = check;
num_moved++;
// try moving the contacted entity
VectorAdd (SVFIELD (check, origin, vector), move, SVFIELD (check, origin, vector));
VectorAdd (SVvector (check, origin), move, SVvector (check, 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 (SVFIELD (check, origin, vector), move, SVFIELD (check, origin, vector));
VectorSubtract (SVvector (check, origin), move, SVvector (check, origin));
block = SV_TestEntityPosition (check);
if (!block) {
num_moved--;
continue;
}
// if it is still inside the pusher, block
if (SVFIELD (check, mins, vector)[0] == SVFIELD (check, maxs, vector)[0]) {
if (SVvector (check, mins)[0] == SVvector (check, maxs)[0]) {
SV_LinkEdict (check, false);
continue;
}
if (SVFIELD (check, solid, float) == SOLID_NOT || SVFIELD (check, solid, float) == SOLID_TRIGGER) { // corpse
SVFIELD (check, mins, vector)[0] = SVFIELD (check, mins, vector)[1] = 0;
VectorCopy (SVFIELD (check, mins, vector), SVFIELD (check, maxs, vector));
if (SVfloat (check, solid) == SOLID_NOT || SVfloat (check, solid) == SOLID_TRIGGER) { // corpse
SVvector (check, mins)[0] = SVvector (check, mins)[1] = 0;
VectorCopy (SVvector (check, mins), SVvector (check, maxs));
SV_LinkEdict (check, false);
continue;
}
VectorCopy (pushorig, SVFIELD (pusher, origin, vector));
VectorCopy (pushorig, SVvector (pusher, 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 (SVFIELD (pusher, blocked, func)) {
if (SVfunc (pusher, blocked)) {
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, pusher);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, check);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (pusher, blocked, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (pusher, blocked));
}
// move back any entities we already moved
for (i = 0; i < num_moved; i++) {
VectorCopy (moved_from[i], SVFIELD (moved_edict[i], origin, vector));
VectorCopy (moved_from[i], SVvector (moved_edict[i], origin));
SV_LinkEdict (moved_edict[i], false);
}
return false;
@ -538,17 +538,17 @@ SV_PushMove (edict_t *pusher, float movetime)
int i;
vec3_t move;
if (!SVFIELD (pusher, velocity, vector)[0] && !SVFIELD (pusher, velocity, vector)[1]
&& !SVFIELD (pusher, velocity, vector)[2]) {
SVFIELD (pusher, ltime, float) += movetime;
if (!SVvector (pusher, velocity)[0] && !SVvector (pusher, velocity)[1]
&& !SVvector (pusher, velocity)[2]) {
SVfloat (pusher, ltime) += movetime;
return;
}
for (i = 0; i < 3; i++)
move[i] = SVFIELD (pusher, velocity, vector)[i] * movetime;
move[i] = SVvector (pusher, velocity)[i] * movetime;
if (SV_Push (pusher, move))
SVFIELD (pusher, ltime, float) += movetime;
SVfloat (pusher, ltime) += movetime;
}
@ -564,36 +564,36 @@ SV_Physics_Pusher (edict_t *ent)
vec3_t oldorg, move;
float l;
oldltime = SVFIELD (ent, ltime, float);
oldltime = SVfloat (ent, ltime);
thinktime = SVFIELD (ent, nextthink, float);
if (thinktime < SVFIELD (ent, ltime, float) + sv_frametime) {
movetime = thinktime - SVFIELD (ent, ltime, float);
thinktime = SVfloat (ent, nextthink);
if (thinktime < SVfloat (ent, ltime) + sv_frametime) {
movetime = thinktime - SVfloat (ent, ltime);
if (movetime < 0)
movetime = 0;
} else
movetime = sv_frametime;
if (movetime) {
SV_PushMove (ent, movetime); // advances SVFIELD (ent, ltime, float) if not
SV_PushMove (ent, movetime); // advances SVfloat (ent, ltime) if not
// blocked
}
if (thinktime > oldltime && thinktime <= SVFIELD (ent, ltime, float)) {
VectorCopy (SVFIELD (ent, origin, vector), oldorg);
SVFIELD (ent, nextthink, float) = 0;
if (thinktime > oldltime && thinktime <= SVfloat (ent, ltime)) {
VectorCopy (SVvector (ent, origin), oldorg);
SVfloat (ent, nextthink) = 0;
*sv_globals.time = sv.time;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, think, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (ent, think));
if (ent->free)
return;
VectorSubtract (SVFIELD (ent, origin, vector), oldorg, move);
VectorSubtract (SVvector (ent, origin), oldorg, move);
l = Length (move);
if (l > 1.0 / 64) {
// SV_Printf ("**** snap: %f\n", Length (l));
VectorCopy (oldorg, SVFIELD (ent, origin, vector));
VectorCopy (oldorg, SVvector (ent, origin));
SV_Push (ent, move);
}
}
@ -625,8 +625,8 @@ SV_Physics_Noclip (edict_t *ent)
if (!SV_RunThink (ent))
return;
VectorMA (SVFIELD (ent, angles, vector), sv_frametime, SVFIELD (ent, avelocity, vector), SVFIELD (ent, angles, vector));
VectorMA (SVFIELD (ent, origin, vector), sv_frametime, SVFIELD (ent, velocity, vector), SVFIELD (ent, origin, vector));
VectorMA (SVvector (ent, angles), sv_frametime, SVvector (ent, avelocity), SVvector (ent, angles));
VectorMA (SVvector (ent, origin), sv_frametime, SVvector (ent, velocity), SVvector (ent, origin));
SV_LinkEdict (ent, false);
}
@ -643,27 +643,27 @@ SV_CheckWaterTransition (edict_t *ent)
{
int cont;
cont = SV_PointContents (SVFIELD (ent, origin, vector));
if (!SVFIELD (ent, watertype, float)) { // just spawned here
SVFIELD (ent, watertype, float) = cont;
SVFIELD (ent, waterlevel, float) = 1;
cont = SV_PointContents (SVvector (ent, origin));
if (!SVfloat (ent, watertype)) { // just spawned here
SVfloat (ent, watertype) = cont;
SVfloat (ent, waterlevel) = 1;
return;
}
if (cont <= CONTENTS_WATER) {
if (SVFIELD (ent, watertype, float) == CONTENTS_EMPTY) { // just crossed into
if (SVfloat (ent, watertype) == CONTENTS_EMPTY) { // just crossed into
// water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
}
SVFIELD (ent, watertype, float) = cont;
SVFIELD (ent, waterlevel, float) = 1;
SVfloat (ent, watertype) = cont;
SVfloat (ent, waterlevel) = 1;
} else {
if (SVFIELD (ent, watertype, float) != CONTENTS_EMPTY) { // just crossed into
if (SVfloat (ent, watertype) != CONTENTS_EMPTY) { // just crossed into
// water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
}
SVFIELD (ent, watertype, float) = CONTENTS_EMPTY;
SVFIELD (ent, waterlevel, float) = cont;
SVfloat (ent, watertype) = CONTENTS_EMPTY;
SVfloat (ent, waterlevel) = cont;
}
}
@ -683,45 +683,45 @@ SV_Physics_Toss (edict_t *ent)
if (!SV_RunThink (ent))
return;
if (SVFIELD (ent, velocity, vector)[2] > 0)
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) & ~FL_ONGROUND;
if (SVvector (ent, velocity)[2] > 0)
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_ONGROUND;
// if onground, return without moving
if (((int) SVFIELD (ent, flags, float) & FL_ONGROUND))
if (((int) SVfloat (ent, flags) & FL_ONGROUND))
return;
SV_CheckVelocity (ent);
// add gravity
if (SVFIELD (ent, movetype, float) != MOVETYPE_FLY
&& SVFIELD (ent, movetype, float) != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0);
if (SVfloat (ent, movetype) != MOVETYPE_FLY
&& SVfloat (ent, movetype) != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0);
// move angles
VectorMA (SVFIELD (ent, angles, vector), sv_frametime, SVFIELD (ent, avelocity, vector), SVFIELD (ent, angles, vector));
VectorMA (SVvector (ent, angles), sv_frametime, SVvector (ent, avelocity), SVvector (ent, angles));
// move origin
VectorScale (SVFIELD (ent, velocity, vector), sv_frametime, move);
VectorScale (SVvector (ent, velocity), sv_frametime, move);
trace = SV_PushEntity (ent, move);
if (trace.fraction == 1)
return;
if (ent->free)
return;
if (SVFIELD (ent, movetype, float) == MOVETYPE_BOUNCE)
if (SVfloat (ent, movetype) == MOVETYPE_BOUNCE)
backoff = 1.5;
else
backoff = 1;
ClipVelocity (SVFIELD (ent, velocity, vector), trace.plane.normal, SVFIELD (ent, velocity, vector),
ClipVelocity (SVvector (ent, velocity), trace.plane.normal, SVvector (ent, velocity),
backoff);
// stop if on ground
if (trace.plane.normal[2] > 0.7) {
if (SVFIELD (ent, velocity, vector)[2] < 60 || SVFIELD (ent, movetype, float) != MOVETYPE_BOUNCE) {
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector));
VectorCopy (vec3_origin, SVFIELD (ent, avelocity, vector));
if (SVvector (ent, velocity)[2] < 60 || SVfloat (ent, movetype) != MOVETYPE_BOUNCE) {
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorCopy (vec3_origin, SVvector (ent, avelocity));
}
}
// check for in water
@ -748,8 +748,8 @@ SV_Physics_Step (edict_t *ent)
qboolean hitsound;
// freefall if not on ground
if (!((int) SVFIELD (ent, flags, float) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (SVFIELD (ent, velocity, vector)[2] < movevars.gravity * -0.1)
if (!((int) SVfloat (ent, flags) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (SVvector (ent, velocity)[2] < movevars.gravity * -0.1)
hitsound = true;
else
hitsound = false;
@ -759,7 +759,7 @@ SV_Physics_Step (edict_t *ent)
SV_FlyMove (ent, sv_frametime, NULL);
SV_LinkEdict (ent, true);
if ((int) SVFIELD (ent, flags, float) & FL_ONGROUND) // just hit ground
if ((int) SVfloat (ent, flags) & FL_ONGROUND) // just hit ground
{
if (hitsound)
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
@ -782,27 +782,27 @@ SV_PPushMove (edict_t *pusher, float movetime) // player push
SV_CheckVelocity (pusher);
for (i = 0; i < 3; i++) {
move[i] = SVFIELD (pusher, velocity, vector)[i] * movetime;
mins[i] = SVFIELD (pusher, absmin, vector)[i] + move[i];
maxs[i] = SVFIELD (pusher, absmax, vector)[i] + move[i];
move[i] = SVvector (pusher, velocity)[i] * movetime;
mins[i] = SVvector (pusher, absmin)[i] + move[i];
maxs[i] = SVvector (pusher, absmax)[i] + move[i];
}
VectorCopy (SVFIELD (pusher, origin, vector), SVFIELD (pusher, oldorigin, vector)); // Backup origin
VectorCopy (SVvector (pusher, origin), SVvector (pusher, oldorigin)); // Backup origin
trace =
SV_Move (SVFIELD (pusher, origin, vector), SVFIELD (pusher, mins, vector), SVFIELD (pusher, maxs, vector), move,
SV_Move (SVvector (pusher, origin), SVvector (pusher, mins), SVvector (pusher, maxs), move,
MOVE_NOMONSTERS, pusher);
if (trace.fraction == 1) {
VectorCopy (SVFIELD (pusher, origin, vector), SVFIELD (pusher, oldorigin, vector)); // Revert
VectorCopy (SVvector (pusher, origin), SVvector (pusher, oldorigin)); // Revert
return;
}
VectorAdd (SVFIELD (pusher, origin, vector), move, SVFIELD (pusher, origin, vector)); // Move
VectorAdd (SVvector (pusher, origin), move, SVvector (pusher, origin)); // Move
SV_LinkEdict (pusher, false);
SVFIELD (pusher, ltime, float) += movetime;
SVfloat (pusher, ltime) += movetime;
oldsolid = SVFIELD (pusher, solid, float);
oldsolid = SVfloat (pusher, solid);
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
@ -814,25 +814,25 @@ SV_PPushMove (edict_t *pusher, float movetime) // player push
continue;
// Stage 2: Is it a player we can push?
if (SVFIELD (check, movetype, float) == MOVETYPE_WALK) {
if (SVfloat (check, movetype) == MOVETYPE_WALK) {
SV_Printf ("Pusher encountered a player\n"); // Yes!@#!@
SVFIELD (pusher, solid, float) = SOLID_NOT;
SVfloat (pusher, solid) = SOLID_NOT;
SV_PushEntity (check, move);
SVFIELD (pusher, solid, float) = oldsolid;
SVfloat (pusher, solid) = oldsolid;
continue;
}
// Stage 3: No.. Is it something that blocks us?
if (SVFIELD (check, mins, vector)[0] == SVFIELD (check, maxs, vector)[0])
if (SVvector (check, mins)[0] == SVvector (check, maxs)[0])
continue;
if (SVFIELD (check, solid, float) == SOLID_NOT || SVFIELD (check, solid, float) == SOLID_TRIGGER)
if (SVfloat (check, solid) == SOLID_NOT || SVfloat (check, solid) == SOLID_TRIGGER)
continue;
// Stage 4: Yes, it must be. Fail the move.
VectorCopy (SVFIELD (pusher, origin, vector), SVFIELD (pusher, oldorigin, vector)); // Revert
if (SVFIELD (pusher, blocked, func)) { // Blocked func?
VectorCopy (SVvector (pusher, origin), SVvector (pusher, oldorigin)); // Revert
if (SVfunc (pusher, blocked)) { // Blocked func?
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, pusher);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, check);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (pusher, blocked, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (pusher, blocked));
}
return;
@ -848,11 +848,11 @@ SV_Physics_PPusher (edict_t *ent)
// float l;
oldltime = SVFIELD (ent, ltime, float);
oldltime = SVfloat (ent, ltime);
thinktime = SVFIELD (ent, nextthink, float);
if (thinktime < SVFIELD (ent, ltime, float) + sv_frametime) {
movetime = thinktime - SVFIELD (ent, ltime, float);
thinktime = SVfloat (ent, nextthink);
if (thinktime < SVfloat (ent, ltime) + sv_frametime) {
movetime = thinktime - SVfloat (ent, ltime);
if (movetime < 0)
movetime = 0;
} else
@ -860,16 +860,16 @@ SV_Physics_PPusher (edict_t *ent)
// if (movetime)
// {
SV_PPushMove (ent, 0.0009); // advances SVFIELD (ent, ltime, float) if not
SV_PPushMove (ent, 0.0009); // advances SVfloat (ent, ltime) if not
// blocked
// }
if (thinktime > oldltime && thinktime <= SVFIELD (ent, ltime, float)) {
SVFIELD (ent, nextthink, float) = 0;
if (thinktime > oldltime && thinktime <= SVfloat (ent, ltime)) {
SVfloat (ent, nextthink) = 0;
*sv_globals.time = sv.time;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, think, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (ent, think));
if (ent->free)
return;
}
@ -893,11 +893,11 @@ SV_ProgStartFrame (void)
void
SV_RunEntity (edict_t *ent)
{
if (SVFIELD (ent, lastruntime, float) == (float) realtime)
if (SVfloat (ent, lastruntime) == (float) realtime)
return;
SVFIELD (ent, lastruntime, float) = (float) realtime;
SVfloat (ent, lastruntime) = (float) realtime;
switch ((int) SVFIELD (ent, movetype, float)) {
switch ((int) SVfloat (ent, movetype)) {
case MOVETYPE_PUSH:
SV_Physics_Pusher (ent);
break;
@ -920,7 +920,7 @@ SV_RunEntity (edict_t *ent)
SV_Physics_Toss (ent);
break;
default:
SV_Error ("SV_Physics: bad movetype %i", (int) SVFIELD (ent, movetype, float));
SV_Error ("SV_Physics: bad movetype %i", (int) SVfloat (ent, movetype));
}
}

View file

@ -146,7 +146,7 @@ PF_setorigin (progs_t *pr)
e = G_EDICT (pr, OFS_PARM0);
org = G_VECTOR (pr, OFS_PARM1);
VectorCopy (org, SVFIELD (e, origin, vector));
VectorCopy (org, SVvector (e, origin));
SV_LinkEdict (e, false);
}
@ -167,9 +167,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, SVFIELD (e, mins, vector));
VectorCopy (max, SVFIELD (e, maxs, vector));
VectorSubtract (max, min, SVFIELD (e, size, vector));
VectorCopy (min, SVvector (e, mins));
VectorCopy (max, SVvector (e, maxs));
VectorSubtract (max, min, SVvector (e, size));
SV_LinkEdict (e, false);
}
@ -199,15 +199,15 @@ PF_setmodel (progs_t *pr)
if (!*check)
PR_RunError (pr, "no precache: %s\n", m);
SVFIELD (e, model, string) = PR_SetString (pr, m);
SVFIELD (e, modelindex, float) = i;
SVstring (e, model) = PR_SetString (pr, m);
SVfloat (e, 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, SVFIELD (e, mins, vector));
VectorCopy (mod->maxs, SVFIELD (e, maxs, vector));
VectorSubtract (mod->maxs, mod->mins, SVFIELD (e, size, vector));
VectorCopy (mod->mins, SVvector (e, mins));
VectorCopy (mod->maxs, SVvector (e, maxs));
VectorSubtract (mod->maxs, mod->mins, SVvector (e, size));
SV_LinkEdict (e, false);
}
@ -627,9 +627,9 @@ PF_newcheckclient (progs_t *pr, int check)
if (ent->free)
continue;
if (SVFIELD (ent, health, float) <= 0)
if (SVfloat (ent, health) <= 0)
continue;
if ((int) SVFIELD (ent, flags, float) & FL_NOTARGET)
if ((int) SVfloat (ent, flags) & FL_NOTARGET)
continue;
// anything that is a client, or has a client as an enemy
@ -637,7 +637,7 @@ PF_newcheckclient (progs_t *pr, int check)
}
// get the PVS for the entity
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, view_ofs, vector), org);
VectorAdd (SVvector (ent, origin), SVvector (ent, view_ofs), org);
leaf = Mod_PointInLeaf (org, sv.worldmodel);
pvs = Mod_LeafPVS (leaf, sv.worldmodel);
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3);
@ -675,13 +675,13 @@ PF_checkclient (progs_t *pr)
}
// return check if it might be visible
ent = EDICT_NUM (pr, sv.lastcheck);
if (ent->free || SVFIELD (ent, health, float) <= 0) {
if (ent->free || SVfloat (ent, 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, *sv_globals.self);
VectorAdd (SVFIELD (self, origin, vector), SVFIELD (self, view_ofs, vector), view);
VectorAdd (SVvector (self, origin), SVvector (self, view_ofs), view);
leaf = Mod_PointInLeaf (view, sv.worldmodel);
l = (leaf - sv.worldmodel->leafs) - 1;
if ((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7)))) {
@ -825,16 +825,16 @@ PF_findradius (progs_t *pr)
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
if (ent->free)
continue;
if (SVFIELD (ent, solid, float) == SOLID_NOT)
if (SVfloat (ent, solid) == SOLID_NOT)
continue;
for (j = 0; j < 3; j++)
eorg[j] =
org[j] - (SVFIELD (ent, origin, vector)[j] +
(SVFIELD (ent, mins, vector)[j] + SVFIELD (ent, maxs, vector)[j]) * 0.5);
org[j] - (SVvector (ent, origin)[j] +
(SVvector (ent, mins)[j] + SVvector (ent, maxs)[j]) * 0.5);
if (Length (eorg) > rad)
continue;
SVFIELD (ent, chain, entity) = EDICT_TO_PROG (pr, chain);
SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);
chain = ent;
}
@ -1052,7 +1052,7 @@ PF_walkmove (progs_t *pr)
yaw = G_FLOAT (pr, OFS_PARM0);
dist = G_FLOAT (pr, OFS_PARM1);
if (!((int) SVFIELD (ent, flags, float) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (!((int) SVfloat (ent, flags) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
G_FLOAT (pr, OFS_RETURN) = 0;
return;
}
@ -1089,18 +1089,18 @@ PF_droptofloor (progs_t *pr)
ent = PROG_TO_EDICT (pr, *sv_globals.self);
VectorCopy (SVFIELD (ent, origin, vector), end);
VectorCopy (SVvector (ent, origin), end);
end[2] -= 256;
trace = SV_Move (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), SVFIELD (ent, maxs, vector), end, false, ent);
trace = SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), end, false, ent);
if (trace.fraction == 1 || trace.allsolid)
G_FLOAT (pr, OFS_RETURN) = 0;
else {
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector));
VectorCopy (trace.endpos, SVvector (ent, origin));
SV_LinkEdict (ent, false);
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (pr, trace.ent);
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVentity (ent, groundentity) = EDICT_TO_PROG (pr, trace.ent);
G_FLOAT (pr, OFS_RETURN) = 1;
}
}
@ -1235,7 +1235,7 @@ PF_aim (progs_t *pr)
ent = G_EDICT (pr, OFS_PARM0);
speed = G_FLOAT (pr, OFS_PARM1);
VectorCopy (SVFIELD (ent, origin, vector), start);
VectorCopy (SVvector (ent, origin), start);
start[2] += 20;
// noaim option
@ -1251,9 +1251,9 @@ PF_aim (progs_t *pr)
VectorCopy (*sv_globals.v_forward, dir);
VectorMA (start, 2048, dir, end);
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
if (tr.ent && SVFIELD (tr.ent, takedamage, float) == DAMAGE_AIM
&& (!teamplay->int_val || SVFIELD (ent, team, float) <= 0
|| SVFIELD (ent, team, float) != SVFIELD (tr.ent, team, float))) {
if (tr.ent && SVfloat (tr.ent, takedamage) == DAMAGE_AIM
&& (!teamplay->int_val || SVfloat (ent, team) <= 0
|| SVfloat (ent, team) != SVfloat (tr.ent, team))) {
VectorCopy (*sv_globals.v_forward, G_VECTOR (pr, OFS_RETURN));
return;
}
@ -1265,16 +1265,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 (SVFIELD (check, takedamage, float) != DAMAGE_AIM)
if (SVfloat (check, takedamage) != DAMAGE_AIM)
continue;
if (check == ent)
continue;
if (teamplay->int_val && SVFIELD (ent, team, float) > 0
&& SVFIELD (ent, team, float) == SVFIELD (check, team, float)) continue; // don't aim at
if (teamplay->int_val && SVfloat (ent, team) > 0
&& SVfloat (ent, team) == SVfloat (check, team)) continue; // don't aim at
// teammate
for (j = 0; j < 3; j++)
end[j] = SVFIELD (check, origin, vector)[j]
+ 0.5 * (SVFIELD (check, mins, vector)[j] + SVFIELD (check, maxs, vector)[j]);
end[j] = SVvector (check, origin)[j]
+ 0.5 * (SVvector (check, mins)[j] + SVvector (check, maxs)[j]);
VectorSubtract (end, start, dir);
VectorNormalize (dir);
dist = DotProduct (dir, *sv_globals.v_forward);
@ -1288,7 +1288,7 @@ PF_aim (progs_t *pr)
}
if (bestent) {
VectorSubtract (SVFIELD (bestent, origin, vector), SVFIELD (ent, origin, vector), dir);
VectorSubtract (SVvector (bestent, origin), SVvector (ent, origin), dir);
dist = DotProduct (dir, *sv_globals.v_forward);
VectorScale (*sv_globals.v_forward, dist, end);
end[2] = dir[2];
@ -1311,9 +1311,9 @@ PF_changeyaw (progs_t *pr)
float ideal, current, move, speed;
ent = PROG_TO_EDICT (pr, *sv_globals.self);
current = anglemod (SVFIELD (ent, angles, vector)[1]);
ideal = SVFIELD (ent, ideal_yaw, float);
speed = SVFIELD (ent, yaw_speed, float);
current = anglemod (SVvector (ent, angles)[1]);
ideal = SVfloat (ent, ideal_yaw);
speed = SVfloat (ent, yaw_speed);
if (current == ideal)
return;
@ -1333,7 +1333,7 @@ PF_changeyaw (progs_t *pr)
move = -speed;
}
SVFIELD (ent, angles, vector)[1] = anglemod (current + move);
SVvector (ent, angles)[1] = anglemod (current + move);
}
/*
@ -1512,16 +1512,16 @@ PF_makestatic (progs_t *pr)
MSG_WriteByte (&sv.signon, svc_spawnstatic);
model = PR_GetString (pr, SVFIELD (ent, model, string));
//SV_Printf ("Model: %d %s\n", SVFIELD (ent, model, string), model);
model = PR_GetString (pr, SVstring (ent, model));
//SV_Printf ("Model: %d %s\n", SVstring (ent, model), model);
MSG_WriteByte (&sv.signon, SV_ModelIndex (model));
MSG_WriteByte (&sv.signon, SVFIELD (ent, frame, float));
MSG_WriteByte (&sv.signon, SVFIELD (ent, colormap, float));
MSG_WriteByte (&sv.signon, SVFIELD (ent, skin, float));
MSG_WriteByte (&sv.signon, SVfloat (ent, frame));
MSG_WriteByte (&sv.signon, SVfloat (ent, colormap));
MSG_WriteByte (&sv.signon, SVfloat (ent, skin));
for (i = 0; i < 3; i++) {
MSG_WriteCoord (&sv.signon, SVFIELD (ent, origin, vector)[i]);
MSG_WriteAngle (&sv.signon, SVFIELD (ent, angles, vector)[i]);
MSG_WriteCoord (&sv.signon, SVvector (ent, origin)[i]);
MSG_WriteAngle (&sv.signon, SVvector (ent, angles)[i]);
}
// throw the entity away now

View file

@ -67,21 +67,21 @@ static int
prune_edict (progs_t *pr, edict_t *ent)
{
if (!sv_globals.current_skill) {
if (((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_DEATHMATCH))
if (((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_DEATHMATCH))
return 1;
} else {
// remove things from different skill levels or deathmatch
if (deathmatch->int_val) {
if (((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_DEATHMATCH)) {
if (((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_DEATHMATCH)) {
return 1;
}
} else if (
(*sv_globals.current_skill == 0
&& ((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_EASY))
&& ((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_EASY))
|| (*sv_globals.current_skill == 1
&& ((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_MEDIUM))
&& ((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_MEDIUM))
|| (*sv_globals.current_skill >= 2
&& ((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_HARD))) {
&& ((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_HARD))) {
return 1;
}
}

View file

@ -317,12 +317,12 @@ SV_Multicast (vec3_t origin, int to)
if (to == MULTICAST_PHS_R || to == MULTICAST_PHS) {
vec3_t delta;
VectorSubtract (origin, SVFIELD (client->edict, origin, vector), delta);
VectorSubtract (origin, SVvector (client->edict, origin), delta);
if (Length (delta) <= 1024)
goto inrange;
}
leaf = Mod_PointInLeaf (SVFIELD (client->edict, origin, vector), sv.worldmodel);
leaf = Mod_PointInLeaf (SVvector (client->edict, origin), sv.worldmodel);
if (leaf) {
// -1 is because pvs rows are 1 based, not 0 based like leafs
leafnum = leaf - sv.worldmodel->leafs - 1;
@ -414,13 +414,13 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
channel |= SND_ATTENUATION;
// use the entity origin unless it is a bmodel
if (SVFIELD (entity, solid, float) == SOLID_BSP) {
if (SVfloat (entity, solid) == SOLID_BSP) {
for (i = 0; i < 3; i++)
origin[i] =
SVFIELD (entity, origin, vector)[i] + 0.5 * (SVFIELD (entity, mins, vector)[i] +
SVFIELD (entity, maxs, vector)[i]);
SVvector (entity, origin)[i] + 0.5 * (SVvector (entity, mins)[i] +
SVvector (entity, maxs)[i]);
} else {
VectorCopy (SVFIELD (entity, origin, vector), origin);
VectorCopy (SVvector (entity, origin), origin);
}
MSG_WriteByte (&sv.multicast, svc_sound);
@ -487,25 +487,25 @@ SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
client->chokecount = 0;
}
// send a damage message if the player got hit this frame
if (SVFIELD (ent, dmg_take, float) || SVFIELD (ent, dmg_save, float)) {
other = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, dmg_inflictor, entity));
if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) {
other = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, dmg_inflictor));
MSG_WriteByte (msg, svc_damage);
MSG_WriteByte (msg, SVFIELD (ent, dmg_save, float));
MSG_WriteByte (msg, SVFIELD (ent, dmg_take, float));
MSG_WriteByte (msg, SVfloat (ent, dmg_save));
MSG_WriteByte (msg, SVfloat (ent, dmg_take));
for (i = 0; i < 3; i++)
MSG_WriteCoord (msg,
SVFIELD (other, origin, vector)[i] + 0.5 * (SVFIELD (other, mins, vector)[i] +
SVFIELD (other, maxs, vector)[i]));
SVvector (other, origin)[i] + 0.5 * (SVvector (other, mins)[i] +
SVvector (other, maxs)[i]));
SVFIELD (ent, dmg_take, float) = 0;
SVFIELD (ent, dmg_save, float) = 0;
SVfloat (ent, dmg_take) = 0;
SVfloat (ent, dmg_save) = 0;
}
// a fixangle might get lost in a dropped packet. Oh well.
if (SVFIELD (ent, fixangle, float)) {
if (SVfloat (ent, fixangle)) {
MSG_WriteByte (msg, svc_setangle);
for (i = 0; i < 3; i++)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[i]);
SVFIELD (ent, fixangle, float) = 0;
MSG_WriteAngle (msg, SVvector (ent, angles)[i]);
SVfloat (ent, fixangle) = 0;
}
}
@ -530,29 +530,29 @@ SV_UpdateClientStats (client_t *client)
if (client->spectator && client->spec_track > 0)
ent = svs.clients[client->spec_track - 1].edict;
stats[STAT_HEALTH] = SVFIELD (ent, health, float);
stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, SVFIELD (ent, weaponmodel, string)));
stats[STAT_AMMO] = SVFIELD (ent, currentammo, float);
stats[STAT_ARMOR] = SVFIELD (ent, armorvalue, float);
stats[STAT_SHELLS] = SVFIELD (ent, ammo_shells, float);
stats[STAT_NAILS] = SVFIELD (ent, ammo_nails, float);
stats[STAT_ROCKETS] = SVFIELD (ent, ammo_rockets, float);
stats[STAT_CELLS] = SVFIELD (ent, ammo_cells, float);
stats[STAT_HEALTH] = SVfloat (ent, health);
stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring (ent, weaponmodel)));
stats[STAT_AMMO] = SVfloat (ent, currentammo);
stats[STAT_ARMOR] = SVfloat (ent, armorvalue);
stats[STAT_SHELLS] = SVfloat (ent, ammo_shells);
stats[STAT_NAILS] = SVfloat (ent, ammo_nails);
stats[STAT_ROCKETS] = SVfloat (ent, ammo_rockets);
stats[STAT_CELLS] = SVfloat (ent, ammo_cells);
if (!client->spectator)
stats[STAT_ACTIVEWEAPON] = SVFIELD (ent, weapon, float);
stats[STAT_ACTIVEWEAPON] = SVfloat (ent, weapon);
// stuff the sigil bits into the high bits of items for sbar
stats[STAT_ITEMS] =
(int) SVFIELD (ent, items, float) | ((int) *sv_globals.serverflags << 28);
(int) SVfloat (ent, items) | ((int) *sv_globals.serverflags << 28);
// Extensions to the QW 2.40 protocol for Mega2k --KB
stats[STAT_VIEWHEIGHT] = (int) SVFIELD (ent, view_ofs, vector)[2];
stats[STAT_VIEWHEIGHT] = (int) SVvector (ent, view_ofs)[2];
// FIXME: this should become a * key! --KB
if (SVFIELD (ent, movetype, float) == MOVETYPE_FLY && !atoi (Info_ValueForKey
if (SVfloat (ent, movetype) == MOVETYPE_FLY && !atoi (Info_ValueForKey
(svs.info, "playerfly")))
SVFIELD (ent, movetype, float) = MOVETYPE_WALK;
SVfloat (ent, movetype) = MOVETYPE_WALK;
stats[STAT_FLYMODE] = (SVFIELD (ent, movetype, float) == MOVETYPE_FLY);
stats[STAT_FLYMODE] = (SVfloat (ent, movetype) == MOVETYPE_FLY);
for (i = 0; i < MAX_CL_STATS; i++)
@ -634,16 +634,16 @@ SV_UpdateToReliableMessages (void)
host_client->sendinfo = false;
SV_FullClientUpdate (host_client, &sv.reliable_datagram);
}
if (host_client->old_frags != SVFIELD (host_client->edict, frags, float)) {
if (host_client->old_frags != SVfloat (host_client->edict, 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, SVFIELD (host_client->edict, frags, float));
ClientReliableWrite_Short (client, SVfloat (host_client->edict, frags));
}
host_client->old_frags = SVFIELD (host_client->edict, frags, float);
host_client->old_frags = SVfloat (host_client->edict, 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, SVFIELD (sv.edicts, message, string)));
PR_GetString (&sv_pr_state, SVstring (sv.edicts, 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, SVFIELD (sv.edicts, sounds, float));
MSG_WriteByte (&host_client->netchan.message, SVfloat (sv.edicts, sounds));
// send server info string
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
@ -393,9 +393,9 @@ SV_Spawn_f (void)
ent = host_client->edict;
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
SVFIELD (ent, colormap, float) = NUM_FOR_EDICT (&sv_pr_state, ent);
SVFIELD (ent, team, float) = 0; // FIXME
SVFIELD (ent, netname, string) = PR_SetString (&sv_pr_state, host_client->name);
SVfloat (ent, colormap) = NUM_FOR_EDICT (&sv_pr_state, ent);
SVfloat (ent, team) = 0; // FIXME
SVstring (ent, netname) = PR_SetString (&sv_pr_state, host_client->name);
host_client->entgravity = 1.0;
val = GetEdictFieldValue (&sv_pr_state, ent, "gravity");
@ -442,15 +442,15 @@ SV_SpawnSpectator (void)
int i;
edict_t *e;
VectorCopy (vec3_origin, SVFIELD (sv_player, origin, vector));
VectorCopy (vec3_origin, SVFIELD (sv_player, view_ofs, vector));
SVFIELD (sv_player, view_ofs, vector)[2] = 22;
VectorCopy (vec3_origin, SVvector (sv_player, origin));
VectorCopy (vec3_origin, SVvector (sv_player, view_ofs));
SVvector (sv_player, 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, SVFIELD (e, classname, string)), "info_player_start")) {
VectorCopy (SVFIELD (e, origin, vector), SVFIELD (sv_player, origin, vector));
if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)), "info_player_start")) {
VectorCopy (SVvector (e, origin), SVvector (sv_player, origin));
return;
}
}
@ -549,7 +549,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, SVFIELD (ent, angles, vector)[i]);
MSG_WriteAngle (&host_client->netchan.message, SVvector (ent, angles)[i]);
MSG_WriteAngle (&host_client->netchan.message, 0);
#endif
}
@ -924,7 +924,7 @@ SV_Pings_f (void)
void
SV_Kill_f (void)
{
if (SVFIELD (sv_player, health, float) <= 0) {
if (SVfloat (sv_player, health) <= 0) {
SV_BeginRedirect (RD_CLIENT);
SV_ClientPrintf (host_client, PRINT_HIGH,
"Can't suicide -- already dead!\n");
@ -1033,7 +1033,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);
SVFIELD (ent, goalentity, entity) = EDICT_TO_PROG (&sv_pr_state, tent);
SVentity (ent, goalentity) = EDICT_TO_PROG (&sv_pr_state, tent);
return;
}
@ -1044,14 +1044,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);
SVFIELD (ent, goalentity, entity) = EDICT_TO_PROG (&sv_pr_state, tent);
SVentity (ent, 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);
SVFIELD (ent, goalentity, entity) = EDICT_TO_PROG (&sv_pr_state, tent);
SVentity (ent, goalentity) = EDICT_TO_PROG (&sv_pr_state, tent);
}
@ -1313,16 +1313,16 @@ AddLinksToPmove (areanode_t *node)
next = l->next;
check = EDICT_FROM_AREA (l);
if (SVFIELD (check, owner, entity) == pl)
if (SVentity (check, owner) == pl)
continue; // player's own missile
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) {
if (check == sv_player)
continue;
for (i = 0; i < 3; i++)
if (SVFIELD (check, absmin, vector)[i] > pmove_maxs[i]
|| SVFIELD (check, absmax, vector)[i] < pmove_mins[i])
if (SVvector (check, absmin)[i] > pmove_maxs[i]
|| SVvector (check, absmax)[i] < pmove_mins[i])
break;
if (i != 3)
continue;
@ -1331,22 +1331,22 @@ AddLinksToPmove (areanode_t *node)
pe = &pmove.physents[pmove.numphysent];
pmove.numphysent++;
VectorCopy (SVFIELD (check, origin, vector), pe->origin);
VectorCopy (SVvector (check, origin), pe->origin);
pe->info = NUM_FOR_EDICT (&sv_pr_state, check);
if (sv_fields.rotated_bbox != -1
&& SVFIELD (check, rotated_bbox, integer)) {
int h = SVFIELD (check, rotated_bbox, integer) - 1;
&& SVinteger (check, rotated_bbox)) {
int h = SVinteger (check, rotated_bbox) - 1;
extern clip_hull_t *pf_hull_list[];
pe->hull = pf_hull_list[h]->hulls[1];
} else {
pe->hull = 0;
if (SVFIELD (check, solid, float) == SOLID_BSP) {
pe->model = sv.models[(int) (SVFIELD (check, modelindex, float))];
if (SVfloat (check, solid) == SOLID_BSP) {
pe->model = sv.models[(int) (SVfloat (check, modelindex))];
} else {
pe->model = NULL;
VectorCopy (SVFIELD (check, mins, vector), pe->mins);
VectorCopy (SVFIELD (check, maxs, vector), pe->maxs);
VectorCopy (SVvector (check, mins), pe->mins);
VectorCopy (SVvector (check, maxs), pe->maxs);
}
}
}
@ -1384,30 +1384,30 @@ AddAllEntsToPmove (void)
check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free)
continue;
if (SVFIELD (check, owner, entity) == pl)
if (SVentity (check, owner) == pl)
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) {
if (check == sv_player)
continue;
for (i = 0; i < 3; i++)
if (SVFIELD (check, absmin, vector)[i] > pmove_maxs[i]
|| SVFIELD (check, absmax, vector)[i] < pmove_mins[i])
if (SVvector (check, absmin)[i] > pmove_maxs[i]
|| SVvector (check, absmax)[i] < pmove_mins[i])
break;
if (i != 3)
continue;
pe = &pmove.physents[pmove.numphysent];
VectorCopy (SVFIELD (check, origin, vector), pe->origin);
VectorCopy (SVvector (check, origin), pe->origin);
pmove.physents[pmove.numphysent].info = e;
if (SVFIELD (check, solid, float) == SOLID_BSP)
pe->model = sv.models[(int) (SVFIELD (check, modelindex, float))];
if (SVfloat (check, solid) == SOLID_BSP)
pe->model = sv.models[(int) (SVfloat (check, modelindex))];
else {
pe->model = NULL;
VectorCopy (SVFIELD (check, mins, vector), pe->mins);
VectorCopy (SVFIELD (check, maxs, vector), pe->maxs);
VectorCopy (SVvector (check, mins), pe->mins);
VectorCopy (SVvector (check, maxs), pe->maxs);
}
if (++pmove.numphysent == MAX_PHYSENTS)
@ -1490,29 +1490,29 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
return;
}
if (!SVFIELD (sv_player, fixangle, float))
VectorCopy (ucmd->angles, SVFIELD (sv_player, v_angle, vector));
if (!SVfloat (sv_player, fixangle))
VectorCopy (ucmd->angles, SVvector (sv_player, v_angle));
SVFIELD (sv_player, button0, float) = ucmd->buttons & 1;
SVfloat (sv_player, button0) = ucmd->buttons & 1;
// 1999-10-29 +USE fix by Maddes start
if (!nouse) {
SVFIELD (sv_player, button1, float) = (ucmd->buttons & 4) >> 2;
SVfloat (sv_player, button1) = (ucmd->buttons & 4) >> 2;
}
// 1999-10-29 +USE fix by Maddes end
SVFIELD (sv_player, button2, float) = (ucmd->buttons & 2) >> 1;
SVfloat (sv_player, button2) = (ucmd->buttons & 2) >> 1;
if (ucmd->impulse)
SVFIELD (sv_player, impulse, float) = ucmd->impulse;
SVfloat (sv_player, impulse) = ucmd->impulse;
//
// angles
// show 1/3 the pitch angle and all the roll angle
if (SVFIELD (sv_player, health, float) > 0) {
if (!SVFIELD (sv_player, fixangle, float)) {
SVFIELD (sv_player, angles, vector)[PITCH] = -SVFIELD (sv_player, v_angle, vector)[PITCH] / 3;
SVFIELD (sv_player, angles, vector)[YAW] = SVFIELD (sv_player, v_angle, vector)[YAW];
if (SVfloat (sv_player, health) > 0) {
if (!SVfloat (sv_player, fixangle)) {
SVvector (sv_player, angles)[PITCH] = -SVvector (sv_player, v_angle)[PITCH] / 3;
SVvector (sv_player, angles)[YAW] = SVvector (sv_player, v_angle)[YAW];
}
SVFIELD (sv_player, angles, vector)[ROLL] =
SV_CalcRoll (SVFIELD (sv_player, angles, vector), SVFIELD (sv_player, velocity, vector)) * 4;
SVvector (sv_player, angles)[ROLL] =
SV_CalcRoll (SVvector (sv_player, angles), SVvector (sv_player, velocity)) * 4;
}
sv_frametime = min (0.1, ucmd->msec * 0.001);
@ -1531,18 +1531,18 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
for (i = 0; i < 3; i++)
pmove.origin[i] =
SVFIELD (sv_player, origin, vector)[i]
+ (SVFIELD (sv_player, mins, vector)[i] - player_mins[i]);
VectorCopy (SVFIELD (sv_player, velocity, vector), pmove.velocity);
VectorCopy (SVFIELD (sv_player, v_angle, vector), pmove.angles);
SVvector (sv_player, origin)[i]
+ (SVvector (sv_player, mins)[i] - player_mins[i]);
VectorCopy (SVvector (sv_player, velocity), pmove.velocity);
VectorCopy (SVvector (sv_player, v_angle), pmove.angles);
pmove.flying = SVFIELD (sv_player, movetype, float) == MOVETYPE_FLY;
pmove.flying = SVfloat (sv_player, movetype) == MOVETYPE_FLY;
pmove.spectator = host_client->spectator;
pmove.waterjumptime = SVFIELD (sv_player, teleport_time, float);
pmove.waterjumptime = SVfloat (sv_player, teleport_time);
pmove.numphysent = 1;
pmove.physents[0].model = sv.worldmodel;
pmove.cmd = *ucmd;
pmove.dead = SVFIELD (sv_player, health, float) <= 0;
pmove.dead = SVfloat (sv_player, health) <= 0;
pmove.oldbuttons = host_client->oldbuttons;
movevars.entgravity = host_client->entgravity;
@ -1567,7 +1567,7 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
PlayerMove ();
after = PM_TestPlayerPosition (pmove.origin);
if (SVFIELD (sv_player, health, float) > 0 && before && !after)
if (SVfloat (sv_player, health) > 0 && before && !after)
SV_Printf ("player %s got stuck in playermove!!!!\n",
host_client->name);
}
@ -1576,29 +1576,29 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
#endif
host_client->oldbuttons = pmove.oldbuttons;
SVFIELD (sv_player, teleport_time, float) = pmove.waterjumptime;
SVFIELD (sv_player, waterlevel, float) = waterlevel;
SVFIELD (sv_player, watertype, float) = watertype;
SVfloat (sv_player, teleport_time) = pmove.waterjumptime;
SVfloat (sv_player, waterlevel) = waterlevel;
SVfloat (sv_player, watertype) = watertype;
if (onground != -1) {
SVFIELD (sv_player, flags, float) = (int) SVFIELD (sv_player, flags, float) | FL_ONGROUND;
SVFIELD (sv_player, groundentity, entity) =
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) | FL_ONGROUND;
SVentity (sv_player, groundentity) =
EDICT_TO_PROG (&sv_pr_state, EDICT_NUM (&sv_pr_state, pmove.physents[onground].info));
} else {
SVFIELD (sv_player, flags, float) = (int) SVFIELD (sv_player, flags, float) & ~FL_ONGROUND;
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) & ~FL_ONGROUND;
}
for (i = 0; i < 3; i++)
SVFIELD (sv_player, origin, vector)[i] =
pmove.origin[i] - (SVFIELD (sv_player, mins, vector)[i] - player_mins[i]);
SVvector (sv_player, origin)[i] =
pmove.origin[i] - (SVvector (sv_player, mins)[i] - player_mins[i]);
#if 0
// truncate velocity the same way the net protocol will
for (i = 0; i < 3; i++)
SVFIELD (sv_player, velocity, vector)[i] = (int) pmove.velocity[i];
SVvector (sv_player, velocity)[i] = (int) pmove.velocity[i];
#else
VectorCopy (pmove.velocity, SVFIELD (sv_player, velocity, vector));
VectorCopy (pmove.velocity, SVvector (sv_player, velocity));
#endif
VectorCopy (pmove.angles, SVFIELD (sv_player, v_angle, vector));
VectorCopy (pmove.angles, SVvector (sv_player, v_angle));
if (!host_client->spectator) {
// link into place and touch triggers
@ -1608,11 +1608,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 (!SVFIELD (ent, touch, func) || (playertouch[n / 8] & (1 << (n % 8))))
if (!SVfunc (ent, touch) || (playertouch[n / 8] & (1 << (n % 8))))
continue;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv_player);
PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, touch, func));
PR_ExecuteProgram (&sv_pr_state, SVfunc (ent, touch));
playertouch[n / 8] |= 1 << (n % 8);
}
}
@ -1780,7 +1780,7 @@ SV_ExecuteClientMessage (client_t *cl)
o[2] = MSG_ReadCoord (net_message);
// only allowed by spectators
if (host_client->spectator) {
VectorCopy (o, SVFIELD (sv_player, origin, vector));
VectorCopy (o, SVvector (sv_player, origin));
SV_LinkEdict (sv_player, false);
}
break;

View file

@ -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);