@@ -68,7 +68,8 @@ SV_EmitPacketEntities
6868Writes a delta update of an entityState_t list to the message.
6969=============
7070*/
71- static void SV_EmitPacketEntities ( const clientSnapshot_t *from, clientSnapshot_t *to, msg_t *msg )
71+ static void SV_EmitPacketEntities ( const clientSnapshot_t *from, clientSnapshot_t *to, msg_t *msg,
72+ client_t * client, int lastframe, int snapFlags )
7273{
7374 entityState_t *oldent, *newent;
7475 int oldindex, newindex;
@@ -97,6 +98,42 @@ static void SV_EmitPacketEntities( const clientSnapshot_t *from, clientSnapshot_
9798
9899 while ( newindex < to->num_entities || oldindex < from_num_entities )
99100 {
101+
102+ if ( MAX_MSGLEN - msg->cursize < 128 ) {
103+ MSG_WriteBits ( msg, 0 , GENTITYNUM_BITS );
104+ MSG_WriteBits ( msg, 1 , 1 );
105+ MSG_WriteBits ( msg, 1 , 1 );
106+
107+ SV_SendMessageToClient ( msg, client );
108+
109+ MSG_Init ( msg, msg->data , msg->maxsize );
110+ MSG_WriteByte ( msg, svc_snapshot );
111+
112+ MSG_WriteLong ( msg, sv.time );
113+
114+ // what we are delta'ing from
115+ MSG_WriteByte ( msg, lastframe );
116+
117+ snapFlags = svs.snapFlagServerBit ;
118+
119+ MSG_WriteByte ( msg, snapFlags );
120+
121+ // send over the areabits
122+ MSG_WriteByte ( msg, to->areabytes );
123+ MSG_WriteData ( msg, to->areabits , to->areabytes );
124+
125+ {
126+ // delta encode the playerstate
127+ if ( from ) {
128+ MSG_WriteDeltaPlayerstate ( msg, &from->ps , &to->ps );
129+ } else {
130+ MSG_WriteDeltaPlayerstate ( msg, nullptr , &to->ps );
131+ }
132+ }
133+
134+ MSG_WriteShort ( msg, to->num_entities - newindex );
135+ }
136+
100137 if ( newindex >= to->num_entities )
101138 {
102139 newnum = MAX_GENTITIES;
@@ -236,7 +273,7 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg )
236273 }
237274
238275 // delta encode the entities
239- SV_EmitPacketEntities ( oldframe, frame, msg );
276+ SV_EmitPacketEntities ( oldframe, frame, msg, client, lastframe, snapFlags );
240277
241278 // padding for rate debugging
242279 if ( sv_padPackets.Get () )
@@ -265,6 +302,14 @@ void SV_UpdateServerCommandsToClient( client_t *client, msg_t *msg )
265302 MSG_WriteByte ( msg, svc_serverCommand );
266303 MSG_WriteLong ( msg, i );
267304 MSG_WriteString ( msg, client->reliableCommands [ i & ( MAX_RELIABLE_COMMANDS - 1 ) ] );
305+
306+ if ( MAX_MSGLEN - msg->cursize < MAX_STRING_CHARS ) {
307+ MSG_WriteByte ( msg, svc_partial );
308+ SV_SendMessageToClient ( msg, client );
309+
310+ MSG_Init ( msg, msg->data , msg->maxsize );
311+ MSG_WriteLong ( msg, client->lastClientCommand );
312+ }
268313 }
269314
270315 client->reliableSent = client->reliableSequence ;
0 commit comments