mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
Allow longer skin names, and get q2 using 24bit player skins.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2005 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5ab43cc90e
commit
f8a1789089
2 changed files with 23 additions and 7 deletions
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char name[16];
|
||||
char name[64];
|
||||
int width;
|
||||
int height;
|
||||
int cachedbpp;
|
||||
|
|
|
@ -169,7 +169,10 @@ void Skin_Find (player_info_t *sc)
|
|||
if (!strcmp (name, skins[i].name))
|
||||
{
|
||||
sc->skin = &skins[i];
|
||||
Skin_Cache8 (sc->skin);
|
||||
if (cls.protocol == CP_QUAKE2)
|
||||
Skin_Cache32 (sc->skin);
|
||||
else
|
||||
Skin_Cache8 (sc->skin);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -386,6 +389,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
char name[1024];
|
||||
qbyte *raw;
|
||||
qbyte *out, *pix;
|
||||
char *path;
|
||||
|
||||
if (noskins.value==1) // JACK: So NOSKINS > 1 will show skins, but
|
||||
return NULL; // not download new ones.
|
||||
|
@ -397,10 +401,15 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
if (out)
|
||||
return out;
|
||||
|
||||
if (cls.protocol == CP_QUAKE2)
|
||||
path = "players/";
|
||||
else
|
||||
path = "skins/";
|
||||
|
||||
//
|
||||
// load the pic from disk
|
||||
//
|
||||
sprintf (name, "skins/%s.tga", skin->name);
|
||||
sprintf (name, "%s%s.tga", path, skin->name);
|
||||
raw = COM_LoadTempFile (name);
|
||||
if (raw)
|
||||
{
|
||||
|
@ -410,10 +419,11 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
#ifdef AVAIL_PNGLIB
|
||||
sprintf (name, "skins/%s.png", skin->name);
|
||||
sprintf (name, "%s%s.png", path, skin->name);
|
||||
raw = COM_LoadTempFile (name);
|
||||
if (raw)
|
||||
{
|
||||
|
@ -423,11 +433,12 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef AVAIL_JPEGLIB
|
||||
sprintf (name, "skins/%s.jpeg", skin->name);
|
||||
sprintf (name, "%s%s.jpeg", path, skin->name);
|
||||
raw = COM_LoadTempFile (name);
|
||||
if (raw)
|
||||
{
|
||||
|
@ -437,9 +448,10 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
sprintf (name, "skins/%s.jpg", skin->name); //jpegs are gready with 2 extensions...
|
||||
sprintf (name, "%s%s.jpg", path, skin->name); //jpegs are gready with 2 extensions...
|
||||
raw = COM_LoadTempFile (name);
|
||||
if (raw)
|
||||
{
|
||||
|
@ -449,6 +461,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -490,7 +503,10 @@ void Skin_NextDownload (void)
|
|||
sc = &cl.players[i];
|
||||
if (!sc->name[0])
|
||||
continue;
|
||||
Skin_Cache8 (sc->skin);
|
||||
if (cls.protocol == CP_QUAKE2)
|
||||
Skin_Cache32(sc->skin);
|
||||
else
|
||||
Skin_Cache8 (sc->skin);
|
||||
#ifdef RGLQUAKE
|
||||
sc->skin = NULL;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue