mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-16 11:15:06 +00:00
Drawing is pixel-perfect again
This commit is contained in:
parent
bac54f1fd9
commit
c494e42cf2
2 changed files with 16 additions and 9 deletions
|
@ -24,12 +24,6 @@ static Uint8 blending[5][16] = {
|
|||
{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2},
|
||||
{1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0}};
|
||||
|
||||
static Uint16
|
||||
ppu_row(Ppu *p, Uint16 x, Uint16 y)
|
||||
{
|
||||
return (y % 8) + ((x / 8 + y / 8 * p->width / 8) * 16);
|
||||
}
|
||||
|
||||
static void
|
||||
ppu_clear(Ppu *p)
|
||||
{
|
||||
|
@ -46,9 +40,22 @@ Uint8
|
|||
ppu_read(Ppu *p, Uint16 x, Uint16 y)
|
||||
{
|
||||
int row = (x + y * p->width) / 0x2;
|
||||
int shift = (1 - (x & 0x1)) * 0x4;
|
||||
|
||||
return p->pixels[row] & 0x3;
|
||||
if(x % 2) {
|
||||
if(p->pixels[row] & 0x0c) {
|
||||
return (p->pixels[row] >> 0x2) & 0x3;
|
||||
} else {
|
||||
return (p->pixels[row] >> 0x0) & 0x3;
|
||||
}
|
||||
} else {
|
||||
if(p->pixels[row] & 0xc0) {
|
||||
return (p->pixels[row] >> 0x6) & 0x3;
|
||||
} else {
|
||||
return (p->pixels[row] >> 0x4) & 0x3;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -65,6 +72,7 @@ ppu_write(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color)
|
|||
next |= color << (4 + (layer * 2));
|
||||
}
|
||||
p->pixels[row] = next;
|
||||
p->reqdraw = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -410,7 +410,6 @@ screen_talk(Device *d, Uint8 b0, Uint8 w)
|
|||
}
|
||||
if(d->dat[0x6] & 0x01) poke16(d->dat, 0x8, x + 8); /* auto x+8 */
|
||||
if(d->dat[0x6] & 0x02) poke16(d->dat, 0xa, y + 8); /* auto y+8 */
|
||||
ppu.reqdraw = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue