dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
Macros | Typedefs | Variables
Item Types and Use

Definitions and callbacks pertaining to ITEM use in-world. More...

Collaboration diagram for Item Types and Use:

Macros

#define ITEM_TABLE(f)   f( none, 0 ) f( seed, 10 ) f( food, 10 ) f( shovel, 1 ) f( editor, 1 ) f( material, 10 ) f( watercan, 1 ) f( hoe, 1 )
 List of possible ITEM_TYPE_MASK values and their maximum stack sizes.
 
#define ITEM_USED_SUCCESSFUL   -1
 
#define ITEM_USED_FAILED   0
 
#define ITEM_USED_SUCCESSFUL_SILENT   1
 
#define ITEM_TABLE_USE_CB_PROTOS(type, max)   int8_t item_use_ ## type( int16_t e_idx, MOBILE_GID owner_gid, struct DSEKAI_STATE* state ) SECTION_ITEM;
 Macro to define ITEM_USE_CB prototypes from ITEM_TABLE.
 

Typedefs

typedef int8_t(* ITEM_USE_CB) (int16_t e_idx, MOBILE_GID owner_gid, struct DSEKAI_STATE *state)
 Definition for a callback to execute when an ITEM is used.
 

Variables

RES_CONST uint8_t gc_items_max []
 Lookup table of maximum of each item type permitted in inventory.
 
RES_CONST ITEM_USE_CB gc_item_use_cbs []
 Lookup table of callbacks to execute for item types.
 
RES_CONST char * gc_items_types []
 Lookup table of text names for item types.
 

Detailed Description

Definitions and callbacks pertaining to ITEM use in-world.

An item's type, defined by the bits marked by ITEM_TYPE_MASK in its Item Flags, primarily decides what function that item will perform when used in-world.

Typedef Documentation

◆ ITEM_USE_CB

typedef int8_t(* ITEM_USE_CB) (int16_t e_idx, MOBILE_GID owner_gid, struct DSEKAI_STATE *state)

Definition for a callback to execute when an ITEM is used.

Parameters
e_idxIndex of the ITEM to use in the current DSEKAI_STATE::items_handle.
owner_gidMOBILE_GID of the MOBILE to use the item.
stateLocked MEMORY_PTR to the current engine DSEKAI_STATE.
Returns
ITEM_USED_SUCCESSFUL if the item was used successfully or ITEM_USED_FAILED if not. ITEM_USED_SUCCESSFUL_SILENT if the item was used and the menu should not be closed (the menu will always be closed if the item use failed.
Attention
In general, the menu should always be closed if the item's use will create a WINDOW, as those might conflict with the menu.