engine: client: fix svc_particles parsing on GoldSrc protocol

This commit is contained in:
Alibek Omarov 2024-10-14 03:12:31 +03:00
parent 60fd5f7ab8
commit 87c88f7463
4 changed files with 11 additions and 7 deletions

View file

@ -264,7 +264,7 @@ CL_ParseParticles
================== ==================
*/ */
void CL_ParseParticles( sizebuf_t *msg ) void CL_ParseParticles( sizebuf_t *msg, connprotocol_t proto )
{ {
vec3_t org, dir; vec3_t org, dir;
int i, count, color; int i, count, color;
@ -277,8 +277,12 @@ void CL_ParseParticles( sizebuf_t *msg )
count = MSG_ReadByte( msg ); count = MSG_ReadByte( msg );
color = MSG_ReadByte( msg ); color = MSG_ReadByte( msg );
if( count == 255 ) count = 1024; if( count == 255 )
life = MSG_ReadByte( msg ) * 0.125f; count = 1024;
if( proto == PROTO_GOLDSRC )
life = 0.0f;
else life = MSG_ReadByte( msg ) * 0.125f;
if( life != 0.0f && count == 1 ) if( life != 0.0f && count == 1 )
{ {
@ -2585,7 +2589,7 @@ void CL_ParseServerMessage( sizebuf_t *msg )
CL_UpdateUserPings( msg ); CL_UpdateUserPings( msg );
break; break;
case svc_particle: case svc_particle:
CL_ParseParticles( msg ); CL_ParseParticles( msg, PROTO_CURRENT );
break; break;
case svc_restoresound: case svc_restoresound:
CL_ParseRestoreSoundPacket( msg ); CL_ParseRestoreSoundPacket( msg );

View file

@ -466,7 +466,7 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg )
CL_UpdateUserPings( msg ); CL_UpdateUserPings( msg );
break; break;
case svc_particle: case svc_particle:
CL_ParseParticles( msg ); CL_ParseParticles( msg, PROTO_LEGACY );
break; break;
case svc_restoresound: case svc_restoresound:
Con_Printf( S_ERROR "%s: svc_restoresound: implement me!\n", __func__ ); Con_Printf( S_ERROR "%s: svc_restoresound: implement me!\n", __func__ );

View file

@ -636,7 +636,7 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
MSG_EndBitWriting( msg ); MSG_EndBitWriting( msg );
break; break;
case svc_particle: case svc_particle:
CL_ParseParticles( msg ); CL_ParseParticles( msg, PROTO_GOLDSRC );
break; break;
case svc_spawnstatic: case svc_spawnstatic:
// no-op // no-op

View file

@ -868,7 +868,7 @@ void CL_UpdateUserinfo( sizebuf_t *msg, connprotocol_t proto );
void CL_ParseResource( sizebuf_t *msg ); void CL_ParseResource( sizebuf_t *msg );
void CL_ParseClientData( sizebuf_t *msg, connprotocol_t proto ); void CL_ParseClientData( sizebuf_t *msg, connprotocol_t proto );
void CL_UpdateUserPings( sizebuf_t *msg ); void CL_UpdateUserPings( sizebuf_t *msg );
void CL_ParseParticles( sizebuf_t *msg ); void CL_ParseParticles( sizebuf_t *msg, connprotocol_t proto );
void CL_ParseRestoreSoundPacket( sizebuf_t *msg ); void CL_ParseRestoreSoundPacket( sizebuf_t *msg );
void CL_ParseBaseline( sizebuf_t *msg, connprotocol_t proto ); void CL_ParseBaseline( sizebuf_t *msg, connprotocol_t proto );
void CL_ParseSignon( sizebuf_t *msg, connprotocol_t proto ); void CL_ParseSignon( sizebuf_t *msg, connprotocol_t proto );