shithub: qk1

Download patch

ref: 2e939eac354f07bd26437ccce0fb446c6bbc3b7e
parent: f80ce3e92c2456282282b277fc85e96604d9e6fb
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Dec 29 22:24:10 EST 2023

alpha: only 0x00000000 is fully transparent; fix the fullbright fighting alpha blending

--- a/d_alpha.c
+++ b/d_alpha.c
@@ -5,7 +5,8 @@
 {
 	int a, b, c;
 
-	alpha = (ca >> 24)*alpha >> 8;
+	if(ca == 0 || (ca >> 24) != 0)
+		alpha = (ca >> 24)*alpha >> 8;
 
 	if(currententity != nil && currententity->effects & EF_ADDITIVE){
 		ca = R_BlendFog(ca, izi);
--- a/i_tga.c
+++ b/i_tga.c
@@ -129,10 +129,7 @@
 		break;
 	}
 
-	if(a == 0)
-		*out = 0;
-	else
-		*out = a<<24 | r<<16 | g<<8 | b<<0;
+	*out = a == 0 ? 0 : (a<<24 | r<<16 | g<<8 | b<<0);
 	*sz -= h->pxsz;
 	return p + h->pxsz;
 }
--- a/model_sprite.c
+++ b/model_sprite.c
@@ -35,7 +35,7 @@
 		in += size;
 	}else if(mod->ver == SPRITE32_VERSION){
 		for(i = 0; i < size; i++, in += sizeof(pixel_t))
-			pspriteframe->pixels[i] = in[3]<<24 | in[0]<<16 | in[1]<<8 | in[2];
+			pspriteframe->pixels[i] = in[3] == 0 ? 0 : (in[3]<<24 | in[0]<<16 | in[1]<<8 | in[2]);
 		mod->blend = true;
 	}