11 if ((
int)item_type < 0 || item_type >= ITEM_NUM_TYPES)
13 MGBA_FUNC_ERROR(
"Undefined type %d", item_type);
32 return item_funcs->get_buy_price(item);
43 item_funcs->acquire(item);
53 return item_funcs->can_acquire(item);
64 item_funcs->dispose(item);
The core structure for items in the shop and inventory. Provides a common API for the shop and invent...
void item_dispose(Item **item)
Destroys an item, freeing underlying resources, and manages rollable items sets if needed....
void item_print_buy_price_under(Item *item)
Prints the buy price under the item Relies on the fact item is a SpriteObject.
Item * item_roll_new(enum ItemType item_type, enum RngSequence key)
Rolls a random item of type item_type and returns a newly created one. Manages rollable items set if ...
bool item_can_acquire(Item *item)
Returns true if the item can be acquired, i.e. added to inventory. Does not check if the player has e...
void item_acquire(Item *item)
Acquires the item, adding to inventory if applicable. Called when it is purchased from the shop,...
int item_get_buy_price(Item *item)
Returns the buy price of the item.
An API for the item functions defined in item.h Separated module from item.c/.h so item_funcs....
ItemFuncs * get_item_type_funcs(enum ItemType type)
Returns the function table for a given item type.
Interface to interact with the mgba logger.
RngSequence
Keys to different independent RNG sequences.
void sprite_object_print_price_under(SpriteObject *sprite_object, int price)
Print the price string directly beneath a SpriteObject. More specialized version of sprite_object_pri...
The set of functions that each item type implements.
Item *(* roll_new)(enum RngSequence key)
A generic interface for all items that can appear in the shop or be in the inventory....
enum ItemType type
The item type - used to dispatch the function implementations for inheriting types.
A sprite object is a sprite that is focusable and movable in animation.
Utilities relating around number string representation and protected arithmatic helper functions.
#define GBAL_RETURN_IF_NULL_RET(param, ret_val)
Checks if param is equal to NULL and prints error message and returns in case it is....
#define GBAL_RETURN_IF_NULL_VOID(param)
Checks if param is NULL and prints error message and returns in case it is. Useful for checking argum...