Seen September 7th, 2022
Posted April 10th, 2022
1,305 posts
11.2 Years
De-linking Palette Sharing Between Player Back & Front Sprites

OK, so firstly you’ll want to save your new backsprite pals from the indexed image to the “palettes” folder in “graphics\trainers”. For easiness, I’ve named mine “brendan_back” and “may_back” to go with the sprite names. The next thing we have to do is define the new labels we'll use for our separate backsprite palettes. Navigate to “pokeemerald\include”. Open "graphics.h" in Notepad++ and add the following two lines:
extern const u32 gTrainerBackPicPalette_Brendan[];
extern const u32 gTrainerBackPicPalette_May[];

I’ve //commented the lines in the picture for the sake of this guide so you can see where I’ve put them.
Now go to “pokeemerald\src\data\graphics\trainers.h”. Add the following two lines:
const u32 gTrainerBackPicPalette_Brendan[] = INCBIN_U32("graphics/trainers/palettes/brendan_back.gbapal.lz");
const u32 gTrainerBackPicPalette_May[] = INCBIN_U32("graphics\trainers\palettes\may_back.gbapal.lz");

Finally, navigate to “pokeemerald\src\data\trainer_graphics\back_pic_tables.h” and add your new palette references here. For example, change this:
const struct CompressedSpritePalette gTrainerBackPicPaletteTable[] = 
    gTrainerPalette_Brendan, 0,
    gTrainerPalette_May, 1, 
To this:
const struct CompressedSpritePalette gTrainerBackPicPaletteTable[] = 
    gTrainerBackPicPalette_Brendan, 0,
    gTrainerBackPicPalette_May, 1, 
Like so:

Compile, test, and there you have it! You should now have separate palettes for your player back and front sprites, so you don't have to worry about colours between the two matching.