From 62ce29d0e98467cf0235caff1bfb72a5b6ac0e04 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 20 Apr 2024 16:31:04 +0100 Subject: [PATCH 01/13] Debug Menu: Re-render 'Flags & Vars' rather than re-create --- src/debug.c | 54 +++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/debug.c b/src/debug.c index ea3ffbabb8af..76fd85fdcd78 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1344,36 +1344,16 @@ static void Debug_InitDebugBattleData(void) sDebugBattleData->aiFlags[i] = FALSE; } -static void Debug_RefreshListMenu(u8 taskId) +static void Debug_GenerateListMenuNames(u32 totalItems) { - u16 i; const u8 sColor_Red[] = _("{COLOR RED}"); const u8 sColor_Green[] = _("{COLOR GREEN}"); - u8 totalItems = 0, flagResult = 0; + u32 i, flagResult = 0; u8 const *name = NULL; - if (sDebugMenuListData->listId == 0) - { - gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_FlagsVars; - totalItems = gMultiuseListMenuTemplate.totalItems; - } - else if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu <= 1) - { - gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_Battle_1; - totalItems = gMultiuseListMenuTemplate.totalItems; - } - else if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu > 1) - { - gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_Battle_2; - totalItems = 7; - } - - // Failsafe to prevent memory corruption - totalItems = min(totalItems, DEBUG_MAX_MENU_ITEMS); // Copy item names for all entries but the last (which is Cancel) - for(i = 0; i < totalItems; i++) + for (i = 0; i < totalItems; i++) { - if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu > 1) { u16 species; @@ -1429,6 +1409,31 @@ static void Debug_RefreshListMenu(u8 taskId) sDebugMenuListData->listItems[i].name = &sDebugMenuListData->itemNames[i][0]; sDebugMenuListData->listItems[i].id = i; } +} + +static void Debug_RefreshListMenu(u8 taskId) +{ + u8 totalItems = 0; + + if (sDebugMenuListData->listId == 0) + { + gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_FlagsVars; + totalItems = gMultiuseListMenuTemplate.totalItems; + } + else if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu <= 1) + { + gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_Battle_1; + totalItems = gMultiuseListMenuTemplate.totalItems; + } + else if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu > 1) + { + gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_Battle_2; + totalItems = 7; + } + + // Failsafe to prevent memory corruption + totalItems = min(totalItems, DEBUG_MAX_MENU_ITEMS); + Debug_GenerateListMenuNames(totalItems); // Set list menu data gMultiuseListMenuTemplate.items = sDebugMenuListData->listItems; @@ -1595,7 +1600,8 @@ static void DebugTask_HandleMenuInput_FlagsVars(u8 taskId) else { func(taskId); - Debug_RedrawListMenu(taskId); + Debug_GenerateListMenuNames(gMultiuseListMenuTemplate.totalItems); + RedrawListMenu(gTasks[taskId].tMenuTaskId); } // Remove TRUE/FALSE window for functions that haven't been assigned flags From 1fea6b83cc3d65c039b1f6d452e41243fd3eb935 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Tue, 5 Mar 2024 13:57:39 +0000 Subject: [PATCH 02/13] PARAMETRIZE_LABEL in test/species.c PARAMETRIZE_LABEL is like PARAMETRIZE, except that it allows the user to provide a label which will be displayed in the test name line. This is useful for tracking _which_ PARAMETRIZE case failed in the situation where the numbers are unwieldy. --- include/test/test.h | 2 ++ test/species.c | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/test/test.h b/include/test/test.h index 790563e77227..dbd547ba9f8d 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -215,6 +215,8 @@ static inline struct Benchmark BenchmarkStop(void) #define PARAMETRIZE if (gFunctionTestRunnerState->parameters++ == gFunctionTestRunnerState->runParameter) +#define PARAMETRIZE_LABEL(f, label) if (gFunctionTestRunnerState->parameters++ == gFunctionTestRunnerState->runParameter && (MgbaPrintf_(":N%s: " f " (%d/%d)", gTestRunnerState.test->name, label, gFunctionTestRunnerState->runParameter + 1, gFunctionTestRunnerState->parameters), 1)) + #define TO_DO \ do { \ Test_ExpectedResult(TEST_RESULT_TODO); \ diff --git a/test/species.c b/test/species.c index d412dd005ad5..986fdbb14f25 100644 --- a/test/species.c +++ b/test/species.c @@ -6,12 +6,16 @@ TEST("Form species ID tables are shared between all forms") { u32 i; u32 species = SPECIES_NONE; + const u16 *formSpeciesIdTable; for (i = 0; i < NUM_SPECIES; i++) { - if (gSpeciesInfo[i].formSpeciesIdTable) PARAMETRIZE { species = i; } + if (gSpeciesInfo[i].formSpeciesIdTable) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } } - const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable; + formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable; for (i = 0; formSpeciesIdTable[i] != FORM_SPECIES_END; i++) { u32 formSpeciesId = formSpeciesIdTable[i]; @@ -23,13 +27,18 @@ TEST("Form change tables contain only forms in the form species ID table") { u32 i, j; u32 species = SPECIES_NONE; + const struct FormChange *formChangeTable; + const u16 *formSpeciesIdTable; for (i = 0; i < NUM_SPECIES; i++) { - if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; } + if (gSpeciesInfo[i].formChangeTable) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } } - const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable; - const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable; + formChangeTable = gSpeciesInfo[species].formChangeTable; + formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable; EXPECT(formSpeciesIdTable); for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++) @@ -51,12 +60,16 @@ TEST("Form change targets have the appropriate species flags") { u32 i; u32 species = SPECIES_NONE; + const struct FormChange *formChangeTable; for (i = 0; i < NUM_SPECIES; i++) { - if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; } + if (gSpeciesInfo[i].formChangeTable) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } } - const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable; + formChangeTable = gSpeciesInfo[species].formChangeTable; for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++) { const struct SpeciesInfo *targetSpeciesInfo = &gSpeciesInfo[formChangeTable[i].targetSpecies]; From e42a0a6dbeb1b0db15ed14dd862ee7ed9c2f5e4f Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 6 Apr 2024 13:00:10 +0100 Subject: [PATCH 03/13] Narrower fonts --- charmap.txt | 3 + gflib/text.c | 331 ++++++++++++++++++++++-- gflib/text.h | 7 + gflib/window.c | 10 + gflib/window.h | 2 + graphics/fonts/latin_narrower.png | Bin 0 -> 7346 bytes graphics/fonts/latin_short_narrow.png | Bin 0 -> 7508 bytes graphics/fonts/latin_small_narrower.png | Bin 0 -> 7037 bytes graphics_file_rules.mk | 9 + include/fonts.h | 6 + include/list_menu.h | 5 +- src/fonts.c | 108 ++++++++ src/list_menu.c | 10 +- 13 files changed, 467 insertions(+), 24 deletions(-) create mode 100644 graphics/fonts/latin_narrower.png create mode 100644 graphics/fonts/latin_short_narrow.png create mode 100644 graphics/fonts/latin_small_narrower.png diff --git a/charmap.txt b/charmap.txt index 7271c621ca70..872e9f76e441 100644 --- a/charmap.txt +++ b/charmap.txt @@ -464,6 +464,9 @@ FONT_NORMAL = FC 06 01 FONT_SHORT = FC 06 02 FONT_NARROW = FC 06 07 FONT_SMALL_NARROW = FC 06 08 +FONT_NARROWER = FC 06 0A +FONT_SMALL_NARROWER = FC 06 0B +FONT_SHORT_NARROW = FC 06 0C @ colors diff --git a/gflib/text.c b/gflib/text.c index cc6a6e90f202..c4ed5f4dbefc 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -23,17 +23,26 @@ static u16 FontFunc_ShortCopy2(struct TextPrinter *); static u16 FontFunc_ShortCopy3(struct TextPrinter *); static u16 FontFunc_Narrow(struct TextPrinter *); static u16 FontFunc_SmallNarrow(struct TextPrinter *); +static u16 FontFunc_Narrower(struct TextPrinter *); +static u16 FontFunc_SmallNarrower(struct TextPrinter *); +static u16 FontFunc_ShortNarrow(struct TextPrinter *); static void DecompressGlyph_Small(u16, bool32); static void DecompressGlyph_Normal(u16, bool32); static void DecompressGlyph_Short(u16, bool32); static void DecompressGlyph_Narrow(u16, bool32); static void DecompressGlyph_SmallNarrow(u16, bool32); static void DecompressGlyph_Bold(u16); +static void DecompressGlyph_Narrower(u16, bool32); +static void DecompressGlyph_SmallNarrower(u16, bool32); +static void DecompressGlyph_ShortNarrow(u16, bool32); static u32 GetGlyphWidth_Small(u16, bool32); static u32 GetGlyphWidth_Normal(u16, bool32); static u32 GetGlyphWidth_Short(u16, bool32); static u32 GetGlyphWidth_Narrow(u16, bool32); static u32 GetGlyphWidth_SmallNarrow(u16, bool32); +static u32 GetGlyphWidth_Narrower(u16, bool32); +static u32 GetGlyphWidth_SmallNarrower(u16, bool32); +static u32 GetGlyphWidth_ShortNarrow(u16, bool32); static EWRAM_DATA struct TextPrinter sTempTextPrinter = {0}; static EWRAM_DATA struct TextPrinter sTextPrinters[WINDOWS_MAX] = {0}; @@ -81,15 +90,18 @@ static const u8 sWindowVerticalScrollSpeeds[] = { static const struct GlyphWidthFunc sGlyphWidthFuncs[] = { - { FONT_SMALL, GetGlyphWidth_Small }, - { FONT_NORMAL, GetGlyphWidth_Normal }, - { FONT_SHORT, GetGlyphWidth_Short }, - { FONT_SHORT_COPY_1, GetGlyphWidth_Short }, - { FONT_SHORT_COPY_2, GetGlyphWidth_Short }, - { FONT_SHORT_COPY_3, GetGlyphWidth_Short }, - { FONT_BRAILLE, GetGlyphWidth_Braille }, - { FONT_NARROW, GetGlyphWidth_Narrow }, - { FONT_SMALL_NARROW, GetGlyphWidth_SmallNarrow } + { FONT_SMALL, GetGlyphWidth_Small }, + { FONT_NORMAL, GetGlyphWidth_Normal }, + { FONT_SHORT, GetGlyphWidth_Short }, + { FONT_SHORT_COPY_1, GetGlyphWidth_Short }, + { FONT_SHORT_COPY_2, GetGlyphWidth_Short }, + { FONT_SHORT_COPY_3, GetGlyphWidth_Short }, + { FONT_BRAILLE, GetGlyphWidth_Braille }, + { FONT_NARROW, GetGlyphWidth_Narrow }, + { FONT_SMALL_NARROW, GetGlyphWidth_SmallNarrow }, + { FONT_NARROWER, GetGlyphWidth_Narrower }, + { FONT_SMALL_NARROWER, GetGlyphWidth_SmallNarrower }, + { FONT_SHORT_NARROW, GetGlyphWidth_ShortNarrow }, }; struct @@ -217,21 +229,54 @@ static const struct FontInfo sFontInfos[] = .fgColor = 1, .bgColor = 2, .shadowColor = 15, - } + }, + [FONT_NARROWER] = { + .fontFunction = FontFunc_Narrower, + .maxLetterWidth = 5, + .maxLetterHeight = 16, + .letterSpacing = 0, + .lineSpacing = 0, + .fgColor = 2, + .bgColor = 1, + .shadowColor = 3, + }, + [FONT_SMALL_NARROWER] = { + .fontFunction = FontFunc_SmallNarrower, + .maxLetterWidth = 5, + .maxLetterHeight = 8, + .letterSpacing = 0, + .lineSpacing = 0, + .fgColor = 2, + .bgColor = 1, + .shadowColor = 3, + }, + [FONT_SHORT_NARROW] = { + .fontFunction = FontFunc_ShortNarrow, + .maxLetterWidth = 5, + .maxLetterHeight = 14, + .letterSpacing = 0, + .lineSpacing = 0, + .fgColor = 2, + .bgColor = 1, + .shadowColor = 3, + }, }; static const u8 sMenuCursorDimensions[][2] = { - [FONT_SMALL] = { 8, 12 }, - [FONT_NORMAL] = { 8, 15 }, - [FONT_SHORT] = { 8, 14 }, - [FONT_SHORT_COPY_1] = { 8, 14 }, - [FONT_SHORT_COPY_2] = { 8, 14 }, - [FONT_SHORT_COPY_3] = { 8, 14 }, - [FONT_BRAILLE] = { 8, 16 }, - [FONT_NARROW] = { 8, 15 }, - [FONT_SMALL_NARROW] = { 8, 8 }, - [FONT_BOLD] = {} + [FONT_SMALL] = { 8, 12 }, + [FONT_NORMAL] = { 8, 15 }, + [FONT_SHORT] = { 8, 14 }, + [FONT_SHORT_COPY_1] = { 8, 14 }, + [FONT_SHORT_COPY_2] = { 8, 14 }, + [FONT_SHORT_COPY_3] = { 8, 14 }, + [FONT_BRAILLE] = { 8, 16 }, + [FONT_NARROW] = { 8, 15 }, + [FONT_SMALL_NARROW] = { 8, 8 }, + [FONT_BOLD] = {}, + [FONT_NARROWER] = { 8, 15 }, + [FONT_SMALL_NARROWER] = { 8, 8 }, + [FONT_SHORT_NARROW] = { 8, 14 }, }; static const u16 sFontBoldJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/bold.hwjpnfont"); @@ -813,6 +858,42 @@ static u16 FontFunc_SmallNarrow(struct TextPrinter *textPrinter) return RenderText(textPrinter); } +static u16 FontFunc_Narrower(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); + + if (subStruct->hasFontIdBeenSet == FALSE) + { + subStruct->fontId = FONT_NARROWER; + subStruct->hasFontIdBeenSet = TRUE; + } + return RenderText(textPrinter); +} + +static u16 FontFunc_SmallNarrower(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); + + if (subStruct->hasFontIdBeenSet == FALSE) + { + subStruct->fontId = FONT_SMALL_NARROWER; + subStruct->hasFontIdBeenSet = TRUE; + } + return RenderText(textPrinter); +} + +static u16 FontFunc_ShortNarrow(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); + + if (subStruct->hasFontIdBeenSet == FALSE) + { + subStruct->fontId = FONT_SHORT_NARROW; + subStruct->hasFontIdBeenSet = TRUE; + } + return RenderText(textPrinter); +} + void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); @@ -1250,6 +1331,15 @@ static u16 RenderText(struct TextPrinter *textPrinter) case FONT_SMALL_NARROW: DecompressGlyph_SmallNarrow(currChar, textPrinter->japanese); break; + case FONT_NARROWER: + DecompressGlyph_Narrower(currChar, textPrinter->japanese); + break; + case FONT_SMALL_NARROWER: + DecompressGlyph_SmallNarrower(currChar, textPrinter->japanese); + break; + case FONT_SHORT_NARROW: + DecompressGlyph_ShortNarrow(currChar, textPrinter->japanese); + break; case FONT_BRAILLE: break; } @@ -2012,3 +2102,204 @@ static void DecompressGlyph_Bold(u16 glyphId) gCurGlyph.width = 8; gCurGlyph.height = 12; } + +static void DecompressGlyph_Narrower(u16 glyphId, bool32 isJapanese) +{ + const u16 *glyphs; + + if (isJapanese == TRUE) + { + glyphs = gFontNormalJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10)); + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); + gCurGlyph.width = 8; + gCurGlyph.height = 15; + } + else + { + glyphs = gFontNarrowerLatinGlyphs + (0x20 * glyphId); + gCurGlyph.width = gFontNarrowerLatinGlyphWidths[glyphId]; + + if (gCurGlyph.width <= 8) + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + } + else + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8); + } + + gCurGlyph.height = 15; + } +} + +static u32 GetGlyphWidth_Narrower(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFontNarrowerLatinGlyphWidths[glyphId]; +} + +static void DecompressGlyph_SmallNarrower(u16 glyphId, bool32 isJapanese) +{ + const u16 *glyphs; + + if (isJapanese == TRUE) + { + glyphs = gFontSmallJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10)); + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); + gCurGlyph.width = 8; + gCurGlyph.height = 15; + } + else + { + glyphs = gFontSmallNarrowerLatinGlyphs + (0x20 * glyphId); + gCurGlyph.width = gFontSmallNarrowerLatinGlyphWidths[glyphId]; + + if (gCurGlyph.width <= 8) + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + } + else + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8); + } + + gCurGlyph.height = 15; + } +} + +static u32 GetGlyphWidth_SmallNarrower(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFontSmallNarrowerLatinGlyphWidths[glyphId]; +} + +static void DecompressGlyph_ShortNarrow(u16 glyphId, bool32 isJapanese) +{ + const u16 *glyphs; + + if (isJapanese == TRUE) + { + glyphs = gFontShortJapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); // gCurGlyph + 0x20 + DecompressGlyphTile(glyphs + 0x88, gCurGlyph.gfxBufferBottom + 8); // gCurGlyph + 0x60 + gCurGlyph.width = gFontShortJapaneseGlyphWidths[glyphId]; + gCurGlyph.height = 14; + } + else + { + glyphs = gFontShortNarrowLatinGlyphs + (0x20 * glyphId); + gCurGlyph.width = gFontShortNarrowLatinGlyphWidths[glyphId]; + + if (gCurGlyph.width <= 8) + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + } + else + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8); + } + + gCurGlyph.height = 14; + } +} + +static u32 GetGlyphWidth_ShortNarrow(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return gFontShortJapaneseGlyphWidths[glyphId]; + else + return gFontShortNarrowLatinGlyphWidths[glyphId]; +} + +static const s8 sNarrowerFontIds[] = +{ + [FONT_SMALL] = FONT_SMALL_NARROW, + [FONT_NORMAL] = FONT_NARROW, + [FONT_SHORT] = FONT_SHORT_NARROW, + [FONT_SHORT_COPY_1] = FONT_SHORT_NARROW, + [FONT_SHORT_COPY_2] = FONT_SHORT_NARROW, + [FONT_SHORT_COPY_3] = FONT_SHORT_NARROW, + [FONT_BRAILLE] = -1, + [FONT_NARROW] = FONT_NARROWER, + [FONT_SMALL_NARROW] = FONT_SMALL_NARROWER, + [FONT_BOLD] = -1, + [FONT_NARROWER] = -1, + [FONT_SMALL_NARROWER] = -1, + [FONT_SHORT_NARROW] = -1, +}; + +// If the narrowest font ID doesn't fit the text, we still return that +// ID because clipping is better than crashing. +u32 GetFontIdToFit(const u8 *string, u32 fontId, u32 letterSpacing, u32 widthPx) +{ + for (;;) + { + s32 narrowerFontId = sNarrowerFontIds[fontId]; + if (narrowerFontId == -1) + return fontId; + if (GetStringWidth(fontId, string, letterSpacing) <= widthPx) + return fontId; + fontId = narrowerFontId; + } +} + +u8 *PrependFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width) +{ + + u32 fitFontId = GetFontIdToFit(start, fontId, 0, width); + if (fitFontId != fontId) + { + memmove(&start[3], &start[0], end - start); + start[0] = EXT_CTRL_CODE_BEGIN; + start[1] = EXT_CTRL_CODE_FONT; + start[2] = fitFontId; + end[3] = EOS; + return end + 3; + } + else + { + return end; + } +} + +u8 *WrapFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width) +{ + + u32 fitFontId = GetFontIdToFit(start, fontId, 0, width); + if (fitFontId != fontId) + { + memmove(&start[3], &start[0], end - start); + start[0] = EXT_CTRL_CODE_BEGIN; + start[1] = EXT_CTRL_CODE_FONT; + start[2] = fitFontId; + end[3] = EXT_CTRL_CODE_BEGIN; + end[4] = EXT_CTRL_CODE_FONT; + end[5] = fontId; + end[6] = EOS; + return end + 6; + } + else + { + return end; + } +} diff --git a/gflib/text.h b/gflib/text.h index 7e1d7bfb111f..0b12edc36328 100644 --- a/gflib/text.h +++ b/gflib/text.h @@ -26,6 +26,9 @@ enum { FONT_NARROW, FONT_SMALL_NARROW, // Very similar to FONT_SMALL, some glyphs are narrower FONT_BOLD, // JP glyph set only + FONT_NARROWER, + FONT_SMALL_NARROWER, + FONT_SHORT_NARROW, }; // Return values for font functions @@ -190,4 +193,8 @@ u8 GetMenuCursorDimensionByFont(u8 fontId, u8 whichDimension); u16 FontFunc_Braille(struct TextPrinter *textPrinter); u32 GetGlyphWidth_Braille(u16 glyphId, bool32 isJapanese); +u32 GetFontIdToFit(const u8 *string, u32 widestFontId, u32 letterSpacing, u32 widthPx); +u8 *PrependFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width); +u8 *WrapFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width); + #endif // GUARD_TEXT_H diff --git a/gflib/window.c b/gflib/window.c index 61264000ea35..5e77283945b5 100644 --- a/gflib/window.c +++ b/gflib/window.c @@ -712,3 +712,13 @@ static u32 GetNumActiveWindowsOnBg8Bit(u32 bgId) } return windowsNum; } + +u32 WindowWidthPx(u32 windowId) +{ + return gWindows[windowId].window.width * TILE_WIDTH; +} + +u32 WindowTemplateWidthPx(const struct WindowTemplate *template) +{ + return template->width * TILE_WIDTH; +} diff --git a/gflib/window.h b/gflib/window.h index 85e385cb9f87..2fd0bddb20cc 100644 --- a/gflib/window.h +++ b/gflib/window.h @@ -73,6 +73,8 @@ void FillWindowPixelBuffer8Bit(u32 windowId, u8 fillValue); void FillWindowPixelRect8Bit(u32 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); void BlitBitmapRectToWindow4BitTo8Bit(u32 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum); void CopyWindowToVram8Bit(u32 windowId, u8 mode); +u32 WindowWidthPx(u32 windowId); +u32 WindowTemplateWidthPx(const struct WindowTemplate *template); extern struct Window gWindows[]; extern void *gWindowBgTilemapBuffers[]; diff --git a/graphics/fonts/latin_narrower.png b/graphics/fonts/latin_narrower.png new file mode 100644 index 0000000000000000000000000000000000000000..22847ef09953dda2644214d2619277f4090324b2 GIT binary patch literal 7346 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 literal 0 HcmV?d00001 diff --git a/graphics/fonts/latin_short_narrow.png b/graphics/fonts/latin_short_narrow.png new file mode 100644 index 0000000000000000000000000000000000000000..cf48712719ace38225213bdf1b896ac07e7f9e19 GIT binary patch literal 7508 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 literal 0 HcmV?d00001 diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 92b8cb0929bf..9f5d9d6c79df 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -238,6 +238,15 @@ $(FONTGFXDIR)/narrow.latfont: $(FONTGFXDIR)/latin_narrow.png $(FONTGFXDIR)/small_narrow.latfont: $(FONTGFXDIR)/latin_small_narrow.png $(GFX) $< $@ +$(FONTGFXDIR)/narrower.latfont: $(FONTGFXDIR)/latin_narrower.png + $(GFX) $< $@ + +$(FONTGFXDIR)/small_narrower.latfont: $(FONTGFXDIR)/latin_small_narrower.png + $(GFX) $< $@ + +$(FONTGFXDIR)/short_narrow.latfont: $(FONTGFXDIR)/latin_short_narrow.png + $(GFX) $< $@ + $(FONTGFXDIR)/small.hwjpnfont: $(FONTGFXDIR)/japanese_small.png $(GFX) $< $@ diff --git a/include/fonts.h b/include/fonts.h index c21c75942df5..a6be35db9820 100644 --- a/include/fonts.h +++ b/include/fonts.h @@ -15,5 +15,11 @@ extern const u16 gFontNarrowLatinGlyphs[]; extern const u8 gFontNarrowLatinGlyphWidths[]; extern const u16 gFontSmallNarrowLatinGlyphs[]; extern const u8 gFontSmallNarrowLatinGlyphWidths[]; +extern const u8 gFontNarrowerLatinGlyphWidths[]; +extern const u16 gFontNarrowerLatinGlyphs[]; +extern const u8 gFontSmallNarrowerLatinGlyphWidths[]; +extern const u16 gFontSmallNarrowerLatinGlyphs[]; +extern const u8 gFontShortNarrowLatinGlyphWidths[]; +extern const u16 gFontShortNarrowLatinGlyphs[]; #endif // GUARD_FONTS_H diff --git a/include/list_menu.h b/include/list_menu.h index 23caaf4b4c75..1e6c0f95facc 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -40,8 +40,9 @@ struct ListMenuTemplate const struct ListMenuItem *items; void (* moveCursorFunc)(s32 itemIndex, bool8 onInit, struct ListMenu *list); void (* itemPrintFunc)(u8 windowId, u32 itemId, u8 y); - u16 totalItems; - u16 maxShowed; + u16 totalItems:12; + u16 maxShowed:12; + u16 textNarrowWidth:8; u8 windowId; u8 header_X; u8 item_X; diff --git a/src/fonts.c b/src/fonts.c index 72de054b73a7..92600fcf7e97 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -180,6 +180,114 @@ ALIGNED(4) const u8 gFontNormalLatinGlyphWidths[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, }; +ALIGNED(4) const u16 gFontNarrowerLatinGlyphs[] = INCBIN_U16("graphics/fonts/narrower.latfont"); +ALIGNED(4) const u8 gFontNarrowerLatinGlyphWidths[] = { + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, + 8, 4, 4, 4, 5, 5, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, + 4, 4, 4, 4, 4, 6, 4, 4, 4, 5, 4, 5, 8, 6, 6, 3, + 3, 3, 3, 3, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 5, 4, 8, 8, 8, 7, 8, 8, 4, 4, 6, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 7, 7, 7, 7, 0, 0, 3, + 4, 5, 6, 7, 4, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 3, 5, 3, + 5, 5, 5, 3, 3, 5, 5, 6, 3, 6, 6, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, + 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, + 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, + 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 10, 10, 10, 10, 8, 8, 10, 8, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontSmallNarrowerLatinGlyphs[] = INCBIN_U16("graphics/fonts/small_narrower.latfont"); +ALIGNED(4) const u8 gFontSmallNarrowerLatinGlyphWidths[] = { + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, + 5, 4, 4, 4, 5, 4, 4, 4, 3, 4, 4, 4, 4, 4, 3, 3, + 4, 4, 4, 4, 4, 6, 4, 4, 4, 5, 4, 4, 7, 5, 6, 3, + 3, 3, 3, 3, 8, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 4, 3, 7, 7, 7, 8, 8, 8, 8, 4, 5, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 8, 8, 8, 8, 0, 0, 3, + 4, 5, 6, 7, 4, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, + 5, 5, 5, 3, 3, 5, 5, 5, 4, 5, 5, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 3, 4, + 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, + 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontShortNarrowLatinGlyphs[] = INCBIN_U16("graphics/fonts/short_narrow.latfont"); +ALIGNED(4) const u8 gFontShortNarrowLatinGlyphWidths[] = { + 3, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 4, 4, 5, 5, 5, + 8, 5, 5, 5, 5, 6, 5, 5, 3, 5, 5, 5, 5, 5, 4, 3, + 4, 4, 5, 5, 5, 8, 5, 5, 5, 5, 6, 6, 9, 6, 6, 3, + 3, 3, 3, 3, 10, 8, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 6, 6, 6, 8, 8, 8, 8, 8, 8, 4, 6, 8, 5, 5, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 6, + 3, 3, 3, 3, 3, 3, 3, 6, 3, 12, 12, 12, 12, 0, 0, 3, + 4, 5, 6, 7, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5, + 6, 6, 6, 3, 3, 6, 6, 8, 5, 9, 6, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, + 5, 5, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, + 4, 6, 5, 5, 5, 5, 5, 5, 4, 5, 5, 6, 4, 5, 5, 8, + 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 12, 12, 12, 12, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + ALIGNED(4) const u16 gFontSmallJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/small.hwjpnfont"); ALIGNED(4) const u16 gFontNormalJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/normal.hwjpnfont"); diff --git a/src/list_menu.c b/src/list_menu.c index e83f325161d7..aa65683eddc6 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -600,11 +600,14 @@ static void ListMenuPrint(struct ListMenu *list, const u8 *str, u8 x, u8 y) u8 colors[3]; if (gListMenuOverride.enabled) { + u32 fontId = gListMenuOverride.fontId; + if (list->template.textNarrowWidth) + fontId = GetFontIdToFit(str, fontId, gListMenuOverride.lettersSpacing, list->template.textNarrowWidth); colors[0] = gListMenuOverride.fillValue; colors[1] = gListMenuOverride.cursorPal; colors[2] = gListMenuOverride.cursorShadowPal; AddTextPrinterParameterized4(list->template.windowId, - gListMenuOverride.fontId, + fontId, x, y, gListMenuOverride.lettersSpacing, 0, colors, TEXT_SKIP_DRAW, str); @@ -613,11 +616,14 @@ static void ListMenuPrint(struct ListMenu *list, const u8 *str, u8 x, u8 y) } else { + u32 fontId = list->template.fontId; + if (list->template.textNarrowWidth) + fontId = GetFontIdToFit(str, fontId, list->template.lettersSpacing, list->template.textNarrowWidth); colors[0] = list->template.fillValue; colors[1] = list->template.cursorPal; colors[2] = list->template.cursorShadowPal; AddTextPrinterParameterized4(list->template.windowId, - list->template.fontId, + fontId, x, y, list->template.lettersSpacing, 0, colors, TEXT_SKIP_DRAW, str); From 738fade50a3c33917d169cdd34eba722cd72724f Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 6 Apr 2024 13:38:52 +0100 Subject: [PATCH 04/13] Fix expanded move names --- src/data/moves_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/moves_info.h b/src/data/moves_info.h index 911f2b6b82f9..c569fb91f24e 100644 --- a/src/data/moves_info.h +++ b/src/data/moves_info.h @@ -14160,7 +14160,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] = [MOVE_HYPERSPACE_HOLE] = { - .name = HANDLE_EXPANDED_MOVE_NAME("HyprspceHole", "Hyprspace Hole"), + .name = HANDLE_EXPANDED_MOVE_NAME("HyprspceHole", "Hyperspace Hole"), .description = sHyperspaceHoleDescription, .effect = EFFECT_HIT, .power = 80, From a1d24603720d30d578260c34e11627acd68ac821 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 6 Apr 2024 13:00:30 +0100 Subject: [PATCH 05/13] Enable GF move names by default In contests, even FONT_NARROWER isn't sufficient to prevent clipping in all cases. e.g. Stomping Tantrum clips. We have decided to accept that cost to make the rest of the user experience better, but downstream projects that don't like that trade-off can either a) alter the contest UI, or b) set B_EXPANDED_MOVE_NAMES to FALSE. --- include/config/battle.h | 2 +- include/config/test.h | 7 ++ include/constants/global.h | 4 + src/battle_message.c | 8 ++ src/contest.c | 14 +++- src/item_menu.c | 11 ++- src/menu_specialized.c | 3 +- src/pokemon_summary_screen.c | 23 ++++-- test/battle/ability/wind_power.c | 4 +- test/battle/damage_formula.c | 2 +- test/battle/gimmick/dynamax.c | 4 +- test/battle/gimmick/terastal.c | 8 -- test/battle/item_effect/increase_stat.c | 8 +- test/battle/move_effect/corrosive_gas.c | 10 +-- test/battle/move_effect/fling.c | 2 +- test/battle/move_effect/metronome.c | 2 +- test/battle/move_effect/psychic_noise.c | 2 +- test/battle/move_effect/reflect_type.c | 2 +- test/battle/move_effect/revival_blessing.c | 18 ++--- .../move_effect/semi_invulnerable_moves.c | 8 +- test/battle/terrain/electric.c | 4 +- test/battle/terrain/misty.c | 2 +- test/battle/terrain/psychic.c | 12 +-- test/text.c | 77 +++++++++++++++++++ 24 files changed, 173 insertions(+), 64 deletions(-) create mode 100644 include/config/test.h create mode 100644 test/text.c diff --git a/include/config/battle.h b/include/config/battle.h index c47f4fedcfae..f2c17f91f6cc 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -214,7 +214,7 @@ #define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. #define B_SHOW_CATEGORY_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category. #define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations. -#define B_EXPANDED_MOVE_NAMES FALSE // If set to TRUE, move names are increased from 12 characters to 16 characters. +#define B_EXPANDED_MOVE_NAMES TRUE // If set to FALSE, move names are decreased from 16 characters to 12 characters. #define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles. #define B_QUICK_MOVE_CURSOR_TO_RUN FALSE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option diff --git a/include/config/test.h b/include/config/test.h new file mode 100644 index 000000000000..9d8066864a67 --- /dev/null +++ b/include/config/test.h @@ -0,0 +1,7 @@ +#ifndef GUARD_CONFIG_TEST_H +#define GUARD_CONFIG_TEST_H + +#undef B_EXPANDED_MOVE_NAMES +#define B_EXPANDED_MOVE_NAMES TRUE + +#endif // GUARD_CONFIG_TEST_H diff --git a/include/constants/global.h b/include/constants/global.h index b8ac7559a82e..daf1c9edb417 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -170,4 +170,8 @@ #define CONNECTION_DIVE 5 #define CONNECTION_EMERGE 6 +#if TESTING +#include "config/test.h" +#endif + #endif // GUARD_CONSTANTS_GLOBAL_H diff --git a/src/battle_message.c b/src/battle_message.c index 5f7e6ca052bf..b713d846addc 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -3949,6 +3949,14 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) printerTemplate.bgColor = textInfo[windowId].bgColor; printerTemplate.shadowColor = textInfo[windowId].shadowColor; + if (B_WIN_MOVE_NAME_1 <= windowId && windowId <= B_WIN_MOVE_NAME_4) + { + // We cannot check the actual width of the window because + // B_WIN_MOVE_NAME_1 and B_WIN_MOVE_NAME_3 are 16 wide for + // Z-move details. + printerTemplate.fontId = GetFontIdToFit(text, printerTemplate.fontId, printerTemplate.letterSpacing, 8 * TILE_WIDTH); + } + if (printerTemplate.x == 0xFF) { u32 width = GetBattleWindowTemplatePixelWidth(gBattleScripting.windowsType, windowId); diff --git a/src/contest.c b/src/contest.c index f0d0d527ed37..c500fda60dec 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1085,6 +1085,12 @@ static const s8 sContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGO } }; +static void CopyMoveNameToFit(u8 *dest, u32 move) +{ + u8 *end = StringCopy(dest, GetMoveName(move)); + WrapFontIdToFit(dest, end, FONT_NORMAL, 84); +} + static void TaskDummy1(u8 taskId) { } @@ -1636,7 +1642,7 @@ static void Task_ShowMoveSelectScreen(u8 taskId) moveNameBuffer = StringCopy(moveNameBuffer, GetMoveName(move)); FillWindowPixelBuffer(i + MOVE_WINDOWS_START, PIXEL_FILL(0)); - Contest_PrintTextToBg0WindowAt(i + MOVE_WINDOWS_START, moveName, 5, 1, FONT_NARROW); + Contest_PrintTextToBg0WindowAt(i + MOVE_WINDOWS_START, moveName, 5, 1, GetFontIdToFit(moveName, FONT_NARROW, 0, WindowWidthPx(i + MOVE_WINDOWS_START) - 11)); } DrawMoveSelectArrow(eContest.playerMoveChoice); @@ -2295,7 +2301,7 @@ static void Task_DoAppeals(u8 taskId) if (eContestantStatus[contestant].overrideCategoryExcitementMod) { r3 = 1; - StringCopy(gStringVar3, GetMoveName(eContestantStatus[contestant].currMove)); + CopyMoveNameToFit(gStringVar3, eContestantStatus[contestant].currMove); } else { @@ -2430,7 +2436,7 @@ static void Task_DoAppeals(u8 taskId) ContestClearGeneralTextWindow(); StringCopy(gStringVar3, gContestMons[eContestExcitement.freezer].nickname); StringCopy(gStringVar1, gContestMons[contestant].nickname); - StringCopy(gStringVar2, GetMoveName(eContestantStatus[contestant].currMove)); + CopyMoveNameToFit(gStringVar2, eContestantStatus[contestant].currMove); StringExpandPlaceholders(gStringVar4, gText_CrowdContinuesToWatchMon); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].tState = APPEALSTATE_PRINT_MON_MOVE_IGNORED_MSG; @@ -2456,7 +2462,7 @@ static void Task_DoAppeals(u8 taskId) eContestantStatus[contestant].hasJudgesAttention = FALSE; StartStopFlashJudgeAttentionEye(contestant); StringCopy(gStringVar1, gContestMons[contestant].nickname); - StringCopy(gStringVar2, GetMoveName(eContestantStatus[contestant].currMove)); + CopyMoveNameToFit(gStringVar2, eContestantStatus[contestant].currMove); StringExpandPlaceholders(gStringVar4, gText_MonWasTooNervousToMove); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].tState = APPEALSTATE_WAIT_TOO_NERVOUS_MSG; diff --git a/src/item_menu.c b/src/item_menu.c index 569712cfe625..dde142d02135 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -109,7 +109,7 @@ struct ListBuffer1 { }; struct ListBuffer2 { - u8 name[MAX_POCKET_ITEMS][ITEM_NAME_LENGTH + 10]; + u8 name[MAX_POCKET_ITEMS][max(ITEM_NAME_LENGTH, MOVE_NAME_LENGTH + 3) + 10]; }; struct TempWallyBag { @@ -905,10 +905,19 @@ static void LoadBagItemListBuffers(u8 pocketId) static void GetItemName(u8 *dest, u16 itemId) { + u32 fontId; switch (gBagPosition.pocket) { case TMHM_POCKET: StringCopy(gStringVar2, GetMoveName(ItemIdToBattleMoveId(itemId))); + fontId = GetFontIdToFit(gStringVar2, FONT_NARROW, 0, 73); + if (fontId != FONT_NARROW) + { + gStringVar2[0] = EXT_CTRL_CODE_BEGIN; + gStringVar2[1] = EXT_CTRL_CODE_FONT; + gStringVar2[2] = fontId; + StringCopy(&gStringVar2[3], GetMoveName(ItemIdToBattleMoveId(itemId))); + } if (itemId >= ITEM_HM01) { // Get HM number diff --git a/src/menu_specialized.c b/src/menu_specialized.c index fcb65d9ae73a..a80a227a4b9e 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -186,7 +186,8 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate = .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, .fontId = FONT_NORMAL, - .cursorKind = CURSOR_BLACK_ARROW + .cursorKind = CURSOR_BLACK_ARROW, + .textNarrowWidth = 68, }; //-------------- diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 6e63ce5eab54..ee2d0e9853fe 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2800,12 +2800,23 @@ static void ResetWindows(void) sMonSummaryScreen->windowIds[i] = WINDOW_NONE; } -static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +static void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId) { if (DECAP_ENABLED && DECAP_MIRRORING && !DECAP_SUMMARY) - AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, MirrorPtr(string)); + AddTextPrinterParameterized4(windowId, fontId, x, y, 0, lineSpacing, sTextColors[colorId], 0, MirrorPtr(string)); else - AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); + AddTextPrinterParameterized4(windowId, fontId, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); +} + +static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +{ + PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, FONT_NORMAL); +} + +static void PrintTextOnWindowToFit(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +{ + u32 fontId = GetFontIdToFit(string, FONT_NORMAL, 0, WindowWidthPx(windowId)); + PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, fontId); } static void PrintMonInfo(void) @@ -3626,7 +3637,7 @@ static void PrintMoveNameAndPP(u8 moveIndex) if (move != 0) { pp = CalculatePPWithBonus(move, summary->ppBonuses, moveIndex); - PrintTextOnWindow(moveNameWindowId, GetMoveName(move), 0, moveIndex * 16 + 1, 0, 1); + PrintTextOnWindowToFit(moveNameWindowId, GetMoveName(move), 0, moveIndex * 16 + 1, 0, 1); ConvertIntToDecimalStringN(gStringVar1, summary->pp[moveIndex], STR_CONV_MODE_RIGHT_ALIGN, 2); ConvertIntToDecimalStringN(gStringVar2, pp, STR_CONV_MODE_RIGHT_ALIGN, 2); DynamicPlaceholderTextUtil_Reset(); @@ -3794,9 +3805,9 @@ static void PrintNewMoveDetailsOrCancelText(void) u16 move = sMonSummaryScreen->newMove; if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) - PrintTextOnWindow(windowId1, GetMoveName(move), 0, 65, 0, 6); + PrintTextOnWindowToFit(windowId1, GetMoveName(move), 0, 65, 0, 6); else - PrintTextOnWindow(windowId1, GetMoveName(move), 0, 65, 0, 5); + PrintTextOnWindowToFit(windowId1, GetMoveName(move), 0, 65, 0, 5); ConvertIntToDecimalStringN(gStringVar1, gMovesInfo[move].pp, STR_CONV_MODE_RIGHT_ALIGN, 2); DynamicPlaceholderTextUtil_Reset(); diff --git a/test/battle/ability/wind_power.c b/test/battle/ability/wind_power.c index bbf76cd6fb66..146c47f3dd87 100644 --- a/test/battle/ability/wind_power.c +++ b/test/battle/ability/wind_power.c @@ -167,12 +167,12 @@ DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ab HP_BAR(playerLeft); if (abilityLeft == ABILITY_WIND_POWER) { ABILITY_POPUP(playerLeft, ABILITY_WIND_POWER); - MESSAGE("Being hit by PetalBlizzrd charged Wattrel with power!"); + MESSAGE("Being hit by Petal Blizzard charged Wattrel with power!"); } HP_BAR(playerRight); if (abilityRight == ABILITY_WIND_POWER) { ABILITY_POPUP(playerRight, ABILITY_WIND_POWER); - MESSAGE("Being hit by PetalBlizzrd charged Wattrel with power!"); + MESSAGE("Being hit by Petal Blizzard charged Wattrel with power!"); } HP_BAR(opponentRight); NOT HP_BAR(opponentLeft); diff --git a/test/battle/damage_formula.c b/test/battle/damage_formula.c index 2fdb9bed0f8d..d89fb7e7fd90 100644 --- a/test/battle/damage_formula.c +++ b/test/battle/damage_formula.c @@ -109,7 +109,7 @@ SINGLE_BATTLE_TEST("Damage calculation matches Gen5+ (Marshadow vs Mawile)") } } SCENE{ - MESSAGE("Marshadow used SpectrlThief!"); + MESSAGE("Marshadow used Spectral Thief!"); HP_BAR(opponent, captureDamage: &dmg); } THEN{ diff --git a/test/battle/gimmick/dynamax.c b/test/battle/gimmick/dynamax.c index 2db55d87b693..42e48c9e9cb2 100644 --- a/test/battle/gimmick/dynamax.c +++ b/test/battle/gimmick/dynamax.c @@ -834,9 +834,9 @@ SINGLE_BATTLE_TEST("(DYNAMAX) Max Mindstorm sets up Psychic Terrain") TURN { MOVE(opponent, MOVE_EXTREME_SPEED); MOVE(player, MOVE_PSYCHIC, dynamax: TRUE); } TURN { MOVE(opponent, MOVE_EXTREME_SPEED); MOVE(player, MOVE_PSYCHIC); } } SCENE { - MESSAGE("Foe Wobbuffet used ExtremeSpeed!"); + MESSAGE("Foe Wobbuffet used Extreme Speed!"); MESSAGE("Wobbuffet used Max Mindstorm!"); - MESSAGE("Foe Wobbuffet cannot use ExtremeSpeed!"); + MESSAGE("Foe Wobbuffet cannot use Extreme Speed!"); MESSAGE("Wobbuffet used Max Mindstorm!"); } } diff --git a/test/battle/gimmick/terastal.c b/test/battle/gimmick/terastal.c index 3166e2d67c62..18eab992afc5 100644 --- a/test/battle/gimmick/terastal.c +++ b/test/battle/gimmick/terastal.c @@ -422,11 +422,7 @@ SINGLE_BATTLE_TEST("(TERA) Revelation Dance uses a Terastallized Pokemon's Tera } WHEN { TURN { MOVE(player, MOVE_REVELATION_DANCE, tera: TRUE); } } SCENE { - #if B_EXPANDED_MOVE_NAMES == TRUE MESSAGE("Oricorio used Revelation Dance!"); - #else - MESSAGE("Oricorio used RvlationDnce!"); - #endif MESSAGE("It doesn't affect Foe Gengar…"); NOT { HP_BAR(opponent); } } @@ -547,11 +543,7 @@ SINGLE_BATTLE_TEST("(TERA) Revelation Dance uses a Stellar-type Pokemon's base t } WHEN { TURN { MOVE(player, MOVE_REVELATION_DANCE, tera: TRUE); } } SCENE { - #if B_EXPANDED_MOVE_NAMES == TRUE MESSAGE("Oricorio used Revelation Dance!"); - #else - MESSAGE("Oricorio used RvlationDnce!"); - #endif MESSAGE("It doesn't affect Foe Gumshoos…"); NOT { HP_BAR(opponent); } } diff --git a/test/battle/item_effect/increase_stat.c b/test/battle/item_effect/increase_stat.c index df36b8ff338c..4eba548961f5 100644 --- a/test/battle/item_effect/increase_stat.c +++ b/test/battle/item_effect/increase_stat.c @@ -63,7 +63,7 @@ SINGLE_BATTLE_TEST("X Sp. Atk sharply raises battler's Sp. Attack stat", s16 dam if (useItem) TURN { USE_ITEM(player, ITEM_X_SP_ATK); } TURN { MOVE(player, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Wobbuffet used DisrmngVoice!"); + MESSAGE("Wobbuffet used Disarming Voice!"); HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { if (B_X_ITEMS_BUFF >= GEN_7) @@ -87,7 +87,7 @@ SINGLE_BATTLE_TEST("X Sp. Def sharply raises battler's Sp. Defense stat", s16 da if (useItem) TURN { USE_ITEM(player, ITEM_X_SP_DEF); } TURN { MOVE(opponent, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Foe Wobbuffet used DisrmngVoice!"); + MESSAGE("Foe Wobbuffet used Disarming Voice!"); HP_BAR(player, captureDamage: &results[i].damage); } FINALLY { if (B_X_ITEMS_BUFF >= GEN_7) @@ -205,7 +205,7 @@ SINGLE_BATTLE_TEST("Max Mushrooms raises battler's Sp. Attack stat", s16 damage) if (useItem) TURN { USE_ITEM(player, ITEM_MAX_MUSHROOMS); } TURN { MOVE(player, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Wobbuffet used DisrmngVoice!"); + MESSAGE("Wobbuffet used Disarming Voice!"); HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); @@ -225,7 +225,7 @@ SINGLE_BATTLE_TEST("Max Mushrooms battler's Sp. Defense stat", s16 damage) if (useItem) TURN { USE_ITEM(player, ITEM_MAX_MUSHROOMS); } TURN { MOVE(opponent, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Foe Wobbuffet used DisrmngVoice!"); + MESSAGE("Foe Wobbuffet used Disarming Voice!"); HP_BAR(player, captureDamage: &results[i].damage); } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.66), results[1].damage); diff --git a/test/battle/move_effect/corrosive_gas.c b/test/battle/move_effect/corrosive_gas.c index c2c921cf742f..714702703a09 100644 --- a/test/battle/move_effect/corrosive_gas.c +++ b/test/battle/move_effect/corrosive_gas.c @@ -19,7 +19,7 @@ SINGLE_BATTLE_TEST("Corrosive Gas destroys the target's item or fails if the tar } WHEN { TURN { MOVE(player, MOVE_CORROSIVE_GAS); } } SCENE { - MESSAGE("Wobbuffet used CorrosiveGas!"); + MESSAGE("Wobbuffet used Corrosive Gas!"); if (item == ITEM_POTION) { ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); MESSAGE("Wobbuffet corroded Foe Wobbuffet's Potion!"); @@ -40,11 +40,11 @@ SINGLE_BATTLE_TEST("Corrosive Gas doesn't destroy the item of a Pokemon with the } WHEN { TURN { MOVE(player, MOVE_CORROSIVE_GAS); } } SCENE { - MESSAGE("Wobbuffet used CorrosiveGas!"); + MESSAGE("Wobbuffet used Corrosive Gas!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); NOT MESSAGE("Wobbuffet corroded Foe Wobbuffet's Potion!"); ABILITY_POPUP(opponent, ABILITY_STICKY_HOLD); - MESSAGE("Foe Muk's Sticky Hold made CorrosiveGas ineffective!"); + MESSAGE("Foe Muk's Sticky Hold made Corrosive Gas ineffective!"); } THEN { EXPECT_EQ(opponent->item, ITEM_POISON_BARB); } @@ -59,7 +59,7 @@ SINGLE_BATTLE_TEST("Items lost to Corrosive Gas cannot be restored by Recycle") } WHEN { TURN { MOVE(player, MOVE_CORROSIVE_GAS); MOVE(opponent, MOVE_RECYCLE); } } SCENE { - MESSAGE("Wobbuffet used CorrosiveGas!"); + MESSAGE("Wobbuffet used Corrosive Gas!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); MESSAGE("Wobbuffet corroded Foe Wobbuffet's Oran Berry!"); MESSAGE("Foe Wobbuffet used Recycle!"); @@ -93,7 +93,7 @@ DOUBLE_BATTLE_TEST("Corrosive Gas destroys foes and ally's items if they have on } WHEN { TURN { MOVE(playerRight, MOVE_CORROSIVE_GAS); } } SCENE { - MESSAGE("Wynaut used CorrosiveGas!"); + MESSAGE("Wynaut used Corrosive Gas!"); if (itemPlayerLeft == ITEM_CHERI_BERRY) { MESSAGE("Wynaut corroded Wobbuffet's Cheri Berry!"); } else { diff --git a/test/battle/move_effect/fling.c b/test/battle/move_effect/fling.c index f6b83215a1c5..b4b25484b330 100644 --- a/test/battle/move_effect/fling.c +++ b/test/battle/move_effect/fling.c @@ -114,7 +114,7 @@ SINGLE_BATTLE_TEST("Fling - Item is lost even when there is no target") TURN { MOVE(opponent, MOVE_SELF_DESTRUCT); MOVE(player, MOVE_FLING); SEND_OUT(opponent, 1); } TURN { MOVE(player, MOVE_FLING); } } SCENE { - MESSAGE("Foe Wobbuffet used SelfDestruct!"); + MESSAGE("Foe Wobbuffet used Self-Destruct!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_SELF_DESTRUCT, opponent); HP_BAR(player); MESSAGE("Foe Wobbuffet fainted!"); diff --git a/test/battle/move_effect/metronome.c b/test/battle/move_effect/metronome.c index d4efcaafff5f..22e3390cb2b9 100644 --- a/test/battle/move_effect/metronome.c +++ b/test/battle/move_effect/metronome.c @@ -35,7 +35,7 @@ SINGLE_BATTLE_TEST("Metronome's called powder move fails against Grass Types") } SCENE { MESSAGE("Wobbuffet used Metronome!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_METRONOME, player); - MESSAGE("Wobbuffet used PoisonPowder!"); + MESSAGE("Wobbuffet used Poison Powder!"); NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_POWDER, player); MESSAGE("It doesn't affect Foe Tangela…"); NOT STATUS_ICON(opponent, poison: TRUE); diff --git a/test/battle/move_effect/psychic_noise.c b/test/battle/move_effect/psychic_noise.c index 7846157b77d5..e8d50dc961ac 100644 --- a/test/battle/move_effect/psychic_noise.c +++ b/test/battle/move_effect/psychic_noise.c @@ -35,7 +35,7 @@ SINGLE_BATTLE_TEST("Psychic Noise is blocked by Soundproof") TURN { MOVE(player, MOVE_PSYCHIC_NOISE); MOVE(opponent, MOVE_RECOVER); } } SCENE { ABILITY_POPUP(opponent, ABILITY_SOUNDPROOF); - MESSAGE("Foe Voltorb's Soundproof blocks PsychicNoise!"); + MESSAGE("Foe Voltorb's Soundproof blocks Psychic Noise!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_RECOVER, opponent); } } diff --git a/test/battle/move_effect/reflect_type.c b/test/battle/move_effect/reflect_type.c index e873516034ee..b75ffc0b0d58 100644 --- a/test/battle/move_effect/reflect_type.c +++ b/test/battle/move_effect/reflect_type.c @@ -171,7 +171,7 @@ SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's type1 an HP_BAR(player); MESSAGE("Foe Arcanine burned itself out!"); // Turn 2 - MESSAGE("Wobbuffet used Forest'sCurs!"); + MESSAGE("Wobbuffet used Forest's Curse!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_FORESTS_CURSE, player); MESSAGE("Grass type was added to Foe Arcanine!"); // Turn 3 diff --git a/test/battle/move_effect/revival_blessing.c b/test/battle/move_effect/revival_blessing.c index 397e01e73aee..d44e9110d50c 100644 --- a/test/battle/move_effect/revival_blessing.c +++ b/test/battle/move_effect/revival_blessing.c @@ -5,12 +5,6 @@ // behaviors. These have been tested in-game, in double, in multi, and in link battles. AI will always // revive their first fainted party member in order. -#if B_EXPANDED_MOVE_NAMES -#define REVIVAL_BLESSING "Revival Blessing" -#else -#define REVIVAL_BLESSING "RevivlBlesng" -#endif - ASSUMPTIONS { ASSUME(gMovesInfo[MOVE_REVIVAL_BLESSING].effect == EFFECT_REVIVAL_BLESSING); @@ -26,7 +20,7 @@ SINGLE_BATTLE_TEST("Revival Blessing revives a chosen fainted party member for t } WHEN { TURN { MOVE(player, MOVE_REVIVAL_BLESSING); SEND_OUT(player, 2); } } SCENE { - MESSAGE("Wobbuffet used " REVIVAL_BLESSING "!"); + MESSAGE("Wobbuffet used Revival Blessing!"); MESSAGE("Wynaut was revived and is ready to fight again!"); } } @@ -41,7 +35,7 @@ SINGLE_BATTLE_TEST("Revival Blessing revives a fainted party member for an oppon } WHEN { TURN { MOVE(opponent, MOVE_REVIVAL_BLESSING); SEND_OUT(opponent, 1); } } SCENE { - MESSAGE("Foe Raichu used " REVIVAL_BLESSING "!"); + MESSAGE("Foe Raichu used Revival Blessing!"); MESSAGE("Pichu was revived and is ready to fight again!"); } } @@ -54,7 +48,7 @@ SINGLE_BATTLE_TEST("Revival Blessing fails if no party members are fainted") } WHEN { TURN { MOVE(player, MOVE_REVIVAL_BLESSING); } } SCENE { - MESSAGE("Wobbuffet used " REVIVAL_BLESSING "!"); + MESSAGE("Wobbuffet used Revival Blessing!"); MESSAGE("But it failed!"); } } @@ -82,10 +76,10 @@ TO_DO_BATTLE_TEST("Revival Blessing cannot revive a partner's party member"); // TURN { MOVE(user, MOVE_REVIVAL_BLESSING); } // } SCENE { // if (user == opponentLeft) { -// MESSAGE("Foe Wobbuffet used " REVIVAL_BLESSING "!"); +// MESSAGE("Foe Wobbuffet used Revival Blessing!"); // MESSAGE("But it failed!"); // } else { -// MESSAGE("Foe Wynaut used " REVIVAL_BLESSING "!"); +// MESSAGE("Foe Wynaut used Revival Blessing!"); // MESSAGE("Wynaut was revived and is ready to fight again!"); // } // } @@ -108,7 +102,7 @@ TO_DO_BATTLE_TEST("Revived battlers still lose their turn"); // } SCENE { // MESSAGE("Wobbuffet used Tackle!"); // MESSAGE("Foe Wynaut fainted!"); -// MESSAGE("Foe Wobbuffet used " REVIVAL_BLESSING "!"); +// MESSAGE("Foe Wobbuffet used Revival Blessing!"); // MESSAGE("Wynaut was revived and is ready to fight again!"); // NOT { MESSAGE("Wynaut used Celebrate!"); } // } diff --git a/test/battle/move_effect/semi_invulnerable_moves.c b/test/battle/move_effect/semi_invulnerable_moves.c index 97760225d132..3ba4889005e5 100644 --- a/test/battle/move_effect/semi_invulnerable_moves.c +++ b/test/battle/move_effect/semi_invulnerable_moves.c @@ -58,7 +58,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves make the user semi-invulnerable turn break; case MOVE_PHANTOM_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); @@ -112,7 +112,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves make the user semi-invulnerable turn MESSAGE("Wobbuffet used Dive!"); break; case MOVE_PHANTOM_FORCE: - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: MESSAGE("Wobbuffet used Shadow Force!"); @@ -163,7 +163,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves don't need to charge with Power Herb break; case MOVE_PHANTOM_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); @@ -215,7 +215,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves don't need to charge with Power Herb MESSAGE("Wobbuffet used Dive!"); break; case MOVE_PHANTOM_FORCE: - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: MESSAGE("Wobbuffet used Shadow Force!"); diff --git a/test/battle/terrain/electric.c b/test/battle/terrain/electric.c index c6fda3fb3e81..eb7a112bb550 100644 --- a/test/battle/terrain/electric.c +++ b/test/battle/terrain/electric.c @@ -10,7 +10,7 @@ SINGLE_BATTLE_TEST("Electric Terrain protects grounded battlers from falling asl TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); MOVE(opponent, MOVE_SPORE); } TURN { MOVE(player, MOVE_SPORE); } } SCENE { - MESSAGE("Wobbuffet used ElctrcTrrain!"); + MESSAGE("Wobbuffet used Electric Terrain!"); MESSAGE("Foe Claydol used Spore!"); MESSAGE("Wobbuffet surrounds itself with electrified terrain!"); MESSAGE("Wobbuffet used Spore!"); @@ -51,7 +51,7 @@ SINGLE_BATTLE_TEST("Electric Terrain increases power of Electric-type moves by 3 TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); } TURN { MOVE(player, MOVE_THUNDER_SHOCK); } } SCENE { - MESSAGE("Wobbuffet used ThunderShock!"); + MESSAGE("Wobbuffet used Thunder Shock!"); HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { if (B_TERRAIN_TYPE_BOOST >= GEN_8) diff --git a/test/battle/terrain/misty.c b/test/battle/terrain/misty.c index c76689ce7957..cd89b2d9abfd 100644 --- a/test/battle/terrain/misty.c +++ b/test/battle/terrain/misty.c @@ -10,7 +10,7 @@ SINGLE_BATTLE_TEST("Misty Terrain protects grounded battlers from non-volatile s TURN { MOVE(player, MOVE_MISTY_TERRAIN); MOVE(opponent, MOVE_TOXIC); } TURN { MOVE(player, MOVE_TOXIC); } } SCENE { - MESSAGE("Wobbuffet used MistyTerrain!"); + MESSAGE("Wobbuffet used Misty Terrain!"); MESSAGE("Foe Claydol used Toxic!"); MESSAGE("Wobbuffet surrounds itself with a protective mist!"); NOT { STATUS_ICON(opponent, badPoison: TRUE); } diff --git a/test/battle/terrain/psychic.c b/test/battle/terrain/psychic.c index 20f7deef6e9c..1881db62978c 100644 --- a/test/battle/terrain/psychic.c +++ b/test/battle/terrain/psychic.c @@ -10,7 +10,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain protects grounded battlers from priority mov TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_QUICK_ATTACK); MOVE(opponent, MOVE_QUICK_ATTACK); } } SCENE { - MESSAGE("Claydol used PsychcTrrain!"); + MESSAGE("Claydol used Psychic Terrain!"); MESSAGE("Claydol cannot use Quick Attack!"); NOT { HP_BAR(opponent); } MESSAGE("Foe Wobbuffet used Quick Attack!"); @@ -69,7 +69,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target the TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_RECOVER); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Recover!"); HP_BAR(player); } @@ -84,7 +84,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_HAZE); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Haze!"); } } @@ -98,7 +98,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_SPIKES); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Spikes!"); } } @@ -114,7 +114,7 @@ DOUBLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all TURN { MOVE(playerLeft, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(playerLeft, MOVE_HEAL_PULSE, target: playerRight); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Heal Pulse!"); } } @@ -128,7 +128,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority field moves") TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_SUNNY_DAY); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Sunny Day!"); } } diff --git a/test/text.c b/test/text.c new file mode 100644 index 000000000000..ee81386c0016 --- /dev/null +++ b/test/text.c @@ -0,0 +1,77 @@ +#include "global.h" +#include "test/test.h" +#include "item.h" +#include "text.h" +#include "constants/moves.h" + +TEST("Move names fit on Pokemon Summary Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 72; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +} + +TEST("Move names fit on Battle Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 64; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +} + +TEST("Move names fit on Contest Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 61; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + // All moves explicitly listed here are too big to fit. + switch (move) + { + case MOVE_NATURES_MADNESS: + EXPECT_GT(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); + break; + default: + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); + break; + } +} + +TEST("Move names fit on TMs & HMs Bag Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 63; + u32 move = MOVE_NONE; + for (i = 1; i < ITEMS_COUNT; i++) + { + if (gItemsInfo[i].pocket == POCKET_TM_HM) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[gItemsInfo[i].secondaryId].name) { move = gItemsInfo[i].secondaryId; } + } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +} + +TEST("Move names fit on Move Relearner Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 72; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +} From 484e288cad2736eb70c96e6c1cccf7770d1f1d17 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 16 Mar 2024 13:28:08 +0000 Subject: [PATCH 06/13] Expanded item names --- include/config/item.h | 1 + include/constants/global.h | 2 +- src/data/items.h | 264 +++++++++++++++++++------------------ 3 files changed, 137 insertions(+), 130 deletions(-) diff --git a/include/config/item.h b/include/config/item.h index 1a1a196a1602..2f7db2ed927b 100644 --- a/include/config/item.h +++ b/include/config/item.h @@ -2,6 +2,7 @@ #define GUARD_CONFIG_ITEM_H // Item config +#define I_EXPANDED_ITEM_NAMES FALSE // If set to TRUE, item names are increased from 14 characters to 20 characters. #define I_SHINY_CHARM_ADDITIONAL_ROLLS 2 // Amount of additional shiny rolls if the player has the Shiny Charm. Set it to 0 to disable Shiny Charm's effects. #define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items. #define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. diff --git a/include/constants/global.h b/include/constants/global.h index daf1c9edb417..5118beb18956 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -102,7 +102,7 @@ #define CONTEST_CATEGORIES_COUNT 5 // string lengths -#define ITEM_NAME_LENGTH 14 +#define ITEM_NAME_LENGTH ((I_EXPANDED_ITEM_NAMES == TRUE) ? 20 : 14) #define ITEM_NAME_PLURAL_LENGTH ITEM_NAME_LENGTH + 2 // 2 is used for the instance where a word's suffix becomes y->ies #define POKEMON_NAME_LENGTH 10 #define POKEMON_NAME_BUFFER_SIZE max(20, POKEMON_NAME_LENGTH + 1) // Frequently used buffer size. Larger than necessary diff --git a/src/data/items.h b/src/data/items.h index 3a65f8758cae..eaa52b5d8f50 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -1,5 +1,11 @@ #include "constants/moves.h" +#if I_EXPANDED_ITEM_NAMES == TRUE +#define HANDLE_EXPANDED_ITEM_NAME(_name, ...) _(DEFAULT(_name, __VA_ARGS__)) +#else +#define HANDLE_EXPANDED_ITEM_NAME(_name, ...) _(_name) +#endif + #if I_USE_EVO_HELD_ITEMS_FROM_BAG == TRUE #define EVO_HELD_ITEM_TYPE ITEM_USE_PARTY_MENU #define EVO_HELD_ITEM_FIELD_FUNC ItemUseOutOfBattle_EvolutionStone @@ -1041,8 +1047,8 @@ const struct Item gItemsInfo[] = [ITEM_PEWTER_CRUNCHIES] = { - .name = _("PewtrCrnches"), - .pluralName = _("PewtrCrnches"), + .name = HANDLE_EXPANDED_ITEM_NAME("PewtrCrnches", "Pewter Crunchies"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("PewtrCrnches", "Pewter Crunchies"), .price = 250, .description = sFullHealDesc, .pocket = POCKET_ITEMS, @@ -1055,7 +1061,7 @@ const struct Item gItemsInfo[] = [ITEM_RAGE_CANDY_BAR] = { - .name = _("RageCandyBar"), + .name = HANDLE_EXPANDED_ITEM_NAME("RageCandyBar", "Rage Candy Bar"), .price = (I_PRICE >= GEN_7) ? 350 : 300, .description = sFullHealDesc, .pocket = POCKET_ITEMS, @@ -1111,7 +1117,7 @@ const struct Item gItemsInfo[] = [ITEM_LUMIOSE_GALETTE] = { - .name = _("LumioseGlete"), + .name = HANDLE_EXPANDED_ITEM_NAME("LumioseGlete", "Lumiose Galette"), .price = (I_PRICE >= GEN_7) ? 350 : 200, .description = sFullHealDesc, .pocket = POCKET_ITEMS, @@ -1124,7 +1130,7 @@ const struct Item gItemsInfo[] = [ITEM_SHALOUR_SABLE] = { - .name = _("ShalourSable"), + .name = HANDLE_EXPANDED_ITEM_NAME("ShalourSable", "Shalour Sable"), .price = (I_PRICE >= GEN_7) ? 350 : 200, .description = sFullHealDesc, .pocket = POCKET_ITEMS, @@ -1275,7 +1281,7 @@ const struct Item gItemsInfo[] = [ITEM_HEALTH_FEATHER] = { - .name = _("HealthFeather"), + .name = HANDLE_EXPANDED_ITEM_NAME("HealthFeather", "Health Feather"), .price = (I_PRICE >= GEN_7) ? 300 : 3000, .description = sHealthFeatherDesc, .pocket = POCKET_ITEMS, @@ -1287,7 +1293,7 @@ const struct Item gItemsInfo[] = [ITEM_MUSCLE_FEATHER] = { - .name = _("MuscleFeather"), + .name = HANDLE_EXPANDED_ITEM_NAME("MuscleFeather", "Muscle Feather"), .price = (I_PRICE >= GEN_7) ? 300 : 3000, .description = sMuscleFeatherDesc, .pocket = POCKET_ITEMS, @@ -1299,7 +1305,7 @@ const struct Item gItemsInfo[] = [ITEM_RESIST_FEATHER] = { - .name = _("ResistFeather"), + .name = HANDLE_EXPANDED_ITEM_NAME("ResistFeather", "Resist Feather"), .price = (I_PRICE >= GEN_7) ? 300 : 3000, .description = sResistFeatherDesc, .pocket = POCKET_ITEMS, @@ -1311,7 +1317,7 @@ const struct Item gItemsInfo[] = [ITEM_GENIUS_FEATHER] = { - .name = _("GeniusFeather"), + .name = HANDLE_EXPANDED_ITEM_NAME("GeniusFeather", "Genius Feather"), .price = (I_PRICE >= GEN_7) ? 300 : 3000, .description = sGeniusFeatherDesc, .pocket = POCKET_ITEMS, @@ -1323,7 +1329,7 @@ const struct Item gItemsInfo[] = [ITEM_CLEVER_FEATHER] = { - .name = _("CleverFeather"), + .name = HANDLE_EXPANDED_ITEM_NAME("CleverFeather", "Clever Feather"), .price = (I_PRICE >= GEN_7) ? 300 : 3000, .description = sCleverFeatherDesc, .pocket = POCKET_ITEMS, @@ -1335,7 +1341,7 @@ const struct Item gItemsInfo[] = [ITEM_SWIFT_FEATHER] = { - .name = _("SwiftFeather"), + .name = HANDLE_EXPANDED_ITEM_NAME("SwiftFeather", "Swift Feather"), .price = (I_PRICE >= GEN_7) ? 300 : 3000, .description = sSwiftFeatherDesc, .pocket = POCKET_ITEMS, @@ -1349,7 +1355,7 @@ const struct Item gItemsInfo[] = [ITEM_ABILITY_CAPSULE] = { - .name = _("AbilityCapsle"), + .name = HANDLE_EXPANDED_ITEM_NAME("AbilityCapsle", "Ability Capsule"), .price = (I_PRICE < GEN_7) ? 1000 : ((I_PRICE < GEN_9) ? 10000 : 100000), .holdEffectParam = 0, .description = COMPOUND_STRING( @@ -1362,8 +1368,8 @@ const struct Item gItemsInfo[] = [ITEM_ABILITY_PATCH] = { - .name = _("AbilityPatch"), - .pluralName = _("AbilityPatches"), + .name = HANDLE_EXPANDED_ITEM_NAME("AbilityPatch", "Ability Patch"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("AbilityPatches", "Ability Patches"), .price = (I_PRICE >= GEN_9) ? 250000 : 20, .holdEffectParam = 0, .description = COMPOUND_STRING( @@ -1712,8 +1718,8 @@ const struct Item gItemsInfo[] = [ITEM_EXP_CANDY_XS] = { - .name = _("Exp.Candy XS"), - .pluralName = _("Exp.Candies XS"), + .name = HANDLE_EXPANDED_ITEM_NAME("Exp.Candy XS", "Exp. Candy XS"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("Exp.Candies XS", "Exp. Candies XS"), .price = 20, .holdEffectParam = EXP_100, .description = COMPOUND_STRING( @@ -1729,8 +1735,8 @@ const struct Item gItemsInfo[] = [ITEM_EXP_CANDY_S] = { - .name = _("Exp.Candy S"), - .pluralName = _("Exp.Candies S"), + .name = HANDLE_EXPANDED_ITEM_NAME("Exp.Candy S", "Exp. Candy S"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("Exp.Candies S", "Exp. Candies S"), .price = 240, .holdEffectParam = EXP_800, .description = COMPOUND_STRING( @@ -1746,8 +1752,8 @@ const struct Item gItemsInfo[] = [ITEM_EXP_CANDY_M] = { - .name = _("Exp.Candy M"), - .pluralName = _("Exp.Candies M"), + .name = HANDLE_EXPANDED_ITEM_NAME("Exp.Candy M", "Exp. Candy M"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("Exp.Candies M", "Exp. Candies M"), .price = 1000, .holdEffectParam = EXP_3000, .description = COMPOUND_STRING( @@ -1763,8 +1769,8 @@ const struct Item gItemsInfo[] = [ITEM_EXP_CANDY_L] = { - .name = _("Exp.Candy L"), - .pluralName = _("Exp.Candies L"), + .name = HANDLE_EXPANDED_ITEM_NAME("Exp.Candy L", "Exp. Candy L"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("Exp.Candies L", "Exp. Candies L"), .price = 3000, .holdEffectParam = EXP_10000, .description = COMPOUND_STRING( @@ -1780,8 +1786,8 @@ const struct Item gItemsInfo[] = [ITEM_EXP_CANDY_XL] = { - .name = _("Exp.Candy XL"), - .pluralName = _("Exp.Candies L"), + .name = HANDLE_EXPANDED_ITEM_NAME("Exp.Candy XL", "Exp. Candy XL"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("Exp.Candies XL", "Exp. Candies XL"), .price = 10000, .holdEffectParam = EXP_30000, .description = COMPOUND_STRING( @@ -1797,8 +1803,8 @@ const struct Item gItemsInfo[] = [ITEM_DYNAMAX_CANDY] = { - .name = _("DynamaxCandy"), - .pluralName = _("DynamaxCandies"), + .name = HANDLE_EXPANDED_ITEM_NAME("DynamaxCandy", "Dynamax Candy"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("DynamaxCandies", "Dynamax Candies"), .price = 0, .description = COMPOUND_STRING( "Raises the Dynamax\n" @@ -2218,8 +2224,8 @@ const struct Item gItemsInfo[] = [ITEM_MAX_MUSHROOMS] = { - .name = _("MaxMushrooms"), - .pluralName = _("MaxMushrooms"), + .name = HANDLE_EXPANDED_ITEM_NAME("MaxMushrooms", "Max Mushrooms"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("MaxMushrooms", "Max Mushrooms"), .price = 8000, .description = COMPOUND_STRING( "Raises every stat\n" @@ -2250,7 +2256,7 @@ const struct Item gItemsInfo[] = [ITEM_GOLD_BOTTLE_CAP] = { - .name = _("GoldBottlCap"), + .name = HANDLE_EXPANDED_ITEM_NAME("GoldBottlCap", "Gold Bottle Cap"), .price = (I_PRICE >= GEN_9) ? 60000 : 10000, .description = COMPOUND_STRING( "A beautiful bottle\n" @@ -2543,7 +2549,7 @@ const struct Item gItemsInfo[] = [ITEM_PRETTY_FEATHER] = { - .name = _("PrettyFeather"), + .name = HANDLE_EXPANDED_ITEM_NAME("PrettyFeather", "Pretty Feather"), .price = (I_PRICE >= GEN_7) ? 1000 * TREASURE_FACTOR: 200, .description = COMPOUND_STRING( "A beautiful yet\n" @@ -2655,7 +2661,7 @@ const struct Item gItemsInfo[] = [ITEM_STRANGE_SOUVENIR] = { - .name = _("StrngeSouvnr"), + .name = HANDLE_EXPANDED_ITEM_NAME("StrngeSouvnr", "Strange Souvenir"), .price = (I_PRICE >= GEN_7) ? 3000 : 10, .description = COMPOUND_STRING( "An ornament that\n" @@ -2849,7 +2855,7 @@ const struct Item gItemsInfo[] = [ITEM_FOSSILIZED_BIRD] = { - .name = _("FosslzedBird"), + .name = HANDLE_EXPANDED_ITEM_NAME("FosslzedBird", "Fossilized Bird"), .price = 5000, .description = COMPOUND_STRING( "A fossil of an\n" @@ -2863,8 +2869,8 @@ const struct Item gItemsInfo[] = [ITEM_FOSSILIZED_FISH] = { - .name = _("FosslzedFish"), - .pluralName = _("FosslzedFishes"), + .name = HANDLE_EXPANDED_ITEM_NAME("FosslzedFish", "Fossilized Fish"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("FosslzedFishes", "Fossilized Fishes"), .price = 5000, .description = sFossilizedFishDesc, .pocket = POCKET_ITEMS, @@ -2875,7 +2881,7 @@ const struct Item gItemsInfo[] = [ITEM_FOSSILIZED_DRAKE] = { - .name = _("FosslzedDrke"), + .name = HANDLE_EXPANDED_ITEM_NAME("FosslzedDrke", "Fossilized Drake"), .price = 5000, .description = COMPOUND_STRING( "A fossil of an\n" @@ -2889,7 +2895,7 @@ const struct Item gItemsInfo[] = [ITEM_FOSSILIZED_DINO] = { - .name = _("FosslzedDino"), + .name = HANDLE_EXPANDED_ITEM_NAME("FosslzedDino", "Fossilized Dino"), .price = 5000, .description = sFossilizedFishDesc, .pocket = POCKET_ITEMS, @@ -3002,8 +3008,8 @@ const struct Item gItemsInfo[] = [ITEM_SURPRISE_MULCH] = { - .name = _("SurprseMulch"), - .pluralName = _("SurprseMulch"), + .name = HANDLE_EXPANDED_ITEM_NAME("SurprseMulch", "Surprise Mulch"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("SurprseMulch", "Surprise Mulch"), .price = 200, #if OW_BERRY_MULCH_USAGE == TRUE .description = COMPOUND_STRING( @@ -3090,7 +3096,7 @@ const struct Item gItemsInfo[] = [ITEM_YELLOW_APRICORN] = { - .name = _("YellwApricorn"), + .name = HANDLE_EXPANDED_ITEM_NAME("YellwApricorn", "Yellow Apricorn"), .price = (I_PRICE == GEN_4) ? 0 : ((I_PRICE >= GEN_5 && I_PRICE <= GEN_7) ? 20 : 200), .description = COMPOUND_STRING( "A yellow apricorn.\n" @@ -3103,7 +3109,7 @@ const struct Item gItemsInfo[] = [ITEM_GREEN_APRICORN] = { - .name = _("GreenApricorn"), + .name = HANDLE_EXPANDED_ITEM_NAME("GreenApricorn", "Green Apricorn"), .price = (I_PRICE == GEN_4) ? 0 : ((I_PRICE >= GEN_5 && I_PRICE <= GEN_7) ? 20 : 200), .description = COMPOUND_STRING( "A green apricorn.\n" @@ -3129,7 +3135,7 @@ const struct Item gItemsInfo[] = [ITEM_WHITE_APRICORN] = { - .name = _("WhiteApricorn"), + .name = HANDLE_EXPANDED_ITEM_NAME("WhiteApricorn", "White Apricorn"), .price = (I_PRICE == GEN_4) ? 0 : ((I_PRICE >= GEN_5 && I_PRICE <= GEN_7) ? 20 : 200), .description = COMPOUND_STRING( "A white apricorn.\n" @@ -3142,7 +3148,7 @@ const struct Item gItemsInfo[] = [ITEM_BLACK_APRICORN] = { - .name = _("BlackApricorn"), + .name = HANDLE_EXPANDED_ITEM_NAME("BlackApricorn", "Black Apricorn"), .price = (I_PRICE == GEN_4) ? 0 : ((I_PRICE >= GEN_5 && I_PRICE <= GEN_7) ? 20 : 200), .description = COMPOUND_STRING( "A black apricorn.\n" @@ -3155,7 +3161,7 @@ const struct Item gItemsInfo[] = [ITEM_WISHING_PIECE] = { - .name = _("WishingPiece"), + .name = HANDLE_EXPANDED_ITEM_NAME("WishingPiece", "Wishing Piece"), .price = 20, .description = COMPOUND_STRING( "Throw into a\n" @@ -3169,7 +3175,7 @@ const struct Item gItemsInfo[] = [ITEM_GALARICA_TWIG] = { - .name = _("GalaricaTwig"), + .name = HANDLE_EXPANDED_ITEM_NAME("GalaricaTwig", "Galarica Twig"), .price = 20 * TREASURE_FACTOR, .description = COMPOUND_STRING( "A twig from a tree\n" @@ -3571,7 +3577,7 @@ const struct Item gItemsInfo[] = [ITEM_GALARICA_CUFF] = { - .name = _("GalaricaCuff"), + .name = HANDLE_EXPANDED_ITEM_NAME("GalaricaCuff", "Galarica Cuff"), .price = (I_PRICE >= GEN_9) ? 3000 : 6000, .description = COMPOUND_STRING( "A cuff from Galar\n" @@ -3586,8 +3592,8 @@ const struct Item gItemsInfo[] = [ITEM_GALARICA_WREATH] = { - .name = _("GalrcaWreath"), - .pluralName = _("GalrcaWreathes"), + .name = HANDLE_EXPANDED_ITEM_NAME("GalrcaWreath", "Galarica Wreath"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("GalrcaWreathes", "Galarica Wreathes"), .price = (I_PRICE >= GEN_9) ? 3000 : 6000, .description = COMPOUND_STRING( "A wreath made in\n" @@ -3771,7 +3777,7 @@ const struct Item gItemsInfo[] = [ITEM_STRAWBERRY_SWEET] = { - .name = _("StrwbrySweet"), + .name = HANDLE_EXPANDED_ITEM_NAME("StrwbrySweet", "Strawberry Sweet"), .price = 500 * TREASURE_FACTOR, .description = COMPOUND_STRING( "Strawberry-shaped\n" @@ -4329,8 +4335,8 @@ const struct Item gItemsInfo[] = [ITEM_ELECTRIC_MEMORY] = { - .name = _("ElectrcMemory"), - .pluralName = _("ElectrcMemories"), + .name = HANDLE_EXPANDED_ITEM_NAME("ElectrcMemory", "Electric Memory"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("ElectrcMemories", "Electric Memories"), .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -4383,8 +4389,8 @@ const struct Item gItemsInfo[] = [ITEM_FIGHTING_MEMORY] = { - .name = _("FightngMemory"), - .pluralName = _("FightngMemories"), + .name = HANDLE_EXPANDED_ITEM_NAME("FightngMemory", "Fighting Memory"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("FightngMemories", "Fighting Memories"), .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -4455,8 +4461,8 @@ const struct Item gItemsInfo[] = [ITEM_PSYCHIC_MEMORY] = { - .name = _("PsychicMemory"), - .pluralName = _("PsychicMemories"), + .name = HANDLE_EXPANDED_ITEM_NAME("PsychicMemory", "Psychic Memory"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("PsychicMemories", "Psychic Memories"), .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -4599,7 +4605,7 @@ const struct Item gItemsInfo[] = [ITEM_RUSTED_SWORD] = { - .name = _("RustedSword"), + .name = HANDLE_EXPANDED_ITEM_NAME("RustedSword", "Rusted Sword"), .price = 0, .description = COMPOUND_STRING( "A rusty sword. A\n" @@ -4612,7 +4618,7 @@ const struct Item gItemsInfo[] = [ITEM_RUSTED_SHIELD] = { - .name = _("RustedShield"), + .name = HANDLE_EXPANDED_ITEM_NAME("RustedShield", "Rusted Shield"), .price = 0, .description = COMPOUND_STRING( "A rusty shield. A\n" @@ -4672,7 +4678,7 @@ const struct Item gItemsInfo[] = [ITEM_CHARIZARDITE_X] = { - .name = _("CharizarditeX"), + .name = HANDLE_EXPANDED_ITEM_NAME("CharizarditeX", "Charizardite X"), .pluralName = _("Charizardites X"), .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, @@ -4685,7 +4691,7 @@ const struct Item gItemsInfo[] = [ITEM_CHARIZARDITE_Y] = { - .name = _("CharizarditeY"), + .name = HANDLE_EXPANDED_ITEM_NAME("CharizarditeY", "Charizardite Y"), .pluralName = _("Charizardites Y"), .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, @@ -6156,7 +6162,7 @@ const struct Item gItemsInfo[] = [ITEM_ULTRANECROZIUM_Z] = { - .name = _("U-Necrozium Z"), + .name = HANDLE_EXPANDED_ITEM_NAME("U-Necrozium Z", "Ultranecrozium Z"), .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = COMPOUND_STRING( @@ -6266,7 +6272,7 @@ const struct Item gItemsInfo[] = [ITEM_DEEP_SEA_SCALE] = { - .name = _("DeepSeaScale"), + .name = HANDLE_EXPANDED_ITEM_NAME("DeepSeaScale", "Deep Sea Scale"), .price = (I_PRICE >= GEN_7) ? 2000 : 200, .holdEffect = HOLD_EFFECT_DEEP_SEA_SCALE, .description = COMPOUND_STRING( @@ -6282,8 +6288,8 @@ const struct Item gItemsInfo[] = [ITEM_DEEP_SEA_TOOTH] = { - .name = _("DeepSeaTooth"), - .pluralName = _("DeepSeaTeeth"), + .name = HANDLE_EXPANDED_ITEM_NAME("DeepSeaTooth", "Deep Sea Tooth"), + .pluralName = _("Deep Sea Teeth"), .price = (I_PRICE >= GEN_7) ? 2000 : 200, .holdEffect = HOLD_EFFECT_DEEP_SEA_TOOTH, .description = COMPOUND_STRING( @@ -6767,8 +6773,8 @@ const struct Item gItemsInfo[] = [ITEM_NEVER_MELT_ICE] = { - .name = _("Never-MeltIce"), - .pluralName = _("Never-MeltIce"), + .name = HANDLE_EXPANDED_ITEM_NAME("Never-MeltIce", "Never-Melt Ice"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("Never-MeltIce", "Never-Melt Ice"), .price = (I_PRICE >= GEN_9) ? 3000 : ((I_PRICE >= GEN_7) ? 1000 : 100), .holdEffect = HOLD_EFFECT_ICE_POWER, .holdEffectParam = TYPE_BOOST_PARAM, @@ -7913,8 +7919,8 @@ const struct Item gItemsInfo[] = [ITEM_WEAKNESS_POLICY] = { - .name = _("WeaknssPolicy"), - .pluralName = _("WeaknssPolicies"), + .name = HANDLE_EXPANDED_ITEM_NAME("WeaknssPolicy", "Weakness Policy"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("WeaknssPolicies", "Weakness Policies"), .price = (I_PRICE >= GEN_9) ? 50000 : 1000, .holdEffect = HOLD_EFFECT_WEAKNESS_POLICY, .holdEffectParam = 0, @@ -7946,8 +7952,8 @@ const struct Item gItemsInfo[] = [ITEM_SAFETY_GOGGLES] = { - .name = _("SafetyGoggles"), - .pluralName = _("SafetyGoggles"), + .name = HANDLE_EXPANDED_ITEM_NAME("SafetyGoggles", "Safety Goggles"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("SafetyGoggles", "Safety Goggles"), .price = (I_PRICE >= GEN_9) ? 20000 : ((I_PRICE >= GEN_7) ? 4000 : 1000), .holdEffect = HOLD_EFFECT_SAFETY_GOGGLES, .description = COMPOUND_STRING( @@ -7962,7 +7968,7 @@ const struct Item gItemsInfo[] = [ITEM_ADRENALINE_ORB] = { - .name = _("AdrenalineOrb"), + .name = HANDLE_EXPANDED_ITEM_NAME("AdrenalineOrb", "Adrenaline Orb"), .price = (I_PRICE >= GEN_9) ? 5000 : ((I_PRICE >= GEN_8) ? 4000 : 300), .holdEffect = HOLD_EFFECT_ADRENALINE_ORB, .description = COMPOUND_STRING( @@ -7977,7 +7983,7 @@ const struct Item gItemsInfo[] = [ITEM_TERRAIN_EXTENDER] = { - .name = _("TerainExtendr"), + .name = HANDLE_EXPANDED_ITEM_NAME("TerainExtendr", "Terrain Extender"), .price = (I_PRICE >= GEN_9) ? 15000 : 4000, .holdEffect = HOLD_EFFECT_TERRAIN_EXTENDER, .description = COMPOUND_STRING( @@ -7992,8 +7998,8 @@ const struct Item gItemsInfo[] = [ITEM_PROTECTIVE_PADS] = { - .name = _("ProtectvePads"), - .pluralName = _("ProtectvePads"), + .name = HANDLE_EXPANDED_ITEM_NAME("ProtectvePads", "Protective Pads"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("ProtectvePads", "Protective Pads"), .price = (I_PRICE >= GEN_9) ? 15000 : 4000, .holdEffect = HOLD_EFFECT_PROTECTIVE_PADS, .description = COMPOUND_STRING( @@ -8038,8 +8044,8 @@ const struct Item gItemsInfo[] = [ITEM_HEAVY_DUTY_BOOTS] = { - .name = _("Heavy-DtyBts"), - .pluralName = _("Heavy-DtyBts"), + .name = HANDLE_EXPANDED_ITEM_NAME("Heavy-DtyBts", "Heavy-Duty Boots"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("Heavy-DtyBts", "Heavy-Duty Boots"), .price = (I_PRICE >= GEN_9) ? 20000 : 4000, .holdEffect = HOLD_EFFECT_HEAVY_DUTY_BOOTS, .description = COMPOUND_STRING( @@ -8054,8 +8060,8 @@ const struct Item gItemsInfo[] = [ITEM_BLUNDER_POLICY] = { - .name = _("BlundrPolicy"), - .pluralName = _("BlundrPolicies"), + .name = HANDLE_EXPANDED_ITEM_NAME("BlundrPolicy", "Blunder Policy"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("BlundrPolicies", "Blunder Policies"), .price = (I_PRICE >= GEN_9) ? 30000 : 4000, .holdEffect = HOLD_EFFECT_BLUNDER_POLICY, .description = COMPOUND_STRING( @@ -8085,7 +8091,7 @@ const struct Item gItemsInfo[] = [ITEM_UTILITY_UMBRELLA] = { - .name = _("UtltyUmbrlla"), + .name = HANDLE_EXPANDED_ITEM_NAME("UtltyUmbrlla", "Utility Umbrella"), .price = (I_PRICE >= GEN_9) ? 15000 : 4000, .holdEffect = HOLD_EFFECT_UTILITY_UMBRELLA, .description = COMPOUND_STRING( @@ -10736,7 +10742,7 @@ const struct Item gItemsInfo[] = [ITEM_CATCHING_CHARM] = { - .name = _("CatchngCharm"), + .name = HANDLE_EXPANDED_ITEM_NAME("CatchngCharm", "Catching Charm"), .price = 0, .importance = 1, .description = COMPOUND_STRING( @@ -10766,7 +10772,7 @@ const struct Item gItemsInfo[] = [ITEM_ROTOM_CATALOG] = { - .name = _("RotomCatalog"), + .name = HANDLE_EXPANDED_ITEM_NAME("RotomCatalog", "Rotom Catalog"), .price = 0, .importance = 1, .description = COMPOUND_STRING( @@ -10880,8 +10886,8 @@ const struct Item gItemsInfo[] = [ITEM_REINS_OF_UNITY] = { - .name = _("ReinsOfUnity"), - .pluralName = _("ReinsOfUnity"), + .name = HANDLE_EXPANDED_ITEM_NAME("ReinsOfUnity", "Reins of Unity"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("ReinsOfUnity", "Reins of Unity"), .price = 0, .importance = 1, .description = COMPOUND_STRING( @@ -11679,7 +11685,7 @@ const struct Item gItemsInfo[] = [ITEM_ABILITY_SHIELD] = { - .name = _("AbilityShield"), + .name = HANDLE_EXPANDED_ITEM_NAME("AbilityShield", "Ability Shield"), .price = 20000, .holdEffect = HOLD_EFFECT_ABILITY_SHIELD, .description = COMPOUND_STRING( @@ -11711,7 +11717,7 @@ const struct Item gItemsInfo[] = [ITEM_PUNCHING_GLOVE] = { - .name = _("PunchingGlove"), + .name = HANDLE_EXPANDED_ITEM_NAME("PunchingGlove", "Punching Glove"), .price = 15000, .holdEffect = HOLD_EFFECT_PUNCHING_GLOVE, .description = COMPOUND_STRING( @@ -11757,7 +11763,7 @@ const struct Item gItemsInfo[] = [ITEM_AUSPICIOUS_ARMOR] = { - .name = _("AuspciousArmr"), + .name = HANDLE_EXPANDED_ITEM_NAME("AuspciousArmr", "Auspicious Armor"), .price = 3000, .description = COMPOUND_STRING( "Armor inhabited by\n" @@ -11772,8 +11778,8 @@ const struct Item gItemsInfo[] = [ITEM_BOOSTER_ENERGY] = { - .name = _("BoosterEnergy"), - .pluralName = _("BoosterEnergies"), + .name = HANDLE_EXPANDED_ITEM_NAME("BoosterEnergy", "Booster Energy"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("BoosterEnergies", "Booster Energies"), .price = 0, .holdEffect = HOLD_EFFECT_BOOSTER_ENERGY, .description = COMPOUND_STRING( @@ -11788,7 +11794,7 @@ const struct Item gItemsInfo[] = [ITEM_BIG_BAMBOO_SHOOT] = { - .name = _("BigBmbooShoot"), + .name = HANDLE_EXPANDED_ITEM_NAME("BigBmbooShoot", "Big Bamboo Shoot"), .price = 3000, .description = COMPOUND_STRING( "A large and rare\n" @@ -11802,7 +11808,7 @@ const struct Item gItemsInfo[] = [ITEM_GIMMIGHOUL_COIN] = { - .name = _("GimighoulCoin"), + .name = HANDLE_EXPANDED_ITEM_NAME("GimighoulCoin", "Gimmighoul Coin"), .price = 400, .description = COMPOUND_STRING( "Gimmighoul hoard\n" @@ -11815,7 +11821,7 @@ const struct Item gItemsInfo[] = [ITEM_LEADERS_CREST] = { - .name = _("Leader'sCrest"), + .name = HANDLE_EXPANDED_ITEM_NAME("Leader'sCrest", "Leader's Crest"), .price = 3000, .description = COMPOUND_STRING( "A shard of an old\n" @@ -11828,7 +11834,7 @@ const struct Item gItemsInfo[] = [ITEM_MALICIOUS_ARMOR] = { - .name = _("MaliciousArmr"), + .name = HANDLE_EXPANDED_ITEM_NAME("MaliciousArmr", "Malicious Armor"), .price = 3000, .description = COMPOUND_STRING( "Armor inhabited by\n" @@ -11858,8 +11864,8 @@ const struct Item gItemsInfo[] = [ITEM_SCROLL_OF_DARKNESS] = { - .name = _("ScrllOfDrknss"), - .pluralName = _("ScrllsOfDrknss"), + .name = HANDLE_EXPANDED_ITEM_NAME("ScrllOfDrknss", "Scroll of Darkness"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("ScrllsOfDrknss", "Scrolls of Darkness"), .price = 0, .description = COMPOUND_STRING( "A peculiar scroll\n" @@ -11874,8 +11880,8 @@ const struct Item gItemsInfo[] = [ITEM_SCROLL_OF_WATERS] = { - .name = _("ScrollOfWatrs"), - .pluralName = _("ScrollsOfWatrs"), + .name = HANDLE_EXPANDED_ITEM_NAME("ScrollOfWatrs", "Scroll of Waters"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("ScrollsOfWatrs", "Scrolls of Waters"), .price = 0, .description = COMPOUND_STRING( "A peculiar scroll\n" @@ -11904,7 +11910,7 @@ const struct Item gItemsInfo[] = [ITEM_TINY_BAMBOO_SHOOT] = { - .name = _("TinyBmbooShot"), + .name = HANDLE_EXPANDED_ITEM_NAME("TinyBmbooShot", "Tiny Bamboo Shoot"), .price = 750, .description = COMPOUND_STRING( "A small and rare\n" @@ -11918,7 +11924,7 @@ const struct Item gItemsInfo[] = [ITEM_BUG_TERA_SHARD] = { - .name = _("Bug TeraShard"), + .name = HANDLE_EXPANDED_ITEM_NAME("Bug TeraShard", "Bug Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11928,7 +11934,7 @@ const struct Item gItemsInfo[] = [ITEM_DARK_TERA_SHARD] = { - .name = _("DarkTeraShard"), + .name = HANDLE_EXPANDED_ITEM_NAME("DarkTeraShard", "Dark Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11938,7 +11944,7 @@ const struct Item gItemsInfo[] = [ITEM_DRAGON_TERA_SHARD] = { - .name = _("DragnTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("DragnTeraShrd", "Dragon Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11948,7 +11954,7 @@ const struct Item gItemsInfo[] = [ITEM_ELECTRIC_TERA_SHARD] = { - .name = _("EltrcTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("EltrcTeraShrd", "Electric Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11958,7 +11964,7 @@ const struct Item gItemsInfo[] = [ITEM_FAIRY_TERA_SHARD] = { - .name = _("FairyTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("FairyTeraShrd", "Fairy Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11968,7 +11974,7 @@ const struct Item gItemsInfo[] = [ITEM_FIGHTING_TERA_SHARD] = { - .name = _("FghtngTerShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("FghtngTerShrd", "Fighting Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11978,7 +11984,7 @@ const struct Item gItemsInfo[] = [ITEM_FIRE_TERA_SHARD] = { - .name = _("FireTeraShard"), + .name = HANDLE_EXPANDED_ITEM_NAME("FireTeraShard", "Fire Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11988,7 +11994,7 @@ const struct Item gItemsInfo[] = [ITEM_FLYING_TERA_SHARD] = { - .name = _("FlyngTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("FlyngTeraShrd", "Flying Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -11998,7 +12004,7 @@ const struct Item gItemsInfo[] = [ITEM_GHOST_TERA_SHARD] = { - .name = _("GhostTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("GhostTeraShrd", "Ghost Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12008,7 +12014,7 @@ const struct Item gItemsInfo[] = [ITEM_GRASS_TERA_SHARD] = { - .name = _("GrassTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("GrassTeraShrd", "Grass Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12018,7 +12024,7 @@ const struct Item gItemsInfo[] = [ITEM_GROUND_TERA_SHARD] = { - .name = _("GrondTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("GrondTeraShrd", "Ground Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12028,7 +12034,7 @@ const struct Item gItemsInfo[] = [ITEM_ICE_TERA_SHARD] = { - .name = _("Ice TeraShard"), + .name = HANDLE_EXPANDED_ITEM_NAME("Ice TeraShard", "Ice Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12038,7 +12044,7 @@ const struct Item gItemsInfo[] = [ITEM_NORMAL_TERA_SHARD] = { - .name = _("NormlTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("NormlTeraShrd", "Normal Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12048,7 +12054,7 @@ const struct Item gItemsInfo[] = [ITEM_POISON_TERA_SHARD] = { - .name = _("PoisnTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("PoisnTeraShrd", "Poison Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12058,7 +12064,7 @@ const struct Item gItemsInfo[] = [ITEM_PSYCHIC_TERA_SHARD] = { - .name = _("PschcTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("PschcTeraShrd", "Psychic Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12068,7 +12074,7 @@ const struct Item gItemsInfo[] = [ITEM_ROCK_TERA_SHARD] = { - .name = _("RockTeraShard"), + .name = HANDLE_EXPANDED_ITEM_NAME("RockTeraShard", "Rock Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12078,7 +12084,7 @@ const struct Item gItemsInfo[] = [ITEM_STEEL_TERA_SHARD] = { - .name = _("SteelTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("SteelTeraShrd", "Steel Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12088,7 +12094,7 @@ const struct Item gItemsInfo[] = [ITEM_WATER_TERA_SHARD] = { - .name = _("WaterTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("WaterTeraShrd", "Water Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12098,7 +12104,7 @@ const struct Item gItemsInfo[] = [ITEM_ADAMANT_CRYSTAL] = { - .name = _("AdamantCrystl"), + .name = HANDLE_EXPANDED_ITEM_NAME("AdamantCrystl", "Adamant Crystal"), .price = 0, .description = COMPOUND_STRING( "A large, glowing gem\n" @@ -12126,7 +12132,7 @@ const struct Item gItemsInfo[] = [ITEM_LUSTROUS_GLOBE] = { - .name = _("LustrousGlobe"), + .name = HANDLE_EXPANDED_ITEM_NAME("LustrousGlobe", "Lustrous Globe"), .price = 0, .description = COMPOUND_STRING( "A large, glowing gem\n" @@ -12140,7 +12146,7 @@ const struct Item gItemsInfo[] = [ITEM_BLACK_AUGURITE] = { - .name = _("BlackAugurite"), + .name = HANDLE_EXPANDED_ITEM_NAME("BlackAugurite", "Black Augurite"), .price = 8000, .description = COMPOUND_STRING( "A black stone that\n" @@ -12231,7 +12237,7 @@ const struct Item gItemsInfo[] = [ITEM_UNREMARKABLE_TEACUP] = { - .name = _("UnrmkblTeacup"), + .name = HANDLE_EXPANDED_ITEM_NAME("UnrmkblTeacup", "Unremarkable Teacup"), .price = 1600, .description = COMPOUND_STRING( "A cracked teacup\n" @@ -12246,7 +12252,7 @@ const struct Item gItemsInfo[] = [ITEM_MASTERPIECE_TEACUP] = { - .name = _("MstrpceTeacup"), + .name = HANDLE_EXPANDED_ITEM_NAME("MstrpceTeacup", "Masterpiece Teacup"), .price = 38000, .description = COMPOUND_STRING( "A chipped teacup\n" @@ -12261,7 +12267,7 @@ const struct Item gItemsInfo[] = [ITEM_CORNERSTONE_MASK] = { - .name = _("CornrstneMask"), + .name = HANDLE_EXPANDED_ITEM_NAME("CornrstneMask", "Cornerstone Mask"), .price = 0, .description = COMPOUND_STRING( "Allows Ogerpon to\n" @@ -12274,7 +12280,7 @@ const struct Item gItemsInfo[] = [ITEM_WELLSPRING_MASK] = { - .name = _("WellsprngMask"), + .name = HANDLE_EXPANDED_ITEM_NAME("WellsprngMask", "Wellspring Mask"), .price = 0, .description = COMPOUND_STRING( "Allows Ogerpon to\n" @@ -12287,7 +12293,7 @@ const struct Item gItemsInfo[] = [ITEM_HEARTHFLAME_MASK] = { - .name = _("HrthflameMask"), + .name = HANDLE_EXPANDED_ITEM_NAME("HrthflameMask", "Hearthflame Mask"), .price = 0, .description = COMPOUND_STRING( "Allows Ogerpon to\n" @@ -12378,8 +12384,8 @@ const struct Item gItemsInfo[] = [ITEM_FRESH_START_MOCHI] = { - .name = _("FrshStrtMochi"), - .pluralName = _("FrshStrtMochi"), + .name = HANDLE_EXPANDED_ITEM_NAME("FrshStrtMochi", "Fresh Start Mochi"), + .pluralName = HANDLE_EXPANDED_ITEM_NAME("FrshStrtMochi", "Fresh Start Mochi"), .price = 300, .description = COMPOUND_STRING( "An item that resets\n" @@ -12394,7 +12400,7 @@ const struct Item gItemsInfo[] = [ITEM_GLIMMERING_CHARM] = { - .name = _("GlmmringCharm"), + .name = HANDLE_EXPANDED_ITEM_NAME("GlmmringCharm", "Glimmering Charm"), .price = 0, .importance = 1, .description = COMPOUND_STRING( @@ -12422,7 +12428,7 @@ const struct Item gItemsInfo[] = [ITEM_STELLAR_TERA_SHARD] = { - .name = _("StllrTeraShrd"), + .name = HANDLE_EXPANDED_ITEM_NAME("StllrTeraShrd", "Stellar Tera Shard"), .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -12432,7 +12438,7 @@ const struct Item gItemsInfo[] = [ITEM_JUBILIFE_MUFFIN] = { - .name = _("JublifeMuffin"), + .name = HANDLE_EXPANDED_ITEM_NAME("JublifeMuffin", "Jubilife Muffin"), .price = 250, .description = sFullHealDesc, .pocket = POCKET_ITEMS, @@ -12560,7 +12566,7 @@ const struct Item gItemsInfo[] = [ITEM_AUX_POWERGUARD] = { - .name = _("AuxPowerguard"), + .name = HANDLE_EXPANDED_ITEM_NAME("AuxPowerguard", "Aux Powerguard"), .price = 1200, .holdEffectParam = X_ITEM_STAGES, .description = COMPOUND_STRING( @@ -12581,7 +12587,7 @@ const struct Item gItemsInfo[] = [ITEM_CHOICE_DUMPLING] = { - .name = _("ChoiceDumplng"), + .name = HANDLE_EXPANDED_ITEM_NAME("ChoiceDumplng", "Choice Dumpling"), .price = 1200, .description = sQuestionMarksDesc, .pocket = POCKET_ITEMS, @@ -12603,7 +12609,7 @@ const struct Item gItemsInfo[] = [ITEM_TWICE_SPICED_RADISH] = { - .name = _("2xSpicedRadsh"), + .name = HANDLE_EXPANDED_ITEM_NAME("2xSpicedRadsh", "Twice-Spiced Radish"), .price = 1600, .description = sQuestionMarksDesc, .pocket = POCKET_ITEMS, From aab9678b0272216188240b392eb9fe05f833812e Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 16 Mar 2024 15:26:03 +0000 Subject: [PATCH 07/13] Enable GF item names by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the Pokémon Storage System, even FONT_SMALL_NARROWER isn't sufficient to prevent clipping in all cases. e.g. Unremarkable Teacup clips. We have decided to accept that cost to make the rest of the user experience better, but downstream projects that don't like that trade-off can either a) alter the Pokémon Storage System UI, or b) set I_EXPANDED_ITEM_NAMES to FALSE. --- include/config/item.h | 2 +- include/config/test.h | 2 + include/item.h | 4 +- src/item.c | 26 +-- src/item_menu.c | 39 ++--- src/player_pc.c | 14 +- src/pokemon_storage_system.c | 4 +- src/pokemon_summary_screen.c | 6 +- src/shop.c | 3 +- src/strings.c | 16 +- test/battle/hold_effect/safety_goggles.c | 2 +- test/battle/move_effect/embargo.c | 2 +- test/battle/move_effect/knock_off.c | 4 +- test/text.c | 194 +++++++++++++++++++++++ 14 files changed, 264 insertions(+), 54 deletions(-) diff --git a/include/config/item.h b/include/config/item.h index 2f7db2ed927b..644a73ade6d8 100644 --- a/include/config/item.h +++ b/include/config/item.h @@ -2,7 +2,7 @@ #define GUARD_CONFIG_ITEM_H // Item config -#define I_EXPANDED_ITEM_NAMES FALSE // If set to TRUE, item names are increased from 14 characters to 20 characters. +#define I_EXPANDED_ITEM_NAMES TRUE // If set to FALSE, item names are decreased from 20 characters to 14 characters. #define I_SHINY_CHARM_ADDITIONAL_ROLLS 2 // Amount of additional shiny rolls if the player has the Shiny Charm. Set it to 0 to disable Shiny Charm's effects. #define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items. #define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. diff --git a/include/config/test.h b/include/config/test.h index 9d8066864a67..8dba50f8a70b 100644 --- a/include/config/test.h +++ b/include/config/test.h @@ -3,5 +3,7 @@ #undef B_EXPANDED_MOVE_NAMES #define B_EXPANDED_MOVE_NAMES TRUE +#undef I_EXPANDED_ITEM_NAMES +#define I_EXPANDED_ITEM_NAMES TRUE #endif // GUARD_CONFIG_TEST_H diff --git a/include/item.h b/include/item.h index 53121d112781..88c9fe5e3fd6 100644 --- a/include/item.h +++ b/include/item.h @@ -37,8 +37,8 @@ extern struct BagPocket gBagPockets[]; void ApplyNewEncryptionKeyToBagItems(u32 newKey); void ApplyNewEncryptionKeyToBagItems_(u32 newKey); void SetBagItemsPointers(void); -void CopyItemName(u16 itemId, u8 *dst); -void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity); +u8 *CopyItemName(u16 itemId, u8 *dst); +u8 *CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity); bool8 IsBagPocketNonEmpty(u8 pocket); bool8 CheckBagHasItem(u16 itemId, u16 count); bool8 HasAtLeastOneBerry(void); diff --git a/src/item.c b/src/item.c index c9318ee4a7ec..4e903b4883e3 100644 --- a/src/item.c +++ b/src/item.c @@ -81,24 +81,28 @@ void SetBagItemsPointers(void) gBagPockets[BERRIES_POCKET].capacity = BAG_BERRIES_COUNT; } -void CopyItemName(u16 itemId, u8 *dst) +u8 *CopyItemName(u16 itemId, u8 *dst) { - StringCopy(dst, ItemId_GetName(itemId)); + return StringCopy(dst, ItemId_GetName(itemId)); } const u8 sText_s[] =_("s"); -void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity) +u8 *CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity) { - u8 *end = StringCopy(dst, ItemId_GetName(itemId)) - 1; - - if (quantity < 2) - return; - - if (DoesItemHavePluralName(itemId)) - StringCopy(dst, ItemId_GetPluralName(itemId)); + if (quantity == 1) + { + return StringCopy(dst, ItemId_GetName(itemId)); + } + else if (DoesItemHavePluralName(itemId)) + { + return StringCopy(dst, ItemId_GetPluralName(itemId)); + } else - StringAppend(end, sText_s); + { + u8 *end = StringCopy(dst, ItemId_GetName(itemId)); + return StringCopy(end, sText_s); + } } bool8 IsBagPocketNonEmpty(u8 pocket) diff --git a/src/item_menu.c b/src/item_menu.c index dde142d02135..ad9fc6f4bcf7 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -109,7 +109,7 @@ struct ListBuffer1 { }; struct ListBuffer2 { - u8 name[MAX_POCKET_ITEMS][max(ITEM_NAME_LENGTH, MOVE_NAME_LENGTH + 3) + 10]; + u8 name[MAX_POCKET_ITEMS][max(ITEM_NAME_LENGTH, MOVE_NAME_LENGTH) + 15]; }; struct TempWallyBag { @@ -905,19 +905,12 @@ static void LoadBagItemListBuffers(u8 pocketId) static void GetItemName(u8 *dest, u16 itemId) { - u32 fontId; + u8 *end; switch (gBagPosition.pocket) { case TMHM_POCKET: - StringCopy(gStringVar2, GetMoveName(ItemIdToBattleMoveId(itemId))); - fontId = GetFontIdToFit(gStringVar2, FONT_NARROW, 0, 73); - if (fontId != FONT_NARROW) - { - gStringVar2[0] = EXT_CTRL_CODE_BEGIN; - gStringVar2[1] = EXT_CTRL_CODE_FONT; - gStringVar2[2] = fontId; - StringCopy(&gStringVar2[3], GetMoveName(ItemIdToBattleMoveId(itemId))); - } + end = StringCopy(gStringVar2, GetMoveName(ItemIdToBattleMoveId(itemId))); + PrependFontIdToFit(gStringVar2, end, FONT_NARROW, 73); if (itemId >= ITEM_HM01) { // Get HM number @@ -933,11 +926,13 @@ static void GetItemName(u8 *dest, u16 itemId) break; case BERRIES_POCKET: ConvertIntToDecimalStringN(gStringVar1, itemId - FIRST_BERRY_INDEX + 1, STR_CONV_MODE_LEADING_ZEROS, 2); - CopyItemName(itemId, gStringVar2); + end = CopyItemName(itemId, gStringVar2); + PrependFontIdToFit(gStringVar2, end, FONT_NARROW, 73); StringExpandPlaceholders(dest, gText_NumberItem_TMBerry); break; default: - CopyItemName(itemId, dest); + end = CopyItemName(itemId, dest); + PrependFontIdToFit(dest, end, FONT_NARROW, 88); break; } } @@ -1676,7 +1671,8 @@ static void OpenContextMenu(u8 taskId) } else { - CopyItemName(gSpecialVar_ItemId, gStringVar1); + u8 *end = CopyItemName(gSpecialVar_ItemId, gStringVar1); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(WIN_DESCRIPTION) - 10 - 6); StringExpandPlaceholders(gStringVar4, gText_Var1IsSelected); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); @@ -1842,7 +1838,8 @@ static void ItemMenu_Toss(u8 taskId) } else { - CopyItemName(gSpecialVar_ItemId, gStringVar1); + u8 *end = CopyItemNameHandlePlural(gSpecialVar_ItemId, gStringVar1, 2); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(WIN_DESCRIPTION) - 10 - 6); StringExpandPlaceholders(gStringVar4, gText_TossHowManyVar1s); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); @@ -1855,7 +1852,8 @@ static void AskTossItems(u8 taskId) { s16 *data = gTasks[taskId].data; - CopyItemName(gSpecialVar_ItemId, gStringVar1); + u8 *end = CopyItemNameHandlePlural(gSpecialVar_ItemId, gStringVar1, tItemCount); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(WIN_DESCRIPTION) - 10 - 6); ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); @@ -1898,7 +1896,8 @@ static void ConfirmToss(u8 taskId) { s16 *data = gTasks[taskId].data; - CopyItemName(gSpecialVar_ItemId, gStringVar1); + u8 *end = CopyItemNameHandlePlural(gSpecialVar_ItemId, gStringVar1, tItemCount); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(WIN_DESCRIPTION) - 10 - 6); ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); @@ -2235,7 +2234,8 @@ static void Task_ItemContext_Deposit(u8 taskId) } else { - CopyItemName(gSpecialVar_ItemId, gStringVar1); + u8 *end = CopyItemNameHandlePlural(gSpecialVar_ItemId, gStringVar1, 2); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(WIN_DESCRIPTION) - 10 - 6); StringExpandPlaceholders(gStringVar4, gText_DepositHowManyVar1); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); @@ -2282,7 +2282,8 @@ static void TryDepositItem(u8 taskId) else if (AddPCItem(gSpecialVar_ItemId, tItemCount) == TRUE) { // Successfully deposited - CopyItemName(gSpecialVar_ItemId, gStringVar1); + u8 *end = CopyItemNameHandlePlural(gSpecialVar_ItemId, gStringVar1, tItemCount); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(WIN_DESCRIPTION) - 10 - 6); ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_DepositedVar2Var1s); BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); diff --git a/src/player_pc.c b/src/player_pc.c index a10cb2ac2be1..3dd5fcc36f26 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -293,6 +293,7 @@ static const struct ListMenuTemplate sListMenuTemplate_ItemStorage = .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, .fontId = FONT_NARROW, .cursorKind = CURSOR_BLACK_ARROW, + .textNarrowWidth = 74, }; static const struct WindowTemplate sWindowTemplates_ItemStorage[ITEMPC_WIN_COUNT] = @@ -1349,6 +1350,7 @@ static void ItemStorage_PrintItemQuantity(u8 windowId, u16 value, u32 mode, u8 x // Start an item Withdraw/Toss static void ItemStorage_DoItemAction(u8 taskId) { + u8 *end; s16 *data = gTasks[taskId].data; u16 pos = gPlayerPCItemPageInfo.cursorPos + gPlayerPCItemPageInfo.itemsAbove; ItemStorage_RemoveScrollIndicator(); @@ -1364,7 +1366,8 @@ static void ItemStorage_DoItemAction(u8 taskId) } // Withdrawing multiple items, show "how many" message - CopyItemName(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1); + end = CopyItemNameHandlePlural(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1, 2); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(ITEMPC_WIN_MESSAGE) - 6); ItemStorage_PrintMessage(ItemStorage_GetMessage(MSG_HOW_MANY_TO_WITHDRAW)); } else @@ -1377,7 +1380,8 @@ static void ItemStorage_DoItemAction(u8 taskId) } // Tossing multiple items, show "how many" message - CopyItemName(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1); + end = CopyItemNameHandlePlural(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1, 2); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(ITEMPC_WIN_MESSAGE) - 6); ItemStorage_PrintMessage(ItemStorage_GetMessage(MSG_HOW_MANY_TO_TOSS)); } @@ -1426,7 +1430,8 @@ static void ItemStorage_DoItemWithdraw(u8 taskId) if (AddBagItem(gSaveBlock1Ptr->pcItems[pos].itemId, tQuantity) == TRUE) { // Item withdrawn - CopyItemName(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1); + u8 *end = CopyItemNameHandlePlural(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1, tQuantity); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(ITEMPC_WIN_MESSAGE) - 6); ConvertIntToDecimalStringN(gStringVar2, tQuantity, STR_CONV_MODE_LEFT_ALIGN, 3); ItemStorage_PrintMessage(ItemStorage_GetMessage(MSG_WITHDREW_ITEM)); gTasks[taskId].func = ItemStorage_HandleRemoveItem; @@ -1448,7 +1453,8 @@ static void ItemStorage_DoItemToss(u8 taskId) if (!ItemId_GetImportance(gSaveBlock1Ptr->pcItems[pos].itemId)) { // Show toss confirmation prompt - CopyItemName(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1); + u8 *end = CopyItemNameHandlePlural(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1, tQuantity); + WrapFontIdToFit(gStringVar1, end, FONT_NORMAL, WindowWidthPx(ITEMPC_WIN_MESSAGE) - 6); ConvertIntToDecimalStringN(gStringVar2, tQuantity, STR_CONV_MODE_LEFT_ALIGN, 3); ItemStorage_PrintMessage(ItemStorage_GetMessage(MSG_OKAY_TO_THROW_AWAY)); CreateYesNoMenuWithCallbacks(taskId, &sWindowTemplates_ItemStorage[ITEMPC_WIN_YESNO], 1, 0, 1, 0x214, 0xE, &ItemTossYesNoFuncs); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 013f7e21b425..a079a10c24e2 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -4031,11 +4031,11 @@ static void PrintDisplayMonInfo(void) AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, 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, FONT_SMALL, sStorage->displayMonItemName, 6, 43, 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, FONT_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL); + 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, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, 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 ee2d0e9853fe..1989913fc242 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3434,6 +3434,7 @@ static void Task_PrintSkillsPage(u8 taskId) static void PrintHeldItemName(void) { const u8 *text; + u32 fontId; int x; if (sMonSummaryScreen->summary.item == ITEM_ENIGMA_BERRY_E_READER @@ -3452,8 +3453,9 @@ static void PrintHeldItemName(void) text = gStringVar1; } - x = GetStringCenterAlignXOffset(FONT_NORMAL, text, 72) + 6; - PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_HELD_ITEM), text, x, 1, 0, 0); + fontId = GetFontIdToFit(text, FONT_NORMAL, 0, WindowTemplateWidthPx(&sPageSkillsTemplate[PSS_DATA_WINDOW_SKILLS_HELD_ITEM]) - 8); + x = GetStringCenterAlignXOffset(fontId, text, 72) + 6; + PrintTextOnWindowWithFont(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_HELD_ITEM), text, x, 1, 0, 0, fontId); } static void PrintRibbonCount(void) diff --git a/src/shop.c b/src/shop.c index 88d66a43e9fd..e517c2115593 100644 --- a/src/shop.c +++ b/src/shop.c @@ -216,7 +216,8 @@ static const struct ListMenuTemplate sShopBuyMenuListTemplate = .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, .fontId = FONT_NARROW, - .cursorKind = CURSOR_BLACK_ARROW + .cursorKind = CURSOR_BLACK_ARROW, + .textNarrowWidth = 84, }; static const struct BgTemplate sShopBuyMenuBgTemplates[] = diff --git a/src/strings.c b/src/strings.c index 4fde38024018..84c811268115 100644 --- a/src/strings.c +++ b/src/strings.c @@ -221,20 +221,20 @@ const u8 gText_xVar1[] = _("×{STR_VAR_1}"); const u8 gText_Berry2[] = _(" BERRY"); // Unused const u8 gText_Coins[] = _("{STR_VAR_1} COINS"); const u8 gText_CloseBag[] = _("CLOSE BAG"); -const u8 gText_Var1IsSelected[] = _("{STR_VAR_1} is\nselected."); +const u8 gText_Var1IsSelected[] = _("{STR_VAR_1}\nis selected."); const u8 gText_CantWriteMail[] = _("You can't write\nMAIL here."); const u8 gText_NoPokemon[] = _("There is no\nPOKéMON."); const u8 gText_MoveVar1Where[] = _("Move the\n{STR_VAR_1}\nwhere?"); const u8 gText_Var1CantBeHeld[] = _("The {STR_VAR_1} can't be held."); const u8 gText_Var1CantBeHeldHere[] = _("The {STR_VAR_1} can't be held\nhere."); -const u8 gText_DepositHowManyVar1[] = _("Deposit how many\n{STR_VAR_1}(s)?"); -const u8 gText_DepositedVar2Var1s[] = _("Deposited {STR_VAR_2}\n{STR_VAR_1}(s)."); +const u8 gText_DepositHowManyVar1[] = _("Deposit how many\n{STR_VAR_1}?"); +const u8 gText_DepositedVar2Var1s[] = _("Deposited {STR_VAR_2}\n{STR_VAR_1}."); const u8 gText_NoRoomForItems[] = _("There's no room to\nstore items."); const u8 gText_CantStoreImportantItems[] = _("Important items\ncan't be stored in\nthe PC!"); const u8 gText_TooImportantToToss[] = _("That's much too\nimportant to toss\nout!"); -const u8 gText_TossHowManyVar1s[] = _("Toss out how many\n{STR_VAR_1}(s)?"); -const u8 gText_ThrewAwayVar2Var1s[] = _("Threw away {STR_VAR_2}\n{STR_VAR_1}(s)."); -const u8 gText_ConfirmTossItems[] = _("Is it okay to\nthrow away {STR_VAR_2}\n{STR_VAR_1}(s)?"); +const u8 gText_TossHowManyVar1s[] = _("Toss out how many\n{STR_VAR_1}?"); +const u8 gText_ThrewAwayVar2Var1s[] = _("Threw away {STR_VAR_2}\n{STR_VAR_1}."); +const u8 gText_ConfirmTossItems[] = _("Is it okay to\nthrow away {STR_VAR_2}\n{STR_VAR_1}?"); const u8 gText_DadsAdvice[] = _("DAD's advice…\n{PLAYER}, there's a time and place for\leverything!{PAUSE_UNTIL_PRESS}"); const u8 gText_CantDismountBike[] = _("You can't dismount your BIKE here.{PAUSE_UNTIL_PRESS}"); const u8 gText_ItemFinderNearby[] = _("Huh?\nThe ITEMFINDER's responding!\pThere's an item buried around here!{PAUSE_UNTIL_PRESS}"); @@ -597,8 +597,8 @@ const u8 gText_TakeOutItemsFromPC[] = _("Take out items from the PC."); const u8 gText_ThrowAwayItemsInPC[] = _("Throw away items stored in the PC."); const u8 gText_NoItems[] = _("There are no items.{PAUSE_UNTIL_PRESS}"); const u8 gText_NoRoomInBag[] = _("There is no more\nroom in the BAG."); -const u8 gText_WithdrawHowManyItems[] = _("Withdraw how many\n{STR_VAR_1}(s)?"); -const u8 gText_WithdrawXItems[] = _("Withdrew {STR_VAR_2}\n{STR_VAR_1}(s)."); +const u8 gText_WithdrawHowManyItems[] = _("Withdraw how many\n{STR_VAR_1}?"); +const u8 gText_WithdrawXItems[] = _("Withdrew {STR_VAR_2}\n{STR_VAR_1}."); const u8 gText_Read[] = _("READ"); const u8 gText_MoveToBag[] = _("MOVE TO BAG"); const u8 gText_Give2[] = _("GIVE"); diff --git a/test/battle/hold_effect/safety_goggles.c b/test/battle/hold_effect/safety_goggles.c index b20f19e0a583..4c5c6a29653b 100644 --- a/test/battle/hold_effect/safety_goggles.c +++ b/test/battle/hold_effect/safety_goggles.c @@ -16,7 +16,7 @@ SINGLE_BATTLE_TEST("Safety Goggles block powder and spore moves") TURN { MOVE(player, MOVE_STUN_SPORE); } } SCENE { NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player); - MESSAGE("Foe Abra is not affected thanks to its SafetyGoggles!"); + MESSAGE("Foe Abra is not affected thanks to its Safety Goggles!"); } } diff --git a/test/battle/move_effect/embargo.c b/test/battle/move_effect/embargo.c index 8d9cc9c86d1c..0d69496efca2 100644 --- a/test/battle/move_effect/embargo.c +++ b/test/battle/move_effect/embargo.c @@ -352,7 +352,7 @@ SINGLE_BATTLE_TEST("Embargo doesn't prevent Mega Evolution") ANIMATION(ANIM_TYPE_MOVE, MOVE_BATON_PASS, opponent); MESSAGE("2 sent out Charizard!"); // Turn 3 - MESSAGE("Foe Charizard's CharizarditeY is reacting to 2's Mega Ring!"); + MESSAGE("Foe Charizard's Charizardite Y is reacting to 2's Mega Ring!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, opponent); MESSAGE("Foe Charizard has Mega Evolved into Mega Charizard!"); } diff --git a/test/battle/move_effect/knock_off.c b/test/battle/move_effect/knock_off.c index 177e3b18c1f9..49e5c499d30b 100644 --- a/test/battle/move_effect/knock_off.c +++ b/test/battle/move_effect/knock_off.c @@ -43,8 +43,8 @@ SINGLE_BATTLE_TEST("Knock Off activates after Rocky Helmet and Weakness Policy") ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent); if (item == ITEM_WEAKNESS_POLICY) { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE); - MESSAGE("Using WeaknssPolicy, the Attack of Foe Wobbuffet sharply rose!"); - MESSAGE("Using WeaknssPolicy, the Sp. Atk of Foe Wobbuffet sharply rose!"); + MESSAGE("Using Weakness Policy, the Attack of Foe Wobbuffet sharply rose!"); + MESSAGE("Using Weakness Policy, the Sp. Atk of Foe Wobbuffet sharply rose!"); } else if (item == ITEM_ROCKY_HELMET) { HP_BAR(player); MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Rocky Helmet!"); diff --git a/test/text.c b/test/text.c index ee81386c0016..f42511ee92dd 100644 --- a/test/text.c +++ b/test/text.c @@ -2,6 +2,7 @@ #include "test/test.h" #include "item.h" #include "text.h" +#include "constants/items.h" #include "constants/moves.h" TEST("Move names fit on Pokemon Summary Screen") @@ -75,3 +76,196 @@ TEST("Move names fit on Move Relearner Screen") } EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); } + +TEST("Item names fit on Bag Screen (list)") +{ + u32 i; + const u32 fontId = FONT_NARROWER; + const u32 tmHmBerryWidthPx = 71, restWidthPx = 88; + u32 item = ITEM_NONE; + for (i = 1; i < ITEMS_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gItemsInfo[i].name) { item = i; } + } + if (gItemsInfo[item].pocket == POCKET_TM_HM || gItemsInfo[item].pocket == POCKET_BERRIES) + EXPECT_LE(GetStringWidth(fontId, gItemsInfo[item].name, 0), tmHmBerryWidthPx); + else + EXPECT_LE(GetStringWidth(fontId, gItemsInfo[item].name, 0), restWidthPx); +} + +TEST("Item plural names fit on Bag Screen (left box)") +{ + u32 i; + // -6 for the question mark in FONT_NORMAL. + const u32 fontId = FONT_NARROWER, widthPx = 102 - 6; + u32 item = ITEM_NONE; + u8 pluralName[ITEM_NAME_PLURAL_LENGTH + 1]; + for (i = 1; i < ITEMS_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gItemsInfo[i].name) { item = i; } + } + CopyItemNameHandlePlural(item, pluralName, 2); + EXPECT_LE(GetStringWidth(fontId, pluralName, 0), widthPx); +} + +TEST("Item plural names fit on PC storage (left box)") +{ + u32 i; + // -6 for the question mark in FONT_NORMAL. + const u32 fontId = FONT_NARROWER, widthPx = 104 - 6; + u32 item = ITEM_NONE; + u8 pluralName[ITEM_NAME_PLURAL_LENGTH + 1]; + for (i = 1; i < ITEMS_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gItemsInfo[i].name) { item = i; } + } + CopyItemNameHandlePlural(item, pluralName, 2); + EXPECT_LE(GetStringWidth(fontId, pluralName, 0), widthPx); +} + +TEST("Item names fit on Pokemon Storage System") +{ + u32 i; + const u32 fontId = FONT_SMALL_NARROWER, widthPx = 50; + u32 item = ITEM_NONE; + for (i = 1; i < ITEMS_COUNT; i++) + { + if (gItemsInfo[i].importance) continue; + PARAMETRIZE_LABEL("%S", gItemsInfo[i].name) { item = i; } + } + // All items explicitly listed here are too big to fit. The ones + // with a hold effect are listed at the bottom in case you want to + // focus on making them fit (they are the most likely to appear on + // the storage system UI, along with anything that could be held + // in the wild). + switch (item) + { + case ITEM_ENERGY_POWDER: + case ITEM_PEWTER_CRUNCHIES: + case ITEM_RAGE_CANDY_BAR: + case ITEM_LUMIOSE_GALETTE: + case ITEM_HEALTH_FEATHER: + case ITEM_MUSCLE_FEATHER: + case ITEM_RESIST_FEATHER: + case ITEM_GENIUS_FEATHER: + case ITEM_CLEVER_FEATHER: + case ITEM_ABILITY_CAPSULE: + case ITEM_DYNAMAX_CANDY: + case ITEM_MAX_MUSHROOMS: + case ITEM_GOLD_BOTTLE_CAP: + case ITEM_PRETTY_FEATHER: + case ITEM_STRANGE_SOUVENIR: + case ITEM_FOSSILIZED_BIRD: + case ITEM_FOSSILIZED_FISH: + case ITEM_FOSSILIZED_DRAKE: + case ITEM_FOSSILIZED_DINO: + case ITEM_SURPRISE_MULCH: + case ITEM_YELLOW_APRICORN: + case ITEM_GREEN_APRICORN: + case ITEM_WHITE_APRICORN: + case ITEM_BLACK_APRICORN: + case ITEM_THUNDER_STONE: + case ITEM_GALARICA_WREATH: + case ITEM_STRAWBERRY_SWEET: + case ITEM_AUSPICIOUS_ARMOR: + case ITEM_BIG_BAMBOO_SHOOT: + case ITEM_GIMMIGHOUL_COIN: + case ITEM_LEADERS_CREST: + case ITEM_MALICIOUS_ARMOR: + case ITEM_TINY_BAMBOO_SHOOT: + case ITEM_BUG_TERA_SHARD: + case ITEM_DARK_TERA_SHARD: + case ITEM_DRAGON_TERA_SHARD: + case ITEM_ELECTRIC_TERA_SHARD: + case ITEM_FAIRY_TERA_SHARD: + case ITEM_FIGHTING_TERA_SHARD: + case ITEM_FIRE_TERA_SHARD: + case ITEM_FLYING_TERA_SHARD: + case ITEM_GHOST_TERA_SHARD: + case ITEM_GRASS_TERA_SHARD: + case ITEM_GROUND_TERA_SHARD: + case ITEM_ICE_TERA_SHARD: + case ITEM_NORMAL_TERA_SHARD: + case ITEM_POISON_TERA_SHARD: + case ITEM_PSYCHIC_TERA_SHARD: + case ITEM_ROCK_TERA_SHARD: + case ITEM_STEEL_TERA_SHARD: + case ITEM_WATER_TERA_SHARD: + case ITEM_BLACK_AUGURITE: + case ITEM_UNREMARKABLE_TEACUP: + case ITEM_MASTERPIECE_TEACUP: + case ITEM_FRESH_START_MOCHI: + case ITEM_STELLAR_TERA_SHARD: + case ITEM_JUBILIFE_MUFFIN: + case ITEM_SUPERB_REMEDY: + case ITEM_AUX_POWERGUARD: + case ITEM_CHOICE_DUMPLING: + case ITEM_TWICE_SPICED_RADISH: + // Items with hold effects: + case ITEM_ELECTRIC_MEMORY: + case ITEM_FIGHTING_MEMORY: + case ITEM_GROUND_MEMORY: + case ITEM_PSYCHIC_MEMORY: + case ITEM_DRAGON_MEMORY: + case ITEM_CHARIZARDITE_X: + case ITEM_CHARIZARDITE_Y: + case ITEM_ULTRANECROZIUM_Z: + case ITEM_DEEP_SEA_SCALE: + case ITEM_DEEP_SEA_TOOTH: + case ITEM_NEVER_MELT_ICE: + case ITEM_WEAKNESS_POLICY: + case ITEM_SAFETY_GOGGLES: + case ITEM_ADRENALINE_ORB: + case ITEM_TERRAIN_EXTENDER: + case ITEM_PROTECTIVE_PADS: + case ITEM_HEAVY_DUTY_BOOTS: + case ITEM_UTILITY_UMBRELLA: + case ITEM_MARANGA_BERRY: + case ITEM_PUNCHING_GLOVE: + case ITEM_BOOSTER_ENERGY: + case ITEM_ADAMANT_CRYSTAL: + case ITEM_LUSTROUS_GLOBE: + case ITEM_CORNERSTONE_MASK: + case ITEM_WELLSPRING_MASK: + case ITEM_HEARTHFLAME_MASK: + EXPECT_GT(GetStringWidth(fontId, gItemsInfo[item].name, 0), widthPx); + break; + default: + EXPECT_LE(GetStringWidth(fontId, gItemsInfo[item].name, 0), widthPx); + break; + } +} + +TEST("Item names fit on Pokemon Summary Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 72; + u32 item = ITEM_NONE; + for (i = 1; i < ITEMS_COUNT; i++) + { + if (gItemsInfo[i].importance) continue; + PARAMETRIZE_LABEL("%S", gItemsInfo[i].name) { item = i; } + } + // All items explicitly listed here are too big to fit. + switch (item) + { + case ITEM_UNREMARKABLE_TEACUP: + EXPECT_GT(GetStringWidth(fontId, gItemsInfo[item].name, 0), widthPx); + break; + default: + EXPECT_LE(GetStringWidth(fontId, gItemsInfo[item].name, 0), widthPx); + break; + } +} + +TEST("Item names fit on Shop Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 84; + u32 item = ITEM_NONE; + for (i = 1; i < ITEMS_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gItemsInfo[i].name) { item = i; } + } + EXPECT_LE(GetStringWidth(fontId, gItemsInfo[item].name, 0), widthPx); +} From 2ec35549a57b5621a3716d29e7cb719ddc80e5d5 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Fri, 29 Mar 2024 17:43:17 +0000 Subject: [PATCH 08/13] VANILLA_POKEMON_NAME_LENGTH --- include/constants/global.h | 1 + include/daycare.h | 2 +- include/global.h | 8 ++++---- include/global.tv.h | 10 +++++----- include/pokemon.h | 1 + src/battle_tower.c | 2 +- src/contest.c | 4 ++-- src/daycare.c | 8 ++++---- src/egg_hatch.c | 9 +++++---- src/hall_of_fame.c | 4 ++-- src/pokemon.c | 22 ++++++++++++++++------ src/tv.c | 8 ++++---- 12 files changed, 46 insertions(+), 33 deletions(-) diff --git a/include/constants/global.h b/include/constants/global.h index 5118beb18956..80378f893a9e 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -105,6 +105,7 @@ #define ITEM_NAME_LENGTH ((I_EXPANDED_ITEM_NAMES == TRUE) ? 20 : 14) #define ITEM_NAME_PLURAL_LENGTH ITEM_NAME_LENGTH + 2 // 2 is used for the instance where a word's suffix becomes y->ies #define POKEMON_NAME_LENGTH 10 +#define VANILLA_POKEMON_NAME_LENGTH 10 #define POKEMON_NAME_BUFFER_SIZE max(20, POKEMON_NAME_LENGTH + 1) // Frequently used buffer size. Larger than necessary #define PLAYER_NAME_LENGTH 7 #define MAIL_WORDS_COUNT 9 diff --git a/include/daycare.h b/include/daycare.h index daea812bedd9..2747a66850bc 100644 --- a/include/daycare.h +++ b/include/daycare.h @@ -10,7 +10,7 @@ struct RecordMixingDaycareMail bool16 cantHoldItem[DAYCARE_MON_COUNT]; }; -u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest); +u8 *GetMonNicknameVanilla(struct Pokemon *mon, u8 *dest); u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest); u8 CountPokemonInDaycare(struct DayCare *daycare); void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *mixMail); diff --git a/include/global.h b/include/global.h index 83bff49c0c95..cbafe29596dc 100644 --- a/include/global.h +++ b/include/global.h @@ -285,7 +285,7 @@ struct BattleTowerPokemon u32 gap:1; u32 abilityNum:1; u32 personality; - u8 nickname[POKEMON_NAME_LENGTH + 1]; + u8 nickname[VANILLA_POKEMON_NAME_LENGTH + 1]; u8 friendship; }; @@ -310,7 +310,7 @@ struct BattleTowerInterview u16 playerSpecies; u16 opponentSpecies; u8 opponentName[PLAYER_NAME_LENGTH + 1]; - u8 opponentMonNickname[POKEMON_NAME_LENGTH + 1]; + u8 opponentMonNickname[VANILLA_POKEMON_NAME_LENGTH + 1]; u8 opponentLanguage; }; @@ -744,7 +744,7 @@ struct ContestWinner u32 trainerId; u16 species; u8 contestCategory; - u8 monName[POKEMON_NAME_LENGTH + 1]; + u8 monName[VANILLA_POKEMON_NAME_LENGTH + 1]; u8 trainerName[PLAYER_NAME_LENGTH + 1]; u8 contestRank:7; bool8 isShiny:1; @@ -764,7 +764,7 @@ struct DaycareMail { struct Mail message; u8 otName[PLAYER_NAME_LENGTH + 1]; - u8 monName[POKEMON_NAME_LENGTH + 1]; + u8 monName[VANILLA_POKEMON_NAME_LENGTH + 1]; u8 gameLanguage:4; u8 monLanguage:4; }; diff --git a/include/global.tv.h b/include/global.tv.h index 9c3902e7cca4..6bc6d08f86f3 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -82,7 +82,7 @@ typedef union // size = 0x24 /*0x00*/ u8 kind; /*0x01*/ bool8 active; /*0x02*/ u16 species; - /*0x04*/ u8 pokemonName[POKEMON_NAME_LENGTH + 1]; + /*0x04*/ u8 pokemonName[VANILLA_POKEMON_NAME_LENGTH + 1]; /*0x0F*/ u8 trainerName[PLAYER_NAME_LENGTH + 1]; /*0x17*/ u8 unused[3]; /*0x1A*/ u8 random; @@ -98,7 +98,7 @@ typedef union // size = 0x24 /*0x01*/ bool8 active; /*0x02*/ u16 species; /*0x04*/ u16 words[2]; - /*0x08*/ u8 pokemonNickname[POKEMON_NAME_LENGTH + 1]; + /*0x08*/ u8 pokemonNickname[VANILLA_POKEMON_NAME_LENGTH + 1]; /*0x13*/ u8 contestCategory:3; u8 contestRank:2; u8 contestResult:2; @@ -196,7 +196,7 @@ typedef union // size = 0x24 /*0x01*/ bool8 active; /*0x02*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x0A*/ u8 contestCategory; - /*0x0B*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; + /*0x0B*/ u8 nickname[VANILLA_POKEMON_NAME_LENGTH + 1]; /*0x16*/ u8 pokeblockState; /*0x17*/ u8 language; /*0x18*/ u8 pokemonNameLanguage; @@ -209,7 +209,7 @@ typedef union // size = 0x24 /*0x01*/ bool8 active; /*0x02*/ u8 language; /*0x03*/ u8 language2; - /*0x04*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; + /*0x04*/ u8 nickname[VANILLA_POKEMON_NAME_LENGTH + 1]; /*0x0F*/ u8 ball; /*0x10*/ u16 species; /*0x12*/ u8 nBallsUsed; @@ -409,7 +409,7 @@ typedef union // size = 0x24 /*0x01*/ bool8 active; /*0x02*/ u8 nRibbons; /*0x03*/ u8 selectedRibbon; - /*0x04*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; + /*0x04*/ u8 nickname[VANILLA_POKEMON_NAME_LENGTH + 1]; /*0x0F*/ u8 language; /*0x10*/ u8 pokemonNameLanguage; /*0x11*/ u8 filler_12[2]; diff --git a/include/pokemon.h b/include/pokemon.h index d37e5f4ae946..1f7003fe3919 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -28,6 +28,7 @@ enum { MON_DATA_HP_LOST, MON_DATA_ENCRYPT_SEPARATOR, MON_DATA_NICKNAME, + MON_DATA_NICKNAME10, MON_DATA_SPECIES, MON_DATA_HELD_ITEM, MON_DATA_MOVE1, diff --git a/src/battle_tower.c b/src/battle_tower.c index 59e9a8aeaf96..7cd319b11323 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -2684,7 +2684,7 @@ static void SetTowerInterviewData(void) GetBattleTowerTrainerLanguage(&gSaveBlock2Ptr->frontier.towerInterview.opponentLanguage, gTrainerBattleOpponent_A); gSaveBlock2Ptr->frontier.towerInterview.opponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[1]], MON_DATA_SPECIES, NULL); gSaveBlock2Ptr->frontier.towerInterview.playerSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[0]], MON_DATA_SPECIES, NULL); - for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++) + for (i = 0; i < VANILLA_POKEMON_NAME_LENGTH + 1; i++) gSaveBlock2Ptr->frontier.towerInterview.opponentMonNickname[i] = gBattleMons[0].nickname[i]; gSaveBlock2Ptr->frontier.towerBattleOutcome = gBattleOutcome; } diff --git a/src/contest.c b/src/contest.c index c500fda60dec..4a2e4e66c4ed 100644 --- a/src/contest.c +++ b/src/contest.c @@ -5648,7 +5648,7 @@ bool8 SaveContestWinner(u8 rank) gSaveBlock1Ptr->contestWinners[id].personality = gContestMons[i].personality; gSaveBlock1Ptr->contestWinners[id].species = gContestMons[i].species; gSaveBlock1Ptr->contestWinners[id].trainerId = gContestMons[i].otId; - StringCopy(gSaveBlock1Ptr->contestWinners[id].monName, gContestMons[i].nickname); + StringCopyN(gSaveBlock1Ptr->contestWinners[id].monName, gContestMons[i].nickname, VANILLA_POKEMON_NAME_LENGTH); StringCopy(gSaveBlock1Ptr->contestWinners[id].trainerName, gContestMons[i].trainerName); if(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) gSaveBlock1Ptr->contestWinners[id].contestRank = CONTEST_RANK_LINK; @@ -5667,7 +5667,7 @@ bool8 SaveContestWinner(u8 rank) gCurContestWinner.isShiny = gContestMons[i].isShiny; gCurContestWinner.trainerId = gContestMons[i].otId; gCurContestWinner.species = gContestMons[i].species; - StringCopy(gCurContestWinner.monName, gContestMons[i].nickname); + StringCopyN(gCurContestWinner.monName, gContestMons[i].nickname, VANILLA_POKEMON_NAME_LENGTH); StringCopy(gCurContestWinner.trainerName, gContestMons[i].trainerName); gCurContestWinner.contestCategory = captionId; } diff --git a/src/daycare.c b/src/daycare.c index 537311f99dd6..8f4e9e7d534b 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -96,11 +96,11 @@ static const u8 *const sCompatibilityMessages[] = static const u8 sJapaneseEggNickname[] = _("タマゴ"); // "tamago" ("egg" in Japanese) -u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest) +u8 *GetMonNicknameVanilla(struct Pokemon *mon, u8 *dest) { u8 nickname[POKEMON_NAME_BUFFER_SIZE]; GetMonData(mon, MON_DATA_NICKNAME, nickname); - return StringCopy_Nickname(dest, nickname); + return StringCopyN(dest, nickname, VANILLA_POKEMON_NAME_LENGTH); } u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest) @@ -218,7 +218,7 @@ static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycar u8 mailId; StringCopy(daycareMon->mail.otName, gSaveBlock2Ptr->playerName); - GetMonNickname2(mon, daycareMon->mail.monName); + GetMonNicknameVanilla(mon, daycareMon->mail.monName); StripExtCtrlCodes(daycareMon->mail.monName); daycareMon->mail.gameLanguage = GAME_LANGUAGE; daycareMon->mail.monLanguage = GetMonData(mon, MON_DATA_LANGUAGE); @@ -418,7 +418,7 @@ static void ClearDaycareMonMail(struct DaycareMail *mail) for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) mail->otName[i] = 0; - for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++) + for (i = 0; i < VANILLA_POKEMON_NAME_LENGTH + 1; i++) mail->monName[i] = 0; ClearMail(&mail->message); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 588563d5d200..beb6ba40c441 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -36,6 +36,7 @@ #include "data.h" #include "battle.h" // to get rid of later #include "constants/rgb.h" +#include "party_menu.h" #define GFXTAG_EGG 12345 #define GFXTAG_EGG_SHARD 23456 @@ -375,7 +376,7 @@ static void AddHatchedMonToParty(u8 id) GetSetPokedexFlag(species, FLAG_SET_SEEN); GetSetPokedexFlag(species, FLAG_SET_CAUGHT); - GetMonNickname2(mon, gStringVar1); + GetMonNickname(mon, gStringVar1); // A met level of 0 is interpreted on the summary screen as "hatched at" metLevel = 0; @@ -648,7 +649,7 @@ static void CB2_EggHatch(void) break; case 5: // "{mon} hatched from egg" message/fanfare - GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar1); + GetMonNickname(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_HatchedFromEgg); EggHatchPrintMessage(sEggHatchData->windowId, gStringVar4, 0, 3, TEXT_SKIP_DRAW); PlayFanfare(MUS_EVOLVED); @@ -666,7 +667,7 @@ static void CB2_EggHatch(void) break; case 8: // Ready the nickname prompt - GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar1); + GetMonNickname(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_NicknameHatchPrompt); EggHatchPrintMessage(sEggHatchData->windowId, gStringVar4, 0, 2, 1); sEggHatchData->state++; @@ -685,7 +686,7 @@ static void CB2_EggHatch(void) switch (Menu_ProcessInputNoWrapClearOnChoose()) { case 0: // Yes - GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar3); + GetMonNickname(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar3); species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyId], MON_DATA_SPECIES); gender = GetMonGender(&gPlayerParty[sEggHatchData->eggPartyId]); personality = GetMonData(&gPlayerParty[sEggHatchData->eggPartyId], MON_DATA_PERSONALITY, 0); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 80689c264e46..2837931ea1a8 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_NICKNAME, nickname); - for (j = 0; j < POKEMON_NAME_LENGTH; j++) + GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME10, nickname); + for (j = 0; j < VANILLA_POKEMON_NAME_LENGTH; j++) sHofMonPtr->mon[i].nickname[j] = nickname[j]; gTasks[taskId].tMonNumber++; } diff --git a/src/pokemon.c b/src/pokemon.c index 521e54cbbd49..47544cdf4adf 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1348,7 +1348,7 @@ void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerP dest->spDefenseIV = GetMonData(mon, MON_DATA_SPDEF_IV, NULL); dest->abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM, NULL); dest->personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); - GetMonData(mon, MON_DATA_NICKNAME, dest->nickname); + GetMonData(mon, MON_DATA_NICKNAME10, dest->nickname); } static void CreateEventMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId) @@ -2190,6 +2190,7 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data) switch (field) { case MON_DATA_NICKNAME: + case MON_DATA_NICKNAME10: { if (boxMon->isBadEgg) { @@ -2232,7 +2233,7 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data) // so if both are 0 we assume that this is a vanilla // Pokémon and replace them with EOS. This means that // two CHAR_SPACE at the end of a nickname are trimmed. - if (POKEMON_NAME_LENGTH >= 12) + if (field != MON_DATA_NICKNAME10 && POKEMON_NAME_LENGTH >= 12) { if (substruct0->nickname11 == 0 && substruct0->nickname12 == 0) { @@ -2727,14 +2728,23 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) switch (field) { case MON_DATA_NICKNAME: + case MON_DATA_NICKNAME10: { s32 i; for (i = 0; i < min(sizeof(boxMon->nickname), POKEMON_NAME_LENGTH); i++) boxMon->nickname[i] = data[i]; - if (POKEMON_NAME_LENGTH >= 11) - substruct0->nickname11 = data[10]; - if (POKEMON_NAME_LENGTH >= 12) - substruct0->nickname12 = data[11]; + if (field != MON_DATA_NICKNAME10) + { + if (POKEMON_NAME_LENGTH >= 11) + substruct0->nickname11 = data[10]; + if (POKEMON_NAME_LENGTH >= 12) + substruct0->nickname12 = data[11]; + } + else + { + substruct0->nickname11 = EOS; + substruct0->nickname12 = EOS; + } break; } case MON_DATA_SPECIES: diff --git a/src/tv.c b/src/tv.c index 215af04dced4..5530e519f62f 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1455,7 +1455,7 @@ void BravoTrainerPokemonProfile_BeforeInterview2(u8 contestStandingPlace) show->bravoTrainer.contestCategory = gSpecialVar_ContestCategory; show->bravoTrainer.contestRank = gSpecialVar_ContestRank; show->bravoTrainer.species = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES, NULL); - GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_NICKNAME, show->bravoTrainer.pokemonNickname); + GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_NICKNAME10, show->bravoTrainer.pokemonNickname); StripExtCtrlCodes(show->bravoTrainer.pokemonNickname); show->bravoTrainer.pokemonNameLanguage = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_LANGUAGE); } @@ -1536,7 +1536,7 @@ void PutNameRaterShowOnTheAir(void) show->nameRaterShow.random2 = Random() % 2; show->nameRaterShow.randomSpecies = GetRandomDifferentSpeciesSeenByPlayer(show->nameRaterShow.species); StringCopy(show->nameRaterShow.trainerName, gSaveBlock2Ptr->playerName); - GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, show->nameRaterShow.pokemonName); + GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME10, show->nameRaterShow.pokemonName); StripExtCtrlCodes(show->nameRaterShow.pokemonName); StorePlayerIdInNormalShow(show); show->nameRaterShow.language = gGameLanguage; @@ -1612,7 +1612,7 @@ static void InterviewAfter_PkmnFanClubOpinions(void) show->fanclubOpinions.friendshipHighNybble = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_FRIENDSHIP, NULL) >> 4; show->fanclubOpinions.questionAsked = gSpecialVar_0x8007; StringCopy(show->fanclubOpinions.playerName, gSaveBlock2Ptr->playerName); - GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME, show->fanclubOpinions.nickname); + GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME10, show->fanclubOpinions.nickname); StripExtCtrlCodes(show->fanclubOpinions.nickname); show->fanclubOpinions.species = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL); StorePlayerIdInNormalShow(show); @@ -2229,7 +2229,7 @@ void TryPutSpotTheCutiesOnAir(struct Pokemon *pokemon, u8 ribbonMonDataIdx) show->cuties.kind = TVSHOW_CUTIES; show->cuties.active = FALSE; // NOTE: Show is not active until passed via Record Mix. StringCopy(show->cuties.playerName, gSaveBlock2Ptr->playerName); - GetMonData(pokemon, MON_DATA_NICKNAME, show->cuties.nickname); + GetMonData(pokemon, MON_DATA_NICKNAME10, show->cuties.nickname); StripExtCtrlCodes(show->cuties.nickname); show->cuties.nRibbons = GetRibbonCount(pokemon); show->cuties.selectedRibbon = MonDataIdxToRibbon(ribbonMonDataIdx); From 06d817bd1b0b3aa020426fa420406185940b8adf Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 6 Apr 2024 14:42:41 +0100 Subject: [PATCH 09/13] Expanded species names --- include/constants/global.h | 2 +- src/battle_interface.c | 23 +++-- src/contest.c | 2 +- src/data/pokemon/species_info.h | 6 ++ .../pokemon/species_info/gen_2_families.h | 6 +- .../pokemon/species_info/gen_5_families.h | 6 +- .../pokemon/species_info/gen_6_families.h | 4 +- .../pokemon/species_info/gen_7_families.h | 6 +- .../pokemon/species_info/gen_8_families.h | 16 ++-- .../pokemon/species_info/gen_9_families.h | 52 +++++----- src/party_menu.c | 7 +- src/pokedex.c | 17 +++- src/pokemon_storage_system.c | 8 +- src/pokemon_summary_screen.c | 17 ++-- test/battle/ability/booster_energy.c | 24 ++--- test/battle/ability/hospitality.c | 12 +-- test/battle/ability/mirror_armor.c | 14 +-- test/battle/ability/protosynthesis.c | 20 ++-- test/battle/gimmick/dynamax.c | 2 +- test/battle/move_effect/sticky_web.c | 12 +-- test/text.c | 94 +++++++++++++++++++ 21 files changed, 239 insertions(+), 111 deletions(-) diff --git a/include/constants/global.h b/include/constants/global.h index 80378f893a9e..4555f08f2198 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -104,7 +104,7 @@ // string lengths #define ITEM_NAME_LENGTH ((I_EXPANDED_ITEM_NAMES == TRUE) ? 20 : 14) #define ITEM_NAME_PLURAL_LENGTH ITEM_NAME_LENGTH + 2 // 2 is used for the instance where a word's suffix becomes y->ies -#define POKEMON_NAME_LENGTH 10 +#define POKEMON_NAME_LENGTH 12 #define VANILLA_POKEMON_NAME_LENGTH 10 #define POKEMON_NAME_BUFFER_SIZE max(20, POKEMON_NAME_LENGTH + 1) // Frequently used buffer size. Larger than necessary #define PLAYER_NAME_LENGTH 7 diff --git a/src/battle_interface.c b/src/battle_interface.c index 6637fa4c4e4c..df96fc1b170c 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -172,6 +172,7 @@ enum static const u8 *GetHealthboxElementGfxPtr(u8); static u8 *AddTextPrinterAndCreateWindowOnHealthbox(const u8 *, u32, u32, u32, u32 *); +static u8 *AddTextPrinterAndCreateWindowOnHealthboxToFit(const u8 *, u32, u32, u32, u32 *, u32); static void RemoveWindowOnHealthbox(u32 windowId); static void UpdateHpTextInHealthboxInDoubles(u32 healthboxSpriteId, u32 maxOrCurrent, s16 currHp, s16 maxHp); @@ -2296,24 +2297,21 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && StringCompare(nickname, GetSpeciesName(species)) == 0) gender = 100; - // AddTextPrinterAndCreateWindowOnHealthbox's arguments are the same in all 3 cases. - // It's possible they may have been different in early development phases. switch (gender) { default: StringCopy(ptr, gText_HealthboxGender_None); - windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gDisplayedStringBattle, 0, 3, 2, &windowId); break; case MON_MALE: StringCopy(ptr, gText_HealthboxGender_Male); - windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gDisplayedStringBattle, 0, 3, 2, &windowId); break; case MON_FEMALE: StringCopy(ptr, gText_HealthboxGender_Female); - windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gDisplayedStringBattle, 0, 3, 2, &windowId); break; } + windowTileData = AddTextPrinterAndCreateWindowOnHealthboxToFit(gDisplayedStringBattle, 0, 3, 2, &windowId, 54); + spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER) @@ -2906,7 +2904,7 @@ u8 GetHPBarLevel(s16 hp, s16 maxhp) return result; } -static u8 *AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId) +static u8 *AddTextPrinterAndCreateWindowOnHealthboxWithFont(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId, u32 fontId) { u16 winId; u8 color[3]; @@ -2919,12 +2917,23 @@ static u8 *AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, color[1] = 1; color[2] = 3; - AddTextPrinterParameterized4(winId, FONT_SMALL, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); + AddTextPrinterParameterized4(winId, fontId, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); *windowId = winId; return (u8 *)(GetWindowAttribute(winId, WINDOW_TILE_DATA)); } +static u8 *AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId) +{ + return AddTextPrinterAndCreateWindowOnHealthboxWithFont(str, x, y, bgColor, windowId, FONT_SMALL); +} + +static u8 *AddTextPrinterAndCreateWindowOnHealthboxToFit(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId, u32 width) +{ + u32 fontId = GetFontIdToFit(str, FONT_SMALL, 0, width); + return AddTextPrinterAndCreateWindowOnHealthboxWithFont(str, x, y, bgColor, windowId, fontId); +} + static void RemoveWindowOnHealthbox(u32 windowId) { RemoveWindow(windowId); diff --git a/src/contest.c b/src/contest.c index 4a2e4e66c4ed..c063b4a3b40d 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3139,7 +3139,7 @@ static void PrintContestantMonName(u8 contestant) static void PrintContestantMonNameWithColor(u8 contestant, u8 color) { Contest_CopyStringWithColor(gContestMons[contestant].nickname, color); - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, 5, 1, FONT_NARROW); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, 5, 1, GetFontIdToFit(gContestMons[contestant].nickname, FONT_NARROW, 0, 50)); } static u16 CalculateContestantRound1Points(u8 who, u8 contestCategory) diff --git a/src/data/pokemon/species_info.h b/src/data/pokemon/species_info.h index 63c5d752a88c..014996e8c3df 100644 --- a/src/data/pokemon/species_info.h +++ b/src/data/pokemon/species_info.h @@ -21,6 +21,12 @@ #define FLIP 0 #define NO_FLIP 1 +#if POKEMON_NAME_LENGTH >= 12 +#define HANDLE_EXPANDED_SPECIES_NAME(_name, ...) _(DEFAULT(_name, __VA_ARGS__)) +#else +#define HANDLE_EXPANDED_SPECIES_NAME(_name, ...) _(_name) +#endif + const struct SpeciesInfo gSpeciesInfo[] = { [SPECIES_NONE] = diff --git a/src/data/pokemon/species_info/gen_2_families.h b/src/data/pokemon/species_info/gen_2_families.h index 75fa9ac1e03f..fcc1e18cd77c 100644 --- a/src/data/pokemon/species_info/gen_2_families.h +++ b/src/data/pokemon/species_info/gen_2_families.h @@ -3407,7 +3407,7 @@ const struct SpeciesInfo gSpeciesInfoGen2[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FIELD), .abilities = { ABILITY_SERENE_GRACE, ABILITY_RUN_AWAY, ABILITY_RATTLED }, .bodyColor = BODY_COLOR_YELLOW, - .speciesName = _("Dudunsprce"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Dudunsprce", "Dudunsparce"), .cryId = CRY_DUDUNSPARCE, .natDexNum = NATIONAL_DEX_DUDUNSPARCE, .categoryName = _("Land Snake"), @@ -3460,7 +3460,7 @@ const struct SpeciesInfo gSpeciesInfoGen2[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FIELD), .abilities = { ABILITY_SERENE_GRACE, ABILITY_RUN_AWAY, ABILITY_RATTLED }, .bodyColor = BODY_COLOR_YELLOW, - .speciesName = _("Dudunsprce"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Dudunsprce", "Dudunsparce"), .cryId = CRY_DUDUNSPARCE, .natDexNum = NATIONAL_DEX_DUDUNSPARCE, .categoryName = _("Land Snake"), @@ -6460,4 +6460,4 @@ const struct SpeciesInfo gSpeciesInfoGen2[] = #ifdef __INTELLISENSE__ }; -#endif \ No newline at end of file +#endif diff --git a/src/data/pokemon/species_info/gen_5_families.h b/src/data/pokemon/species_info/gen_5_families.h index 4b1fea02634f..9f7200849bcc 100644 --- a/src/data/pokemon/species_info/gen_5_families.h +++ b/src/data/pokemon/species_info/gen_5_families.h @@ -3462,7 +3462,7 @@ const struct SpeciesInfo gSpeciesInfoGen5[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_WATER_2), .abilities = { ABILITY_SWIFT_SWIM, ABILITY_ADAPTABILITY, ABILITY_MOLD_BREAKER }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("Bsculegion"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Bsculegion", "Basculegion"), .cryId = CRY_BASCULEGION, .natDexNum = NATIONAL_DEX_BASCULEGION, .categoryName = _("Big Fish"), @@ -3516,7 +3516,7 @@ const struct SpeciesInfo gSpeciesInfoGen5[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_WATER_2), .abilities = { ABILITY_SWIFT_SWIM, ABILITY_ADAPTABILITY, ABILITY_MOLD_BREAKER }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("Bsculegion"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Bsculegion", "Basculegion"), .cryId = CRY_BASCULEGION, .natDexNum = NATIONAL_DEX_BASCULEGION, .categoryName = _("Big Fish"), @@ -10404,4 +10404,4 @@ const struct SpeciesInfo gSpeciesInfoGen5[] = #ifdef __INTELLISENSE__ }; -#endif \ No newline at end of file +#endif diff --git a/src/data/pokemon/species_info/gen_6_families.h b/src/data/pokemon/species_info/gen_6_families.h index ce1f1da228d6..d49628cb0c4d 100644 --- a/src/data/pokemon/species_info/gen_6_families.h +++ b/src/data/pokemon/species_info/gen_6_families.h @@ -767,7 +767,7 @@ const struct SpeciesInfo gSpeciesInfoGen6[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FLYING), .abilities = { ABILITY_FLAME_BODY, ABILITY_NONE, ABILITY_GALE_WINGS }, .bodyColor = BODY_COLOR_RED, - .speciesName = _("Flechinder"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Flechinder", "Fletchinder"), .cryId = CRY_FLETCHINDER, .natDexNum = NATIONAL_DEX_FLETCHINDER, .categoryName = _("Ember"), @@ -5343,4 +5343,4 @@ const struct SpeciesInfo gSpeciesInfoGen6[] = #ifdef __INTELLISENSE__ }; -#endif \ No newline at end of file +#endif diff --git a/src/data/pokemon/species_info/gen_7_families.h b/src/data/pokemon/species_info/gen_7_families.h index da640ca852e9..36a1133190bc 100644 --- a/src/data/pokemon/species_info/gen_7_families.h +++ b/src/data/pokemon/species_info/gen_7_families.h @@ -1150,7 +1150,7 @@ const struct SpeciesInfo gSpeciesInfoGen7[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_WATER_3), .abilities = { ABILITY_HYPER_CUTTER, ABILITY_IRON_FIST, ABILITY_ANGER_POINT }, .bodyColor = BODY_COLOR_WHITE, - .speciesName = _("Crabminabl"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Crabminabl", "Crabominable"), .cryId = CRY_CRABOMINABLE, .natDexNum = NATIONAL_DEX_CRABOMINABLE, .categoryName = _("Woolly Crab"), @@ -5904,7 +5904,7 @@ const struct SpeciesInfo gSpeciesInfoGen7[] = .abilities = { ABILITY_BEAST_BOOST, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_WHITE, .noFlip = TRUE, - .speciesName = _("Blacephaln"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Blacephaln", "Blacephalon"), .cryId = CRY_BLACEPHALON, .natDexNum = NATIONAL_DEX_BLACEPHALON, .categoryName = _("Fireworks"), @@ -6160,4 +6160,4 @@ const struct SpeciesInfo gSpeciesInfoGen7[] = #ifdef __INTELLISENSE__ }; -#endif \ No newline at end of file +#endif diff --git a/src/data/pokemon/species_info/gen_8_families.h b/src/data/pokemon/species_info/gen_8_families.h index bb9ff9c0872c..65c5659f7b3c 100644 --- a/src/data/pokemon/species_info/gen_8_families.h +++ b/src/data/pokemon/species_info/gen_8_families.h @@ -837,7 +837,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FLYING), .abilities = { ABILITY_KEEN_EYE, ABILITY_UNNERVE, ABILITY_BIG_PECKS }, .bodyColor = BODY_COLOR_BLUE, - .speciesName = _("Corvisquir"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Corvisquir", "Corvisquire"), .cryId = CRY_CORVISQUIRE, .natDexNum = NATIONAL_DEX_CORVISQUIRE, .categoryName = _("Raven"), @@ -891,7 +891,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FLYING), .abilities = { ABILITY_PRESSURE, ABILITY_UNNERVE, ABILITY_MIRROR_ARMOR }, .bodyColor = BODY_COLOR_PURPLE, - .speciesName = _("Corviknigh"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Corviknigh", "Corviknight"), .cryId = CRY_CORVIKNIGHT, .natDexNum = NATIONAL_DEX_CORVIKNIGHT, .categoryName = _("Raven"), @@ -2803,7 +2803,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_WATER_2), .abilities = { ABILITY_SWIFT_SWIM, ABILITY_NONE, ABILITY_PROPELLER_TAIL }, .bodyColor = BODY_COLOR_BROWN, - .speciesName = _("Barraskewd"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Barraskewd", "Barraskewda"), .cryId = CRY_BARRASKEWDA, .natDexNum = NATIONAL_DEX_BARRASKEWDA, .categoryName = _("Skewer"), @@ -3178,7 +3178,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_BUG), .abilities = { ABILITY_FLASH_FIRE, ABILITY_WHITE_SMOKE, ABILITY_FLAME_BODY }, .bodyColor = BODY_COLOR_RED, - .speciesName = _("Centiskorc"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Centiskorc", "Centiskorch"), .cryId = CRY_CENTISKORCH, .natDexNum = NATIONAL_DEX_CENTISKORCH, .categoryName = _("Radiator"), @@ -3506,7 +3506,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_MINERAL, EGG_GROUP_AMORPHOUS), .abilities = { ABILITY_WEAK_ARMOR, ABILITY_NONE, ABILITY_CURSED_BODY }, .bodyColor = BODY_COLOR_PURPLE, - .speciesName = _("Polteageis"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Polteageis", "Polteageist"), .cryId = CRY_POLTEAGEIST, .natDexNum = NATIONAL_DEX_POLTEAGEIST, .categoryName = _("Black Tea"), @@ -3559,7 +3559,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_MINERAL, EGG_GROUP_AMORPHOUS), .abilities = { ABILITY_WEAK_ARMOR, ABILITY_NONE, ABILITY_CURSED_BODY }, .bodyColor = BODY_COLOR_PURPLE, - .speciesName = _("Polteageis"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Polteageis", "Polteageist"), .cryId = CRY_POLTEAGEIST, .natDexNum = NATIONAL_DEX_POLTEAGEIST, .categoryName = _("Black Tea"), @@ -4486,7 +4486,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_MINERAL), .abilities = { ABILITY_POWER_SPOT, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_GRAY, - .speciesName = _("Stonjourne"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Stonjourne", "Stonjourner"), .cryId = CRY_STONJOURNER, .natDexNum = NATIONAL_DEX_STONJOURNER, .categoryName = _("Big Rock"), @@ -6789,4 +6789,4 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = #ifdef __INTELLISENSE__ }; -#endif \ No newline at end of file +#endif diff --git a/src/data/pokemon/species_info/gen_9_families.h b/src/data/pokemon/species_info/gen_9_families.h index 304f0560a20b..b334c5911085 100644 --- a/src/data/pokemon/species_info/gen_9_families.h +++ b/src/data/pokemon/species_info/gen_9_families.h @@ -129,7 +129,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FIELD, EGG_GROUP_GRASS), .abilities = { ABILITY_OVERGROW, ABILITY_NONE, ABILITY_PROTEAN }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("Meowscarad"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Meowscarad", "Meowscarada"), .cryId = CRY_MEOWSCARADA, .natDexNum = NATIONAL_DEX_MEOWSCARADA, .categoryName = _("Magician"), @@ -1466,7 +1466,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FLYING), .abilities = { ABILITY_INTIMIDATE, ABILITY_HUSTLE, ABILITY_GUTS }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("Sqawkabily"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Sqawkabily", "Squawkabilly"), .cryId = CRY_SQUAWKABILLY, .natDexNum = NATIONAL_DEX_SQUAWKABILLY, .categoryName = _("Parrot"), @@ -1519,7 +1519,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FLYING), .abilities = { ABILITY_INTIMIDATE, ABILITY_HUSTLE, ABILITY_GUTS }, .bodyColor = BODY_COLOR_BLUE, - .speciesName = _("Sqawkabily"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Sqawkabily", "Squawkabilly"), .cryId = CRY_SQUAWKABILLY, .natDexNum = NATIONAL_DEX_SQUAWKABILLY, .categoryName = _("Parrot"), @@ -1572,7 +1572,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FLYING), .abilities = { ABILITY_INTIMIDATE, ABILITY_HUSTLE, ABILITY_SHEER_FORCE }, .bodyColor = BODY_COLOR_YELLOW, - .speciesName = _("Sqawkabily"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Sqawkabily", "Squawkabilly"), .cryId = CRY_SQUAWKABILLY, .natDexNum = NATIONAL_DEX_SQUAWKABILLY, .categoryName = _("Parrot"), @@ -1625,7 +1625,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_FLYING), .abilities = { ABILITY_INTIMIDATE, ABILITY_HUSTLE, ABILITY_SHEER_FORCE }, .bodyColor = BODY_COLOR_WHITE, - .speciesName = _("Sqawkabily"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Sqawkabily", "Squawkabilly"), .cryId = CRY_SQUAWKABILLY, .natDexNum = NATIONAL_DEX_SQUAWKABILLY, .categoryName = _("Parrot"), @@ -2161,7 +2161,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_WATER_1, EGG_GROUP_FLYING), .abilities = { ABILITY_WIND_POWER, ABILITY_VOLT_ABSORB, ABILITY_COMPETITIVE }, .bodyColor = BODY_COLOR_YELLOW, - .speciesName = _("Kilowatrel"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Kilowatrel", "Kilowattrel"), .cryId = CRY_KILOWATTREL, .natDexNum = NATIONAL_DEX_KILOWATTREL, .categoryName = _("Frigatebird"), @@ -2482,7 +2482,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_GRASS), .abilities = { ABILITY_WIND_RIDER, ABILITY_NONE, ABILITY_INFILTRATOR }, .bodyColor = BODY_COLOR_BROWN, - .speciesName = _("Brmblghast"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Brmblghast", "Brambleghast"), .cryId = CRY_BRAMBLEGHAST, .natDexNum = NATIONAL_DEX_BRAMBLEGHAST, .categoryName = _("Tumbleweed"), @@ -4416,7 +4416,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_PINK, - .speciesName = _("ScreamTail"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("ScreamTail", "Scream Tail"), .cryId = CRY_SCREAM_TAIL, .natDexNum = NATIONAL_DEX_SCREAM_TAIL, .categoryName = _("Paradox"), @@ -4471,7 +4471,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_WHITE, - .speciesName = _("BruteBonet"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("BruteBonet", "Brute Bonnet"), .cryId = CRY_BRUTE_BONNET, .natDexNum = NATIONAL_DEX_BRUTE_BONNET, .categoryName = _("Paradox"), @@ -4528,7 +4528,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_GRAY, - .speciesName = _("FluttrMane"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("FluttrMane", "Flutter Mane"), .cryId = CRY_FLUTTER_MANE, .natDexNum = NATIONAL_DEX_FLUTTER_MANE, .categoryName = _("Paradox"), @@ -4584,7 +4584,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_WHITE, - .speciesName = _("SlithrWing"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("SlithrWing", "Slither Wing"), .cryId = CRY_SLITHER_WING, .natDexNum = NATIONAL_DEX_SLITHER_WING, .categoryName = _("Paradox"), @@ -4638,7 +4638,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_GRAY, - .speciesName = _("SndyShocks"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("SndyShocks", "Sandy Shocks"), .cryId = CRY_SANDY_SHOCKS, .natDexNum = NATIONAL_DEX_SANDY_SHOCKS, .categoryName = _("Paradox"), @@ -4693,7 +4693,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_QUARK_DRIVE, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_GRAY, - .speciesName = _("IronTreads"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("IronTreads", "Iron Treads"), .cryId = CRY_IRON_TREADS, .natDexNum = NATIONAL_DEX_IRON_TREADS, .categoryName = _("Paradox"), @@ -4748,7 +4748,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_QUARK_DRIVE, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_RED, - .speciesName = _("IronBundle"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("IronBundle", "Iron Bundle"), .cryId = CRY_IRON_BUNDLE, .natDexNum = NATIONAL_DEX_IRON_BUNDLE, .categoryName = _("Paradox"), @@ -4858,7 +4858,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_QUARK_DRIVE, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_BLUE, - .speciesName = _("IronJuguls"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("IronJuguls", "Iron Jugulis"), .cryId = CRY_IRON_JUGULIS, .natDexNum = NATIONAL_DEX_IRON_JUGULIS, .categoryName = _("Paradox"), @@ -4970,7 +4970,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_QUARK_DRIVE, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("IronThorns"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("IronThorns", "Iron Thorns"), .cryId = CRY_IRON_THORNS, .natDexNum = NATIONAL_DEX_IRON_THORNS, .categoryName = _("Paradox"), @@ -5568,7 +5568,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_BLUE, - .speciesName = _("RoarngMoon"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("RoarngMoon", "Roaring Moon"), .cryId = CRY_ROARING_MOON, .natDexNum = NATIONAL_DEX_ROARING_MOON, .categoryName = _("Paradox"), @@ -5624,7 +5624,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_QUARK_DRIVE, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_WHITE, - .speciesName = _("IronVliant"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("IronVliant", "Iron Valiant"), .cryId = CRY_IRON_VALIANT, .natDexNum = NATIONAL_DEX_IRON_VALIANT, .categoryName = _("Paradox"), @@ -5788,7 +5788,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_BLUE, - .speciesName = _("WalkngWake"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("WalkngWake", "Walking Wake"), .cryId = CRY_WALKING_WAKE, .natDexNum = NATIONAL_DEX_WALKING_WAKE, .categoryName = _("Paradox"), @@ -5842,7 +5842,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_QUARK_DRIVE, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("IronLeaves"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("IronLeaves", "Iron Leaves"), .cryId = CRY_IRON_LEAVES, .natDexNum = NATIONAL_DEX_IRON_LEAVES, .categoryName = _("Paradox"), @@ -5896,7 +5896,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_MINERAL, EGG_GROUP_AMORPHOUS), .abilities = { ABILITY_HOSPITALITY, ABILITY_NONE, ABILITY_HEATPROOF }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("Ptchageist"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Ptchageist", "Poltchageist"), .cryId = CRY_POLTCHAGEIST, .natDexNum = NATIONAL_DEX_POLTCHAGEIST, .categoryName = _("Matcha"), @@ -5949,7 +5949,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_MINERAL, EGG_GROUP_AMORPHOUS), .abilities = { ABILITY_HOSPITALITY, ABILITY_NONE, ABILITY_HEATPROOF }, .bodyColor = BODY_COLOR_GREEN, - .speciesName = _("Ptchageist"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Ptchageist", "Poltchageist"), .cryId = CRY_POLTCHAGEIST, .natDexNum = NATIONAL_DEX_POLTCHAGEIST, .categoryName = _("Matcha"), @@ -6220,7 +6220,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_TOXIC_CHAIN, ABILITY_NONE, ABILITY_TECHNICIAN }, .bodyColor = BODY_COLOR_BLACK, - .speciesName = _("Fezndipiti"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("Fezndipiti", "Fezandipiti"), .cryId = CRY_FEZANDIPITI, .natDexNum = NATIONAL_DEX_FEZANDIPITI, .categoryName = _("Retainer"), @@ -6340,7 +6340,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_BROWN, - .speciesName = _("GouginFire"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("GouginFire", "Gouging Fire"), .cryId = CRY_GOUGING_FIRE, .natDexNum = NATIONAL_DEX_GOUGING_FIRE, .categoryName = _("Paradox"), @@ -6395,7 +6395,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_PROTOSYNTHESIS, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_YELLOW, - .speciesName = _("RagingBolt"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("RagingBolt", "Raging Bolt"), .cryId = CRY_RAGING_BOLT, .natDexNum = NATIONAL_DEX_RAGING_BOLT, .categoryName = _("Paradox"), @@ -6450,7 +6450,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .eggGroups = MON_EGG_GROUPS(EGG_GROUP_NO_EGGS_DISCOVERED), .abilities = { ABILITY_QUARK_DRIVE, ABILITY_NONE, ABILITY_NONE }, .bodyColor = BODY_COLOR_GRAY, - .speciesName = _("IronBouldr"), + .speciesName = HANDLE_EXPANDED_SPECIES_NAME("IronBouldr", "Iron Boulder"), .cryId = CRY_IRON_BOULDER, .natDexNum = NATIONAL_DEX_IRON_BOULDER, .categoryName = _("Paradox"), diff --git a/src/party_menu.c b/src/party_menu.c index fc0a66c5a6bf..af88db790dd1 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2435,6 +2435,11 @@ static void DisplayPartyPokemonBarDetail(u8 windowId, const u8 *str, u8 color, c AddTextPrinterParameterized3(windowId, FONT_SMALL, align[0], align[1], sFontColorTable[color], 0, str); } +static void DisplayPartyPokemonBarDetailToFit(u8 windowId, const u8 *str, u8 color, const u8 *align, u32 width) +{ + AddTextPrinterParameterized3(windowId, GetFontIdToFit(str, FONT_SMALL, 0, width), align[0], align[1], sFontColorTable[color], 0, str); +} + static void DisplayPartyPokemonNickname(struct Pokemon *mon, struct PartyMenuBox *menuBox, u8 c) { u8 nickname[POKEMON_NAME_LENGTH + 1]; @@ -2444,7 +2449,7 @@ static void DisplayPartyPokemonNickname(struct Pokemon *mon, struct PartyMenuBox if (c == 1) menuBox->infoRects->blitFunc(menuBox->windowId, menuBox->infoRects->dimensions[0] >> 3, menuBox->infoRects->dimensions[1] >> 3, menuBox->infoRects->dimensions[2] >> 3, menuBox->infoRects->dimensions[3] >> 3, FALSE); GetMonNickname(mon, nickname); - DisplayPartyPokemonBarDetail(menuBox->windowId, nickname, 0, menuBox->infoRects->dimensions); + DisplayPartyPokemonBarDetailToFit(menuBox->windowId, nickname, 0, menuBox->infoRects->dimensions, 50); } } diff --git a/src/pokedex.c b/src/pokedex.c index 02738980dd2c..0eb99d701e27 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2337,7 +2337,7 @@ static void CreatePokedexList(u8 dexMode, u8 order) } } -static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top) +static void PrintMonDexNum(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top) { u8 color[3]; @@ -2347,6 +2347,17 @@ static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8 *str, u8 left 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; + fontId = GetFontIdToFit(str, fontId, 0, 50); + AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, TEXT_SKIP_DRAW, str); +} + // u16 ignored is passed but never used static void CreateMonListEntry(u8 position, u16 b, u16 ignored) { @@ -2453,7 +2464,7 @@ static void CreateMonDexNum(u16 entryNum, u8 left, u8 top, u16 unused) text[offset++] = CHAR_0 + ((dexNum % 1000) % 100) / 10; text[offset++] = CHAR_0 + ((dexNum % 1000) % 100) % 10; text[offset++] = EOS; - PrintMonDexNumAndName(0, FONT_NARROW, text, left, top); + PrintMonDexNum(0, FONT_NARROW, text, left, top); } static void CreateCaughtBall(bool16 owned, u8 x, u8 y, u16 unused) @@ -2473,7 +2484,7 @@ static u8 CreateMonName(u16 num, u8 left, u8 top) str = GetSpeciesName(num); else str = sText_TenDashes; - PrintMonDexNumAndName(0, FONT_NARROW, str, left, top); + PrintMonName(0, FONT_NARROW, str, left, top); return StringLength(str); } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index a079a10c24e2..b60dfb7daf8b 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, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL); - AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL); + 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, 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, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL); - AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 28, 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, 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 1989913fc242..5132218931a6 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2813,12 +2813,17 @@ static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 line PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, FONT_NORMAL); } -static void PrintTextOnWindowToFit(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +static void PrintTextOnWindowToFitPx(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 width) { - u32 fontId = GetFontIdToFit(string, FONT_NORMAL, 0, WindowWidthPx(windowId)); + u32 fontId = GetFontIdToFit(string, FONT_NORMAL, 0, width); PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, fontId); } +static void PrintTextOnWindowToFit(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +{ + PrintTextOnWindowToFitPx(windowId, string, x, y, lineSpacing, colorId, WindowWidthPx(windowId)); +} + static void PrintMonInfo(void) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER, PIXEL_FILL(0)); @@ -2833,7 +2838,6 @@ static void PrintMonInfo(void) static void PrintNotEggInfo(void) { - u8 strArray[16]; struct Pokemon *mon = &sMonSummaryScreen->currentMon; struct PokeSummary *summary = &sMonSummaryScreen->summary; u16 dexNum = SpeciesToPokedexNum(summary->species); @@ -2869,10 +2873,9 @@ static void PrintNotEggInfo(void) StringAppend(gStringVar1, gStringVar2); PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, gStringVar1, 24, 17, 0, 1); GetMonNickname(mon, gStringVar1); - PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME, gStringVar1, 0, 1, 0, 1); - strArray[0] = CHAR_SLASH; - StringCopy(&strArray[1], &GetSpeciesName(summary->species2)[0]); - PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, strArray, 0, 1, 0, 1); + PrintTextOnWindowToFitPx(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME, gStringVar1, 0, 1, 0, 1, 63); + 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); PrintGenderSymbol(mon, summary->species2); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); diff --git a/test/battle/ability/booster_energy.c b/test/battle/ability/booster_energy.c index 6d0865978185..3d9b41d5aab0 100644 --- a/test/battle/ability/booster_energy.c +++ b/test/battle/ability/booster_energy.c @@ -50,17 +50,17 @@ SINGLE_BATTLE_TEST("Booster Energy will activate Protosynthesis after harsh sunl ABILITY_POPUP(opponent, ABILITY_DROUGHT); NONE_OF { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); - MESSAGE("RagingBolt used its Booster Energy to activate Protosynthesis!"); - MESSAGE("RagingBolt's Sp. Atk was heightened!"); + MESSAGE("Raging Bolt used its Booster Energy to activate Protosynthesis!"); + MESSAGE("Raging Bolt's Sp. Atk was heightened!"); } ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("The harsh sunlight activated RagingBolt's Protosynthesis!"); - MESSAGE("RagingBolt's Sp. Atk was heightened!"); + MESSAGE("The harsh sunlight activated Raging Bolt's Protosynthesis!"); + MESSAGE("Raging Bolt's Sp. Atk was heightened!"); MESSAGE("The sunlight faded."); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("RagingBolt used its Booster Energy to activate Protosynthesis!"); - MESSAGE("RagingBolt's Sp. Atk was heightened!"); + MESSAGE("Raging Bolt used its Booster Energy to activate Protosynthesis!"); + MESSAGE("Raging Bolt's Sp. Atk was heightened!"); } } @@ -82,17 +82,17 @@ SINGLE_BATTLE_TEST("Booster Energy activates Protosynthesis and increases highes } SCENE { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("RagingBolt used its Booster Energy to activate Protosynthesis!"); + MESSAGE("Raging Bolt used its Booster Energy to activate Protosynthesis!"); if (attack == 110) - MESSAGE("RagingBolt's Attack was heightened!"); + MESSAGE("Raging Bolt's Attack was heightened!"); else if (defense == 110) - MESSAGE("RagingBolt's Defense was heightened!"); + MESSAGE("Raging Bolt's Defense was heightened!"); else if (speed == 110) - MESSAGE("RagingBolt's Speed was heightened!"); + MESSAGE("Raging Bolt's Speed was heightened!"); else if (spAttack == 110) - MESSAGE("RagingBolt's Sp. Atk was heightened!"); + MESSAGE("Raging Bolt's Sp. Atk was heightened!"); else if (spDefense == 110) - MESSAGE("RagingBolt's Sp. Def was heightened!"); + MESSAGE("Raging Bolt's Sp. Def was heightened!"); } THEN { EXPECT(player->item == ITEM_NONE); } diff --git a/test/battle/ability/hospitality.c b/test/battle/ability/hospitality.c index 74648b0c9ae9..dc81faf7de1c 100644 --- a/test/battle/ability/hospitality.c +++ b/test/battle/ability/hospitality.c @@ -18,12 +18,12 @@ DOUBLE_BATTLE_TEST("Hospitality user restores 25% of ally's health") } SCENE { if (health == 75) { ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY); - MESSAGE("Wobbuffet drank down all the matcha that Ptchageist made!"); + MESSAGE("Wobbuffet drank down all the matcha that Poltchageist made!"); HP_BAR(playerRight, damage: -25); } else { NONE_OF { ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY); - MESSAGE("Wobbuffet drank down all the matcha that Ptchageist made!"); + MESSAGE("Wobbuffet drank down all the matcha that Poltchageist made!"); HP_BAR(playerRight, damage: -25); } } @@ -42,9 +42,9 @@ DOUBLE_BATTLE_TEST("Hospitality user restores 25% of ally's health on switch-in" TURN { SWITCH(playerLeft, 2); } } SCENE { MESSAGE("Wobbuffet, that's enough! Come back!"); - MESSAGE("Go! Ptchageist!"); + MESSAGE("Go! Poltchageist!"); ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY); - MESSAGE("Wobbuffet drank down all the matcha that Ptchageist made!"); + MESSAGE("Wobbuffet drank down all the matcha that Poltchageist made!"); HP_BAR(playerRight, damage: -25); } } @@ -63,8 +63,8 @@ DOUBLE_BATTLE_TEST("Hospitality ignores Substitute") } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, playerRight); MESSAGE("Wobbuffet, that's enough! Come back!"); - MESSAGE("Go! Ptchageist!"); + MESSAGE("Go! Poltchageist!"); ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY); - MESSAGE("Wobbuffet drank down all the matcha that Ptchageist made!"); + MESSAGE("Wobbuffet drank down all the matcha that Poltchageist made!"); } } diff --git a/test/battle/ability/mirror_armor.c b/test/battle/ability/mirror_armor.c index 38ee8dab91e8..39c22a66c56b 100644 --- a/test/battle/ability/mirror_armor.c +++ b/test/battle/ability/mirror_armor.c @@ -55,11 +55,11 @@ SINGLE_BATTLE_TEST("Mirror Armor triggers even if the attacking Pokemon also has } WHEN { TURN { MOVE(opponent, MOVE_LEER); } } SCENE { - MESSAGE("Foe Corviknigh used Leer!"); + MESSAGE("Foe Corviknight used Leer!"); ABILITY_POPUP(player, ABILITY_MIRROR_ARMOR); NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); - MESSAGE("Foe Corviknigh's Defense fell!"); + MESSAGE("Foe Corviknight's Defense fell!"); } THEN { EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE); EXPECT_EQ(opponent->statStages[STAT_DEF], DEFAULT_STAT_STAGE - 1); @@ -153,9 +153,9 @@ SINGLE_BATTLE_TEST("Mirror Armor doesn't lower the stat of the attacking Pokemon TURN { MOVE(player, MOVE_SCREECH); } TURN { MOVE(opponent, MOVE_LEER); } } SCENE { - MESSAGE("Corviknigh used Screech!"); - MESSAGE("Corviknigh used Screech!"); - MESSAGE("Corviknigh used Screech!"); + MESSAGE("Corviknight used Screech!"); + MESSAGE("Corviknight used Screech!"); + MESSAGE("Corviknight used Screech!"); MESSAGE("Foe Wynaut used Leer!"); ABILITY_POPUP(player, ABILITY_MIRROR_ARMOR); NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); @@ -188,8 +188,8 @@ DOUBLE_BATTLE_TEST("Mirror Armor lowers Speed of the partner Pokemon after Court MESSAGE("Wobbuffet used Sticky Web!"); MESSAGE("Foe Wynaut used Court Change!"); MESSAGE("Foe Wynaut swapped the battle effects affecting each side!"); - MESSAGE("Go! Corviknigh!"); - MESSAGE("Corviknigh was caught in a Sticky Web!"); + MESSAGE("Go! Corviknight!"); + MESSAGE("Corviknight was caught in a Sticky Web!"); ABILITY_POPUP(playerRight, ABILITY_MIRROR_ARMOR); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft); MESSAGE("Wobbuffet's Speed fell!"); diff --git a/test/battle/ability/protosynthesis.c b/test/battle/ability/protosynthesis.c index 264548c207f3..3cb35164ec7b 100644 --- a/test/battle/ability/protosynthesis.c +++ b/test/battle/ability/protosynthesis.c @@ -17,8 +17,8 @@ SINGLE_BATTLE_TEST("Protosynthesis boosts the highest stat") } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_SUNNY_DAY, player); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("The harsh sunlight activated WalkngWake's Protosynthesis!"); - MESSAGE("WalkngWake's Sp. Atk was heightened!"); + MESSAGE("The harsh sunlight activated Walking Wake's Protosynthesis!"); + MESSAGE("Walking Wake's Sp. Atk was heightened!"); } } @@ -68,19 +68,19 @@ SINGLE_BATTLE_TEST("Protosynthesis ability pop up activates only once during the } SCENE { ABILITY_POPUP(opponent, ABILITY_DROUGHT); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("The harsh sunlight activated WalkngWake's Protosynthesis!"); - MESSAGE("WalkngWake's Sp. Atk was heightened!"); + MESSAGE("The harsh sunlight activated Walking Wake's Protosynthesis!"); + MESSAGE("Walking Wake's Sp. Atk was heightened!"); NONE_OF { for (turns = 0; turns < 4; turns++) { ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("The harsh sunlight activated WalkngWake's Protosynthesis!"); - MESSAGE("WalkngWake's Sp. Atk was heightened!"); + MESSAGE("The harsh sunlight activated Walking Wake's Protosynthesis!"); + MESSAGE("Walking Wake's Sp. Atk was heightened!"); } } ANIMATION(ANIM_TYPE_MOVE, MOVE_SUNNY_DAY, opponent); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("The harsh sunlight activated WalkngWake's Protosynthesis!"); - MESSAGE("WalkngWake's Sp. Atk was heightened!"); + MESSAGE("The harsh sunlight activated Walking Wake's Protosynthesis!"); + MESSAGE("Walking Wake's Sp. Atk was heightened!"); } } @@ -95,7 +95,7 @@ SINGLE_BATTLE_TEST("Protosynthesis activates on switch-in") } SCENE { ABILITY_POPUP(opponent, ABILITY_DROUGHT); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("The harsh sunlight activated RoarngMoon's Protosynthesis!"); - MESSAGE("RoarngMoon's Attack was heightened!"); + MESSAGE("The harsh sunlight activated Roaring Moon's Protosynthesis!"); + MESSAGE("Roaring Moon's Attack was heightened!"); } } diff --git a/test/battle/gimmick/dynamax.c b/test/battle/gimmick/dynamax.c index 42e48c9e9cb2..a9ee2fe4d01e 100644 --- a/test/battle/gimmick/dynamax.c +++ b/test/battle/gimmick/dynamax.c @@ -1347,7 +1347,7 @@ DOUBLE_BATTLE_TEST("(DYNAMAX) G-Max Centiferno traps both opponents in Fire Spin TURN { SWITCH(playerLeft, 2); } } SCENE { // turn 1 - MESSAGE("Centiskorc used G-Max Centiferno!"); + MESSAGE("Centiskorch used G-Max Centiferno!"); MESSAGE("Foe Wobbuffet is hurt by Fire Spin!"); HP_BAR(opponentLeft); MESSAGE("Foe Wynaut is hurt by Fire Spin!"); diff --git a/test/battle/move_effect/sticky_web.c b/test/battle/move_effect/sticky_web.c index 6c6f8f156cb2..e3c96ca2fa23 100644 --- a/test/battle/move_effect/sticky_web.c +++ b/test/battle/move_effect/sticky_web.c @@ -123,8 +123,8 @@ DOUBLE_BATTLE_TEST("Sticky Web has correct interactions with Mirror Armor - the ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, BATTLER_PLAYER); MESSAGE("A sticky web spreads out on the ground around the opposing team!"); - MESSAGE("Go! Corviknigh!"); - MESSAGE("Corviknigh was caught in a Sticky Web!"); + MESSAGE("Go! Corviknight!"); + MESSAGE("Corviknight was caught in a Sticky Web!"); ABILITY_POPUP(playerRight, ABILITY_MIRROR_ARMOR); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, BATTLER_OPPONENT); if (opponentSetUpper == 0) { @@ -170,8 +170,8 @@ DOUBLE_BATTLE_TEST("Sticky Web has correct interactions with Mirror Armor - no o MESSAGE("A sticky web spreads out on the ground around the opposing team!"); } - MESSAGE("Go! Corviknigh!"); - MESSAGE("Corviknigh was caught in a Sticky Web!"); + MESSAGE("Go! Corviknight!"); + MESSAGE("Corviknight was caught in a Sticky Web!"); ABILITY_POPUP(playerRight, ABILITY_MIRROR_ARMOR); NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); } THEN { @@ -219,8 +219,8 @@ DOUBLE_BATTLE_TEST("Sticky Web has correct interactions with Mirror Armor - no o MESSAGE("2 sent out Pidgey!"); } - MESSAGE("Go! Corviknigh!"); - MESSAGE("Corviknigh was caught in a Sticky Web!"); + MESSAGE("Go! Corviknight!"); + MESSAGE("Corviknight was caught in a Sticky Web!"); ABILITY_POPUP(playerRight, ABILITY_MIRROR_ARMOR); NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); } THEN { diff --git a/test/text.c b/test/text.c index f42511ee92dd..19a0a88b4095 100644 --- a/test/text.c +++ b/test/text.c @@ -269,3 +269,97 @@ TEST("Item names fit on Shop Screen") } EXPECT_LE(GetStringWidth(fontId, gItemsInfo[item].name, 0), widthPx); } + +TEST("Species names fit on Battle Screen HP box") +{ + u32 i, genderWidthPx; + const u32 fontId = FONT_SMALL_NARROWER, widthPx = 54; + u32 species = SPECIES_NONE; + genderWidthPx = GetStringWidth(fontId, COMPOUND_STRING("♂"), 0); + for (i = 1; i < NUM_SPECIES; i++) + { + if (IsSpeciesEnabled(i)) + { + PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; } + } + } + if (gSpeciesInfo[i].genderRatio != MON_GENDERLESS) + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0) - genderWidthPx, widthPx); + else + EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); +} + +TEST("Species names fit on Party Screen") +{ + u32 i; + const u32 fontId = FONT_SMALL_NARROWER, widthPx = 50; + 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 Summary Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 63; + 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 Pokedex Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 50; + 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; + 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(FONT_NARROWER, gSpeciesInfo[species].speciesName, 0), 66); + EXPECT_LE(GetStringWidth(FONT_SHORT_NARROW, gSpeciesInfo[species].speciesName, 0), 60); +} + +TEST("Species names fit on Contest Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 50; + 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); +} From d913792f43907c83125f5015dcdac92b0c7302fd Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 6 Apr 2024 15:15:08 +0100 Subject: [PATCH 10/13] Enable GF species names by default --- include/config/test.h | 2 + src/battle_dome.c | 2 + src/contest.c | 24 +++-- src/contest_util.c | 12 ++- src/hall_of_fame.c | 14 ++- src/naming_screen.c | 7 +- src/pokedex.c | 15 +-- src/pokemon_storage_system.c | 8 +- src/pokemon_summary_screen.c | 4 +- src/pokenav_conditions.c | 2 + src/pokenav_conditions_search_results.c | 10 +- src/pokenav_ribbons_list.c | 9 +- src/pokenav_ribbons_summary.c | 2 +- test/text.c | 135 ++++++++++++++++++++++++ 14 files changed, 202 insertions(+), 44 deletions(-) diff --git a/include/config/test.h b/include/config/test.h index 8dba50f8a70b..cba8012d3625 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 95490a54eafc..ca105beb171a 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 c063b4a3b40d..be8bb3e92b3a 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 7977f373c165..c90113c5ce8c 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 2837931ea1a8..1c3b00f2ef1b 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 848e5b1a487e..d21130284ec2 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 0eb99d701e27..75f8d70720b8 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 b60dfb7daf8b..111d153d2f31 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 5132218931a6..f13e57ed8ecc 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 19cfe38b95d5..382ddde41324 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 24fe966dc329..9afb2bb2d9c5 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 72783b0972d1..834dc926ad0a 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 1ff55dc187c6..bba1c3600cb0 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 19a0a88b4095..5b461f39e45d 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); +} From 30efba0ccdfe5449f1fa17fa5205d949a5f83068 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 20 Apr 2024 17:14:37 +0100 Subject: [PATCH 11/13] Support GF abilities names --- src/battle_interface.c | 4 +++- test/text.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index df96fc1b170c..e7734a9f4356 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3038,6 +3038,7 @@ static const s16 sAbilityPopUpCoordsSingles[MAX_BATTLERS_COUNT][2] = static u8* AddTextPrinterAndCreateWindowOnAbilityPopUp(const u8 *str, u32 x, u32 y, u32 color1, u32 color2, u32 color3, u32 *windowId) { + u32 fontId; u8 color[3] = {color1, color2, color3}; struct WindowTemplate winTemplate = {0}; winTemplate.width = POPUP_WINDOW_WIDTH; @@ -3046,7 +3047,8 @@ static u8* AddTextPrinterAndCreateWindowOnAbilityPopUp(const u8 *str, u32 x, u32 *windowId = AddWindow(&winTemplate); FillWindowPixelBuffer(*windowId, PIXEL_FILL(color1)); - AddTextPrinterParameterized4(*windowId, FONT_SMALL, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); + fontId = GetFontIdToFit(str, FONT_SMALL, 0, 76); + AddTextPrinterParameterized4(*windowId, fontId, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); return (u8 *)(GetWindowAttribute(*windowId, WINDOW_TILE_DATA)); } diff --git a/test/text.c b/test/text.c index 5b461f39e45d..9766433a8ed2 100644 --- a/test/text.c +++ b/test/text.c @@ -2,6 +2,7 @@ #include "test/test.h" #include "item.h" #include "text.h" +#include "constants/abilities.h" #include "constants/items.h" #include "constants/moves.h" @@ -498,3 +499,27 @@ TEST("Species names fit on PokeNav Ribbon List Screen") } EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx); } + +TEST("Ability names fit on Pokemon Summary Screen") +{ + u32 i; + const u32 fontId = FONT_NORMAL, widthPx = 144; + u32 ability = ABILITY_NONE; + for (i = 1; i < ABILITIES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gAbilitiesInfo[i].name) { ability = i; } + } + EXPECT_LE(GetStringWidth(fontId, gAbilitiesInfo[ability].name, 0), widthPx); +} + +TEST("Ability names fit on Ability Pop-Up") +{ + u32 i; + const u32 fontId = FONT_SMALL_NARROWER, widthPx = 76; + u32 ability = ABILITY_NONE; + for (i = 1; i < ABILITIES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gAbilitiesInfo[i].name) { ability = i; } + } + EXPECT_LE(GetStringWidth(fontId, gAbilitiesInfo[ability].name, 0), widthPx); +} From 073f12be18c47b33ec0ac7c93eb6534240f0e851 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Thu, 25 Apr 2024 06:51:02 +0100 Subject: [PATCH 12/13] Expanded type names --- include/config/battle.h | 1 + include/constants/global.h | 2 +- src/battle_main.c | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/config/battle.h b/include/config/battle.h index f2c17f91f6cc..16f8586614bb 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -39,6 +39,7 @@ #define B_MULTIPLE_TARGETS_DMG GEN_LATEST // In Gen4+, damage dealt by moves that hit multiple targets at once is reduced to 75%. Before, it was 50%. // Type settings +#define B_EXPANDED_TYPE_NAMES FALSE // If TRUE, type names are increased from 6 characters to 8 characters. #define B_GHOSTS_ESCAPE GEN_LATEST // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. #define B_PARALYZE_ELECTRIC GEN_LATEST // In Gen6+, Electric-type Pokémon can't be paralyzed. #define B_POWDER_GRASS GEN_LATEST // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. diff --git a/include/constants/global.h b/include/constants/global.h index 4555f08f2198..8b91af77fa1a 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -117,7 +117,7 @@ #define WONDER_NEWS_TEXT_LENGTH 40 #define WONDER_CARD_BODY_TEXT_LINES 4 #define WONDER_NEWS_BODY_TEXT_LINES 10 -#define TYPE_NAME_LENGTH 6 +#define TYPE_NAME_LENGTH ((B_EXPANDED_TYPE_NAMES == TRUE) ? 8 : 6) #define ABILITY_NAME_LENGTH ((B_EXPANDED_ABILITY_NAMES == TRUE) ? 16 : 12) #define TRAINER_NAME_LENGTH 10 diff --git a/src/battle_main.c b/src/battle_main.c index eba4916ef468..30154ef17268 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -295,6 +295,12 @@ const struct OamData gOamData_BattleSpritePlayerSide = static const s8 sCenterToCornerVecXs[8] ={-32, -16, -16, -32, -32}; +#if B_EXPANDED_TYPE_NAMES == TRUE +#define HANDLE_EXPANDED_TYPE_NAME(_name, ...) _(DEFAULT(_name, __VA_ARGS__)) +#else +#define HANDLE_EXPANDED_TYPE_NAME(_name) _(_name) +#endif + // .generic is large enough that the text for TYPE_ELECTRIC will exceed TEXT_BUFF_ARRAY_COUNT. const struct TypeInfo gTypesInfo[NUMBER_OF_MON_TYPES] = { @@ -314,7 +320,7 @@ const struct TypeInfo gTypesInfo[NUMBER_OF_MON_TYPES] = }, [TYPE_FIGHTING] = { - .name = _("Fight"), + .name = HANDLE_EXPANDED_TYPE_NAME("Fight", "Fighting"), .generic = _("a FIGHTING move"), .palette = 13, .zMove = MOVE_ALL_OUT_PUMMELING, @@ -496,7 +502,7 @@ const struct TypeInfo gTypesInfo[NUMBER_OF_MON_TYPES] = }, [TYPE_ELECTRIC] = { - .name = _("Electr"), + .name = HANDLE_EXPANDED_TYPE_NAME("Electr", "Electric"), .generic = _("an ELECTRIC move"), .palette = 13, .zMove = MOVE_GIGAVOLT_HAVOC, @@ -512,7 +518,7 @@ const struct TypeInfo gTypesInfo[NUMBER_OF_MON_TYPES] = }, [TYPE_PSYCHIC] = { - .name = _("Psychc"), + .name = HANDLE_EXPANDED_TYPE_NAME("Psychc", "Psychic"), .generic = _("a PSYCHIC move"), .palette = 14, .zMove = MOVE_SHATTERED_PSYCHE, @@ -592,7 +598,7 @@ const struct TypeInfo gTypesInfo[NUMBER_OF_MON_TYPES] = }, [TYPE_STELLAR] = { - .name = _("Stellr"), + .name = HANDLE_EXPANDED_TYPE_NAME("Stellr", "Stellar"), .generic = _("a STELLAR move"), .palette = 15, .zMove = MOVE_BREAKNECK_BLITZ, From 664fe905f64f1219a6d2be385379ab8719ac22ce Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Thu, 25 Apr 2024 07:05:51 +0100 Subject: [PATCH 13/13] Enable GF type names by default --- include/config/battle.h | 2 +- include/config/test.h | 2 ++ src/battle_controller_player.c | 8 +++----- src/pokedex.c | 17 ++++++++++------- test/battle/terrain/electric.c | 2 +- test/battle/terrain/psychic.c | 2 +- test/text.c | 25 +++++++++++++++++++++++++ 7 files changed, 43 insertions(+), 15 deletions(-) diff --git a/include/config/battle.h b/include/config/battle.h index 16f8586614bb..b6c55e8d248d 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -39,7 +39,7 @@ #define B_MULTIPLE_TARGETS_DMG GEN_LATEST // In Gen4+, damage dealt by moves that hit multiple targets at once is reduced to 75%. Before, it was 50%. // Type settings -#define B_EXPANDED_TYPE_NAMES FALSE // If TRUE, type names are increased from 6 characters to 8 characters. +#define B_EXPANDED_TYPE_NAMES TRUE // If TRUE, type names are increased from 6 characters to 8 characters. #define B_GHOSTS_ESCAPE GEN_LATEST // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. #define B_PARALYZE_ELECTRIC GEN_LATEST // In Gen6+, Electric-type Pokémon can't be paralyzed. #define B_POWDER_GRASS GEN_LATEST // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. diff --git a/include/config/test.h b/include/config/test.h index cba8012d3625..4101f7a5592c 100644 --- a/include/config/test.h +++ b/include/config/test.h @@ -7,5 +7,7 @@ #define I_EXPANDED_ITEM_NAMES TRUE #undef POKEMON_NAME_LENGTH #define POKEMON_NAME_LENGTH 12 +#undef B_EXPANDED_TYPE_NAMES +#define B_EXPANDED_TYPE_NAMES TRUE #endif // GUARD_CONFIG_TEST_H diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 10a91a14853a..b86da34d2421 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1745,16 +1745,13 @@ static void MoveSelectionDisplayPpNumber(u32 battler) static void MoveSelectionDisplayMoveType(u32 battler) { - u8 *txtPtr; + u8 *txtPtr, *end; u8 type; u32 speciesId; struct Pokemon *mon; struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); - *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; - *(txtPtr)++ = EXT_CTRL_CODE_FONT; - *(txtPtr)++ = FONT_NORMAL; if (moveInfo->moves[gMoveSelectionCursor[battler]] == MOVE_IVY_CUDGEL) { @@ -1771,7 +1768,8 @@ static void MoveSelectionDisplayMoveType(u32 battler) else type = gMovesInfo[moveInfo->moves[gMoveSelectionCursor[battler]]].type; - StringCopy(txtPtr, gTypesInfo[type].name); + end = StringCopy(txtPtr, gTypesInfo[type].name); + PrependFontIdToFit(txtPtr, end, FONT_NORMAL, WindowWidthPx(B_WIN_MOVE_TYPE) - 25); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } diff --git a/src/pokedex.c b/src/pokedex.c index 75f8d70720b8..7c39b2502cca 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -5008,13 +5008,16 @@ static u8 LoadSearchMenu(void) return CreateTask(Task_LoadSearchMenu, 0); } -static void PrintSearchText(const u8 *str, u32 x, u32 y) +static void PrintSearchTextToFit(const u8 *str, u32 x, u32 y, u32 width) { - u8 color[3]; + static const u8 color[3] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_DARK_GRAY }; + u32 fontId = GetFontIdToFit(str, FONT_NORMAL, 0, width); + AddTextPrinterParameterized4(0, fontId, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); +} - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_DARK_GRAY; +static void PrintSearchText(const u8 *str, u32 x, u32 y) +{ + static const u8 color[3] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_DARK_GRAY }; AddTextPrinterParameterized4(0, FONT_NORMAL, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); } @@ -5634,10 +5637,10 @@ static void PrintSelectedSearchParameters(u8 taskId) PrintSearchText(sDexSearchColorOptions[searchParamId].title, 0x2D, 0x21); searchParamId = gTasks[taskId].tCursorPos_TypeLeft + gTasks[taskId].tScrollOffset_TypeLeft; - PrintSearchText(sDexSearchTypeOptions[searchParamId].title, 0x2D, 0x31); + PrintSearchTextToFit(sDexSearchTypeOptions[searchParamId].title, 0x2D, 0x31, 38); searchParamId = gTasks[taskId].tCursorPos_TypeRight + gTasks[taskId].tScrollOffset_TypeRight; - PrintSearchText(sDexSearchTypeOptions[searchParamId].title, 0x5D, 0x31); + PrintSearchTextToFit(sDexSearchTypeOptions[searchParamId].title, 0x5D, 0x31, 38); searchParamId = gTasks[taskId].tCursorPos_Order + gTasks[taskId].tScrollOffset_Order; PrintSearchText(sDexOrderOptions[searchParamId].title, 0x2D, 0x41); diff --git a/test/battle/terrain/electric.c b/test/battle/terrain/electric.c index eb7a112bb550..2227afdcd9e8 100644 --- a/test/battle/terrain/electric.c +++ b/test/battle/terrain/electric.c @@ -32,7 +32,7 @@ SINGLE_BATTLE_TEST("Electric Terrain activates Electric Seed and Mimicry") ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); MESSAGE("Using Electric Seed, the Defense of Wobbuffet rose!"); ABILITY_POPUP(opponent); - MESSAGE("Foe Stunfisk's type changed to Electr!"); + MESSAGE("Foe Stunfisk's type changed to Electric!"); } THEN { EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_ELECTRIC); } diff --git a/test/battle/terrain/psychic.c b/test/battle/terrain/psychic.c index 1881db62978c..0c13122fa65e 100644 --- a/test/battle/terrain/psychic.c +++ b/test/battle/terrain/psychic.c @@ -31,7 +31,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain activates Psychic Seed and Mimicry") ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); MESSAGE("Using Psychic Seed, the Sp. Def of Wobbuffet rose!"); ABILITY_POPUP(opponent); - MESSAGE("Foe Stunfisk's type changed to Psychc!"); + MESSAGE("Foe Stunfisk's type changed to Psychic!"); } THEN { EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_PSYCHIC); } diff --git a/test/text.c b/test/text.c index 9766433a8ed2..e8eb4f7f24cf 100644 --- a/test/text.c +++ b/test/text.c @@ -1,5 +1,6 @@ #include "global.h" #include "test/test.h" +#include "battle_main.h" #include "item.h" #include "text.h" #include "constants/abilities.h" @@ -523,3 +524,27 @@ TEST("Ability names fit on Ability Pop-Up") } EXPECT_LE(GetStringWidth(fontId, gAbilitiesInfo[ability].name, 0), widthPx); } + +TEST("Type names fit on Battle Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 39; + u32 type = TYPE_NORMAL; + for (i = 0; i < NUMBER_OF_MON_TYPES; i++) + { + PARAMETRIZE_LABEL("%S", gTypesInfo[i].name) { type = i; } + } + EXPECT_LE(GetStringWidth(fontId, gTypesInfo[type].name, 0), widthPx); +} + +TEST("Type names fit on Pokedex Search Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 38; + u32 type = TYPE_NORMAL; + for (i = 0; i < NUMBER_OF_MON_TYPES; i++) + { + PARAMETRIZE_LABEL("%S", gTypesInfo[i].name) { type = i; } + } + EXPECT_LE(GetStringWidth(fontId, gTypesInfo[type].name, 0), widthPx); +}