From 886a487bf1a4438a16fa8f15c6ff502409f2419d Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 26 Sep 2022 12:40:30 +0200 Subject: [PATCH] Added LoadMonIconPalettePersonality to load gender specific pokemon icon palettes --- include/pokemon_icon.h | 1 + src/pokemon_debug.c | 2 +- src/pokemon_icon.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index fba6a6740..6e27689f9 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -23,6 +23,7 @@ void FreeAndDestroyMonIconSprite(struct Sprite *sprite); u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality); u8 UpdateMonIconFrame(struct Sprite *sprite); void LoadMonIconPalette(u16 species); +void LoadMonIconPalettePersonality(u16 species, u32 personality); void SpriteCB_MonIcon(struct Sprite *sprite); void SetPartyHPBarSprite(struct Sprite *sprite, u8 animNum); u8 GetMonIconPaletteIndexFromSpecies(u16 species); diff --git a/src/pokemon_debug.c b/src/pokemon_debug.c index 4168b7524..2eb6fd682 100644 --- a/src/pokemon_debug.c +++ b/src/pokemon_debug.c @@ -1686,7 +1686,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data) FreeMonIconPalettes(); AllocateMonSpritesGfx(); - LoadMonIconPalette(species); + LoadMonIconPalettePersonality(species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY)); //Update instructions PrintInstructionsOnWindow(data); diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 4bbdf07b0..1061457ab 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -2760,6 +2760,17 @@ void LoadMonIconPalette(u16 species) LoadSpritePalette(&gMonIconPaletteTable[palIndex]); } +void LoadMonIconPalettePersonality(u16 species, u32 personality) +{ + u8 palIndex; + if (ShouldShowFemaleDifferences(species, personality)) + palIndex = gMonIconPaletteIndicesFemale[species]; + else + palIndex = gMonIconPaletteIndices[species]; + if (IndexOfSpritePaletteTag(gMonIconPaletteTable[palIndex].tag) == 0xFF) + LoadSpritePalette(&gMonIconPaletteTable[palIndex]); +} + void FreeMonIconPalettes(void) { u8 i;