shithub: qk1

Download patch

ref: d6265371c542cc4f66ccd1559837ab8a8c3978a3
parent: c8eebb954f8a7d7c7511bf504f3bc20798af3cc3
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Nov 10 11:28:43 EST 2023

Draw_Pic: skip transparent (255) pixels

--- a/draw.c
+++ b/draw.c
@@ -212,7 +212,7 @@
 void Draw_Pic (int x, int y, qpic_t *pic)
 {
 	byte			*dest, *source;
-	int v;
+	int px, py;
 
 	if ((x < 0) ||
 		(x + pic->width > vid.width) ||
@@ -223,8 +223,11 @@
 	}
 	source = pic->data;
 	dest = vid.buffer + y * vid.rowbytes + x;
-	for(v=0; v<pic->height; v++){
-		memcpy(dest, source, pic->width);
+	for(py = 0; py < pic->height; py++){
+		for(px = 0; px < pic->width; px++){
+			if(source[px] != 255)
+				dest[px] = source[px];
+		}
 		dest += vid.rowbytes;
 		source += pic->width;
 	}