Clear packet entities when they are removed. This fixes a bug in particle

trails, and possibly others as well.

Eliminate cl_oldvisedicts and cl_visedicts_list, change cl_visedicts's
definition to compensate. It isn't used any more, so they just waste
memory.
This commit is contained in:
Jeff Teunissen 2001-02-08 17:43:14 +00:00
parent 4cde7461b1
commit 6da731fec1
3 changed files with 10 additions and 12 deletions

View file

@ -49,9 +49,8 @@ qboolean CL_DemoBehind(void);
void CL_BeginServerConnect(void);
#define MAX_VISEDICTS 256
extern int cl_numvisedicts, cl_oldnumvisedicts;
extern entity_t **cl_visedicts, **cl_oldvisedicts;
extern entity_t *cl_visedicts_list[2][MAX_VISEDICTS];
extern int cl_numvisedicts;
extern entity_t *cl_visedicts[MAX_VISEDICTS];
extern char emodel_name[], pmodel_name[], prespawn_name[], modellist_name[], soundlist_name[];

View file

@ -440,6 +440,7 @@ CL_ParsePacketEntities (qboolean delta)
if (newindex >= MAX_PACKET_ENTITIES)
Host_EndGame ("CL_ParsePacketEntities: newindex == MAX_PACKET_ENTITIES");
CL_ParseDelta (&cl_baselines[newnum], &newp->entities[newindex], word);
newindex++;
continue;
}
@ -449,11 +450,13 @@ CL_ParsePacketEntities (qboolean delta)
cl.validsequence = 0;
Con_Printf ("WARNING: delta on full update");
}
if (word & U_REMOVE) {
if (word & U_REMOVE) { // Clear the entity
entity_t *ent = &cl_packet_ents[newnum];
memset (ent, 0, sizeof (entity_t));
oldindex++;
continue;
}
// Con_Printf ("delta %i\n",newnum);
// Con_Printf ("delta %i\n", newnum);
CL_ParseDelta (&oldp->entities[oldindex], &newp->entities[newindex], word);
newindex++;
oldindex++;
@ -512,6 +515,7 @@ CL_LinkPacketEntities (void)
ent = CL_NewTempEntity ();
if (!ent)
break; // object list is full
*ent = &cl_packet_ents[s1->number];
(*ent)->keynum = s1->number;
@ -1131,10 +1135,6 @@ CL_EmitEntities (void)
if (!cl.validsequence)
return;
cl_oldnumvisedicts = cl_numvisedicts;
cl_oldvisedicts = cl_visedicts_list[!(cls.netchan.incoming_sequence & 1)];
cl_visedicts = cl_visedicts_list[cls.netchan.incoming_sequence & 1];
cl_numvisedicts = 0;
CL_LinkPlayers ();

View file

@ -166,9 +166,8 @@ dlight_t cl_dlights[MAX_DLIGHTS];
// refresh list
// this is double buffered so the last frame
// can be scanned for oldorigins of trailing objects
int cl_numvisedicts, cl_oldnumvisedicts;
entity_t **cl_visedicts, **cl_oldvisedicts;
entity_t *cl_visedicts_list[2][MAX_VISEDICTS];
int cl_numvisedicts;
entity_t *cl_visedicts[MAX_VISEDICTS];
double connect_time = -1; // for connection retransmits