From 6b1c283082f78b37b6e62a18941ecded6fc7bfb0 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 15 Oct 2024 06:07:06 +0300 Subject: [PATCH] engine: client: fix svc_event parsing --- engine/client/cl_events.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engine/client/cl_events.c b/engine/client/cl_events.c index 15d524d9..73000e05 100644 --- a/engine/client/cl_events.c +++ b/engine/client/cl_events.c @@ -422,14 +422,12 @@ void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto ) int event_index; int i, num_events; int packet_index; - event_args_t nullargs, args; + const event_args_t nullargs = { 0 }; + event_args_t args = { 0 }; entity_state_t *state; float delay; int entity_bits; - memset( &nullargs, 0, sizeof( nullargs )); - memset( &args, 0, sizeof( args )); - num_events = MSG_ReadUBitLong( msg, 5 ); 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 ); - if( MSG_ReadOneBit( msg )) - packet_index = MSG_ReadUBitLong( msg, entity_bits ); - else packet_index = -1; - if( MSG_ReadOneBit( msg )) { - if( proto == PROTO_GOLDSRC ) - Delta_ReadGSFields( msg, DT_EVENT_T, &nullargs, &args, 0.0f ); - else MSG_ReadDeltaEvent( msg, &nullargs, &args ); + packet_index = MSG_ReadUBitLong( msg, entity_bits ); + + 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 )) delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);