00001 // items.h 00004 00005 #ifndef ITEMS_H 00006 #define ITEMS_H 00007 00008 //{{{ 00009 struct item 00010 { 00011 ushort type; 00012 ushort next; 00013 ulong stacksize; 00014 uchar flags; 00015 schar plus; 00016 uchar hotkey; 00017 uchar rustiness; 00018 uchar x; uchar y; 00019 ushort padding; 00020 }; 00021 //}}} 00022 //{{{ 00023 #define ITEMFLAG_EQUIPPED 1 00024 #define ITEMFLAG_CURSED 2 00025 #define ITEMFLAG_IDENTIFIED 4 /* Item (not necessarily the type) is unIDed */ 00026 #define ITEMFLAG_UNPAID 8 /* Owned by a shopkeeper */ 00027 #define ITEMFLAG_DEPLETE 16 /* Temp flag: kill a charge when it's time */ 00028 #define ITEMFLAG_TOP 32 /* This is the top of a floor stack */ 00029 //}}} 00030 //{{{ 00031 struct itemsinfo 00032 { 00033 uint num; 00034 uint alloced; 00035 struct item *items; 00036 }; 00037 //}}} 00038 TYPEDEF(struct item item) 00039 TYPEDEF(struct itemsinfo itemsinfo) 00040 00041 /*{{{*/ 00042 struct stat_mod_desc 00043 { 00044 uchar type; 00045 uchar stat; 00046 sint amount; 00047 }; 00048 TYPEDEF(struct stat_mod_desc stat_mod_desc) 00049 #define STATMOD_ADD 1 /* [stat]+=amount */ 00050 #define STATMOD_ADDPLUS 2 /* [stat]+=amount + item.plus */ 00051 #define STATMOD_OR 3 /* [stat]|=amount */ 00052 #define STATMOD_SET 4 /* [stat]= amount */ 00053 //}}} 00054 #ifndef DATA_FILE 00055 //{{{ 00056 union item_property_desc 00057 { 00058 filelink parent; 00059 stat_mod_desc worn_stat_effect; 00060 stat_mod_desc carried_stat_effect; 00061 uint launcher; 00062 filelink function; 00063 uint score_factor; 00064 }; 00065 TYPEDEF(union item_property_desc item_property_desc) 00066 //}}} 00067 //{{{ 00068 struct item_property 00069 { 00070 uint type; 00071 item_property_desc contents; 00072 }; 00073 TYPEDEF(struct item_property item_property) 00074 //}}} 00075 //{{{ 00076 struct item_properties 00077 { 00078 uint num_properties; 00079 item_property properties[1]; 00080 }; 00081 TYPEDEF(struct item_properties item_properties) 00082 //}}} 00083 //{{{ 00084 struct itemextension 00085 { 00086 #ifdef SUPPORT_COLOR 00087 struct colorinfo color; 00088 #endif 00089 char str[1]; 00090 }; 00091 TYPEDEF(struct itemextension itemextension) 00092 //}}} 00093 #endif 00094 //{{{ 00095 #define PROPERTY_INHERIT 0 /* Inherit properties from another item */ 00096 #define PROPERTY_WORN_STAT_EFFECT 1 /* When equipped, apply stat_mod_desc */ 00097 #define PROPERTY_WEAR_FUNC 2 /* Function to call when equipping */ 00098 #define PROPERTY_LAUNCHER 3 /* Bit-mask of launchers that can be used 00099 * with this ammo */ 00100 #define PROPERTY_USE_EFFECT 4 /* int (*)(int n): item n was used. Return 00101 * non-zero to identify the item. */ 00102 #define PROPERTY_THROW_HIT_EFFECT 5 /* void (*)(int monst): item was thrown 00103 * at a monster. */ 00104 #define PROPERTY_SCORE 6 /* Worth [score_factor]*[item value] pts */ 00105 #define PROPERTY_CARRIED_EFFECT 7 00106 #define PROPERTY_THROWN_EFFECT 8 /* Applied immediately before firing and 00107 * then undone */ 00108 #define PROPERTY_BURN 9 /* int(*)(int n) Function for depleting fuel 00109 * Return value ignored */ 00110 //}}} 00111 00112 //{{{ 00113 struct itemdesc 00114 { 00115 uint num; 00116 struct filelink name; 00117 struct filelink unidname; 00118 uchar drawchar; 00119 schar spot; 00120 uchar category; 00121 uint flags; 00122 uint weight; 00123 uint value; 00124 uint stacksize; 00125 #ifdef SUPPORT_COLOR 00126 struct colorinfo color; 00127 #endif 00128 #ifndef DATA_FILE 00129 item_properties properties; 00130 #endif 00131 }; 00132 //}}} 00133 //{{{ 00134 #define ITEMFLAG_STACK 1 00135 #define ITEMFLAG_FRAGILE 2 00136 #define ITEMFLAG_AUTOID 4 00137 #define ITEMFLAG_RUSTPROOF 8 00138 #define ITEMFLAG_CURRENCY 16 00139 #define ITEMFLAG_CHARGED 32 00140 #define ITEMFLAG_USABLE 64 00141 #define ITEMFLAG_HIDECHARGE 256 00142 #define ITEMFLAG_PLUS 512 00143 #define ITEMFLAG_GEN_CURSED 1024 00144 #define ITEMFLAG_BREAKABLE 2048 00145 #define ITEMFLAG_FUELED 8192 00146 //}}} 00147 TYPEDEF(struct itemdesc itemdesc) 00148 00149 TYPEDEF(int (*inventoryfilter)(const item*)) 00150 00151 #endif //ITEMS_H 00152
1.3.6