diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index fff0c217fa..9d2f14f8da 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -1046,7 +1046,7 @@ void CL_InitEdicts( int maxclients ) cls.num_client_entities = CL_UPDATE_BACKUP * NUM_PACKET_ENTITIES; cls.packet_entities = Mem_Realloc( clgame.mempool, cls.packet_entities, sizeof( entity_state_t ) * cls.num_client_entities ); clgame.entities = Mem_Calloc( clgame.mempool, sizeof( cl_entity_t ) * clgame.maxEntities ); - clgame.static_entities = Mem_Calloc( clgame.mempool, sizeof( cl_entity_t ) * MAX_STATIC_ENTITIES ); + clgame.static_entities = NULL; // will be initialized later clgame.numStatics = 0; if(( clgame.maxRemapInfos - 1 ) != clgame.maxEntities ) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 715106d9ee..ad52548ed3 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -311,10 +311,13 @@ static client entity static void CL_ParseStaticEntity( sizebuf_t *msg ) { int i, newnum; - entity_state_t from, to; + const entity_state_t from = { 0 }; + entity_state_t to; cl_entity_t *ent; - memset( &from, 0, sizeof( from )); + if( !clgame.static_entities ) + clgame.static_entities = Mem_Calloc( clgame.mempool, sizeof( cl_entity_t ) * MAX_STATIC_ENTITIES ); + newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); MSG_ReadDeltaEntity( msg, &from, &to, 0, DELTA_STATIC, cl.mtime[0] ); diff --git a/engine/client/cl_parse_48.c b/engine/client/cl_parse_48.c index a1081ca70a..3703935a29 100644 --- a/engine/client/cl_parse_48.c +++ b/engine/client/cl_parse_48.c @@ -33,10 +33,12 @@ static client entity static void CL_LegacyParseStaticEntity( sizebuf_t *msg ) { int i; - entity_state_t state; + entity_state_t state = { 0 }; cl_entity_t *ent; - memset( &state, 0, sizeof( state )); + if( !clgame.static_entities ) + clgame.static_entities = Mem_Calloc( clgame.mempool, sizeof( cl_entity_t ) * MAX_STATIC_ENTITIES ); + state.modelindex = MSG_ReadShort( msg ); state.sequence = MSG_ReadByte( msg ); state.frame = MSG_ReadByte( msg ); diff --git a/engine/client/cl_qparse.c b/engine/client/cl_qparse.c index 992d8b15d7..57b6ae908f 100644 --- a/engine/client/cl_qparse.c +++ b/engine/client/cl_qparse.c @@ -628,11 +628,12 @@ CL_ParseStaticEntity */ static void CL_ParseQuakeStaticEntity( sizebuf_t *msg ) { - entity_state_t state; + entity_state_t state = { 0 }; cl_entity_t *ent; int i; - memset( &state, 0, sizeof( state )); + if( !clgame.static_entities ) + clgame.static_entities = Mem_Calloc( clgame.mempool, sizeof( cl_entity_t ) * MAX_STATIC_ENTITIES ); state.modelindex = MSG_ReadByte( msg ); state.frame = MSG_ReadByte( msg );