aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon
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/qcommon
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/qcommon')
-rw-r--r--code/qcommon/huffman.c10
-rw-r--r--code/qcommon/msg.c11
-rw-r--r--code/qcommon/qcommon.h21
3 files changed, 35 insertions, 7 deletions
diff --git a/code/qcommon/huffman.c b/code/qcommon/huffman.c
index b230b5b..2ff4ae5 100644
--- a/code/qcommon/huffman.c
+++ b/code/qcommon/huffman.c
@@ -39,6 +39,16 @@ void Huff_putBit( int bit, byte *fout, int *offset) {
*offset = bloc;
}
+int Huff_getBloc(void)
+{
+ return bloc;
+}
+
+void Huff_setBloc(int _bloc)
+{
+ bloc = _bloc;
+}
+
int Huff_getBit( byte *fin, int *offset) {
int t;
bloc = *offset;
diff --git a/code/qcommon/msg.c b/code/qcommon/msg.c
index b26cf8f..3840a8c 100644
--- a/code/qcommon/msg.c
+++ b/code/qcommon/msg.c
@@ -389,6 +389,17 @@ int MSG_ReadByte( msg_t *msg ) {
return c;
}
+int MSG_LookaheadByte( msg_t *msg ) {
+ const int bloc = Huff_getBloc();
+ const int readcount = msg->readcount;
+ const int bit = msg->bit;
+ int c = MSG_ReadByte(msg);
+ Huff_setBloc(bloc);
+ msg->readcount = readcount;
+ msg->bit = bit;
+ return c;
+}
+
int MSG_ReadShort( msg_t *msg ) {
int c;
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index f535d68..58b0a29 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -92,7 +92,7 @@ char *MSG_ReadBigString (msg_t *sb);
char *MSG_ReadStringLine (msg_t *sb);
float MSG_ReadAngle16 (msg_t *sb);
void MSG_ReadData (msg_t *sb, void *buffer, int size);
-
+int MSG_LookaheadByte (msg_t *msg);
void MSG_WriteDeltaUsercmd( msg_t *msg, struct usercmd_s *from, struct usercmd_s *to );
void MSG_ReadDeltaUsercmd( msg_t *msg, struct usercmd_s *from, struct usercmd_s *to );
@@ -276,9 +276,10 @@ enum svc_ops_e {
svc_snapshot,
svc_EOF,
-#if USE_VOIP
- svc_voip
-#endif
+ // svc_extension follows a svc_EOF, followed by another svc_* ...
+ // this keeps legacy clients compatible.
+ svc_extension,
+ svc_voip, // not wrapped in USE_VOIP, so this value is reserved.
};
@@ -293,9 +294,10 @@ enum clc_ops_e {
clc_clientCommand, // [string] message
clc_EOF,
-#if USE_VOIP
- clc_voip, // packet of voice data.
-#endif
+ // clc_extension follows a clc_EOF, followed by another clc_* ...
+ // this keeps legacy servers compatible.
+ clc_extension,
+ clc_voip, // not wrapped in USE_VOIP, so this value is reserved.
};
/*
@@ -1112,6 +1114,11 @@ void Huff_offsetTransmit (huff_t *huff, int ch, byte *fout, int *offset);
void Huff_putBit( int bit, byte *fout, int *offset);
int Huff_getBit( byte *fout, int *offset);
+// don't use if you don't know what you're doing.
+int Huff_getBloc(void);
+void Huff_setBloc(int _bloc);
+
+
extern huffman_t clientHuffTables;
#define SV_ENCODE_START 4