Merge pull request #88 from ultima-soul/pokedex_2

Port/Decompile pokedex.c and Dump Pokedex Entries and Text to C
This commit is contained in:
PikalaxALT
2019-08-24 13:14:50 -04:00
committed by GitHub
20 changed files with 7938 additions and 334 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -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, 0x100);
}
@@ -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);
}
+1 -1
View File
@@ -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:
+123
View File
@@ -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;
}
bool16 HasAllMons(void)
{
u16 i;
for (i = 0; i < NATIONAL_DEX_MEWTWO; i++)
{
if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT))
return FALSE;
}
for (i = NATIONAL_DEX_MEW; i < NATIONAL_DEX_TYRANITAR; i++)
{
if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT))
return FALSE;
}
for (i = NATIONAL_DEX_CELEBI; i < NATIONAL_DEX_RAYQUAZA; i++)
{
if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT))
return FALSE;
}
return TRUE;
}
+4 -4
View File
@@ -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();
}