Patch from Spike. Two new ruleset cvars, one that prevents custom eyes models, one that prevents custom skins on packs/eyes (this doesn't work yet, needs fix).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2898 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Molgrum 2008-02-01 15:21:14 +00:00
parent 1805f13b23
commit 1e64dfd76d
8 changed files with 173 additions and 126 deletions

View file

@ -153,6 +153,8 @@ cvar_t ruleset_allow_packet = SCVAR("ruleset_allow_packet", "1");
cvar_t ruleset_allow_particle_lightning = SCVAR("ruleset_allow_particle_lightning", "1");
cvar_t ruleset_allow_overlongsounds = SCVAR("ruleset_allow_overlong_sounds", "1");
cvar_t ruleset_allow_larger_models = SCVAR("ruleset_allow_larger_models", "1");
cvar_t ruleset_allow_modified_eyes = SCVAR("ruleset_allow_modified_eyes", "0");
cvar_t ruleset_allow_sensative_texture_replacements = SCVAR("ruleset_allow_sensative_texture_replacements", "1");
extern cvar_t cl_hightrack;
@ -2908,6 +2910,8 @@ void CL_Init (void)
Cvar_Register (&ruleset_allow_particle_lightning, cl_controlgroup);
Cvar_Register (&ruleset_allow_overlongsounds, cl_controlgroup);
Cvar_Register (&ruleset_allow_larger_models, cl_controlgroup);
Cvar_Register (&ruleset_allow_modified_eyes, cl_controlgroup);
Cvar_Register (&ruleset_allow_sensative_texture_replacements, cl_controlgroup);
Cvar_Register (&qtvcl_forceversion1, cl_controlgroup);
Cvar_Register (&qtvcl_eztvextensions, cl_controlgroup);

View file

@ -643,6 +643,8 @@ extern cvar_t ruleset_allow_packet;
extern cvar_t ruleset_allow_particle_lightning;
extern cvar_t ruleset_allow_overlongsounds;
extern cvar_t ruleset_allow_larger_models;
extern cvar_t ruleset_allow_modified_eyes;
extern cvar_t ruleset_allow_sensative_texture_replacements;
#define MAX_STATIC_ENTITIES 256 // torches, etc

View file

@ -402,6 +402,8 @@ rulesetrule_t rulesetrules_strict[] = {
{"ruleset_allow_particle_lightning", "0"},
{"ruleset_allow_overlong_sounds", "0"},
{"ruleset_allow_larger_models", "0"},
{"ruleset_allow_modified_eyes", "0"},
{"ruleset_allow_sensative_texture_replacements", "0"},
{"tp_disputablemacros", "0"},
{"cl_instantrotate", "0"},
{NULL}
@ -413,6 +415,8 @@ rulesetrule_t rulesetrules_nqr[] = {
{"ruleset_allow_particle_lightning", "0"},
{"ruleset_allow_packet", "0"},
{"ruleset_allow_frj", "0"},
{"ruleset_allow_modified_eyes", "0"},
{"ruleset_allow_sensative_texture_replacements", "0"},
{"gl_shadeq1", "0"},
{"gl_shadeq3", "0"},
{NULL}

View file

@ -724,6 +724,11 @@ static void Mod_DoCRC(model_t *mod, char *buffer, int buffersize)
(loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name,
(int)crc);
}
if (!(loadmodel->engineflags & MDLF_PLAYER))
{ //eyes
loadmodel->tainted = (crc != 6967);
}
}
#endif
}
@ -742,6 +747,15 @@ static void Mod_ClampModelSize(model_t *mod)
axis = (mod->maxs[2] - mod->mins[2]);
rad += axis*axis;
if (loadmodel->engineflags & MDLF_DOCRC)
{
if (!strcmp(mod->name, "progs/eyes.mdl"))
{ //this is checked elsewhere to make sure the crc matches (this is to make sure the crc check was actually called)
if (mod->type != mod_alias || mod->fromgame != fg_quake)
mod->tainted = true;
}
}
mod->clampscale = 1;
for (i = 0; i < sizeof(clampedmodel)/sizeof(clampedmodel[0]); i++)
{

View file

@ -236,6 +236,11 @@ void Mod_DoCRC(model_t *mod, char *buffer, int buffersize)
(loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name,
(int)crc);
}
if (!(loadmodel->engineflags & MDLF_PLAYER))
{ //eyes
loadmodel->tainted = (crc != 6967);
}
}
#endif
}
@ -1001,8 +1006,14 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur
int frame;
int tc, bc;
qboolean forced;
if (!gl_nocolors.value)
if ((e->model->engineflags & MDLF_NOTREPLACEMENTS) && ruleset_allow_sensative_texture_replacements.value)
forced = true;
else
forced = false;
if (!gl_nocolors.value || forced)
{
if (e->scoreboard)
{
@ -1017,7 +1028,7 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur
bc = 1;
}
if (tc != 1 || bc != 1 || (e->scoreboard && e->scoreboard->skin))
if (forced || tc != 1 || bc != 1 || (e->scoreboard && e->scoreboard->skin))
{
int inwidth, inheight;
int tinwidth, tinheight;
@ -1028,7 +1039,7 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur
char hashname[512];
cc = (tc<<4)|bc;
if (e->scoreboard && e->scoreboard->skin && !gl_nocolors.value)
if (e->scoreboard && e->scoreboard->skin)
{
snprintf(hashname, sizeof(hashname), "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum);
skinname = hashname;
@ -1619,6 +1630,12 @@ void R_DrawGAliasModel (entity_t *e)
clmodel = e->model;
}
if (clmodel->tainted)
{
if (!ruleset_allow_modified_eyes.value && !strcmp(clmodel->name, "progs/eyes.mdl"))
return;
}
if (!(e->flags & Q2RF_WEAPONMODEL))
if (R_CullEntityBox (e, clmodel->mins, clmodel->maxs))
return;

View file

@ -479,8 +479,10 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash)
!strcmp(mod->name, "models/stsunsf1.mdl") ||
!strcmp(mod->name, "models/stice.mdl"))
mod->engineflags |= MDLF_BOLT;
else if (!strcmp(mod->name, "progs/backpack.mdl"))
mod->engineflags |= MDLF_NOTREPLACEMENTS;
else if (!strcmp(mod->name, "progs/eyes.mdl"))
mod->engineflags |= MDLF_DOCRC;
mod->engineflags |= MDLF_NOTREPLACEMENTS|MDLF_DOCRC;
// call the apropriate loader
mod->needload = false;

View file

@ -732,6 +732,7 @@ typedef struct model_s
{
char name[MAX_QPATH];
qboolean needload; // bmodels and sprites don't cache normally
qboolean tainted;
modtype_t type;
fromgame_t fromgame;
@ -822,14 +823,15 @@ typedef struct model_s
} model_t;
#define MDLF_ENGULPHS 0x01 // particle effect engulphs model (don't draw)
#define MDLF_NODEFAULTTRAIL 0x02
#define MDLF_RGBLIGHTING 0x04
#define MDLF_PLAYER 0x08 // players have specific lighting values
#define MDLF_FLAME 0x10 // can be excluded with r_drawflame, fullbright render hack
#define MDLF_DOCRC 0x20 // model needs CRC built
#define MDLF_NEEDOVERBRIGHT 0x40 // only overbright these models with gl_overbright_all set
#define MDLF_BOLT 0x80 // doesn't produce shadows
#define MDLF_ENGULPHS 0x001 // particle effect engulphs model (don't draw)
#define MDLF_NODEFAULTTRAIL 0x002
#define MDLF_RGBLIGHTING 0x004
#define MDLF_PLAYER 0x008 // players have specific lighting values
#define MDLF_FLAME 0x010 // can be excluded with r_drawflame, fullbright render hack
#define MDLF_DOCRC 0x020 // model needs CRC built
#define MDLF_NEEDOVERBRIGHT 0x040 // only overbright these models with gl_overbright_all set
#define MDLF_BOLT 0x080 // doesn't produce shadows
#define MDLF_NOTREPLACEMENTS 0x100 // can be considered a cheat, disable texture replacements
//============================================================================
/*

View file

@ -328,8 +328,10 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash)
!strcmp(mod->name, "models/stsunsf1.mdl") ||
!strcmp(mod->name, "models/stice.mdl"))
mod->engineflags |= MDLF_BOLT;
else if (!strcmp(mod->name, "progs/backpack.mdl"))
mod->engineflags |= MDLF_NOTREPLACEMENTS;
else if (!strcmp(mod->name, "progs/eyes.mdl"))
mod->engineflags |= MDLF_DOCRC;
mod->engineflags |= MDLF_NOTREPLACEMENTS|MDLF_DOCRC;
// call the apropriate loader
mod->needload = false;