Some constant use in pokemon_icon.c

This commit is contained in:
GriffinR 2021-02-17 14:11:59 -05:00
parent e059c4fdfa
commit 642ae8295e

View file

@ -7,6 +7,8 @@
#define POKE_ICON_BASE_PAL_TAG 56000
#define INVALID_ICON_SPECIES SPECIES_OLD_UNOWN_J // Oddly specific, used when an icon should be a ?. Any of the 'old unown' would work
struct MonIconSpriteTemplate
{
const struct OamData *oam;
@ -1086,7 +1088,7 @@ u16 GetIconSpecies(u16 species, u32 personality)
else
{
if (species > NUM_SPECIES)
result = 260;
result = INVALID_ICON_SPECIES;
else
result = species;
}
@ -1117,7 +1119,7 @@ u16 sub_80D2E84(u16 species)
else
{
if (species > (SPECIES_UNOWN_B - 1))
species = SPECIES_OLD_UNOWN_J; // That's an oddly specific species.
species = INVALID_ICON_SPECIES;
return GetIconSpecies(species, 0);
}
}
@ -1144,7 +1146,7 @@ void SafeLoadMonIconPalette(u16 species)
{
u8 palIndex;
if (species > NUM_SPECIES)
species = 260;
species = INVALID_ICON_SPECIES;
palIndex = gMonIconPaletteIndices[species];
if (IndexOfSpritePaletteTag(gMonIconPaletteTable[palIndex].tag) == 0xFF)
LoadSpritePalette(&gMonIconPaletteTable[palIndex]);
@ -1160,7 +1162,7 @@ void LoadMonIconPalette(u16 species)
void FreeMonIconPalettes(void)
{
u8 i;
for (i = 0; i < 6; i++)
for (i = 0; i < ARRAY_COUNT(gMonIconPaletteTable); i++)
FreeSpritePaletteByTag(gMonIconPaletteTable[i].tag);
}
@ -1169,7 +1171,7 @@ void SafeFreeMonIconPalette(u16 species)
{
u8 palIndex;
if (species > NUM_SPECIES)
species = 260;
species = INVALID_ICON_SPECIES;
palIndex = gMonIconPaletteIndices[species];
FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag);
}
@ -1216,7 +1218,7 @@ void sub_80D304C(u16 offset)
u8 GetValidMonIconPalIndex(u16 species)
{
if (species > NUM_SPECIES)
species = 260;
species = INVALID_ICON_SPECIES;
return gMonIconPaletteIndices[species];
}
@ -1228,7 +1230,7 @@ u8 GetMonIconPaletteIndexFromSpecies(u16 species)
const u16* GetValidMonIconPalettePtr(u16 species)
{
if (species > NUM_SPECIES)
species = 260;
species = INVALID_ICON_SPECIES;
return gMonIconPaletteTable[gMonIconPaletteIndices[species]].data;
}