mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: client: fixed players voice state changing
This commit is contained in:
parent
9bcd36cc24
commit
c5d7e3c783
@ -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;
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user