int eval_pmodel;
int eval_punchvector;
int eval_viewzoom;
+int eval_clientcolors;
+int eval_tag_entity;
+int eval_tag_index;
mfunction_t *SV_PlayerPhysicsQC;
mfunction_t *EndFrameQC;
eval_pmodel = FindFieldOffset("pmodel");
eval_punchvector = FindFieldOffset("punchvector");
eval_viewzoom = FindFieldOffset("viewzoom");
+ eval_clientcolors = FindFieldOffset("clientcolors");
+ eval_tag_entity = FindFieldOffset("tag_entity");
+ eval_tag_index = FindFieldOffset("tag_index");
// LordHavoc: allowing QuakeC to override the player movement code
SV_PlayerPhysicsQC = ED_FindFunction ("SV_PlayerPhysics");
*/
void ED_ClearEdict (edict_t *e)
{
+ int num;
memset (e->v, 0, progs->entityfields * 4);
e->e->free = false;
+ // LordHavoc: for consistency set these here
+ num = NUM_FOR_EDICT(e) - 1;
+ if (num >= 0 && num < svs.maxclients)
+ {
+ e->v->colormap = num + 1;
+ e->v->team = (svs.clients[num].colors & 15) + 1;
+ e->v->netname = PR_SetString(svs.clients[num].name);
+ }
}
/*
angles and bad trails.
=================
*/
-extern void SV_IncreaseEdicts(void);
edict_t *ED_Alloc (void)
{
int i;
while (1)
{
// parse key
- if (!COM_ParseToken (&data))
+ if (!COM_ParseToken(&data, false))
Host_Error ("ED_ParseEntity: EOF without closing brace");
if (com_token[0] == '}')
break;
strcpy (keyname, com_token);
// parse value
- if (!COM_ParseToken (&data))
+ if (!COM_ParseToken(&data, false))
Host_Error ("ED_ParseEntity: EOF without closing brace");
if (com_token[0] == '}')
break;
case ev_entity:
- *(int *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s)));
+ i = atoi (s);
+ if (i < 0 || i >= MAX_EDICTS)
+ Con_DPrintf("ED_ParseEpair: ev_entity reference too large (edict %i >= MAX_EDICTS %i)\n", i, MAX_EDICTS);
+ while (i >= sv.max_edicts)
+ SV_IncreaseEdicts();
+ *(int *)d = EDICT_TO_PROG(EDICT_NUM(i));
break;
case ev_field:
while (1)
{
// parse key
- if (!COM_ParseToken (&data))
+ if (!COM_ParseToken(&data, false))
Host_Error ("ED_ParseEntity: EOF without closing brace");
if (com_token[0] == '}')
break;
}
// parse value
- if (!COM_ParseToken (&data))
+ if (!COM_ParseToken(&data, false))
Host_Error ("ED_ParseEntity: EOF without closing brace");
if (com_token[0] == '}')
while (1)
{
// parse the opening brace
- if (!COM_ParseToken (&data))
+ if (!COM_ParseToken(&data, false))
break;
if (com_token[0] != '{')
Host_Error ("ED_LoadFromFile: found %s when expecting {",com_token);
{ev_float, "ping"},
{ev_vector, "movement"},
{ev_float, "pmodel"},
- {ev_vector, "punchvector"}
+ {ev_vector, "punchvector"},
+ {ev_float, "clientcolors"},
+ {ev_entity, "tag_entity"},
+ {ev_float, "tag_index"}
};
/*
// LordHavoc: turned EDICT_NUM into a #define for speed reasons
edict_t *EDICT_NUM_ERROR(int n, char *filename, int fileline)
{
- Host_Error ("EDICT_NUM: bad number %i (called at %f:%i)", n, filename, fileline);
+ Host_Error ("EDICT_NUM: bad number %i (called at %s:%i)", n, filename, fileline);
return NULL;
}