Sprite wipe helper

This commit is contained in:
Devine Lu Linvega 2023-02-28 20:54:32 -08:00
parent 5709511c7e
commit bd01e71c35
1 changed files with 15 additions and 2 deletions

View File

@ -38,6 +38,15 @@ screen_write(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color)
} }
} }
static void
screen_wipe(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y)
{
int v, h;
for(v = 0; v < 8; v++)
for(h = 0; h < 8; h++)
screen_write(p, layer, x + h, y + v, 0);
}
static void static void
screen_blit(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy, Uint8 twobpp) screen_blit(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy, Uint8 twobpp)
{ {
@ -183,8 +192,12 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
if(addr > 0xfff0) if(addr > 0xfff0)
return; return;
for(i = 0; i <= n; i++) { for(i = 0; i <= n; i++) {
screen_blit(&uxn_screen, layer, x + dy * i, y + dx * i, &ram[addr], d[0xf] & 0xf, d[0xf] & 0x10, d[0xf] & 0x20, twobpp); if(!(d[0xf] & 0xf))
addr += (d[0x6] & 0x04) << (1 + twobpp); screen_wipe(&uxn_screen, layer, x + dy * i, y + dx * i);
else {
screen_blit(&uxn_screen, layer, x + dy * i, y + dx * i, &ram[addr], d[0xf] & 0xf, d[0xf] & 0x10, d[0xf] & 0x20, twobpp);
addr += (d[0x6] & 0x04) << (1 + twobpp);
}
} }
POKDEV(0xc, addr); /* auto addr+length */ POKDEV(0xc, addr); /* auto addr+length */
POKDEV(0x8, x + dx); /* auto x+8 */ POKDEV(0x8, x + dx); /* auto x+8 */