]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed an R_InitSky warning regarding transpix being uninitialized, added transpixunio...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 13 Sep 2003 20:39:35 +0000 (20:39 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 13 Sep 2003 20:39:35 +0000 (20:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3455 d7cf8633-e32d-0410-b094-e92efae38249

r_sky.c

diff --git a/r_sky.c b/r_sky.c
index 530fc19866ffa2573384a524bdc1a77257e50bfe..2995a85dd6e17dc1f5300cb482637996bb8ba148 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -385,6 +385,12 @@ void R_InitSky (qbyte *src, int bytesperpixel)
        int i, j, p, r, g, b;
        qbyte skyupperlayerpixels[128*128*4], skylowerlayerpixels[128*128*4];
        unsigned trans[128*128], transpix, *rgba;
+       union
+       {
+               int i;
+               qbyte b[4];
+       }
+       transpixunion;
 
        skyavailable_quake = true;
 
@@ -396,6 +402,7 @@ void R_InitSky (qbyte *src, int bytesperpixel)
 
        if (bytesperpixel == 4)
        {
+               transpixunion.i = 0;
                for (i = 0;i < 128;i++)
                        for (j = 0;j < 128;j++)
                                trans[(i*128) + j] = ((unsigned *)src)[i*256+j+128];
@@ -418,11 +425,13 @@ void R_InitSky (qbyte *src, int bytesperpixel)
                        }
                }
 
-               ((qbyte *)&transpix)[0] = r/(128*128);
-               ((qbyte *)&transpix)[1] = g/(128*128);
-               ((qbyte *)&transpix)[2] = b/(128*128);
-               ((qbyte *)&transpix)[3] = 0;
+               transpixunion.i = 0;
+               transpixunion.b[0] = r/(128*128);
+               transpixunion.b[1] = g/(128*128);
+               transpixunion.b[2] = b/(128*128);
+               transpixunion.b[3] = 0;
        }
+       transpix = transpixunion.i;
 
        memcpy(skyupperlayerpixels, trans, 128*128*4);