From 406a7645a50d036ab63951c5e040ae025a7e86c7 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 8 Feb 2008 23:26:25 +0000 Subject: [PATCH] Okay, that ruleset cvar actually works now, correctly locking out modified textures on backpack.mdl git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2911 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/com_mesh.c | 27 +++++++++++++++------------ engine/gl/gl_alias.c | 29 ++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 38aa77491..4949f4036 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -1394,7 +1394,7 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, qboolean alpha) } //but only preload it if we have no replacement. - if (!texture) + if (!texture || (loadmodel->engineflags & MDLF_NOTREPLACEMENTS)) { //we're not using 24bits texnums = Hunk_Alloc(sizeof(*texnums)+s); @@ -1403,18 +1403,21 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, qboolean alpha) memcpy(saved, pskintype+1, s); Mod_FloodFillSkin(saved, outskin->skinwidth, outskin->skinheight); -//the extra underscore is to stop - snprintf(skinname, sizeof(skinname), "%s__%i", loadname, i); - texture = R_LoadTexture8(skinname, outskin->skinwidth, outskin->skinheight, saved, true, alpha); - if (r_fb_models.value) +//the extra underscore is to stop + if (!texture) { - snprintf(skinname, sizeof(skinname), "%s__%i_luma", loadname, i); - fbtexture = R_LoadTextureFB(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true); - } - if (gl_bump.value) - { - snprintf(skinname, sizeof(skinname), "%s__%i_bump", loadname, i); - bumptexture = R_LoadTexture8Bump(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true); + snprintf(skinname, sizeof(skinname), "%s__%i", loadname, i); + texture = R_LoadTexture8(skinname, outskin->skinwidth, outskin->skinheight, saved, true, alpha); + if (r_fb_models.value) + { + snprintf(skinname, sizeof(skinname), "%s__%i_luma", loadname, i); + fbtexture = R_LoadTextureFB(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true); + } + if (gl_bump.value) + { + snprintf(skinname, sizeof(skinname), "%s__%i_bump", loadname, i); + bumptexture = R_LoadTexture8Bump(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true); + } } } else diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index cd22bc91f..32f9d1b78 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -1008,7 +1008,7 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur int tc, bc; qboolean forced; - if ((e->model->engineflags & MDLF_NOTREPLACEMENTS) && ruleset_allow_sensative_texture_replacements.value) + if ((e->model->engineflags & MDLF_NOTREPLACEMENTS) && !ruleset_allow_sensative_texture_replacements.value) forced = true; else forced = false; @@ -1039,18 +1039,29 @@ 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) + if (forced) { - snprintf(hashname, sizeof(hashname), "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum); - skinname = hashname; - } - else if (surfnum) - { - snprintf(hashname, sizeof(hashname), "%s$%i", modelname, surfnum); + if (e->scoreboard && e->scoreboard->skin) + snprintf(hashname, sizeof(hashname), "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum); + else + snprintf(hashname, sizeof(hashname), "%s$%i", modelname, surfnum); skinname = hashname; } else - skinname = modelname; + { + if (e->scoreboard && e->scoreboard->skin) + { + snprintf(hashname, sizeof(hashname), "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum); + skinname = hashname; + } + else if (surfnum) + { + snprintf(hashname, sizeof(hashname), "%s$%i", modelname, surfnum); + skinname = hashname; + } + else + skinname = modelname; + } if (!skincolourmapped.numbuckets) Hash_InitTable(&skincolourmapped, 256, BZ_Malloc(Hash_BytesForBuckets(256)));