pvsneslib
pvsneslib copied to clipboard
Regression: Sprite issue with vertical maps
This was fixed in earlier 4.x dev branch, but now with 4.1 it is broken again.
When on a vertical map, if you move up or down on the map, then any sprites that scroll off the map, suddenly appear on the opposite side. So, if you move up, any sprites that go off bottom of map, appear at top. If you move down, any sprites that go off top of map, appear at bottom.
Previously this was fixed with sprite refresh settings, but this fix no longer works.
Please see animated showing moving up and down. Only the middle goomba should be there, the others are ghosts. Attached is also code and sfc file.
This behavior is normal on the Snes, take a look in the sprite viewer in Mesen when you moving vertically To get around this, just draw the sprite out depending on your camera Y Position. Try something like this:
oambuffer[sprnum].oamx = (*goombaox) - x_pos; // that was easy for X
s16 posY = (*goombaoy) - y_pos; //define posY on top of your c file, not method local like here
if (posY > -16 && posY < 240) // play around with these values, in my case it works with a sprite size of 16
{
oambuffer[sprnum].oamy = posY; // if posY is in range it will draw
}
else
{
oambuffer[sprnum].oamy = 240; // otherwise draw the sprite it out of screen
}
oamDynamic16Draw(sprnum);
Yes, but this was previously handled by the map engine.
that's correct, it was handle previously but the code was not correct. Is it possible to have your source code to check how you add your objects in the map?