mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-06 07:27:47 +01:00
PSS supports gender differences (kinda)
Update the PSS to show gender-specific icons for mons that have them. Comes with a small but harmless bug - could use some suggestions for fixing it!
This commit is contained in:
parent
fd6f7eadbb
commit
dc5259ed3f
@ -151,6 +151,7 @@ enum {
|
||||
};
|
||||
#define MENU_WALLPAPER_SETS_START MENU_SCENERY_1
|
||||
#define MENU_WALLPAPERS_START MENU_FOREST
|
||||
#define GENDER_MASK 0x7FFF
|
||||
|
||||
// Return IDs for input handlers
|
||||
enum {
|
||||
@ -5105,6 +5106,10 @@ static u16 TryLoadMonIconTiles(u16 species, u32 personality)
|
||||
{
|
||||
u16 i, offset;
|
||||
|
||||
// Treat female mons as a seperate species as they may have a different icon than males
|
||||
if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
|
||||
species |= 0x8000; // 1 << 15
|
||||
|
||||
// Search icon list for this species
|
||||
for (i = 0; i < MAX_MON_ICONS; i++)
|
||||
{
|
||||
@ -5131,6 +5136,7 @@ static u16 TryLoadMonIconTiles(u16 species, u32 personality)
|
||||
sStorage->iconSpeciesList[i] = species;
|
||||
sStorage->numIconsPerSpecies[i]++;
|
||||
offset = 16 * i;
|
||||
species &= GENDER_MASK;
|
||||
CpuCopy32(GetMonIconTiles(species, personality), (void*)(OBJ_VRAM0) + offset * 32, 0x200);
|
||||
|
||||
return offset;
|
||||
@ -5142,7 +5148,11 @@ static void RemoveSpeciesFromIconList(u16 species)
|
||||
|
||||
for (i = 0; i < MAX_MON_ICONS; i++)
|
||||
{
|
||||
if (sStorage->iconSpeciesList[i] == species)
|
||||
/* This is flawed - if a male mon with gender differeneces has its icon removed from the list,
|
||||
* but a female mon of the same species is still visible, its icon will also be cleared from the list.
|
||||
* This may create a small but noticable visual bug when switching boxes.
|
||||
*/
|
||||
if (sStorage->iconSpeciesList[i] == species || sStorage->iconSpeciesList[i] == (species | 0x8000))
|
||||
{
|
||||
if (--sStorage->numIconsPerSpecies[i] == 0)
|
||||
sStorage->iconSpeciesList[i] = SPECIES_NONE;
|
||||
@ -5158,7 +5168,15 @@ static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s
|
||||
struct SpriteTemplate template = sSpriteTemplate_MonIcon;
|
||||
|
||||
species = GetIconSpecies(species, personality);
|
||||
template.paletteTag = PALTAG_MON_ICON_0 + gMonIconPaletteIndices[species];
|
||||
if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
|
||||
{
|
||||
template.paletteTag = PALTAG_MON_ICON_0 + gMonIconPaletteIndicesFemale[species];
|
||||
}
|
||||
else
|
||||
{
|
||||
template.paletteTag = PALTAG_MON_ICON_0 + gMonIconPaletteIndices[species];
|
||||
}
|
||||
|
||||
tileNum = TryLoadMonIconTiles(species, personality);
|
||||
if (tileNum == 0xFFFF)
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user