Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some vanilla names that fit in the battle UI incorrectly using a narrow font #4979

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/battle_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
break;
}

windowTileData = AddTextPrinterAndCreateWindowOnHealthboxToFit(gDisplayedStringBattle, 0, 3, 2, &windowId, 54);
windowTileData = AddTextPrinterAndCreateWindowOnHealthboxToFit(gDisplayedStringBattle, 0, 3, 2, &windowId, 55);

spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP;

Expand Down
21 changes: 20 additions & 1 deletion test/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ TEST("Item names fit on Shop Screen")
TEST("Species names fit on Battle Screen HP box")
{
u32 i, genderWidthPx;
const u32 fontId = FONT_SMALL_NARROWER, widthPx = 54;
const u32 fontId = FONT_SMALL_NARROWER, widthPx = 55;
u32 species = SPECIES_NONE;
genderWidthPx = GetStringWidth(fontId, COMPOUND_STRING("♂"), 0);
for (i = 1; i < NUM_SPECIES; i++)
Expand Down Expand Up @@ -501,6 +501,25 @@ TEST("Species names fit on PokeNav Ribbon List Screen")
EXPECT_LE(GetStringWidth(fontId, gSpeciesInfo[species].speciesName, 0), widthPx);
}

TEST("Species names fit on Battle Screen HP box for vanilla mons with the default font")
{
u32 i, genderWidthPx;
const u32 fontId = FONT_SMALL, widthPx = 55;
u32 species = SPECIES_NONE;
genderWidthPx = GetStringWidth(fontId, COMPOUND_STRING("♂"), 0);
for (i = 1; i < SPECIES_TURTWIG; 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("Ability names fit on Pokemon Summary Screen")
{
u32 i;
Expand Down
Loading