pvsneslib icon indicating copy to clipboard operation
pvsneslib copied to clipboard

Regression: Sprite issue with vertical maps

Open mbh21 opened this issue 2 years ago • 4 comments

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.

mbh21 avatar Sep 19 '23 16:09 mbh21

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.

0nogravityobjects nogravityobject09.zip

mbh21 avatar Sep 19 '23 17:09 mbh21

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);

nub1604 avatar Sep 19 '23 20:09 nub1604

Yes, but this was previously handled by the map engine.

mbh21 avatar Sep 19 '23 21:09 mbh21

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?

alekmaul avatar Feb 16 '24 04:02 alekmaul