From 2dd9cb2b916a2a4ed2e552f352fa17e9ac3acf49 Mon Sep 17 00:00:00 2001 From: velllu <91963404+velllu@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:16:03 +0100 Subject: [PATCH] Fixed last line of sprites not rendering ... yes this was dumb. I also renamed a variable in `gpu/states.rs` --- src/gpu/oam_parser.rs | 4 ++-- src/gpu/states.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gpu/oam_parser.rs b/src/gpu/oam_parser.rs index 3dbacce..2675126 100644 --- a/src/gpu/oam_parser.rs +++ b/src/gpu/oam_parser.rs @@ -63,8 +63,8 @@ impl GameBoy { let x_condition = sprite_x == x; // and we check if we also are on the same y axis, however, a sprite is 8 - // pixel long, so we check if we are anywhere between row 0 to 7 - let y_condition = ((sprite_y)..(sprite_y + 7)).contains(&y); + // pixel long, so we check if we are anywhere between row 1 to 8 + let y_condition = ((sprite_y)..(sprite_y + 8)).contains(&y); if x_condition && y_condition { sprite_fifo = Some(( diff --git a/src/gpu/states.rs b/src/gpu/states.rs index 52205ec..221e65b 100644 --- a/src/gpu/states.rs +++ b/src/gpu/states.rs @@ -96,10 +96,10 @@ impl GameBoy { // And we get both background/window fifo and the sprite fifo let background_fifo = self.get_line(self.bus[tile_map_address], self.gpu.y as u16 % 8); - let mut sprite_fifo = self.get_sprite_fifo(self.gpu.x, self.gpu.y); + let mut sprite = self.get_sprite_fifo(self.gpu.x, self.gpu.y); // TODO: Implement fifo mixing - if let Some((sprite_fifo, sprite_data)) = &mut sprite_fifo { + if let Some((sprite_fifo, sprite_data)) = &mut sprite { self.apply_palette_to_sprite(sprite_fifo, &sprite_data.palette); if self.gpu.rendered_sprites_on_line < 10 {