miscellaneous formatting
[aNetHack.git] / include / objclass.h
blob3f721809203b861655d1de022a5299d9abf4e6aa
1 /* NetHack 3.6 objclass.h $NHDT-Date: 1462067744 2016/05/01 01:55:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #ifndef OBJCLASS_H
6 #define OBJCLASS_H
8 /* [misnamed] definition of a type of object */
10 struct objclass {
11 short oc_name_idx; /* index of actual name */
12 short oc_descr_idx; /* description when name unknown */
13 char *oc_uname; /* called by user */
14 Bitfield(oc_name_known, 1);
15 Bitfield(oc_merge, 1); /* merge otherwise equal objects */
16 Bitfield(oc_uses_known, 1); /* obj->known affects full description;
17 otherwise, obj->dknown and obj->bknown
18 tell all, and obj->known should always
19 be set for proper merging behavior. */
20 Bitfield(oc_pre_discovered, 1); /* Already known at start of game;
21 won't be listed as a discovery. */
22 Bitfield(oc_magic, 1); /* inherently magical object */
23 Bitfield(oc_charged, 1); /* may have +n or (n) charges */
24 Bitfield(oc_unique, 1); /* special one-of-a-kind object */
25 Bitfield(oc_nowish, 1); /* cannot wish for this object */
27 Bitfield(oc_big, 1);
28 #define oc_bimanual oc_big /* for weapons & tools used as weapons */
29 #define oc_bulky oc_big /* for armor */
30 Bitfield(oc_tough, 1); /* hard gems/rings */
32 Bitfield(oc_dir, 2);
33 #define NODIR 1 /* for wands/spells: non-directional */
34 #define IMMEDIATE 2 /* directional */
35 #define RAY 3 /* zap beams */
37 #define PIERCE 1 /* for weapons & tools used as weapons */
38 #define SLASH 2 /* (latter includes iron ball & chain) */
39 #define WHACK 0
41 /*Bitfield(oc_subtyp,3);*/ /* Now too big for a bitfield... see below */
43 Bitfield(oc_material, 5);
44 #define LIQUID 1 /* currently only for venom */
45 #define WAX 2
46 #define VEGGY 3 /* foodstuffs */
47 #define FLESH 4 /* ditto */
48 #define PAPER 5
49 #define CLOTH 6
50 #define LEATHER 7
51 #define WOOD 8
52 #define BONE 9
53 #define DRAGON_HIDE 10 /* not leather! */
54 #define IRON 11 /* Fe - includes steel */
55 #define METAL 12 /* Sn, &c. */
56 #define COPPER 13 /* Cu - includes brass */
57 #define SILVER 14 /* Ag */
58 #define GOLD 15 /* Au */
59 #define PLATINUM 16 /* Pt */
60 #define MITHRIL 17
61 #define PLASTIC 18
62 #define GLASS 19
63 #define GEMSTONE 20
64 #define MINERAL 21
66 #define is_organic(otmp) (objects[otmp->otyp].oc_material <= WOOD)
67 #define is_metallic(otmp) \
68 (objects[otmp->otyp].oc_material >= IRON \
69 && objects[otmp->otyp].oc_material <= MITHRIL)
71 /* primary damage: fire/rust/--- */
72 /* is_flammable(otmp), is_rottable(otmp) in mkobj.c */
73 #define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON)
75 /* secondary damage: rot/acid/acid */
76 #define is_corrodeable(otmp) \
77 (objects[otmp->otyp].oc_material == COPPER \
78 || objects[otmp->otyp].oc_material == IRON)
80 #define is_damageable(otmp) \
81 (is_rustprone(otmp) || is_flammable(otmp) || is_rottable(otmp) \
82 || is_corrodeable(otmp))
84 schar oc_subtyp;
85 #define oc_skill oc_subtyp /* Skills of weapons, spellbooks, tools, gems */
86 #define oc_armcat oc_subtyp /* for armor */
87 #define ARM_SHIELD 1 /* needed for special wear function */
88 #define ARM_HELM 2
89 #define ARM_GLOVES 3
90 #define ARM_BOOTS 4
91 #define ARM_CLOAK 5
92 #define ARM_SHIRT 6
93 #define ARM_SUIT 0
95 uchar oc_oprop; /* property (invis, &c.) conveyed */
96 char oc_class; /* object class */
97 schar oc_delay; /* delay when using such an object */
98 uchar oc_color; /* color of the object */
100 short oc_prob; /* probability, used in mkobj() */
101 unsigned short oc_weight; /* encumbrance (1 cn = 0.1 lb.) */
102 short oc_cost; /* base cost in shops */
103 /* Check the AD&D rules! The FIRST is small monster damage. */
104 /* for weapons, and tools, rocks, and gems useful as weapons */
105 schar oc_wsdam, oc_wldam; /* max small/large monster damage */
106 schar oc_oc1, oc_oc2;
107 #define oc_hitbon oc_oc1 /* weapons: "to hit" bonus */
109 #define a_ac oc_oc1 /* armor class, used in ARM_BONUS in do.c */
110 #define a_can oc_oc2 /* armor: used in mhitu.c */
111 #define oc_level oc_oc2 /* books: spell level */
113 unsigned short oc_nutrition; /* food value */
116 struct class_sym {
117 char sym;
118 const char *name;
119 const char *explain;
122 struct objdescr {
123 const char *oc_name; /* actual name */
124 const char *oc_descr; /* description when name unknown */
127 extern NEARDATA struct objclass objects[];
128 extern NEARDATA struct objdescr obj_descr[];
131 * All objects have a class. Make sure that all classes have a corresponding
132 * symbol below.
134 enum obj_class_types {
135 RANDOM_CLASS = 0, /* used for generating random objects */
136 ILLOBJ_CLASS,
137 WEAPON_CLASS,
138 ARMOR_CLASS,
139 RING_CLASS,
140 AMULET_CLASS,
141 TOOL_CLASS,
142 FOOD_CLASS,
143 POTION_CLASS,
144 SCROLL_CLASS,
145 SPBOOK_CLASS, /* actually SPELL-book */
146 WAND_CLASS,
147 COIN_CLASS,
148 GEM_CLASS,
149 ROCK_CLASS,
150 BALL_CLASS,
151 CHAIN_CLASS,
152 VENOM_CLASS,
154 MAXOCLASSES
157 #define ALLOW_COUNT (MAXOCLASSES + 1) /* Can be used in the object class */
158 #define ALL_CLASSES (MAXOCLASSES + 2) /* input to getobj(). */
159 #define ALLOW_NONE (MAXOCLASSES + 3)
161 #define BURNING_OIL (MAXOCLASSES + 1) /* Can be used as input to explode. */
162 #define MON_EXPLODE (MAXOCLASSES + 2) /* Exploding monster (e.g. gas spore) */
164 #if 0 /* moved to decl.h so that makedefs.c won't see them */
165 extern const struct class_sym
166 def_oc_syms[MAXOCLASSES]; /* default class symbols */
167 extern uchar oc_syms[MAXOCLASSES]; /* current class symbols */
168 #endif
170 /* Default definitions of all object-symbols (must match classes above). */
172 #define ILLOBJ_SYM ']' /* also used for mimics */
173 #define WEAPON_SYM ')'
174 #define ARMOR_SYM '['
175 #define RING_SYM '='
176 #define AMULET_SYM '"'
177 #define TOOL_SYM '('
178 #define FOOD_SYM '%'
179 #define POTION_SYM '!'
180 #define SCROLL_SYM '?'
181 #define SPBOOK_SYM '+'
182 #define WAND_SYM '/'
183 #define GOLD_SYM '$'
184 #define GEM_SYM '*'
185 #define ROCK_SYM '`'
186 #define BALL_SYM '0'
187 #define CHAIN_SYM '_'
188 #define VENOM_SYM '.'
190 struct fruit {
191 char fname[PL_FSIZ];
192 int fid;
193 struct fruit *nextf;
195 #define newfruit() (struct fruit *) alloc(sizeof(struct fruit))
196 #define dealloc_fruit(rind) free((genericptr_t)(rind))
198 #define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name)
199 #define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr)
200 #endif /* OBJCLASS_H */