aboutsummaryrefslogtreecommitdiffstats
path: root/code/client
diff options
context:
space:
mode:
authoricculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-06-03 02:32:52 +0000
committericculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-06-03 02:32:52 +0000
commita4f6e2f577d878e4d7b6e27f9e86af3d462f8f77 (patch)
treea260f5d2e0191570b2e5bad3b2a353fc19c2c158 /code/client
parent74ccff8bf571b8bfeeea42a4c62ea0528393fa37 (diff)
downloadioquake3-aero-a4f6e2f577d878e4d7b6e27f9e86af3d462f8f77.tar.gz
ioquake3-aero-a4f6e2f577d878e4d7b6e27f9e86af3d462f8f77.zip
Changed the protocol for VoIP packets to support legacy clients.
Previously, a legacy client wouldn't get a VoIP packet, but if they did, they'd panic and disconnect. Now they ignore them and continue on. This also gives us the framework to add other features legacy clients can ignore. Oh, this also has the benefit of allowing us to store incoming VoIP for playback in recorded demos. They'll play the chatter on VoIP clients, and be ignored on legacy ones. Huge win. git-svn-id: svn://svn.icculus.org/quake3/trunk@1361 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client')
-rw-r--r--code/client/cl_input.c2
-rw-r--r--code/client/cl_parse.c27
2 files changed, 21 insertions, 8 deletions
diff --git a/code/client/cl_input.c b/code/client/cl_input.c
index a972536..ff0e5b1 100644
--- a/code/client/cl_input.c
+++ b/code/client/cl_input.c
@@ -760,6 +760,8 @@ void CL_WritePacket( void ) {
#if USE_VOIP
if (clc.voipOutgoingDataSize > 0) { // only send if data.
+ MSG_WriteByte (&buf, clc_EOF); // placate legacy servers.
+ MSG_WriteByte (&buf, clc_extension);
MSG_WriteByte (&buf, clc_voip);
MSG_WriteByte (&buf, clc.voipOutgoingGeneration);
MSG_WriteLong (&buf, clc.voipOutgoingSequence);
diff --git a/code/client/cl_parse.c b/code/client/cl_parse.c
index d80d7d2..294e46e 100644
--- a/code/client/cl_parse.c
+++ b/code/client/cl_parse.c
@@ -34,10 +34,8 @@ char *svc_strings[256] = {
"svc_download",
"svc_snapshot",
"svc_EOF",
-
-#if USE_VOIP
- "svc_voip"
-#endif
+ "svc_extension",
+ "svc_voip",
};
void SHOWNET( msg_t *msg, char *s) {
@@ -854,13 +852,26 @@ void CL_ParseServerMessage( msg_t *msg ) {
cmd = MSG_ReadByte( msg );
- if ( cmd == svc_EOF) {
+ // See if this is an extension command after the EOF, which means we
+ // got data that a legacy client should ignore.
+ if ((cmd == svc_EOF) && (MSG_LookaheadByte( msg ) == svc_extension)) {
+ SHOWNET( msg, "EXTENSION" );
+ MSG_ReadByte( msg ); // throw the svc_extension byte away.
+ cmd = MSG_ReadByte( msg ); // something legacy clients can't do!
+ // sometimes you get a svc_extension at end of stream...dangling
+ // bits in the huffman decoder giving a bogus value?
+ if (cmd == -1) {
+ cmd = svc_EOF;
+ }
+ }
+
+ if (cmd == svc_EOF) {
SHOWNET( msg, "END OF MESSAGE" );
break;
}
if ( cl_shownet->integer >= 2 ) {
- if ( !svc_strings[cmd] ) {
+ if ( (cmd < 0) || (!svc_strings[cmd]) ) {
Com_Printf( "%3i:BAD CMD %i\n", msg->readcount-1, cmd );
} else {
SHOWNET( msg, svc_strings[cmd] );
@@ -886,11 +897,11 @@ void CL_ParseServerMessage( msg_t *msg ) {
case svc_download:
CL_ParseDownload( msg );
break;
-#if USE_VOIP
case svc_voip:
+#if USE_VOIP
CL_ParseVoip( msg );
- break;
#endif
+ break;
}
}
}