mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-31 04:30:38 +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
|
typedef struct
|
||||||
{
|
{
|
||||||
char name[16];
|
char name[64];
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int cachedbpp;
|
int cachedbpp;
|
||||||
|
|
|
@ -169,7 +169,10 @@ void Skin_Find (player_info_t *sc)
|
||||||
if (!strcmp (name, skins[i].name))
|
if (!strcmp (name, skins[i].name))
|
||||||
{
|
{
|
||||||
sc->skin = &skins[i];
|
sc->skin = &skins[i];
|
||||||
Skin_Cache8 (sc->skin);
|
if (cls.protocol == CP_QUAKE2)
|
||||||
|
Skin_Cache32 (sc->skin);
|
||||||
|
else
|
||||||
|
Skin_Cache8 (sc->skin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,6 +389,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
||||||
char name[1024];
|
char name[1024];
|
||||||
qbyte *raw;
|
qbyte *raw;
|
||||||
qbyte *out, *pix;
|
qbyte *out, *pix;
|
||||||
|
char *path;
|
||||||
|
|
||||||
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.
|
||||||
|
@ -397,10 +401,15 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
||||||
if (out)
|
if (out)
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
|
if (cls.protocol == CP_QUAKE2)
|
||||||
|
path = "players/";
|
||||||
|
else
|
||||||
|
path = "skins/";
|
||||||
|
|
||||||
//
|
//
|
||||||
// load the pic from disk
|
// load the pic from disk
|
||||||
//
|
//
|
||||||
sprintf (name, "skins/%s.tga", skin->name);
|
sprintf (name, "%s%s.tga", path, skin->name);
|
||||||
raw = COM_LoadTempFile (name);
|
raw = COM_LoadTempFile (name);
|
||||||
if (raw)
|
if (raw)
|
||||||
{
|
{
|
||||||
|
@ -410,10 +419,11 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
||||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||||
memcpy(out, pix, skin->width*skin->height*4);
|
memcpy(out, pix, skin->width*skin->height*4);
|
||||||
BZ_Free(pix);
|
BZ_Free(pix);
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef AVAIL_PNGLIB
|
#ifdef AVAIL_PNGLIB
|
||||||
sprintf (name, "skins/%s.png", skin->name);
|
sprintf (name, "%s%s.png", path, skin->name);
|
||||||
raw = COM_LoadTempFile (name);
|
raw = COM_LoadTempFile (name);
|
||||||
if (raw)
|
if (raw)
|
||||||
{
|
{
|
||||||
|
@ -423,11 +433,12 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
||||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||||
memcpy(out, pix, skin->width*skin->height*4);
|
memcpy(out, pix, skin->width*skin->height*4);
|
||||||
BZ_Free(pix);
|
BZ_Free(pix);
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef AVAIL_JPEGLIB
|
#ifdef AVAIL_JPEGLIB
|
||||||
sprintf (name, "skins/%s.jpeg", skin->name);
|
sprintf (name, "%s%s.jpeg", path, skin->name);
|
||||||
raw = COM_LoadTempFile (name);
|
raw = COM_LoadTempFile (name);
|
||||||
if (raw)
|
if (raw)
|
||||||
{
|
{
|
||||||
|
@ -437,9 +448,10 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
||||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||||
memcpy(out, pix, skin->width*skin->height*4);
|
memcpy(out, pix, skin->width*skin->height*4);
|
||||||
BZ_Free(pix);
|
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);
|
raw = COM_LoadTempFile (name);
|
||||||
if (raw)
|
if (raw)
|
||||||
{
|
{
|
||||||
|
@ -449,6 +461,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
||||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||||
memcpy(out, pix, skin->width*skin->height*4);
|
memcpy(out, pix, skin->width*skin->height*4);
|
||||||
BZ_Free(pix);
|
BZ_Free(pix);
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -490,7 +503,10 @@ void Skin_NextDownload (void)
|
||||||
sc = &cl.players[i];
|
sc = &cl.players[i];
|
||||||
if (!sc->name[0])
|
if (!sc->name[0])
|
||||||
continue;
|
continue;
|
||||||
Skin_Cache8 (sc->skin);
|
if (cls.protocol == CP_QUAKE2)
|
||||||
|
Skin_Cache32(sc->skin);
|
||||||
|
else
|
||||||
|
Skin_Cache8 (sc->skin);
|
||||||
#ifdef RGLQUAKE
|
#ifdef RGLQUAKE
|
||||||
sc->skin = NULL;
|
sc->skin = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue