Browse code

(Screen) Pass addr to sprite

neauoire authored on 13/11/2023 01:01:16
Showing 1 changed files
... ...
@@ -61,10 +61,10 @@ screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
61 61
 }
62 62
 
63 63
 static void
64
-screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
64
+screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
65 65
 {
66 66
 	int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5);
67
-	Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8;
67
+	Uint8 *ch1 = addr, *ch2 = ch1 + 8;
68 68
 	Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
69 69
 	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
70 70
 	for(y = y1 + ymod; y != ymax; y += fy) {
... ...
@@ -79,10 +79,10 @@ screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16
79 79
 }
80 80
 
81 81
 static void
82
-screen_1bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
82
+screen_1bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
83 83
 {
84 84
 	int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5);
85
-	Uint8 *ch1 = &ram[addr];
85
+	Uint8 *ch1 = addr;
86 86
 	Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
87 87
 	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
88 88
 	for(y = y1 + ymod; y != ymax; y += fy) {
... ...
@@ -116,8 +116,8 @@ static Uint8 arrow[] = {
116 116
 static void
117 117
 draw_byte(Uint8 b, Uint16 x, Uint16 y, Uint8 color)
118 118
 {
119
-	screen_1bpp(uxn_screen.fg, icons, (b >> 4) << 3, x, y, color, 1, 1);
120
-	screen_1bpp(uxn_screen.fg, icons, (b & 0xf) << 3, x + 8, y, color, 1, 1);
119
+	screen_1bpp(uxn_screen.fg, &icons[(b >> 4) << 3], x, y, color, 1, 1);
120
+	screen_1bpp(uxn_screen.fg, &icons[(b & 0xf) << 3], x + 8, y, color, 1, 1);
121 121
 	screen_change(x, y, x + 0x10, y + 0x8);
122 122
 }
123 123
 
... ...
@@ -139,7 +139,7 @@ screen_debugger(Uxn *u)
139 139
                                             0x2;
140 140
 		draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color);
141 141
 	}
142
-	screen_1bpp(uxn_screen.fg, arrow, 0, 0x68, uxn_screen.height - 0x20, 3, 1, 1);
142
+	screen_1bpp(uxn_screen.fg, &arrow[0], 0x68, uxn_screen.height - 0x20, 3, 1, 1);
143 143
 	for(i = 0; i < 0x20; i++)
144 144
 		draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
145 145
 }
... ...
@@ -273,12 +273,12 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
273 273
 		addr = PEEK2(port_addr), addr_incr = (move & 0x4) << (1 + twobpp);
274 274
 		if(twobpp) {
275 275
 			for(i = 0; i <= length; i++) {
276
-				screen_2bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, fx, fy);
276
+				screen_2bpp(layer, &ram[addr], x + dyx * i, y + dxy * i, color, fx, fy);
277 277
 				addr += addr_incr;
278 278
 			}
279 279
 		} else {
280 280
 			for(i = 0; i <= length; i++) {
281
-				screen_1bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, fx, fy);
281
+				screen_1bpp(layer, &ram[addr], x + dyx * i, y + dxy * i, color, fx, fy);
282 282
 				addr += addr_incr;
283 283
 			}
284 284
 		}