sovereignx/src/birch_pc.c

73 lines
2.1 KiB
C
Raw Normal View History

2018-02-12 10:12:15 +00:00
#include "global.h"
#include "event_data.h"
#include "field_message_box.h"
#include "pokedex.h"
2018-02-13 04:02:40 +00:00
#include "strings.h"
2018-02-12 10:12:15 +00:00
bool16 ScriptGetPokedexInfo(void)
{
if (gSpecialVar_0x8004 == 0) // is national dex not present?
{
2019-10-07 06:13:34 +01:00
gSpecialVar_0x8005 = GetHoennPokedexCount(FLAG_GET_SEEN);
gSpecialVar_0x8006 = GetHoennPokedexCount(FLAG_GET_CAUGHT);
2018-02-12 10:12:15 +00:00
}
else
{
2019-10-07 06:13:34 +01:00
gSpecialVar_0x8005 = GetNationalPokedexCount(FLAG_GET_SEEN);
gSpecialVar_0x8006 = GetNationalPokedexCount(FLAG_GET_CAUGHT);
2018-02-12 10:12:15 +00:00
}
return IsNationalPokedexEnabled();
}
2024-01-05 08:47:28 +00:00
#define BIRCH_DEX_STRINGS 21
static const u8 *const sBirchDexRatingTexts[BIRCH_DEX_STRINGS] =
{
gBirchDexRatingText_LessThan10,
gBirchDexRatingText_LessThan20,
gBirchDexRatingText_LessThan30,
gBirchDexRatingText_LessThan40,
gBirchDexRatingText_LessThan50,
gBirchDexRatingText_LessThan60,
gBirchDexRatingText_LessThan70,
gBirchDexRatingText_LessThan80,
gBirchDexRatingText_LessThan90,
gBirchDexRatingText_LessThan100,
gBirchDexRatingText_LessThan110,
gBirchDexRatingText_LessThan120,
gBirchDexRatingText_LessThan130,
gBirchDexRatingText_LessThan140,
gBirchDexRatingText_LessThan150,
gBirchDexRatingText_LessThan160,
gBirchDexRatingText_LessThan170,
gBirchDexRatingText_LessThan180,
gBirchDexRatingText_LessThan190,
gBirchDexRatingText_LessThan200,
gBirchDexRatingText_DexCompleted,
};
// This shows your Hoenn Pokédex rating and not your National Dex.
const u8 *GetPokedexRatingText(u32 count)
2018-02-12 10:12:15 +00:00
{
u32 i, j;
2024-01-05 08:47:28 +00:00
u16 maxDex = HOENN_DEX_COUNT - 1;
// doesNotCountForRegionalPokedex
for(i = 0; i < HOENN_DEX_COUNT; i++)
2018-02-12 10:12:15 +00:00
{
j = NationalPokedexNumToSpecies(HoennToNationalOrder(i + 1));
if (gSpeciesInfo[j].isMythical && !gSpeciesInfo[j].dexForceRequired)
{
if (GetSetPokedexFlag(j, FLAG_GET_CAUGHT))
count--;
maxDex--;
}
2018-02-12 10:12:15 +00:00
}
2024-01-05 08:47:28 +00:00
return sBirchDexRatingTexts[(count * (BIRCH_DEX_STRINGS - 1)) / maxDex];
2018-02-12 10:12:15 +00:00
}
void ShowPokedexRatingMessage(void)
{
ShowFieldMessage(GetPokedexRatingText(gSpecialVar_0x8004));
}