![]() |
dsekai
World engine for retrocomputers.
|
Modules | |
Item Errors | |
Item Types and Use | |
Definitions and callbacks pertaining to ITEM use in-world. | |
Item Flags | |
Flags which affect an individual ITEM. | |
Files | |
file | item.h |
Definitions, functions, and macros pertaining to inventory objects. | |
file | itstruct.h |
Structs pertaining to inventory objects. | |
Data Structures | |
struct | ITEM |
An instance of an item in the world. More... | |
Macros | |
#define | ITEM_INVENTORY_MAX 20 |
Maximum number of items in a single MOBILE inventory. | |
#define | DSEKAI_ITEMS_MAX 200 |
Maximum number of items existing in the world at any time. | |
#define | DSEKAI_ITEMS_ONSCREEN (GRAPHICS_SPRITES_ONSCREEN / 3) |
#define | item_break_if_last(items, i) if( ITEM_FLAG_NOT_LAST != (ITEM_FLAG_NOT_LAST & items[i].flags) ) { debug_printf( 1, "breaking early on item %d!", i ); break; } |
#define | ITEM_NAME_SZ 8 |
The maximum characters in an ITEM::name. | |
Functions | |
int16_t | item_exists_in_inventory (int16_t template_gid, MOBILE_GID owner_gid, struct DSEKAI_STATE *state) SECTION_ITEM |
Determine if/where item with the given ITEM::gid exists in the inventory of an dsekai_items_owners. | |
int16_t | item_decr_or_delete (int16_t e_idx, struct DSEKAI_STATE *state) SECTION_ITEM |
int16_t | item_stack_or_add (int16_t template_gid, MOBILE_GID owner_gid, struct DSEKAI_STATE *state) SECTION_ITEM |
Create an item in DSEKAI_STATE::items_handle from a template in TILEMAP::item_defs or increment its count if possible. | |
int16_t | item_give_mobile (int16_t e_idx, MOBILE_GID owner_gid, struct DSEKAI_STATE *state) SECTION_ITEM |
int8_t | item_drop (int16_t e_idx, struct DSEKAI_STATE *state) SECTION_ITEM |
Drop am item on the map floor where its owner is standing. | |
int16_t | item_pickup_xy (uint8_t x, uint8_t y, MOBILE_GID owner_gid, struct DSEKAI_STATE *state) SECTION_ITEM |
Pick up an item at the given x, y tile coordinates on the given TILEMAP. | |
#define DSEKAI_ITEMS_MAX 200 |
Maximum number of items existing in the world at any time.
#define ITEM_INVENTORY_MAX 20 |
Maximum number of items in a single MOBILE inventory.
int8_t item_drop | ( | int16_t | e_idx, |
struct DSEKAI_STATE * | state | ||
) |
Drop am item on the map floor where its owner is standing.
e_idx | Index of the ITEM to drop in the current DSEKAI_STATE::items_handle. |
t | Locked MEMORY_PTR to the TILEMAP on which the item is being dropped. |
state | Locked MEMORY_PTR to the current engine DSEKAI_STATE. |
int16_t item_exists_in_inventory | ( | int16_t | template_gid, |
MOBILE_GID | owner_gid, | ||
struct DSEKAI_STATE * | state | ||
) |
Determine if/where item with the given ITEM::gid exists in the inventory of an dsekai_items_owners.
template_gid | ITEM::gid of the definition in TILEMAP::items. |
owner_gid | dsekai_items_owners of the sought item. |
state | Locked MEMORY_PTR to the current engine DSEKAI_STATE. |
int16_t item_give_mobile | ( | int16_t | e_idx, |
MOBILE_GID | owner_gid, | ||
struct DSEKAI_STATE * | state | ||
) |
e_idx | Index of the ITEM to give in the current DSEKAI_STATE::items_handle. |
owner_gid | MOBILE_GID of the MOBILE to give the item to. |
t | Locked MEMORY_PTR to the TILEMAP containing template_gid in its TILEMAP::item_defs. |
state | Locked MEMORY_PTR to the current engine DSEKAI_STATE. |
int16_t item_pickup_xy | ( | uint8_t | x, |
uint8_t | y, | ||
MOBILE_GID | owner_gid, | ||
struct DSEKAI_STATE * | state | ||
) |
Pick up an item at the given x, y tile coordinates on the given TILEMAP.
owner_gid | MOBILE_GID of the MOBILE to give the item to if found. |
t | Locked MEMORY_PTR to the TILEMAP from which the item is being picked up. |
state | Locked MEMORY_PTR to the current engine DSEKAI_STATE. |
int16_t item_stack_or_add | ( | int16_t | template_gid, |
MOBILE_GID | owner_gid, | ||
struct DSEKAI_STATE * | state | ||
) |
Create an item in DSEKAI_STATE::items_handle from a template in TILEMAP::item_defs or increment its count if possible.
If the item exists in the inventory of the owner it's being added to, this function will attempt to increment its count (stored in its Item Flags).
If the item does not exist, or its count in its owner's inventory has exceeded the maximum defined for its Item Types and Use in gc_items_max, then a new ITEM will be created in the inventory of that owner (unless that inventory has reached ITEM_INVENTORY_MAX).
template_gid | ITEM::gid of the template in TILEMAP::item_defs to add. |
owner_gid | MOBILE_GID of the MOBILE to give the item to. |
t | Locked MEMORY_PTR to the TILEMAP containing template_gid in its TILEMAP::item_defs. |
state | Locked MEMORY_PTR to the current engine DSEKAI_STATE. |