pokeemerald/include/item.h

98 lines
2.6 KiB
C
Raw Normal View History

2018-04-29 13:36:26 +02:00
#ifndef GUARD_ITEM_H
#define GUARD_ITEM_H
2018-04-29 15:34:14 +02:00
// These constants are used in gItems
enum
{
POCKET_NONE,
POCKET_ITEMS,
POCKET_POKE_BALLS,
POCKET_TM_HM,
POCKET_BERRIES,
POCKET_KEY_ITEMS,
};
2018-04-29 13:36:26 +02:00
enum
{
ITEMS_POCKET,
BALLS_POCKET,
TMHM_POCKET,
BERRIES_POCKET,
KEYITEMS_POCKET,
POCKETS_COUNT
};
2017-09-03 00:47:51 +02:00
2017-09-03 13:33:13 +02:00
typedef void (*ItemUseFunc)(u8);
struct Item
{
2018-04-29 13:36:26 +02:00
u8 name[ITEM_NAME_LENGTH];
2017-09-03 13:33:13 +02:00
u16 itemId;
u16 price;
u8 holdEffect;
u8 holdEffectParam;
const u8 *description;
u8 importance;
u8 unk19;
u8 pocket;
u8 type;
ItemUseFunc fieldUseFunc;
u8 battleUsage;
ItemUseFunc battleUseFunc;
u8 secondaryId;
};
struct BagPocket
{
struct ItemSlot *itemSlots;
u8 capacity;
};
extern struct BagPocket gBagPockets[];
2018-04-29 14:21:59 +02:00
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);
void GetBerryCountString(u8 *dst, const u8 *berryName, u32 quantity);
2017-09-03 13:33:13 +02:00
bool8 IsBagPocketNonEmpty(u8 pocket);
bool8 CheckBagHasItem(u16 itemId, u16 count);
2018-04-29 14:21:59 +02:00
bool8 HasAtLeastOneBerry(void);
2017-09-03 13:33:13 +02:00
bool8 CheckBagHasSpace(u16 itemId, u16 count);
bool8 AddBagItem(u16 itemId, u16 count);
bool8 RemoveBagItem(u16 itemId, u16 count);
u8 GetPocketByItemId(u16 itemId);
2018-04-29 14:21:59 +02:00
void ClearItemSlots(struct ItemSlot *itemSlots, u8 itemCount);
2017-09-03 13:33:13 +02:00
u8 CountUsedPCItemSlots(void);
bool8 CheckPCHasItem(u16 itemId, u16 count);
bool8 AddPCItem(u16 itemId, u16 count);
void RemovePCItem(u8 index, u16 count);
2018-04-29 14:21:59 +02:00
void CompactPCItems(void);
2017-09-03 13:33:13 +02:00
void SwapRegisteredBike(void);
2018-04-29 14:21:59 +02:00
u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos);
u16 BagGetQuantityByPocketPosition(u8 pocketId, u16 pocketPos);
void CompactItemsInBagPocket(struct BagPocket *bagPocket);
void SortBerriesOrTMHMs(struct BagPocket *bagPocket);
void MoveItemSlotInList(struct ItemSlot* itemSlots_, u32 from, u32 to_);
void ClearBag(void);
u16 CountTotalItemQuantityInBag(u16 itemId);
bool8 AddPyramidBagItem(u16 itemId, u16 count);
bool8 RemovePyramidBagItem(u16 itemId, u16 count);
const u8 *ItemId_GetName(u16 itemId);
2017-09-03 13:33:13 +02:00
u16 ItemId_GetId(u16 itemId);
u16 ItemId_GetPrice(u16 itemId);
u8 ItemId_GetHoldEffect(u16 itemId);
u8 ItemId_GetHoldEffectParam(u16 itemId);
const u8 *ItemId_GetDescription(u16 itemId);
u8 ItemId_GetImportance(u16 itemId);
u8 ItemId_GetUnknownValue(u16 itemId);
u8 ItemId_GetPocket(u16 itemId);
u8 ItemId_GetType(u16 itemId);
ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
u8 ItemId_GetBattleUsage(u16 itemId);
ItemUseFunc ItemId_GetBattleFunc(u16 itemId);
u8 ItemId_GetSecondaryId(u16 itemId);
2018-04-29 13:36:26 +02:00
#endif // GUARD_ITEM_H