X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=r_sky.c;h=2995a85dd6e17dc1f5300cb482637996bb8ba148;hp=530fc19866ffa2573384a524bdc1a77257e50bfe;hb=8e8d87ca996c325b99ba8da55f55b117b319f821;hpb=9dc5cfc22338fe6c43b933d3e505fc6e086b83a6 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);