diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/diploma.c | 4 | ||||
-rw-r--r-- | src/help_system_812B1E0.c | 2 | ||||
-rw-r--r-- | src/pokedex.c | 117 | ||||
-rw-r--r-- | src/prof_pc.c | 8 |
4 files changed, 123 insertions, 8 deletions
diff --git a/src/diploma.c b/src/diploma.c index 517ee8aa0..e32d7592f 100644 --- a/src/diploma.c +++ b/src/diploma.c @@ -132,7 +132,7 @@ static void Task_DiplomaInit(u8 taskId) CopyToBgTilemapBuffer(1, gUnknown_84154E8, 0, 0); break; case 4: - if (HasAllKantoMons()) + if (HasAllMons()) { SetGpuReg(REG_OFFSET_BG1HOFS, 0x80 << 1); } @@ -265,7 +265,7 @@ static void DiplomaPrintText(void) u32 width; DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock2Ptr->playerName); - if (HasAllKantoMons()) + if (HasAllMons()) { DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_841B68F); } diff --git a/src/help_system_812B1E0.c b/src/help_system_812B1E0.c index 98d6ce8be..024cfcf09 100644 --- a/src/help_system_812B1E0.c +++ b/src/help_system_812B1E0.c @@ -1247,7 +1247,7 @@ static bool8 sub_812B780(u8 id) return FlagGet(FLAG_0x828); case 4: case 34: - if (sub_8088EDC(1) > 1) + if (GetKantoPokedexCount(1) > 1) return TRUE; return FALSE; case 15: diff --git a/src/pokedex.c b/src/pokedex.c index 485605233..42c9326e3 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2,7 +2,122 @@ #include "pokedex.h" #include "constants/species.h" +extern s8 sub_8104AB0(u16 nationalDexNo, u8 caseID, u8 unk); + ALIGNED(4) static const u8 gExpandedPlaceholder_PokedexDescription[] = _(""); #include "data/pokemon/pokedex_text.h" -#include "data/pokemon/pokedex_entries.h"
\ No newline at end of file +#include "data/pokemon/pokedex_entries.h" + +const u8 *sub_8088E20(u16 dexNum) +{ + return gPokedexEntries[dexNum].categoryName; +} + +u16 GetPokedexHeightWeight(u16 dexNum, u8 data) +{ + switch (data) + { + case 0: // height + return gPokedexEntries[dexNum].height; + case 1: // weight + return gPokedexEntries[dexNum].weight; + default: + return 1; + } +} + +s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID) +{ + return sub_8104AB0(nationalDexNo, caseID, 0); +} + +u16 GetNationalPokedexCount(u8 caseID) +{ + u16 count = 0; + u16 i; + + for (i = 0; i < NATIONAL_DEX_COUNT; i++) + { + switch (caseID) + { + case FLAG_GET_SEEN: + if (GetSetPokedexFlag(i + 1, FLAG_GET_SEEN)) + count++; + break; + case FLAG_GET_CAUGHT: + if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) + count++; + break; + } + } + return count; +} + +u16 GetKantoPokedexCount(u8 caseID) +{ + u16 count = 0; + u16 i; + + for (i = 0; i < KANTO_DEX_COUNT; i++) + { + switch (caseID) + { + case FLAG_GET_SEEN: + if (GetSetPokedexFlag(i + 1, FLAG_GET_SEEN)) + count++; + break; + case FLAG_GET_CAUGHT: + if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) + count++; + break; + } + } + return count; +} + +bool16 HasAllHoennMons(void) +{ + u16 i; + + for (i = 0; i < HOENN_DEX_COUNT - 2; i++) + { + if (!GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_CAUGHT)) + return FALSE; + } + return TRUE; +} + +bool8 HasAllKantoMons(void) +{ + u16 i; + + for (i = 0; i < KANTO_DEX_COUNT - 1; i++) + { + if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) + return FALSE; + } + return TRUE; +} + +u16 HasAllMons(void) +{ + u16 i; + + for (i = 0; i < NATIONAL_DEX_MEWTWO; i++) + { + if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) + return 0; + } + for (i = NATIONAL_DEX_MEW; i < NATIONAL_DEX_TYRANITAR; i++) + { + if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) + return 0; + } + for (i = NATIONAL_DEX_CELEBI; i < NATIONAL_DEX_RAYQUAZA; i++) + { + if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) + return 0; + } + return 1; +} diff --git a/src/prof_pc.c b/src/prof_pc.c index cfccbd6e3..35566e714 100644 --- a/src/prof_pc.c +++ b/src/prof_pc.c @@ -25,13 +25,13 @@ u16 Special_GetPokedexCount(void) { if (gSpecialVar_0x8004 == 0) { - gSpecialVar_0x8005 = sub_8088EDC(0); - gSpecialVar_0x8006 = sub_8088EDC(1); + gSpecialVar_0x8005 = GetKantoPokedexCount(0); + gSpecialVar_0x8006 = GetKantoPokedexCount(1); } else { - gSpecialVar_0x8005 = pokedex_count(0); - gSpecialVar_0x8006 = pokedex_count(1); + gSpecialVar_0x8005 = GetNationalPokedexCount(0); + gSpecialVar_0x8006 = GetNationalPokedexCount(1); } return sub_806E25C(); } |