Added more color blending modes for chrs

This commit is contained in:
Andrew Alderwick 2021-07-31 23:21:13 +01:00
parent 19b0aa2083
commit 555d38a8ef
1 changed files with 6 additions and 1 deletions

View File

@ -48,7 +48,12 @@ puticn(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint
void void
putchr(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy) putchr(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy)
{ {
Uint8 k1 = 1, k2 = 2;
Uint16 v, h; Uint16 v, h;
if(!(color & 1)) {
++color;
k1 = 2, k2 = 1;
}
for(v = 0; v < 8; v++) for(v = 0; v < 8; v++)
for(h = 0; h < 8; h++) { for(h = 0; h < 8; h++) {
Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1) * color; Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1) * color;
@ -57,7 +62,7 @@ putchr(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint
layer, layer,
x + (flipx ? 7 - h : h), x + (flipx ? 7 - h : h),
y + (flipy ? 7 - v : v), y + (flipy ? 7 - v : v),
((ch1 + ch2 * 2) + color / 4) & 0x3); ((ch1 * k1 + ch2 * k2) + color / 4) & 0x3);
} }
} }