mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-22 22:05:11 +00:00
Added auto byte sprite flipping
This commit is contained in:
parent
ffc604fba3
commit
b4d7818632
1 changed files with 11 additions and 11 deletions
|
@ -184,20 +184,20 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
|
|||
Uint8 move = d[0x6];
|
||||
Uint8 length = move >> 4;
|
||||
Uint8 twobpp = !!(ctrl & 0x80);
|
||||
Uint16 x = PEEK2(d + 0x8);
|
||||
Uint16 y = PEEK2(d + 0xa);
|
||||
Uint16 addr = PEEK2(d + 0xc);
|
||||
Uint16 dx = (move & 0x1) << 3;
|
||||
Uint16 dy = (move & 0x2) << 2;
|
||||
Uint8 *layer = (ctrl & 0x40) ? uxn_screen.fg : uxn_screen.bg;
|
||||
Uint16 x = PEEK2(d + 0x8), dx = (move & 0x1) << 3;
|
||||
Uint16 y = PEEK2(d + 0xa), dy = (move & 0x2) << 2;
|
||||
Uint16 addr = PEEK2(d + 0xc);
|
||||
int flipx = (ctrl & 0x10), fx = flipx ? -1 : 1;
|
||||
int flipy = (ctrl & 0x20), fy = flipy ? -1 : 1;
|
||||
for(i = 0; i <= length; i++) {
|
||||
screen_blit(layer, ram, addr, x + dy * i, y + dx * i, ctrl & 0xf, ctrl & 0x10, ctrl & 0x20, twobpp);
|
||||
addr += (move & 0x04) << (1 + twobpp);
|
||||
screen_blit(layer, ram, addr, x + dy * i * fx, y + dx * i * fy, ctrl & 0xf, flipx, flipy, twobpp);
|
||||
addr += (move & 0x4) << (1 + twobpp);
|
||||
}
|
||||
screen_change(x, y, x + dy * length + 8, y + dx * length + 8);
|
||||
if(move & 0x1) POKE2(d + 0x8, x + dx); /* auto x+8 */
|
||||
if(move & 0x2) POKE2(d + 0xa, y + dy); /* auto y+8 */
|
||||
if(move & 0x4) POKE2(d + 0xc, addr); /* auto addr+length */
|
||||
screen_change(x, y, x + dy * length * fx + 8, y + dx * length * fy + 8);
|
||||
if(move & 0x1) POKE2(d + 0x8, x + dx * fx); /* auto x+8 */
|
||||
if(move & 0x2) POKE2(d + 0xa, y + dy * fy); /* auto y+8 */
|
||||
if(move & 0x4) POKE2(d + 0xc, addr); /* auto addr+length */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue