feat(ppu): account for OBJ ENABLE bit in LCDC
This commit is contained in:
parent
aeaaee8c6c
commit
778e04e645
23
src/ppu.rs
23
src/ppu.rs
|
@ -373,6 +373,7 @@ impl Ppu {
|
||||||
|
|
||||||
// Handle Background Pixel and Sprite FIFO
|
// Handle Background Pixel and Sprite FIFO
|
||||||
let bg_enabled = self.control.bg_win_enabled();
|
let bg_enabled = self.control.bg_win_enabled();
|
||||||
|
let obj_enabled = self.control.obj_enabled();
|
||||||
let i0_colour = self.monochrome.bg_palette.i0_colour();
|
let i0_colour = self.monochrome.bg_palette.i0_colour();
|
||||||
|
|
||||||
// FIXME: Is this the correct behaviour
|
// FIXME: Is this the correct behaviour
|
||||||
|
@ -380,14 +381,20 @@ impl Ppu {
|
||||||
let bg_shade = if bg_enabled { bg_info.shade } else { i0_colour };
|
let bg_shade = if bg_enabled { bg_info.shade } else { i0_colour };
|
||||||
|
|
||||||
match self.fifo.obj.pop_front() {
|
match self.fifo.obj.pop_front() {
|
||||||
Some(obj_info) => match (obj_info.shade, obj_info.priority) {
|
Some(obj_info) => {
|
||||||
(Some(obj_shade), BackgroundAndWindow) => match bg_info.shade {
|
if obj_enabled {
|
||||||
GrayShade::White => obj_shade.into_rgba(),
|
match (obj_info.shade, obj_info.priority) {
|
||||||
_ => bg_shade.into_rgba(),
|
(Some(obj_shade), BackgroundAndWindow) => match bg_info.shade {
|
||||||
},
|
GrayShade::White => obj_shade.into_rgba(),
|
||||||
(Some(obj_shade), Object) => obj_shade.into_rgba(),
|
_ => bg_shade.into_rgba(),
|
||||||
(None, _) => bg_shade.into_rgba(),
|
},
|
||||||
},
|
(Some(obj_shade), Object) => obj_shade.into_rgba(),
|
||||||
|
(None, _) => bg_shade.into_rgba(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bg_shade.into_rgba()
|
||||||
|
}
|
||||||
|
}
|
||||||
None => bg_shade.into_rgba(),
|
None => bg_shade.into_rgba(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue