+typedef struct imageformat_s
+{
+ const char *formatstring;
+ unsigned char *(*loadfunc)(const unsigned char *f, int filesize, int *miplevel);
+}
+imageformat_t;
+
+// GAME_TENEBRAE only
+imageformat_t imageformats_tenebrae[] =
+{
+ {"override/%s.tga", LoadTGA_BGRA},
+ {"override/%s.png", PNG_LoadImage_BGRA},
+ {"override/%s.jpg", JPEG_LoadImage_BGRA},
+ {"override/%s.pcx", LoadPCX_BGRA},
+ {"%s.tga", LoadTGA_BGRA},
+ {"%s.png", PNG_LoadImage_BGRA},
+ {"%s.jpg", JPEG_LoadImage_BGRA},
+ {"%s.pcx", LoadPCX_BGRA},
+ {NULL, NULL}
+};
+
+imageformat_t imageformats_nopath[] =
+{
+ {"override/%s.tga", LoadTGA_BGRA},
+ {"override/%s.png", PNG_LoadImage_BGRA},
+ {"override/%s.jpg", JPEG_LoadImage_BGRA},
+ {"textures/%s.tga", LoadTGA_BGRA},
+ {"textures/%s.png", PNG_LoadImage_BGRA},
+ {"textures/%s.jpg", JPEG_LoadImage_BGRA},
+ {"%s.tga", LoadTGA_BGRA},
+ {"%s.png", PNG_LoadImage_BGRA},
+ {"%s.jpg", JPEG_LoadImage_BGRA},
+ {"%s.pcx", LoadPCX_BGRA},
+ {NULL, NULL}
+};
+
+// GAME_DELUXEQUAKE only
+// VorteX: the point why i use such messy texture paths is
+// that GtkRadiant can't detect normal/gloss textures
+// and exclude them from texture browser
+// so i just use additional folder to store this textures
+imageformat_t imageformats_dq[] =
+{
+ {"%s.tga", LoadTGA_BGRA},
+ {"%s.jpg", JPEG_LoadImage_BGRA},
+ {"texturemaps/%s.tga", LoadTGA_BGRA},
+ {"texturemaps/%s.jpg", JPEG_LoadImage_BGRA},
+ {NULL, NULL}
+};
+
+imageformat_t imageformats_textures[] =
+{
+ {"%s.tga", LoadTGA_BGRA},
+ {"%s.png", PNG_LoadImage_BGRA},
+ {"%s.jpg", JPEG_LoadImage_BGRA},
+ {"%s.pcx", LoadPCX_BGRA},
+ {"%s.wal", LoadWAL_BGRA},
+ {NULL, NULL}
+};
+
+imageformat_t imageformats_gfx[] =
+{
+ {"%s.tga", LoadTGA_BGRA},
+ {"%s.png", PNG_LoadImage_BGRA},
+ {"%s.jpg", JPEG_LoadImage_BGRA},
+ {"%s.pcx", LoadPCX_BGRA},
+ {NULL, NULL}
+};
+
+imageformat_t imageformats_other[] =
+{
+ {"%s.tga", LoadTGA_BGRA},
+ {"%s.png", PNG_LoadImage_BGRA},
+ {"%s.jpg", JPEG_LoadImage_BGRA},
+ {"%s.pcx", LoadPCX_BGRA},
+ {NULL, NULL}
+};
+
+int fixtransparentpixels(unsigned char *data, int w, int h);
+unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qboolean allowFixtrans, qboolean convertsRGB, int *miplevel)