mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
cleanup, implemented tga loading for gfx.wad files
This commit is contained in:
parent
5c2a17f7a8
commit
9c1969146c
2 changed files with 31 additions and 16 deletions
|
@ -50,29 +50,27 @@ void
|
|||
Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||
{
|
||||
char name[64];
|
||||
qboolean loaded = true;
|
||||
char filename[MAX_QPATH + 4];
|
||||
VFile *f;
|
||||
tex_t *targa;
|
||||
|
||||
snprintf (name, sizeof (name), "%s_%i.tga", loadmodel->name, framenum);
|
||||
COM_FOpenFile (name, &f);
|
||||
snprintf (name, sizeof (name), "%s_%i", loadmodel->name, framenum);
|
||||
|
||||
snprintf (filename, sizeof (filename), "%s.tga", name);
|
||||
COM_FOpenFile (filename, &f);
|
||||
if (f) {
|
||||
targa = LoadTGA (f);
|
||||
Qclose (f);
|
||||
if (targa->format < 4)
|
||||
pspriteframe->gl_texturenum =
|
||||
GL_LoadTexture (name, targa->width,
|
||||
targa->height, targa->data, true, false, 3);
|
||||
pspriteframe->gl_texturenum = GL_LoadTexture (name,
|
||||
targa->width, targa->height, targa->data,
|
||||
true, false, 3);
|
||||
else
|
||||
pspriteframe->gl_texturenum =
|
||||
GL_LoadTexture (name, targa->width,
|
||||
targa->height, targa->data, true, true, 4);
|
||||
pspriteframe->gl_texturenum = GL_LoadTexture (name,
|
||||
targa->width, targa->height, targa->data,
|
||||
true, true, 4);
|
||||
return;
|
||||
}
|
||||
Con_DPrintf ("Couldn't load %s\n", name);
|
||||
loaded = false;
|
||||
|
||||
snprintf (name, sizeof (name), "%s_%i", loadmodel->name, framenum);
|
||||
pspriteframe->gl_texturenum =
|
||||
GL_LoadTexture (name, pspriteframe->width, pspriteframe->height,
|
||||
pspriteframe->pixels, true, true, 1);
|
||||
|
|
|
@ -46,6 +46,8 @@ static const char rcsid[] =
|
|||
#include "QF/render.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/texture.h"
|
||||
#include "QF/tga.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/vfs.h"
|
||||
#include "QF/vid.h"
|
||||
|
@ -105,13 +107,28 @@ Draw_PicFromWad (const char *name)
|
|||
{
|
||||
glpic_t *gl;
|
||||
qpic_t *p;
|
||||
char filename[MAX_QPATH + 4];
|
||||
VFile *f;
|
||||
tex_t *targa;
|
||||
|
||||
p = W_GetLumpName (name);
|
||||
gl = (glpic_t *) p->data;
|
||||
|
||||
gl->texnum = GL_LoadTexture (name, p->width, p->height, p->data, false,
|
||||
true, 1);
|
||||
|
||||
snprintf (filename, sizeof (filename), "%s.tga", name);
|
||||
COM_FOpenFile (filename, &f);
|
||||
if (f) {
|
||||
targa = LoadTGA (f);
|
||||
Qclose (f);
|
||||
if (targa->format < 4)
|
||||
gl->texnum = GL_LoadTexture (name, targa->width,
|
||||
targa->height, targa->data, false, false, 3);
|
||||
else
|
||||
gl->texnum = GL_LoadTexture (name, targa->width,
|
||||
targa->height, targa->data, false, true, 4);
|
||||
return p;
|
||||
}
|
||||
gl->texnum = GL_LoadTexture (name, p->width, p->height,
|
||||
p->data, false, true, 1);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue