Port pokedex.c

This commit is contained in:
ultima-soul
2019-08-04 15:11:02 -07:00
parent 9ceff166bc
commit bbc7c6ccfc
16 changed files with 147 additions and 314 deletions
+116 -1
View File
@@ -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"
#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;
}