mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
VoIP: Save own voice when recording a demo.
We fake a server packet and write it directly to the demo file at the point where we'd transmit to the server. This is a little nasty, but it seems to be the most reasonable solution.
This commit is contained in:
parent
28c48a8cf9
commit
a7b854d65f
4 changed files with 34 additions and 2 deletions
|
@ -800,6 +800,31 @@ void CL_WritePacket( void ) {
|
||||||
MSG_WriteLong (&buf, clc.voipTarget3);
|
MSG_WriteLong (&buf, clc.voipTarget3);
|
||||||
MSG_WriteShort (&buf, clc.voipOutgoingDataSize);
|
MSG_WriteShort (&buf, clc.voipOutgoingDataSize);
|
||||||
MSG_WriteData (&buf, clc.voipOutgoingData, clc.voipOutgoingDataSize);
|
MSG_WriteData (&buf, clc.voipOutgoingData, clc.voipOutgoingDataSize);
|
||||||
|
|
||||||
|
// If we're recording a demo, we have to fake a server packet with
|
||||||
|
// this VoIP data so it gets to disk; the server doesn't send it
|
||||||
|
// back to us, and we might as well eliminate concerns about dropped
|
||||||
|
// and misordered packets here.
|
||||||
|
if ( clc.demorecording && !clc.demowaiting ) {
|
||||||
|
const int voipSize = clc.voipOutgoingDataSize;
|
||||||
|
msg_t fakemsg;
|
||||||
|
byte fakedata[MAX_MSGLEN];
|
||||||
|
MSG_Init (&fakemsg, fakedata, sizeof (fakedata));
|
||||||
|
MSG_Bitstream (&fakemsg);
|
||||||
|
MSG_WriteLong (&fakemsg, clc.reliableAcknowledge);
|
||||||
|
MSG_WriteByte (&fakemsg, svc_EOF);
|
||||||
|
MSG_WriteByte (&fakemsg, svc_extension);
|
||||||
|
MSG_WriteByte (&fakemsg, svc_voip);
|
||||||
|
MSG_WriteShort (&fakemsg, clc.clientNum);
|
||||||
|
MSG_WriteByte (&fakemsg, clc.voipOutgoingGeneration);
|
||||||
|
MSG_WriteLong (&fakemsg, clc.voipOutgoingSequence);
|
||||||
|
MSG_WriteByte (&fakemsg, clc.voipOutgoingDataFrames);
|
||||||
|
MSG_WriteShort (&fakemsg, clc.voipOutgoingDataSize );
|
||||||
|
MSG_WriteData (&fakemsg, clc.voipOutgoingData, voipSize);
|
||||||
|
MSG_WriteByte (&fakemsg, svc_EOF);
|
||||||
|
CL_WriteDemoMessage (&fakemsg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
clc.voipOutgoingSequence += clc.voipOutgoingDataFrames;
|
clc.voipOutgoingSequence += clc.voipOutgoingDataFrames;
|
||||||
clc.voipOutgoingDataSize = 0;
|
clc.voipOutgoingDataSize = 0;
|
||||||
clc.voipOutgoingDataFrames = 0;
|
clc.voipOutgoingDataFrames = 0;
|
||||||
|
|
|
@ -478,6 +478,7 @@ CL_WriteDemoMessage
|
||||||
Dumps the current net message, prefixed by the length
|
Dumps the current net message, prefixed by the length
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CL_WriteDemoMessage ( msg_t *msg, int headerBytes ) {
|
void CL_WriteDemoMessage ( msg_t *msg, int headerBytes ) {
|
||||||
int len, swlen;
|
int len, swlen;
|
||||||
|
|
||||||
|
|
|
@ -641,8 +641,8 @@ qboolean CL_ShouldIgnoreVoipSender(int sender)
|
||||||
{
|
{
|
||||||
if (!voip->integer)
|
if (!voip->integer)
|
||||||
return qtrue; // VoIP is disabled.
|
return qtrue; // VoIP is disabled.
|
||||||
else if (sender == clc.clientNum)
|
else if ((sender == clc.clientNum) && (!clc.demoplaying))
|
||||||
return qtrue; // this is us, don't output our own voice.
|
return qtrue; // ignore own voice (unless playing back a demo).
|
||||||
else if (clc.voipMuteAll)
|
else if (clc.voipMuteAll)
|
||||||
return qtrue; // all channels are muted with extreme prejudice.
|
return qtrue; // all channels are muted with extreme prejudice.
|
||||||
else if (clc.voipIgnore[sender])
|
else if (clc.voipIgnore[sender])
|
||||||
|
|
|
@ -615,3 +615,9 @@ void CL_WriteAVIVideoFrame( const byte *imageBuffer, int size );
|
||||||
void CL_WriteAVIAudioFrame( const byte *pcmBuffer, int size );
|
void CL_WriteAVIAudioFrame( const byte *pcmBuffer, int size );
|
||||||
qboolean CL_CloseAVI( void );
|
qboolean CL_CloseAVI( void );
|
||||||
qboolean CL_VideoRecording( void );
|
qboolean CL_VideoRecording( void );
|
||||||
|
|
||||||
|
//
|
||||||
|
// cl_main.c
|
||||||
|
//
|
||||||
|
void CL_WriteDemoMessage ( msg_t *msg, int headerBytes );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue