mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 05:41:52 +00:00
------------------------------------------------------------------------
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;
|
int height;
|
||||||
|
|
||||||
//for hardware 32bit texture overrides
|
//for hardware 32bit texture overrides
|
||||||
texid_t tex_base;
|
texnums_t textures;
|
||||||
texid_t tex_lower;
|
|
||||||
texid_t tex_upper;
|
|
||||||
|
|
||||||
qboolean failedload; // the name isn't a valid skin
|
qboolean failedload; // the name isn't a valid skin
|
||||||
cache_user_t cache;
|
cache_user_t cache;
|
||||||
|
|
|
@ -185,6 +185,14 @@ typedef struct texid_s texid_tf;
|
||||||
#define TEXASSIGNF(d,s) memcpy(&d,&s,sizeof(d))
|
#define TEXASSIGNF(d,s) memcpy(&d,&s,sizeof(d))
|
||||||
#define TEXVALID(t) 1
|
#define TEXVALID(t) 1
|
||||||
#endif
|
#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
|
typedef enum uploadfmt
|
||||||
{
|
{
|
||||||
TF_INVALID,
|
TF_INVALID,
|
||||||
|
|
|
@ -216,6 +216,7 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
||||||
int dataByte;
|
int dataByte;
|
||||||
int runLength;
|
int runLength;
|
||||||
int fbremap[256];
|
int fbremap[256];
|
||||||
|
char *skinpath;
|
||||||
|
|
||||||
if (noskins.value==1) // JACK: So NOSKINS > 1 will show skins, but
|
if (noskins.value==1) // JACK: So NOSKINS > 1 will show skins, but
|
||||||
return NULL; // not download new ones.
|
return NULL; // not download new ones.
|
||||||
|
@ -223,9 +224,9 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
||||||
if (skin->failedload)
|
if (skin->failedload)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
TEXASSIGN(skin->tex_base, r_nulltex);
|
TEXASSIGN(skin->textures.base, r_nulltex);
|
||||||
TEXASSIGN(skin->tex_lower, r_nulltex);
|
TEXASSIGN(skin->textures.loweroverlay, r_nulltex);
|
||||||
TEXASSIGN(skin->tex_upper, r_nulltex);
|
TEXASSIGN(skin->textures.upperoverlay, r_nulltex);
|
||||||
|
|
||||||
out = Cache_Check (&skin->cache);
|
out = Cache_Check (&skin->cache);
|
||||||
if (out)
|
if (out)
|
||||||
|
@ -267,25 +268,55 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
||||||
|
|
||||||
#ifdef Q2CLIENT
|
#ifdef Q2CLIENT
|
||||||
if (cls.protocol == CP_QUAKE2)
|
if (cls.protocol == CP_QUAKE2)
|
||||||
Q_snprintfz (name, sizeof(name), "players/%s.pcx", skin->name);
|
skinpath = "players";
|
||||||
else
|
else
|
||||||
#endif
|
#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);
|
raw = COM_LoadTempFile (name);
|
||||||
if (!raw)
|
if (!raw)
|
||||||
{
|
{
|
||||||
|
//use 24bit skins even if gl_load24bit is failed
|
||||||
if (strcmp(skin->name, baseskin.string))
|
if (strcmp(skin->name, baseskin.string))
|
||||||
{
|
{
|
||||||
TEXASSIGN(skin->tex_base, R_LoadReplacementTexture(skin->name, "skins", IF_NOALPHA));
|
if (!gl_load24bit.value)
|
||||||
if (TEXVALID(skin->tex_base))
|
|
||||||
{
|
{
|
||||||
Q_snprintfz (name, sizeof(name), "%s_shirt", skin->name);
|
TEXASSIGN(skin->textures.base, R_LoadHiResTexture(skin->name, skinpath, IF_NOALPHA));
|
||||||
TEXASSIGN(skin->tex_upper, R_LoadReplacementTexture(name, "skins", 0));
|
if (TEXVALID(skin->textures.base))
|
||||||
Q_snprintfz (name, sizeof(name), "%s_pants", skin->name);
|
{
|
||||||
TEXASSIGN(skin->tex_lower, R_LoadReplacementTexture(name, "skins", 0));
|
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;
|
Q_snprintfz (name, sizeof(name), "%s_luma", skin->name);
|
||||||
return NULL;
|
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).
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GL_GAliasFlushSkinCache();
|
||||||
for (i=0 ; i<numskins ; i++)
|
for (i=0 ; i<numskins ; i++)
|
||||||
{
|
{
|
||||||
if (skins[i].cache.data)
|
if (skins[i].cache.data)
|
||||||
|
|
|
@ -158,7 +158,27 @@ static void R_GAliasApplyLighting(mesh_t *mesh, vec3_t org, vec3_t angles, float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
void GL_GAliasFlushSkinCache(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -206,9 +226,12 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
||||||
{
|
{
|
||||||
shader_t *s;
|
shader_t *s;
|
||||||
s = R_RegisterSkin(va("gfx/skin%d.lmp", e->skinnum), NULL);
|
s = R_RegisterSkin(va("gfx/skin%d.lmp", e->skinnum), NULL);
|
||||||
if (!TEXVALID(s->defaulttextures.base))
|
if (s)
|
||||||
s->defaulttextures.base = R_LoadHiResTexture(va("gfx/skin%d.lmp", e->skinnum), NULL, 0);
|
{
|
||||||
return 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.loweroverlay = plskin->textures.loweroverlay;
|
||||||
cm->texnum.upperoverlay = plskin->tex_upper;
|
cm->texnum.upperoverlay = plskin->textures.upperoverlay;
|
||||||
cm->texnum.base = plskin->tex_base;
|
cm->texnum.base = plskin->textures.base;
|
||||||
|
cm->texnum.fullbright = plskin->textures.fullbright;
|
||||||
|
cm->texnum.specular = plskin->textures.specular;
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,11 +393,13 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
||||||
inwidth = plskin->width;
|
inwidth = plskin->width;
|
||||||
inheight = plskin->height;
|
inheight = plskin->height;
|
||||||
|
|
||||||
if (!original && TEXVALID(plskin->tex_base))
|
if (!original && TEXVALID(plskin->textures.base))
|
||||||
{
|
{
|
||||||
cm->texnum.loweroverlay = plskin->tex_lower;
|
cm->texnum.loweroverlay = plskin->textures.loweroverlay;
|
||||||
cm->texnum.upperoverlay = plskin->tex_upper;
|
cm->texnum.upperoverlay = plskin->textures.upperoverlay;
|
||||||
cm->texnum.base = plskin->tex_base;
|
cm->texnum.base = plskin->textures.base;
|
||||||
|
cm->texnum.fullbright = plskin->textures.fullbright;
|
||||||
|
cm->texnum.specular = plskin->textures.specular;
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,15 +242,6 @@ typedef struct mplane_s
|
||||||
qbyte pad[2];
|
qbyte pad[2];
|
||||||
} mplane_t;
|
} 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
|
typedef struct vboarray_s
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
|
|
Loading…
Reference in a new issue