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 > gfx2gba, palettes, and linear byte arrays

#20355 - tethered - Sat May 08, 2004 8:53 pm

Perhaps someone here will have experience with this...

As I mentioned in a recent post (http://forum.gbadev.org/viewtopic.php?t=3365), I'm working on creating a 3 layer background with parallax scrolling in mode 0, text bg 0.

In Photoshop, I've created 3 seperate 512 x 512 pixel, 256 color bitmaps that each reference the same palette. My problem is that when I convert each bitmap w/ gfx2gba, it seems to optimize the palette on a per image basis. Here is the command I'm using:

Code:
gfx2gba -fsrc -m -plvl1bg0.pal lvl1bg0.bmp


And I do that for each of the three bitmaps.

How can I create one single master palette, and then when I convert each seperate bitmap, tell gfx2gba to use that master palette? I looked at all the command line switches and nothing seems to do the trick.

Any ideas?


- Chuck

#20357 - Lupin - Sat May 08, 2004 9:13 pm

you know that you have to create tile and map data seperately?

Put everything in one file, that would be my first guess :)
_________________
Team Pokeme
My blog and PM ASM tutorials

#20359 - tethered - Sat May 08, 2004 9:32 pm

The above command outputs the palette as an unsigned short array (i.e., it will figure out what colors are required and creates an optimized palette of 16-bit colors), tiles as an unsigned char array (i.e., it will look at the entire image, figure out how to break it down into tiles, and then output the tiles side by side in one long linear byte array whose values correspond to the palette entries), the map as an unsigned short array (each byte stores a value that corresponds to the tiles)...

For my purposes, I need to create 3 seperate map and tile sets that all correspond to one master palette, and I don't see any way of doing this w/ gfx2gba...

As far as putting everything into one large image, the problem with that is that I then have no idea how many tiles are being used for each of the 3 seperate maps, and if I were to create a loop to copy the tiledata, I wouldn't know where to begin and where to end for each layer.

If its something blatently obvious that I'm overlooking, feel free to yell at me and stuff. I can take it.

Or, I'm willing to accept recommendations of other utilities that do a better job.


- Chuck

#20362 - tethered - Sat May 08, 2004 10:44 pm

Sometimes it takes a little thinking out loud to solve a problem. For anyone who is experiencing the same thing, there's a solution: batch processing.

For example, with all your bitmaps in one directory, use the following command:

Code:
gfx2gba -fsrc -m -t8 *.bmp


That will create one master palette which all of the bitmaps will use, seperate tileset arrays for each bitmap, and seperate map files for each bitmap.

Beautiful!


- Chuck