nesgNoBGFillColor support for new ppu, re-enable old ppu sprite layer hiding

This commit is contained in:
rainwarrior 2016-08-30 09:40:36 +00:00
parent 72276d9b1c
commit d9eb69523d
1 changed files with 10 additions and 8 deletions

View File

@ -1592,7 +1592,7 @@ static void CopySprites(uint8 *target) {
if (!spork) return; if (!spork) return;
spork = 0; spork = 0;
//if (!rendersprites) return; //User asked to not display sprites. if (!rendersprites) return; //User asked to not display sprites.
loopskie: loopskie:
{ {
@ -2120,6 +2120,8 @@ int FCEUX_PPU_Loop(int skip) {
for (int xt = 0; xt < 32; xt++) { for (int xt = 0; xt < 32; xt++) {
bgdata.main[xt + 2].Read(); bgdata.main[xt + 2].Read();
const uint8 blank = (gNoBGFillColor == 0xFF) ? READPAL(0) : gNoBGFillColor;
//ok, we're also going to draw here. //ok, we're also going to draw here.
//unless we're on the first dummy scanline //unless we're on the first dummy scanline
if (sl != 0 && sl < 241) { // cape at 240 for dendy, its PPU does nothing afterwards if (sl != 0 && sl < 241) { // cape at 240 for dendy, its PPU does nothing afterwards
@ -2141,7 +2143,8 @@ int FCEUX_PPU_Loop(int skip) {
const int bgpx = bgpos & 7; const int bgpx = bgpos & 7;
const int bgtile = bgpos >> 3; const int bgtile = bgpos >> 3;
uint8 pixel = 0, pixelcolor; uint8 pixel = 0;
uint8 pixelcolor = blank;
//according to qeed's doc, use palette 0 or $2006's value if it is & 0x3Fxx //according to qeed's doc, use palette 0 or $2006's value if it is & 0x3Fxx
if (!ScreenON && !SpriteON) if (!ScreenON && !SpriteON)
@ -2160,9 +2163,8 @@ int FCEUX_PPU_Loop(int skip) {
uint8* pt = bgdata.main[bgtile].pt; uint8* pt = bgdata.main[bgtile].pt;
pixel = ((pt[0] >> (7 - bgpx)) & 1) | (((pt[1] >> (7 - bgpx)) & 1) << 1) | bgdata.main[bgtile].at; pixel = ((pt[0] >> (7 - bgpx)) & 1) | (((pt[1] >> (7 - bgpx)) & 1) << 1) | bgdata.main[bgtile].at;
} }
if(renderbg) if (renderbg)
pixelcolor = READPAL(pixel); pixelcolor = READPAL(pixel);
else pixelcolor = READPAL(0);
//look for a sprite to be drawn //look for a sprite to be drawn
bool havepixel = false; bool havepixel = false;
@ -2195,9 +2197,7 @@ int FCEUX_PPU_Loop(int skip) {
rasterpos < 255) { rasterpos < 255) {
PPU_status |= 0x40; PPU_status |= 0x40;
} }
if(rendersprites) havepixel = true;
havepixel = true;
else continue;
//priority handling //priority handling
if (oam[2] & 0x20) { if (oam[2] & 0x20) {
@ -2207,7 +2207,9 @@ int FCEUX_PPU_Loop(int skip) {
//bring in the palette bits and palettize //bring in the palette bits and palettize
spixel |= (oam[2] & 3) << 2; spixel |= (oam[2] & 3) << 2;
pixelcolor = READPAL(0x10 + spixel);
if (rendersprites)
pixelcolor = READPAL(0x10 + spixel);
} }
} }