]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - image.c
Added a couple todo items related to pq_fullpitch
[xonotic/darkplaces.git] / image.c
diff --git a/image.c b/image.c
index 470ea1795019df7a8c0f47e762e18120962f482b..d72ceca744644700e558808c08a4dd86dc1fbd85 100644 (file)
--- a/image.c
+++ b/image.c
@@ -436,6 +436,8 @@ unsigned char *LoadTGA_BGRA (const unsigned char *f, int filesize, int *miplevel
                return NULL;
        }
 
+       memset(palettei, 0, sizeof(palettei));
+
        // advance to end of header
        fin = f + 18;
 
@@ -794,7 +796,6 @@ static unsigned char *LoadWAL_BGRA (const unsigned char *f, int filesize, int *m
 
 qboolean LoadWAL_GetMetadata(const unsigned char *f, int filesize, int *retwidth, int *retheight, int *retflags, int *retvalue, int *retcontents, char *retanimname32c)
 {
-       unsigned char *image_buffer;
        const q2wal_t *inwal = (const q2wal_t *)f;
 
        if (filesize < (int) sizeof(q2wal_t))
@@ -1005,11 +1006,15 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo
                                        if(f)
                                        {
                                                int mymiplevel2 = miplevel ? *miplevel : 0;
+                                               int image_width_save = image_width;
+                                               int image_height_save = image_height;
                                                data2 = format->loadfunc(f, (int)filesize, &mymiplevel2);
-                                               if(data2 && mymiplevel == mymiplevel2)
+                                               if(data2 && mymiplevel == mymiplevel2 && image_width == image_width_save && image_height == image_height_save)
                                                        Image_CopyAlphaFromBlueBGRA(data, data2, image_width, image_height);
                                                else
                                                        Con_Printf("loadimagepixelsrgba: corrupt or invalid alpha image %s_alpha\n", basename);
+                                               image_width = image_width_save;
+                                               image_height = image_height_save;
                                                if(data2)
                                                        Mem_Free(data2);
                                                Mem_Free(f);