commit 224202e

neauoire  ·  2023-11-12 19:36:34 +0000 UTC
parent 98c7036
(Screen) Removed v value
1 files changed,  +7, -7
+7, -7
 1@@ -58,18 +58,18 @@ screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
 2 static void
 3 screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
 4 {
 5-	int v, h, width = uxn_screen.width, height = uxn_screen.height, opaque = (color % 5);
 6-	Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8, mx = (fx > 0 ? 8 : 0), my = (fy < 0 ? 8 : 0);
 7-	Uint16 yy = y1 + my;
 8-	for(v = 0; v < 8; v++) {
 9+	int h, width = uxn_screen.width, height = uxn_screen.height, opaque = (color % 5);
10+	Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8, mx = (fx > 0 ? 8 : 0);
11+	Uint16 y, ymod = (fy < 0 ? 8 : 0), ymax = y1 + ymod + fy * 8;
12+	// Uint16 x, xmod = (fx < 0 ? 8 : 0), xmax = x1 + xmod + fx * 8;
13+	for(y = y1 + ymod; y != ymax; y += fy) {
14 		Uint16 c = *ch1++ | (*ch2++ << 8);
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 			xx += -fx;
20-			if((opaque || ch) && xx < width && yy < height)
21-				layer[xx + yy * width] = blending[ch][color];
22+			if((opaque || ch) && xx < width && y < height)
23+				layer[xx + y * width] = blending[ch][color];
24 		}
25 	}
26 }