Corrected BG enable's behavior (Fixes visual glitch with Krusty's Funhouse)

This commit is contained in:
Lior Halphon 2016-09-23 18:30:07 +03:00
parent 42c01a21b2
commit 52ed2ca55e
1 changed files with 18 additions and 20 deletions

View File

@ -144,10 +144,7 @@ static uint32_t get_pixel(GB_gameboy_t *gb, uint8_t x, uint8_t y)
return gb->sprite_palletes_rgb[sprite_palette * 4 + sprite_pixel];
}
if (!bg_enabled) {
return gb->background_palletes_rgb[0];
}
if (bg_enabled) {
if (gb->io_registers[GB_IO_LCDC] & 0x10) {
tile_address = tile * 0x10;
}
@ -168,6 +165,7 @@ static uint32_t get_pixel(GB_gameboy_t *gb, uint8_t x, uint8_t y)
background_pixel = (((gb->vram[tile_address + (y & 7) * 2 ] >> ((~x)&7)) & 1 ) |
((gb->vram[tile_address + (y & 7) * 2 + 1] >> ((~x)&7)) & 1) << 1 );
}
if (priority && sprite_pixel && !background_pixel) {
if (!gb->cgb_mode) {