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.

DS development > Problems with 256*256 bitmap for 32*32 sprites

#97772 - iainprice - Fri Aug 11, 2006 1:56 pm

I have a 256*256 bitmap. I use Usenti and convert it to a c file as a tiled image with palette, tile group 16*16. I then copy the image into my program:

for(i = 0; i < 32768; i++)
SPRITE_GFX[i] = spritesTiles[i];

but when I index into the image to allocate the sprites, it only goes half way across the 256*256 and then starts on the left-hand side again.....


sprites[i].attribute[0] = ATTR0_COLOR_256 | ATTR0_SQUARE | ypos;
sprites[i].attribute[1] = ATTR1_SIZE_32 | xpos;
sprites[i].attribute[2] = ATTR2_ALPHA(1) | index;

where index is either 0, 8, 16 etc but it jumps to 128 for the next row 32 pixels down my 256*256...

Thius means I can only use 128*128 which is not many 32*32 sprites!

any ideas?

#97777 - silent_code - Fri Aug 11, 2006 2:37 pm

search the forum, there was a topic like "...sprite memory ...something.. at 128..." or something (not so) recently (like two months ago). good luck

#97791 - iainprice - Fri Aug 11, 2006 3:26 pm

This is a new thread based on a previous one on 256*256 sprites..... the majority of the code is working but the 128*128 area is the only bit available.... :(

#97795 - Cearn - Fri Aug 11, 2006 4:08 pm

Object VRAM is only 256x256 for 4bit objects. For 8bit objects the width is halved because each 8bit tile actually takes up two cells, so you have a effectively have a 128x256 area. So you can fit 4 32x32 objects next to each other here, and the next 'row' of objects starts at 128.
Note that this problem only occurs when you use 2D object mapping; in 1D, the indexing is simply object_index * tiles_in_object.

#97814 - iainprice - Fri Aug 11, 2006 7:12 pm

Thanks...