I was curious about in the sprite ram one should use y - 1 instead of y.
Could be that this way sprite detection on scanline is easier with NES logic?
Not(~) this value to get -y, and so:
However this not work for *py = 0xEF-0xFE, where sprite should be hidden.
(so I think a check should be made for this).
Does exists a more straightforward method?
Bye,
tano
Could be that this way sprite detection on scanline is easier with NES logic?
Not(~) this value to get -y, and so:
Code:
uint8_t sprite_ram[0xFF], *py, sprite_height, scanline;
int count;
sprite_height = reg2000 & 0x20 ? 16 : 8;
for (py = sprite_ram, count = 0 ; py < sprite_ram + 0xFF ; py += 4)
if (scanline + ~*py < sprite_height) {
/* sprite is in scanline */
if (++count >= 8)
break;
}
int count;
sprite_height = reg2000 & 0x20 ? 16 : 8;
for (py = sprite_ram, count = 0 ; py < sprite_ram + 0xFF ; py += 4)
if (scanline + ~*py < sprite_height) {
/* sprite is in scanline */
if (++count >= 8)
break;
}
However this not work for *py = 0xEF-0xFE, where sprite should be hidden.
(so I think a check should be made for this).
Does exists a more straightforward method?
Bye,
tano