better progs access error checking and cleanups resulting from it. Fixes

mega2k and nq.
This commit is contained in:
Bill Currie 2001-03-27 03:57:17 +00:00
parent 5e993575a4
commit f6073d756f
15 changed files with 181 additions and 142 deletions

View file

@ -98,10 +98,12 @@ void ED_ParseGlobals (progs_t *pr, char *data);
void ED_LoadFromFile (progs_t *pr, char *data);
ddef_t *ED_FindField (progs_t *pr, char *name);
ddef_t *ED_FindField (progs_t *pr, const char *name);
int ED_GetFieldIndex (progs_t *pr, char *name);
dfunction_t *ED_FindFunction (progs_t *pr, char *name);
dfunction_t *ED_FindFunction (progs_t *pr, const char *name);
int PR_AccessField (progs_t *pr, const char *name, etype_t type,
const char *file, int line);
//define EDICT_NUM(p,n) ((edict_t *)(*(p)->edicts+ (n)*(p)->pr_edict_size))
//define NUM_FOR_EDICT(p,e) (((byte *)(e) - *(p)->edicts)/(p)->pr_edict_size)
@ -142,7 +144,10 @@ extern builtin_t *pr_builtins;
extern int pr_numbuiltins;
ddef_t *PR_FindGlobal (progs_t *pr, const char *name);
eval_t *PR_GetGlobalPointer (progs_t *pr, const char *name);
func_t PR_GetFunctionIndex (progs_t *pr, const char *name);
int PR_GetFieldOffset (progs_t *pr, const char *name);
void PR_Error (progs_t *pr, const char *error, ...) __attribute__((format(printf,2,3)));
void PR_RunError (progs_t *pr, char *error, ...) __attribute__((format(printf,2,3)));

View file

@ -62,6 +62,17 @@ int type_size[8] = {
sizeof (void *) / 4
};
char *type_name[8] = {
"void",
"string",
"float",
"vector",
"entity",
"field",
"function",
"pointer",
};
ddef_t *ED_FieldAtOfs (progs_t * pr, int ofs);
qboolean ED_ParseEpair (progs_t * pr, pr_type_t *base, ddef_t *key, char *s);
@ -187,7 +198,7 @@ ED_FieldAtOfs (progs_t * pr, int ofs)
ED_FindField
*/
ddef_t *
ED_FindField (progs_t * pr, char *name)
ED_FindField (progs_t * pr, const char *name)
{
return Hash_Find (pr->field_hash, name);
}
@ -220,15 +231,35 @@ PR_GetGlobalPointer (progs_t *pr, const char *name)
def = PR_FindGlobal (pr, name);
if (def)
return (eval_t*)&pr->pr_globals[def->ofs];
PR_Error (pr, "undefined global %s", name);
return 0;
}
func_t
PR_GetFunctionIndex (progs_t *pr, const char *name)
{
dfunction_t *func = ED_FindFunction (pr, name);
if (func)
return func - pr->pr_functions;
PR_Error (pr, "undefined function %s", name);
return -1;
}
int
PR_GetFieldOffset (progs_t *pr, const char *name)
{
ddef_t *def = ED_FindField (pr, name);
if (def)
return def->ofs;
PR_Error (pr, "undefined field %s", name);
return -1;
}
/*
ED_FindFunction
*/
dfunction_t *
ED_FindFunction (progs_t * pr, char *name)
ED_FindFunction (progs_t * pr, const char *name)
{
return Hash_Find (pr->function_hash, name);
}
@ -1216,3 +1247,17 @@ PR_Error (progs_t *pr, const char *error, ...)
Sys_Error ("%s", string);
}
int
PR_AccessField (progs_t *pr, const char *name, etype_t type,
const char *file, int line)
{
ddef_t *def = ED_FindField (pr, name);
if (!def)
PR_Error (pr, "undefined field %s accessed at %s:%d", name, file, line);
if (def->type != type)
PR_Error (pr, "bad type access to %s as %s (should be %s) at %s:%d",
name, type_name[type], type_name[def->type], file, line);
return def->ofs;
}

View file

@ -183,13 +183,7 @@ typedef struct
extern sv_fields_t sv_fields;
#if 1
#define SVFIELD(e,f,t) \
((ED_FindField (&sv_pr_state, #f)->type == ev_##t) \
? E_var (e, sv_fields.f, t) \
: PR_Error (&sv_pr_state, \
"bad type access to %s as %s at %s:%d", \
#f, #t, __FILE__, __LINE__), \
E_var (e, sv_fields.f, t))
#define SVFIELD(e,f,t) E_var (e, PR_AccessField (&sv_pr_state, #f, ev_##t, __FILE__, __LINE__), t)
#else
#define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
#endif

View file

@ -1 +1,2 @@
set args -nosound -nodga +set _windowed_mouse 0
set height 0

View file

@ -144,7 +144,6 @@ SV_LoadProgs (void)
(void *) sv_globals.frametime = PR_GetGlobalPointer (&sv_pr_state, "frametime");
(void *) sv_globals.force_retouch = PR_GetGlobalPointer (&sv_pr_state, "force_retouch");
(void *) sv_globals.mapname = PR_GetGlobalPointer (&sv_pr_state, "mapname");
(void *) sv_globals.startspot = PR_GetGlobalPointer (&sv_pr_state, "startspot");
(void *) sv_globals.deathmatch = PR_GetGlobalPointer (&sv_pr_state, "deathmatch");
(void *) sv_globals.coop = PR_GetGlobalPointer (&sv_pr_state, "coop");
(void *) sv_globals.teamplay = PR_GetGlobalPointer (&sv_pr_state, "teamplay");
@ -167,18 +166,22 @@ SV_LoadProgs (void)
(void *) sv_globals.trace_inopen = PR_GetGlobalPointer (&sv_pr_state, "trace_inopen");
(void *) sv_globals.trace_inwater = PR_GetGlobalPointer (&sv_pr_state, "trace_inwater");
(void *) sv_globals.msg_entity = PR_GetGlobalPointer (&sv_pr_state, "msg_entity");
(void *) sv_globals.null = PR_GetGlobalPointer (&sv_pr_state, "null");
sv_funcs.main = ED_FindFunction (&sv_pr_state, "main") - sv_pr_state. pr_functions;
sv_funcs.StartFrame = ED_FindFunction (&sv_pr_state, "StartFrame") - sv_pr_state. pr_functions;
sv_funcs.PlayerPreThink = ED_FindFunction (&sv_pr_state, "PlayerPreThink") - sv_pr_state. pr_functions;
sv_funcs.PlayerPostThink = ED_FindFunction (&sv_pr_state, "PlayerPostThink") - sv_pr_state. pr_functions;
sv_funcs.ClientKill = ED_FindFunction (&sv_pr_state, "ClientKill") - sv_pr_state. pr_functions;
sv_funcs.ClientConnect = ED_FindFunction (&sv_pr_state, "ClientConnect") - sv_pr_state. pr_functions;
sv_funcs.PutClientInServer = ED_FindFunction (&sv_pr_state, "PutClientInServer") - sv_pr_state. pr_functions;
sv_funcs.ClientDisconnect = ED_FindFunction (&sv_pr_state, "ClientDisconnect") - sv_pr_state. pr_functions;
sv_funcs.SetNewParms = ED_FindFunction (&sv_pr_state, "SetNewParms") - sv_pr_state. pr_functions;
sv_funcs.SetChangeParms = ED_FindFunction (&sv_pr_state, "SetChangeParms") - sv_pr_state. pr_functions;
#ifdef QUAKE2
(void *) sv_globals.startspot = PR_GetGlobalPointer (&sv_pr_state, "startspot");
(void *) sv_globals.null = PR_GetGlobalPointer (&sv_pr_state, "null");
#endif
sv_funcs.main = PR_GetFunctionIndex (&sv_pr_state, "main");
sv_funcs.StartFrame = PR_GetFunctionIndex (&sv_pr_state, "StartFrame");
sv_funcs.PlayerPreThink = PR_GetFunctionIndex (&sv_pr_state, "PlayerPreThink");
sv_funcs.PlayerPostThink = PR_GetFunctionIndex (&sv_pr_state, "PlayerPostThink");
sv_funcs.ClientKill = PR_GetFunctionIndex (&sv_pr_state, "ClientKill");
sv_funcs.ClientConnect = PR_GetFunctionIndex (&sv_pr_state, "ClientConnect");
sv_funcs.PutClientInServer = PR_GetFunctionIndex (&sv_pr_state, "PutClientInServer");
sv_funcs.ClientDisconnect = PR_GetFunctionIndex (&sv_pr_state, "ClientDisconnect");
sv_funcs.SetNewParms = PR_GetFunctionIndex (&sv_pr_state, "SetNewParms");
sv_funcs.SetChangeParms = PR_GetFunctionIndex (&sv_pr_state, "SetChangeParms");
sv_fields.modelindex = ED_GetFieldIndex (&sv_pr_state, "modelindex");
sv_fields.absmin = ED_GetFieldIndex (&sv_pr_state, "absmin");

View file

@ -280,8 +280,8 @@ typedef struct
// LordHavoc: Endy neglected to mark this as a QSG version 2 thingy...
byte alpha;
byte scale;
byte glowsize;
byte glowcolor;
byte glow_size;
byte glow_color;
byte colormod;
} entity_state_t;

View file

@ -74,8 +74,8 @@ typedef struct entity_s
float colormod[3]; // color tint for model
float alpha; // opacity (alpha) of the model
float scale; // size scaler of the model
float glowsize; // how big the glow is (can be negative)
byte glowcolor; // color of glow (paletted)
float glow_size; // how big the glow is (can be negative)
byte glow_color; // color of glow (paletted)
// FIXME: could turn these into a union
int trivial_accept;

View file

@ -150,15 +150,15 @@ typedef struct
int alpha;
int scale;
int glowsize;
int glowcolor;
int glow_size;
int glow_color;
int colormod;
} sv_fields_t;
extern sv_fields_t sv_fields;
#if 1
#define SVFIELD(e,f,t) ((ED_FindField (&sv_pr_state, #f)->type == ev_##t) ? E_var (e, sv_fields.f, t) : PR_Error (&sv_pr_state, "bad type access %s:%d", __FILE__, __LINE__), E_var (e, sv_fields.f, t))
#define SVFIELD(e,f,t) E_var (e, PR_AccessField (&sv_pr_state, #f, ev_##t, __FILE__, __LINE__), t)
#else
#define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
#endif

View file

@ -1 +1,2 @@
set args -nosound -nocdaudio +setrom _windowed_mouse 0 +set gl_sky_clip 1 +set show_fps 1
set height 0

View file

@ -272,9 +272,9 @@ CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
if (bits & U_EFFECTS2)
to->effects = (to->effects & 0xFF) | (MSG_ReadByte (net_message) << 8);
if (bits & U_GLOWSIZE)
to->glowsize = MSG_ReadByte (net_message);
to->glow_size = MSG_ReadByte (net_message);
if (bits & U_GLOWCOLOR)
to->glowcolor = MSG_ReadByte (net_message);
to->glow_color = MSG_ReadByte (net_message);
if (bits & U_COLORMOD)
to->colormod = MSG_ReadByte (net_message);
if (bits & U_FRAME2)
@ -520,8 +520,8 @@ CL_LinkPacketEntities (void)
// Ender: Extend (Colormod) [QSG - Begin]
// N.B: All messy code below is the sole fault of LordHavoc and
// his futile attempts to save bandwidth. :)
(*ent)->glowsize = s1->glowsize < 128 ? s1->glowsize * 8.0 : (s1->glowsize - 256) * 8.0;
(*ent)->glowcolor = s1->glowcolor;
(*ent)->glow_size = s1->glow_size < 128 ? s1->glow_size * 8.0 : (s1->glow_size - 256) * 8.0;
(*ent)->glow_color = s1->glow_color;
(*ent)->alpha = s1->alpha / 255.0;
(*ent)->scale = s1->scale / 16.0;
@ -665,8 +665,8 @@ CL_LinkProjectiles (void)
(*ent)->scoreboard = NULL;
// LordHavoc: Endy had neglected to do this as part of the QSG
// VERSION 2 stuff
(*ent)->glowsize = 0;
(*ent)->glowcolor = 254;
(*ent)->glow_size = 0;
(*ent)->glow_color = 254;
(*ent)->alpha = 1;
(*ent)->scale = 1;
(*ent)->colormod[0] = (*ent)->colormod[1] = (*ent)->colormod[2] = 1;
@ -896,8 +896,8 @@ CL_LinkPlayers (void)
// LordHavoc: more QSG VERSION 2 stuff, FIXME: players don't have
// extend stuff
(*ent)->glowsize = 0;
(*ent)->glowcolor = 254;
(*ent)->glow_size = 0;
(*ent)->glow_color = 254;
(*ent)->alpha = 1;
(*ent)->scale = 1;
(*ent)->colormod[0] = (*ent)->colormod[1] = (*ent)->colormod[2] = 1;

View file

@ -699,8 +699,8 @@ CL_ClearBaselines (void)
for (i = 0; i < MAX_EDICTS; i++) {
cl_baselines[i].alpha = 255;
cl_baselines[i].scale = 16;
cl_baselines[i].glowcolor = 254;
cl_baselines[i].glowsize = 0;
cl_baselines[i].glow_color = 254;
cl_baselines[i].glow_size = 0;
cl_baselines[i].colormod = 255;
}
}
@ -817,8 +817,8 @@ CL_ParseBaseline (entity_state_t *es)
// colormod, etc)
es->alpha = 255;
es->scale = 16;
es->glowcolor = 254;
es->glowsize = 0;
es->glow_color = 254;
es->glow_size = 0;
es->colormod = 255;
}

View file

@ -107,8 +107,8 @@ CL_Init_Entity (entity_t *ent)
memset (ent, 0, sizeof (*ent));
ent->colormap = vid.colormap;
ent->glowsize = 0;
ent->glowcolor = 254;
ent->glow_size = 0;
ent->glow_color = 254;
ent->alpha = 1;
ent->scale = 1;
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;

View file

@ -214,10 +214,10 @@ SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg,
if (to->scale != from->scale)
bits |= U_SCALE;
if (to->glowsize != from->glowsize)
if (to->glow_size != from->glow_size)
bits |= U_GLOWSIZE;
if (to->glowcolor != from->glowcolor)
if (to->glow_color != from->glow_color)
bits |= U_GLOWCOLOR;
if (to->colormod != from->colormod)
@ -295,9 +295,9 @@ SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg,
if (bits & U_EFFECTS2)
MSG_WriteByte (msg, (to->effects >> 8));
if (bits & U_GLOWSIZE)
MSG_WriteByte (msg, to->glowsize);
MSG_WriteByte (msg, to->glow_size);
if (bits & U_GLOWCOLOR)
MSG_WriteByte (msg, to->glowcolor);
MSG_WriteByte (msg, to->glow_color);
if (bits & U_COLORMOD)
MSG_WriteByte (msg, to->colormod);
if (bits & U_FRAME2)
@ -567,8 +567,8 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
{
state->alpha = 255;
state->scale = 16;
state->glowsize = 0;
state->glowcolor = 254;
state->glow_size = 0;
state->glow_color = 254;
state->colormod = 255;
if (sv_fields.alpha != -1 && SVFIELD (ent, alpha, float))
@ -577,11 +577,11 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
if (sv_fields.scale != -1 && SVFIELD (ent, scale, float))
state->scale = bound (0, SVFIELD (ent, scale, float), 15.9375) * 16.0;
if (sv_fields.glowsize != -1 && SVFIELD (ent, glowsize, float))
state->glowsize = bound (-1024, (int) SVFIELD (ent, glowsize, float), 1016) >> 3;
if (sv_fields.glow_size != -1 && SVFIELD (ent, glow_size, float))
state->glow_size = bound (-1024, (int) SVFIELD (ent, glow_size, float), 1016) >> 3;
if (sv_fields.glowcolor != -1 && SVFIELD (ent, glowcolor, float))
state->glowcolor = (int) SVFIELD (ent, glowcolor, float);
if (sv_fields.glow_color != -1 && SVFIELD (ent, glow_color, vector))
state->glow_color = (int) SVFIELD (ent, glow_color, vector);
if (sv_fields.colormod != -1
&& SVFIELD (ent, colormod, vector)[0]

View file

@ -132,8 +132,8 @@ SV_CreateBaseline (void)
// LordHavoc: setup baseline to include new effects
((entity_state_t*)svent->data)->alpha = 255;
((entity_state_t*)svent->data)->scale = 16;
((entity_state_t*)svent->data)->glowsize = 0;
((entity_state_t*)svent->data)->glowcolor = 254;
((entity_state_t*)svent->data)->glow_size = 0;
((entity_state_t*)svent->data)->glow_color = 254;
((entity_state_t*)svent->data)->colormap = 255;
//

View file

@ -158,91 +158,81 @@ SV_LoadProgs (void)
(void *) sv_globals.trace_inwater = PR_GetGlobalPointer (&sv_pr_state, "trace_inwater");
(void *) sv_globals.msg_entity = PR_GetGlobalPointer (&sv_pr_state, "msg_entity");
sv_funcs.main =
ED_FindFunction (&sv_pr_state, "main") - sv_pr_state.pr_functions;
sv_funcs.StartFrame =
ED_FindFunction (&sv_pr_state, "StartFrame") - sv_pr_state.pr_functions;
sv_funcs.PlayerPreThink =
ED_FindFunction (&sv_pr_state, "PlayerPreThink") - sv_pr_state.pr_functions;
sv_funcs.PlayerPostThink =
ED_FindFunction (&sv_pr_state, "PlayerPostThink") - sv_pr_state.pr_functions;
sv_funcs.ClientKill =
ED_FindFunction (&sv_pr_state, "ClientKill") - sv_pr_state.pr_functions;
sv_funcs.ClientConnect =
ED_FindFunction (&sv_pr_state, "ClientConnect") - sv_pr_state.pr_functions;
sv_funcs.PutClientInServer =
ED_FindFunction (&sv_pr_state, "PutClientInServer") - sv_pr_state.pr_functions;
sv_funcs.ClientDisconnect =
ED_FindFunction (&sv_pr_state, "ClientDisconnect") - sv_pr_state.pr_functions;
sv_funcs.SetNewParms =
ED_FindFunction (&sv_pr_state, "SetNewParms") - sv_pr_state.pr_functions;
sv_funcs.SetChangeParms =
ED_FindFunction (&sv_pr_state, "SetChangeParms") - sv_pr_state.pr_functions;
sv_funcs.main = PR_GetFunctionIndex (&sv_pr_state, "main");
sv_funcs.StartFrame = PR_GetFunctionIndex (&sv_pr_state, "StartFrame");
sv_funcs.PlayerPreThink = PR_GetFunctionIndex (&sv_pr_state, "PlayerPreThink");
sv_funcs.PlayerPostThink = PR_GetFunctionIndex (&sv_pr_state, "PlayerPostThink");
sv_funcs.ClientKill = PR_GetFunctionIndex (&sv_pr_state, "ClientKill");
sv_funcs.ClientConnect = PR_GetFunctionIndex (&sv_pr_state, "ClientConnect");
sv_funcs.PutClientInServer = PR_GetFunctionIndex (&sv_pr_state, "PutClientInServer");
sv_funcs.ClientDisconnect = PR_GetFunctionIndex (&sv_pr_state, "ClientDisconnect");
sv_funcs.SetNewParms = PR_GetFunctionIndex (&sv_pr_state, "SetNewParms");
sv_funcs.SetChangeParms = PR_GetFunctionIndex (&sv_pr_state, "SetChangeParms");
sv_fields.modelindex = ED_FindField (&sv_pr_state, "modelindex")->ofs;
sv_fields.absmin = ED_FindField (&sv_pr_state, "absmin")->ofs;
sv_fields.absmax = ED_FindField (&sv_pr_state, "absmax")->ofs;
sv_fields.ltime = ED_FindField (&sv_pr_state, "ltime")->ofs;
sv_fields.lastruntime = ED_FindField (&sv_pr_state, "lastruntime")->ofs;
sv_fields.movetype = ED_FindField (&sv_pr_state, "movetype")->ofs;
sv_fields.solid = ED_FindField (&sv_pr_state, "solid")->ofs;
sv_fields.origin = ED_FindField (&sv_pr_state, "origin")->ofs;
sv_fields.oldorigin = ED_FindField (&sv_pr_state, "oldorigin")->ofs;
sv_fields.velocity = ED_FindField (&sv_pr_state, "velocity")->ofs;
sv_fields.angles = ED_FindField (&sv_pr_state, "angles")->ofs;
sv_fields.avelocity = ED_FindField (&sv_pr_state, "avelocity")->ofs;
sv_fields.classname = ED_FindField (&sv_pr_state, "classname")->ofs;
sv_fields.model = ED_FindField (&sv_pr_state, "model")->ofs;
sv_fields.frame = ED_FindField (&sv_pr_state, "frame")->ofs;
sv_fields.skin = ED_FindField (&sv_pr_state, "skin")->ofs;
sv_fields.effects = ED_FindField (&sv_pr_state, "effects")->ofs;
sv_fields.mins = ED_FindField (&sv_pr_state, "mins")->ofs;
sv_fields.maxs = ED_FindField (&sv_pr_state, "maxs")->ofs;
sv_fields.size = ED_FindField (&sv_pr_state, "size")->ofs;
sv_fields.touch = ED_FindField (&sv_pr_state, "touch")->ofs;
sv_fields.think = ED_FindField (&sv_pr_state, "think")->ofs;
sv_fields.blocked = ED_FindField (&sv_pr_state, "blocked")->ofs;
sv_fields.nextthink = ED_FindField (&sv_pr_state, "nextthink")->ofs;
sv_fields.groundentity = ED_FindField (&sv_pr_state, "groundentity")->ofs;
sv_fields.health = ED_FindField (&sv_pr_state, "health")->ofs;
sv_fields.frags = ED_FindField (&sv_pr_state, "frags")->ofs;
sv_fields.weapon = ED_FindField (&sv_pr_state, "weapon")->ofs;
sv_fields.weaponmodel = ED_FindField (&sv_pr_state, "weaponmodel")->ofs;
sv_fields.weaponframe = ED_FindField (&sv_pr_state, "weaponframe")->ofs;
sv_fields.currentammo = ED_FindField (&sv_pr_state, "currentammo")->ofs;
sv_fields.ammo_shells = ED_FindField (&sv_pr_state, "ammo_shells")->ofs;
sv_fields.ammo_nails = ED_FindField (&sv_pr_state, "ammo_nails")->ofs;
sv_fields.ammo_rockets = ED_FindField (&sv_pr_state, "ammo_rockets")->ofs;
sv_fields.ammo_cells = ED_FindField (&sv_pr_state, "ammo_cells")->ofs;
sv_fields.items = ED_FindField (&sv_pr_state, "items")->ofs;
sv_fields.takedamage = ED_FindField (&sv_pr_state, "takedamage")->ofs;
sv_fields.chain = ED_FindField (&sv_pr_state, "chain")->ofs;
sv_fields.view_ofs = ED_FindField (&sv_pr_state, "view_ofs")->ofs;
sv_fields.button0 = ED_FindField (&sv_pr_state, "button0")->ofs;
sv_fields.button1 = ED_FindField (&sv_pr_state, "button1")->ofs;
sv_fields.button2 = ED_FindField (&sv_pr_state, "button2")->ofs;
sv_fields.impulse = ED_FindField (&sv_pr_state, "impulse")->ofs;
sv_fields.fixangle = ED_FindField (&sv_pr_state, "fixangle")->ofs;
sv_fields.v_angle = ED_FindField (&sv_pr_state, "v_angle")->ofs;
sv_fields.netname = ED_FindField (&sv_pr_state, "netname")->ofs;
sv_fields.enemy = ED_FindField (&sv_pr_state, "enemy")->ofs;
sv_fields.flags = ED_FindField (&sv_pr_state, "flags")->ofs;
sv_fields.colormap = ED_FindField (&sv_pr_state, "colormap")->ofs;
sv_fields.team = ED_FindField (&sv_pr_state, "team")->ofs;
sv_fields.teleport_time = ED_FindField (&sv_pr_state, "teleport_time")->ofs;
sv_fields.armorvalue = ED_FindField (&sv_pr_state, "armorvalue")->ofs;
sv_fields.waterlevel = ED_FindField (&sv_pr_state, "waterlevel")->ofs;
sv_fields.watertype = ED_FindField (&sv_pr_state, "watertype")->ofs;
sv_fields.ideal_yaw = ED_FindField (&sv_pr_state, "ideal_yaw")->ofs;
sv_fields.yaw_speed = ED_FindField (&sv_pr_state, "yaw_speed")->ofs;
sv_fields.goalentity = ED_FindField (&sv_pr_state, "goalentity")->ofs;
sv_fields.spawnflags = ED_FindField (&sv_pr_state, "spawnflags")->ofs;
sv_fields.dmg_take = ED_FindField (&sv_pr_state, "dmg_take")->ofs;
sv_fields.dmg_save = ED_FindField (&sv_pr_state, "dmg_save")->ofs;
sv_fields.dmg_inflictor = ED_FindField (&sv_pr_state, "dmg_inflictor")->ofs;
sv_fields.owner = ED_FindField (&sv_pr_state, "owner")->ofs;
sv_fields.message = ED_FindField (&sv_pr_state, "message")->ofs;
sv_fields.sounds = ED_FindField (&sv_pr_state, "sounds")->ofs;
sv_fields.modelindex = PR_GetFieldOffset (&sv_pr_state, "modelindex");
sv_fields.absmin = PR_GetFieldOffset (&sv_pr_state, "absmin");
sv_fields.absmax = PR_GetFieldOffset (&sv_pr_state, "absmax");
sv_fields.ltime = PR_GetFieldOffset (&sv_pr_state, "ltime");
sv_fields.lastruntime = PR_GetFieldOffset (&sv_pr_state, "lastruntime");
sv_fields.movetype = PR_GetFieldOffset (&sv_pr_state, "movetype");
sv_fields.solid = PR_GetFieldOffset (&sv_pr_state, "solid");
sv_fields.origin = PR_GetFieldOffset (&sv_pr_state, "origin");
sv_fields.oldorigin = PR_GetFieldOffset (&sv_pr_state, "oldorigin");
sv_fields.velocity = PR_GetFieldOffset (&sv_pr_state, "velocity");
sv_fields.angles = PR_GetFieldOffset (&sv_pr_state, "angles");
sv_fields.avelocity = PR_GetFieldOffset (&sv_pr_state, "avelocity");
sv_fields.classname = PR_GetFieldOffset (&sv_pr_state, "classname");
sv_fields.model = PR_GetFieldOffset (&sv_pr_state, "model");
sv_fields.frame = PR_GetFieldOffset (&sv_pr_state, "frame");
sv_fields.skin = PR_GetFieldOffset (&sv_pr_state, "skin");
sv_fields.effects = PR_GetFieldOffset (&sv_pr_state, "effects");
sv_fields.mins = PR_GetFieldOffset (&sv_pr_state, "mins");
sv_fields.maxs = PR_GetFieldOffset (&sv_pr_state, "maxs");
sv_fields.size = PR_GetFieldOffset (&sv_pr_state, "size");
sv_fields.touch = PR_GetFieldOffset (&sv_pr_state, "touch");
sv_fields.think = PR_GetFieldOffset (&sv_pr_state, "think");
sv_fields.blocked = PR_GetFieldOffset (&sv_pr_state, "blocked");
sv_fields.nextthink = PR_GetFieldOffset (&sv_pr_state, "nextthink");
sv_fields.groundentity = PR_GetFieldOffset (&sv_pr_state, "groundentity");
sv_fields.health = PR_GetFieldOffset (&sv_pr_state, "health");
sv_fields.frags = PR_GetFieldOffset (&sv_pr_state, "frags");
sv_fields.weapon = PR_GetFieldOffset (&sv_pr_state, "weapon");
sv_fields.weaponmodel = PR_GetFieldOffset (&sv_pr_state, "weaponmodel");
sv_fields.weaponframe = PR_GetFieldOffset (&sv_pr_state, "weaponframe");
sv_fields.currentammo = PR_GetFieldOffset (&sv_pr_state, "currentammo");
sv_fields.ammo_shells = PR_GetFieldOffset (&sv_pr_state, "ammo_shells");
sv_fields.ammo_nails = PR_GetFieldOffset (&sv_pr_state, "ammo_nails");
sv_fields.ammo_rockets = PR_GetFieldOffset (&sv_pr_state, "ammo_rockets");
sv_fields.ammo_cells = PR_GetFieldOffset (&sv_pr_state, "ammo_cells");
sv_fields.items = PR_GetFieldOffset (&sv_pr_state, "items");
sv_fields.takedamage = PR_GetFieldOffset (&sv_pr_state, "takedamage");
sv_fields.chain = PR_GetFieldOffset (&sv_pr_state, "chain");
sv_fields.view_ofs = PR_GetFieldOffset (&sv_pr_state, "view_ofs");
sv_fields.button0 = PR_GetFieldOffset (&sv_pr_state, "button0");
sv_fields.button1 = PR_GetFieldOffset (&sv_pr_state, "button1");
sv_fields.button2 = PR_GetFieldOffset (&sv_pr_state, "button2");
sv_fields.impulse = PR_GetFieldOffset (&sv_pr_state, "impulse");
sv_fields.fixangle = PR_GetFieldOffset (&sv_pr_state, "fixangle");
sv_fields.v_angle = PR_GetFieldOffset (&sv_pr_state, "v_angle");
sv_fields.netname = PR_GetFieldOffset (&sv_pr_state, "netname");
sv_fields.enemy = PR_GetFieldOffset (&sv_pr_state, "enemy");
sv_fields.flags = PR_GetFieldOffset (&sv_pr_state, "flags");
sv_fields.colormap = PR_GetFieldOffset (&sv_pr_state, "colormap");
sv_fields.team = PR_GetFieldOffset (&sv_pr_state, "team");
sv_fields.teleport_time = PR_GetFieldOffset (&sv_pr_state, "teleport_time");
sv_fields.armorvalue = PR_GetFieldOffset (&sv_pr_state, "armorvalue");
sv_fields.waterlevel = PR_GetFieldOffset (&sv_pr_state, "waterlevel");
sv_fields.watertype = PR_GetFieldOffset (&sv_pr_state, "watertype");
sv_fields.ideal_yaw = PR_GetFieldOffset (&sv_pr_state, "ideal_yaw");
sv_fields.yaw_speed = PR_GetFieldOffset (&sv_pr_state, "yaw_speed");
sv_fields.goalentity = PR_GetFieldOffset (&sv_pr_state, "goalentity");
sv_fields.spawnflags = PR_GetFieldOffset (&sv_pr_state, "spawnflags");
sv_fields.dmg_take = PR_GetFieldOffset (&sv_pr_state, "dmg_take");
sv_fields.dmg_save = PR_GetFieldOffset (&sv_pr_state, "dmg_save");
sv_fields.dmg_inflictor = PR_GetFieldOffset (&sv_pr_state, "dmg_inflictor");
sv_fields.owner = PR_GetFieldOffset (&sv_pr_state, "owner");
sv_fields.message = PR_GetFieldOffset (&sv_pr_state, "message");
sv_fields.sounds = PR_GetFieldOffset (&sv_pr_state, "sounds");
// Zoid, find the spectator functions
SpectatorConnect = SpectatorThink = SpectatorDisconnect = 0;
@ -261,8 +251,8 @@ SV_LoadProgs (void)
sv_fields.alpha = ED_GetFieldIndex (&sv_pr_state, "alpha");
sv_fields.scale = ED_GetFieldIndex (&sv_pr_state, "scale");
sv_fields.glowsize = ED_GetFieldIndex (&sv_pr_state, "glow_size");
sv_fields.glowcolor = ED_GetFieldIndex (&sv_pr_state, "glow_color");
sv_fields.glow_size = ED_GetFieldIndex (&sv_pr_state, "glow_size");
sv_fields.glow_color = ED_GetFieldIndex (&sv_pr_state, "glow_color");
sv_fields.colormod = ED_GetFieldIndex (&sv_pr_state, "colormod");
}