dsekai
World engine for retrocomputers.
All Data Structures Files Functions Variables Typedefs Friends Macros Modules Pages
Data Fields | Related Functions
ITEM Struct Reference

An instance of an item in the world. More...

#include <itstruct.h>

Data Fields

RESOURCE_NAME sprite_name
 
int16_t sprite_cache_id
 Index of the item's sprite loaded in the Unilayer Graphics Cache.
 
char name [ITEM_NAME_SZ+1]
 Meaningful name of this item displayed in menus, etc.
 
int16_t owner
 dsekai_items_owners for this particular item.
 
int16_t gid
 Arbitrary portion of the GID of the item.
 
uint8_t data
 Qualitative value specific to each ITEM_TYPE_MASK.
 
uint16_t flags
 Item Flags pertaining to this item.
 
uint8_t x
 If ITEM::owner is ::ITEM_OWNER_NONE, the X coord (in tiles) of this item on the TILEMAP referred to by ITEM::map_gid.
 
uint8_t y
 If ITEM::owner is ::ITEM_OWNER_NONE, the Y coord (in tiles) of this item on the TILEMAP referred to by ITEM::map_gid.
 
TILEMAP_GID map_gid
 TILEMAP::gid of the tilemap on which this item is sitting. Only has meaning when ITEM::owner is set to ::ITEM_OWNER_NONE.
 

Related Functions

(Note that these are not member functions.)

#define item_get_type_flag(e)   (((e)->flags & ITEM_TYPE_MASK) >> 8)
 Get the Item Types and Use for ITEM e, e.g. to index in gc_items_max.
 
#define item_set_type_flag(e, v)   (e)->flags = (((e)->flags & ~ITEM_TYPE_MASK) | (((v) << 8) & ITEM_TYPE_MASK))
 Set the Item Types and Use for ITEM e.
 
#define item_get_count_flag(e)   ((e)->flags & ITEM_COUNT_MASK)
 Return the number of copies of ITEM e as a stack.
 
#define item_incr_count(e, v)   (e)->flags = (((e)->flags & ~ITEM_COUNT_MASK) | ((item_get_count_flag( e ) + (((v) & ITEM_COUNT_MASK))) & ITEM_COUNT_MASK))
 Increment the number of copies of ITEM e as a stack.
 

Detailed Description

An instance of an item in the world.

All extant items are stored in DSEKAI_STATE::items_handle after being created in-world, typically through a SCRIPT attached to a TILEMAP.

Example copies of items available to create on a given TILEMAP are stored in that's tilemap's TILEMAP::item_defs.

Field Documentation

◆ data

uint8_t ITEM::data

Qualitative value specific to each ITEM_TYPE_MASK.

Item Data
Seed Crop GID
Food HP+

The documentation for this struct was generated from the following file: