@@ -1079,6 +1079,13 @@ static void SV_SendClientGameState( client_t *client ) {
10791079
10801080 Com_DPrintf ( "SV_SendClientGameState() for %s\n" , client -> name );
10811081
1082+ #ifdef STEF_UDP_DOWNLOAD_NO_DOUBLE_LOAD
1083+ if ( client -> state < CS_PRIMED ) {
1084+ // clear old cs change log to avoid unnecessary retransmits
1085+ Com_Memset ( client -> csUpdated , 0 , sizeof ( client -> csUpdated ) );
1086+ }
1087+ #endif
1088+
10821089 SV_PrintClientStateChange ( client , CS_PRIMED );
10831090
10841091 client -> state = CS_PRIMED ;
@@ -1340,6 +1347,20 @@ static void SV_DoneDownload_f( client_t *cl ) {
13401347
13411348 Com_DPrintf ( "clientDownload: %s Done\n" , cl -> name );
13421349
1350+ #ifdef STEF_UDP_DOWNLOAD_NO_DOUBLE_LOAD
1351+ if ( cl -> compat && cl -> state == CS_PRIMED ) {
1352+ // Vanilla client will load map based on the pre-download gamestate, so a new one is
1353+ // unnecessary and would cause double loading. Note that it's also possible for ioEF
1354+ // clients to use protocol 24 and get cl->compat, but in this case the drop check
1355+ // should should handle sending the gamestate after a short delay.
1356+ cl -> downloading = qfalse ;
1357+
1358+ // Don't immediately trip dropped download gamestate checks in SV_ExecuteClientMessage
1359+ cl -> gamestateMessageNum = cl -> messageAcknowledge - 1 ;
1360+ return ;
1361+ }
1362+ #endif
1363+
13431364 // resend the game state to update any clients that entered during the download
13441365 SV_SendClientGameState ( cl );
13451366}
@@ -1394,8 +1415,20 @@ static void SV_BeginDownload_f( client_t *cl ) {
13941415 // the file itself
13951416 Q_strncpyz ( cl -> downloadName , Cmd_Argv (1 ), sizeof (cl -> downloadName ) );
13961417
1418+ #ifdef STEF_UDP_DOWNLOAD_NO_DOUBLE_LOAD
1419+ if ( cl -> compat ) {
1420+ // Vanilla clients will try to load map based on the pre-download gamestate,
1421+ // so we need to track configstring updates during the download
1422+ SV_PrintClientStateChange ( cl , CS_PRIMED );
1423+ cl -> state = CS_PRIMED ;
1424+ } else {
1425+ SV_PrintClientStateChange ( cl , CS_CONNECTED );
1426+ cl -> state = CS_CONNECTED ;
1427+ }
1428+ #else
13971429 SV_PrintClientStateChange ( cl , CS_CONNECTED );
13981430 cl -> state = CS_CONNECTED ;
1431+ #endif
13991432 cl -> gentity = NULL ;
14001433
14011434 cl -> downloading = qtrue ;
0 commit comments