1
0
Fork 0
forked from fte/fteqw

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;
@ -2856,61 +2858,63 @@ void CL_Init (void)
//
// info mirrors
//
Cvar_Register (&name, cl_controlgroup);
Cvar_Register (&password, cl_controlgroup);
Cvar_Register (&spectator, cl_controlgroup);
Cvar_Register (&skin, cl_controlgroup);
Cvar_Register (&model, cl_controlgroup);
Cvar_Register (&team, cl_controlgroup);
Cvar_Register (&topcolor, cl_controlgroup);
Cvar_Register (&bottomcolor, cl_controlgroup);
Cvar_Register (&rate, cl_controlgroup);
Cvar_Register (&drate, cl_controlgroup);
Cvar_Register (&msg, cl_controlgroup);
Cvar_Register (&noaim, cl_controlgroup);
Cvar_Register (&b_switch, cl_controlgroup);
Cvar_Register (&w_switch, cl_controlgroup);
Cvar_Register (&name, cl_controlgroup);
Cvar_Register (&password, cl_controlgroup);
Cvar_Register (&spectator, cl_controlgroup);
Cvar_Register (&skin, cl_controlgroup);
Cvar_Register (&model, cl_controlgroup);
Cvar_Register (&team, cl_controlgroup);
Cvar_Register (&topcolor, cl_controlgroup);
Cvar_Register (&bottomcolor, cl_controlgroup);
Cvar_Register (&rate, cl_controlgroup);
Cvar_Register (&drate, cl_controlgroup);
Cvar_Register (&msg, cl_controlgroup);
Cvar_Register (&noaim, cl_controlgroup);
Cvar_Register (&b_switch, cl_controlgroup);
Cvar_Register (&w_switch, cl_controlgroup);
Cvar_Register (&cl_nofake, cl_controlgroup);
Cvar_Register (&cl_chatsound, cl_controlgroup);
Cvar_Register (&cl_enemychatsound, cl_controlgroup);
Cvar_Register (&cl_teamchatsound, cl_controlgroup);
Cvar_Register (&cl_nofake, cl_controlgroup);
Cvar_Register (&cl_chatsound, cl_controlgroup);
Cvar_Register (&cl_enemychatsound, cl_controlgroup);
Cvar_Register (&cl_teamchatsound, cl_controlgroup);
Cvar_Register (&requiredownloads, cl_controlgroup);
Cvar_Register (&cl_standardchat, cl_controlgroup);
Cvar_Register (&msg_filter, cl_controlgroup);
Cvar_Register (&cl_standardmsg, cl_controlgroup);
Cvar_Register (&cl_parsewhitetext, cl_controlgroup);
Cvar_Register (&cl_nopext, cl_controlgroup);
Cvar_Register (&cl_splitscreen, cl_controlgroup);
Cvar_Register (&requiredownloads, cl_controlgroup);
Cvar_Register (&cl_standardchat, cl_controlgroup);
Cvar_Register (&msg_filter, cl_controlgroup);
Cvar_Register (&cl_standardmsg, cl_controlgroup);
Cvar_Register (&cl_parsewhitetext, cl_controlgroup);
Cvar_Register (&cl_nopext, cl_controlgroup);
Cvar_Register (&cl_splitscreen, cl_controlgroup);
Cvar_Register (&host_mapname, "Scripting");
Cvar_Register (&host_mapname, "Scripting");
Cvar_Register (&cl_countpendingpl, cl_controlgroup);
Cvar_Register (&cl_indepphysics, cl_controlgroup);
Cvar_Register (&cl_antibunch, "evil hacks");
Cvar_Register (&hud_tracking_show, "statusbar");
Cvar_Register (&cl_countpendingpl, cl_controlgroup);
Cvar_Register (&cl_indepphysics, cl_controlgroup);
Cvar_Register (&cl_antibunch, "evil hacks");
Cvar_Register (&hud_tracking_show, "statusbar");
Cvar_Register (&cl_dlemptyterminate, cl_controlgroup);
Cvar_Register (&cl_gunx, cl_controlgroup);
Cvar_Register (&cl_guny, cl_controlgroup);
Cvar_Register (&cl_gunz, cl_controlgroup);
Cvar_Register (&cl_gunx, cl_controlgroup);
Cvar_Register (&cl_guny, cl_controlgroup);
Cvar_Register (&cl_gunz, cl_controlgroup);
Cvar_Register (&cl_gunanglex, cl_controlgroup);
Cvar_Register (&cl_gunangley, cl_controlgroup);
Cvar_Register (&cl_gunanglez, cl_controlgroup);
Cvar_Register (&cl_gunanglex, cl_controlgroup);
Cvar_Register (&cl_gunangley, cl_controlgroup);
Cvar_Register (&cl_gunanglez, cl_controlgroup);
Cvar_Register (&ruleset_allow_playercount, cl_controlgroup);
Cvar_Register (&ruleset_allow_frj, cl_controlgroup);
Cvar_Register (&ruleset_allow_frj, cl_controlgroup);
Cvar_Register (&ruleset_allow_semicheats, cl_controlgroup);
Cvar_Register (&ruleset_allow_packet, cl_controlgroup);
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_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);
Cvar_Register (&qtvcl_forceversion1, cl_controlgroup);
Cvar_Register (&qtvcl_eztvextensions, cl_controlgroup);
#ifdef WEBCLIENT
Cmd_AddCommand ("ftp", CL_FTP_f);
#endif

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

@ -26,55 +26,55 @@ extern char loadname[];
typedef struct
{
char *name;
float furthestallowedextremety; //this field is the combined max-min square, added together
//note that while this allows you to move models about a little, you cannot resize the visible part
typedef struct
{
char *name;
float furthestallowedextremety; //this field is the combined max-min square, added together
//note that while this allows you to move models about a little, you cannot resize the visible part
} clampedmodel_t;
//these should be rounded up slightly.
//these should be rounded up slightly.
//really this is only to catch spiked models. This doesn't prevent more visible models, just bigger ones.
clampedmodel_t clampedmodel[] = {
{"maps/b_bh100.bsp", 3440},
{"progs/player.mdl", 22497},
{"progs/eyes.mdl", 755},
{"progs/gib1.mdl", 374},
{"progs/gib2.mdl", 1779},
{"progs/gib3.mdl", 2066},
{"progs/bolt2.mdl", 1160},
{"progs/end1.mdl", 764},
{"progs/end2.mdl", 981},
{"progs/end3.mdl", 851},
{"progs/end4.mdl", 903},
{"progs/g_shot.mdl", 3444},
{"progs/g_nail.mdl", 2234},
{"progs/g_nail2.mdl", 3660},
{"progs/g_rock.mdl", 3441},
{"progs/g_rock2.mdl", 3660},
{"progs/g_light.mdl", 2698},
{"progs/invisibl.mdl", 196},
{"progs/quaddama.mdl", 2353},
{"progs/invulner.mdl", 2746},
{"progs/suit.mdl", 3057},
{"progs/missile.mdl", 416},
{"progs/grenade.mdl", 473},
{"progs/spike.mdl", 112},
{"progs/s_spike.mdl", 112},
{"progs/backpack.mdl", 1117},
{"progs/armor.mdl", 2919},
{"progs/s_bubble.spr", 100},
{"progs/s_explod.spr", 1000},
//and now TF models
#ifndef _MSC_VER
#warning FIXME: these are placeholders
#endif
{"progs/disp.mdl", 3000},
{"progs/tf_flag.mdl", 3000},
{"progs/tf_stan.mdl", 3000},
{"progs/turrbase.mdl", 3000},
{"progs/turrgun.mdl", 3000}
clampedmodel_t clampedmodel[] = {
{"maps/b_bh100.bsp", 3440},
{"progs/player.mdl", 22497},
{"progs/eyes.mdl", 755},
{"progs/gib1.mdl", 374},
{"progs/gib2.mdl", 1779},
{"progs/gib3.mdl", 2066},
{"progs/bolt2.mdl", 1160},
{"progs/end1.mdl", 764},
{"progs/end2.mdl", 981},
{"progs/end3.mdl", 851},
{"progs/end4.mdl", 903},
{"progs/g_shot.mdl", 3444},
{"progs/g_nail.mdl", 2234},
{"progs/g_nail2.mdl", 3660},
{"progs/g_rock.mdl", 3441},
{"progs/g_rock2.mdl", 3660},
{"progs/g_light.mdl", 2698},
{"progs/invisibl.mdl", 196},
{"progs/quaddama.mdl", 2353},
{"progs/invulner.mdl", 2746},
{"progs/suit.mdl", 3057},
{"progs/missile.mdl", 416},
{"progs/grenade.mdl", 473},
{"progs/spike.mdl", 112},
{"progs/s_spike.mdl", 112},
{"progs/backpack.mdl", 1117},
{"progs/armor.mdl", 2919},
{"progs/s_bubble.spr", 100},
{"progs/s_explod.spr", 1000},
//and now TF models
#ifndef _MSC_VER
#warning FIXME: these are placeholders
#endif
{"progs/disp.mdl", 3000},
{"progs/tf_flag.mdl", 3000},
{"progs/tf_stan.mdl", 3000},
{"progs/turrbase.mdl", 3000},
{"progs/turrgun.mdl", 3000}
};
#ifdef SKELETALMODELS
@ -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
}
@ -731,30 +736,39 @@ static void Mod_DoCRC(model_t *mod, char *buffer, int buffersize)
static void Mod_ClampModelSize(model_t *mod)
{
#ifndef SERVERONLY
int i;
float rad=0, axis;
axis = (mod->maxs[0] - mod->mins[0]);
rad += axis*axis;
axis = (mod->maxs[1] - mod->mins[1]);
rad += axis*axis;
axis = (mod->maxs[2] - mod->mins[2]);
rad += axis*axis;
mod->clampscale = 1;
for (i = 0; i < sizeof(clampedmodel)/sizeof(clampedmodel[0]); i++)
{
if (!strcmp(mod->name, clampedmodel[i].name))
{
if (rad > clampedmodel[i].furthestallowedextremety)
{
axis = clampedmodel[i].furthestallowedextremety;
mod->clampscale = axis/rad;
Con_DPrintf("\"%s\" will be clamped.\n", mod->name);
}
return;
}
#ifndef SERVERONLY
int i;
float rad=0, axis;
axis = (mod->maxs[0] - mod->mins[0]);
rad += axis*axis;
axis = (mod->maxs[1] - mod->mins[1]);
rad += axis*axis;
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++)
{
if (!strcmp(mod->name, clampedmodel[i].name))
{
if (rad > clampedmodel[i].furthestallowedextremety)
{
axis = clampedmodel[i].furthestallowedextremety;
mod->clampscale = axis/rad;
Con_DPrintf("\"%s\" will be clamped.\n", mod->name);
}
return;
}
}
Con_DPrintf("Don't know what size to clamp \"%s\" to (size:%f).\n", mod->name, rad);

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;