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.

Graphics > gfx2gba problem, 32x32 tiles.

#68607 - razialx - Thu Jan 26, 2006 12:41 am

I am trying to use gfx2gba to convert a sprite sheet I have made up into something useable. I am using HAM/HEL2 for development.

The problem is, when I use any setting other than -t8 I get garbage as my sprite output.

My image is 320x320, so its 10 x 10 sprites.

When I use -t8, my first sprite is made up of the top 16 8x8 blocks in the image, even (with HEL object created as a 32x32 sprite).

My string used to create image:
gfx2gba -t32 -c256 -fraw -ogfx -pcharacter.pal ./sourcegfx/character.bmp

My creation code
Code:

g_Handle = hel_ObjCreate(
                     ResData(RES_CHARACTER_RAW), // Pointer to source graphic

                OBJ_SHAPE_SQUARE,       // Obj Shape
                     2 ,                      // Obj Size, 1 means 16x16 pixels, if Shape is set to SQUARE
                     OBJ_MODE_NORMAL,        // Obj Mode
                     COLORS_256,             // Use 256 color mode
                     0,                      // Palette number. Only neccessary in 16 color mode
                     FALSE,                  // Don't use mosaic
                     FALSE,                  // Don't flip the sprite vertically
                     FALSE,                  // Don't flip the object horizontally
                     0,                      // Priority against background. 0=higest
                     FALSE,                  // Don't make the object double-sized
                     50,                     // Destination horzintal screen coordinate in pixels
                     20                      // Destination vertical screen coordinate in pixels
                  );


If anyone has any idea what I am doing wrong, please let me know. Thank you.

This is what I get displayed with -t32
[Images not permitted - Click here to view it]

#68669 - Cearn - Thu Jan 26, 2006 9:48 am

Not really familiar with gfx2gba, but I think this is the problem. The -t option sets the primary tile size, which in the GBA's case should always be 8. For the larger 'tiles' you need the metatile size, -T. Try -T32 -t8

gfx2gba readme wrote:
Q: metatiling? wow! cool name for a feature, BUT WHAT THE HELL IS IT?!
A: it more or less means that your input gfx will get tiled twice. for
example my game "engine" is building large objects from 16x16 sprites.
but 16x16 sprites have to made from 8x8 data internally anyway. so
with a normal tool you have to group your objects in 16xY gfx to get
a good result. now here comes metatiling into play: it first tiles
your gfx into X*X and then in Y*Y. so -T16 -t8 will split up the gfx
into 16x16 blocks first and then this blocks into 8x8 blocks ...
i hope you get the idea ... :-)

#68925 - razialx - Fri Jan 27, 2006 12:22 pm

WOW! Thank you so much. That worked perfectly.