commit 98c7036

neauoire  ·  2023-11-12 19:21:47 +0000 UTC
parent 7827570
Taken some flags out of 2bpp tight lop
1 files changed,  +9, -7
+9, -7
 1@@ -56,18 +56,20 @@ screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
 2 }
 3 
 4 static void
 5-screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int flipx, int flipy)
 6+screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
 7 {
 8 	int v, h, width = uxn_screen.width, height = uxn_screen.height, opaque = (color % 5);
 9-	Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8;
10+	Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8, mx = (fx > 0 ? 8 : 0), my = (fy < 0 ? 8 : 0);
11+	Uint16 yy = y1 + my;
12 	for(v = 0; v < 8; v++) {
13 		Uint16 c = *ch1++ | (*ch2++ << 8);
14-		Uint16 y = (y1 + (flipy ? 7 - v : v));
15+		Uint16 xx = x1 + mx;
16+		yy += fy;
17 		for(h = 7; h >= 0; --h, c >>= 1) {
18 			Uint8 ch = (c & 1) | ((c >> 7) & 2);
19-			Uint16 x = (x1 + (flipx ? 7 - h : h));
20-			if((opaque || ch) && x < width && y < height)
21-				layer[x + y * width] = blending[ch][color];
22+			xx += -fx;
23+			if((opaque || ch) && xx < width && yy < height)
24+				layer[xx + yy * width] = blending[ch][color];
25 		}
26 	}
27 }
28@@ -270,7 +272,7 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
29 		addr = PEEK2(port_addr), addr_incr = (move & 0x4) << (1 + twobpp);
30 		if(twobpp) {
31 			for(i = 0; i <= length; i++) {
32-				screen_2bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, flipx, flipy);
33+				screen_2bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, fx, fy);
34 				addr += addr_incr;
35 			}
36 		} else {