diff --git a/libs/models/sprite/gl_model_sprite.c b/libs/models/sprite/gl_model_sprite.c index 8f3d5f3ac..18c925bc9 100644 --- a/libs/models/sprite/gl_model_sprite.c +++ b/libs/models/sprite/gl_model_sprite.c @@ -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); diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index 5831d1def..5de8d2713 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -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; }