#ifndef item_h #define item_h #include #include /** * Constants defining default item behaviors and limits. * 'no_id' represents an empty slot, while 'infinite_durability' is used * for items like blocks or materials that do not break upon use. */ #define no_item_id 0 #define infinite_durability 0 #define default_max_stack_size 64 #define item_is_not_placeable false #define item_is_placeable true /** * Categorizes an item to determine its behavior when the player interacts * with the world or uses the item. */ typedef uint8_t item_type_struct; enum { item_type_block = 0, item_type_tool = 1, item_type_consumable = 2, item_type_miscellaneous = 3 }; /** * The core definition of an item instance within the game. * This structure stores the static properties of an item, such as its * identification, durability limits, and whether it can be placed in the * world as a block. */ typedef struct item_struct { uint32_t item_id; uint16_t max_durability; uint8_t max_stack; item_type_struct item_type; bool is_placeable; } item_struct; /** * Initializes an item structure with specific properties. * This function is used to populate item data from the global item registry * into specific instances (like inventory slots or world drops). */ void initialize_item(item_struct *item, uint32_t new_item_id, uint16_t new_max_durability, uint8_t new_max_stack, item_type_struct new_item_type, bool new_is_placeable); #endif