2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-03 18:45:46 +03:00

Merge pull request #174 from WPMGPRoSToTeMa/fastsprayupload

Added sv_delayed_spray_upload cvar (#173)
This commit is contained in:
theAsmodai 2016-02-08 12:01:09 +03:00
commit 42b7f12f27
4 changed files with 32 additions and 2 deletions

View File

@ -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;

View File

@ -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++)

View File

@ -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;
}

View File

@ -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
}
}
}
}