From 8e8d87ca996c325b99ba8da55f55b117b319f821 Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 13 Sep 2003 20:39:35 +0000 Subject: [PATCH] fixed an R_InitSky warning regarding transpix being uninitialized, added transpixunion to clean up the aliasing mess (thanks to Black for pointing this out) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3455 d7cf8633-e32d-0410-b094-e92efae38249 --- r_sky.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/r_sky.c b/r_sky.c index 530fc198..2995a85d 100644 --- 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); -- 2.39.2