[NES] fix sprite overlapping draw bugs regression
This commit is contained in:
parent
bddb0e0c3f
commit
c4e37bf42c
|
@ -159,7 +159,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
|
|
||||||
for (int xp = 0; xp < 8; xp++, rasterpos++)
|
for (int xp = 0; xp < 8; xp++, rasterpos++)
|
||||||
{
|
{
|
||||||
|
|
||||||
//bg pos is different from raster pos due to its offsetability.
|
//bg pos is different from raster pos due to its offsetability.
|
||||||
//so adjust for that here
|
//so adjust for that here
|
||||||
int bgpos = rasterpos + ppur.fh;
|
int bgpos = rasterpos + ppur.fh;
|
||||||
|
@ -199,12 +198,15 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
|
|
||||||
if (!renderspritenow) continue;
|
if (!renderspritenow) continue;
|
||||||
|
|
||||||
//bail out if we already have a pixel from a higher priority sprite
|
//bail out if we already have a pixel from a higher priority sprite.
|
||||||
|
//notice that we continue looping anyway, so that we can shift down the patterns
|
||||||
if (havepixel) continue;
|
if (havepixel) continue;
|
||||||
|
|
||||||
//transparent pixel bailout
|
//transparent pixel bailout
|
||||||
if (spixel == 0) continue;
|
if (spixel == 0) continue;
|
||||||
|
|
||||||
|
havepixel = true;
|
||||||
|
|
||||||
//TODO - make sure we dont trigger spritehit if the edges are masked for either BG or OBJ
|
//TODO - make sure we dont trigger spritehit if the edges are masked for either BG or OBJ
|
||||||
//spritehit:
|
//spritehit:
|
||||||
//1. is it sprite#0?
|
//1. is it sprite#0?
|
||||||
|
@ -214,19 +216,25 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
Reg2002_objhit = true;
|
Reg2002_objhit = true;
|
||||||
}
|
}
|
||||||
havepixel = true;
|
|
||||||
|
|
||||||
|
|
||||||
|
bool drawsprite = true;
|
||||||
//priority handling
|
//priority handling
|
||||||
if ((oam->oam[2] & 0x20) != 0)
|
if ((oam->oam[2] & 0x20) != 0)
|
||||||
{
|
{
|
||||||
//behind background:
|
//if in front of BG:
|
||||||
if ((pixel & 3) != 0) continue;
|
if ((pixel & 3) != 0)
|
||||||
|
{
|
||||||
|
drawsprite = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//bring in the palette bits and palettize
|
if (drawsprite)
|
||||||
spixel |= (oam->oam[2] & 3) << 2;
|
{
|
||||||
pixelcolor = PALRAM[0x10 + spixel];
|
//bring in the palette bits and palettize
|
||||||
|
spixel |= (oam->oam[2] & 3) << 2;
|
||||||
|
//save it for use in the framebuffer
|
||||||
|
pixelcolor = PALRAM[0x10 + spixel];
|
||||||
|
}
|
||||||
} //rasterpos in sprite range
|
} //rasterpos in sprite range
|
||||||
|
|
||||||
} //c# fixed oam ptr
|
} //c# fixed oam ptr
|
||||||
|
|
Loading…
Reference in New Issue