Refactor dex completion (again) (#3937)
* Refactor dex completion
* Incorporate Alex's requests
* rename to dexForceRequired
* Revert GetPokedexRatingText argument type
* Apply suggestions from code review
Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
* Revert "Revert GetPokedexRatingText argument type"
This reverts commit a9b0c28040
.
* Fix HasAllMons
* Fix oops
---------
Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
This commit is contained in:
parent
e0f672fbad
commit
a8a504ef25
4 changed files with 22 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
||||||
#ifndef GUARD_BIRCH_PC_H
|
#ifndef GUARD_BIRCH_PC_H
|
||||||
#define GUARD_BIRCH_PC_H
|
#define GUARD_BIRCH_PC_H
|
||||||
|
|
||||||
const u8 *GetPokedexRatingText(u16 count);
|
const u8 *GetPokedexRatingText(u32 count);
|
||||||
|
|
||||||
#endif // GUARD_BIRCH_PC_H
|
#endif // GUARD_BIRCH_PC_H
|
||||||
|
|
|
@ -394,7 +394,8 @@ struct SpeciesInfo /*0x8C*/
|
||||||
u32 isPaldeanForm:1;
|
u32 isPaldeanForm:1;
|
||||||
u32 cannotBeTraded:1;
|
u32 cannotBeTraded:1;
|
||||||
u32 allPerfectIVs:1;
|
u32 allPerfectIVs:1;
|
||||||
u32 padding4:18;
|
u32 dexForceRequired:1; // This species will be taken into account for Pokédex ratings even if they have the "isMythical" flag set.
|
||||||
|
u32 padding4:17;
|
||||||
// Move Data
|
// Move Data
|
||||||
/* 0x80 */ const struct LevelUpMove *levelUpLearnset;
|
/* 0x80 */ const struct LevelUpMove *levelUpLearnset;
|
||||||
/* 0x84 */ const u16 *teachableLearnset;
|
/* 0x84 */ const u16 *teachableLearnset;
|
||||||
|
|
|
@ -20,13 +20,6 @@ bool16 ScriptGetPokedexInfo(void)
|
||||||
return IsNationalPokedexEnabled();
|
return IsNationalPokedexEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Species in this array are ignored in the progress towards a full regional dex
|
|
||||||
static const u16 sRegionalNotCountedList[] = {
|
|
||||||
SPECIES_JIRACHI,
|
|
||||||
SPECIES_DEOXYS,
|
|
||||||
SPECIES_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
#define BIRCH_DEX_STRINGS 21
|
#define BIRCH_DEX_STRINGS 21
|
||||||
|
|
||||||
static const u8 *const sBirchDexRatingTexts[BIRCH_DEX_STRINGS] =
|
static const u8 *const sBirchDexRatingTexts[BIRCH_DEX_STRINGS] =
|
||||||
|
@ -55,16 +48,21 @@ static const u8 *const sBirchDexRatingTexts[BIRCH_DEX_STRINGS] =
|
||||||
};
|
};
|
||||||
|
|
||||||
// This shows your Hoenn Pokedex rating and not your National Dex.
|
// This shows your Hoenn Pokedex rating and not your National Dex.
|
||||||
const u8 *GetPokedexRatingText(u16 count)
|
const u8 *GetPokedexRatingText(u32 count)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i, j;
|
||||||
u16 maxDex = HOENN_DEX_COUNT - 1;
|
u16 maxDex = HOENN_DEX_COUNT - 1;
|
||||||
for(i = 0; sRegionalNotCountedList[i] != SPECIES_NONE; i++)
|
// doesNotCountForRegionalPokedex
|
||||||
|
for(i = 0; i < HOENN_DEX_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(sRegionalNotCountedList[i]), FLAG_GET_CAUGHT))
|
j = NationalPokedexNumToSpecies(HoennToNationalOrder(i + 1));
|
||||||
|
if (gSpeciesInfo[j].isMythical && !gSpeciesInfo[j].dexForceRequired)
|
||||||
|
{
|
||||||
|
if (GetSetPokedexFlag(j, FLAG_GET_CAUGHT))
|
||||||
count--;
|
count--;
|
||||||
maxDex--;
|
maxDex--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return sBirchDexRatingTexts[(count * (BIRCH_DEX_STRINGS - 1)) / maxDex];
|
return sBirchDexRatingTexts[(count * (BIRCH_DEX_STRINGS - 1)) / maxDex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4379,12 +4379,12 @@ u16 GetKantoPokedexCount(u8 caseID)
|
||||||
|
|
||||||
bool16 HasAllHoennMons(void)
|
bool16 HasAllHoennMons(void)
|
||||||
{
|
{
|
||||||
u16 i;
|
u32 i, j;
|
||||||
|
|
||||||
// -2 excludes Jirachi and Deoxys
|
for (i = 0; i < HOENN_DEX_COUNT; i++)
|
||||||
for (i = 0; i < HOENN_DEX_COUNT - 2; i++)
|
|
||||||
{
|
{
|
||||||
if (!GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_CAUGHT))
|
j = HoennToNationalOrder(i + 1);
|
||||||
|
if (!(gSpeciesInfo[j].isMythical && !gSpeciesInfo[j].dexForceRequired) && !GetSetPokedexFlag(j, FLAG_GET_CAUGHT))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -4392,7 +4392,7 @@ bool16 HasAllHoennMons(void)
|
||||||
|
|
||||||
bool8 HasAllKantoMons(void)
|
bool8 HasAllKantoMons(void)
|
||||||
{
|
{
|
||||||
u16 i;
|
u32 i;
|
||||||
|
|
||||||
// -1 excludes Mew
|
// -1 excludes Mew
|
||||||
for (i = 0; i < KANTO_DEX_COUNT - 1; i++)
|
for (i = 0; i < KANTO_DEX_COUNT - 1; i++)
|
||||||
|
@ -4405,11 +4405,12 @@ bool8 HasAllKantoMons(void)
|
||||||
|
|
||||||
bool16 HasAllMons(void)
|
bool16 HasAllMons(void)
|
||||||
{
|
{
|
||||||
u16 i;
|
u32 i, j;
|
||||||
|
|
||||||
for (i = 1; i < NATIONAL_DEX_COUNT + 1; i++)
|
for (i = 1; i < NATIONAL_DEX_COUNT + 1; i++)
|
||||||
{
|
{
|
||||||
if (!(gSpeciesInfo[i].isMythical) && !GetSetPokedexFlag(i, FLAG_GET_CAUGHT))
|
j = NationalPokedexNumToSpecies(i);
|
||||||
|
if (!(gSpeciesInfo[j].isMythical && !gSpeciesInfo[j].dexForceRequired) && !GetSetPokedexFlag(j, FLAG_GET_CAUGHT))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue