From 3bbaf5a15d0bfaa5a002e834f6da9750a1d494a4 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 1 Jan 2022 19:24:34 -0300 Subject: [PATCH 1/2] Optimized SpeciesHasGenderDifference into Base Stat flag --- include/constants/species.h | 7 ++- include/data.h | 1 - src/data.c | 19 ------ src/data/pokemon/base_stats.h | 113 +++++++++++++++++++--------------- src/decompress.c | 4 +- src/pokemon.c | 8 +-- src/pokemon_icon.c | 4 +- src/pokemon_storage_system.c | 4 +- 8 files changed, 77 insertions(+), 83 deletions(-) diff --git a/include/constants/species.h b/include/constants/species.h index 5a410aa5b..9f79b83d9 100644 --- a/include/constants/species.h +++ b/include/constants/species.h @@ -2472,8 +2472,9 @@ #define HOENN_DEX_COUNT 212 // species flags -#define F_ULTRA_BEAST (1 << 0) -#define F_ALOLAN_FORM (1 << 1) -#define F_GALARIAN_FORM (1 << 2) +#define FLAG_ULTRA_BEAST (1 << 0) +#define FLAG_ALOLAN_FORM (1 << 1) +#define FLAG_GALARIAN_FORM (1 << 2) +#define FLAG_GENDER_DIFFERENCE (1 << 3) #endif // GUARD_CONSTANTS_SPECIES_H diff --git a/include/data.h b/include/data.h index 14de14bae..8a6d7cef7 100644 --- a/include/data.h +++ b/include/data.h @@ -124,7 +124,6 @@ extern const u8 gEnemyMonElevation[NUM_SPECIES]; extern const union AnimCmd *const *const gMonFrontAnimsPtrTable[]; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; extern const struct CompressedSpriteSheet gMonFrontPicTableFemale[]; -extern const bool8 SpeciesHasGenderDifference[NUM_SPECIES]; extern const struct Trainer gTrainers[]; extern const u8 gTrainerClassNames[][13]; diff --git a/src/data.c b/src/data.c index 2ece62412..4b216cfd2 100644 --- a/src/data.c +++ b/src/data.c @@ -302,25 +302,6 @@ const union AnimCmd *const gAnims_MonPic[] = #define SPECIES_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species} #define SPECIES_SHINY_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species + SPECIES_SHINY_TAG} -const bool8 SpeciesHasGenderDifference[NUM_SPECIES] = -{ - [SPECIES_EEVEE] = TRUE, - [SPECIES_STARLY] = TRUE, - [SPECIES_STARAVIA] = TRUE, - [SPECIES_STARAPTOR] = TRUE, - [SPECIES_BIDOOF] = TRUE, - [SPECIES_KRICKETOT] = TRUE, - [SPECIES_KRICKETUNE] = TRUE, - [SPECIES_SHINX] = TRUE, - [SPECIES_COMBEE] = TRUE, - [SPECIES_HIPPOPOTAS] = TRUE, - [SPECIES_HIPPOWDON] = TRUE, - [SPECIES_UNFEZANT] = TRUE, - [SPECIES_FRILLISH] = TRUE, - [SPECIES_JELLICENT] = TRUE, - [SPECIES_PYROAR] = TRUE, -}; - #include "data/pokemon_graphics/front_pic_coordinates.h" #include "data/pokemon_graphics/back_pic_coordinates.h" diff --git a/src/data/pokemon/base_stats.h b/src/data/pokemon/base_stats.h index 15e406ae2..8295f12ee 100644 --- a/src/data/pokemon/base_stats.h +++ b/src/data/pokemon/base_stats.h @@ -3790,6 +3790,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_VAPOREON] = @@ -11194,6 +11195,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_STARAVIA] = @@ -11222,6 +11224,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_STARAPTOR] = @@ -11282,6 +11285,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_BIBAREL] = @@ -11337,6 +11341,7 @@ const struct BaseStats gBaseStats[] = .abilities = {ABILITY_SHED_SKIN, ABILITY_NONE, ABILITY_RUN_AWAY}, .bodyColor = BODY_COLOR_RED, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_KRICKETUNE] = @@ -11368,6 +11373,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_RED, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_SHINX] = @@ -11396,6 +11402,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLUE, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_LUXIO] = @@ -11736,6 +11743,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_YELLOW, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_VESPIQUEN] = @@ -12672,6 +12680,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_HIPPOWDON] = @@ -12700,6 +12709,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_SKORUPI] = @@ -14676,6 +14686,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GRAY, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_BLITZLE] = @@ -16767,6 +16778,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_JELLICENT] = @@ -16795,6 +16807,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_ALOMOMOLA] = @@ -18879,6 +18892,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, + .flags = FLAG_GENDER_DIFFERENCE, }, [SPECIES_FLABEBE] = @@ -22437,7 +22451,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_BUZZWOLE] = @@ -22467,7 +22481,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_RED, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_PHEROMOSA] = @@ -22496,7 +22510,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_XURKITREE] = @@ -22525,7 +22539,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLACK, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_CELESTEELA] = @@ -22556,7 +22570,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GREEN, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_KARTANA] = @@ -22585,7 +22599,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_GUZZLORD] = @@ -22614,7 +22628,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLACK, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_NECROZMA] = @@ -22729,7 +22743,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_PURPLE, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_NAGANADEL] = @@ -22758,7 +22772,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_PURPLE, .noFlip = FALSE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_STAKATAKA] = @@ -22787,7 +22801,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GRAY, .noFlip = TRUE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_BLACEPHALON] = @@ -22816,7 +22830,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = TRUE, - .flags = F_ULTRA_BEAST, + .flags = FLAG_ULTRA_BEAST, }, [SPECIES_ZERAORA] = @@ -26779,7 +26793,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLACK, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_RATICATE_ALOLAN] = @@ -26809,7 +26823,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLACK, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_RAICHU_ALOLAN] = @@ -26838,7 +26852,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_SANDSHREW_ALOLAN] = @@ -26870,7 +26884,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLUE, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_SANDSLASH_ALOLAN] = @@ -26899,7 +26913,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLUE, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_VULPIX_ALOLAN] = @@ -26931,7 +26945,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLUE, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_NINETALES_ALOLAN] = @@ -26961,7 +26975,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLUE, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_DIGLETT_ALOLAN] = @@ -26991,7 +27005,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_DUGTRIO_ALOLAN] = @@ -27021,7 +27035,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = TRUE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_MEOWTH_ALOLAN] = @@ -27051,7 +27065,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GRAY, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_PERSIAN_ALOLAN] = @@ -27081,7 +27095,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GRAY, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_GEODUDE_ALOLAN] = @@ -27113,7 +27127,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_GRAVELER_ALOLAN] = @@ -27145,7 +27159,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_GOLEM_ALOLAN] = @@ -27174,7 +27188,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_GRIMER_ALOLAN] = @@ -27206,7 +27220,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GREEN, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_MUK_ALOLAN] = @@ -27236,7 +27250,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GREEN, .noFlip = TRUE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_EXEGGUTOR_ALOLAN] = @@ -27265,7 +27279,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_YELLOW, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_MAROWAK_ALOLAN] = @@ -27294,7 +27308,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_PURPLE, .noFlip = FALSE, - .flags = F_ALOLAN_FORM, + .flags = FLAG_ALOLAN_FORM, }, [SPECIES_MEOWTH_GALARIAN] = @@ -27323,7 +27337,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_PONYTA_GALARIAN] = @@ -27352,7 +27366,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_RAPIDASH_GALARIAN] = @@ -27381,7 +27395,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_SLOWPOKE_GALARIAN] = @@ -27410,10 +27424,9 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_PINK, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, - [SPECIES_SLOWBRO_GALARIAN] = { .baseHP = 95, @@ -27440,7 +27453,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_PINK, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_FARFETCHD_GALARIAN] = @@ -27470,7 +27483,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_WEEZING_GALARIAN] = @@ -27502,7 +27515,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GRAY, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_MR_MIME_GALARIAN] = @@ -27531,7 +27544,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_ARTICUNO_GALARIAN] = @@ -27560,7 +27573,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_PURPLE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_ZAPDOS_GALARIAN] = @@ -27589,7 +27602,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_YELLOW, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_MOLTRES_GALARIAN] = @@ -27618,7 +27631,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_RED, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_SLOWKING_GALARIAN] = @@ -27647,7 +27660,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_PINK, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_CORSOLA_GALARIAN] = @@ -27676,7 +27689,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_ZIGZAGOON_GALARIAN] = @@ -27705,7 +27718,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_LINOONE_GALARIAN] = @@ -27734,7 +27747,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_DARUMAKA_GALARIAN] = @@ -27759,7 +27772,7 @@ const struct BaseStats gBaseStats[] = .abilities = {ABILITY_HUSTLE, ABILITY_NONE, ABILITY_INNER_FOCUS}, .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_DARMANITAN_GALARIAN] = @@ -27788,7 +27801,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_YAMASK_GALARIAN] = @@ -27817,7 +27830,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_BLACK, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_STUNFISK_GALARIAN] = @@ -27846,7 +27859,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_GREEN, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_PIKACHU_COSPLAY] = @@ -29976,7 +29989,7 @@ const struct BaseStats gBaseStats[] = #endif .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = F_GALARIAN_FORM, + .flags = FLAG_GALARIAN_FORM, }, [SPECIES_DEERLING_SUMMER] = diff --git a/src/decompress.c b/src/decompress.c index c20b6404c..028679a5b 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -70,7 +70,7 @@ void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffe void DecompressPicFromTableGender(void* buffer, s32 species, u32 personality) { - if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) DecompressPicFromTable(&gMonFrontPicTableFemale[species], buffer, species); else DecompressPicFromTable(&gMonFrontPicTable[species], buffer, species); @@ -101,7 +101,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 } else if (species > NUM_SPECIES) // is species unknown? draw the ? icon LZ77UnCompWram(gMonFrontPicTable[0].data, dest); - else if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + else if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) { if (isFrontPic) LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest); diff --git a/src/pokemon.c b/src/pokemon.c index 96ea4798b..372c2ac6f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -7513,14 +7513,14 @@ const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 p shinyValue = GET_SHINY_VALUE(otId, personality); if (shinyValue < SHINY_ODDS) { - if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) return gMonShinyPaletteTableFemale[species].data; else return gMonShinyPaletteTable[species].data; } else { - if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) return gMonPaletteTableFemale[species].data; else return gMonPaletteTable[species].data; @@ -7542,14 +7542,14 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u shinyValue = GET_SHINY_VALUE(otId, personality); if (shinyValue < SHINY_ODDS) { - if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) return &gMonShinyPaletteTableFemale[species]; else return &gMonShinyPaletteTable[species]; } else { - if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) return &gMonPaletteTableFemale[species]; else return &gMonPaletteTable[species]; diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index b4f1d03a2..7161e64de 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -2581,7 +2581,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u if (species > NUM_SPECIES) iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG; - else if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + else if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndicesFemale[species]; spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority); @@ -2758,7 +2758,7 @@ void SpriteCB_MonIcon(struct Sprite *sprite) const u8* GetMonIconTiles(u16 species, u32 personality) { const u8* iconSprite = gMonIconTable[species]; - if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) { iconSprite = gMonIconTableFemale[species]; } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 1a3e8f0fe..cb64c2254 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -5120,7 +5120,7 @@ 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) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) species |= 0x8000; // 1 << 15 // Search icon list for this species @@ -5187,7 +5187,7 @@ static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s struct SpriteTemplate template = sSpriteTemplate_MonIcon; species = GetIconSpecies(species, personality); - if (SpeciesHasGenderDifference[species] && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) { template.paletteTag = PALTAG_MON_ICON_0 + gMonIconPaletteIndicesFemale[species]; } From d328c2e006d0c31905384173eb48a53eeeb58fd7 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 1 Jan 2022 21:07:49 -0300 Subject: [PATCH 2/2] Fixed references by debug menu. --- src/decompress.c | 2 +- src/pokemon_debug.c | 18 +++++++++--------- src/pokemon_icon.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/decompress.c b/src/decompress.c index 028679a5b..a1f92da2c 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -128,7 +128,7 @@ static void LoadSpecialPokePicCustom(const struct CompressedSpriteSheet *src, vo } else if (species > NUM_SPECIES) // is species unknown? draw the ? icon LZ77UnCompWram(gMonFrontPicTable[0].data, dest); - else if (SpeciesHasGenderDifference[species] && isFemale) + else if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale) { if (isFrontPic) LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest); diff --git a/src/pokemon_debug.c b/src/pokemon_debug.c index d43120e6a..5c1cf9490 100644 --- a/src/pokemon_debug.c +++ b/src/pokemon_debug.c @@ -417,21 +417,21 @@ static void PrintInstructionsOnWindow(struct PokemonDebugMenu *data) FillWindowPixelBuffer(WIN_INSTRUCTIONS, 0x11); if (data->currentSubmenu == 0) { - if (SpeciesHasGenderDifference[species]) + if (gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsGender, x, 0, 0, NULL); else AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructions, x, 0, 0, NULL); } else if (data->currentSubmenu == 1) { - if (SpeciesHasGenderDifference[species]) + if (gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuOneGender, x, 0, 0, NULL); else AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuOne, x, 0, 0, NULL); } else if (data->currentSubmenu == 2) { - if (SpeciesHasGenderDifference[species]) + if (gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuTwoGender, x, 0, 0, NULL); else AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuTwo, x, 0, 0, NULL); @@ -485,7 +485,7 @@ static void PrintDigitChars(struct PokemonDebugMenu *data) text[i++] = CHAR_SPACE; text[i++] = CHAR_HYPHEN; - if (SpeciesHasGenderDifference[species]) + if (gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) { if (data->isFemale) text[i++] = CHAR_FEMALE; @@ -688,14 +688,14 @@ static const struct CompressedSpritePalette *GetMonSpritePalStructCustom(u16 spe { if (isShiny) { - if (SpeciesHasGenderDifference[species] && isFemale) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale) return &gMonShinyPaletteTableFemale[species]; else return &gMonShinyPaletteTable[species]; } else { - if (SpeciesHasGenderDifference[species] && isFemale) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale) return &gMonPaletteTableFemale[species]; else return &gMonPaletteTable[species]; @@ -714,14 +714,14 @@ static void BattleLoadOpponentMonSpriteGfxCustom(u16 species, bool8 isFemale, bo if (isShiny) { - if (SpeciesHasGenderDifference[species] && isFemale) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale) lzPaletteData = gMonShinyPaletteTableFemale[species].data; else lzPaletteData = gMonShinyPaletteTable[species].data; } else { - if (SpeciesHasGenderDifference[species] && isFemale) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale) lzPaletteData = gMonPaletteTableFemale[species].data; else lzPaletteData = gMonPaletteTable[species].data; @@ -1472,7 +1472,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId) ReloadPokemonSprites(data); } - if (JOY_NEW(SELECT_BUTTON) && SpeciesHasGenderDifference[data->currentmonId]) + if (JOY_NEW(SELECT_BUTTON) && (gBaseStats[data->currentmonId].flags & FLAG_GENDER_DIFFERENCE)) { data->isFemale = !data->isFemale; PrintDigitChars(data); diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 7161e64de..666330975 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -2607,7 +2607,7 @@ u8 CreateMonIconCustom(u16 species, void (*callback)(struct Sprite *), s16 x, s1 if (species > NUM_SPECIES) iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG; - else if (SpeciesHasGenderDifference[species] && isFemale) + else if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale) iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndicesFemale[species]; spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority); @@ -2768,7 +2768,7 @@ const u8* GetMonIconTiles(u16 species, u32 personality) static const u8* GetMonIconTilesCustom(u16 species, bool8 isFemale) { const u8* iconSprite = gMonIconTable[species]; - if (SpeciesHasGenderDifference[species] && isFemale) + if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale) { iconSprite = gMonIconTableFemale[species]; }