minor gpu improvements
This commit is contained in:
parent
6eb791ebf4
commit
96af4b94a1
|
@ -169,7 +169,7 @@ impl CPU {
|
|||
let mode_1_vblank_enabled = get_bit(stat, 4);
|
||||
let mode_0_hblank_enabled = get_bit(stat, 3);
|
||||
|
||||
let lyc_eq_ly = self.memory.get(0xFF44) == self.memory.get(0xFF45);
|
||||
let lyc_eq_ly = self.gpu.scanline == self.memory.get(0xFF45);
|
||||
let mode_2 = self.gpu.mode == DrawMode::Mode2;
|
||||
let mode_1_vblank = self.gpu.mode == DrawMode::VBlank;
|
||||
let mode_0_hblank = self.gpu.mode == DrawMode::HBlank;
|
||||
|
@ -232,18 +232,16 @@ impl CPU {
|
|||
fn render_scanline_window(&mut self, scanline: u8, lcdc: &LCDC, palette: Palette) {
|
||||
let pos_y = self.memory.get(0xFF4A);
|
||||
// subtracting 7 to get the Real Number...
|
||||
let pos_x = self.memory.get(0xFF4B).wrapping_sub(7);
|
||||
if pos_y < 143 && pos_x < 166 {
|
||||
let pos_x = self.memory.get(0xFF4B);
|
||||
self.render_tiles(
|
||||
scanline,
|
||||
&lcdc.window_tilemap,
|
||||
&lcdc.tile_area,
|
||||
palette,
|
||||
pos_x,
|
||||
pos_x.wrapping_sub(7),
|
||||
pos_y,
|
||||
false,
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
fn render_scanline_obj(&mut self, scanline: u8, lcdc: &LCDC, bg_palette: Palette) {
|
||||
|
@ -304,6 +302,9 @@ impl CPU {
|
|||
let lsb = get_bit(lsbs, x_addr);
|
||||
let msb = get_bit(msbs, x_addr);
|
||||
let colour = bits_to_mapped_colour(lsb, msb, object.flags.palette);
|
||||
if colour == object.flags.palette.zero {
|
||||
continue;
|
||||
}
|
||||
let x_coord_uncorrected = (object.x as usize) + (px_x as usize);
|
||||
if x_coord_uncorrected < 8 {
|
||||
continue;
|
||||
|
@ -331,7 +332,7 @@ impl CPU {
|
|||
wrap: bool,
|
||||
) {
|
||||
let tile_line_y = scanline.wrapping_add(offset_y);
|
||||
if (scanline as usize + offset_y as usize) % 0xFF > 0 && !wrap {
|
||||
if ((scanline as usize + offset_y as usize) / 0xFF) > 0 && !wrap {
|
||||
return;
|
||||
}
|
||||
let tilemap_row = tile_line_y / 8;
|
||||
|
|
|
@ -65,7 +65,7 @@ pub(super) struct LCDC {
|
|||
pub(super) bg_window_enable: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub(super) enum Colour {
|
||||
White,
|
||||
LightGray,
|
||||
|
|
Loading…
Reference in a new issue