Add pluralName to gItems to allow the proper spelling when multiple items are received at once (#4001)

* Updated CopyItemNameHandlePlural to deal with plural names

* Fixed whitespace in a few places

* Fixed whitespace in a few places

* Add remaining plural forms.

* Created ITEM_NAME_PLURAL_LENGTH

* Updated ITEM_NAME_PLURAL_LENGTH per feedback https://github.com/rh-hideout/pokeemerald-expansion/pull/4001\#discussion_r1453598165

* Reverted ITEM_NAME_PLURAL_LENGTH to +2 and added new comment

* Removed GetBerryCountString from CopyItemNameHandlePlural
Will deprecate the former in a future feature: https://github.com/rh-hideout/pokeemerald-expansion/issues/4010

---------

Co-authored-by: Zimmermann Gyula <graiondilach@hotmail.com>
Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
psf 2024-01-16 10:05:41 -08:00 committed by GitHub
parent 9a1f6dfb64
commit cdf7190d15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 216 additions and 2 deletions

View file

@ -101,6 +101,7 @@
// string lengths
#define ITEM_NAME_LENGTH 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
#define PLAYER_NAME_LENGTH 7

View file

@ -15,6 +15,7 @@ struct Item
const u8 *description;
const u8 *effect;
u8 name[ITEM_NAME_LENGTH];
u8 pluralName[ITEM_NAME_PLURAL_LENGTH];
u8 holdEffect;
u8 holdEffectParam;
u8 importance;

File diff suppressed because it is too large Load diff

View file

@ -20,6 +20,8 @@
static bool8 CheckPyramidBagHasItem(u16 itemId, u16 count);
static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count);
static const u8 *ItemId_GetPluralName(u16);
static bool32 DoesItemHavePluralName(u16);
EWRAM_DATA struct BagPocket gBagPockets[POCKETS_COUNT] = {0};
@ -93,8 +95,8 @@ void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity)
if (quantity < 2)
return;
if (ItemId_GetPocket(itemId) == POCKET_BERRIES)
GetBerryCountString(dst, gBerries[itemId - FIRST_BERRY_INDEX].name, quantity);
if (DoesItemHavePluralName(itemId))
StringCopy(dst, ItemId_GetPluralName(itemId));
else
StringAppend(end, sText_s);
}
@ -887,6 +889,16 @@ u32 ItemId_GetPrice(u16 itemId)
return gItems[SanitizeItemId(itemId)].price;
}
static bool32 DoesItemHavePluralName(u16 itemId)
{
return (gItems[SanitizeItemId(itemId)].pluralName[0] != '\0');
}
static const u8 *ItemId_GetPluralName(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].pluralName;
}
const u8 *ItemId_GetEffect(u32 itemId)
{
if (itemId == ITEM_ENIGMA_BERRY_E_READER)