diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index a50192d..1d39783 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -541,6 +541,7 @@ extern cvar_t sv_version; #ifdef REHLDS_FIXES extern cvar_t sv_echo_unknown_cmd; extern cvar_t sv_auto_precache_sounds_in_models; +extern cvar_t sv_delayed_spray_upload; #endif extern int sv_playermodel; diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 8f1df41..a90ee25 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -201,6 +201,7 @@ cvar_t sv_allow_dlfile = { "sv_allow_dlfile", "1", 0, 0.0f, NULL }; cvar_t sv_version = { "sv_version", "", FCVAR_SERVER, 0.0f, NULL }; cvar_t sv_echo_unknown_cmd = { "sv_echo_unknown_cmd", "0", 0, 0.0f, NULL }; cvar_t sv_auto_precache_sounds_in_models = { "sv_auto_precache_sounds_in_models", "0", 0, 0.0f, nullptr }; +cvar_t sv_delayed_spray_upload = { "sv_delayed_spray_upload", "0", 0, 0.0f, nullptr }; #else cvar_t sv_version = {"sv_version", "", 0, 0.0f, NULL}; #endif @@ -7758,6 +7759,7 @@ void SV_Init(void) Cvar_RegisterVariable(&sv_force_ent_intersection); Cvar_RegisterVariable(&sv_echo_unknown_cmd); Cvar_RegisterVariable(&sv_auto_precache_sounds_in_models); + Cvar_RegisterVariable(&sv_delayed_spray_upload); #endif for (int i = 0; i < MAX_MODELS; i++) diff --git a/rehlds/engine/sv_upld.cpp b/rehlds/engine/sv_upld.cpp index f0f0f93..224890d 100644 --- a/rehlds/engine/sv_upld.cpp +++ b/rehlds/engine/sv_upld.cpp @@ -76,8 +76,16 @@ qboolean SV_CheckFile(sizebuf_t *msg, char *filename) #endif // REHLDS_FIXES - MSG_WriteByte(msg, svc_stufftext); - MSG_WriteString(msg, va("upload \"!MD5%s\"\n", MD5_Print(p.rgucMD5_hash))); +#ifdef REHLDS_FIXES + // While client is connecting he always send too small fragments (128 bytes) + // But if client is fully connected he send fragments with cl_dlmax size + // So, send upload in SV_SendEnts_f + if (!sv_delayed_spray_upload.value) +#endif // REHLDS_FIXES + { + MSG_WriteByte(msg, svc_stufftext); + MSG_WriteString(msg, va("upload \"!MD5%s\"\n", MD5_Print(p.rgucMD5_hash))); + } return FALSE; } diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 71b8c95..005908e 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -1824,7 +1824,26 @@ void SV_SendEnts_f(void) if (host_client->active && host_client->spawned) { if (host_client->connected) + { host_client->fully_connected = 1; + +#ifdef REHLDS_FIXES + // See SV_CheckFile function + if (sv_delayed_spray_upload.value) + { + resource_t *res = host_client->resourcesneeded.pNext; + if (res != &host_client->resourcesneeded) + { + // TODO: all this is already checked earlier + if (res->ucFlags & RES_WASMISSING && res->type == t_decal && res->ucFlags & RES_CUSTOM) + { + MSG_WriteByte(&host_client->netchan.message, svc_stufftext); + MSG_WriteString(&host_client->netchan.message, va("upload !MD5%s\n", MD5_Print(res->rgucMD5_hash))); + } + } + } +#endif // REHLDS_FIXES + } } } }