Enable GF item names by default

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.
This commit is contained in:
Martin Griffin 2024-03-16 15:26:03 +00:00
parent 484e288cad
commit aab9678b02
14 changed files with 264 additions and 54 deletions

View file

@ -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.

View file

@ -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

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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[] =

View file

@ -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");

View file

@ -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!");
}
}

View file

@ -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!");
}

View file

@ -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!");

View file

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