external tga skin loading, doesn't work for players (teamcolor stuff)

This commit is contained in:
Seth Galbraith 2002-01-16 20:32:39 +00:00
parent 9dedd21158
commit 778af4276e
6 changed files with 68 additions and 0 deletions

View file

@ -455,6 +455,7 @@ mleaf_t *Mod_PointInLeaf (const vec3_t p, model_t *model);
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
model_t *Mod_FindName (const char *name);
void Mod_ProcessTexture(miptex_t *mt, texture_t *tx);
void Mod_LoadExternalSkins (model_t * mod);
void Mod_LoadExternalTextures (model_t * mod);
void Mod_LoadLighting (lump_t *l);
int Mod_CalcFullbright (byte *in, byte *out, int pixels);

View file

@ -45,6 +45,9 @@ static const char rcsid[] =
#include "QF/qendian.h"
#include "QF/skin.h"
#include "QF/sys.h"
#include "QF/texture.h"
#include "QF/tga.h"
#include "QF/vfs.h"
#include "QF/vid.h"
#include "QF/GL/qf_textures.h"
@ -263,3 +266,50 @@ Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
VectorScale (hdr->mdl.scale, 2, hdr->mdl.scale);
}
}
void
Mod_LoadExternalSkin (maliasskindesc_t *pskindesc, char *filename)
{
VFile *f;
tex_t *targa;
COM_FOpenFile (filename, &f);
if (f)
{
targa = LoadTGA (f);
Qclose (f);
if (targa->format < 4)
pskindesc->texnum = GL_LoadTexture ("", targa->width,
targa->height, targa->data, true, false, 3);
else
pskindesc->texnum = GL_LoadTexture ("", targa->width,
targa->height, targa->data, true, true, 4);
}
}
void
Mod_LoadExternalSkins (model_t *mod)
{
char filename[MAX_QPATH + 4];
aliashdr_t *paliashdr;
maliasskindesc_t *pskindesc;
maliasskingroup_t *pskingroup;
int i, j;
paliashdr = Cache_Get (&mod->cache);
for (i = 0; i < paliashdr->mdl.numskins; i++) {
pskindesc = ((maliasskindesc_t *)
((byte *) paliashdr + paliashdr->skindesc)) + i;
if (pskindesc->type == ALIAS_SKIN_SINGLE) {
snprintf (filename, sizeof (filename), "%s_%i.tga", mod->name, i);
Mod_LoadExternalSkin (pskindesc, filename);
} else {
pskingroup = (maliasskingroup_t *)
((byte *) paliashdr + pskindesc->skin);
for (j = 0; j < pskingroup->numskins; j++) {
snprintf (filename, sizeof (filename), "%s_%i_%i.tga", mod->name, i, j);
Mod_LoadExternalSkin (pskingroup->skindescs + j, filename);
}
}
}
}

View file

@ -218,3 +218,9 @@ void
Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
{
}
void
Mod_LoadExternalSkins (model_t *mod)
{
}

View file

@ -217,6 +217,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
case IDPOLYHEADER:
case POLYHEADER16:
Mod_LoadAliasModel (mod, buf, allocator);
Mod_LoadExternalSkins (mod);
break;
case IDSPRITEHEADER:

View file

@ -67,6 +67,11 @@ Mod_ProcessTexture (miptex_t *mx, texture_t *tx)
{
}
void
Mod_LoadExternalSkins (model_t *mod)
{
}
void
Mod_LoadExternalTextures (model_t *mod)
{

View file

@ -67,6 +67,11 @@ Mod_ProcessTexture (miptex_t *mx, texture_t *tx)
{
}
void
Mod_LoadExternalSkins (model_t *mod)
{
}
void
Mod_LoadExternalTextures (model_t *mod)
{