Fixed transparency

This commit is contained in:
neauoire 2021-09-29 21:00:18 -07:00
parent c494e42cf2
commit c02dc5b0e2
1 changed files with 14 additions and 4 deletions

View File

@ -65,11 +65,21 @@ ppu_write(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color)
int original = p->pixels[row]; int original = p->pixels[row];
Uint8 next = 0x0; Uint8 next = 0x0;
if(x % 2) { if(x % 2) {
next |= original & 0xf0; if(layer) {
next |= color << (layer * 2); next |= original & 0xf3;
next |= color << 0x02;
} else {
next |= original & 0xfc;
next |= color;
}
} else { } else {
next |= original & 0x0f; if(layer) {
next |= color << (4 + (layer * 2)); next |= original & 0x3f;
next |= color << 0x06;
} else {
next |= original & 0xcf;
next |= color << 0x04;
}
} }
p->pixels[row] = next; p->pixels[row] = next;
p->reqdraw = 1; p->reqdraw = 1;