X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=image.c;h=4e372a85aea5dbf3e2dd04a918ebb61ef0fd1b1e;hb=c32e446060df3ccfcbec6fa49ab1146ae2ba7076;hp=185c66d360732d772053180d35344fc60c8b50e4;hpb=f716f8f488d519c27082826c81b7420e7dbe1743;p=xonotic%2Fdarkplaces.git diff --git a/image.c b/image.c index 185c66d3..4e372a85 100644 --- a/image.c +++ b/image.c @@ -690,7 +690,10 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, char basename[MAX_QPATH], name[MAX_QPATH], *c; if (developer_memorydebug.integer) Mem_CheckSentinelsGlobal(); - Image_StripImageExtension(filename, basename); // strip filename extensions to allow replacement by other types + 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 // replace *'s with #, so commandline utils don't get confused when dealing with the external files for (c = basename;*c;c++) if (*c == '*') @@ -1300,7 +1303,10 @@ Image_Resample void Image_Resample (const void *indata, int inwidth, int inheight, int indepth, void *outdata, int outwidth, int outheight, int outdepth, int bytesperpixel, int quality) { if (indepth != 1 || outdepth != 1) - Sys_Error("Image_Resample: 3D resampling not supported\n"); + { + Con_Printf ("Image_Resample: 3D resampling not supported\n"); + return; + } if (bytesperpixel == 4) { if (quality) @@ -1316,7 +1322,7 @@ void Image_Resample (const void *indata, int inwidth, int inheight, int indepth, Image_Resample24Nolerp(indata, inwidth, inheight, outdata, outwidth, outheight); } else - Sys_Error("Image_Resample: unsupported bytesperpixel %i\n", bytesperpixel); + Con_Printf ("Image_Resample: unsupported bytesperpixel %i\n", bytesperpixel); } // in can be the same as out @@ -1324,7 +1330,10 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * { int x, y, nextrow; if (*depth != 1 || destdepth != 1) - Sys_Error("Image_Resample: 3D resampling not supported\n"); + { + Con_Printf ("Image_Resample: 3D resampling not supported\n"); + return; + } nextrow = *width * bytesperpixel; if (*width > destwidth) { @@ -1365,7 +1374,7 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * } } else - Sys_Error("Image_MipReduce: unsupported bytesperpixel %i\n", bytesperpixel); + Con_Printf ("Image_MipReduce: unsupported bytesperpixel %i\n", bytesperpixel); } else { @@ -1400,7 +1409,7 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * } } else - Sys_Error("Image_MipReduce: unsupported bytesperpixel %i\n", bytesperpixel); + Con_Printf ("Image_MipReduce: unsupported bytesperpixel %i\n", bytesperpixel); } } else @@ -1441,10 +1450,10 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * } } else - Sys_Error("Image_MipReduce: unsupported bytesperpixel %i\n", bytesperpixel); + Con_Printf ("Image_MipReduce: unsupported bytesperpixel %i\n", bytesperpixel); } else - Sys_Error("Image_MipReduce: desired size already achieved\n"); + Con_Printf ("Image_MipReduce: desired size already achieved\n"); } } @@ -1492,8 +1501,8 @@ void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *ou n[1] = dv[0][2]*dv[1][0]-dv[0][0]*dv[1][2]; n[2] = dv[0][0]*dv[1][1]-dv[0][1]*dv[1][0]; */ - n[0] = ((p1[0] + p1[1] + p1[2]) - (p0[0] + p0[1] + p0[2])); - n[1] = ((p0[0] + p0[1] + p0[2]) - (p2[0] + p2[1] + p2[2])); + n[0] = ((p0[0] + p0[1] + p0[2]) - (p1[0] + p1[1] + p1[2])); + n[1] = ((p2[0] + p2[1] + p2[2]) - (p0[0] + p0[1] + p0[2])); n[2] = ibumpscale; VectorNormalize(n); /* @@ -1519,7 +1528,8 @@ int image_loadskin(imageskin_t *s, char *shadername) qbyte *bumppixels; int bumppixels_width, bumppixels_height; char name[MAX_QPATH]; - Image_StripImageExtension(shadername, name); + strlcpy(name, shadername, sizeof(name)); + Image_StripImageExtension(name, name); memset(s, 0, sizeof(*s)); s->basepixels = loadimagepixels(name, false, 0, 0); if (s->basepixels == NULL)