Support GF abilities names
This commit is contained in:
parent
d913792f43
commit
30efba0ccd
2 changed files with 28 additions and 1 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
25
test/text.c
25
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue