------------------------------------------------------------------------
r4203 | acceptthis | 2013-02-15 01:42:44 +0000 (Fri, 15 Feb 2013) | 1 line Be more promiscuous with high-res skins, and flush them etc. ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4201 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
c7bc101e12
commit
00c3b4f1f0
5 changed files with 93 additions and 37 deletions
|
@ -28,9 +28,7 @@ typedef struct
|
|||
int height;
|
||||
|
||||
//for hardware 32bit texture overrides
|
||||
texid_t tex_base;
|
||||
texid_t tex_lower;
|
||||
texid_t tex_upper;
|
||||
texnums_t textures;
|
||||
|
||||
qboolean failedload; // the name isn't a valid skin
|
||||
cache_user_t cache;
|
||||
|
|
|
@ -185,6 +185,14 @@ typedef struct texid_s texid_tf;
|
|||
#define TEXASSIGNF(d,s) memcpy(&d,&s,sizeof(d))
|
||||
#define TEXVALID(t) 1
|
||||
#endif
|
||||
typedef struct texnums_s {
|
||||
texid_t base;
|
||||
texid_t bump;
|
||||
texid_t upperoverlay;
|
||||
texid_t loweroverlay;
|
||||
texid_t specular;
|
||||
texid_t fullbright;
|
||||
} texnums_t;
|
||||
typedef enum uploadfmt
|
||||
{
|
||||
TF_INVALID,
|
||||
|
|
|
@ -216,6 +216,7 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
int dataByte;
|
||||
int runLength;
|
||||
int fbremap[256];
|
||||
char *skinpath;
|
||||
|
||||
if (noskins.value==1) // JACK: So NOSKINS > 1 will show skins, but
|
||||
return NULL; // not download new ones.
|
||||
|
@ -223,9 +224,9 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
if (skin->failedload)
|
||||
return NULL;
|
||||
|
||||
TEXASSIGN(skin->tex_base, r_nulltex);
|
||||
TEXASSIGN(skin->tex_lower, r_nulltex);
|
||||
TEXASSIGN(skin->tex_upper, r_nulltex);
|
||||
TEXASSIGN(skin->textures.base, r_nulltex);
|
||||
TEXASSIGN(skin->textures.loweroverlay, r_nulltex);
|
||||
TEXASSIGN(skin->textures.upperoverlay, r_nulltex);
|
||||
|
||||
out = Cache_Check (&skin->cache);
|
||||
if (out)
|
||||
|
@ -267,25 +268,55 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
|
||||
#ifdef Q2CLIENT
|
||||
if (cls.protocol == CP_QUAKE2)
|
||||
Q_snprintfz (name, sizeof(name), "players/%s.pcx", skin->name);
|
||||
skinpath = "players";
|
||||
else
|
||||
#endif
|
||||
Q_snprintfz (name, sizeof(name), "skins/%s.pcx", skin->name);
|
||||
skinpath = "skins";
|
||||
|
||||
//favour 24bit+recoloured skins if gl_load24bit is enabled.
|
||||
Q_snprintfz (name, sizeof(name), "%s_shirt", skin->name);
|
||||
TEXASSIGN(skin->textures.upperoverlay, R_LoadReplacementTexture(name, skinpath, 0));
|
||||
Q_snprintfz (name, sizeof(name), "%s_pants", skin->name);
|
||||
TEXASSIGN(skin->textures.loweroverlay, R_LoadReplacementTexture(name, skinpath, 0));
|
||||
if (TEXVALID(skin->textures.upperoverlay) || TEXVALID(skin->textures.loweroverlay))
|
||||
{
|
||||
TEXASSIGN(skin->textures.base, R_LoadReplacementTexture(skin->name, skinpath, IF_NOALPHA));
|
||||
if (TEXVALID(skin->textures.base))
|
||||
{
|
||||
Q_snprintfz (name, sizeof(name), "%s_luma", skin->name);
|
||||
TEXASSIGN(skin->textures.fullbright, R_LoadReplacementTexture(skin->name, skinpath, IF_NOALPHA));
|
||||
Q_snprintfz (name, sizeof(name), "%s_gloss", skin->name);
|
||||
TEXASSIGN(skin->textures.specular, R_LoadReplacementTexture(skin->name, skinpath, 0));
|
||||
skin->failedload = true;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Q_snprintfz (name, sizeof(name), "%s/%s.pcx", skinpath, skin->name);
|
||||
raw = COM_LoadTempFile (name);
|
||||
if (!raw)
|
||||
{
|
||||
//use 24bit skins even if gl_load24bit is failed
|
||||
if (strcmp(skin->name, baseskin.string))
|
||||
{
|
||||
TEXASSIGN(skin->tex_base, R_LoadReplacementTexture(skin->name, "skins", IF_NOALPHA));
|
||||
if (TEXVALID(skin->tex_base))
|
||||
if (!gl_load24bit.value)
|
||||
{
|
||||
Q_snprintfz (name, sizeof(name), "%s_shirt", skin->name);
|
||||
TEXASSIGN(skin->tex_upper, R_LoadReplacementTexture(name, "skins", 0));
|
||||
Q_snprintfz (name, sizeof(name), "%s_pants", skin->name);
|
||||
TEXASSIGN(skin->tex_lower, R_LoadReplacementTexture(name, "skins", 0));
|
||||
TEXASSIGN(skin->textures.base, R_LoadHiResTexture(skin->name, skinpath, IF_NOALPHA));
|
||||
if (TEXVALID(skin->textures.base))
|
||||
{
|
||||
Q_snprintfz (name, sizeof(name), "%s_shirt", skin->name);
|
||||
TEXASSIGN(skin->textures.upperoverlay, R_LoadHiResTexture(name, skinpath, 0));
|
||||
Q_snprintfz (name, sizeof(name), "%s_pants", skin->name);
|
||||
TEXASSIGN(skin->textures.loweroverlay, R_LoadHiResTexture(name, skinpath, 0));
|
||||
|
||||
skin->failedload = true;
|
||||
return NULL;
|
||||
Q_snprintfz (name, sizeof(name), "%s_luma", skin->name);
|
||||
TEXASSIGN(skin->textures.fullbright, R_LoadHiResTexture(skin->name, skinpath, IF_NOALPHA));
|
||||
Q_snprintfz (name, sizeof(name), "%s_gloss", skin->name);
|
||||
TEXASSIGN(skin->textures.specular, R_LoadHiResTexture(skin->name, skinpath, 0));
|
||||
|
||||
skin->failedload = true;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//if its not already the base skin, try the base (and warn if anything not base couldn't load).
|
||||
|
@ -620,6 +651,7 @@ void Skin_Skins_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
GL_GAliasFlushSkinCache();
|
||||
for (i=0 ; i<numskins ; i++)
|
||||
{
|
||||
if (skins[i].cache.data)
|
||||
|
|
|
@ -158,7 +158,27 @@ static void R_GAliasApplyLighting(mesh_t *mesh, vec3_t org, vec3_t angles, float
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
void GL_GAliasFlushOneSkin(char *skinname)
|
||||
{
|
||||
int i;
|
||||
bucket_t **l;
|
||||
galiascolourmapped_t *cm;
|
||||
for (i = 0; i < skincolourmapped.numbuckets; i++)
|
||||
{
|
||||
for(l = &skincolourmapped.bucket[i]; *l; )
|
||||
{
|
||||
cm = (*l)->data;
|
||||
if (strstr(cm->name, skinname))
|
||||
{
|
||||
*l = cm->bucket.next;
|
||||
BZ_Free(cm);
|
||||
continue;
|
||||
}
|
||||
l = &(*l)->next;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
void GL_GAliasFlushSkinCache(void)
|
||||
{
|
||||
int i;
|
||||
|
@ -206,9 +226,12 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
{
|
||||
shader_t *s;
|
||||
s = R_RegisterSkin(va("gfx/skin%d.lmp", e->skinnum), NULL);
|
||||
if (!TEXVALID(s->defaulttextures.base))
|
||||
s->defaulttextures.base = R_LoadHiResTexture(va("gfx/skin%d.lmp", e->skinnum), NULL, 0);
|
||||
return s;
|
||||
if (s)
|
||||
{
|
||||
if (!TEXVALID(s->defaulttextures.base))
|
||||
s->defaulttextures.base = R_LoadHiResTexture(va("gfx/skin%d.lmp", e->skinnum), NULL, 0);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,11 +369,13 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
}
|
||||
}
|
||||
|
||||
if (TEXVALID(plskin->tex_base))
|
||||
if (TEXVALID(plskin->textures.base))
|
||||
{
|
||||
cm->texnum.loweroverlay = plskin->tex_lower;
|
||||
cm->texnum.upperoverlay = plskin->tex_upper;
|
||||
cm->texnum.base = plskin->tex_base;
|
||||
cm->texnum.loweroverlay = plskin->textures.loweroverlay;
|
||||
cm->texnum.upperoverlay = plskin->textures.upperoverlay;
|
||||
cm->texnum.base = plskin->textures.base;
|
||||
cm->texnum.fullbright = plskin->textures.fullbright;
|
||||
cm->texnum.specular = plskin->textures.specular;
|
||||
return shader;
|
||||
}
|
||||
|
||||
|
@ -368,11 +393,13 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
inwidth = plskin->width;
|
||||
inheight = plskin->height;
|
||||
|
||||
if (!original && TEXVALID(plskin->tex_base))
|
||||
if (!original && TEXVALID(plskin->textures.base))
|
||||
{
|
||||
cm->texnum.loweroverlay = plskin->tex_lower;
|
||||
cm->texnum.upperoverlay = plskin->tex_upper;
|
||||
cm->texnum.base = plskin->tex_base;
|
||||
cm->texnum.loweroverlay = plskin->textures.loweroverlay;
|
||||
cm->texnum.upperoverlay = plskin->textures.upperoverlay;
|
||||
cm->texnum.base = plskin->textures.base;
|
||||
cm->texnum.fullbright = plskin->textures.fullbright;
|
||||
cm->texnum.specular = plskin->textures.specular;
|
||||
return shader;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,15 +242,6 @@ typedef struct mplane_s
|
|||
qbyte pad[2];
|
||||
} mplane_t;
|
||||
|
||||
typedef struct texnums_s {
|
||||
texid_t base;
|
||||
texid_t bump;
|
||||
texid_t upperoverlay;
|
||||
texid_t loweroverlay;
|
||||
texid_t specular;
|
||||
texid_t fullbright;
|
||||
} texnums_t;
|
||||
|
||||
typedef struct vboarray_s
|
||||
{
|
||||
union
|
||||
|
|
Loading…
Reference in a new issue