From 9bad51cbc69786ecd2e6719f2bca201a961bff5e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 23 Dec 2022 11:32:01 -0300 Subject: [PATCH] 4 digits option for dex numbers --- include/config/pokemon.h | 1 + src/pokedex.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index c1c94c0f1c..5192d9ba23 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -12,6 +12,7 @@ #define P_DEX_EMPTY_ENTRY_SKIP TRUE // If TRUE, the Pokédex numerical order will skip empty entries if they don't have a seen or caught entry before or after. #define P_DEX_EMPTY_ENTRY_AT_ENDS FALSE // If TRUE and P_DEX_EMPTY_ENTRY_SKIP is on, it will show trailing missing entries at the beginning and end of the scrolling list. #define P_DEX_SEPARATE_FORMS_CAUGHT FALSE // If TRUE, in order to see form dex data, they need to be caught separately. +#define P_DEX_FOUR_DIGITS_AMOUNT TRUE // If TRUE, // Other settings #define P_SHEDINJA_BALL GEN_LATEST // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. diff --git a/src/pokedex.c b/src/pokedex.c index 08068e5e07..dff37e0f4c 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -868,7 +868,11 @@ static const struct WindowTemplate sPokemonList_WindowTemplate[] = DUMMY_WIN_TEMPLATE }; +#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE +static const u8 sText_No000[] = _("{NO}0000"); +#else static const u8 sText_No000[] = _("{NO}000"); +#endif static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp"); static const u8 sText_TenDashes[] = _("----------"); @@ -2547,16 +2551,27 @@ 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; memcpy(text, sText_No000, ARRAY_COUNT(text)); dexNum = sPokedexView->pokedexList[entryNum].dexNum; if (sPokedexView->dexMode == DEX_MODE_HOENN) dexNum = NationalToHoennOrder(dexNum); +#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE + 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); +#else text[2] = CHAR_0 + dexNum / 100; text[3] = CHAR_0 + (dexNum % 100) / 10; text[4] = CHAR_0 + (dexNum % 100) % 10; +#endif PrintMonDexNumAndName(0, FONT_NARROW, text, left, top); } @@ -4244,7 +4259,11 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) value = SpeciesToHoennPokedexNum(num); else value = SpeciesToNationalPokedexNum(num); +#if P_DEX_FOUR_DIGITS_AMOUNT == TRUE + ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 4); +#else ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); +#endif PrintInfoScreenText(str, 0x60, 0x19); name = GetSpeciesName(num); PrintInfoScreenText(name, 0x84, 0x19);