diff options
-rw-r--r-- | include/pokedex.h | 3 | ||||
-rw-r--r-- | src/birch_pc.c | 10 | ||||
-rw-r--r-- | src/pokedex.c | 9 | ||||
-rw-r--r-- | src/pokemon_3.c | 15 |
4 files changed, 20 insertions, 17 deletions
diff --git a/include/pokedex.h b/include/pokedex.h index f051b4afe..1d3d9b388 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -3,6 +3,9 @@ #include "sprite.h" +#define HOENN_DEX_COUNT 202 +#define NATIONAL_DEX_COUNT 386 + void ResetPokedex(void); void sub_808C0A0(void); void CB2_InitPokedex(void); diff --git a/src/birch_pc.c b/src/birch_pc.c index 4b0025504..2a76b3c8c 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -87,24 +87,24 @@ const u8 *GetPokedexRatingText(u16 count) return gBirchDexRatingText_LessThan180; if (count < 190) return gBirchDexRatingText_LessThan190; - if (count < 200) + if (count < HOENN_DEX_COUNT - 2) return gBirchDexRatingText_LessThan200; - if (count == 200) + if (count == HOENN_DEX_COUNT - 2) { if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) || GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200. return gBirchDexRatingText_LessThan200; return gBirchDexRatingText_DexCompleted; } - if (count == 201) + if (count == HOENN_DEX_COUNT - 1) { if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) && GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200. return gBirchDexRatingText_LessThan200; return gBirchDexRatingText_DexCompleted; } - if (count == 202) - return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210. + if (count == HOENN_DEX_COUNT) + return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, a count of 202 means Jirachi and Deoxys are obtained return gBirchDexRatingText_LessThan10; } diff --git a/src/pokedex.c b/src/pokedex.c index eb4d1d918..caa6a1565 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -26,7 +26,6 @@ #include "scanline_effect.h" #include "ewram.h" -#define NATIONAL_DEX_COUNT 386 struct PokedexListItem { @@ -1971,7 +1970,7 @@ static void SortPokedex(u8 dexMode, u8 sortMode) { default: case DEX_MODE_HOENN: - vars[0] = 202; + vars[0] = HOENN_DEX_COUNT; vars[1] = 1; break; case DEX_MODE_NATIONAL: @@ -1982,7 +1981,7 @@ static void SortPokedex(u8 dexMode, u8 sortMode) } else { - vars[0] = 202; + vars[0] = HOENN_DEX_COUNT; vars[1] = 1; } break; @@ -2028,7 +2027,7 @@ static void SortPokedex(u8 dexMode, u8 sortMode) } break; case 1: - for (i = 0; i < 411; i++) + for (i = 0; i < POKEMON_SLOTS_NUMBER - 1; i++) { vars[2] = gPokedexOrder_Alphabetical[i]; @@ -4060,7 +4059,7 @@ u16 GetHoennPokedexCount(u8 caseID) u16 count = 0; u16 i; - for (i = 0; i < 202; i++) + for (i = 0; i < HOENN_DEX_COUNT; i++) { switch (caseID) { diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 30e9503cd..4814c900d 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -12,6 +12,7 @@ #include "main.h" #include "move_tutor_menu.h" #include "pokemon.h" +#include "pokedex.h" #include "random.h" #include "overworld.h" #include "rom_8077ABC.h" @@ -390,10 +391,10 @@ u16 HoennPokedexNumToSpecies(u16 hoennNum) species = 0; - while (species < 411 && gSpeciesToHoennPokedexNum[species] != hoennNum) + while (species < POKEMON_SLOTS_NUMBER - 1 && gSpeciesToHoennPokedexNum[species] != hoennNum) species++; - if (species == 411) + if (species == POKEMON_SLOTS_NUMBER - 1) return 0; return species + 1; @@ -408,10 +409,10 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum) species = 0; - while (species < 411 && gSpeciesToNationalPokedexNum[species] != nationalNum) + while (species < POKEMON_SLOTS_NUMBER - 1 && gSpeciesToNationalPokedexNum[species] != nationalNum) species++; - if (species == 411) + if (species == POKEMON_SLOTS_NUMBER - 1) return 0; return species + 1; @@ -426,10 +427,10 @@ u16 NationalToHoennOrder(u16 nationalNum) hoennNum = 0; - while (hoennNum < 411 && gHoennToNationalOrder[hoennNum] != nationalNum) + while (hoennNum < POKEMON_SLOTS_NUMBER - 1 && gHoennToNationalOrder[hoennNum] != nationalNum) hoennNum++; - if (hoennNum == 411) + if (hoennNum == POKEMON_SLOTS_NUMBER - 1) return 0; return hoennNum + 1; @@ -1095,7 +1096,7 @@ u16 SpeciesToPokedexNum(u16 species) else { species = SpeciesToHoennPokedexNum(species); - if (species <= 202) + if (species <= HOENN_DEX_COUNT) return species; return 0xFFFF; } |