diff options
author | /dev/humancontroller <devhc@example.com> | 2015-02-08 13:55:15 +0100 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:18 +0100 |
commit | b392b0d97f3ea048478059873ed6dec8afd9634b (patch) | |
tree | e3fb4a9ef70d89bfb70676fe33f9b493da7051ec /src/server/sv_snapshot.c | |
parent | 65bcf419d4b612b7d626447924fa0fe2079c18c2 (diff) |
implement part 1 of the multi-protocol functionality: protocols
this contains support for connecting via, and serving simultaneously via, any of the three protocols: latest, GPP and 1.1
alternate-1 means protocol 70 (GPP), alternate-2 means protocol 69 (1.1)
relevant cvars:
- net_alternateProtocols
- net_alt{1|2}port[6]
- sv_alt{1|2}master{1|...|5}
- sv_clAltProto{0|..|63}
Diffstat (limited to 'src/server/sv_snapshot.c')
-rw-r--r-- | src/server/sv_snapshot.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/server/sv_snapshot.c b/src/server/sv_snapshot.c index e73e6138..09633eb7 100644 --- a/src/server/sv_snapshot.c +++ b/src/server/sv_snapshot.c @@ -53,7 +53,7 @@ SV_EmitPacketEntities Writes a delta update of an entityState_t list to the message. ============= */ -static void SV_EmitPacketEntities( clientSnapshot_t *from, clientSnapshot_t *to, msg_t *msg ) { +static void SV_EmitPacketEntities( int alternateProtocol, clientSnapshot_t *from, clientSnapshot_t *to, msg_t *msg ) { entityState_t *oldent, *newent; int oldindex, newindex; int oldnum, newnum; @@ -89,7 +89,7 @@ static void SV_EmitPacketEntities( clientSnapshot_t *from, clientSnapshot_t *to, // delta update from old position // because the force parm is qfalse, this will not result // in any bytes being emited if the entity has not changed at all - MSG_WriteDeltaEntity (msg, oldent, newent, qfalse ); + MSG_WriteDeltaEntity (alternateProtocol, msg, oldent, newent, qfalse ); oldindex++; newindex++; continue; @@ -97,14 +97,14 @@ static void SV_EmitPacketEntities( clientSnapshot_t *from, clientSnapshot_t *to, if ( newnum < oldnum ) { // this is a new entity, send it from the baseline - MSG_WriteDeltaEntity (msg, &sv.svEntities[newnum].baseline, newent, qtrue ); + MSG_WriteDeltaEntity (alternateProtocol, msg, &sv.svEntities[newnum].baseline, newent, qtrue ); newindex++; continue; } if ( newnum > oldnum ) { // the old entity isn't present in the new message - MSG_WriteDeltaEntity (msg, oldent, NULL, qtrue ); + MSG_WriteDeltaEntity (alternateProtocol, msg, oldent, NULL, qtrue ); oldindex++; continue; } @@ -192,13 +192,13 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) { // delta encode the playerstate if ( oldframe ) { - MSG_WriteDeltaPlayerstate( msg, &oldframe->ps, &frame->ps ); + MSG_WriteDeltaPlayerstate( client->netchan.alternateProtocol, msg, &oldframe->ps, &frame->ps ); } else { - MSG_WriteDeltaPlayerstate( msg, NULL, &frame->ps ); + MSG_WriteDeltaPlayerstate( client->netchan.alternateProtocol, msg, NULL, &frame->ps ); } // delta encode the entities - SV_EmitPacketEntities (oldframe, frame, msg); + SV_EmitPacketEntities (client->netchan.alternateProtocol, oldframe, frame, msg); // padding for rate debugging if ( sv_padPackets->integer ) { @@ -551,13 +551,19 @@ static void SV_WriteVoipToClient(client_t *cl, msg_t *msg) if (totalbytes > (msg->maxsize - msg->cursize) / 2) break; - MSG_WriteByte(msg, svc_voipOpus); + if(cl->netchan.alternateProtocol != 0) + { + MSG_WriteByte(msg, svc_EOF); + MSG_WriteByte(msg, svc_voipSpeex); + } + MSG_WriteByte(msg, svc_voipOpus); MSG_WriteShort(msg, packet->sender); MSG_WriteByte(msg, (byte) packet->generation); MSG_WriteLong(msg, packet->sequence); MSG_WriteByte(msg, packet->frames); MSG_WriteShort(msg, packet->len); - MSG_WriteBits(msg, packet->flags, VOIP_FLAGCNT); + if(cl->netchan.alternateProtocol == 0) + MSG_WriteBits(msg, packet->flags, VOIP_FLAGCNT); MSG_WriteData(msg, packet->data, packet->len); } |