dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
itstruct.h
Go to the documentation of this file.
1
2#ifndef ITSTRUCT_H
3#define ITSTRUCT_H
4
25#define ITEM_FLAG_ACTIVE 0x1000
26#define ITEM_FLAG_CRAFTABLE 0x2000
27
35#define ITEM_FLAG_NOT_LAST 0x4000
36
41#define ITEM_TYPE_MASK 0x0f00
42
47#define ITEM_COUNT_MASK 0x00ff
48 /* dsekai_items_flags */
50
56#define item_get_type_flag( e ) (((e)->flags & ITEM_TYPE_MASK) >> 8)
57
62#define item_set_type_flag( e, v ) (e)->flags = (((e)->flags & ~ITEM_TYPE_MASK) | (((v) << 8) & ITEM_TYPE_MASK))
63
68#define item_get_count_flag( e ) ((e)->flags & ITEM_COUNT_MASK)
69
74#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))
75
80#define ITEM_NAME_SZ 8
81
91struct ITEM {
92 RESOURCE_NAME sprite_name;
99 char name[ITEM_NAME_SZ + 1]; /* +1 for NULL. */
103 int16_t owner;
107 int16_t gid;
117 uint8_t data;
119 uint16_t flags;
124 uint8_t x;
129 uint8_t y;
135};
136 /* dsekai_items */
138
139#endif /* !ITSTRUCT_H */
140
uint16_t TILEMAP_GID
Globally unique identifier for TILEMAP objects.
Definition: gid.h:26
#define ITEM_NAME_SZ
The maximum characters in an ITEM::name.
Definition: itstruct.h:80
An instance of an item in the world.
Definition: itstruct.h:91
int16_t gid
Arbitrary portion of the GID of the item.
Definition: itstruct.h:107
int16_t sprite_cache_id
Index of the item's sprite loaded in the Unilayer Graphics Cache.
Definition: itstruct.h:97
char name[ITEM_NAME_SZ+1]
Meaningful name of this item displayed in menus, etc.
Definition: itstruct.h:99
uint8_t y
If ITEM::owner is ::ITEM_OWNER_NONE, the Y coord (in tiles) of this item on the TILEMAP referred to b...
Definition: itstruct.h:129
uint8_t data
Qualitative value specific to each ITEM_TYPE_MASK.
Definition: itstruct.h:117
uint16_t flags
Item Flags pertaining to this item.
Definition: itstruct.h:119
int16_t owner
dsekai_items_owners for this particular item.
Definition: itstruct.h:103
TILEMAP_GID map_gid
TILEMAP::gid of the tilemap on which this item is sitting. Only has meaning when ITEM::owner is set t...
Definition: itstruct.h:134
uint8_t x
If ITEM::owner is ::ITEM_OWNER_NONE, the X coord (in tiles) of this item on the TILEMAP referred to b...
Definition: itstruct.h:124