Page 1 of 2
Sprite Noob Question
Posted: Wed Apr 15, 2015 4:45 pm
by Anes
Im rewriting my sprites engine since i was using the old "brad taylor" method as we know is outdated.
I find a problem when sprites have X=255 or 0xFF. When a sprite has this coordinate value is it visible?, since im getting errors.
Thanks in advance.
Re: Sprite Noob Question
Posted: Wed Apr 15, 2015 5:14 pm
by lidnariq
Sprite 0 hits don't trigger on sprites with X=255, even if there are visible pixels. Otherwise I think it's normal?
Re: Sprite Noob Question
Posted: Wed Apr 15, 2015 5:28 pm
by Anes
I know it doesn't trigger when its 255, but my question is if X is set intentionally at 255, is the the sprite pixel shown??
Re: Sprite Noob Question
Posted: Wed Apr 15, 2015 6:43 pm
by Anes
mean this:
I have 8 output units wich this unit is a C struct:
Code: Select all
typedef struct
{
unsigned char Y, TileIndex, Attr, PT0, PT1, pre_spr_zero, spr_zero;
int X;
} SPRBUFFER, * PSPRBUFFER;
"X" is copied from "sprite temp" memory in sprite fetches phase.
When rendering each ppu cc i decrese this "X", when X == 0 the unit is "active" and check if the sprite is not transparent.
What i got is this:

Re: Sprite Noob Question
Posted: Wed Apr 15, 2015 7:03 pm
by mkwong98
The game should not set 255 to the left sprite when Mario moves to the left edge of the screen so I think it is a bug with the CPU, not PPU.
Re: Sprite Noob Question
Posted: Wed Apr 15, 2015 8:30 pm
by Sik
Maybe it just assumes that Mario can never be off-screen horizontally? Especially since it'd be impossible to see on a TV anyway (due to overscan).
Re: Sprite Noob Question
Posted: Wed Apr 15, 2015 8:37 pm
by Anes
I solved it!! it was an sprite logic problem anyway I tested it in a real NES and it doesn't produce that effect.
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 5:46 am
by Zepper
Now I'm curious.
Is this a bug? Isn't Mario sprite supposed to wrap?
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 7:13 am
by mkwong98
Zepper wrote:Now I'm curious.
Is this a bug? Isn't Mario sprite supposed to wrap?
You are right, somehow that glitch didn't cross my mind when I saw the first picture.
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 8:23 am
by Zepper
Anes wrote:I solved it!! it was an sprite logic problem anyway I tested it in a real NES and it doesn't produce that effect.
What was your fix?? I'd like to know in details to fix my emu too.
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 11:28 am
by nostromo
I've tested it in my Sony Triniton using service menu and it happends on real hardware(sorry by the image).
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 12:13 pm
by tokumaru
IIRC, SMB calculates sprite positions in a strange way, it doesn't surprise me that this bug is actually in the game.
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 1:07 pm
by tepples
Is this along the glitches that ShaneM fixed?
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 3:28 pm
by Anes
Yeah it happens in real hardware.
I have a real NES and a PAL Dendy. The thing that i couldn't test it in the real NES yestarday becouse my current transformer was broken and i tought that Dendy was the same, but not.
I have just bought one for the NES and IT DO HAPPEN.
Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 3:57 pm
by Zepper
This sprite wrapping occurs in Nintendulator, but not on puNES. If Anes "has fixed it", it just took ppu_cycle MINUS sprite_xpos > 0 (should be >= 0).
So, that's it. No panic - it's not an emulator glitch.