See pic: https://imgur.com/a/frBl0Tl
I recently add support for 8x16 sprites in my PPU. The rest of the game looks good, so I think it's an off-by-one error but I can't find it. Any ideas?
I uploaded my sprite rendering code at:
renderSprites: https://gist.github.com/rodri042/3ac148 ... 1441a911ca
OAM: https://gist.github.com/rodri042/448b38 ... 28779df618
Sprite: https://gist.github.com/rodri042/04c173 ... 5f6a51f5d8
Why is Castlevania displaying these lines in title screen?
Moderator: Moderators
Re: Why is Castlevania displaying these lines in title screen?
The sprites are drawn one line too high.
The reason being on real hardware sprites are drawn one line lower than the Y coordinate you set in the OAM, i.e. if byte 0 of a sprite's attribute 0 is set to '0', it's drawn at line 1 and there is no way to draw a sprite starting from line 0.
The reason being on real hardware sprites are drawn one line lower than the Y coordinate you set in the OAM, i.e. if byte 0 of a sprite's attribute 0 is set to '0', it's drawn at line 1 and there is no way to draw a sprite starting from line 0.
Re: Why is Castlevania displaying these lines in title screen?
Thanks Gilbert! Adding +1 to every sprite Y fixed it
I guess this also affects sprite 0 hit? After adding this fix, now I have a glitch where SMB sets the scrolling too late so the topmost lines of the clouds are off (https://imgur.com/a/JOzA9Qx).
Anyway, the emulator now passes more tests from blargg's sprite_hit_tests ROM and sprite 0 hit is triggered exactly on scanline=30, so the previous problem was probably masking this new bug.
I guess this also affects sprite 0 hit? After adding this fix, now I have a glitch where SMB sets the scrolling too late so the topmost lines of the clouds are off (https://imgur.com/a/JOzA9Qx).
Anyway, the emulator now passes more tests from blargg's sprite_hit_tests ROM and sprite 0 hit is triggered exactly on scanline=30, so the previous problem was probably masking this new bug.
Re: Why is Castlevania displaying these lines in title screen?
So yeah, sprite position is important for determining when sprite 0 hit flag will be set.https://www.nesdev.org/wiki/PPU_registers#PPUSTATUS wrote: Sprite 0 Hit. Set when a nonzero pixel of sprite 0 overlaps a nonzero background pixel, cleared at dot 1 of the pre-render line. Used for raster timing.