sovereignx/src/birch_pc.c
Biffalo XIII 2cc26d935a Merge branch '_RHH/master' into _RHH/upcoming
# Conflicts:
#	data/battle_scripts_1.s
#	include/config/pokemon.h
#	src/birch_pc.c
2024-01-11 19:51:11 -03:00

72 lines
2.1 KiB
C

#include "global.h"
#include "event_data.h"
#include "field_message_box.h"
#include "pokedex.h"
#include "strings.h"
bool16 ScriptGetPokedexInfo(void)
{
if (gSpecialVar_0x8004 == 0) // is national dex not present?
{
gSpecialVar_0x8005 = GetHoennPokedexCount(FLAG_GET_SEEN);
gSpecialVar_0x8006 = GetHoennPokedexCount(FLAG_GET_CAUGHT);
}
else
{
gSpecialVar_0x8005 = GetNationalPokedexCount(FLAG_GET_SEEN);
gSpecialVar_0x8006 = GetNationalPokedexCount(FLAG_GET_CAUGHT);
}
return IsNationalPokedexEnabled();
}
#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)
{
u32 i, j;
u16 maxDex = HOENN_DEX_COUNT - 1;
// doesNotCountForRegionalPokedex
for(i = 0; i < HOENN_DEX_COUNT; i++)
{
j = NationalPokedexNumToSpecies(HoennToNationalOrder(i + 1));
if (gSpeciesInfo[j].isMythical && !gSpeciesInfo[j].dexForceRequired)
{
if (GetSetPokedexFlag(j, FLAG_GET_CAUGHT))
count--;
maxDex--;
}
}
return sBirchDexRatingTexts[(count * (BIRCH_DEX_STRINGS - 1)) / maxDex];
}
void ShowPokedexRatingMessage(void)
{
ShowFieldMessage(GetPokedexRatingText(gSpecialVar_0x8004));
}