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 > Problem with colors of the 2nd Background

#102813 - chewtoy11 - Sun Sep 17, 2006 5:55 am

I've done some preliminary searching for how to fix this, but I'm running out of places to look.

I'm using background mode 0, and trying to get both of my backgrounds (both 256x256) to display properly. I can get both backgrounds displaying, and I'm even getting transparency to work fine. The problem is that the 2nd background's colors are displaying improperly. The first bg's colors are fine.

I know both backgrounds are supposed to use the same palette, so I made a palette in Adobe Photoshop, and have been consistently using it for any BMPs that I save. The BMPs look fine when I preview them, load them up in Photoshop, and even in HAM's Map Editor.

I'm using gfx2gba to convert the images with this command:

gfx2gba -t8 -fsrc bg0-tileset.bmp

This gives me both the palette and raw data files which I'm linking into my source via makefile. I'm only loading in one palette for this purpose, and the palette consists of all 16 colors that I'm using for both backgrounds. Both images appear to have the same exact palettes (color order and everything).

Here is what the map SHOULD look like (minus the obnoxious lime green transparent color):

[Images not permitted - Click here to view it]

The green grass, however, shows up as red and yellow instead of green and light green. The brown soil winds up being transparent!

Any ideas?

#102817 - Kirby - Sun Sep 17, 2006 6:54 am

chewtoy11 wrote:
I'm using gfx2gba to convert the images with this command:

gfx2gba -t8 -fsrc bg0-tileset.bmp

Try, instead, using:
Code:
gfx2gba -t8 -fasm *.bmp

That compiles all your images at the same time (which ensures they have the same palette), and outputs seperate .s files. Then, when compiling you can use:
Code:
as sprDir\*.s -o Sprites.o
interflip -mthumb-interwork Sprites.o

That assembles all of your images at the same time (as opposed to having to gcc each of them in turn if they were src files). sprDir is the folder where you outputted the .s files, and Sprites.o is the file that stores all of the images.
Then, just link Sprites.o to the rest of your files.
_________________
Knock-knock.
Whose there?
Kirby.
Kirby-who?
I told you! Kirby!

#102863 - chewtoy11 - Sun Sep 17, 2006 3:02 pm

Thank you very much! It worked like a charm. I also like how this method compiles all the images' data and the palette into one file (much cleaner for the makefile).

You're a godsend, Kirby!