diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 311656d0..f2cb26cf 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1714,9 +1714,11 @@ void CL_ParseVoiceData( sizebuf_t *msg ) if ( idx <= 0 || idx > cl.maxclients ) return; - if ( idx == cl.playernum + 1 ) + if( idx == cl.playernum + 1 ) Voice_LocalPlayerTalkingAck(); - + else + Voice_PlayerTalkingAck( idx ); + if ( !size ) return; diff --git a/engine/client/voice.c b/engine/client/voice.c index 8c56b2b5..46c61a91 100644 --- a/engine/client/voice.c +++ b/engine/client/voice.c @@ -171,6 +171,8 @@ uint Voice_GetCompressedData( byte *out, uint maxsize, uint *frames ) void Voice_Idle( float frametime ) { + int i; + if ( !voice_enable.value ) { Voice_DeInit(); @@ -180,13 +182,26 @@ void Voice_Idle( float frametime ) if ( voice.talking_ack ) { voice.talking_timeout += frametime; - - if ( voice.talking_timeout > 0.2f ) + if( voice.talking_timeout > 0.2f ) { voice.talking_ack = false; Voice_Status( -2, false ); } } + + for ( i = 0; i < 32; i++ ) + { + if ( voice.players_status[i].talking_ack ) + { + voice.players_status[i].talking_timeout += frametime; + if ( voice.players_status[i].talking_timeout > 0.2f ) + { + voice.players_status[i].talking_ack = false; + if ( i < cl.maxclients ) + Voice_Status( i, false ); + } + } + } } qboolean Voice_IsRecording( void ) @@ -286,6 +301,17 @@ void Voice_LocalPlayerTalkingAck( void ) voice.talking_timeout = 0.0f; } +void Voice_PlayerTalkingAck(int playerIndex) +{ + if( !voice.players_status[playerIndex].talking_ack ) + { + Voice_Status( playerIndex, true ); + } + + voice.players_status[playerIndex].talking_ack = true; + voice.players_status[playerIndex].talking_timeout = 0.0f; +} + void Voice_StartChannel( uint samples, byte *data, int entnum ) { SND_ForceInitMouth( entnum ); diff --git a/engine/client/voice.h b/engine/client/voice.h index bcf27c7e..7ac3fe93 100644 --- a/engine/client/voice.h +++ b/engine/client/voice.h @@ -19,6 +19,11 @@ typedef struct voice_state_s qboolean talking_ack; float talking_timeout; + struct { + qboolean talking_ack; + float talking_timeout; + } players_status[32]; + // opus stuff OpusEncoder *encoder; OpusDecoder *decoder; @@ -51,6 +56,7 @@ void Voice_RecordStart( void ); void Voice_AddIncomingData( int ent, byte *data, uint size, uint frames ); qboolean Voice_GetLoopback( void ); void Voice_LocalPlayerTalkingAck( void ); +void Voice_PlayerTalkingAck( int playerIndex ); void Voice_StartChannel( uint samples, byte *data, int entnum ); #endif // VOICE_H