gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Sprite scaling weirdness

#18725 - punchy - Thu Apr 01, 2004 8:59 pm

Hi,
my project has a playfield that is 240 pixels wide by 256 pixels high, so i want to provide a scaled videomode so that the whole playfield can be shown on screen at once. I'm using interrupts to monkey around with the bg scroll registers at each screen line which scales the tile backgrounds very nicely. The problem is with the sprites.

I only want to alter the sprites vertical height, and I also want to provide sprite flipping. I'm still playing around with the sprite parameters, but it's currently something like this:

s16 testHoriz = 1<<8;
s16 testVert = 1<<8|1<<6;

rotData[0].pa = testHoriz; // 1<8 or -1<<8 flips sprite horizontally
rotData[0].pb = 0;
rotData[0].pc = 0;
rotData[0].pd = testVert;//Using -ve values flips the sprite vertically

So i have 4 sets of parameters for the 4 possible sprite flip combinations.

The problem (finally) is that sometimes the sprites are appearing 1 pixel
out of aligment horizontally. So if i have several sprites nexy to each other, i can see single pixel gaps.

Any help would be most appreciated.

#18731 - tepples - Fri Apr 02, 2004 3:47 am

Reflecting sprites using sprite rotation will in fact make what look like off-by-one errors compared to reflecting unrotated sprites. If you're not emulating another machine where the CPU can arbitrarily write to sprite cel VRAM, then why not just draw and store your sprite cels pre-scaled and use regular reflection?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#18732 - punchy - Fri Apr 02, 2004 10:08 am

I'm not sure why I didn't think of that myself. Thanks.