commit ff63e12

neauoire  ·  2023-11-13 01:00:21 +0000 UTC
parent ee7a69c
(Screen) Pass addr to sprite
1 files changed,  +9, -9
+9, -9
 1@@ -61,10 +61,10 @@ 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 fx, int fy)
 6+screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
 7 {
 8 	int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5);
 9-	Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8;
10+	Uint8 *ch1 = addr, *ch2 = ch1 + 8;
11 	Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
12 	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
13 	for(y = y1 + ymod; y != ymax; y += fy) {
14@@ -79,10 +79,10 @@ screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16
15 }
16 
17 static void
18-screen_1bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
19+screen_1bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
20 {
21 	int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5);
22-	Uint8 *ch1 = &ram[addr];
23+	Uint8 *ch1 = addr;
24 	Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
25 	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
26 	for(y = y1 + ymod; y != ymax; y += fy) {
27@@ -116,8 +116,8 @@ static Uint8 arrow[] = {
28 static void
29 draw_byte(Uint8 b, Uint16 x, Uint16 y, Uint8 color)
30 {
31-	screen_1bpp(uxn_screen.fg, icons, (b >> 4) << 3, x, y, color, 1, 1);
32-	screen_1bpp(uxn_screen.fg, icons, (b & 0xf) << 3, x + 8, y, color, 1, 1);
33+	screen_1bpp(uxn_screen.fg, &icons[(b >> 4) << 3], x, y, color, 1, 1);
34+	screen_1bpp(uxn_screen.fg, &icons[(b & 0xf) << 3], x + 8, y, color, 1, 1);
35 	screen_change(x, y, x + 0x10, y + 0x8);
36 }
37 
38@@ -139,7 +139,7 @@ screen_debugger(Uxn *u)
39                                             0x2;
40 		draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color);
41 	}
42-	screen_1bpp(uxn_screen.fg, arrow, 0, 0x68, uxn_screen.height - 0x20, 3, 1, 1);
43+	screen_1bpp(uxn_screen.fg, &arrow[0], 0x68, uxn_screen.height - 0x20, 3, 1, 1);
44 	for(i = 0; i < 0x20; i++)
45 		draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
46 }
47@@ -273,12 +273,12 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
48 		addr = PEEK2(port_addr), addr_incr = (move & 0x4) << (1 + twobpp);
49 		if(twobpp) {
50 			for(i = 0; i <= length; i++) {
51-				screen_2bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, fx, fy);
52+				screen_2bpp(layer, &ram[addr], x + dyx * i, y + dxy * i, color, fx, fy);
53 				addr += addr_incr;
54 			}
55 		} else {
56 			for(i = 0; i <= length; i++) {
57-				screen_1bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, fx, fy);
58+				screen_1bpp(layer, &ram[addr], x + dyx * i, y + dxy * i, color, fx, fy);
59 				addr += addr_incr;
60 			}
61 		}