diff options
author | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-06-08 08:25:25 +0000 |
---|---|---|
committer | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-06-08 08:25:25 +0000 |
commit | ba53563804ad3589f5ad5618230606dd3cb4410f (patch) | |
tree | f6362763e85fa190ab609fd53d44586040d11604 /code/client/cl_input.c | |
parent | 0cfbb51836fefc35f6e1aa612d6bc77203d6b1d3 (diff) | |
download | ioquake3-aero-ba53563804ad3589f5ad5618230606dd3cb4410f.tar.gz ioquake3-aero-ba53563804ad3589f5ad5618230606dd3cb4410f.zip |
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.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1382 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client/cl_input.c')
-rw-r--r-- | code/client/cl_input.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/code/client/cl_input.c b/code/client/cl_input.c index 5eab1a2..323aba1 100644 --- a/code/client/cl_input.c +++ b/code/client/cl_input.c @@ -800,6 +800,31 @@ void CL_WritePacket( void ) { MSG_WriteLong (&buf, clc.voipTarget3); MSG_WriteShort (&buf, 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.voipOutgoingDataSize = 0; clc.voipOutgoingDataFrames = 0; |