Regional Dex numbers are always 3 digits

This commit is contained in:
leo60228 2023-09-28 17:48:05 -04:00
parent d27e566b4b
commit 920fd481e7
No known key found for this signature in database
GPG key ID: 6F3EB461799AD95E
3 changed files with 45 additions and 33 deletions

View file

@ -25,7 +25,7 @@
#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. #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 // Pokédex settings
#define P_DEX_FOUR_DIGITS_AMOUNT TRUE // Since Gen 9, Pokédex numbers are four digits long. #define P_DEX_FOUR_DIGITS_AMOUNT TRUE // Since Gen 9, National Pokédex numbers are four digits long.
// Other settings // 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_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.

View file

@ -845,11 +845,8 @@ static const struct WindowTemplate sPokemonList_WindowTemplate[] =
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE static const u8 sText_No0000[] = _("{NO}0000");
static const u8 sText_No000[] = _("{NO}0000");
#else
static const u8 sText_No000[] = _("{NO}000"); static const u8 sText_No000[] = _("{NO}000");
#endif
static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp"); static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp");
static const u8 sText_TenDashes[] = _("----------"); static const u8 sText_TenDashes[] = _("----------");
@ -2437,20 +2434,24 @@ static void CreateMonDexNum(u16 entryNum, u8 left, u8 top, u16 unused)
#endif #endif
u16 dexNum; u16 dexNum;
memcpy(text, sText_No000, ARRAY_COUNT(text));
dexNum = sPokedexView->pokedexList[entryNum].dexNum; dexNum = sPokedexView->pokedexList[entryNum].dexNum;
if (sPokedexView->dexMode == DEX_MODE_HOENN) if (sPokedexView->dexMode == DEX_MODE_HOENN)
dexNum = NationalToHoennOrder(dexNum); dexNum = NationalToHoennOrder(dexNum);
#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE if (sPokedexView->dexMode == DEX_MODE_HOENN || !P_DEX_FOUR_DIGITS_AMOUNT)
text[2] = CHAR_0 + dexNum / 1000; {
text[3] = CHAR_0 + (dexNum % 1000) / 100; memcpy(text, sText_No000, ARRAY_COUNT(sText_No000));
text[4] = CHAR_0 + (dexNum % 100) / 10; text[2] = CHAR_0 + dexNum / 100;
text[5] = CHAR_0 + (dexNum % 10); text[3] = CHAR_0 + (dexNum % 100) / 10;
#else text[4] = CHAR_0 + (dexNum % 100) % 10;
text[2] = CHAR_0 + dexNum / 100; }
text[3] = CHAR_0 + (dexNum % 100) / 10; else
text[4] = CHAR_0 + (dexNum % 100) % 10; {
#endif 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);
}
PrintMonDexNumAndName(0, FONT_NARROW, text, left, top); PrintMonDexNumAndName(0, FONT_NARROW, text, left, top);
} }
@ -4127,28 +4128,38 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
const u8 *name; const u8 *name;
const u8 *category; const u8 *category;
const u8 *description; const u8 *description;
bool8 isNational;
if (newEntry) if (newEntry)
PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, DISPLAY_WIDTH), 0); PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, DISPLAY_WIDTH), 0);
if (value == 0) if (value == 0)
{
isNational = FALSE;
value = NationalToHoennOrder(num); value = NationalToHoennOrder(num);
}
else else
{
isNational = TRUE;
value = num; value = num;
#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE }
ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 4); if (P_DEX_FOUR_DIGITS_AMOUNT && isNational)
PrintInfoScreenText(str, 0x60, 0x19); {
name = GetSpeciesName(num); ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 4);
PrintInfoScreenText(name, 0x8A, 0x19); PrintInfoScreenText(str, 0x60, 0x19);
#else name = GetSpeciesName(num);
ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); PrintInfoScreenText(name, 0x8A, 0x19);
PrintInfoScreenText(str, 0x60, 0x19); }
natNum = NationalPokedexNumToSpecies(num);
if (natNum)
name = GetSpeciesName(natNum);
else else
name = sText_TenDashes2; {
PrintInfoScreenText(name, 0x84, 0x19); ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3);
#endif PrintInfoScreenText(str, 0x60, 0x19);
natNum = NationalPokedexNumToSpecies(num);
if (natNum)
name = GetSpeciesName(natNum);
else
name = sText_TenDashes2;
PrintInfoScreenText(name, 0x84, 0x19);
}
if (owned) if (owned)
{ {
CopyMonCategoryText(num, str2); CopyMonCategoryText(num, str2);

View file

@ -2837,10 +2837,11 @@ static void PrintNotEggInfo(void)
{ {
StringCopy(gStringVar1, &gText_NumberClear01[0]); StringCopy(gStringVar1, &gText_NumberClear01[0]);
#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE #if P_DEX_FOUR_DIGITS_AMOUNT == TRUE
ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, 4); if (IsNationalPokedexEnabled())
#else ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, 4);
ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, 3); else
#endif #endif
ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, 3);
StringAppend(gStringVar1, gStringVar2); StringAppend(gStringVar1, gStringVar2);
if (!IsMonShiny(mon)) if (!IsMonShiny(mon))
{ {