mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +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)
|
Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||||
{
|
{
|
||||||
char name[64];
|
char name[64];
|
||||||
qboolean loaded = true;
|
char filename[MAX_QPATH + 4];
|
||||||
VFile *f;
|
VFile *f;
|
||||||
tex_t *targa;
|
tex_t *targa;
|
||||||
|
|
||||||
snprintf (name, sizeof (name), "%s_%i.tga", loadmodel->name, framenum);
|
snprintf (name, sizeof (name), "%s_%i", loadmodel->name, framenum);
|
||||||
COM_FOpenFile (name, &f);
|
|
||||||
|
snprintf (filename, sizeof (filename), "%s.tga", name);
|
||||||
|
COM_FOpenFile (filename, &f);
|
||||||
if (f) {
|
if (f) {
|
||||||
targa = LoadTGA (f);
|
targa = LoadTGA (f);
|
||||||
Qclose (f);
|
Qclose (f);
|
||||||
if (targa->format < 4)
|
if (targa->format < 4)
|
||||||
pspriteframe->gl_texturenum =
|
pspriteframe->gl_texturenum = GL_LoadTexture (name,
|
||||||
GL_LoadTexture (name, targa->width,
|
targa->width, targa->height, targa->data,
|
||||||
targa->height, targa->data, true, false, 3);
|
true, false, 3);
|
||||||
else
|
else
|
||||||
pspriteframe->gl_texturenum =
|
pspriteframe->gl_texturenum = GL_LoadTexture (name,
|
||||||
GL_LoadTexture (name, targa->width,
|
targa->width, targa->height, targa->data,
|
||||||
targa->height, targa->data, true, true, 4);
|
true, true, 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Con_DPrintf ("Couldn't load %s\n", name);
|
|
||||||
loaded = false;
|
|
||||||
|
|
||||||
snprintf (name, sizeof (name), "%s_%i", loadmodel->name, framenum);
|
|
||||||
pspriteframe->gl_texturenum =
|
pspriteframe->gl_texturenum =
|
||||||
GL_LoadTexture (name, pspriteframe->width, pspriteframe->height,
|
GL_LoadTexture (name, pspriteframe->width, pspriteframe->height,
|
||||||
pspriteframe->pixels, true, true, 1);
|
pspriteframe->pixels, true, true, 1);
|
||||||
|
|
|
@ -46,6 +46,8 @@ static const char rcsid[] =
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
#include "QF/screen.h"
|
#include "QF/screen.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
|
#include "QF/texture.h"
|
||||||
|
#include "QF/tga.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
#include "QF/vfs.h"
|
#include "QF/vfs.h"
|
||||||
#include "QF/vid.h"
|
#include "QF/vid.h"
|
||||||
|
@ -105,13 +107,28 @@ Draw_PicFromWad (const char *name)
|
||||||
{
|
{
|
||||||
glpic_t *gl;
|
glpic_t *gl;
|
||||||
qpic_t *p;
|
qpic_t *p;
|
||||||
|
char filename[MAX_QPATH + 4];
|
||||||
|
VFile *f;
|
||||||
|
tex_t *targa;
|
||||||
|
|
||||||
p = W_GetLumpName (name);
|
p = W_GetLumpName (name);
|
||||||
gl = (glpic_t *) p->data;
|
gl = (glpic_t *) p->data;
|
||||||
|
|
||||||
gl->texnum = GL_LoadTexture (name, p->width, p->height, p->data, false,
|
snprintf (filename, sizeof (filename), "%s.tga", name);
|
||||||
true, 1);
|
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;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue