Skip to content

Commit 96c2981

Browse files
committed
fix: sprite 0 hit
1 parent 8ca9eba commit 96c2981

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/ppu/ppu.zig

+2-3
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,8 @@ pub const PPU = struct {
447447
// Sprite zero hit: https://www.nesdev.org/wiki/PPU_OAM#Sprite_zero_hits
448448
// This happens regardless of sprite priority.
449449
if (i == 0 and // sprite 0 is always in the first latch.
450-
i < self.num_sprites_on_scanline and
451-
self.scanline_has_sprite0 and
452-
!is_bg_transparent)
450+
i < self.num_sprites_on_scanline and self.scanline_has_sprite0 and
451+
is_sprite_px_opaque and !is_bg_transparent)
453452
{
454453
self.ppu_status.sprite_zero_hit = true;
455454
}

0 commit comments

Comments
 (0)