fix some issues with rulesets being reapplied and nuking framerates due to shader reloads.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4919 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
f7b61a1dd8
commit
24b8fff515
8 changed files with 89 additions and 47 deletions
|
@ -5181,6 +5181,7 @@ char *CL_ParseChat(char *text, player_info_t **player, int *msgflags)
|
||||||
int check_flood;
|
int check_flood;
|
||||||
|
|
||||||
flags = TP_CategorizeMessage (text, &offset, player);
|
flags = TP_CategorizeMessage (text, &offset, player);
|
||||||
|
*msgflags = flags;
|
||||||
|
|
||||||
s = text + offset;
|
s = text + offset;
|
||||||
|
|
||||||
|
@ -5256,8 +5257,6 @@ char *CL_ParseChat(char *text, player_info_t **player, int *msgflags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*msgflags = flags;
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@ static f_modified_t *f_modified_list;
|
||||||
qboolean care_f_modified;
|
qboolean care_f_modified;
|
||||||
qboolean f_modified_particles;
|
qboolean f_modified_particles;
|
||||||
|
|
||||||
|
void QDECL rulesetcallback(cvar_t *var, char *oldval)
|
||||||
|
{
|
||||||
|
Validation_Apply_Ruleset();
|
||||||
|
}
|
||||||
|
|
||||||
cvar_t allow_f_version = SCVAR("allow_f_version", "1");
|
cvar_t allow_f_version = SCVAR("allow_f_version", "1");
|
||||||
cvar_t allow_f_server = SCVAR("allow_f_server", "1");
|
cvar_t allow_f_server = SCVAR("allow_f_server", "1");
|
||||||
|
@ -26,7 +30,7 @@ cvar_t allow_f_fakeshaft = SCVAR("allow_f_fakeshaft", "1");
|
||||||
cvar_t allow_f_system = SCVAR("allow_f_system", "0");
|
cvar_t allow_f_system = SCVAR("allow_f_system", "0");
|
||||||
cvar_t allow_f_cmdline = SCVAR("allow_f_cmdline", "0");
|
cvar_t allow_f_cmdline = SCVAR("allow_f_cmdline", "0");
|
||||||
cvar_t auth_validateclients = SCVAR("auth_validateclients", "1");
|
cvar_t auth_validateclients = SCVAR("auth_validateclients", "1");
|
||||||
cvar_t ruleset = SCVAR("ruleset", "none");
|
cvar_t ruleset = CVARC("ruleset", "none", rulesetcallback);
|
||||||
|
|
||||||
|
|
||||||
#define SECURITY_INIT_BAD_CHECKSUM 1
|
#define SECURITY_INIT_BAD_CHECKSUM 1
|
||||||
|
@ -410,6 +414,7 @@ static ruleset_t rulesets[] =
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static qboolean ruleset_locked;
|
||||||
void RulesetLatch(cvar_t *cvar)
|
void RulesetLatch(cvar_t *cvar)
|
||||||
{
|
{
|
||||||
cvar->flags |= CVAR_RULESETLATCH;
|
cvar->flags |= CVAR_RULESETLATCH;
|
||||||
|
@ -417,6 +422,7 @@ void RulesetLatch(cvar_t *cvar)
|
||||||
|
|
||||||
void Validation_DelatchRulesets(void)
|
void Validation_DelatchRulesets(void)
|
||||||
{ //game has come to an end, allow the ruleset to be changed
|
{ //game has come to an end, allow the ruleset to be changed
|
||||||
|
ruleset_locked = false;
|
||||||
if (Cvar_ApplyLatches(CVAR_RULESETLATCH))
|
if (Cvar_ApplyLatches(CVAR_RULESETLATCH))
|
||||||
Con_DPrintf("Ruleset deactivated\n");
|
Con_DPrintf("Ruleset deactivated\n");
|
||||||
}
|
}
|
||||||
|
@ -428,6 +434,9 @@ qboolean Validation_GetCurrentRulesetName(char *rsnames, int resultbuflen, qbool
|
||||||
ruleset_t *rs;
|
ruleset_t *rs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (enforcechosenrulesets)
|
||||||
|
ruleset_locked = true;
|
||||||
|
|
||||||
rs = rulesets;
|
rs = rulesets;
|
||||||
*rsnames = '\0';
|
*rsnames = '\0';
|
||||||
|
|
||||||
|
@ -504,7 +513,8 @@ void Validation_AllChecks(void)
|
||||||
playername[0] = 0;
|
playername[0] = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(playername, ' ', 15-localpnamelen-1);
|
//pad the left side to compensate for the player name prefix the server will add in the final svc_print
|
||||||
|
memset(playername, ' ', 15-localpnamelen);
|
||||||
playername[15-localpnamelen] = 0;
|
playername[15-localpnamelen] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,16 +538,26 @@ void Validation_Apply_Ruleset(void)
|
||||||
int i;
|
int i;
|
||||||
char *rulesetname = ruleset.string;
|
char *rulesetname = ruleset.string;
|
||||||
|
|
||||||
|
if (ruleset_locked)
|
||||||
|
{
|
||||||
|
if (ruleset.modified)
|
||||||
|
{
|
||||||
|
Con_Printf("Cannot change rulesets after the current ruleset has been announced\n");
|
||||||
|
ruleset.modified = false;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ruleset.modified = false;
|
||||||
|
|
||||||
if (!strcmp(rulesetname, "smackdown")) //officially, smackdown cannot authorise this, thus we do not use that name. however, imported configs tend to piss people off.
|
if (!strcmp(rulesetname, "smackdown")) //officially, smackdown cannot authorise this, thus we do not use that name. however, imported configs tend to piss people off.
|
||||||
rulesetname = "strict";
|
rulesetname = "strict";
|
||||||
|
|
||||||
#ifdef warningmsg
|
|
||||||
#pragma warningmsg("fixme: the following line should not be needed. ensure this is the case")
|
|
||||||
#endif
|
|
||||||
Validation_DelatchRulesets(); //make sure there's no old one
|
|
||||||
|
|
||||||
if (!*rulesetname || !strcmp(rulesetname, "none") || !strcmp(rulesetname, "default"))
|
if (!*rulesetname || !strcmp(rulesetname, "none") || !strcmp(rulesetname, "default"))
|
||||||
|
{
|
||||||
|
if (Cvar_ApplyLatches(CVAR_RULESETLATCH))
|
||||||
|
Con_DPrintf("Ruleset deactivated\n");
|
||||||
return; //no ruleset is set
|
return; //no ruleset is set
|
||||||
|
}
|
||||||
|
|
||||||
for (rs = rulesets; rs->rulesetname; rs++)
|
for (rs = rulesets; rs->rulesetname; rs++)
|
||||||
{
|
{
|
||||||
|
@ -547,6 +567,8 @@ void Validation_Apply_Ruleset(void)
|
||||||
if (!rs->rulesetname)
|
if (!rs->rulesetname)
|
||||||
{
|
{
|
||||||
Con_Printf("Cannot apply ruleset %s - not recognised\n", rulesetname);
|
Con_Printf("Cannot apply ruleset %s - not recognised\n", rulesetname);
|
||||||
|
if (Cvar_ApplyLatches(CVAR_RULESETLATCH))
|
||||||
|
Con_DPrintf("Ruleset deactivated\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -881,8 +881,8 @@ qboolean Cvar_ApplyLatchFlag(cvar_t *var, char *value, int flag)
|
||||||
#ifdef warningmsg
|
#ifdef warningmsg
|
||||||
#pragma warningmsg("this means the callback will never be called")
|
#pragma warningmsg("this means the callback will never be called")
|
||||||
#endif
|
#endif
|
||||||
latch = var->string;
|
latch = Z_StrDup(var->string);
|
||||||
var->string = NULL;
|
// var->string = NULL;
|
||||||
}
|
}
|
||||||
#ifdef warningmsg
|
#ifdef warningmsg
|
||||||
#pragma warningmsg("set or forceset?")
|
#pragma warningmsg("set or forceset?")
|
||||||
|
@ -924,16 +924,15 @@ void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats)
|
||||||
if (!(var->flags & (CVAR_CHEAT|CVAR_SEMICHEAT)))
|
if (!(var->flags & (CVAR_CHEAT|CVAR_SEMICHEAT)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (var->flags & CVAR_RULESETLATCH)
|
||||||
|
{
|
||||||
|
Con_Printf("Hello\n");
|
||||||
|
}
|
||||||
|
|
||||||
latch = var->latched_string;
|
latch = var->latched_string;
|
||||||
var->latched_string = NULL;
|
var->latched_string = NULL;
|
||||||
if (!latch)
|
if (!latch)
|
||||||
{
|
latch = Z_StrDup(var->string);
|
||||||
#ifdef warningmsg
|
|
||||||
#pragma warningmsg("this means the callback will never be called")
|
|
||||||
#endif
|
|
||||||
latch = var->string;
|
|
||||||
var->string = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var->flags & CVAR_CHEAT)
|
if (var->flags & CVAR_CHEAT)
|
||||||
{
|
{
|
||||||
|
@ -944,7 +943,9 @@ void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats)
|
||||||
}
|
}
|
||||||
if (var->flags & CVAR_SEMICHEAT)
|
if (var->flags & CVAR_SEMICHEAT)
|
||||||
{
|
{
|
||||||
if (!semicheats)
|
if (var->flags & CVAR_RULESETLATCH)
|
||||||
|
; //this is too problematic. the ruleset should cover it.
|
||||||
|
else if (!semicheats)
|
||||||
Cvar_ForceSet(var, "");
|
Cvar_ForceSet(var, "");
|
||||||
else
|
else
|
||||||
Cvar_ForceSet(var, latch);
|
Cvar_ForceSet(var, latch);
|
||||||
|
|
|
@ -283,6 +283,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define svcfte_setangledelta 85 // [angle3] add this to the current viewangles
|
#define svcfte_setangledelta 85 // [angle3] add this to the current viewangles
|
||||||
#define svcfte_updateentities 86
|
#define svcfte_updateentities 86
|
||||||
#define svcfte_brushedit 87 // networked brush editing, paired with clcfte_brushedit.
|
#define svcfte_brushedit 87 // networked brush editing, paired with clcfte_brushedit.
|
||||||
|
#define svcfte_updateseats 88 // byte count, byte playernum[count]
|
||||||
|
|
||||||
|
|
||||||
//fitz svcs
|
//fitz svcs
|
||||||
|
|
|
@ -656,12 +656,14 @@ static void BE_ApplyAttributes(unsigned int bitstochange, unsigned int bitstoend
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VATTR_COLOUR:
|
case VATTR_COLOUR:
|
||||||
if (shaderstate.sourcevbo->colours[0].gl.addr)
|
if (!shaderstate.sourcevbo->colours[0].gl.addr)
|
||||||
{
|
{
|
||||||
GL_SelectVBO(shaderstate.sourcevbo->colours[0].gl.vbo);
|
shaderstate.sha_attr &= ~(1u<<i);
|
||||||
qglVertexAttribPointer(VATTR_COLOUR, 4, shaderstate.colourarraytype, ((shaderstate.colourarraytype==GL_FLOAT)?GL_FALSE:GL_TRUE), 0, shaderstate.sourcevbo->colours[0].gl.addr);
|
qglDisableVertexAttribArray(i);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
GL_SelectVBO(shaderstate.sourcevbo->colours[0].gl.vbo);
|
||||||
|
qglVertexAttribPointer(VATTR_COLOUR, 4, shaderstate.colourarraytype, ((shaderstate.colourarraytype==GL_FLOAT)?GL_FALSE:GL_TRUE), 0, shaderstate.sourcevbo->colours[0].gl.addr);
|
||||||
break;
|
break;
|
||||||
#if MAXRLIGHTMAPS > 1
|
#if MAXRLIGHTMAPS > 1
|
||||||
case VATTR_COLOUR2:
|
case VATTR_COLOUR2:
|
||||||
|
@ -738,22 +740,22 @@ static void BE_ApplyAttributes(unsigned int bitstochange, unsigned int bitstoend
|
||||||
qglVertexAttribPointer(VATTR_TNORMALS, 3, GL_FLOAT, GL_FALSE, 0, shaderstate.sourcevbo->tvector.gl.addr);
|
qglVertexAttribPointer(VATTR_TNORMALS, 3, GL_FLOAT, GL_FALSE, 0, shaderstate.sourcevbo->tvector.gl.addr);
|
||||||
break;
|
break;
|
||||||
case VATTR_BONENUMS:
|
case VATTR_BONENUMS:
|
||||||
/*if (!shaderstate.sourcevbo->bonenums.gl.vbo && !shaderstate.sourcevbo->bonenums.gl.addr)
|
if (!shaderstate.sourcevbo->bonenums.gl.vbo && !shaderstate.sourcevbo->bonenums.gl.addr)
|
||||||
{
|
{
|
||||||
shaderstate.sha_attr &= ~(1u<<i);
|
shaderstate.sha_attr &= ~(1u<<i);
|
||||||
qglDisableVertexAttribArray(i);
|
qglDisableVertexAttribArray(i);
|
||||||
continue;
|
continue;
|
||||||
}*/
|
}
|
||||||
GL_SelectVBO(shaderstate.sourcevbo->bonenums.gl.vbo);
|
GL_SelectVBO(shaderstate.sourcevbo->bonenums.gl.vbo);
|
||||||
qglVertexAttribPointer(VATTR_BONENUMS, 4, GL_UNSIGNED_BYTE, GL_FALSE, 0, shaderstate.sourcevbo->bonenums.gl.addr);
|
qglVertexAttribPointer(VATTR_BONENUMS, 4, GL_UNSIGNED_BYTE, GL_FALSE, 0, shaderstate.sourcevbo->bonenums.gl.addr);
|
||||||
break;
|
break;
|
||||||
case VATTR_BONEWEIGHTS:
|
case VATTR_BONEWEIGHTS:
|
||||||
/*if (!shaderstate.sourcevbo->boneweights.gl.vbo && !shaderstate.sourcevbo->boneweights.gl.addr)
|
if (!shaderstate.sourcevbo->boneweights.gl.vbo && !shaderstate.sourcevbo->boneweights.gl.addr)
|
||||||
{
|
{
|
||||||
shaderstate.sha_attr &= ~(1u<<i);
|
shaderstate.sha_attr &= ~(1u<<i);
|
||||||
qglDisableVertexAttribArray(i);
|
qglDisableVertexAttribArray(i);
|
||||||
continue;
|
continue;
|
||||||
}*/
|
}
|
||||||
GL_SelectVBO(shaderstate.sourcevbo->boneweights.gl.vbo);
|
GL_SelectVBO(shaderstate.sourcevbo->boneweights.gl.vbo);
|
||||||
qglVertexAttribPointer(VATTR_BONEWEIGHTS, 4, GL_FLOAT, GL_FALSE, 0, shaderstate.sourcevbo->boneweights.gl.addr);
|
qglVertexAttribPointer(VATTR_BONEWEIGHTS, 4, GL_FLOAT, GL_FALSE, 0, shaderstate.sourcevbo->boneweights.gl.addr);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -4693,6 +4693,9 @@ void Shader_DefaultBSPLM(const char *shortname, shader_t *s, const void *args)
|
||||||
);
|
);
|
||||||
|
|
||||||
Shader_DefaultScript(shortname, s, builtin);
|
Shader_DefaultScript(shortname, s, builtin);
|
||||||
|
|
||||||
|
if (r_lightprepass.ival)
|
||||||
|
s->flags |= SHADER_HASNORMALMAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader_DefaultCinematic(const char *shortname, shader_t *s, const void *args)
|
void Shader_DefaultCinematic(const char *shortname, shader_t *s, const void *args)
|
||||||
|
@ -5656,21 +5659,29 @@ void Shader_DoReload(void)
|
||||||
int oldsort;
|
int oldsort;
|
||||||
qboolean resort = false;
|
qboolean resort = false;
|
||||||
|
|
||||||
if (shader_rescan_needed && ruleset_allow_shaders.ival)
|
if (shader_rescan_needed)
|
||||||
{
|
{
|
||||||
Shader_FlushCache();
|
Shader_FlushCache();
|
||||||
|
|
||||||
COM_EnumerateFiles("materials/*.mtr", Shader_InitCallback, NULL);
|
if (ruleset_allow_shaders.ival)
|
||||||
COM_EnumerateFiles("shaders/*.shader", Shader_InitCallback, NULL);
|
{
|
||||||
COM_EnumerateFiles("scripts/*.shader", Shader_InitCallback, NULL);
|
COM_EnumerateFiles("materials/*.mtr", Shader_InitCallback, NULL);
|
||||||
COM_EnumerateFiles("scripts/*.rscript", Shader_InitCallback, NULL);
|
COM_EnumerateFiles("shaders/*.shader", Shader_InitCallback, NULL);
|
||||||
|
COM_EnumerateFiles("scripts/*.shader", Shader_InitCallback, NULL);
|
||||||
|
COM_EnumerateFiles("scripts/*.rscript", Shader_InitCallback, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
shader_reload_needed = true;
|
shader_reload_needed = true;
|
||||||
shader_rescan_needed = false;
|
shader_rescan_needed = false;
|
||||||
}
|
|
||||||
|
|
||||||
if (!shader_reload_needed)
|
Con_DPrintf("Rescanning shaders\n");
|
||||||
return;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!shader_reload_needed)
|
||||||
|
return;
|
||||||
|
Con_DPrintf("Reloading shaders\n");
|
||||||
|
}
|
||||||
shader_reload_needed = false;
|
shader_reload_needed = false;
|
||||||
Font_InvalidateColour();
|
Font_InvalidateColour();
|
||||||
Shader_ReloadGenerics();
|
Shader_ReloadGenerics();
|
||||||
|
|
|
@ -9258,7 +9258,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
||||||
{"walkmove", PF_walkmove, 32, 32, 32, 0, D("float(float yaw, float dist, optional float settraceglobals)", "Attempt to walk the entity at a given angle for a given distance.\nif settraceglobals is set, the trace_* globals will be set, showing the results of the movement.\nThis function will trigger touch events.")},
|
{"walkmove", PF_walkmove, 32, 32, 32, 0, D("float(float yaw, float dist, optional float settraceglobals)", "Attempt to walk the entity at a given angle for a given distance.\nif settraceglobals is set, the trace_* globals will be set, showing the results of the movement.\nThis function will trigger touch events.")},
|
||||||
// {"qtest_flymove", NULL, 33}, // float(vector dir) flymove = #33;
|
// {"qtest_flymove", NULL, 33}, // float(vector dir) flymove = #33;
|
||||||
//qbism super8's 'private'sound #33
|
//qbism super8's 'private'sound #33
|
||||||
{"droptofloor", PF_droptofloor, 34, 34, 34, 0, D("float()", "Instantly moves the entity downwards until it hits the ground. If the entity would need to drop more than 'pr_droptofloorunits' quake units, its position will be considered invalid and the builtin will abort.")},
|
{"droptofloor", PF_droptofloor, 34, 34, 34, 0, D("float()", "Instantly moves the entity downwards until it hits the ground. If the entity is in solid or would need to drop more than 'pr_droptofloorunits' quake units, its position will be considered invalid and the builtin will abort, returning FALSE, otherwise TRUE.")},
|
||||||
{"lightstyle", PF_lightstyle, 35, 35, 35, 0, D("void(float lightstyle, string stylestring, optional vector rgb)", "Specifies an auto-animating string that specifies the light intensity for entities using that lightstyle.\na is off, z is fully lit. Should be lower case only.\nrgb will recolour all lights using that lightstyle.\n")},
|
{"lightstyle", PF_lightstyle, 35, 35, 35, 0, D("void(float lightstyle, string stylestring, optional vector rgb)", "Specifies an auto-animating string that specifies the light intensity for entities using that lightstyle.\na is off, z is fully lit. Should be lower case only.\nrgb will recolour all lights using that lightstyle.\n")},
|
||||||
{"rint", PF_rint, 36, 36, 36, 0, D("float(float)", "Rounds the given float up or down to the closest integeral value. X.5 rounds away from 0")},
|
{"rint", PF_rint, 36, 36, 36, 0, D("float(float)", "Rounds the given float up or down to the closest integeral value. X.5 rounds away from 0")},
|
||||||
{"floor", PF_floor, 37, 37, 37, 0, D("float(float)", "Rounds the given float downwards, even when negative.")},
|
{"floor", PF_floor, 37, 37, 37, 0, D("float(float)", "Rounds the given float downwards, even when negative.")},
|
||||||
|
|
|
@ -5609,21 +5609,27 @@ void SV_ExecuteUserCommand (char *s, qboolean fromQC)
|
||||||
|
|
||||||
Cmd_ExecLevel=1;
|
Cmd_ExecLevel=1;
|
||||||
|
|
||||||
if (!fromQC && host_client->controlled && atoi(Cmd_Argv(0))>0) //now see if it's meant to be from a slave client
|
if (!fromQC && host_client->controlled) //now see if it's meant to be from a slave client
|
||||||
{
|
{ //'cmd 2 say hi' should
|
||||||
int pnum = atoi(Cmd_Argv(0));
|
char *a=Cmd_Argv(0), *e;
|
||||||
client_t *sp;
|
int pnum = strtoul(a, &e, 10);
|
||||||
for (sp = host_client; sp; sp = sp->controlled)
|
|
||||||
|
if (e == a+1 && pnum >= 1 && pnum <= MAX_SPLITS)
|
||||||
{
|
{
|
||||||
if (!--pnum)
|
client_t *sp;
|
||||||
|
for (sp = host_client; sp; sp = sp->controlled)
|
||||||
{
|
{
|
||||||
host_client = sp;
|
if (!--pnum)
|
||||||
break;
|
{
|
||||||
|
host_client = sp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sv_player = host_client->edict;
|
||||||
|
s = Cmd_Args();
|
||||||
|
Cmd_ShiftArgs(1, false);
|
||||||
}
|
}
|
||||||
sv_player = host_client->edict;
|
|
||||||
s = Cmd_Args();
|
|
||||||
Cmd_ShiftArgs(1, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q2SERVER
|
#ifdef Q2SERVER
|
||||||
|
|
Loading…
Reference in a new issue