fixed sprite hit before 255 and for non transparent hits only, thanks to dwedit for providing the fix

This commit is contained in:
qeed 2009-12-08 00:51:14 +00:00
parent b8a4067542
commit fe70d1bc32
1 changed files with 5 additions and 3 deletions

View File

@ -1074,7 +1074,8 @@ static void CheckSpriteHit(int p)
for(x=sphitx;x<(sphitx+8) && x<l;x++)
{
if((sphitdata&(0x80>>(x-sphitx))) && !(Plinef[x]&64))
if((sphitdata&(0x80>>(x-sphitx))) && !(Plinef[x]&64) && x < 255)
{
PPU_status|=0x40;
//printf("Ha: %d, %d, Hita: %d, %d, %d, %d, %d\n",p,p&~7,scanline,GETLASTPIXEL-16,&Plinef[x],Pline,Pline-Plinef);
@ -2284,9 +2285,10 @@ int FCEUX_PPU_Loop(int skip) {
//1. is it sprite#0?
//2. is the bg pixel nonzero?
//then, it is spritehit.
if(oam[6] == 0 && pixel != 0)
if(oam[6] == 0 && (pixel & 3) != 0 &&
rasterpos < 255)
{
PPU_status |= 0x40;
PPU_status |= 0x40;
}
havepixel = true;