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) #define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
#endif #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 #endif // __sv_progs_h

View file

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

View file

@ -953,7 +953,7 @@ _Datagram_CheckNewConnections (void)
MSG_WriteByte (net_message->message, playerNumber); MSG_WriteByte (net_message->message, playerNumber);
MSG_WriteString (net_message->message, client->name); MSG_WriteString (net_message->message, client->name);
MSG_WriteLong (net_message->message, client->colors); 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, MSG_WriteLong (net_message->message,
(int) (net_time - client->netconnection->connecttime)); (int) (net_time - client->netconnection->connecttime));
MSG_WriteString (net_message->message, client->netconnection->address); 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); e = G_EDICT (pr, OFS_PARM0);
org = G_VECTOR (pr, OFS_PARM1); org = G_VECTOR (pr, OFS_PARM1);
VectorCopy (org, SVFIELD (e, origin, vector)); VectorCopy (org, SVvector (e, origin));
SV_LinkEdict (e, false); SV_LinkEdict (e, false);
} }
@ -188,7 +188,7 @@ SetMinMaxSize (progs_t * pr, edict_t *e, float *min, float *max,
VectorCopy (max, rmax); VectorCopy (max, rmax);
} else { } else {
// find min / max for rotations // find min / max for rotations
angles = SVFIELD (e, angles, vector); angles = SVvector (e, angles);
a = angles[1] / 180 * M_PI; a = angles[1] / 180 * M_PI;
@ -229,9 +229,9 @@ SetMinMaxSize (progs_t * pr, edict_t *e, float *min, float *max,
} }
// set derived values // set derived values
VectorCopy (rmin, SVFIELD (e, mins, vector)); VectorCopy (rmin, SVvector (e, mins));
VectorCopy (rmax, SVFIELD (e, maxs, vector)); VectorCopy (rmax, SVvector (e, maxs));
VectorSubtract (max, min, SVFIELD (e, size, vector)); VectorSubtract (max, min, SVvector (e, size));
SV_LinkEdict (e, false); SV_LinkEdict (e, false);
} }
@ -285,10 +285,10 @@ PF_setmodel (progs_t * pr)
PR_RunError (pr, "no precache: %s\n", m); PR_RunError (pr, "no precache: %s\n", m);
SVFIELD (e, model, string) = PR_SetString (pr, m); SVstring (e, model) = PR_SetString (pr, m);
SVFIELD (e, modelindex, float) = i; // SV_ModelIndex (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) if (mod)
SetMinMaxSize (pr, e, mod->mins, mod->maxs, true); SetMinMaxSize (pr, e, mod->mins, mod->maxs, true);
@ -756,9 +756,9 @@ PF_newcheckclient (progs_t * pr, int check)
if (ent->free) if (ent->free)
continue; continue;
if (SVFIELD (ent, health, float) <= 0) if (SVfloat (ent, health) <= 0)
continue; continue;
if ((int) SVFIELD (ent, flags, float) & FL_NOTARGET) if ((int) SVfloat (ent, flags) & FL_NOTARGET)
continue; continue;
// anything that is a client, or has a client as an enemy // 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 // 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); leaf = Mod_PointInLeaf (org, sv.worldmodel);
pvs = Mod_LeafPVS (leaf, sv.worldmodel); pvs = Mod_LeafPVS (leaf, sv.worldmodel);
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3); memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3);
@ -806,13 +806,13 @@ PF_checkclient (progs_t * pr)
} }
// return check if it might be visible // return check if it might be visible
ent = EDICT_NUM (pr, sv.lastcheck); 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_EDICT (pr, sv.edicts);
return; return;
} }
// if current entity can't possibly see the check entity, return 0 // if current entity can't possibly see the check entity, return 0
self = PROG_TO_EDICT (pr, *sv_globals.self); 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); leaf = Mod_PointInLeaf (view, sv.worldmodel);
l = (leaf - sv.worldmodel->leafs) - 1; l = (leaf - sv.worldmodel->leafs) - 1;
if ((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7)))) { 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)) { for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
if (ent->free) if (ent->free)
continue; continue;
if (SVFIELD (ent, solid, float) == SOLID_NOT) if (SVfloat (ent, solid) == SOLID_NOT)
continue; continue;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
eorg[j] = eorg[j] =
org[j] - (SVFIELD (ent, origin, vector)[j] + org[j] - (SVvector (ent, origin)[j] +
(SVFIELD (ent, mins, vector)[j] + SVFIELD (ent, maxs, vector)[j]) * 0.5); (SVvector (ent, mins)[j] + SVvector (ent, maxs)[j]) * 0.5);
if (Length (eorg) > rad) if (Length (eorg) > rad)
continue; continue;
SVFIELD (ent, chain, entity) = EDICT_TO_PROG (pr, chain); SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);
chain = ent; chain = ent;
} }
@ -1068,19 +1068,19 @@ PF_Find (progs_t * pr)
first = ed; first = ed;
else if (second == (edict_t *) sv.edicts) else if (second == (edict_t *) sv.edicts)
second = ed; second = ed;
SVFIELD (ed, chain, entity) = EDICT_TO_PROG (pr, last); SVentity (ed, chain) = EDICT_TO_PROG (pr, last);
last = ed; last = ed;
} }
} }
if (first != last) { if (first != last) {
if (last != second) if (last != second)
SVFIELD (first, chain, entity) = SVFIELD (last, chain, entity); SVentity (first, chain) = SVentity (last, chain);
else else
SVFIELD (first, chain, entity) = EDICT_TO_PROG (pr, last); SVentity (first, chain) = EDICT_TO_PROG (pr, last);
SVFIELD (last, chain, entity) = EDICT_TO_PROG (pr, (edict_t *) sv.edicts); SVentity (last, chain) = EDICT_TO_PROG (pr, (edict_t *) sv.edicts);
if (second && second != last) 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); RETURN_EDICT (pr, first);
} }
@ -1226,7 +1226,7 @@ PF_walkmove (progs_t * pr)
yaw = G_FLOAT (pr, OFS_PARM0); yaw = G_FLOAT (pr, OFS_PARM0);
dist = G_FLOAT (pr, OFS_PARM1); 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; G_FLOAT (pr, OFS_RETURN) = 0;
return; return;
} }
@ -1265,20 +1265,20 @@ PF_droptofloor (progs_t * pr)
ent = PROG_TO_EDICT (pr, *sv_globals.self); ent = PROG_TO_EDICT (pr, *sv_globals.self);
VectorCopy (SVFIELD (ent, origin, vector), end); VectorCopy (SVvector (ent, origin), end);
end[2] -= 256; end[2] -= 256;
trace = 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); ent);
if (trace.fraction == 1 || trace.allsolid) if (trace.fraction == 1 || trace.allsolid)
G_FLOAT (pr, OFS_RETURN) = 0; G_FLOAT (pr, OFS_RETURN) = 0;
else { else {
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector)); VectorCopy (trace.endpos, SVvector (ent, origin));
SV_LinkEdict (ent, false); SV_LinkEdict (ent, false);
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND; SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (pr, trace.ent); SVentity (ent, groundentity) = EDICT_TO_PROG (pr, trace.ent);
G_FLOAT (pr, OFS_RETURN) = 1; G_FLOAT (pr, OFS_RETURN) = 1;
} }
} }
@ -1421,16 +1421,16 @@ PF_aim (progs_t * pr)
ent = G_EDICT (pr, OFS_PARM0); ent = G_EDICT (pr, OFS_PARM0);
speed = G_FLOAT (pr, OFS_PARM1); speed = G_FLOAT (pr, OFS_PARM1);
VectorCopy (SVFIELD (ent, origin, vector), start); VectorCopy (SVvector (ent, origin), start);
start[2] += 20; start[2] += 20;
// try sending a trace straight // try sending a trace straight
VectorCopy (*sv_globals.v_forward, dir); VectorCopy (*sv_globals.v_forward, dir);
VectorMA (start, 2048, dir, end); VectorMA (start, 2048, dir, end);
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent); tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
if (tr.ent && SVFIELD (tr.ent, takedamage, float) == DAMAGE_AIM if (tr.ent && SVfloat (tr.ent, takedamage) == DAMAGE_AIM
&& (!teamplay->int_val || SVFIELD (ent, team, float) <= 0 && (!teamplay->int_val || SVfloat (ent, team) <= 0
|| SVFIELD (ent, team, float) != SVFIELD (tr.ent, team, float))) { || SVfloat (ent, team) != SVfloat (tr.ent, team))) {
VectorCopy (*sv_globals.v_forward, G_VECTOR (pr, OFS_RETURN)); VectorCopy (*sv_globals.v_forward, G_VECTOR (pr, OFS_RETURN));
return; return;
} }
@ -1441,16 +1441,16 @@ PF_aim (progs_t * pr)
check = NEXT_EDICT (pr, sv.edicts); check = NEXT_EDICT (pr, sv.edicts);
for (i = 1; i < sv.num_edicts; i++, check = NEXT_EDICT (pr, check)) { 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; continue;
if (check == ent) if (check == ent)
continue; continue;
if (teamplay->int_val && SVFIELD (ent, team, float) > 0 if (teamplay->int_val && SVfloat (ent, team) > 0
&& SVFIELD (ent, team, float) == SVFIELD (check, team, float)) continue; // don't aim at && SVfloat (ent, team) == SVfloat (check, team)) continue; // don't aim at
// teammate // teammate
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
end[j] = SVFIELD (check, origin, vector)[j] end[j] = SVvector (check, origin)[j]
+ 0.5 * (SVFIELD (check, mins, vector)[j] + SVFIELD (check, maxs, vector)[j]); + 0.5 * (SVvector (check, mins)[j] + SVvector (check, maxs)[j]);
VectorSubtract (end, start, dir); VectorSubtract (end, start, dir);
VectorNormalize (dir); VectorNormalize (dir);
dist = DotProduct (dir, *sv_globals.v_forward); dist = DotProduct (dir, *sv_globals.v_forward);
@ -1464,7 +1464,7 @@ PF_aim (progs_t * pr)
} }
if (bestent) { 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); dist = DotProduct (dir, *sv_globals.v_forward);
VectorScale (*sv_globals.v_forward, dist, end); VectorScale (*sv_globals.v_forward, dist, end);
end[2] = dir[2]; end[2] = dir[2];
@ -1489,9 +1489,9 @@ PF_changeyaw (progs_t * pr)
float ideal, current, move, speed; float ideal, current, move, speed;
ent = PROG_TO_EDICT (pr, *sv_globals.self); ent = PROG_TO_EDICT (pr, *sv_globals.self);
current = anglemod (SVFIELD (ent, angles, vector)[1]); current = anglemod (SVvector (ent, angles)[1]);
ideal = SVFIELD (ent, ideal_yaw, float); ideal = SVfloat (ent, ideal_yaw);
speed = SVFIELD (ent, yaw_speed, float); speed = SVfloat (ent, yaw_speed);
if (current == ideal) if (current == ideal)
return; return;
@ -1511,7 +1511,7 @@ PF_changeyaw (progs_t * pr)
move = -speed; move = -speed;
} }
SVFIELD (ent, angles, vector)[1] = anglemod (current + move); SVvector (ent, angles)[1] = anglemod (current + move);
} }
#ifdef QUAKE2 #ifdef QUAKE2
@ -1527,9 +1527,9 @@ PF_changepitch (progs_t * pr)
float ideal, current, move, speed; float ideal, current, move, speed;
ent = G_EDICT (pr, OFS_PARM0); ent = G_EDICT (pr, OFS_PARM0);
current = anglemod (SVFIELD (ent, angles, vector)[0]); current = anglemod (SVvector (ent, angles)[0]);
ideal = SVFIELD (ent, idealpitch, float); ideal = SVfloat (ent, idealpitch);
speed = SVFIELD (ent, pitch_speed, float); speed = SVfloat (ent, pitch_speed);
if (current == ideal) if (current == ideal)
return; return;
@ -1549,7 +1549,7 @@ PF_changepitch (progs_t * pr)
move = -speed; move = -speed;
} }
SVFIELD (ent, angles, vector)[0] = anglemod (current + move); SVvector (ent, angles)[0] = anglemod (current + move);
} }
#endif #endif
@ -1660,14 +1660,14 @@ PF_makestatic (progs_t * pr)
MSG_WriteByte (&sv.signon, svc_spawnstatic); 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, SVfloat (ent, frame));
MSG_WriteByte (&sv.signon, SVFIELD (ent, colormap, float)); MSG_WriteByte (&sv.signon, SVfloat (ent, colormap));
MSG_WriteByte (&sv.signon, SVFIELD (ent, skin, float)); MSG_WriteByte (&sv.signon, SVfloat (ent, skin));
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
MSG_WriteCoord (&sv.signon, SVFIELD (ent, origin, vector)[i]); MSG_WriteCoord (&sv.signon, SVvector (ent, origin)[i]);
MSG_WriteAngle (&sv.signon, SVFIELD (ent, angles, vector)[i]); MSG_WriteAngle (&sv.signon, SVvector (ent, angles)[i]);
} }
// throw the entity away now // throw the entity away now
@ -1764,49 +1764,49 @@ PF_WaterMove (progs_t * pr)
self = PROG_TO_EDICT (pr, *sv_globals.self); self = PROG_TO_EDICT (pr, *sv_globals.self);
if (SVFIELD (self, movetype, float) == MOVETYPE_NOCLIP) { if (SVfloat (self, movetype) == MOVETYPE_NOCLIP) {
SVFIELD (self, air_finished, float) = sv.time + 12; SVfloat (self, air_finished) = sv.time + 12;
G_FLOAT (pr, OFS_RETURN) = damage; G_FLOAT (pr, OFS_RETURN) = damage;
return; return;
} }
if (SVFIELD (self, health, float) < 0) { if (SVfloat (self, health) < 0) {
G_FLOAT (pr, OFS_RETURN) = damage; G_FLOAT (pr, OFS_RETURN) = damage;
return; return;
} }
if (SVFIELD (self, deadflag, float) == DEAD_NO) if (SVfloat (self, deadflag) == DEAD_NO)
drownlevel = 3; drownlevel = 3;
else else
drownlevel = 1; drownlevel = 1;
flags = (int) SVFIELD (self, flags, float); flags = (int) SVfloat (self, flags);
waterlevel = (int) SVFIELD (self, waterlevel, float); waterlevel = (int) SVfloat (self, waterlevel);
watertype = (int) SVFIELD (self, watertype, float); watertype = (int) SVfloat (self, watertype);
if (!(flags & (FL_IMMUNE_WATER + FL_GODMODE))) if (!(flags & (FL_IMMUNE_WATER + FL_GODMODE)))
if (((flags & FL_SWIM) && (waterlevel < drownlevel)) if (((flags & FL_SWIM) && (waterlevel < drownlevel))
|| (waterlevel >= drownlevel)) { || (waterlevel >= drownlevel)) {
if (SVFIELD (self, air_finished, float) < sv.time) if (SVfloat (self, air_finished) < sv.time)
if (SVFIELD (self, pain_finished, float) < sv.time) { if (SVfloat (self, pain_finished) < sv.time) {
SVFIELD (self, dmg, float) = SVFIELD (self, dmg, float) + 2; SVfloat (self, dmg) = SVfloat (self, dmg) + 2;
if (SVFIELD (self, dmg, float) > 15) if (SVfloat (self, dmg) > 15)
SVFIELD (self, dmg, float) = 10; SVfloat (self, dmg) = 10;
// T_Damage (self, world, world, self.dmg, 0, FALSE); // T_Damage (self, world, world, self.dmg, 0, FALSE);
damage = SVFIELD (self, dmg, float); damage = SVfloat (self, dmg);
SVFIELD (self, pain_finished, float) = sv.time + 1.0; SVfloat (self, pain_finished) = sv.time + 1.0;
} }
} else { } 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); // sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_VOICE, "player/gasp2.wav", 255, SV_StartSound (self, CHAN_VOICE, "player/gasp2.wav", 255,
ATTN_NORM); 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); // sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_VOICE, "player/gasp1.wav", 255, SV_StartSound (self, CHAN_VOICE, "player/gasp1.wav", 255,
ATTN_NORM); ATTN_NORM);
SVFIELD (self, air_finished, float) = sv.time + 12.0; SVfloat (self, air_finished) = sv.time + 12.0;
SVFIELD (self, dmg, float) = 2; SVfloat (self, dmg) = 2;
} }
if (!waterlevel) { if (!waterlevel) {
@ -1815,28 +1815,28 @@ PF_WaterMove (progs_t * pr)
// sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM); // sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_BODY, "misc/outwater.wav", 255, SV_StartSound (self, CHAN_BODY, "misc/outwater.wav", 255,
ATTN_NORM); 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; G_FLOAT (pr, OFS_RETURN) = damage;
return; return;
} }
if (watertype == CONTENT_LAVA) { // do damage if (watertype == CONTENT_LAVA) { // do damage
if (!(flags & (FL_IMMUNE_LAVA + FL_GODMODE))) if (!(flags & (FL_IMMUNE_LAVA + FL_GODMODE)))
if (SVFIELD (self, dmgtime, float) < sv.time) { if (SVfloat (self, dmgtime) < sv.time) {
if (SVFIELD (self, radsuit_finished, float) < sv.time) if (SVfloat (self, radsuit_finished) < sv.time)
SVFIELD (self, dmgtime, float) = sv.time + 0.2; SVfloat (self, dmgtime) = sv.time + 0.2;
else 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); // T_Damage (self, world, world, 10*self.waterlevel, 0, TRUE);
damage = (float) (10 * waterlevel); damage = (float) (10 * waterlevel);
} }
} else if (watertype == CONTENT_SLIME) { // do damage } else if (watertype == CONTENT_SLIME) { // do damage
if (!(flags & (FL_IMMUNE_SLIME + FL_GODMODE))) if (!(flags & (FL_IMMUNE_SLIME + FL_GODMODE)))
if (SVFIELD (self, dmgtime, float) < sv.time if (SVfloat (self, dmgtime) < sv.time
&& SVFIELD (self, radsuit_finished, float) < sv.time) { && SVfloat (self, radsuit_finished) < sv.time) {
SVFIELD (self, dmgtime, float) = sv.time + 1.0; SVfloat (self, dmgtime) = sv.time + 1.0;
// T_Damage (self, world, world, 4*self.waterlevel, 0, TRUE); // T_Damage (self, world, world, 4*self.waterlevel, 0, TRUE);
damage = (float) (4 * waterlevel); damage = (float) (4 * waterlevel);
} }
@ -1857,15 +1857,15 @@ PF_WaterMove (progs_t * pr)
SV_StartSound (self, CHAN_BODY, "player/slimbrn2.wav", 255, SV_StartSound (self, CHAN_BODY, "player/slimbrn2.wav", 255,
ATTN_NORM); ATTN_NORM);
SVFIELD (self, flags, float) = (float) (flags | FL_INWATER); SVfloat (self, flags) = (float) (flags | FL_INWATER);
SVFIELD (self, dmgtime, float) = 0; SVfloat (self, dmgtime) = 0;
} }
if (!(flags & FL_WATERJUMP)) { if (!(flags & FL_WATERJUMP)) {
// self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity; // self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
VectorMA (SVFIELD (self, velocity, vector), VectorMA (SVvector (self, velocity),
-0.8 * SVFIELD (self, waterlevel, float) * host_frametime, -0.8 * SVfloat (self, waterlevel) * host_frametime,
SVFIELD (self, velocity, vector), SVFIELD (self, velocity, vector)); SVvector (self, velocity), SVvector (self, velocity));
} }
G_FLOAT (pr, OFS_RETURN) = damage; 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); MSG_WriteByte (&sv.datagram, sound_num);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
MSG_WriteCoord (&sv.datagram, MSG_WriteCoord (&sv.datagram,
SVFIELD (entity, origin, vector)[i] + 0.5 * (SVFIELD (entity, mins, vector)[i] + SVvector (entity, origin)[i] + 0.5 * (SVvector (entity, mins)[i] +
SVFIELD (entity, maxs, vector)[i])); SVvector (entity, maxs)[i]));
} }
/* /*
@ -227,7 +227,7 @@ SV_SendServerinfo (client_t *client)
MSG_WriteByte (&client->message, GAME_COOP); MSG_WriteByte (&client->message, GAME_COOP);
snprintf (message, sizeof (message), 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); MSG_WriteString (&client->message, message);
@ -241,8 +241,8 @@ SV_SendServerinfo (client_t *client)
// send music // send music
MSG_WriteByte (&client->message, svc_cdtrack); MSG_WriteByte (&client->message, svc_cdtrack);
MSG_WriteByte (&client->message, SVFIELD (sv.edicts, sounds, float)); MSG_WriteByte (&client->message, SVfloat (sv.edicts, sounds));
MSG_WriteByte (&client->message, SVFIELD (sv.edicts, sounds, float)); MSG_WriteByte (&client->message, SVfloat (sv.edicts, sounds));
// set view // set view
MSG_WriteByte (&client->message, svc_setview); MSG_WriteByte (&client->message, svc_setview);
@ -455,7 +455,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
edict_t *ent; edict_t *ent;
// find the client's PVS // 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); pvs = SV_FatPVS (org);
// send over all entities (excpet the client) that touch the pvs // 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)) { for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
#ifdef QUAKE2 #ifdef QUAKE2
// don't send if flagged for NODRAW and there are no lighting effects // 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; continue;
#endif #endif
@ -471,7 +471,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
if (ent != clent) // clent is ALLWAYS sent if (ent != clent) // clent is ALLWAYS sent
{ {
// ignore ents without visible models // 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; continue;
for (i = 0; i < ent->num_leafs; i++) for (i = 0; i < ent->num_leafs; i++)
@ -490,36 +490,36 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
bits = 0; bits = 0;
for (i = 0; i < 3; i++) { 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) if (miss < -0.1 || miss > 0.1)
bits |= U_ORIGIN1 << i; 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; 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; 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; 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 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; 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; 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; 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; 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; bits |= U_MODEL;
if (e >= 256) if (e >= 256)
@ -541,27 +541,27 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
MSG_WriteByte (msg, e); MSG_WriteByte (msg, e);
if (bits & U_MODEL) if (bits & U_MODEL)
MSG_WriteByte (msg, SVFIELD (ent, modelindex, float)); MSG_WriteByte (msg, SVfloat (ent, modelindex));
if (bits & U_FRAME) if (bits & U_FRAME)
MSG_WriteByte (msg, SVFIELD (ent, frame, float)); MSG_WriteByte (msg, SVfloat (ent, frame));
if (bits & U_COLORMAP) if (bits & U_COLORMAP)
MSG_WriteByte (msg, SVFIELD (ent, colormap, float)); MSG_WriteByte (msg, SVfloat (ent, colormap));
if (bits & U_SKIN) if (bits & U_SKIN)
MSG_WriteByte (msg, SVFIELD (ent, skin, float)); MSG_WriteByte (msg, SVfloat (ent, skin));
if (bits & U_EFFECTS) if (bits & U_EFFECTS)
MSG_WriteByte (msg, SVFIELD (ent, effects, float)); MSG_WriteByte (msg, SVfloat (ent, effects));
if (bits & U_ORIGIN1) if (bits & U_ORIGIN1)
MSG_WriteCoord (msg, SVFIELD (ent, origin, vector)[0]); MSG_WriteCoord (msg, SVvector (ent, origin)[0]);
if (bits & U_ANGLE1) if (bits & U_ANGLE1)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[0]); MSG_WriteAngle (msg, SVvector (ent, angles)[0]);
if (bits & U_ORIGIN2) if (bits & U_ORIGIN2)
MSG_WriteCoord (msg, SVFIELD (ent, origin, vector)[1]); MSG_WriteCoord (msg, SVvector (ent, origin)[1]);
if (bits & U_ANGLE2) if (bits & U_ANGLE2)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[1]); MSG_WriteAngle (msg, SVvector (ent, angles)[1]);
if (bits & U_ORIGIN3) if (bits & U_ORIGIN3)
MSG_WriteCoord (msg, SVFIELD (ent, origin, vector)[2]); MSG_WriteCoord (msg, SVvector (ent, origin)[2]);
if (bits & U_ANGLE3) 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); ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) { 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 // send a damage message
// //
if (SVFIELD (ent, dmg_take, float) || SVFIELD (ent, dmg_save, float)) { if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) {
other = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, dmg_inflictor, entity)); other = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, dmg_inflictor));
MSG_WriteByte (msg, svc_damage); MSG_WriteByte (msg, svc_damage);
MSG_WriteByte (msg, SVFIELD (ent, dmg_save, float)); MSG_WriteByte (msg, SVfloat (ent, dmg_save));
MSG_WriteByte (msg, SVFIELD (ent, dmg_take, float)); MSG_WriteByte (msg, SVfloat (ent, dmg_take));
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
MSG_WriteCoord (msg, MSG_WriteCoord (msg,
SVFIELD (other, origin, vector)[i] + 0.5 * (SVFIELD (other, mins, vector)[i] + SVvector (other, origin)[i] + 0.5 * (SVvector (other, mins)[i] +
SVFIELD (other, maxs, vector)[i])); SVvector (other, maxs)[i]));
SVFIELD (ent, dmg_take, float) = 0; SVfloat (ent, dmg_take) = 0;
SVFIELD (ent, dmg_save, float) = 0; SVfloat (ent, dmg_save) = 0;
} }
// //
// send the current viewpos offset from the view entity // 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 SV_SetIdealPitch (); // how much to look up / down ideally
// a fixangle might get lost in a dropped packet. Oh well. // 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); MSG_WriteByte (msg, svc_setangle);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[i]); MSG_WriteAngle (msg, SVvector (ent, angles)[i]);
SVFIELD (ent, fixangle, float) = 0; SVfloat (ent, fixangle) = 0;
} }
bits = 0; bits = 0;
if (SVFIELD (ent, view_ofs, vector)[2] != DEFAULT_VIEWHEIGHT) if (SVvector (ent, view_ofs)[2] != DEFAULT_VIEWHEIGHT)
bits |= SU_VIEWHEIGHT; bits |= SU_VIEWHEIGHT;
if (SVFIELD (ent, idealpitch, float)) if (SVfloat (ent, idealpitch))
bits |= SU_IDEALPITCH; bits |= SU_IDEALPITCH;
// stuff the sigil bits into the high bits of items for sbar, or else // stuff the sigil bits into the high bits of items for sbar, or else
// mix in items2 // mix in items2
#ifdef QUAKE2 #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 #else
val = GetEdictFieldValue (&sv_pr_state, ent, "items2"); val = GetEdictFieldValue (&sv_pr_state, ent, "items2");
if (val) if (val)
items = (int) SVFIELD (ent, items, float) | ((int) val->float_var << 23); items = (int) SVfloat (ent, items) | ((int) val->float_var << 23);
else else
items = items =
(int) SVFIELD (ent, items, float) | ((int) *sv_globals.serverflags << 28); (int) SVfloat (ent, items) | ((int) *sv_globals.serverflags << 28);
#endif #endif
bits |= SU_ITEMS; bits |= SU_ITEMS;
if ((int) SVFIELD (ent, flags, float) & FL_ONGROUND) if ((int) SVfloat (ent, flags) & FL_ONGROUND)
bits |= SU_ONGROUND; bits |= SU_ONGROUND;
if (SVFIELD (ent, waterlevel, float) >= 2) if (SVfloat (ent, waterlevel) >= 2)
bits |= SU_INWATER; bits |= SU_INWATER;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (SVFIELD (ent, punchangle, vector)[i]) if (SVvector (ent, punchangle)[i])
bits |= (SU_PUNCH1 << i); bits |= (SU_PUNCH1 << i);
if (SVFIELD (ent, velocity, vector)[i]) if (SVvector (ent, velocity)[i])
bits |= (SU_VELOCITY1 << i); bits |= (SU_VELOCITY1 << i);
} }
if (SVFIELD (ent, weaponframe, float)) if (SVfloat (ent, weaponframe))
bits |= SU_WEAPONFRAME; bits |= SU_WEAPONFRAME;
if (SVFIELD (ent, armorvalue, float)) if (SVfloat (ent, armorvalue))
bits |= SU_ARMOR; bits |= SU_ARMOR;
// if (SVFIELD (ent, weapon, float)) // if (SVfloat (ent, weapon))
bits |= SU_WEAPON; bits |= SU_WEAPON;
// send the data // send the data
@ -683,42 +683,42 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
MSG_WriteShort (msg, bits); MSG_WriteShort (msg, bits);
if (bits & SU_VIEWHEIGHT) 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) if (bits & SU_IDEALPITCH)
MSG_WriteChar (msg, SVFIELD (ent, idealpitch, float)); MSG_WriteChar (msg, SVfloat (ent, idealpitch));
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (bits & (SU_PUNCH1 << 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)) 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) // [always sent] if (bits & SU_ITEMS)
MSG_WriteLong (msg, items); MSG_WriteLong (msg, items);
if (bits & SU_WEAPONFRAME) if (bits & SU_WEAPONFRAME)
MSG_WriteByte (msg, SVFIELD (ent, weaponframe, float)); MSG_WriteByte (msg, SVfloat (ent, weaponframe));
if (bits & SU_ARMOR) if (bits & SU_ARMOR)
MSG_WriteByte (msg, SVFIELD (ent, armorvalue, float)); MSG_WriteByte (msg, SVfloat (ent, armorvalue));
if (bits & SU_WEAPON) if (bits & SU_WEAPON)
MSG_WriteByte (msg, MSG_WriteByte (msg,
SV_ModelIndex (PR_GetString (&sv_pr_state, SV_ModelIndex (PR_GetString (&sv_pr_state,
SVFIELD (ent, weaponmodel, string)))); SVstring (ent, weaponmodel))));
MSG_WriteShort (msg, SVFIELD (ent, health, float)); MSG_WriteShort (msg, SVfloat (ent, health));
MSG_WriteByte (msg, SVFIELD (ent, currentammo, float)); MSG_WriteByte (msg, SVfloat (ent, currentammo));
MSG_WriteByte (msg, SVFIELD (ent, ammo_shells, float)); MSG_WriteByte (msg, SVfloat (ent, ammo_shells));
MSG_WriteByte (msg, SVFIELD (ent, ammo_nails, float)); MSG_WriteByte (msg, SVfloat (ent, ammo_nails));
MSG_WriteByte (msg, SVFIELD (ent, ammo_rockets, float)); MSG_WriteByte (msg, SVfloat (ent, ammo_rockets));
MSG_WriteByte (msg, SVFIELD (ent, ammo_cells, float)); MSG_WriteByte (msg, SVfloat (ent, ammo_cells));
if (standard_quake) { if (standard_quake) {
MSG_WriteByte (msg, SVFIELD (ent, weapon, float)); MSG_WriteByte (msg, SVfloat (ent, weapon));
} else { } else {
for (i = 0; i < 32; i++) { 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); MSG_WriteByte (msg, i);
break; break;
} }
@ -778,17 +778,17 @@ SV_UpdateToReliableMessages (void)
// check for changes to be sent over the reliable streams // check for changes to be sent over the reliable streams
for (i = 0, host_client = svs.clients; i < svs.maxclients; for (i = 0, host_client = svs.clients; i < svs.maxclients;
i++, host_client++) { 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++) { for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) {
if (!client->active) if (!client->active)
continue; continue;
MSG_WriteByte (&client->message, svc_updatefrags); MSG_WriteByte (&client->message, svc_updatefrags);
MSG_WriteByte (&client->message, i); MSG_WriteByte (&client->message, i);
MSG_WriteShort (&client->message, 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); svent = EDICT_NUM (&sv_pr_state, entnum);
if (svent->free) if (svent->free)
continue; continue;
if (entnum > svs.maxclients && !SVFIELD (svent, modelindex, float)) if (entnum > svs.maxclients && !SVfloat (svent, modelindex))
continue; continue;
// //
// create entity baseline // create entity baseline
// //
VectorCopy (SVFIELD (svent, origin, vector), ((entity_state_t*)svent->data)->origin); VectorCopy (SVvector (svent, origin), ((entity_state_t*)svent->data)->origin);
VectorCopy (SVFIELD (svent, angles, vector), ((entity_state_t*)svent->data)->angles); VectorCopy (SVvector (svent, angles), ((entity_state_t*)svent->data)->angles);
((entity_state_t*)svent->data)->frame = SVFIELD (svent, frame, float); ((entity_state_t*)svent->data)->frame = SVfloat (svent, frame);
((entity_state_t*)svent->data)->skin = SVFIELD (svent, skin, float); ((entity_state_t*)svent->data)->skin = SVfloat (svent, skin);
if (entnum > 0 && entnum <= svs.maxclients) { if (entnum > 0 && entnum <= svs.maxclients) {
((entity_state_t*)svent->data)->colormap = entnum; ((entity_state_t*)svent->data)->colormap = entnum;
((entity_state_t*)svent->data)->modelindex = SV_ModelIndex ("progs/player.mdl"); ((entity_state_t*)svent->data)->modelindex = SV_ModelIndex ("progs/player.mdl");
} else { } else {
((entity_state_t*)svent->data)->colormap = 0; ((entity_state_t*)svent->data)->colormap = 0;
((entity_state_t*)svent->data)->modelindex = ((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); ent = EDICT_NUM (&sv_pr_state, 0);
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4); memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
ent->free = false; ent->free = false;
SVFIELD (ent, model, string) = PR_SetString (&sv_pr_state, sv.worldmodel->name); SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->name);
SVFIELD (ent, modelindex, float) = 1; // world model SVfloat (ent, modelindex) = 1; // world model
SVFIELD (ent, solid, float) = SOLID_BSP; SVfloat (ent, solid) = SOLID_BSP;
SVFIELD (ent, movetype, float) = MOVETYPE_PUSH; SVfloat (ent, movetype) = MOVETYPE_PUSH;
if (coop->int_val) if (coop->int_val)
*sv_globals.coop = coop->int_val; *sv_globals.coop = coop->int_val;

View file

@ -52,8 +52,8 @@ SV_CheckBottom (edict_t *ent)
int x, y; int x, y;
float mid, bottom; float mid, bottom;
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), mins); VectorAdd (SVvector (ent, origin), SVvector (ent, mins), mins);
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, maxs, vector), maxs); VectorAdd (SVvector (ent, origin), SVvector (ent, maxs), maxs);
// if all of the points under the corners are solid world, don't bother // if all of the points under the corners are solid world, don't bother
// with the tougher checks // with the tougher checks
@ -124,32 +124,32 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
edict_t *enemy; edict_t *enemy;
// try the move // try the move
VectorCopy (SVFIELD (ent, origin, vector), oldorg); VectorCopy (SVvector (ent, origin), oldorg);
VectorAdd (SVFIELD (ent, origin, vector), move, neworg); VectorAdd (SVvector (ent, origin), move, neworg);
// flying monsters don't step up // 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 // try one move with vertical motion, then one without
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
VectorAdd (SVFIELD (ent, origin, vector), move, neworg); VectorAdd (SVvector (ent, origin), move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, enemy, entity)); enemy = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, enemy));
if (i == 0 && enemy != sv.edicts) { if (i == 0 && enemy != sv.edicts) {
dz = dz =
SVFIELD (ent, origin, vector)[2] - SVFIELD (enemy, origin, vector)[2]; SVvector (ent, origin)[2] - SVvector (enemy, origin)[2];
if (dz > 40) if (dz > 40)
neworg[2] -= 8; neworg[2] -= 8;
if (dz < 30) if (dz < 30)
neworg[2] += 8; neworg[2] += 8;
} }
trace = 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 (trace.fraction == 1) {
if (((int) SVFIELD (ent, flags, float) & FL_SWIM) if (((int) SVfloat (ent, flags) & FL_SWIM)
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY) && SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
return false; // swim monster left water return false; // swim monster left water
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector)); VectorCopy (trace.endpos, SVvector (ent, origin));
if (relink) if (relink)
SV_LinkEdict (ent, true); SV_LinkEdict (ent, true);
return true; return true;
@ -166,24 +166,24 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
VectorCopy (neworg, end); VectorCopy (neworg, end);
end[2] -= STEPSIZE * 2; 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) if (trace.allsolid)
return false; return false;
if (trace.startsolid) { if (trace.startsolid) {
neworg[2] -= STEPSIZE; 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) if (trace.allsolid || trace.startsolid)
return false; return false;
} }
if (trace.fraction == 1) { if (trace.fraction == 1) {
// if monster had the ground pulled out, go ahead and fall // if monster had the ground pulled out, go ahead and fall
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) { if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
VectorAdd (SVFIELD (ent, origin, vector), move, SVFIELD (ent, origin, vector)); VectorAdd (SVvector (ent, origin), move, SVvector (ent, origin));
if (relink) if (relink)
SV_LinkEdict (ent, true); 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"); // Con_Printf ("fall down\n");
return true; return true;
} }
@ -191,10 +191,10 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
return false; // walked off an edge return false; // walked off an edge
} }
// check point traces down for dangling corners // 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 (!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 // mostly pulled out
// from underneath it // from underneath it
// and is trying to correct // and is trying to correct
@ -202,15 +202,15 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
SV_LinkEdict (ent, true); SV_LinkEdict (ent, true);
return true; return true;
} }
VectorCopy (oldorg, SVFIELD (ent, origin, vector)); VectorCopy (oldorg, SVvector (ent, origin));
return false; return false;
} }
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) { if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
// Con_Printf ("back on ground\n"); // 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 // the move is ok
if (relink) if (relink)
@ -233,7 +233,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
vec3_t move, oldorigin; vec3_t move, oldorigin;
float delta; float delta;
SVFIELD (ent, ideal_yaw, float) = yaw; SVfloat (ent, ideal_yaw) = yaw;
PF_changeyaw (&sv_pr_state); PF_changeyaw (&sv_pr_state);
yaw = yaw * M_PI * 2 / 360; 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[1] = sin (yaw) * dist;
move[2] = 0; move[2] = 0;
VectorCopy (SVFIELD (ent, origin, vector), oldorigin); VectorCopy (SVvector (ent, origin), oldorigin);
if (SV_movestep (ent, move, false)) { 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 if (delta > 45 && delta < 315) { // not turned far enough, so
// don't take the step // don't take the step
VectorCopy (oldorigin, SVFIELD (ent, origin, vector)); VectorCopy (oldorigin, SVvector (ent, origin));
} }
SV_LinkEdict (ent, true); SV_LinkEdict (ent, true);
return true; return true;
@ -264,7 +264,7 @@ SV_FixCheckBottom (edict_t *ent)
{ {
// Con_Printf ("SV_FixCheckBottom\n"); // 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 d[3];
float tdir, olddir, turnaround; 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); turnaround = anglemod (olddir - 180);
deltax = SVFIELD (enemy, origin, vector)[0] - SVFIELD (actor, origin, vector)[0]; deltax = SVvector (enemy, origin)[0] - SVvector (actor, origin)[0];
deltay = SVFIELD (enemy, origin, vector)[1] - SVFIELD (actor, origin, vector)[1]; deltay = SVvector (enemy, origin)[1] - SVvector (actor, origin)[1];
if (deltax > 10) if (deltax > 10)
d[1] = 0; d[1] = 0;
else if (deltax < -10) 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)) if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
return; 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 // if a bridge was pulled out from underneath a monster, it may not have
// a valid standing position at all // a valid standing position at all
@ -359,9 +359,9 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
int i; int i;
for (i = 0; i < 3; 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; 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 false;
} }
return true; return true;
@ -377,20 +377,20 @@ SV_MoveToGoal (progs_t *pr)
float dist; float dist;
ent = PROG_TO_EDICT (pr, *pr->globals.self); 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); 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; G_FLOAT (pr, OFS_RETURN) = 0;
return; return;
} }
// if the next step hits the enemy, return immediately // 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)) && SV_CloseEnough (ent, goal, dist))
return; return;
// bump around... // 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); 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 // remove things from different skill levels or deathmatch
if (deathmatch->int_val) { if (deathmatch->int_val) {
if (((int) SVFIELD (ent, spawnflags, float) if (((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_DEATHMATCH)) { & SPAWNFLAG_NOT_DEATHMATCH)) {
return 1; return 1;
} }
} else if ((current_skill == 0 } else if ((current_skill == 0
&& ((int) SVFIELD (ent, spawnflags, float) && ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_EASY)) & SPAWNFLAG_NOT_EASY))
|| (current_skill == 1 || (current_skill == 1
&& ((int) SVFIELD (ent, spawnflags, float) && ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_MEDIUM)) & SPAWNFLAG_NOT_MEDIUM))
|| (current_skill >= 2 || (current_skill >= 2
&& ((int) SVFIELD (ent, spawnflags, float) && ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_HARD))) { & SPAWNFLAG_NOT_HARD))) {
return 1; return 1;
} }

View file

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

View file

@ -143,12 +143,12 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
hull_t *hull; hull_t *hull;
// decide which clipping hull to use, based on the size // 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 // 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"); 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) if (!model || model->type != mod_brush)
Sys_Error ("MOVETYPE_PUSH with a non bsp model"); 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 // calculate an offset value to center the origin
VectorSubtract (hull->clip_mins, mins, offset); 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 } else { // create a temp hull from bounding box sizes
VectorSubtract (SVFIELD (ent, mins, vector), maxs, hullmins); VectorSubtract (SVvector (ent, mins), maxs, hullmins);
VectorSubtract (SVFIELD (ent, maxs, vector), mins, hullmaxs); VectorSubtract (SVvector (ent, maxs), mins, hullmaxs);
hull = SV_HullForBox (hullmins, hullmaxs); hull = SV_HullForBox (hullmins, hullmaxs);
VectorCopy (SVFIELD (ent, origin, vector), offset); VectorCopy (SVvector (ent, origin), offset);
} }
return hull; return hull;
@ -269,15 +269,15 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
touch = EDICT_FROM_AREA (l); touch = EDICT_FROM_AREA (l);
if (touch == ent) if (touch == ent)
continue; continue;
if (!SVFIELD (touch, touch, func) if (!SVfunc (touch, touch)
|| SVFIELD (touch, solid, float) != SOLID_TRIGGER) || SVfloat (touch, solid) != SOLID_TRIGGER)
continue; continue;
if (SVFIELD (ent, absmin, vector)[0] > SVFIELD (touch, absmax, vector)[0] if (SVvector (ent, absmin)[0] > SVvector (touch, absmax)[0]
|| SVFIELD (ent, absmin, vector)[1] > SVFIELD (touch, absmax, vector)[1] || SVvector (ent, absmin)[1] > SVvector (touch, absmax)[1]
|| SVFIELD (ent, absmin, vector)[2] > SVFIELD (touch, absmax, vector)[2] || SVvector (ent, absmin)[2] > SVvector (touch, absmax)[2]
|| SVFIELD (ent, absmax, vector)[0] < SVFIELD (touch, absmin, vector)[0] || SVvector (ent, absmax)[0] < SVvector (touch, absmin)[0]
|| SVFIELD (ent, absmax, vector)[1] < SVFIELD (touch, absmin, vector)[1] || SVvector (ent, absmax)[1] < SVvector (touch, absmin)[1]
|| SVFIELD (ent, absmax, vector)[2] < SVFIELD (touch, absmin, vector)[2]) || SVvector (ent, absmax)[2] < SVvector (touch, absmin)[2])
continue; continue;
old_self = *sv_globals.self; 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.self = EDICT_TO_PROG (&sv_pr_state, touch);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.other = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.time = sv.time; *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.self = old_self;
*sv_globals.other = old_other; *sv_globals.other = old_other;
@ -296,9 +296,9 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
if (node->axis == -1) if (node->axis == -1)
return; return;
if (SVFIELD (ent, absmax, vector)[node->axis] > node->dist) if (SVvector (ent, absmax)[node->axis] > node->dist)
SV_TouchLinks (ent, node->children[0]); 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]); SV_TouchLinks (ent, node->children[1]);
} }
@ -329,8 +329,8 @@ SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
// NODE_MIXED // NODE_MIXED
splitplane = node->plane; splitplane = node->plane;
sides = BOX_ON_PLANE_SIDE (SVFIELD (ent, absmin, vector), sides = BOX_ON_PLANE_SIDE (SVvector (ent, absmin),
SVFIELD (ent, absmax, vector), splitplane); SVvector (ent, absmax), splitplane);
// recurse down the contacted sides // recurse down the contacted sides
if (sides & 1) if (sides & 1)
@ -356,34 +356,34 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
return; return;
// set the abs box // set the abs box
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), VectorAdd (SVvector (ent, origin), SVvector (ent, mins),
SVFIELD (ent, absmin, vector)); SVvector (ent, absmin));
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, maxs, vector), VectorAdd (SVvector (ent, origin), SVvector (ent, maxs),
SVFIELD (ent, absmax, vector)); SVvector (ent, absmax));
// to make items easier to pick up and allow them to be grabbed off // to make items easier to pick up and allow them to be grabbed off
// of shelves, the abs sizes are expanded // of shelves, the abs sizes are expanded
if ((int) SVFIELD (ent, flags, float) & FL_ITEM) { if ((int) SVfloat (ent, flags) & FL_ITEM) {
SVFIELD (ent, absmin, vector)[0] -= 15; SVvector (ent, absmin)[0] -= 15;
SVFIELD (ent, absmin, vector)[1] -= 15; SVvector (ent, absmin)[1] -= 15;
SVFIELD (ent, absmax, vector)[0] += 15; SVvector (ent, absmax)[0] += 15;
SVFIELD (ent, absmax, vector)[1] += 15; SVvector (ent, absmax)[1] += 15;
} else { // movement is clipped an epsilon away from actual edge, so we } else { // movement is clipped an epsilon away from actual edge, so we
// must fully check even when bounding boxes don't quite touch // must fully check even when bounding boxes don't quite touch
SVFIELD (ent, absmin, vector)[0] -= 1; SVvector (ent, absmin)[0] -= 1;
SVFIELD (ent, absmin, vector)[1] -= 1; SVvector (ent, absmin)[1] -= 1;
SVFIELD (ent, absmin, vector)[2] -= 1; SVvector (ent, absmin)[2] -= 1;
SVFIELD (ent, absmax, vector)[0] += 1; SVvector (ent, absmax)[0] += 1;
SVFIELD (ent, absmax, vector)[1] += 1; SVvector (ent, absmax)[1] += 1;
SVFIELD (ent, absmax, vector)[2] += 1; SVvector (ent, absmax)[2] += 1;
} }
// link to PVS leafs // link to PVS leafs
ent->num_leafs = 0; ent->num_leafs = 0;
if (SVFIELD (ent, modelindex, float)) if (SVfloat (ent, modelindex))
SV_FindTouchedLeafs (ent, sv.worldmodel->nodes); SV_FindTouchedLeafs (ent, sv.worldmodel->nodes);
if (SVFIELD (ent, solid, float) == SOLID_NOT) if (SVfloat (ent, solid) == SOLID_NOT)
return; return;
// find the first node that the ent's box crosses // find the first node that the ent's box crosses
@ -391,16 +391,16 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
while (1) { while (1) {
if (node->axis == -1) if (node->axis == -1)
break; break;
if (SVFIELD (ent, absmin, vector)[node->axis] > node->dist) if (SVvector (ent, absmin)[node->axis] > node->dist)
node = node->children[0]; 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]; node = node->children[1];
else else
break; // crosses the node break; // crosses the node
} }
// link it in // link it in
if (SVFIELD (ent, solid, float) == SOLID_TRIGGER) if (SVfloat (ent, solid) == SOLID_TRIGGER)
InsertLinkBefore (&ent->area, &node->trigger_edicts); InsertLinkBefore (&ent->area, &node->trigger_edicts);
else else
InsertLinkBefore (&ent->area, &node->solid_edicts); InsertLinkBefore (&ent->area, &node->solid_edicts);
@ -475,10 +475,10 @@ SV_TestEntityPosition (edict_t *ent)
{ {
trace_t trace; trace_t trace;
trace = SV_Move (SVFIELD (ent, origin, vector), trace = SV_Move (SVvector (ent, origin),
SVFIELD (ent, mins, vector), SVvector (ent, mins),
SVFIELD (ent, maxs, vector), SVvector (ent, maxs),
SVFIELD (ent, origin, vector), 0, ent); SVvector (ent, origin), 0, ent);
if (trace.startsolid) if (trace.startsolid)
return sv.edicts; 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) { for (l = node->solid_edicts.next; l != &node->solid_edicts; l = next) {
next = l->next; next = l->next;
touch = EDICT_FROM_AREA (l); touch = EDICT_FROM_AREA (l);
if (SVFIELD (touch, solid, float) == SOLID_NOT) if (SVfloat (touch, solid) == SOLID_NOT)
continue; continue;
if (touch == clip->passedict) if (touch == clip->passedict)
continue; continue;
if (SVFIELD (touch, solid, float) == SOLID_TRIGGER) if (SVfloat (touch, solid) == SOLID_TRIGGER)
Sys_Error ("Trigger in clipping list"); 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) != SOLID_BSP)
continue; continue;
if (clip->boxmins[0] > SVFIELD (touch, absmax, vector)[0] if (clip->boxmins[0] > SVvector (touch, absmax)[0]
|| clip->boxmins[1] > SVFIELD (touch, absmax, vector)[1] || clip->boxmins[1] > SVvector (touch, absmax)[1]
|| clip->boxmins[2] > SVFIELD (touch, absmax, vector)[2] || clip->boxmins[2] > SVvector (touch, absmax)[2]
|| clip->boxmaxs[0] < SVFIELD (touch, absmin, vector)[0] || clip->boxmaxs[0] < SVvector (touch, absmin)[0]
|| clip->boxmaxs[1] < SVFIELD (touch, absmin, vector)[1] || clip->boxmaxs[1] < SVvector (touch, absmin)[1]
|| clip->boxmaxs[2] < SVFIELD (touch, absmin, vector)[2]) || clip->boxmaxs[2] < SVvector (touch, absmin)[2])
continue; continue;
if (clip->passedict != 0 && SVFIELD (clip->passedict, size, vector)[0] if (clip->passedict != 0 && SVvector (clip->passedict, size)[0]
&& !SVFIELD (touch, size, vector)[0]) && !SVvector (touch, size)[0])
continue; // points never interact continue; // points never interact
// might intersect, so do an exact clip // might intersect, so do an exact clip
if (clip->trace.allsolid) if (clip->trace.allsolid)
return; return;
if (clip->passedict) { 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) == clip->passedict)
continue; // don't clip against own missiles continue; // don't clip against own missiles
if (PROG_TO_EDICT (&sv_pr_state, if (PROG_TO_EDICT (&sv_pr_state,
SVFIELD (clip->passedict, owner, entity)) == touch) SVentity (clip->passedict, owner)) == touch)
continue; // don't clip against owner 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, trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2,
clip->maxs2, clip->end); clip->maxs2, clip->end);
else 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) #define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
#endif #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 #define PROGHEADER_CRC 54730
extern func_t EndFrame; extern func_t EndFrame;

View file

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

View file

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

View file

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

View file

@ -58,8 +58,8 @@ SV_CheckBottom (edict_t *ent)
int x, y; int x, y;
float mid, bottom; float mid, bottom;
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), mins); VectorAdd (SVvector (ent, origin), SVvector (ent, mins), mins);
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, maxs, vector), maxs); VectorAdd (SVvector (ent, origin), SVvector (ent, maxs), maxs);
// if all of the points under the corners are solid world, don't bother // if all of the points under the corners are solid world, don't bother
// with the tougher checks // with the tougher checks
@ -130,33 +130,35 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
edict_t *enemy; edict_t *enemy;
// try the move // try the move
VectorCopy (SVFIELD (ent, origin, vector), oldorg); VectorCopy (SVvector (ent, origin), oldorg);
VectorAdd (SVFIELD (ent, origin, vector), move, neworg); VectorAdd (SVvector (ent, origin), move, neworg);
// flying monsters don't step up // 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 // try one move with vertical motion, then one without
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
VectorAdd (SVFIELD (ent, origin, vector), move, neworg); VectorAdd (SVvector (ent, origin), move, neworg);
enemy = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, enemy, entity)); enemy = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, enemy));
if (i == 0 && enemy != sv.edicts) { if (i == 0 && enemy != sv.edicts) {
dz = dz =
SVFIELD (ent, origin, vector)[2] - SVvector (ent, origin)[2] -
SVFIELD (PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, enemy, entity)), origin, vector)[2]; SVvector (PROG_TO_EDICT (&sv_pr_state,
SVentity (ent, enemy)),
origin)[2];
if (dz > 40) if (dz > 40)
neworg[2] -= 8; neworg[2] -= 8;
if (dz < 30) if (dz < 30)
neworg[2] += 8; neworg[2] += 8;
} }
trace = 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 (trace.fraction == 1) {
if (((int) SVFIELD (ent, flags, float) & FL_SWIM) if (((int) SVfloat (ent, flags) & FL_SWIM)
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY) && SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
return false; // swim monster left water return false; // swim monster left water
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector)); VectorCopy (trace.endpos, SVvector (ent, origin));
if (relink) if (relink)
SV_LinkEdict (ent, true); SV_LinkEdict (ent, true);
return true; return true;
@ -173,24 +175,24 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
VectorCopy (neworg, end); VectorCopy (neworg, end);
end[2] -= STEPSIZE * 2; 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) if (trace.allsolid)
return false; return false;
if (trace.startsolid) { if (trace.startsolid) {
neworg[2] -= STEPSIZE; 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) if (trace.allsolid || trace.startsolid)
return false; return false;
} }
if (trace.fraction == 1) { if (trace.fraction == 1) {
// if monster had the ground pulled out, go ahead and fall // if monster had the ground pulled out, go ahead and fall
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) { if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
VectorAdd (SVFIELD (ent, origin, vector), move, SVFIELD (ent, origin, vector)); VectorAdd (SVvector (ent, origin), move, SVvector (ent, origin));
if (relink) if (relink)
SV_LinkEdict (ent, true); 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"); // SV_Printf ("fall down\n");
return true; return true;
} }
@ -198,10 +200,10 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
return false; // walked off an edge return false; // walked off an edge
} }
// check point traces down for dangling corners // 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 (!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 // mostly pulled out
// from underneath it // from underneath it
// and is trying to correct // and is trying to correct
@ -209,15 +211,15 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
SV_LinkEdict (ent, true); SV_LinkEdict (ent, true);
return true; return true;
} }
VectorCopy (oldorg, SVFIELD (ent, origin, vector)); VectorCopy (oldorg, SVvector (ent, origin));
return false; return false;
} }
if ((int) SVFIELD (ent, flags, float) & FL_PARTIALGROUND) { if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
// SV_Printf ("back on ground\n"); // 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 // the move is ok
if (relink) if (relink)
@ -240,7 +242,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
vec3_t move, oldorigin; vec3_t move, oldorigin;
float delta; float delta;
SVFIELD (ent, ideal_yaw, float) = yaw; SVfloat (ent, ideal_yaw) = yaw;
PF_changeyaw (&sv_pr_state); PF_changeyaw (&sv_pr_state);
yaw = yaw * M_PI * 2 / 360; 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[1] = sin (yaw) * dist;
move[2] = 0; move[2] = 0;
VectorCopy (SVFIELD (ent, origin, vector), oldorigin); VectorCopy (SVvector (ent, origin), oldorigin);
if (SV_movestep (ent, move, false)) { 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 if (delta > 45 && delta < 315) { // not turned far enough, so
// don't take the step // don't take the step
VectorCopy (oldorigin, SVFIELD (ent, origin, vector)); VectorCopy (oldorigin, SVvector (ent, origin));
} }
SV_LinkEdict (ent, true); SV_LinkEdict (ent, true);
return true; return true;
@ -271,7 +273,7 @@ SV_FixCheckBottom (edict_t *ent)
{ {
// SV_Printf ("SV_FixCheckBottom\n"); // 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 d[3];
float tdir, olddir, turnaround; 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); turnaround = anglemod (olddir - 180);
deltax = SVFIELD (enemy, origin, vector)[0] - SVFIELD (actor, origin, vector)[0]; deltax = SVvector (enemy, origin)[0] - SVvector (actor, origin)[0];
deltay = SVFIELD (enemy, origin, vector)[1] - SVFIELD (actor, origin, vector)[1]; deltay = SVvector (enemy, origin)[1] - SVvector (actor, origin)[1];
if (deltax > 10) if (deltax > 10)
d[1] = 0; d[1] = 0;
else if (deltax < -10) 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)) if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
return; 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 // if a bridge was pulled out from underneath a monster, it may not have
// a valid standing position at all // a valid standing position at all
@ -366,9 +368,9 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
int i; int i;
for (i = 0; i < 3; 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; 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 false;
} }
return true; return true;
@ -384,20 +386,20 @@ SV_MoveToGoal (progs_t *pr)
float dist; float dist;
ent = PROG_TO_EDICT (&sv_pr_state, *sv_globals.self); 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); 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; G_FLOAT (&sv_pr_state, OFS_RETURN) = 0;
return; return;
} }
// if the next step hits the enemy, return immediately // 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)) && SV_CloseEnough (ent, goal, dist))
return; return;
// bump around... // 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); 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)) { for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free) if (check->free)
continue; continue;
if (SVFIELD (check, movetype, float) == MOVETYPE_PUSH if (SVfloat (check, movetype) == MOVETYPE_PUSH
|| SVFIELD (check, movetype, float) == MOVETYPE_NONE || SVfloat (check, movetype) == MOVETYPE_NONE
|| SVFIELD (check, movetype, float) == MOVETYPE_NOCLIP) continue; || SVfloat (check, movetype) == MOVETYPE_NOCLIP) continue;
if (SV_TestEntityPosition (check)) if (SV_TestEntityPosition (check))
SV_Printf ("entity in invalid position\n"); SV_Printf ("entity in invalid position\n");
@ -109,23 +109,23 @@ SV_CheckVelocity (edict_t *ent)
// bound velocity // bound velocity
// //
for (i = 0; i < 3; i++) { 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", SV_Printf ("Got a NaN velocity on %s\n",
PR_GetString (&sv_pr_state, SVFIELD (ent, classname, string))); PR_GetString (&sv_pr_state, SVstring (ent, classname)));
SVFIELD (ent, velocity, vector)[i] = 0; 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", SV_Printf ("Got a NaN origin on %s\n",
PR_GetString (&sv_pr_state, SVFIELD (ent, classname, string))); PR_GetString (&sv_pr_state, SVstring (ent, classname)));
SVFIELD (ent, origin, vector)[i] = 0; SVvector (ent, origin)[i] = 0;
} }
} }
// 1999-10-18 SV_MAXVELOCITY fix by Maddes start // 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) { if (wishspeed > sv_maxvelocity->value) {
VectorScale (SVFIELD (ent, velocity, vector), sv_maxvelocity->value / wishspeed, VectorScale (SVvector (ent, velocity), sv_maxvelocity->value / wishspeed,
SVFIELD (ent, velocity, vector)); SVvector (ent, velocity));
} }
// 1999-10-18 SV_MAXVELOCITY fix by Maddes end // 1999-10-18 SV_MAXVELOCITY fix by Maddes end
} }
@ -144,7 +144,7 @@ SV_RunThink (edict_t *ent)
float thinktime; float thinktime;
do { do {
thinktime = SVFIELD (ent, nextthink, float); thinktime = SVfloat (ent, nextthink);
if (thinktime <= 0) if (thinktime <= 0)
return true; return true;
if (thinktime > sv.time + sv_frametime) 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. thinktime = sv.time; // don't let things stay in the past.
// it is possible to start that way // it is possible to start that way
// by a trigger with a local time. // by a trigger with a local time.
SVFIELD (ent, nextthink, float) = 0; SVfloat (ent, nextthink) = 0;
*sv_globals.time = thinktime; *sv_globals.time = thinktime;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts); *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) if (ent->free)
return false; return false;
@ -181,16 +181,16 @@ SV_Impact (edict_t *e1, edict_t *e2)
old_other = *sv_globals.other; old_other = *sv_globals.other;
*sv_globals.time = sv.time; *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.self = EDICT_TO_PROG (&sv_pr_state, e1);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, e2); *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.self = EDICT_TO_PROG (&sv_pr_state, e2);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, e1); *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; *sv_globals.self = old_self;
@ -259,27 +259,27 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
numbumps = 4; numbumps = 4;
blocked = 0; blocked = 0;
VectorCopy (SVFIELD (ent, velocity, vector), original_velocity); VectorCopy (SVvector (ent, velocity), original_velocity);
VectorCopy (SVFIELD (ent, velocity, vector), primal_velocity); VectorCopy (SVvector (ent, velocity), primal_velocity);
numplanes = 0; numplanes = 0;
time_left = time; time_left = time;
for (bumpcount = 0; bumpcount < numbumps; bumpcount++) { for (bumpcount = 0; bumpcount < numbumps; bumpcount++) {
for (i = 0; i < 3; i++) 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 = 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 if (trace.allsolid) { // entity is trapped in another solid
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector)); VectorCopy (vec3_origin, SVvector (ent, velocity));
return 3; return 3;
} }
if (trace.fraction > 0) { // actually covered some distance if (trace.fraction > 0) { // actually covered some distance
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector)); VectorCopy (trace.endpos, SVvector (ent, origin));
VectorCopy (SVFIELD (ent, velocity, vector), original_velocity); VectorCopy (SVvector (ent, velocity), original_velocity);
numplanes = 0; numplanes = 0;
} }
@ -291,10 +291,10 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
if (trace.plane.normal[2] > 0.7) { if (trace.plane.normal[2] > 0.7) {
blocked |= 1; // floor blocked |= 1; // floor
if ((SVFIELD (trace.ent, solid, float) == SOLID_BSP) if ((SVfloat (trace.ent, solid) == SOLID_BSP)
|| (SVFIELD (trace.ent, movetype, float) == MOVETYPE_PPUSH)) { || (SVfloat (trace.ent, movetype) == MOVETYPE_PPUSH)) {
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND; SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (&sv_pr_state, trace.ent); SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
} }
} }
if (!trace.plane.normal[2]) { if (!trace.plane.normal[2]) {
@ -314,7 +314,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
// cliped to another plane // cliped to another plane
if (numplanes >= MAX_CLIP_PLANES) { // this shouldn't really happen 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; return 3;
} }
@ -336,24 +336,24 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
} }
if (i != numplanes) { // go along this plane 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 } else { // go along the crease
if (numplanes != 2) { if (numplanes != 2) {
// SV_Printf ("clip velocity, numplanes == %i\n",numplanes); // SV_Printf ("clip velocity, numplanes == %i\n",numplanes);
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector)); VectorCopy (vec3_origin, SVvector (ent, velocity));
return 7; return 7;
} }
CrossProduct (planes[0], planes[1], dir); CrossProduct (planes[0], planes[1], dir);
d = DotProduct (dir, SVFIELD (ent, velocity, vector)); d = DotProduct (dir, SVvector (ent, velocity));
VectorScale (dir, d, SVFIELD (ent, velocity, vector)); VectorScale (dir, d, SVvector (ent, velocity));
} }
// //
// if original velocity is against the original velocity, stop dead // if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners // to avoid tiny occilations in sloping corners
// //
if (DotProduct (SVFIELD (ent, velocity, vector), primal_velocity) <= 0) { if (DotProduct (SVvector (ent, velocity), primal_velocity) <= 0) {
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector)); VectorCopy (vec3_origin, SVvector (ent, velocity));
return blocked; return blocked;
} }
} }
@ -368,7 +368,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
void void
SV_AddGravity (edict_t *ent, float scale) 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; trace_t trace;
vec3_t end; 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 = 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); 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 // only clip against bmodels
trace = 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); MOVE_NOMONSTERS, ent);
else else
trace = 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); ent);
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector)); VectorCopy (trace.endpos, SVvector (ent, origin));
SV_LinkEdict (ent, true); SV_LinkEdict (ent, true);
if (trace.ent) if (trace.ent)
@ -430,15 +430,15 @@ SV_Push (edict_t *pusher, vec3_t move)
// --KB // --KB
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
mins[i] = SVFIELD (pusher, absmin, vector)[i] + move[i]; mins[i] = SVvector (pusher, absmin)[i] + move[i];
maxs[i] = SVFIELD (pusher, absmax, vector)[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 // 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); SV_LinkEdict (pusher, false);
// see if any solid entities are inside the final position // 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)) { for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free) if (check->free)
continue; continue;
if (SVFIELD (check, movetype, float) == MOVETYPE_PUSH if (SVfloat (check, movetype) == MOVETYPE_PUSH
|| SVFIELD (check, movetype, float) == MOVETYPE_NONE || SVfloat (check, movetype) == MOVETYPE_NONE
|| SVFIELD (check, movetype, float) == MOVETYPE_PPUSH || SVfloat (check, movetype) == MOVETYPE_PPUSH
|| SVFIELD (check, movetype, float) == MOVETYPE_NOCLIP) continue; || SVfloat (check, movetype) == MOVETYPE_NOCLIP) continue;
// Don't assume SOLID_BSP ! --KB // Don't assume SOLID_BSP ! --KB
solid_save = SVFIELD (pusher, solid, float); solid_save = SVfloat (pusher, solid);
SVFIELD (pusher, solid, float) = SOLID_NOT; SVfloat (pusher, solid) = SOLID_NOT;
block = SV_TestEntityPosition (check); block = SV_TestEntityPosition (check);
// SVFIELD (pusher, solid, float) = SOLID_BSP; // SVfloat (pusher, solid) = SOLID_BSP;
SVFIELD (pusher, solid, float) = solid_save; SVfloat (pusher, solid) = solid_save;
if (block) if (block)
continue; continue;
// if the entity is standing on the pusher, it will definately be // if the entity is standing on the pusher, it will definately be
// moved // moved
if (!(((int) SVFIELD (check, flags, float) & FL_ONGROUND) if (!(((int) SVfloat (check, flags) & FL_ONGROUND)
&& PROG_TO_EDICT (&sv_pr_state, SVFIELD (check, groundentity, entity)) == pusher)) { && PROG_TO_EDICT (&sv_pr_state, SVentity (check, groundentity)) == pusher)) {
if (SVFIELD (check, absmin, vector)[0] >= maxs[0] if (SVvector (check, absmin)[0] >= maxs[0]
|| SVFIELD (check, absmin, vector)[1] >= maxs[1] || SVvector (check, absmin)[1] >= maxs[1]
|| SVFIELD (check, absmin, vector)[2] >= maxs[2] || SVvector (check, absmin)[2] >= maxs[2]
|| SVFIELD (check, absmax, vector)[0] <= mins[0] || SVvector (check, absmax)[0] <= mins[0]
|| SVFIELD (check, absmax, vector)[1] <= mins[1] || SVvector (check, absmax)[1] <= mins[1]
|| SVFIELD (check, absmax, vector)[2] <= mins[2]) || SVvector (check, absmax)[2] <= mins[2])
continue; continue;
// see if the ent's bbox is inside the pusher's final position // 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; continue;
} }
VectorCopy (SVFIELD (check, origin, vector), moved_from[num_moved]); VectorCopy (SVvector (check, origin), moved_from[num_moved]);
moved_edict[num_moved] = check; moved_edict[num_moved] = check;
num_moved++; num_moved++;
// try moving the contacted entity // 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); block = SV_TestEntityPosition (check);
if (!block) { // pushed ok if (!block) { // pushed ok
SV_LinkEdict (check, false); SV_LinkEdict (check, false);
continue; continue;
} }
// if it is ok to leave in the old position, do it // 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); block = SV_TestEntityPosition (check);
if (!block) { if (!block) {
num_moved--; num_moved--;
continue; continue;
} }
// if it is still inside the pusher, block // 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); SV_LinkEdict (check, false);
continue; continue;
} }
if (SVFIELD (check, solid, float) == SOLID_NOT || SVFIELD (check, solid, float) == SOLID_TRIGGER) { // corpse if (SVfloat (check, solid) == SOLID_NOT || SVfloat (check, solid) == SOLID_TRIGGER) { // corpse
SVFIELD (check, mins, vector)[0] = SVFIELD (check, mins, vector)[1] = 0; SVvector (check, mins)[0] = SVvector (check, mins)[1] = 0;
VectorCopy (SVFIELD (check, mins, vector), SVFIELD (check, maxs, vector)); VectorCopy (SVvector (check, mins), SVvector (check, maxs));
SV_LinkEdict (check, false); SV_LinkEdict (check, false);
continue; continue;
} }
VectorCopy (pushorig, SVFIELD (pusher, origin, vector)); VectorCopy (pushorig, SVvector (pusher, origin));
SV_LinkEdict (pusher, false); SV_LinkEdict (pusher, false);
// if the pusher has a "blocked" function, call it // if the pusher has a "blocked" function, call it
// otherwise, just stay in place until the obstacle is gone // 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.self = EDICT_TO_PROG (&sv_pr_state, pusher);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, check); *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 // move back any entities we already moved
for (i = 0; i < num_moved; i++) { 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); SV_LinkEdict (moved_edict[i], false);
} }
return false; return false;
@ -538,17 +538,17 @@ SV_PushMove (edict_t *pusher, float movetime)
int i; int i;
vec3_t move; vec3_t move;
if (!SVFIELD (pusher, velocity, vector)[0] && !SVFIELD (pusher, velocity, vector)[1] if (!SVvector (pusher, velocity)[0] && !SVvector (pusher, velocity)[1]
&& !SVFIELD (pusher, velocity, vector)[2]) { && !SVvector (pusher, velocity)[2]) {
SVFIELD (pusher, ltime, float) += movetime; SVfloat (pusher, ltime) += movetime;
return; return;
} }
for (i = 0; i < 3; i++) 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)) 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; vec3_t oldorg, move;
float l; float l;
oldltime = SVFIELD (ent, ltime, float); oldltime = SVfloat (ent, ltime);
thinktime = SVFIELD (ent, nextthink, float); thinktime = SVfloat (ent, nextthink);
if (thinktime < SVFIELD (ent, ltime, float) + sv_frametime) { if (thinktime < SVfloat (ent, ltime) + sv_frametime) {
movetime = thinktime - SVFIELD (ent, ltime, float); movetime = thinktime - SVfloat (ent, ltime);
if (movetime < 0) if (movetime < 0)
movetime = 0; movetime = 0;
} else } else
movetime = sv_frametime; movetime = sv_frametime;
if (movetime) { if (movetime) {
SV_PushMove (ent, movetime); // advances SVFIELD (ent, ltime, float) if not SV_PushMove (ent, movetime); // advances SVfloat (ent, ltime) if not
// blocked // blocked
} }
if (thinktime > oldltime && thinktime <= SVFIELD (ent, ltime, float)) { if (thinktime > oldltime && thinktime <= SVfloat (ent, ltime)) {
VectorCopy (SVFIELD (ent, origin, vector), oldorg); VectorCopy (SVvector (ent, origin), oldorg);
SVFIELD (ent, nextthink, float) = 0; SVfloat (ent, nextthink) = 0;
*sv_globals.time = sv.time; *sv_globals.time = sv.time;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts); *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) if (ent->free)
return; return;
VectorSubtract (SVFIELD (ent, origin, vector), oldorg, move); VectorSubtract (SVvector (ent, origin), oldorg, move);
l = Length (move); l = Length (move);
if (l > 1.0 / 64) { if (l > 1.0 / 64) {
// SV_Printf ("**** snap: %f\n", Length (l)); // SV_Printf ("**** snap: %f\n", Length (l));
VectorCopy (oldorg, SVFIELD (ent, origin, vector)); VectorCopy (oldorg, SVvector (ent, origin));
SV_Push (ent, move); SV_Push (ent, move);
} }
} }
@ -625,8 +625,8 @@ SV_Physics_Noclip (edict_t *ent)
if (!SV_RunThink (ent)) if (!SV_RunThink (ent))
return; return;
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));
VectorMA (SVFIELD (ent, origin, vector), sv_frametime, SVFIELD (ent, velocity, vector), SVFIELD (ent, origin, vector)); VectorMA (SVvector (ent, origin), sv_frametime, SVvector (ent, velocity), SVvector (ent, origin));
SV_LinkEdict (ent, false); SV_LinkEdict (ent, false);
} }
@ -643,27 +643,27 @@ SV_CheckWaterTransition (edict_t *ent)
{ {
int cont; int cont;
cont = SV_PointContents (SVFIELD (ent, origin, vector)); cont = SV_PointContents (SVvector (ent, origin));
if (!SVFIELD (ent, watertype, float)) { // just spawned here if (!SVfloat (ent, watertype)) { // just spawned here
SVFIELD (ent, watertype, float) = cont; SVfloat (ent, watertype) = cont;
SVFIELD (ent, waterlevel, float) = 1; SVfloat (ent, waterlevel) = 1;
return; return;
} }
if (cont <= CONTENTS_WATER) { if (cont <= CONTENTS_WATER) {
if (SVFIELD (ent, watertype, float) == CONTENTS_EMPTY) { // just crossed into if (SVfloat (ent, watertype) == CONTENTS_EMPTY) { // just crossed into
// water // water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1); SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
} }
SVFIELD (ent, watertype, float) = cont; SVfloat (ent, watertype) = cont;
SVFIELD (ent, waterlevel, float) = 1; SVfloat (ent, waterlevel) = 1;
} else { } else {
if (SVFIELD (ent, watertype, float) != CONTENTS_EMPTY) { // just crossed into if (SVfloat (ent, watertype) != CONTENTS_EMPTY) { // just crossed into
// water // water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1); SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
} }
SVFIELD (ent, watertype, float) = CONTENTS_EMPTY; SVfloat (ent, watertype) = CONTENTS_EMPTY;
SVFIELD (ent, waterlevel, float) = cont; SVfloat (ent, waterlevel) = cont;
} }
} }
@ -683,45 +683,45 @@ SV_Physics_Toss (edict_t *ent)
if (!SV_RunThink (ent)) if (!SV_RunThink (ent))
return; return;
if (SVFIELD (ent, velocity, vector)[2] > 0) if (SVvector (ent, velocity)[2] > 0)
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) & ~FL_ONGROUND; SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_ONGROUND;
// if onground, return without moving // if onground, return without moving
if (((int) SVFIELD (ent, flags, float) & FL_ONGROUND)) if (((int) SVfloat (ent, flags) & FL_ONGROUND))
return; return;
SV_CheckVelocity (ent); SV_CheckVelocity (ent);
// add gravity // add gravity
if (SVFIELD (ent, movetype, float) != MOVETYPE_FLY if (SVfloat (ent, movetype) != MOVETYPE_FLY
&& SVFIELD (ent, movetype, float) != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0); && SVfloat (ent, movetype) != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0);
// move angles // 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 // move origin
VectorScale (SVFIELD (ent, velocity, vector), sv_frametime, move); VectorScale (SVvector (ent, velocity), sv_frametime, move);
trace = SV_PushEntity (ent, move); trace = SV_PushEntity (ent, move);
if (trace.fraction == 1) if (trace.fraction == 1)
return; return;
if (ent->free) if (ent->free)
return; return;
if (SVFIELD (ent, movetype, float) == MOVETYPE_BOUNCE) if (SVfloat (ent, movetype) == MOVETYPE_BOUNCE)
backoff = 1.5; backoff = 1.5;
else else
backoff = 1; 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); backoff);
// stop if on ground // stop if on ground
if (trace.plane.normal[2] > 0.7) { if (trace.plane.normal[2] > 0.7) {
if (SVFIELD (ent, velocity, vector)[2] < 60 || SVFIELD (ent, movetype, float) != MOVETYPE_BOUNCE) { if (SVvector (ent, velocity)[2] < 60 || SVfloat (ent, movetype) != MOVETYPE_BOUNCE) {
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND; SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (&sv_pr_state, trace.ent); SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
VectorCopy (vec3_origin, SVFIELD (ent, velocity, vector)); VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorCopy (vec3_origin, SVFIELD (ent, avelocity, vector)); VectorCopy (vec3_origin, SVvector (ent, avelocity));
} }
} }
// check for in water // check for in water
@ -748,8 +748,8 @@ SV_Physics_Step (edict_t *ent)
qboolean hitsound; qboolean hitsound;
// freefall if not on ground // freefall if not on ground
if (!((int) SVFIELD (ent, flags, float) & (FL_ONGROUND | FL_FLY | FL_SWIM))) { if (!((int) SVfloat (ent, flags) & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
if (SVFIELD (ent, velocity, vector)[2] < movevars.gravity * -0.1) if (SVvector (ent, velocity)[2] < movevars.gravity * -0.1)
hitsound = true; hitsound = true;
else else
hitsound = false; hitsound = false;
@ -759,7 +759,7 @@ SV_Physics_Step (edict_t *ent)
SV_FlyMove (ent, sv_frametime, NULL); SV_FlyMove (ent, sv_frametime, NULL);
SV_LinkEdict (ent, true); 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) if (hitsound)
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1); 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); SV_CheckVelocity (pusher);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
move[i] = SVFIELD (pusher, velocity, vector)[i] * movetime; move[i] = SVvector (pusher, velocity)[i] * movetime;
mins[i] = SVFIELD (pusher, absmin, vector)[i] + move[i]; mins[i] = SVvector (pusher, absmin)[i] + move[i];
maxs[i] = SVFIELD (pusher, absmax, vector)[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 = 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); MOVE_NOMONSTERS, pusher);
if (trace.fraction == 1) { if (trace.fraction == 1) {
VectorCopy (SVFIELD (pusher, origin, vector), SVFIELD (pusher, oldorigin, vector)); // Revert VectorCopy (SVvector (pusher, origin), SVvector (pusher, oldorigin)); // Revert
return; 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); 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); check = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) { 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; continue;
// Stage 2: Is it a player we can push? // 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!@#!@ SV_Printf ("Pusher encountered a player\n"); // Yes!@#!@
SVFIELD (pusher, solid, float) = SOLID_NOT; SVfloat (pusher, solid) = SOLID_NOT;
SV_PushEntity (check, move); SV_PushEntity (check, move);
SVFIELD (pusher, solid, float) = oldsolid; SVfloat (pusher, solid) = oldsolid;
continue; continue;
} }
// Stage 3: No.. Is it something that blocks us? // 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; 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; continue;
// Stage 4: Yes, it must be. Fail the move. // Stage 4: Yes, it must be. Fail the move.
VectorCopy (SVFIELD (pusher, origin, vector), SVFIELD (pusher, oldorigin, vector)); // Revert VectorCopy (SVvector (pusher, origin), SVvector (pusher, oldorigin)); // Revert
if (SVFIELD (pusher, blocked, func)) { // Blocked func? if (SVfunc (pusher, blocked)) { // Blocked func?
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, pusher); *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, pusher);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, check); *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; return;
@ -848,11 +848,11 @@ SV_Physics_PPusher (edict_t *ent)
// float l; // float l;
oldltime = SVFIELD (ent, ltime, float); oldltime = SVfloat (ent, ltime);
thinktime = SVFIELD (ent, nextthink, float); thinktime = SVfloat (ent, nextthink);
if (thinktime < SVFIELD (ent, ltime, float) + sv_frametime) { if (thinktime < SVfloat (ent, ltime) + sv_frametime) {
movetime = thinktime - SVFIELD (ent, ltime, float); movetime = thinktime - SVfloat (ent, ltime);
if (movetime < 0) if (movetime < 0)
movetime = 0; movetime = 0;
} else } else
@ -860,16 +860,16 @@ SV_Physics_PPusher (edict_t *ent)
// if (movetime) // 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 // blocked
// } // }
if (thinktime > oldltime && thinktime <= SVFIELD (ent, ltime, float)) { if (thinktime > oldltime && thinktime <= SVfloat (ent, ltime)) {
SVFIELD (ent, nextthink, float) = 0; SVfloat (ent, nextthink) = 0;
*sv_globals.time = sv.time; *sv_globals.time = sv.time;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts); *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) if (ent->free)
return; return;
} }
@ -893,11 +893,11 @@ SV_ProgStartFrame (void)
void void
SV_RunEntity (edict_t *ent) SV_RunEntity (edict_t *ent)
{ {
if (SVFIELD (ent, lastruntime, float) == (float) realtime) if (SVfloat (ent, lastruntime) == (float) realtime)
return; 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: case MOVETYPE_PUSH:
SV_Physics_Pusher (ent); SV_Physics_Pusher (ent);
break; break;
@ -920,7 +920,7 @@ SV_RunEntity (edict_t *ent)
SV_Physics_Toss (ent); SV_Physics_Toss (ent);
break; break;
default: 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); e = G_EDICT (pr, OFS_PARM0);
org = G_VECTOR (pr, OFS_PARM1); org = G_VECTOR (pr, OFS_PARM1);
VectorCopy (org, SVFIELD (e, origin, vector)); VectorCopy (org, SVvector (e, origin));
SV_LinkEdict (e, false); SV_LinkEdict (e, false);
} }
@ -167,9 +167,9 @@ PF_setsize (progs_t *pr)
e = G_EDICT (pr, OFS_PARM0); e = G_EDICT (pr, OFS_PARM0);
min = G_VECTOR (pr, OFS_PARM1); min = G_VECTOR (pr, OFS_PARM1);
max = G_VECTOR (pr, OFS_PARM2); max = G_VECTOR (pr, OFS_PARM2);
VectorCopy (min, SVFIELD (e, mins, vector)); VectorCopy (min, SVvector (e, mins));
VectorCopy (max, SVFIELD (e, maxs, vector)); VectorCopy (max, SVvector (e, maxs));
VectorSubtract (max, min, SVFIELD (e, size, vector)); VectorSubtract (max, min, SVvector (e, size));
SV_LinkEdict (e, false); SV_LinkEdict (e, false);
} }
@ -199,15 +199,15 @@ PF_setmodel (progs_t *pr)
if (!*check) if (!*check)
PR_RunError (pr, "no precache: %s\n", m); PR_RunError (pr, "no precache: %s\n", m);
SVFIELD (e, model, string) = PR_SetString (pr, m); SVstring (e, model) = PR_SetString (pr, m);
SVFIELD (e, modelindex, float) = i; SVfloat (e, modelindex) = i;
// if it is an inline model, get the size information for it // if it is an inline model, get the size information for it
if (m[0] == '*') { if (m[0] == '*') {
mod = Mod_ForName (m, true); mod = Mod_ForName (m, true);
VectorCopy (mod->mins, SVFIELD (e, mins, vector)); VectorCopy (mod->mins, SVvector (e, mins));
VectorCopy (mod->maxs, SVFIELD (e, maxs, vector)); VectorCopy (mod->maxs, SVvector (e, maxs));
VectorSubtract (mod->maxs, mod->mins, SVFIELD (e, size, vector)); VectorSubtract (mod->maxs, mod->mins, SVvector (e, size));
SV_LinkEdict (e, false); SV_LinkEdict (e, false);
} }
@ -627,9 +627,9 @@ PF_newcheckclient (progs_t *pr, int check)
if (ent->free) if (ent->free)
continue; continue;
if (SVFIELD (ent, health, float) <= 0) if (SVfloat (ent, health) <= 0)
continue; continue;
if ((int) SVFIELD (ent, flags, float) & FL_NOTARGET) if ((int) SVfloat (ent, flags) & FL_NOTARGET)
continue; continue;
// anything that is a client, or has a client as an enemy // 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 // 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); leaf = Mod_PointInLeaf (org, sv.worldmodel);
pvs = Mod_LeafPVS (leaf, sv.worldmodel); pvs = Mod_LeafPVS (leaf, sv.worldmodel);
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3); memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3);
@ -675,13 +675,13 @@ PF_checkclient (progs_t *pr)
} }
// return check if it might be visible // return check if it might be visible
ent = EDICT_NUM (pr, sv.lastcheck); 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_EDICT (pr, sv.edicts);
return; return;
} }
// if current entity can't possibly see the check entity, return 0 // if current entity can't possibly see the check entity, return 0
self = PROG_TO_EDICT (pr, *sv_globals.self); 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); leaf = Mod_PointInLeaf (view, sv.worldmodel);
l = (leaf - sv.worldmodel->leafs) - 1; l = (leaf - sv.worldmodel->leafs) - 1;
if ((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7)))) { 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)) { for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
if (ent->free) if (ent->free)
continue; continue;
if (SVFIELD (ent, solid, float) == SOLID_NOT) if (SVfloat (ent, solid) == SOLID_NOT)
continue; continue;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
eorg[j] = eorg[j] =
org[j] - (SVFIELD (ent, origin, vector)[j] + org[j] - (SVvector (ent, origin)[j] +
(SVFIELD (ent, mins, vector)[j] + SVFIELD (ent, maxs, vector)[j]) * 0.5); (SVvector (ent, mins)[j] + SVvector (ent, maxs)[j]) * 0.5);
if (Length (eorg) > rad) if (Length (eorg) > rad)
continue; continue;
SVFIELD (ent, chain, entity) = EDICT_TO_PROG (pr, chain); SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);
chain = ent; chain = ent;
} }
@ -1052,7 +1052,7 @@ PF_walkmove (progs_t *pr)
yaw = G_FLOAT (pr, OFS_PARM0); yaw = G_FLOAT (pr, OFS_PARM0);
dist = G_FLOAT (pr, OFS_PARM1); 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; G_FLOAT (pr, OFS_RETURN) = 0;
return; return;
} }
@ -1089,18 +1089,18 @@ PF_droptofloor (progs_t *pr)
ent = PROG_TO_EDICT (pr, *sv_globals.self); ent = PROG_TO_EDICT (pr, *sv_globals.self);
VectorCopy (SVFIELD (ent, origin, vector), end); VectorCopy (SVvector (ent, origin), end);
end[2] -= 256; 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) if (trace.fraction == 1 || trace.allsolid)
G_FLOAT (pr, OFS_RETURN) = 0; G_FLOAT (pr, OFS_RETURN) = 0;
else { else {
VectorCopy (trace.endpos, SVFIELD (ent, origin, vector)); VectorCopy (trace.endpos, SVvector (ent, origin));
SV_LinkEdict (ent, false); SV_LinkEdict (ent, false);
SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND; SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (pr, trace.ent); SVentity (ent, groundentity) = EDICT_TO_PROG (pr, trace.ent);
G_FLOAT (pr, OFS_RETURN) = 1; G_FLOAT (pr, OFS_RETURN) = 1;
} }
} }
@ -1235,7 +1235,7 @@ PF_aim (progs_t *pr)
ent = G_EDICT (pr, OFS_PARM0); ent = G_EDICT (pr, OFS_PARM0);
speed = G_FLOAT (pr, OFS_PARM1); speed = G_FLOAT (pr, OFS_PARM1);
VectorCopy (SVFIELD (ent, origin, vector), start); VectorCopy (SVvector (ent, origin), start);
start[2] += 20; start[2] += 20;
// noaim option // noaim option
@ -1251,9 +1251,9 @@ PF_aim (progs_t *pr)
VectorCopy (*sv_globals.v_forward, dir); VectorCopy (*sv_globals.v_forward, dir);
VectorMA (start, 2048, dir, end); VectorMA (start, 2048, dir, end);
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent); tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
if (tr.ent && SVFIELD (tr.ent, takedamage, float) == DAMAGE_AIM if (tr.ent && SVfloat (tr.ent, takedamage) == DAMAGE_AIM
&& (!teamplay->int_val || SVFIELD (ent, team, float) <= 0 && (!teamplay->int_val || SVfloat (ent, team) <= 0
|| SVFIELD (ent, team, float) != SVFIELD (tr.ent, team, float))) { || SVfloat (ent, team) != SVfloat (tr.ent, team))) {
VectorCopy (*sv_globals.v_forward, G_VECTOR (pr, OFS_RETURN)); VectorCopy (*sv_globals.v_forward, G_VECTOR (pr, OFS_RETURN));
return; return;
} }
@ -1265,16 +1265,16 @@ PF_aim (progs_t *pr)
check = NEXT_EDICT (pr, sv.edicts); check = NEXT_EDICT (pr, sv.edicts);
for (i = 1; i < sv.num_edicts; i++, check = NEXT_EDICT (pr, check)) { 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; continue;
if (check == ent) if (check == ent)
continue; continue;
if (teamplay->int_val && SVFIELD (ent, team, float) > 0 if (teamplay->int_val && SVfloat (ent, team) > 0
&& SVFIELD (ent, team, float) == SVFIELD (check, team, float)) continue; // don't aim at && SVfloat (ent, team) == SVfloat (check, team)) continue; // don't aim at
// teammate // teammate
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
end[j] = SVFIELD (check, origin, vector)[j] end[j] = SVvector (check, origin)[j]
+ 0.5 * (SVFIELD (check, mins, vector)[j] + SVFIELD (check, maxs, vector)[j]); + 0.5 * (SVvector (check, mins)[j] + SVvector (check, maxs)[j]);
VectorSubtract (end, start, dir); VectorSubtract (end, start, dir);
VectorNormalize (dir); VectorNormalize (dir);
dist = DotProduct (dir, *sv_globals.v_forward); dist = DotProduct (dir, *sv_globals.v_forward);
@ -1288,7 +1288,7 @@ PF_aim (progs_t *pr)
} }
if (bestent) { 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); dist = DotProduct (dir, *sv_globals.v_forward);
VectorScale (*sv_globals.v_forward, dist, end); VectorScale (*sv_globals.v_forward, dist, end);
end[2] = dir[2]; end[2] = dir[2];
@ -1311,9 +1311,9 @@ PF_changeyaw (progs_t *pr)
float ideal, current, move, speed; float ideal, current, move, speed;
ent = PROG_TO_EDICT (pr, *sv_globals.self); ent = PROG_TO_EDICT (pr, *sv_globals.self);
current = anglemod (SVFIELD (ent, angles, vector)[1]); current = anglemod (SVvector (ent, angles)[1]);
ideal = SVFIELD (ent, ideal_yaw, float); ideal = SVfloat (ent, ideal_yaw);
speed = SVFIELD (ent, yaw_speed, float); speed = SVfloat (ent, yaw_speed);
if (current == ideal) if (current == ideal)
return; return;
@ -1333,7 +1333,7 @@ PF_changeyaw (progs_t *pr)
move = -speed; 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); MSG_WriteByte (&sv.signon, svc_spawnstatic);
model = PR_GetString (pr, SVFIELD (ent, model, string)); model = PR_GetString (pr, SVstring (ent, model));
//SV_Printf ("Model: %d %s\n", SVFIELD (ent, model, string), model); //SV_Printf ("Model: %d %s\n", SVstring (ent, model), model);
MSG_WriteByte (&sv.signon, SV_ModelIndex (model)); MSG_WriteByte (&sv.signon, SV_ModelIndex (model));
MSG_WriteByte (&sv.signon, SVFIELD (ent, frame, float)); MSG_WriteByte (&sv.signon, SVfloat (ent, frame));
MSG_WriteByte (&sv.signon, SVFIELD (ent, colormap, float)); MSG_WriteByte (&sv.signon, SVfloat (ent, colormap));
MSG_WriteByte (&sv.signon, SVFIELD (ent, skin, float)); MSG_WriteByte (&sv.signon, SVfloat (ent, skin));
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
MSG_WriteCoord (&sv.signon, SVFIELD (ent, origin, vector)[i]); MSG_WriteCoord (&sv.signon, SVvector (ent, origin)[i]);
MSG_WriteAngle (&sv.signon, SVFIELD (ent, angles, vector)[i]); MSG_WriteAngle (&sv.signon, SVvector (ent, angles)[i]);
} }
// throw the entity away now // throw the entity away now

View file

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

View file

@ -317,12 +317,12 @@ SV_Multicast (vec3_t origin, int to)
if (to == MULTICAST_PHS_R || to == MULTICAST_PHS) { if (to == MULTICAST_PHS_R || to == MULTICAST_PHS) {
vec3_t delta; vec3_t delta;
VectorSubtract (origin, SVFIELD (client->edict, origin, vector), delta); VectorSubtract (origin, SVvector (client->edict, origin), delta);
if (Length (delta) <= 1024) if (Length (delta) <= 1024)
goto inrange; goto inrange;
} }
leaf = Mod_PointInLeaf (SVFIELD (client->edict, origin, vector), sv.worldmodel); leaf = Mod_PointInLeaf (SVvector (client->edict, origin), sv.worldmodel);
if (leaf) { if (leaf) {
// -1 is because pvs rows are 1 based, not 0 based like leafs // -1 is because pvs rows are 1 based, not 0 based like leafs
leafnum = leaf - sv.worldmodel->leafs - 1; 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; channel |= SND_ATTENUATION;
// use the entity origin unless it is a bmodel // 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++) for (i = 0; i < 3; i++)
origin[i] = origin[i] =
SVFIELD (entity, origin, vector)[i] + 0.5 * (SVFIELD (entity, mins, vector)[i] + SVvector (entity, origin)[i] + 0.5 * (SVvector (entity, mins)[i] +
SVFIELD (entity, maxs, vector)[i]); SVvector (entity, maxs)[i]);
} else { } else {
VectorCopy (SVFIELD (entity, origin, vector), origin); VectorCopy (SVvector (entity, origin), origin);
} }
MSG_WriteByte (&sv.multicast, svc_sound); MSG_WriteByte (&sv.multicast, svc_sound);
@ -487,25 +487,25 @@ SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
client->chokecount = 0; client->chokecount = 0;
} }
// send a damage message if the player got hit this frame // send a damage message if the player got hit this frame
if (SVFIELD (ent, dmg_take, float) || SVFIELD (ent, dmg_save, float)) { if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) {
other = PROG_TO_EDICT (&sv_pr_state, SVFIELD (ent, dmg_inflictor, entity)); other = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, dmg_inflictor));
MSG_WriteByte (msg, svc_damage); MSG_WriteByte (msg, svc_damage);
MSG_WriteByte (msg, SVFIELD (ent, dmg_save, float)); MSG_WriteByte (msg, SVfloat (ent, dmg_save));
MSG_WriteByte (msg, SVFIELD (ent, dmg_take, float)); MSG_WriteByte (msg, SVfloat (ent, dmg_take));
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
MSG_WriteCoord (msg, MSG_WriteCoord (msg,
SVFIELD (other, origin, vector)[i] + 0.5 * (SVFIELD (other, mins, vector)[i] + SVvector (other, origin)[i] + 0.5 * (SVvector (other, mins)[i] +
SVFIELD (other, maxs, vector)[i])); SVvector (other, maxs)[i]));
SVFIELD (ent, dmg_take, float) = 0; SVfloat (ent, dmg_take) = 0;
SVFIELD (ent, dmg_save, float) = 0; SVfloat (ent, dmg_save) = 0;
} }
// a fixangle might get lost in a dropped packet. Oh well. // 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); MSG_WriteByte (msg, svc_setangle);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
MSG_WriteAngle (msg, SVFIELD (ent, angles, vector)[i]); MSG_WriteAngle (msg, SVvector (ent, angles)[i]);
SVFIELD (ent, fixangle, float) = 0; SVfloat (ent, fixangle) = 0;
} }
} }
@ -530,29 +530,29 @@ SV_UpdateClientStats (client_t *client)
if (client->spectator && client->spec_track > 0) if (client->spectator && client->spec_track > 0)
ent = svs.clients[client->spec_track - 1].edict; ent = svs.clients[client->spec_track - 1].edict;
stats[STAT_HEALTH] = SVFIELD (ent, health, float); stats[STAT_HEALTH] = SVfloat (ent, health);
stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, SVFIELD (ent, weaponmodel, string))); stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring (ent, weaponmodel)));
stats[STAT_AMMO] = SVFIELD (ent, currentammo, float); stats[STAT_AMMO] = SVfloat (ent, currentammo);
stats[STAT_ARMOR] = SVFIELD (ent, armorvalue, float); stats[STAT_ARMOR] = SVfloat (ent, armorvalue);
stats[STAT_SHELLS] = SVFIELD (ent, ammo_shells, float); stats[STAT_SHELLS] = SVfloat (ent, ammo_shells);
stats[STAT_NAILS] = SVFIELD (ent, ammo_nails, float); stats[STAT_NAILS] = SVfloat (ent, ammo_nails);
stats[STAT_ROCKETS] = SVFIELD (ent, ammo_rockets, float); stats[STAT_ROCKETS] = SVfloat (ent, ammo_rockets);
stats[STAT_CELLS] = SVFIELD (ent, ammo_cells, float); stats[STAT_CELLS] = SVfloat (ent, ammo_cells);
if (!client->spectator) 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 // stuff the sigil bits into the high bits of items for sbar
stats[STAT_ITEMS] = 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 // 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 // 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"))) (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++) for (i = 0; i < MAX_CL_STATS; i++)
@ -634,16 +634,16 @@ SV_UpdateToReliableMessages (void)
host_client->sendinfo = false; host_client->sendinfo = false;
SV_FullClientUpdate (host_client, &sv.reliable_datagram); 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++) { for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) {
if (client->state < cs_connected) if (client->state < cs_connected)
continue; continue;
ClientReliableWrite_Begin (client, svc_updatefrags, 4); ClientReliableWrite_Begin (client, svc_updatefrags, 4);
ClientReliableWrite_Byte (client, i); 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 // maxspeed/entgravity changes
ent = host_client->edict; ent = host_client->edict;

View file

@ -135,7 +135,7 @@ SV_New_f (void)
// send full levelname // send full levelname
MSG_WriteString (&host_client->netchan.message, 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 // send the movevars
MSG_WriteFloat (&host_client->netchan.message, movevars.gravity); MSG_WriteFloat (&host_client->netchan.message, movevars.gravity);
@ -151,7 +151,7 @@ SV_New_f (void)
// send music // send music
MSG_WriteByte (&host_client->netchan.message, svc_cdtrack); 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 // send server info string
MSG_WriteByte (&host_client->netchan.message, svc_stufftext); MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
@ -393,9 +393,9 @@ SV_Spawn_f (void)
ent = host_client->edict; ent = host_client->edict;
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4); memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
SVFIELD (ent, colormap, float) = NUM_FOR_EDICT (&sv_pr_state, ent); SVfloat (ent, colormap) = NUM_FOR_EDICT (&sv_pr_state, ent);
SVFIELD (ent, team, float) = 0; // FIXME SVfloat (ent, team) = 0; // FIXME
SVFIELD (ent, netname, string) = PR_SetString (&sv_pr_state, host_client->name); SVstring (ent, netname) = PR_SetString (&sv_pr_state, host_client->name);
host_client->entgravity = 1.0; host_client->entgravity = 1.0;
val = GetEdictFieldValue (&sv_pr_state, ent, "gravity"); val = GetEdictFieldValue (&sv_pr_state, ent, "gravity");
@ -442,15 +442,15 @@ SV_SpawnSpectator (void)
int i; int i;
edict_t *e; edict_t *e;
VectorCopy (vec3_origin, SVFIELD (sv_player, origin, vector)); VectorCopy (vec3_origin, SVvector (sv_player, origin));
VectorCopy (vec3_origin, SVFIELD (sv_player, view_ofs, vector)); VectorCopy (vec3_origin, SVvector (sv_player, view_ofs));
SVFIELD (sv_player, view_ofs, vector)[2] = 22; SVvector (sv_player, view_ofs)[2] = 22;
// search for an info_playerstart to spawn the spectator at // search for an info_playerstart to spawn the spectator at
for (i = MAX_CLIENTS - 1; i < sv.num_edicts; i++) { for (i = MAX_CLIENTS - 1; i < sv.num_edicts; i++) {
e = EDICT_NUM (&sv_pr_state, i); e = EDICT_NUM (&sv_pr_state, i);
if (!strcmp (PR_GetString (&sv_pr_state, SVFIELD (e, classname, string)), "info_player_start")) { if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)), "info_player_start")) {
VectorCopy (SVFIELD (e, origin, vector), SVFIELD (sv_player, origin, vector)); VectorCopy (SVvector (e, origin), SVvector (sv_player, origin));
return; return;
} }
} }
@ -549,7 +549,7 @@ SV_Begin_f (void)
ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients)); ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients));
MSG_WriteByte (&host_client->netchan.message, svc_setangle); MSG_WriteByte (&host_client->netchan.message, svc_setangle);
for (i = 0; i < 2; i++) 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); MSG_WriteAngle (&host_client->netchan.message, 0);
#endif #endif
} }
@ -924,7 +924,7 @@ SV_Pings_f (void)
void void
SV_Kill_f (void) SV_Kill_f (void)
{ {
if (SVFIELD (sv_player, health, float) <= 0) { if (SVfloat (sv_player, health) <= 0) {
SV_BeginRedirect (RD_CLIENT); SV_BeginRedirect (RD_CLIENT);
SV_ClientPrintf (host_client, PRINT_HIGH, SV_ClientPrintf (host_client, PRINT_HIGH,
"Can't suicide -- already dead!\n"); "Can't suicide -- already dead!\n");
@ -1033,7 +1033,7 @@ SV_PTrack_f (void)
host_client->spec_track = 0; host_client->spec_track = 0;
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1); ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
tent = EDICT_NUM (&sv_pr_state, 0); 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; return;
} }
@ -1044,14 +1044,14 @@ SV_PTrack_f (void)
host_client->spec_track = 0; host_client->spec_track = 0;
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1); ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
tent = EDICT_NUM (&sv_pr_state, 0); 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; return;
} }
host_client->spec_track = i + 1; // now tracking host_client->spec_track = i + 1; // now tracking
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1); ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
tent = EDICT_NUM (&sv_pr_state, i + 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; next = l->next;
check = EDICT_FROM_AREA (l); check = EDICT_FROM_AREA (l);
if (SVFIELD (check, owner, entity) == pl) if (SVentity (check, owner) == pl)
continue; // player's own missile continue; // player's own missile
if (SVFIELD (check, solid, float) == SOLID_BSP if (SVfloat (check, solid) == SOLID_BSP
|| SVFIELD (check, solid, float) == SOLID_BBOX || SVFIELD (check, solid, float) == SOLID_SLIDEBOX) { || SVfloat (check, solid) == SOLID_BBOX || SVfloat (check, solid) == SOLID_SLIDEBOX) {
if (check == sv_player) if (check == sv_player)
continue; continue;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (SVFIELD (check, absmin, vector)[i] > pmove_maxs[i] if (SVvector (check, absmin)[i] > pmove_maxs[i]
|| SVFIELD (check, absmax, vector)[i] < pmove_mins[i]) || SVvector (check, absmax)[i] < pmove_mins[i])
break; break;
if (i != 3) if (i != 3)
continue; continue;
@ -1331,22 +1331,22 @@ AddLinksToPmove (areanode_t *node)
pe = &pmove.physents[pmove.numphysent]; pe = &pmove.physents[pmove.numphysent];
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); pe->info = NUM_FOR_EDICT (&sv_pr_state, check);
if (sv_fields.rotated_bbox != -1 if (sv_fields.rotated_bbox != -1
&& SVFIELD (check, rotated_bbox, integer)) { && SVinteger (check, rotated_bbox)) {
int h = SVFIELD (check, rotated_bbox, integer) - 1; int h = SVinteger (check, rotated_bbox) - 1;
extern clip_hull_t *pf_hull_list[]; extern clip_hull_t *pf_hull_list[];
pe->hull = pf_hull_list[h]->hulls[1]; pe->hull = pf_hull_list[h]->hulls[1];
} else { } else {
pe->hull = 0; pe->hull = 0;
if (SVFIELD (check, solid, float) == SOLID_BSP) { if (SVfloat (check, solid) == SOLID_BSP) {
pe->model = sv.models[(int) (SVFIELD (check, modelindex, float))]; pe->model = sv.models[(int) (SVfloat (check, modelindex))];
} else { } else {
pe->model = NULL; pe->model = NULL;
VectorCopy (SVFIELD (check, mins, vector), pe->mins); VectorCopy (SVvector (check, mins), pe->mins);
VectorCopy (SVFIELD (check, maxs, vector), pe->maxs); VectorCopy (SVvector (check, maxs), pe->maxs);
} }
} }
} }
@ -1384,30 +1384,30 @@ AddAllEntsToPmove (void)
check = NEXT_EDICT (&sv_pr_state, check)) { check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free) if (check->free)
continue; continue;
if (SVFIELD (check, owner, entity) == pl) if (SVentity (check, owner) == pl)
continue; continue;
if (SVFIELD (check, solid, float) == SOLID_BSP if (SVfloat (check, solid) == SOLID_BSP
|| SVFIELD (check, solid, float) == SOLID_BBOX || SVfloat (check, solid) == SOLID_BBOX
|| SVFIELD (check, solid, float) == SOLID_SLIDEBOX) { || SVfloat (check, solid) == SOLID_SLIDEBOX) {
if (check == sv_player) if (check == sv_player)
continue; continue;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (SVFIELD (check, absmin, vector)[i] > pmove_maxs[i] if (SVvector (check, absmin)[i] > pmove_maxs[i]
|| SVFIELD (check, absmax, vector)[i] < pmove_mins[i]) || SVvector (check, absmax)[i] < pmove_mins[i])
break; break;
if (i != 3) if (i != 3)
continue; continue;
pe = &pmove.physents[pmove.numphysent]; pe = &pmove.physents[pmove.numphysent];
VectorCopy (SVFIELD (check, origin, vector), pe->origin); VectorCopy (SVvector (check, origin), pe->origin);
pmove.physents[pmove.numphysent].info = e; pmove.physents[pmove.numphysent].info = e;
if (SVFIELD (check, solid, float) == SOLID_BSP) if (SVfloat (check, solid) == SOLID_BSP)
pe->model = sv.models[(int) (SVFIELD (check, modelindex, float))]; pe->model = sv.models[(int) (SVfloat (check, modelindex))];
else { else {
pe->model = NULL; pe->model = NULL;
VectorCopy (SVFIELD (check, mins, vector), pe->mins); VectorCopy (SVvector (check, mins), pe->mins);
VectorCopy (SVFIELD (check, maxs, vector), pe->maxs); VectorCopy (SVvector (check, maxs), pe->maxs);
} }
if (++pmove.numphysent == MAX_PHYSENTS) if (++pmove.numphysent == MAX_PHYSENTS)
@ -1490,29 +1490,29 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
return; return;
} }
if (!SVFIELD (sv_player, fixangle, float)) if (!SVfloat (sv_player, fixangle))
VectorCopy (ucmd->angles, SVFIELD (sv_player, v_angle, vector)); 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 // 1999-10-29 +USE fix by Maddes start
if (!nouse) { 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 // 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) if (ucmd->impulse)
SVFIELD (sv_player, impulse, float) = ucmd->impulse; SVfloat (sv_player, impulse) = ucmd->impulse;
// //
// angles // angles
// show 1/3 the pitch angle and all the roll angle // show 1/3 the pitch angle and all the roll angle
if (SVFIELD (sv_player, health, float) > 0) { if (SVfloat (sv_player, health) > 0) {
if (!SVFIELD (sv_player, fixangle, float)) { if (!SVfloat (sv_player, fixangle)) {
SVFIELD (sv_player, angles, vector)[PITCH] = -SVFIELD (sv_player, v_angle, vector)[PITCH] / 3; SVvector (sv_player, angles)[PITCH] = -SVvector (sv_player, v_angle)[PITCH] / 3;
SVFIELD (sv_player, angles, vector)[YAW] = SVFIELD (sv_player, v_angle, vector)[YAW]; SVvector (sv_player, angles)[YAW] = SVvector (sv_player, v_angle)[YAW];
} }
SVFIELD (sv_player, angles, vector)[ROLL] = SVvector (sv_player, angles)[ROLL] =
SV_CalcRoll (SVFIELD (sv_player, angles, vector), SVFIELD (sv_player, velocity, vector)) * 4; SV_CalcRoll (SVvector (sv_player, angles), SVvector (sv_player, velocity)) * 4;
} }
sv_frametime = min (0.1, ucmd->msec * 0.001); 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++) for (i = 0; i < 3; i++)
pmove.origin[i] = pmove.origin[i] =
SVFIELD (sv_player, origin, vector)[i] SVvector (sv_player, origin)[i]
+ (SVFIELD (sv_player, mins, vector)[i] - player_mins[i]); + (SVvector (sv_player, mins)[i] - player_mins[i]);
VectorCopy (SVFIELD (sv_player, velocity, vector), pmove.velocity); VectorCopy (SVvector (sv_player, velocity), pmove.velocity);
VectorCopy (SVFIELD (sv_player, v_angle, vector), pmove.angles); 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.spectator = host_client->spectator;
pmove.waterjumptime = SVFIELD (sv_player, teleport_time, float); pmove.waterjumptime = SVfloat (sv_player, teleport_time);
pmove.numphysent = 1; pmove.numphysent = 1;
pmove.physents[0].model = sv.worldmodel; pmove.physents[0].model = sv.worldmodel;
pmove.cmd = *ucmd; pmove.cmd = *ucmd;
pmove.dead = SVFIELD (sv_player, health, float) <= 0; pmove.dead = SVfloat (sv_player, health) <= 0;
pmove.oldbuttons = host_client->oldbuttons; pmove.oldbuttons = host_client->oldbuttons;
movevars.entgravity = host_client->entgravity; movevars.entgravity = host_client->entgravity;
@ -1567,7 +1567,7 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
PlayerMove (); PlayerMove ();
after = PM_TestPlayerPosition (pmove.origin); 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", SV_Printf ("player %s got stuck in playermove!!!!\n",
host_client->name); host_client->name);
} }
@ -1576,29 +1576,29 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
#endif #endif
host_client->oldbuttons = pmove.oldbuttons; host_client->oldbuttons = pmove.oldbuttons;
SVFIELD (sv_player, teleport_time, float) = pmove.waterjumptime; SVfloat (sv_player, teleport_time) = pmove.waterjumptime;
SVFIELD (sv_player, waterlevel, float) = waterlevel; SVfloat (sv_player, waterlevel) = waterlevel;
SVFIELD (sv_player, watertype, float) = watertype; SVfloat (sv_player, watertype) = watertype;
if (onground != -1) { if (onground != -1) {
SVFIELD (sv_player, flags, float) = (int) SVFIELD (sv_player, flags, float) | FL_ONGROUND; SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) | FL_ONGROUND;
SVFIELD (sv_player, groundentity, entity) = SVentity (sv_player, groundentity) =
EDICT_TO_PROG (&sv_pr_state, EDICT_NUM (&sv_pr_state, pmove.physents[onground].info)); EDICT_TO_PROG (&sv_pr_state, EDICT_NUM (&sv_pr_state, pmove.physents[onground].info));
} else { } 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++) for (i = 0; i < 3; i++)
SVFIELD (sv_player, origin, vector)[i] = SVvector (sv_player, origin)[i] =
pmove.origin[i] - (SVFIELD (sv_player, mins, vector)[i] - player_mins[i]); pmove.origin[i] - (SVvector (sv_player, mins)[i] - player_mins[i]);
#if 0 #if 0
// truncate velocity the same way the net protocol will // truncate velocity the same way the net protocol will
for (i = 0; i < 3; i++) 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 #else
VectorCopy (pmove.velocity, SVFIELD (sv_player, velocity, vector)); VectorCopy (pmove.velocity, SVvector (sv_player, velocity));
#endif #endif
VectorCopy (pmove.angles, SVFIELD (sv_player, v_angle, vector)); VectorCopy (pmove.angles, SVvector (sv_player, v_angle));
if (!host_client->spectator) { if (!host_client->spectator) {
// link into place and touch triggers // link into place and touch triggers
@ -1608,11 +1608,11 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
for (i = 0; i < pmove.numtouch; i++) { for (i = 0; i < pmove.numtouch; i++) {
n = pmove.physents[pmove.touchindex[i]].info; n = pmove.physents[pmove.touchindex[i]].info;
ent = EDICT_NUM (&sv_pr_state, n); 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; continue;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv_player); *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); playertouch[n / 8] |= 1 << (n % 8);
} }
} }
@ -1780,7 +1780,7 @@ SV_ExecuteClientMessage (client_t *cl)
o[2] = MSG_ReadCoord (net_message); o[2] = MSG_ReadCoord (net_message);
// only allowed by spectators // only allowed by spectators
if (host_client->spectator) { if (host_client->spectator) {
VectorCopy (o, SVFIELD (sv_player, origin, vector)); VectorCopy (o, SVvector (sv_player, origin));
SV_LinkEdict (sv_player, false); SV_LinkEdict (sv_player, false);
} }
break; 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; int hull_index = 0;
if ((sv_fields.rotated_bbox != -1 if ((sv_fields.rotated_bbox != -1
&& SVFIELD (ent, rotated_bbox, integer)) && SVinteger (ent, rotated_bbox))
|| SVFIELD (ent, solid, float) == SOLID_BSP) { || SVfloat (ent, solid) == SOLID_BSP) {
VectorSubtract (maxs, mins, size); VectorSubtract (maxs, mins, size);
if (size[0] < 3) if (size[0] < 3)
hull_index = 0; 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 // decide which clipping hull to use, based on the size
if (sv_fields.rotated_bbox != -1 if (sv_fields.rotated_bbox != -1
&& SVFIELD (ent, rotated_bbox, integer)) { && SVinteger (ent, rotated_bbox)) {
extern clip_hull_t *pf_hull_list[]; 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]; 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 // 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"); 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) if (!model || model->type != mod_brush)
SV_Error ("SOLID_BSP with a non bsp model"); 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) { if (hull) {
// calculate an offset value to center the origin // calculate an offset value to center the origin
VectorSubtract (hull->clip_mins, mins, offset); 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 } else { // create a temp hull from bounding box sizes
VectorSubtract (SVFIELD (ent, mins, vector), maxs, hullmins); VectorSubtract (SVvector (ent, mins), maxs, hullmins);
VectorSubtract (SVFIELD (ent, maxs, vector), mins, hullmaxs); VectorSubtract (SVvector (ent, maxs), mins, hullmaxs);
hull = SV_HullForBox (hullmins, hullmaxs); hull = SV_HullForBox (hullmins, hullmaxs);
VectorCopy (SVFIELD (ent, origin, vector), offset); VectorCopy (SVvector (ent, origin), offset);
} }
return hull; return hull;
@ -284,15 +284,15 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
touch = EDICT_FROM_AREA (l); touch = EDICT_FROM_AREA (l);
if (touch == ent) if (touch == ent)
continue; continue;
if (!SVFIELD (touch, touch, func) if (!SVfunc (touch, touch)
|| SVFIELD (touch, solid, float) != SOLID_TRIGGER) || SVfloat (touch, solid) != SOLID_TRIGGER)
continue; continue;
if (SVFIELD (ent, absmin, vector)[0] > SVFIELD (touch, absmax, vector)[0] if (SVvector (ent, absmin)[0] > SVvector (touch, absmax)[0]
|| SVFIELD (ent, absmin, vector)[1] > SVFIELD (touch, absmax, vector)[1] || SVvector (ent, absmin)[1] > SVvector (touch, absmax)[1]
|| SVFIELD (ent, absmin, vector)[2] > SVFIELD (touch, absmax, vector)[2] || SVvector (ent, absmin)[2] > SVvector (touch, absmax)[2]
|| SVFIELD (ent, absmax, vector)[0] < SVFIELD (touch, absmin, vector)[0] || SVvector (ent, absmax)[0] < SVvector (touch, absmin)[0]
|| SVFIELD (ent, absmax, vector)[1] < SVFIELD (touch, absmin, vector)[1] || SVvector (ent, absmax)[1] < SVvector (touch, absmin)[1]
|| SVFIELD (ent, absmax, vector)[2] < SVFIELD (touch, absmin, vector)[2]) || SVvector (ent, absmax)[2] < SVvector (touch, absmin)[2])
continue; continue;
old_self = *sv_globals.self; 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.self = EDICT_TO_PROG (&sv_pr_state, touch);
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.other = EDICT_TO_PROG (&sv_pr_state, ent);
*sv_globals.time = sv.time; *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.self = old_self;
*sv_globals.other = old_other; *sv_globals.other = old_other;
@ -311,9 +311,9 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
if (node->axis == -1) if (node->axis == -1)
return; return;
if (SVFIELD (ent, absmax, vector)[node->axis] > node->dist) if (SVvector (ent, absmax)[node->axis] > node->dist)
SV_TouchLinks (ent, node->children[0]); 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]); SV_TouchLinks (ent, node->children[1]);
} }
@ -344,8 +344,8 @@ SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
// NODE_MIXED // NODE_MIXED
splitplane = node->plane; splitplane = node->plane;
sides = BOX_ON_PLANE_SIDE (SVFIELD (ent, absmin, vector), sides = BOX_ON_PLANE_SIDE (SVvector (ent, absmin),
SVFIELD (ent, absmax, vector), splitplane); SVvector (ent, absmax), splitplane);
// recurse down the contacted sides // recurse down the contacted sides
if (sides & 1) if (sides & 1)
@ -371,34 +371,34 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
return; return;
// set the abs box // set the abs box
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, mins, vector), VectorAdd (SVvector (ent, origin), SVvector (ent, mins),
SVFIELD (ent, absmin, vector)); SVvector (ent, absmin));
VectorAdd (SVFIELD (ent, origin, vector), SVFIELD (ent, maxs, vector), VectorAdd (SVvector (ent, origin), SVvector (ent, maxs),
SVFIELD (ent, absmax, vector)); SVvector (ent, absmax));
// to make items easier to pick up and allow them to be grabbed off // to make items easier to pick up and allow them to be grabbed off
// of shelves, the abs sizes are expanded // of shelves, the abs sizes are expanded
if ((int) SVFIELD (ent, flags, float) & FL_ITEM) { if ((int) SVfloat (ent, flags) & FL_ITEM) {
SVFIELD (ent, absmin, vector)[0] -= 15; SVvector (ent, absmin)[0] -= 15;
SVFIELD (ent, absmin, vector)[1] -= 15; SVvector (ent, absmin)[1] -= 15;
SVFIELD (ent, absmax, vector)[0] += 15; SVvector (ent, absmax)[0] += 15;
SVFIELD (ent, absmax, vector)[1] += 15; SVvector (ent, absmax)[1] += 15;
} else { // movement is clipped an epsilon away from actual edge, so we } else { // movement is clipped an epsilon away from actual edge, so we
// must fully check even when bounding boxes don't quite touch // must fully check even when bounding boxes don't quite touch
SVFIELD (ent, absmin, vector)[0] -= 1; SVvector (ent, absmin)[0] -= 1;
SVFIELD (ent, absmin, vector)[1] -= 1; SVvector (ent, absmin)[1] -= 1;
SVFIELD (ent, absmin, vector)[2] -= 1; SVvector (ent, absmin)[2] -= 1;
SVFIELD (ent, absmax, vector)[0] += 1; SVvector (ent, absmax)[0] += 1;
SVFIELD (ent, absmax, vector)[1] += 1; SVvector (ent, absmax)[1] += 1;
SVFIELD (ent, absmax, vector)[2] += 1; SVvector (ent, absmax)[2] += 1;
} }
// link to PVS leafs // link to PVS leafs
ent->num_leafs = 0; ent->num_leafs = 0;
if (SVFIELD (ent, modelindex, float)) if (SVfloat (ent, modelindex))
SV_FindTouchedLeafs (ent, sv.worldmodel->nodes); SV_FindTouchedLeafs (ent, sv.worldmodel->nodes);
if (SVFIELD (ent, solid, float) == SOLID_NOT) if (SVfloat (ent, solid) == SOLID_NOT)
return; return;
// find the first node that the ent's box crosses // find the first node that the ent's box crosses
@ -406,16 +406,16 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
while (1) { while (1) {
if (node->axis == -1) if (node->axis == -1)
break; break;
if (SVFIELD (ent, absmin, vector)[node->axis] > node->dist) if (SVvector (ent, absmin)[node->axis] > node->dist)
node = node->children[0]; 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]; node = node->children[1];
else else
break; // crosses the node break; // crosses the node
} }
// link it in // link it in
if (SVFIELD (ent, solid, float) == SOLID_TRIGGER) if (SVfloat (ent, solid) == SOLID_TRIGGER)
InsertLinkBefore (&ent->area, &node->trigger_edicts); InsertLinkBefore (&ent->area, &node->trigger_edicts);
else else
InsertLinkBefore (&ent->area, &node->solid_edicts); InsertLinkBefore (&ent->area, &node->solid_edicts);
@ -479,10 +479,10 @@ SV_TestEntityPosition (edict_t *ent)
{ {
trace_t trace; trace_t trace;
trace = SV_Move (SVFIELD (ent, origin, vector), trace = SV_Move (SVvector (ent, origin),
SVFIELD (ent, mins, vector), SVvector (ent, mins),
SVFIELD (ent, maxs, vector), SVvector (ent, maxs),
SVFIELD (ent, origin, vector), 0, ent); SVvector (ent, origin), 0, ent);
if (trace.startsolid) if (trace.startsolid)
return sv.edicts; 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) { for (l = node->solid_edicts.next; l != &node->solid_edicts; l = next) {
next = l->next; next = l->next;
touch = EDICT_FROM_AREA (l); touch = EDICT_FROM_AREA (l);
if (SVFIELD (touch, solid, float) == SOLID_NOT) if (SVfloat (touch, solid) == SOLID_NOT)
continue; continue;
if (touch == clip->passedict) if (touch == clip->passedict)
continue; continue;
if (SVFIELD (touch, solid, float) == SOLID_TRIGGER) if (SVfloat (touch, solid) == SOLID_TRIGGER)
SV_Error ("Trigger in clipping list"); 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) != SOLID_BSP)
continue; continue;
if (clip->boxmins[0] > SVFIELD (touch, absmax, vector)[0] if (clip->boxmins[0] > SVvector (touch, absmax)[0]
|| clip->boxmins[1] > SVFIELD (touch, absmax, vector)[1] || clip->boxmins[1] > SVvector (touch, absmax)[1]
|| clip->boxmins[2] > SVFIELD (touch, absmax, vector)[2] || clip->boxmins[2] > SVvector (touch, absmax)[2]
|| clip->boxmaxs[0] < SVFIELD (touch, absmin, vector)[0] || clip->boxmaxs[0] < SVvector (touch, absmin)[0]
|| clip->boxmaxs[1] < SVFIELD (touch, absmin, vector)[1] || clip->boxmaxs[1] < SVvector (touch, absmin)[1]
|| clip->boxmaxs[2] < SVFIELD (touch, absmin, vector)[2]) || clip->boxmaxs[2] < SVvector (touch, absmin)[2])
continue; continue;
if (clip->passedict != 0 && SVFIELD (clip->passedict, size, vector)[0] if (clip->passedict != 0 && SVvector (clip->passedict, size)[0]
&& !SVFIELD (touch, size, vector)[0]) && !SVvector (touch, size)[0])
continue; // points never interact continue; // points never interact
// might intersect, so do an exact clip // might intersect, so do an exact clip
if (clip->trace.allsolid) if (clip->trace.allsolid)
return; return;
if (clip->passedict) { 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) == clip->passedict)
continue; // don't clip against own missiles continue; // don't clip against own missiles
if (PROG_TO_EDICT (&sv_pr_state, if (PROG_TO_EDICT (&sv_pr_state,
SVFIELD (clip->passedict, owner, entity)) == touch) SVentity (clip->passedict, owner)) == touch)
continue; // don't clip against owner 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, trace = SV_ClipMoveToEntity (touch, clip->passedict, clip->start,
clip->mins2, clip->maxs2, clip->end); clip->mins2, clip->maxs2, clip->end);
else else
@ -827,8 +827,8 @@ SV_TestPlayerPosition (edict_t *ent, vec3_t origin)
CONTENTS_EMPTY) return sv.edicts; CONTENTS_EMPTY) return sv.edicts;
// check all entities // check all entities
VectorAdd (origin, SVFIELD (ent, mins, vector), boxmins); VectorAdd (origin, SVvector (ent, mins), boxmins);
VectorAdd (origin, SVFIELD (ent, maxs, vector), boxmaxs); VectorAdd (origin, SVvector (ent, maxs), boxmaxs);
check = NEXT_EDICT (&sv_pr_state, sv.edicts); check = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) { 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) if (check == ent)
continue; continue;
if (SVFIELD (check, solid, float) != SOLID_BSP if (SVfloat (check, solid) != SOLID_BSP
&& SVFIELD (check, solid, float) != SOLID_BBOX && SVfloat (check, solid) != SOLID_BBOX
&& SVFIELD (check, solid, float) != SOLID_SLIDEBOX) && SVfloat (check, solid) != SOLID_SLIDEBOX)
continue; continue;
if (boxmins[0] > SVFIELD (check, absmax, vector)[0] if (boxmins[0] > SVvector (check, absmax)[0]
|| boxmins[1] > SVFIELD (check, absmax, vector)[1] || boxmins[1] > SVvector (check, absmax)[1]
|| boxmins[2] > SVFIELD (check, absmax, vector)[2] || boxmins[2] > SVvector (check, absmax)[2]
|| boxmaxs[0] < SVFIELD (check, absmin, vector)[0] || boxmaxs[0] < SVvector (check, absmin)[0]
|| boxmaxs[1] < SVFIELD (check, absmin, vector)[1] || boxmaxs[1] < SVvector (check, absmin)[1]
|| boxmaxs[2] < SVFIELD (check, absmin, vector)[2]) || boxmaxs[2] < SVvector (check, absmin)[2])
continue; continue;
// get the clipping hull // get the clipping hull
hull = SV_HullForEntity (check, SVFIELD (ent, mins, vector), hull = SV_HullForEntity (check, SVvector (ent, mins),
SVFIELD (ent, maxs, vector), offset); SVvector (ent, maxs), offset);
VectorSubtract (origin, offset, offset); VectorSubtract (origin, offset, offset);