engine: client: implement miscellaneous, often unused, GoldSrc protocol messages

This commit is contained in:
Alibek Omarov 2024-10-15 06:10:25 +03:00
parent 0b02c2c6a7
commit 1bd59096fd

View file

@ -452,7 +452,9 @@ static void CL_ParseSoundPacketGS( sizebuf_t *msg )
chan = MSG_ReadUBitLong( msg, 3 ); chan = MSG_ReadUBitLong( msg, 3 );
entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS ); entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS );
sound = MSG_ReadUBitLong( msg, FBitSet( flags, SND_LEGACY_LARGE_INDEX ) ? 16 : 8 ); if( FBitSet( flags, SND_LEGACY_LARGE_INDEX ))
sound = MSG_ReadWord( msg );
else sound = MSG_ReadByte( msg );
MSG_ReadGSBitVec3Coord( msg, pos ); MSG_ReadGSBitVec3Coord( msg, pos );
if( FBitSet( flags, SND_PITCH )) if( FBitSet( flags, SND_PITCH ))
@ -519,7 +521,7 @@ dispatch messages
void CL_ParseGoldSrcServerMessage( sizebuf_t *msg ) void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
{ {
size_t bufStart, playerbytes; size_t bufStart, playerbytes;
int cmd; int cmd, param1;
const char *s; const char *s;
// parse the message // parse the message
@ -553,6 +555,10 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
Host_Error( "svc_bad\n" ); Host_Error( "svc_bad\n" );
break; break;
case svc_nop: case svc_nop:
case svc_spawnstatic:
case svc_goldsrc_damage:
case svc_goldsrc_killedmonster:
case svc_goldsrc_foundsecret:
// this does nothing // this does nothing
break; break;
case svc_disconnect: case svc_disconnect:
@ -568,6 +574,11 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
MSG_EndBitWriting( msg ); MSG_EndBitWriting( msg );
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart; cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
break; break;
case svc_goldsrc_version:
param1 = MSG_ReadLong( msg );
if( param1 != PROTOCOL_GOLDSRC_VERSION )
Host_Error( "Server use invalid protocol (%i should be %i)\n", param1, PROTOCOL_GOLDSRC_VERSION );
break;
case svc_setview: case svc_setview:
CL_ParseViewEntity( msg ); CL_ParseViewEntity( msg );
break; break;
@ -618,6 +629,11 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
MSG_EndBitWriting( msg ); MSG_EndBitWriting( msg );
cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart; cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart;
break; break;
case svc_goldsrc_stopsound:
param1 = MSG_ReadWord( msg );
S_StopSound( param1 >> 3, param1 & 7, NULL );
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
break;
case svc_pings: case svc_pings:
MSG_StartBitWriting( msg ); MSG_StartBitWriting( msg );
CL_UpdateUserPings( msg ); CL_UpdateUserPings( msg );
@ -626,9 +642,6 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
case svc_particle: case svc_particle:
CL_ParseParticles( msg, PROTO_GOLDSRC ); CL_ParseParticles( msg, PROTO_GOLDSRC );
break; break;
case svc_spawnstatic:
// no-op
break;
case svc_event_reliable: case svc_event_reliable:
MSG_StartBitWriting( msg ); MSG_StartBitWriting( msg );
CL_ParseReliableEvent( msg, PROTO_GOLDSRC ); CL_ParseReliableEvent( msg, PROTO_GOLDSRC );
@ -661,6 +674,11 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
case svc_cutscene: case svc_cutscene:
CL_ParseFinaleCutscene( msg, 3 ); CL_ParseFinaleCutscene( msg, 3 );
break; break;
case svc_goldsrc_decalname:
param1 = MSG_ReadByte( msg );
s = MSG_ReadString( msg );
Q_strncpy( host.draw_decals[param1], s, sizeof( host.draw_decals[param1] ));
break;
case svc_addangle: case svc_addangle:
CL_ParseAddAngle( msg ); CL_ParseAddAngle( msg );
break; break;
@ -717,15 +735,15 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
case svc_resourcelocation: case svc_resourcelocation:
CL_ParseResLocation( msg ); CL_ParseResLocation( msg );
break; break;
case svc_goldsrc_sendextrainfo:
CL_ParseExtraInfo( msg );
break;
case svc_goldsrc_timescale: case svc_goldsrc_timescale:
// we can set sys_timescale to anything we want but in GoldSrc it's locked for // we can set sys_timescale to anything we want but in GoldSrc it's locked for
// HLTV and demoplayback. Do we really want to have it then if both are out of scope? // HLTV and demoplayback. Do we really want to have it then if both are out of scope?
Con_Reportf( S_ERROR "%s: svc_goldsrc_timescale: implement me!\n", __func__ ); Con_Reportf( S_ERROR "%s: svc_goldsrc_timescale: implement me!\n", __func__ );
MSG_ReadFloat( msg ); MSG_ReadFloat( msg );
break; break;
case svc_goldsrc_sendextrainfo:
CL_ParseExtraInfo( msg );
break;
case svc_goldsrc_sendcvarvalue: case svc_goldsrc_sendcvarvalue:
CL_ParseCvarValue( msg, false, PROTO_GOLDSRC ); CL_ParseCvarValue( msg, false, PROTO_GOLDSRC );
break; break;