#34442 - Celeryface - Wed Jan 19, 2005 7:04 pm
Hi there,
Does anyone know how to set the palette number for 16-colour backgrounds in mode 0? I see that you need to set the same bits (12-15) as OAM sprites do for palettes, but how do you set the 16-colour background to use a certain palette number entry?
Is it done on a per-tile basis, or can you set the whole background to use 1 of the 16-colour palettes?
Thanks in advance. :)
#34445 - DekuTree64 - Wed Jan 19, 2005 7:30 pm
Yup, palettes are set per-tile, in the top 4 bits of the screeen data entries (except on rotation screens, which can only be 256 color and use 8-bit screen entries). Check GBATEK/CowBite for details.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#34446 - Celeryface - Wed Jan 19, 2005 7:40 pm
Do you know if there's an option in gfx2gba to store the palette number in the map data source file itself per tile?
#34451 - DekuTree64 - Wed Jan 19, 2005 8:29 pm
Sorry, I haven't used gfx2gba, but it should have a 4-bit option of some sort that will give you the 4-bit char data, palette data, and screen data with H/V flipping and palette numbers set (usually in seperate files, called something like file.gfx, file.pal and file.map)
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#34454 - Celeryface - Wed Jan 19, 2005 9:23 pm
DekuTree64 wrote: |
Sorry, I haven't used gfx2gba, but it should have a 4-bit option of some sort that will give you the 4-bit char data, palette data, and screen data with H/V flipping and palette numbers set (usually in seperate files, called something like file.gfx, file.pal and file.map) |
Code: |
=======================
gfx2gba Converter v0.13
-----------------------
(C) 2oo1-2oo2 [TRiNiTY]
=======================
Usage: gfx2gba [options] bmp/pcx/tga/tim/spr files ...
Options are:
-pPalettename -m generate map (optimized)
-oOutputdir -M generate map (not optimized)
-fOutput format -mm generate metatiled map (optimized)
-sSection -MM generate metatiled map (not optimized)
-SpSuffix for palette -bBank for map
-SmSuffix for map -mc save map in column order
-StSuffix for tiledata -F turn off check for flipped tiles
-TMetatilesize -rs output a rotate/scale BG screen map
-tTilesize -P don't save palette data
-tc save tiles as columns -G don't save tile/image data
-cColordepth -D don't save map data
-CColor-Offset -X don't save anything
-A force color offset add -Z compress everything
-aTransparent color -zt compress tile/bitmap data
-vVRAM-Offset -zp compress palette data
-x don't merge palettes -zm compress map data
-q quiet mode -ap use aPLib as compressor
-B only optimize blank tiles -aps use aPLib (safe) as compressor
-align add alignment info for GCC |
I'm not too sure which option it is. Has anyone used this to set the palette number for your background data? :)
#34455 - DekuTree64 - Wed Jan 19, 2005 9:35 pm
Looks like you'd use -c4 for 4-bit, and -m to generate the map data with the palettes set (if I'm understanding his -cColordepth option right)
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#34456 - Celeryface - Wed Jan 19, 2005 9:45 pm
DekuTree64 wrote: |
Looks like you'd use -c4 for 4-bit, and -m to generate the map data with the palettes set (if I'm understanding his -cColordepth option right) |
Hmm. I use -c16 for 16-colour mode, and -m to generate the map. Can you set the actual 16-colour palette number using this tool though?
If not, then I can just combine all the backgrounds to use the same palette and use the 256-colour mode.
#34525 - Celeryface - Thu Jan 20, 2005 11:22 pm
Celeryface wrote: |
Hi there,
Does anyone know how to set the palette number for 16-colour backgrounds in mode 0? I see that you need to set the same bits (12-15) as OAM sprites do for palettes, but how do you set the 16-colour background to use a certain palette number entry?
Is it done on a per-tile basis, or can you set the whole background to use 1 of the 16-colour palettes?
Thanks in advance. :) |
I found that when loading the map data, I just set the palette number by ORing it with the palette number and a bit shift:
screenDest[index] = mapData[index] | ( paletteNum << 12 );
And it works. :)