diff --git a/include/config/test.h b/include/config/test.h index 8dba50f8a7..cba8012d36 100644 --- a/include/config/test.h +++ b/include/config/test.h @@ -5,5 +5,7 @@ #define B_EXPANDED_MOVE_NAMES TRUE #undef I_EXPANDED_ITEM_NAMES #define I_EXPANDED_ITEM_NAMES TRUE +#undef POKEMON_NAME_LENGTH +#define POKEMON_NAME_LENGTH 12 #endif // GUARD_CONFIG_TEST_H diff --git a/src/battle_dome.c b/src/battle_dome.c index 95490a54ea..ca105beb17 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -4256,6 +4256,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) textPrinter.currentChar = GetSpeciesName(DOME_MONS[trainerTourneyId][i]); else textPrinter.currentChar = GetSpeciesName(gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].species); + textPrinter.fontId = GetFontIdToFit(textPrinter.currentChar, FONT_SHORT, 0, 60); textPrinter.windowId = WIN_TRAINER_MON1_NAME + i + windowId; if (i == 1) @@ -4267,6 +4268,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) CopyWindowToVram(WIN_TRAINER_MON1_NAME + i + windowId, COPYWIN_FULL); AddTextPrinter(&textPrinter, 0, NULL); } + textPrinter.fontId = FONT_SHORT; PutWindowTilemap(windowId + WIN_TRAINER_FLAVOR_TEXT); CopyWindowToVram(windowId + WIN_TRAINER_FLAVOR_TEXT, COPYWIN_FULL); diff --git a/src/contest.c b/src/contest.c index c063b4a3b4..be8bb3e92b 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1085,6 +1085,12 @@ static const s8 sContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGO } }; +static void CopyNicknameToFit(u8 *dest, u32 contestant) +{ + u8 *end = StringCopy(dest, gContestMons[contestant].nickname); + WrapFontIdToFit(dest, end, FONT_NORMAL, 60); +} + static void CopyMoveNameToFit(u8 *dest, u32 move) { u8 *end = StringCopy(dest, GetMoveName(move)); @@ -1905,7 +1911,7 @@ static void Task_DoAppeals(u8 taskId) else { ContestClearGeneralTextWindow(); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar1, contestant); if (eContestantStatus[contestant].currMove < MOVES_COUNT) StringCopy(gStringVar2, GetMoveName(eContestantStatus[contestant].currMove)); else @@ -2171,7 +2177,7 @@ static void Task_DoAppeals(u8 taskId) || eContestantStatus[contestant].turnSkipped) { ContestClearGeneralTextWindow(); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar1, contestant); StringExpandPlaceholders(gStringVar4, gText_MonCantAppealNextTurn); Contest_StartTextPrinter(gStringVar4, TRUE); } @@ -2213,7 +2219,7 @@ static void Task_DoAppeals(u8 taskId) { // Started combo ContestClearGeneralTextWindow(); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar1, contestant); StringExpandPlaceholders(gStringVar4, gText_JudgeLookedAtMonExpectantly); Contest_StartTextPrinter(gStringVar4, TRUE); DoJudgeSpeechBubble(JUDGE_SYMBOL_ONE_EXCLAMATION); @@ -2257,7 +2263,7 @@ static void Task_DoAppeals(u8 taskId) if (eContestantStatus[contestant].repeatedMove) { ContestClearGeneralTextWindow(); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar1, contestant); StringExpandPlaceholders(gStringVar4, gText_RepeatedAppeal); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].tCounter = 0; @@ -2312,7 +2318,7 @@ static void Task_DoAppeals(u8 taskId) r3 = 0; ContestClearGeneralTextWindow(); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar1, contestant); eContest.applauseLevel += r3; if (eContest.applauseLevel < 0) eContest.applauseLevel = 0; @@ -2434,8 +2440,8 @@ static void Task_DoAppeals(u8 taskId) return; case APPEALSTATE_PRINT_CROWD_WATCHES_MSG: ContestClearGeneralTextWindow(); - StringCopy(gStringVar3, gContestMons[eContestExcitement.freezer].nickname); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar3, eContestExcitement.freezer); + CopyNicknameToFit(gStringVar1, contestant); CopyMoveNameToFit(gStringVar2, eContestantStatus[contestant].currMove); StringExpandPlaceholders(gStringVar4, gText_CrowdContinuesToWatchMon); Contest_StartTextPrinter(gStringVar4, TRUE); @@ -2461,7 +2467,7 @@ static void Task_DoAppeals(u8 taskId) if (eContestantStatus[contestant].hasJudgesAttention) eContestantStatus[contestant].hasJudgesAttention = FALSE; StartStopFlashJudgeAttentionEye(contestant); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar1, contestant); CopyMoveNameToFit(gStringVar2, eContestantStatus[contestant].currMove); StringExpandPlaceholders(gStringVar4, gText_MonWasTooNervousToMove); Contest_StartTextPrinter(gStringVar4, TRUE); @@ -2506,7 +2512,7 @@ static void Task_DoAppeals(u8 taskId) return; case APPEALSTATE_PRINT_SKIP_TURN_MSG: ContestClearGeneralTextWindow(); - StringCopy(gStringVar1, gContestMons[contestant].nickname); + CopyNicknameToFit(gStringVar1, contestant); StringExpandPlaceholders(gStringVar4, gText_MonWasWatchingOthers); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].tState = APPEALSTATE_WAIT_SKIP_TURN_MSG; diff --git a/src/contest_util.c b/src/contest_util.c index 7977f373c1..c90113c5ce 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -130,6 +130,7 @@ static void LoadContestResultsTitleBarTilemaps(void); static u8 GetNumPreliminaryPoints(u8, bool8); static s8 GetNumRound2Points(u8, bool8); static void AddContestTextPrinter(int, u8 *, int); +static void AddContestTextPrinterFitWidth(int, u8 *, int, int); static void AllocContestResults(void); static void FreeContestResults(void); static void LoadAllContestMonIcons(u8, u8); @@ -504,7 +505,7 @@ static void LoadContestMonName(u8 monIndex) str = StringCopy(gDisplayedStringBattle, gText_ColorDarkGray); StringCopy(str, mon->nickname); - AddContestTextPrinter(monIndex, gDisplayedStringBattle, 0); + AddContestTextPrinterFitWidth(monIndex, gDisplayedStringBattle, 0, 49); StringCopy(str, gText_Slash); StringAppend(str, mon->trainerName); AddContestTextPrinter(monIndex, gDisplayedStringBattle, 50); @@ -1916,12 +1917,12 @@ static void FreeContestResults(void) FreeMonSpritesGfx(); } -static void AddContestTextPrinter(int windowId, u8 *str, int x) +static void AddContestTextPrinterFitWidth(int windowId, u8 *str, int x, int widthPx) { struct TextPrinterTemplate textPrinter; textPrinter.currentChar = str; textPrinter.windowId = windowId; - textPrinter.fontId = FONT_NARROW; + textPrinter.fontId = GetFontIdToFit(str, FONT_NARROW, 0, widthPx); textPrinter.x = x; textPrinter.y = 2; textPrinter.currentX = x; @@ -1936,6 +1937,11 @@ static void AddContestTextPrinter(int windowId, u8 *str, int x) PutWindowTilemap(windowId); } +static void AddContestTextPrinter(int windowId, u8 *str, int x) +{ + AddContestTextPrinterFitWidth(windowId, str, x, DISPLAY_WIDTH); +} + void TryEnterContestMon(void) { u8 eligibility = GetContestEntryEligibility(&gPlayerParty[gContestMonPartyIndex]); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 2837931ea1..1c3b00f2ef 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -452,8 +452,8 @@ static void Task_Hof_InitMonData(u8 taskId) sHofMonPtr->mon[i].isShiny = GetMonData(&gPlayerParty[i], MON_DATA_IS_SHINY); sHofMonPtr->mon[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); sHofMonPtr->mon[i].lvl = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME10, nickname); - for (j = 0; j < VANILLA_POKEMON_NAME_LENGTH; j++) + GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME, nickname); + for (j = 0; j < POKEMON_NAME_LENGTH; j++) sHofMonPtr->mon[i].nickname[j] = nickname[j]; gTasks[taskId].tMonNumber++; } @@ -1167,11 +1167,15 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u } else { - width = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x80); - AddTextPrinterParameterized3(0, FONT_NORMAL, width, 1, sMonInfoTextColors, TEXT_SKIP_DRAW, text); + u32 fontId = GetFontIdToFit(text, FONT_NORMAL, 0, 66); + width = GetStringRightAlignXOffset(fontId, text, 0x80); + AddTextPrinterParameterized3(0, fontId, width, 1, sMonInfoTextColors, TEXT_SKIP_DRAW, text); text[0] = CHAR_SLASH; - stringPtr = StringCopy(text + 1, GetSpeciesName(currMon->species)); + text[1] = EXT_CTRL_CODE_BEGIN; + text[2] = EXT_CTRL_CODE_FONT; + text[3] = fontId; + stringPtr = StringCopy(text + 4, GetSpeciesName(currMon->species)); if (currMon->species != SPECIES_NIDORAN_M && currMon->species != SPECIES_NIDORAN_F) { diff --git a/src/naming_screen.c b/src/naming_screen.c index 848e5b1a48..d21130284e 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1710,10 +1710,11 @@ static void DrawNormalTextEntryBox(void) static void DrawMonTextEntryBox(void) { - u8 buffer[32]; + u8 buffer[64]; - StringCopy(buffer, GetSpeciesName(sNamingScreen->monSpecies)); - StringAppendN(buffer, sNamingScreen->template->title, 15); + u8 *end = StringCopy(buffer, GetSpeciesName(sNamingScreen->monSpecies)); + WrapFontIdToFit(buffer, end, FONT_NORMAL, 128 - 64); + StringAppendN(end, sNamingScreen->template->title, 15); FillWindowPixelBuffer(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], PIXEL_FILL(1)); AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], FONT_NORMAL, buffer, 8, 1, 0, 0); PutWindowTilemap(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX]); diff --git a/src/pokedex.c b/src/pokedex.c index 0eb99d701e..75f8d70720 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2339,21 +2339,13 @@ static void CreatePokedexList(u8 dexMode, u8 order) static void PrintMonDexNum(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top) { - u8 color[3]; - - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GRAY; + static const u8 color[3] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_LIGHT_GRAY }; AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, TEXT_SKIP_DRAW, str); } static void PrintMonName(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top) { - u8 color[3]; - - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GRAY; + static const u8 color[3] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_LIGHT_GRAY }; fontId = GetFontIdToFit(str, fontId, 0, 50); AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, TEXT_SKIP_DRAW, str); } @@ -4682,7 +4674,7 @@ static void UNUSED UnusedPrintNum(u8 windowId, u16 num, u8 left, u8 top) static u8 PrintCryScreenSpeciesName(u8 windowId, u16 num, u8 left, u8 top) { - u8 str[POKEMON_NAME_LENGTH + 1]; + u8 str[POKEMON_NAME_BUFFER_SIZE]; u8 i; for (i = 0; i < ARRAY_COUNT(str); i++) @@ -4693,6 +4685,7 @@ static u8 PrintCryScreenSpeciesName(u8 windowId, u16 num, u8 left, u8 top) default: for (i = 0; GetSpeciesName(num)[i] != EOS && i < POKEMON_NAME_LENGTH; i++) str[i] = GetSpeciesName(num)[i]; + WrapFontIdToFit(str, str + i, FONT_NORMAL, 60); break; case 0: for (i = 0; i < 5; i++) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index b60dfb7daf..111d153d2f 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -4028,16 +4028,16 @@ static void PrintDisplayMonInfo(void) FillWindowPixelBuffer(WIN_DISPLAY_INFO, PIXEL_FILL(1)); if (sStorage->boxOption != OPTION_MOVE_ITEMS) { - AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonNameText, FONT_NORMAL, 0, 9*8 - 6), sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL); - AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonNameText, FONT_SHORT, 0, 9*8 - 12), sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonNameText, FONT_NORMAL, 0, WindowWidthPx(WIN_DISPLAY_INFO) - 6), sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonNameText, FONT_SHORT, 0, WindowWidthPx(WIN_DISPLAY_INFO) - 12), sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonItemName, FONT_SMALL, 0, WindowWidthPx(WIN_DISPLAY_INFO) - 22), sStorage->displayMonItemName, 6, 43, TEXT_SKIP_DRAW, NULL); } else { AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonItemName, FONT_SMALL, 0, WindowWidthPx(WIN_DISPLAY_INFO) - 22), sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL); - AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonNameText, FONT_NORMAL, 0, 9*8 - 6), sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL); - AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonSpeciesName, FONT_SHORT, 0, 9*8 - 12), sStorage->displayMonSpeciesName, 6, 28, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonNameText, FONT_NORMAL, 0, WindowWidthPx(WIN_DISPLAY_INFO) - 6), sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(WIN_DISPLAY_INFO, GetFontIdToFit(sStorage->displayMonSpeciesName, FONT_SHORT, 0, WindowWidthPx(WIN_DISPLAY_INFO) - 12), sStorage->displayMonSpeciesName, 6, 28, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 42, TEXT_SKIP_DRAW, NULL); } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5132218931..f13e57ed8e 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2873,9 +2873,9 @@ static void PrintNotEggInfo(void) StringAppend(gStringVar1, gStringVar2); PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, gStringVar1, 24, 17, 0, 1); GetMonNickname(mon, gStringVar1); - PrintTextOnWindowToFitPx(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME, gStringVar1, 0, 1, 0, 1, 63); + PrintTextOnWindowToFitPx(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME, gStringVar1, 0, 1, 0, 1, WindowWidthPx(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME) - 9); PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, gText_Slash, 0, 1, 0, 1); - PrintTextOnWindowToFitPx(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, GetSpeciesName(summary->species2), 6, 1, 0, 1, 63); + PrintTextOnWindowToFitPx(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, GetSpeciesName(summary->species2), 6, 1, 0, 1, WindowWidthPx(PSS_LABEL_WINDOW_PORTRAIT_SPECIES) - 9); PrintGenderSymbol(mon, summary->species2); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); diff --git a/src/pokenav_conditions.c b/src/pokenav_conditions.c index 19cfe38b95..382ddde413 100644 --- a/src/pokenav_conditions.c +++ b/src/pokenav_conditions.c @@ -372,6 +372,8 @@ static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 skipPadding) while (*str_ != EOS) (str_++); + str_ = WrapFontIdToFit(str, str_, FONT_NORMAL, 57); + *(str_++) = EXT_CTRL_CODE_BEGIN; *(str_++) = EXT_CTRL_CODE_SKIP; *(str_++) = 60; diff --git a/src/pokenav_conditions_search_results.c b/src/pokenav_conditions_search_results.c index 24fe966dc3..9afb2bb2d9 100644 --- a/src/pokenav_conditions_search_results.c +++ b/src/pokenav_conditions_search_results.c @@ -692,8 +692,9 @@ static void BufferSearchMonListItem(struct PokenavMonListItem * item, u8 *dest) { u8 gender; u8 level; - u8 *s; + u8 *s, *end; const u8 *genderStr; + u32 fontId; // Mon is in party if (item->boxId == TOTAL_BOXES_COUNT) @@ -712,8 +713,6 @@ static void BufferSearchMonListItem(struct PokenavMonListItem * item, u8 *dest) GetBoxMonData(mon, MON_DATA_NICKNAME, gStringVar3); } - StringGet_Nickname(gStringVar3); - dest = GetStringClearToWidth(dest, FONT_NORMAL, gStringVar3, 60); switch (gender) { default: @@ -726,6 +725,11 @@ static void BufferSearchMonListItem(struct PokenavMonListItem * item, u8 *dest) genderStr = sText_FemaleSymbol; break; } + end = StringGet_Nickname(gStringVar3); + fontId = GetFontIdToFit(gStringVar3, FONT_NORMAL, 0, 60); + WrapFontIdToFit(gStringVar3, end, FONT_NORMAL, 60); + dest = GetStringClearToWidth(dest, fontId, gStringVar3, 60); + s = StringCopy(gStringVar1, genderStr); *s++ = CHAR_SLASH; *s++ = CHAR_EXTRA_SYMBOL; diff --git a/src/pokenav_ribbons_list.c b/src/pokenav_ribbons_list.c index 72783b0972..834dc926ad 100644 --- a/src/pokenav_ribbons_list.c +++ b/src/pokenav_ribbons_list.c @@ -699,9 +699,10 @@ static void BufferRibbonMonInfoText(struct PokenavListItem * listItem, u8 *dest) { u8 gender; u8 level; - u8 *s; + u8 *s, *end; const u8 *genderStr; struct PokenavMonListItem * item = (struct PokenavMonListItem *)listItem; + u32 fontId; // Mon is in party if (item->boxId == TOTAL_BOXES_COUNT) @@ -720,8 +721,6 @@ static void BufferRibbonMonInfoText(struct PokenavListItem * listItem, u8 *dest) GetBoxMonData(mon, MON_DATA_NICKNAME, gStringVar3); } - StringGet_Nickname(gStringVar3); - dest = GetStringClearToWidth(dest, FONT_NORMAL, gStringVar3, 60); switch (gender) { default: @@ -734,6 +733,10 @@ static void BufferRibbonMonInfoText(struct PokenavListItem * listItem, u8 *dest) genderStr = sText_FemaleSymbol; break; } + end = StringGet_Nickname(gStringVar3); + fontId = GetFontIdToFit(gStringVar3, FONT_NORMAL, 0, 60); + WrapFontIdToFit(gStringVar3, end, FONT_NORMAL, 60); + dest = GetStringClearToWidth(dest, fontId, gStringVar3, 60); s = StringCopy(gStringVar1, genderStr); *s++ = CHAR_SLASH; diff --git a/src/pokenav_ribbons_summary.c b/src/pokenav_ribbons_summary.c index 1ff55dc187..bba1c3600c 100644 --- a/src/pokenav_ribbons_summary.c +++ b/src/pokenav_ribbons_summary.c @@ -878,7 +878,6 @@ static void PrintRibbbonsSummaryMonInfo(struct Pokenav_RibbonsSummaryMenu *menu) FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); GetMonNicknameLevelGender(gStringVar3, &level, &gender); - AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar3, 0, 1, TEXT_SKIP_DRAW, NULL); switch (gender) { case MON_MALE: @@ -891,6 +890,7 @@ static void PrintRibbbonsSummaryMonInfo(struct Pokenav_RibbonsSummaryMenu *menu) genderTxt = sGenderlessIconString; break; } + AddTextPrinterParameterized(windowId, GetFontIdToFit(gStringVar3, FONT_NORMAL, 0, 60), gStringVar3, 0, 1, TEXT_SKIP_DRAW, NULL); txtPtr = StringCopy(gStringVar1, genderTxt); *(txtPtr++) = CHAR_SLASH; diff --git a/test/text.c b/test/text.c index 19a0a88b40..5b461f39e4 100644 --- a/test/text.c +++ b/test/text.c @@ -334,6 +334,21 @@ TEST("Species names fit on Pokedex Screen") EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); } +TEST("Species names fit on Pokedex Screen - Cries") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 60; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + TEST("Species names fit on Pokemon Storage System") { u32 i; @@ -363,3 +378,123 @@ TEST("Species names fit on Contest Screen") } EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); } + +TEST("Species names fit on Contest Screen - Rankings") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 49; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on Battle Dome Screen") +{ + u32 i; + const u32 fontId = FONT_SHORT_NARROW, widthPx = 60; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on Hall of Fame") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 66; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on Naming Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 64; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on PokeNav Condition Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 57; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on PokeNav Condition Search Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 60; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on PokeNav Ribbon Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 60; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on PokeNav Ribbon List Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 60; + u32 species = SPECIES_NONE; + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +}