]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - image.c
added debug prints to FRIK_FILE fopen/fclose builtins
[xonotic/darkplaces.git] / image.c
diff --git a/image.c b/image.c
index 745aac100106482b53c0742ab6e24a01f6c2058b..ebed474304d363f9e75d7af9a7d5169247d0dea2 100644 (file)
--- a/image.c
+++ b/image.c
@@ -692,7 +692,8 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth,
                Mem_CheckSentinelsGlobal();
        if (developer_texturelogging.integer)
                Log_Printf("textures.log", "%s\n", filename);
-       Image_StripImageExtension(filename, basename); // strip filename extensions to allow replacement by other types
+       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 == '*')
@@ -1494,8 +1495,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);
                        /*
@@ -1521,7 +1522,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)