mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-10 01:31:14 +00:00
Require mods to actually query DP_SV_PRECACHEANYTIME if they want to avoid warnings from making use of it. This should avoid unintentional compat issues for QS in mods.
This commit is contained in:
parent
1c8562a021
commit
5b05414d7f
3 changed files with 31 additions and 11 deletions
|
@ -1079,7 +1079,16 @@ static void PF_vtos (void)
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = PR_GetTempString();
|
s = PR_GetTempString();
|
||||||
sprintf (s, "'%5.1f %5.1f %5.1f'", G_VECTOR(OFS_PARM0)[0], G_VECTOR(OFS_PARM0)[1], G_VECTOR(OFS_PARM0)[2]);
|
if (!pr_checkextension.value)
|
||||||
|
sprintf (s, "'%5.1f %5.1f %5.1f'", G_VECTOR(OFS_PARM0)[0], G_VECTOR(OFS_PARM0)[1], G_VECTOR(OFS_PARM0)[2]);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char x[64], y[64], z[64];
|
||||||
|
Q_ftoa(x, G_VECTOR(OFS_PARM0)[0]);
|
||||||
|
Q_ftoa(y, G_VECTOR(OFS_PARM0)[1]);
|
||||||
|
Q_ftoa(z, G_VECTOR(OFS_PARM0)[2]);
|
||||||
|
sprintf (s, "'%s %s %s'", x, y, z);
|
||||||
|
}
|
||||||
G_INT(OFS_RETURN) = PR_SetEngineString(s);
|
G_INT(OFS_RETURN) = PR_SetEngineString(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1148,13 +1157,19 @@ int SV_Precache_Sound(const char *s)
|
||||||
{ //must be a persistent string.
|
{ //must be a persistent string.
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (sv.state != ss_loading && !qcvm->precacheanytime)
|
||||||
|
{
|
||||||
|
Con_Warning("PF_precache_sound(\"%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_SOUNDS; i++)
|
for (i = 0; i < MAX_SOUNDS; i++)
|
||||||
{
|
{
|
||||||
if (!sv.sound_precache[i])
|
if (!sv.sound_precache[i])
|
||||||
{
|
{
|
||||||
if (sv.state != ss_loading) //spike -- moved this so that there's no actual error any more.
|
if (sv.state != ss_loading) //spike -- moved this so that there's no actual error any more.
|
||||||
{
|
{
|
||||||
Con_Warning("PF_precache_sound(\"%s\"): Precache should only be done in spawn functions\n", s);
|
|
||||||
//let existing clients know about it
|
//let existing clients know about it
|
||||||
MSG_WriteByte(&sv.reliable_datagram, svcdp_precache);
|
MSG_WriteByte(&sv.reliable_datagram, svcdp_precache);
|
||||||
MSG_WriteShort(&sv.reliable_datagram, i|0x8000);
|
MSG_WriteShort(&sv.reliable_datagram, i|0x8000);
|
||||||
|
@ -1164,11 +1179,7 @@ int SV_Precache_Sound(const char *s)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
if (!strcmp(sv.sound_precache[i], s))
|
if (!strcmp(sv.sound_precache[i], s))
|
||||||
{
|
|
||||||
if (sv.state != ss_loading && !pr_checkextension.value)
|
|
||||||
Con_Warning("PF_precache_sound(\"%s\"): Precache should only be done in spawn functions\n", s);
|
|
||||||
return i;
|
return i;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1219,13 +1230,19 @@ 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)
|
||||||
|
{
|
||||||
|
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])
|
||||||
{
|
{
|
||||||
if (sv.state != ss_loading)
|
if (sv.state != ss_loading)
|
||||||
{
|
{
|
||||||
Con_Warning ("PF_precache_model(\"%s\"): Precache should only be done in spawn functions\n", s);
|
|
||||||
//let existing clients know about it
|
//let existing clients know about it
|
||||||
MSG_WriteByte(&sv.reliable_datagram, svcdp_precache);
|
MSG_WriteByte(&sv.reliable_datagram, svcdp_precache);
|
||||||
MSG_WriteShort(&sv.reliable_datagram, i|0x8000);
|
MSG_WriteShort(&sv.reliable_datagram, i|0x8000);
|
||||||
|
@ -1237,11 +1254,7 @@ static void PF_sv_precache_model (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!strcmp(sv.model_precache[i], s))
|
if (!strcmp(sv.model_precache[i], s))
|
||||||
{
|
|
||||||
if (sv.state != ss_loading && !pr_checkextension.value)
|
|
||||||
Con_Warning ("PF_precache_model(\"%s\"): Precache should only be done in spawn functions\n", s);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PR_RunError ("PF_precache_model: overflow");
|
PR_RunError ("PF_precache_model: overflow");
|
||||||
}
|
}
|
||||||
|
|
|
@ -7473,6 +7473,11 @@ qboolean PR_Can_Ent_Scale(unsigned int prot, unsigned int pext1, unsigned int pe
|
||||||
else
|
else
|
||||||
return false; //sorry. don't report it as supported.
|
return false; //sorry. don't report it as supported.
|
||||||
}
|
}
|
||||||
|
qboolean PR_CanPrecacheAnyTime(unsigned int prot, unsigned int pext1, unsigned int pext2)
|
||||||
|
{
|
||||||
|
qcvm->precacheanytime = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -7536,6 +7541,7 @@ static struct
|
||||||
{"DP_SV_DROPCLIENT"},
|
{"DP_SV_DROPCLIENT"},
|
||||||
// {"DP_SV_POINTPARTICLES", PR_Can_Particles}, //can't enable this, because certain mods then assume that we're DP and all the particles break.
|
// {"DP_SV_POINTPARTICLES", PR_Can_Particles}, //can't enable this, because certain mods then assume that we're DP and all the particles break.
|
||||||
{"DP_SV_POINTSOUND"},
|
{"DP_SV_POINTSOUND"},
|
||||||
|
{"DP_SV_PRECACHEANYTIME", PR_CanPrecacheAnyTime},
|
||||||
{"DP_SV_PRINT"},
|
{"DP_SV_PRINT"},
|
||||||
{"DP_SV_SETCOLOR"},
|
{"DP_SV_SETCOLOR"},
|
||||||
{"DP_SV_SPAWNFUNC_PREFIX"},
|
{"DP_SV_SPAWNFUNC_PREFIX"},
|
||||||
|
|
|
@ -375,6 +375,7 @@ struct qcvm_s
|
||||||
void *cursorhandle; //video code.
|
void *cursorhandle; //video code.
|
||||||
qboolean nogameaccess; //simplecsqc isn't allowed to poke properties of the actual game (to prevent cheats when there's no restrictions on what it can access)
|
qboolean nogameaccess; //simplecsqc isn't allowed to poke properties of the actual game (to prevent cheats when there's no restrictions on what it can access)
|
||||||
qboolean brokenbouncemissile; //2021 rerelease redefined it, breaking any mod that depends on it.
|
qboolean brokenbouncemissile; //2021 rerelease redefined it, breaking any mod that depends on it.
|
||||||
|
qboolean precacheanytime; //mod queried for support. this is used to spam warnings to anyone that doesn't bother checking for it first. this annoyance is to reduce compat issues.
|
||||||
|
|
||||||
//was static inside pr_edict
|
//was static inside pr_edict
|
||||||
char *strings;
|
char *strings;
|
||||||
|
|
Loading…
Reference in a new issue