Automatically change dex number digits based on NATIONAL_DEX_COUNT
This commit is contained in:
parent
c74ad8251d
commit
ae1266e077
@ -27,9 +27,6 @@
|
||||
#define P_HIPPO_GENDER_DIFF_ICONS TRUE // If TRUE, will give Hippopotas and Hippowdon custom icons for their female forms.
|
||||
#define P_SHUCKLE_BERRY_JUICE TRUE // In Gen 2, Shuckle had a 1/16 chance of converting Berry that it's holding into Berry Juice. Setting this to TRUE will allow to do this with an Oran Berry, which is the spiritual succesor of the Berry item.
|
||||
|
||||
// Pokédex settings
|
||||
#define P_DEX_FOUR_DIGITS_AMOUNT TRUE // Since Gen 9, National Pokédex numbers are four digits long.
|
||||
|
||||
// Other settings
|
||||
#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs.
|
||||
#define P_EV_CAP GEN_LATEST // Since Gen 6, the max EVs per stat is 252 instead of 255.
|
||||
|
||||
@ -2428,31 +2428,22 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored)
|
||||
|
||||
static void CreateMonDexNum(u16 entryNum, u8 left, u8 top, u16 unused)
|
||||
{
|
||||
#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE
|
||||
u8 text[7];
|
||||
#else
|
||||
u8 text[6];
|
||||
#endif
|
||||
u16 dexNum;
|
||||
u16 dexNum, offset = 2;
|
||||
|
||||
dexNum = sPokedexView->pokedexList[entryNum].dexNum;
|
||||
if (sPokedexView->dexMode == DEX_MODE_HOENN)
|
||||
dexNum = NationalToHoennOrder(dexNum);
|
||||
if (sPokedexView->dexMode == DEX_MODE_HOENN || !P_DEX_FOUR_DIGITS_AMOUNT)
|
||||
memcpy(text, sText_No0000, ARRAY_COUNT(sText_No0000));
|
||||
if (NATIONAL_DEX_COUNT > 999)
|
||||
{
|
||||
memcpy(text, sText_No000, ARRAY_COUNT(sText_No000));
|
||||
text[2] = CHAR_0 + dexNum / 100;
|
||||
text[3] = CHAR_0 + (dexNum % 100) / 10;
|
||||
text[4] = CHAR_0 + (dexNum % 100) % 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(text, sText_No0000, ARRAY_COUNT(sText_No0000));
|
||||
text[2] = CHAR_0 + dexNum / 1000;
|
||||
text[3] = CHAR_0 + (dexNum % 1000) / 100;
|
||||
text[4] = CHAR_0 + (dexNum % 100) / 10;
|
||||
text[5] = CHAR_0 + (dexNum % 10);
|
||||
offset++;
|
||||
}
|
||||
text[offset] = CHAR_0 + (dexNum % 1000) / 100;
|
||||
text[offset + 1] = CHAR_0 + ((dexNum % 1000) % 100) / 10;
|
||||
text[offset + 2] = CHAR_0 + ((dexNum % 1000) % 100) % 10;
|
||||
text[offset + 3] = EOS;
|
||||
PrintMonDexNumAndName(0, FONT_NARROW, text, left, top);
|
||||
}
|
||||
|
||||
@ -4156,42 +4147,24 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
|
||||
const u8 *name;
|
||||
const u8 *category;
|
||||
const u8 *description;
|
||||
bool8 isNational;
|
||||
u8 digitCount = (NATIONAL_DEX_COUNT > 999 && IsNationalPokedexEnabled()) ? 4 : 3;
|
||||
|
||||
if (newEntry)
|
||||
PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, DISPLAY_WIDTH), 0);
|
||||
if (value == 0)
|
||||
{
|
||||
isNational = FALSE;
|
||||
value = NationalToHoennOrder(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
isNational = TRUE;
|
||||
value = num;
|
||||
}
|
||||
if (P_DEX_FOUR_DIGITS_AMOUNT && isNational)
|
||||
{
|
||||
ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 4);
|
||||
PrintInfoScreenText(str, 0x60, 0x19);
|
||||
natNum = NationalPokedexNumToSpecies(num);
|
||||
if (natNum)
|
||||
name = GetSpeciesName(natNum);
|
||||
else
|
||||
name = sText_TenDashes2;
|
||||
PrintInfoScreenText(name, 0x8A, 0x19);
|
||||
}
|
||||
|
||||
ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, digitCount);
|
||||
PrintInfoScreenText(str, 0x60, 0x19);
|
||||
natNum = NationalPokedexNumToSpecies(num);
|
||||
if (natNum)
|
||||
name = GetSpeciesName(natNum);
|
||||
else
|
||||
{
|
||||
ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3);
|
||||
PrintInfoScreenText(str, 0x60, 0x19);
|
||||
natNum = NationalPokedexNumToSpecies(num);
|
||||
if (natNum)
|
||||
name = GetSpeciesName(natNum);
|
||||
else
|
||||
name = sText_TenDashes2;
|
||||
PrintInfoScreenText(name, 0x84, 0x19);
|
||||
}
|
||||
name = sText_TenDashes2;
|
||||
PrintInfoScreenText(name, 114 + (6 * digitCount), 0x19);
|
||||
|
||||
if (owned)
|
||||
{
|
||||
CopyMonCategoryText(num, str2);
|
||||
|
||||
@ -125,7 +125,6 @@ extern const struct PokedexEntry gPokedexEntries[];
|
||||
|
||||
// static .rodata strings
|
||||
|
||||
static const u8 sText_No000[] = _("000");
|
||||
static const u8 sText_No0000[] = _("0000");
|
||||
static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp");
|
||||
static const u8 sText_TenDashes[] = _("----------");
|
||||
@ -2795,31 +2794,22 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored)
|
||||
|
||||
static void CreateMonDexNum(u16 entryNum, u8 left, u8 top, u16 unused)
|
||||
{
|
||||
#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE
|
||||
u8 text[5];
|
||||
#else
|
||||
u8 text[4];
|
||||
#endif
|
||||
u16 dexNum;
|
||||
u16 dexNum, offset = 0;
|
||||
|
||||
dexNum = sPokedexView->pokedexList[entryNum].dexNum;
|
||||
if (sPokedexView->dexMode == DEX_MODE_HOENN)
|
||||
dexNum = NationalToHoennOrder(dexNum);
|
||||
if (sPokedexView->dexMode == DEX_MODE_HOENN || !P_DEX_FOUR_DIGITS_AMOUNT)
|
||||
memcpy(text, sText_No0000, ARRAY_COUNT(sText_No0000));
|
||||
if (NATIONAL_DEX_COUNT > 999)
|
||||
{
|
||||
memcpy(text, sText_No000, ARRAY_COUNT(sText_No000));
|
||||
text[2] = CHAR_0 + dexNum / 100;
|
||||
text[3] = CHAR_0 + (dexNum % 100) / 10;
|
||||
text[4] = CHAR_0 + (dexNum % 100) % 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(text, sText_No0000, ARRAY_COUNT(sText_No0000));
|
||||
text[0] = CHAR_0 + dexNum / 1000;
|
||||
text[1] = CHAR_0 + (dexNum % 1000) / 100;
|
||||
text[2] = CHAR_0 + (dexNum % 100) / 10;
|
||||
text[3] = CHAR_0 + (dexNum % 10);
|
||||
offset = 1;
|
||||
}
|
||||
text[offset] = CHAR_0 + (dexNum % 1000) / 100;
|
||||
text[offset + 1] = CHAR_0 + ((dexNum % 1000) % 100) / 10;
|
||||
text[offset + 2] = CHAR_0 + ((dexNum % 1000) % 100) % 10;
|
||||
text[offset + 3] = EOS;
|
||||
PrintMonDexNumAndName(0, FONT_NARROW, text, left, top);
|
||||
}
|
||||
|
||||
|
||||
@ -2835,13 +2835,9 @@ static void PrintNotEggInfo(void)
|
||||
|
||||
if (dexNum != 0xFFFF)
|
||||
{
|
||||
u8 digitCount = (NATIONAL_DEX_COUNT > 999 && IsNationalPokedexEnabled()) ? 4 : 3;
|
||||
StringCopy(gStringVar1, &gText_NumberClear01[0]);
|
||||
#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE
|
||||
if (IsNationalPokedexEnabled())
|
||||
ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, 4);
|
||||
else
|
||||
#endif
|
||||
ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, 3);
|
||||
ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, digitCount);
|
||||
StringAppend(gStringVar1, gStringVar2);
|
||||
if (!IsMonShiny(mon))
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user