]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_draw.c
Merge branch 'master' into Mario/wrath-darkplaces_extra
[xonotic/darkplaces.git] / gl_draw.c
index 2211f261cdd99eb5ddff18a567048d03ba57ae77..3aa8a07fa80978889e60cba629bacfc30ab88ef4 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -267,7 +267,7 @@ cachepic_t *Draw_NewPic(const char *picname, int width, int height, unsigned cha
                if (pic->flags & CACHEPICFLAG_NEWPIC && pic->skinframe && pic->skinframe->base && pic->width == width && pic->height == height)
                {
                        Con_DPrintf("Draw_NewPic(\"%s\"): frame %i: updating texture\n", picname, draw_frame);
-                       R_UpdateTexture(pic->skinframe->base, pixels_bgra, 0, 0, 0, width, height, 1);
+                       R_UpdateTexture(pic->skinframe->base, pixels_bgra, 0, 0, 0, width, height, 1, 0);
                        R_SkinFrame_MarkUsed(pic->skinframe);
                        pic->lastusedframe = draw_frame;
                        return pic;
@@ -323,6 +323,17 @@ void Draw_FreePic(const char *picname)
        }
 }
 
+qbool Draw_PicExists(const char *name) {
+       char vabuf[1024] = { 0 };
+       const char *checkfmt[] = { "%s.tga", "%s.png", "%s.jpg", "%s.pcx" };
+       long unsigned int i;
+       // TODO: actually use the gfx format list for this
+       for (i = 0; i < sizeof(checkfmt) / sizeof(checkfmt[0]); ++i)
+               if (FS_FileExists(va(vabuf, sizeof(vabuf), checkfmt[i], name)))
+                       return true;
+       return false;
+}
+
 static float snap_to_pixel_x(float x, float roundUpAt);
 extern int con_linewidth; // to force rewrapping
 void LoadFont(qbool override, const char *name, dp_font_t *fnt, float scale, float voffset)