jsgroth / jgenesis

Sega Genesis / Sega CD / SNES / Master System / Game Gear emulator
MIT License
36 stars 3 forks source link

Alex Kidd in the Enchanted Castle (USA).md graphic glitch #125

Open benderscruffy opened 2 days ago

benderscruffy commented 2 days ago

when you go in the first door the rock paper scissors game the hands are glitchy happens in the Europe version aswell

jsgroth commented 2 days ago

This worked correctly in earlier versions but has been broken since v0.6.1, specifically because of this changeset: 01db12653529a86ca71c0cc82716bd5cd1db96c7

That change introduced an off-by-one error related to the sprite overflow flag in the VDP status register. In H40 mode, it's supposed to get set whenever a line contains more than 20 sprites or more than 320 sprite pixels (before accounting for overlap or whether sprites are horizontally onscreen). After that change, the sprite pixel overflow check was setting the flag at >=320 pixels instead of >320 pixels.

Alex Kidd is sensitive to this because it renders lines with exactly 320 sprite pixels and it has some logic that uses the sprite overflow flag (which is kind of unusual, most games seem to ignore it).