mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-13 08:38:59 +00:00
engine: client: cl_qparse: refactor quake baseline parser, so we don't call memset for nothing
This commit is contained in:
parent
8bdb49516d
commit
08a2d431da
@ -694,17 +694,13 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg )
|
|||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
int newnum;
|
int newnum;
|
||||||
|
|
||||||
memset( &state, 0, sizeof( state ));
|
|
||||||
newnum = MSG_ReadWord( msg ); // entnum
|
newnum = MSG_ReadWord( msg ); // entnum
|
||||||
|
|
||||||
if( newnum >= clgame.maxEntities )
|
if( newnum >= clgame.maxEntities )
|
||||||
Host_Error( "CL_AllocEdict: no free edicts\n" );
|
Host_Error( "CL_AllocEdict: no free edicts\n" );
|
||||||
|
|
||||||
ent = CL_EDICT_NUM( newnum );
|
|
||||||
memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
|
|
||||||
ent->index = newnum;
|
|
||||||
|
|
||||||
// parse baseline
|
// parse baseline
|
||||||
|
memset( &state, 0, sizeof( state ));
|
||||||
state.modelindex = MSG_ReadByte( msg );
|
state.modelindex = MSG_ReadByte( msg );
|
||||||
state.frame = MSG_ReadByte( msg );
|
state.frame = MSG_ReadByte( msg );
|
||||||
state.colormap = MSG_ReadByte( msg );
|
state.colormap = MSG_ReadByte( msg );
|
||||||
@ -715,8 +711,10 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg )
|
|||||||
state.angles[1] = MSG_ReadAngle( msg );
|
state.angles[1] = MSG_ReadAngle( msg );
|
||||||
state.origin[2] = MSG_ReadCoord( msg );
|
state.origin[2] = MSG_ReadCoord( msg );
|
||||||
state.angles[2] = MSG_ReadAngle( msg );
|
state.angles[2] = MSG_ReadAngle( msg );
|
||||||
ent->player = CL_IsPlayerIndex( newnum );
|
|
||||||
|
|
||||||
|
ent = CL_EDICT_NUM( newnum );
|
||||||
|
ent->index = newnum;
|
||||||
|
ent->player = CL_IsPlayerIndex( newnum );
|
||||||
memcpy( &ent->baseline, &state, sizeof( entity_state_t ));
|
memcpy( &ent->baseline, &state, sizeof( entity_state_t ));
|
||||||
memcpy( &ent->prevstate, &state, sizeof( entity_state_t ));
|
memcpy( &ent->prevstate, &state, sizeof( entity_state_t ));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user