uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit efd70d34be20e08ad7b5582a97c129798af038cc
parent f744a95a70406c6236ec018c8883cda59faa833a
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 12 Nov 2023 17:01:16 -0800

(Screen) Pass addr to sprite

Diffstat:
Msrc/devices/screen.c | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/devices/screen.c b/src/devices/screen.c @@ -61,10 +61,10 @@ screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color) } static void -screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy) +screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy) { int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5); - Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8; + Uint8 *ch1 = addr, *ch2 = ch1 + 8; Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8; Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8; 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 } static void -screen_1bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy) +screen_1bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy) { int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5); - Uint8 *ch1 = &ram[addr]; + Uint8 *ch1 = addr; Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8; Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8; for(y = y1 + ymod; y != ymax; y += fy) { @@ -116,8 +116,8 @@ static Uint8 arrow[] = { static void draw_byte(Uint8 b, Uint16 x, Uint16 y, Uint8 color) { - screen_1bpp(uxn_screen.fg, icons, (b >> 4) << 3, x, y, color, 1, 1); - screen_1bpp(uxn_screen.fg, icons, (b & 0xf) << 3, x + 8, y, color, 1, 1); + screen_1bpp(uxn_screen.fg, &icons[(b >> 4) << 3], x, y, color, 1, 1); + screen_1bpp(uxn_screen.fg, &icons[(b & 0xf) << 3], x + 8, y, color, 1, 1); screen_change(x, y, x + 0x10, y + 0x8); } @@ -139,7 +139,7 @@ screen_debugger(Uxn *u) 0x2; draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color); } - screen_1bpp(uxn_screen.fg, arrow, 0, 0x68, uxn_screen.height - 0x20, 3, 1, 1); + screen_1bpp(uxn_screen.fg, &arrow[0], 0x68, uxn_screen.height - 0x20, 3, 1, 1); for(i = 0; i < 0x20; i++) draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]); } @@ -273,12 +273,12 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port) addr = PEEK2(port_addr), addr_incr = (move & 0x4) << (1 + twobpp); if(twobpp) { for(i = 0; i <= length; i++) { - screen_2bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, fx, fy); + screen_2bpp(layer, &ram[addr], x + dyx * i, y + dxy * i, color, fx, fy); addr += addr_incr; } } else { for(i = 0; i <= length; i++) { - screen_1bpp(layer, ram, addr, x + dyx * i, y + dxy * i, color, fx, fy); + screen_1bpp(layer, &ram[addr], x + dyx * i, y + dxy * i, color, fx, fy); addr += addr_incr; } }