25#define ITEM_RETURN_IF_UNEXPECTED_TYPE_RET(item, expected_type, ret_val) \
28 if ((item)->type != expected_type) \
30 MGBA_FUNC_ERROR("Unexpected %s->type != %s", #item, #expected_type); \
41#define ITEM_RETURN_IF_UNEXPECTED_TYPE_VOID(item, expected_type) \
44 if ((item)->type != expected_type) \
46 MGBA_FUNC_ERROR("Unexpected %s->type != %s", #item, #expected_type); \
54 ITEM_TYPE_PLAYING_CARD,
100 int (*get_buy_price)(
Item* item);
101 bool (*can_acquire)(
Item* item);
102 void (*acquire)(
Item* item);
103 void (*dispose)(
Item** item);
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.
Interface to interact with the mgba logger.
Common functions to handle RNG manipulation. Using this interface has three goals:
RngSequence
Keys to different independent RNG sequences.
Sprite system for Gbalatro.
The set of functions that each item type implements.
A generic interface for all items that can appear in the shop or be in the inventory....
SpriteObject
First member struct inheritance all items that can appear in the shop are SpriteObjects....
enum ItemType type
The item type - used to dispatch the function implementations for inheriting types.