diff --git a/src/ppu.cpp b/src/ppu.cpp index 960f13c2..cded0ae9 100644 --- a/src/ppu.cpp +++ b/src/ppu.cpp @@ -1074,7 +1074,8 @@ static void CheckSpriteHit(int p) for(x=sphitx;x<(sphitx+8) && x>(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;