mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
Fix model precaching outside of spawn function
PF_sv_precache_model() function not only had duplicate code fragment of SV_Precache_Model(), but it set wrong mask for svcdp_precache command, 0x8000 instead of 0x0000
This commit is contained in:
parent
1aabcb0de0
commit
7e34bb1aca
1 changed files with 10 additions and 27 deletions
|
@ -1203,6 +1203,14 @@ static void PF_sv_precache_sound (void)
|
||||||
int SV_Precache_Model(const char *s)
|
int SV_Precache_Model(const char *s)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (sv.state != ss_loading && !qcvm->precacheanytime)
|
||||||
|
{
|
||||||
|
Con_Warning ("PF_precache_model(\"%s\"): 'DP_SV_PRECACHEANYTIME' not checked, so precaches should only be done in spawn functions\n", s);
|
||||||
|
if (!developer.value)
|
||||||
|
qcvm->precacheanytime = true; //don't spam too much
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_MODELS; i++)
|
for (i = 0; i < MAX_MODELS; i++)
|
||||||
{
|
{
|
||||||
if (!sv.model_precache[i])
|
if (!sv.model_precache[i])
|
||||||
|
@ -1234,32 +1242,7 @@ static void PF_sv_precache_model (void)
|
||||||
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
|
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
|
||||||
PR_CheckEmptyString (s);
|
PR_CheckEmptyString (s);
|
||||||
|
|
||||||
if (sv.state != ss_loading && !qcvm->precacheanytime)
|
if (!SV_Precache_Model(s))
|
||||||
{
|
|
||||||
Con_Warning ("PF_precache_model(\"%s\"): 'DP_SV_PRECACHEANYTIME' not checked, so precaches should only be done in spawn functions\n", s);
|
|
||||||
if (!developer.value)
|
|
||||||
qcvm->precacheanytime = true; //don't spam too much
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_MODELS; i++)
|
|
||||||
{
|
|
||||||
if (!sv.model_precache[i])
|
|
||||||
{
|
|
||||||
if (sv.state != ss_loading)
|
|
||||||
{
|
|
||||||
//let existing clients know about it
|
|
||||||
MSG_WriteByte(&sv.reliable_datagram, svcdp_precache);
|
|
||||||
MSG_WriteShort(&sv.reliable_datagram, i|0x8000);
|
|
||||||
MSG_WriteString(&sv.reliable_datagram, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
sv.model_precache[i] = s;
|
|
||||||
sv.models[i] = Mod_ForName (s, i==1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strcmp(sv.model_precache[i], s))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PR_RunError ("PF_precache_model: overflow");
|
PR_RunError ("PF_precache_model: overflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue