mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-08 21:31:46 +08:00
engine: voice: fix voice loopback on GoldSrc proto
This commit is contained in:
@@ -789,6 +789,7 @@ static void CL_WritePacket( void )
|
||||
{
|
||||
int newcmds, numcmds;
|
||||
int from, i, key;
|
||||
int packet_loss = bound( 0, (int)cls.packet_loss, 100 );
|
||||
|
||||
cls.nextcmdtime = host.realtime + ( 1.0f / cl_cmdrate.value );
|
||||
|
||||
@@ -808,7 +809,10 @@ static void CL_WritePacket( void )
|
||||
key = MSG_GetRealBytesWritten( &buf );
|
||||
MSG_WriteByte( &buf, 0 );
|
||||
|
||||
MSG_WriteByte( &buf, bound( 0, (int)cls.packet_loss, 100 ));
|
||||
if( proto == PROTO_GOLDSRC && voice_loopback.value )
|
||||
SetBits( packet_loss, 7 ); // set 7-th bit to tell server that we want voice loopback
|
||||
|
||||
MSG_WriteByte( &buf, packet_loss );
|
||||
MSG_WriteByte( &buf, numbackup );
|
||||
MSG_WriteByte( &buf, newcmds );
|
||||
|
||||
|
||||
@@ -984,7 +984,7 @@ void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
||||
return;
|
||||
|
||||
// must notify through as both local player and normal client
|
||||
if( ent == ( cl.playernum + 1 ))
|
||||
if( playernum == cl.playernum )
|
||||
Voice_StatusAck( &voice.local, VOICE_LOOPBACK_INDEX );
|
||||
|
||||
status = Voice_GetPlayerStatus( ent );
|
||||
@@ -1057,11 +1057,6 @@ void CL_AddVoiceToDatagram( void )
|
||||
MSG_BeginClientCmd( &cls.datagram, clc_voicedata );
|
||||
MSG_WriteShort( &cls.datagram, packet_size );
|
||||
MSG_WriteBytes( &cls.datagram, voice.compress_buffer, packet_size );
|
||||
|
||||
if( voice_loopback.value && packet_size > 0 && frames > 0 )
|
||||
{
|
||||
Voice_AddIncomingData( cl.playernum + 1, voice.compress_buffer, packet_size, frames );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,6 +119,8 @@ typedef struct voice_state_s
|
||||
|
||||
extern voice_state_t voice;
|
||||
|
||||
extern convar_t voice_loopback;
|
||||
|
||||
void CL_AddVoiceToDatagram( void );
|
||||
void Voice_RegisterCvars( void );
|
||||
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit );
|
||||
|
||||
Reference in New Issue
Block a user