#if 1
// written by LadyHavoc in a readable way, optimized by Vic, further optimized by LadyHavoc (the non-special index case), readable version preserved below this
-void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
+void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qbool inputflipx, qbool inputflipy, qbool inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
{
int index, c, x, y;
const unsigned char *in, *line;
}
#else
// intentionally readable version
-void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
+void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qbool inputflipx, qbool inputflipy, qbool inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
{
int index, c, x, y;
const unsigned char *in, *inrow, *incolumn;
LoadPCX
============
*/
-qboolean LoadPCX_QWSkin(const unsigned char *f, int filesize, unsigned char *pixels, int outwidth, int outheight)
+qbool LoadPCX_QWSkin(const unsigned char *f, int filesize, unsigned char *pixels, int outwidth, int outheight)
{
pcx_t pcx;
unsigned char *a;
LoadPCX
============
*/
-qboolean LoadPCX_PaletteOnly(const unsigned char *f, int filesize, unsigned char *palette768b)
+qbool LoadPCX_PaletteOnly(const unsigned char *f, int filesize, unsigned char *palette768b)
{
if (filesize < 768)
return false;
return image_buffer;
}
-qboolean LoadWAL_GetMetadata(const unsigned char *f, int filesize, int *retwidth, int *retheight, int *retflags, int *retvalue, int *retcontents, char *retanimname32c)
+qbool LoadWAL_GetMetadata(const unsigned char *f, int filesize, int *retwidth, int *retheight, int *retflags, int *retvalue, int *retcontents, char *retanimname32c)
{
const q2wal_t *inwal = (const q2wal_t *)f;
if (ext && (!strcmp(ext, "tga") || !strcmp(ext, "pcx") || !strcmp(ext, "lmp") || !strcmp(ext, "png") || !strcmp(ext, "jpg") || !strcmp(ext, "wal")))
FS_StripExtension(in, out, size_out);
else
- strlcpy(out, in, size_out);
+ dp_strlcpy(out, in, size_out);
}
static unsigned char image_linearfromsrgb[256];
imageformat_t imageformats_tenebrae[] =
{
{"override/%s.tga", LoadTGA_BGRA},
- {"override/%s.TGA", LoadTGA_BGRA},
{"override/%s.png", PNG_LoadImage_BGRA},
- {"override/%s.PNG", PNG_LoadImage_BGRA},
{"override/%s.jpg", JPEG_LoadImage_BGRA},
- {"override/%s.JPG", JPEG_LoadImage_BGRA},
{"override/%s.pcx", LoadPCX_BGRA},
- {"override/%s.PCX", LoadPCX_BGRA},
{"%s.tga", LoadTGA_BGRA},
- {"%s.TGA", LoadTGA_BGRA},
{"%s.png", PNG_LoadImage_BGRA},
- {"%s.PNG", PNG_LoadImage_BGRA},
{"%s.jpg", JPEG_LoadImage_BGRA},
- {"%s.JPG", JPEG_LoadImage_BGRA},
{"%s.pcx", LoadPCX_BGRA},
- {"%s.PCX", LoadPCX_BGRA},
{NULL, NULL}
};
imageformat_t imageformats_nopath[] =
{
{"override/%s.tga", LoadTGA_BGRA},
- {"override/%s.TGA", LoadTGA_BGRA},
{"override/%s.png", PNG_LoadImage_BGRA},
- {"override/%s.PNG", PNG_LoadImage_BGRA},
{"override/%s.jpg", JPEG_LoadImage_BGRA},
- {"override/%s.JPG", JPEG_LoadImage_BGRA},
{"textures/%s.tga", LoadTGA_BGRA},
- {"textures/%s.TGA", LoadTGA_BGRA},
{"textures/%s.png", PNG_LoadImage_BGRA},
- {"textures/%s.PNG", PNG_LoadImage_BGRA},
{"textures/%s.jpg", JPEG_LoadImage_BGRA},
- {"textures/%s.JPG", JPEG_LoadImage_BGRA},
{"%s.tga", LoadTGA_BGRA},
- {"%s.TGA", LoadTGA_BGRA},
{"%s.png", PNG_LoadImage_BGRA},
- {"%s.PNG", PNG_LoadImage_BGRA},
{"%s.jpg", JPEG_LoadImage_BGRA},
- {"%s.JPG", JPEG_LoadImage_BGRA},
{"%s.pcx", LoadPCX_BGRA},
- {"%s.PCX", LoadPCX_BGRA},
{NULL, NULL}
};
imageformat_t imageformats_dq[] =
{
{"%s.tga", LoadTGA_BGRA},
- {"%s.TGA", LoadTGA_BGRA},
{"%s.jpg", JPEG_LoadImage_BGRA},
- {"%s.JPG", JPEG_LoadImage_BGRA},
{"texturemaps/%s.tga", LoadTGA_BGRA},
- {"texturemaps/%s.TGA", LoadTGA_BGRA},
{"texturemaps/%s.jpg", JPEG_LoadImage_BGRA},
- {"texturemaps/%s.JPG", JPEG_LoadImage_BGRA},
{NULL, NULL}
};
imageformat_t imageformats_textures[] =
{
{"%s.tga", LoadTGA_BGRA},
- {"%s.TGA", LoadTGA_BGRA},
{"%s.png", PNG_LoadImage_BGRA},
- {"%s.PNG", PNG_LoadImage_BGRA},
{"%s.jpg", JPEG_LoadImage_BGRA},
- {"%s.JPG", JPEG_LoadImage_BGRA},
{"%s.pcx", LoadPCX_BGRA},
- {"%s.PCX", LoadPCX_BGRA},
{"%s.wal", LoadWAL_BGRA},
- {"%s.WAL", LoadWAL_BGRA},
{NULL, NULL}
};
imageformat_t imageformats_gfx[] =
{
{"%s.tga", LoadTGA_BGRA},
- {"%s.TGA", LoadTGA_BGRA},
{"%s.png", PNG_LoadImage_BGRA},
- {"%s.PNG", PNG_LoadImage_BGRA},
{"%s.jpg", JPEG_LoadImage_BGRA},
- {"%s.JPG", JPEG_LoadImage_BGRA},
{"%s.pcx", LoadPCX_BGRA},
- {"%s.PCX", LoadPCX_BGRA},
{"%s.lmp", LoadLMP_BGRA},
- {"%s.LMP", LoadLMP_BGRA},
{NULL, NULL}
};
imageformat_t imageformats_other[] =
{
{"%s.tga", LoadTGA_BGRA},
- {"%s.TGA", LoadTGA_BGRA},
{"%s.png", PNG_LoadImage_BGRA},
- {"%s.PNG", PNG_LoadImage_BGRA},
{"%s.jpg", JPEG_LoadImage_BGRA},
- {"%s.JPG", JPEG_LoadImage_BGRA},
{"%s.pcx", LoadPCX_BGRA},
- {"%s.PCX", LoadPCX_BGRA},
{"%s.lmp", LoadLMP_BGRA},
- {"%s.LMP", LoadLMP_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)
+unsigned char *loadimagepixelsbgra (const char *filename, qbool complain, qbool allowFixtrans, qbool convertsRGB, int *miplevel)
{
fs_offset_t filesize;
imageformat_t *firstformat, *format;
*c = '#';
path[0] = 0;
name[0] = 0;
- strlcpy(afterpath, basename, sizeof(afterpath));
+ dp_strlcpy(afterpath, basename, sizeof(afterpath));
if (strchr(basename, '/'))
{
int i;
for (i = 0;i < (int)sizeof(path)-1 && basename[i] != '/' && basename[i];i++)
path[i] = basename[i];
path[i] = 0;
- strlcpy(afterpath, basename + i + 1, sizeof(afterpath));
+ dp_strlcpy(afterpath, basename + i + 1, sizeof(afterpath));
}
if (gamemode == GAME_TENEBRAE)
firstformat = imageformats_tenebrae;
for (format = firstformat;format->formatstring;format++)
{
dpsnprintf (name, sizeof(name), format->formatstring, basename);
- f = FS_LoadFile(name, tempmempool, true, &filesize);
- if (f)
+
+ FS_SanitizePath(name);
+
+ if(FS_FileExists(name) && (f = FS_LoadFile(name, tempmempool, true, &filesize)) != NULL)
{
mymiplevel = miplevel ? *miplevel : 0;
image_width = 0;
return NULL;
}
-qboolean Image_GetStockPicSize(const char *filename, int *returnwidth, int *returnheight)
+qbool Image_GetStockPicSize(const char *filename, int *returnwidth, int *returnheight)
{
unsigned char *data;
fs_offset_t filesize;
}
extern cvar_t gl_picmip;
-rtexture_t *loadtextureimage (rtexturepool_t *pool, const char *filename, qboolean complain, int flags, qboolean allowFixtrans, qboolean sRGB)
+rtexture_t *loadtextureimage (rtexturepool_t *pool, const char *filename, qbool complain, int flags, qbool allowFixtrans, qbool sRGB)
{
unsigned char *data;
rtexture_t *rt;
return;
}
filename_pattern = Cmd_Argv(cmd, 1);
- search = FS_Search(filename_pattern, true, true);
+ search = FS_Search(filename_pattern, true, true, NULL);
if(!search)
return;
for(i = 0; i < search->numfilenames; ++i)
FS_FreeSearch(search);
}
-qboolean Image_WriteTGABGR_preflipped (const char *filename, int width, int height, const unsigned char *data)
+qbool Image_WriteTGABGR_preflipped (const char *filename, int width, int height, const unsigned char *data)
{
- qboolean ret;
+ qbool ret;
unsigned char buffer[18];
const void *buffers[2];
fs_offset_t sizes[2];
return ret;
}
-qboolean Image_WriteTGABGRA (const char *filename, int width, int height, const unsigned char *data)
+qbool Image_WriteTGABGRA (const char *filename, int width, int height, const unsigned char *data)
{
int y;
unsigned char *buffer, *out;
const unsigned char *in, *end;
- qboolean ret;
+ qbool ret;
buffer = (unsigned char *)Mem_Alloc(tempmempool, width*height*4 + 18);
}
}
-static const unsigned char concharimage[] =
-{
+
#include "lhfont.h"
-};
static unsigned char *Image_GenerateConChars(void)
{