Skip to content

Commit

Permalink
Fixed last line of sprites not rendering
Browse files Browse the repository at this point in the history
... yes this was dumb. I also renamed a variable
in `gpu/states.rs`
  • Loading branch information
velllu committed Dec 13, 2023
1 parent 4a059db commit 2dd9cb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/gpu/oam_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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((
Expand Down
4 changes: 2 additions & 2 deletions src/gpu/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2dd9cb2

Please sign in to comment.