engine: client: fix svc_event parsing

This commit is contained in:
Alibek Omarov 2024-10-15 06:07:06 +03:00
parent 5402a9611e
commit 6b1c283082

View file

@ -422,14 +422,12 @@ void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto )
int event_index; int event_index;
int i, num_events; int i, num_events;
int packet_index; int packet_index;
event_args_t nullargs, args; const event_args_t nullargs = { 0 };
event_args_t args = { 0 };
entity_state_t *state; entity_state_t *state;
float delay; float delay;
int entity_bits; int entity_bits;
memset( &nullargs, 0, sizeof( nullargs ));
memset( &args, 0, sizeof( args ));
num_events = MSG_ReadUBitLong( msg, 5 ); num_events = MSG_ReadUBitLong( msg, 5 );
if( proto == PROTO_GOLDSRC ) if( proto == PROTO_GOLDSRC )
@ -443,16 +441,18 @@ void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto )
{ {
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS ); event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
if( MSG_ReadOneBit( msg ))
packet_index = MSG_ReadUBitLong( msg, entity_bits );
else packet_index = -1;
if( MSG_ReadOneBit( msg )) if( MSG_ReadOneBit( msg ))
{ {
if( proto == PROTO_GOLDSRC ) packet_index = MSG_ReadUBitLong( msg, entity_bits );
Delta_ReadGSFields( msg, DT_EVENT_T, &nullargs, &args, 0.0f );
else MSG_ReadDeltaEvent( msg, &nullargs, &args ); if( MSG_ReadOneBit( msg ))
{
if( proto == PROTO_GOLDSRC )
Delta_ReadGSFields( msg, DT_EVENT_T, &nullargs, &args, 0.0f );
else MSG_ReadDeltaEvent( msg, &nullargs, &args );
}
} }
else packet_index = -1;
if( MSG_ReadOneBit( msg )) if( MSG_ReadOneBit( msg ))
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f); delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);