Skip to content

Commit

Permalink
4 digits option for dex numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Dec 23, 2022
1 parent c356041 commit 9bad51c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/config/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions src/pokedex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = _("----------");

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9bad51c

Please sign in to comment.