return image_buffer;
}
-static unsigned char *LoadLMPRGBA (const unsigned char *f, int filesize, int matchwidth, int matchheight)
-{
- return LoadLMP(f, filesize, matchwidth, matchheight, false);
-}
-
typedef struct q2wal_s
{
}
-void Image_StripImageExtension (const char *in, char *out)
+static void Image_StripImageExtension (const char *in, char *out, size_t size_out)
{
const char *end, *temp;
+
+ if (size_out == 0)
+ return;
+
end = in + strlen(in);
if ((end - in) >= 4)
{
|| strcmp(temp, ".png") == 0
|| strcmp(temp, ".jpg") == 0)
end = temp;
- while (in < end)
+ while (in < end && size_out > 1)
+ {
*out++ = *in++;
+ size_out--;
+ }
*out++ = 0;
}
else
- strcpy(out, in);
+ strlcpy(out, in, size_out);
}
typedef struct imageformat_s
{"override/%s.tga", LoadTGA},
{"override/%s.png", PNG_LoadImage},
{"override/%s.jpg", JPEG_LoadImage},
+ {"override/%s.pcx", LoadPCX},
{NULL, NULL}
};
imageformat_t imageformats_nopath[] =
{
+ {"override/%s.tga", LoadTGA},
+ {"override/%s.png", PNG_LoadImage},
+ {"override/%s.jpg", JPEG_LoadImage},
{"textures/%s.tga", LoadTGA},
{"textures/%s.png", PNG_LoadImage},
{"textures/%s.jpg", JPEG_LoadImage},
{"%s.tga", LoadTGA},
{"%s.png", PNG_LoadImage},
{"%s.jpg", JPEG_LoadImage},
+ {"%s.pcx", LoadPCX},
{NULL, NULL}
};
{"%s.png", PNG_LoadImage},
{"%s.jpg", JPEG_LoadImage},
{"%s.pcx", LoadPCX},
- {"%s.lmp", LoadLMPRGBA},
{NULL, NULL}
};
Mem_CheckSentinelsGlobal();
if (developer_texturelogging.integer)
Log_Printf("textures.log", "%s\n", filename);
- strlcpy(basename, filename, sizeof(basename));
- Image_StripImageExtension(basename, basename); // strip filename extensions to allow replacement by other types
+ Image_StripImageExtension(filename, basename, sizeof(basename)); // strip filename extensions to allow replacement by other types
// replace *'s with #, so commandline utils don't get confused when dealing with the external files
for (c = basename;*c;c++)
if (*c == '*')
unsigned char *bumppixels;
int bumppixels_width, bumppixels_height;
char name[MAX_QPATH];
- strlcpy(name, shadername, sizeof(name));
- Image_StripImageExtension(name, name);
+ Image_StripImageExtension(shadername, name, sizeof(name));
memset(s, 0, sizeof(*s));
s->basepixels = loadimagepixels(name, false, 0, 0);
if (s->basepixels == NULL)