ref: 111260104893facc7758defcbbba0d1f590e6a46
parent: d8035a86f77b7351ebdea9bad0ba77593b84ed76
parent: 3d01ec2f25739fb1d01c8ea736de451b6615c3b5
author: aiju <aiju@phicode.de>
date: Sat Mar 1 14:23:55 EST 2014
merge
--- a/sys/src/games/nes/ppu.c
+++ b/sys/src/games/nes/ppu.c
@@ -165,7 +165,7 @@
}
static void
-drawsprites(void)
+drawsprites(int show)
{
uchar *p;
int big, dx, dy, i, x, cc, pri;
@@ -209,7 +209,7 @@
x = ppux - 2;
dx = x - t[0].x;
if(t0 && dx >= 0 && dx < 8 && ppux != 257){
- if((nz & 1) != 0 && iscolor(x, ppuy))
+ if((nz & 1) != 0 && iscolor(x, ppuy) && show)
mem[PPUSTATUS] |= SPRITE0HIT;
nz >>= 1;
}
@@ -227,7 +227,7 @@
t[i].r1 >>= 1;
t[i].r2 >>= 1;
}
- if(cc != -1 && (pri || !iscolor(x, ppuy)))
+ if(cc != -1 && show && (pri || !iscolor(x, ppuy)))
pixel(x, ppuy, cc, 0);
}
if(ppux == 257){
@@ -310,10 +310,10 @@
mask = mem[PPUMASK];
if((mask & BGDISP) != 0)
drawbg();
- if(((mask & BGDISP) == 0 && ppux <= 257 || ppux <= 10 && (mask & BG8DISP) == 0) && ppux >= 2)
+ if(((mask & BGDISP) == 0 && ppux <= 257 || ppux < 10 && (mask & BG8DISP) == 0) && ppux >= 2)
pixel(ppux - 2, ppuy, ppuread(0x3F00), 1);
- if((mask & SPRITEDISP) != 0 && ppuy != 261 && (ppux > 10 || (mask & SPRITE8DISP) != 0))
- drawsprites();
+ if((mask & SPRITEDISP) != 0 && ppuy != 261)
+ drawsprites(ppux >= 10 || (mask & SPRITE8DISP) != 0);
if(ppux == 240 && (mask & SPRITEDISP) != 0)
mapper[map](SCAN, 0);
if(ppuy == 261){