summaryrefslogtreecommitdiff
path: root/src/pokedex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pokedex.c')
-rw-r--r--src/pokedex.c123
1 files changed, 123 insertions, 0 deletions
diff --git a/src/pokedex.c b/src/pokedex.c
new file mode 100644
index 000000000..42c9326e3
--- /dev/null
+++ b/src/pokedex.c
@@ -0,0 +1,123 @@
+#include "global.h"
+#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"
+
+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;
+}