1 /* SCCS Id: @(#)objclass.h 3.4 1996/06/16 */ 2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3 /* NetHack may be freely redistributed. See license for details. */ 4 5 #ifndef OBJCLASS_H 6 #define OBJCLASS_H 7 8 /* definition of a class of objects */ 9 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 decription */ 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 */ 26 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 */ 31 32 Bitfield(oc_dir,3); 33 #define NODIR 1 /* for wands/spells: non-directional */ 34 #define IMMEDIATE 2 /* directional */ 35 #define RAY 3 /* zap beams */ 36 37 #define PIERCE 1 /* for weapons & tools used as weapons */ 38 #define SLASH 2 /* (latter includes iron ball & chain) */ 39 #define EXPLOSION 4 /* (rockets, grenades) */ 40 #define WHACK 0 41 42 Bitfield(oc_material,5); 43 #define LIQUID 1 /* currently only for venom */ 44 #define WAX 2 45 #define VEGGY 3 /* foodstuffs */ 46 #define FLESH 4 /* ditto */ 47 #define PAPER 5 48 #define CLOTH 6 49 #define LEATHER 7 50 #define WOOD 8 51 #define BONE 9 52 #define DRAGON_HIDE 10 /* not leather! */ 53 #define IRON 11 /* Fe - includes steel */ 54 #define METAL 12 /* Sn, &c. */ 55 #define COPPER 13 /* Cu - includes brass */ 56 #define SILVER 14 /* Ag */ 57 #define GOLD 15 /* Au */ 58 #define PLATINUM 16 /* Pt */ 59 #define MITHRIL 17 60 #define PLASTIC 18 61 #define GLASS 19 62 #define GEMSTONE 20 63 #define MINERAL 21 64 65 #define is_organic(otmp) (objects[(otmp)->otyp].oc_material <= WOOD) 66 #define is_metallic(otmp) (objects[(otmp)->otyp].oc_material >= IRON && \ 67 objects[(otmp)->otyp].oc_material <= MITHRIL) 68 69 /* primary damage: fire/rust/--- */ 70 /* is_flammable(otmp), is_rottable(otmp) in mkobj.c */ 71 #define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON) 72 73 /* secondary damage: rot/acid/acid */ 74 #define is_corrodeable(otmp) (objects[otmp->otyp].oc_material == COPPER || objects[otmp->otyp].oc_material == IRON) 75 76 #define is_damageable(otmp) (is_rustprone(otmp) || is_flammable(otmp) || \ 77 is_rottable(otmp) || is_corrodeable(otmp)) 78 79 schar oc_subtyp; 80 /* Bitfield(oc_subtyp,3);*/ /* Now too big for a bitfield */ 81 #define oc_skill oc_subtyp /* for weapons, spellbooks, tools, gems */ 82 #define oc_armcat oc_subtyp /* for armor */ 83 #define ARM_SHIELD 1 /* needed for special wear function */ 84 #define ARM_HELM 2 85 #define ARM_GLOVES 3 86 #define ARM_BOOTS 4 87 #define ARM_CLOAK 5 88 #define ARM_SHIRT 6 89 #define ARM_SUIT 0 90 91 uchar oc_oprop; /* property (invis, &c.) conveyed */ 92 char oc_class; /* object class */ 93 schar oc_delay; /* delay when using such an object */ 94 uchar oc_color; /* color of the object */ 95 96 short oc_prob; /* probability, used in mkobj() */ 97 unsigned short oc_weight; /* encumbrance (1 cn = 0.1 lb.) */ 98 short oc_cost; /* base cost in shops */ 99 /* Check the AD&D rules! The FIRST is small monster damage. */ 100 /* for weapons, and tools, rocks, and gems useful as weapons */ 101 schar oc_wsdam, oc_wldam; /* max small/large monster damage */ 102 #define oc_range oc_wsdam /* for strength independant ranged weapons */ 103 #define oc_rof oc_wldam /* rate of fire bonus for ranged weapons */ 104 105 schar oc_oc1, oc_oc2; 106 #define oc_hitbon oc_oc1 /* weapons: "to hit" bonus */ 107 #define w_ammotyp oc_oc2 /* type of ammo taken by ranged weapon */ 108 #define WP_GENERIC 0 /* all ammo subclasses ok */ 109 #define WP_BULLET 1 110 #define WP_SHELL 2 111 #define WP_ROCKET 3 112 #define WP_GRENADE 4 113 114 #define a_ac oc_oc1 /* armor class, used in ARM_BONUS in do.c */ 115 #define a_can oc_oc2 /* armor: used in mhitu.c */ 116 #define oc_level oc_oc2 /* books: spell level */ 117 118 unsigned short oc_nutrition; /* food value */ 119 }; 120 121 struct objdescr { 122 const char *oc_name; /* actual name */ 123 const char *oc_descr; /* description when name unknown */ 124 }; 125 126 extern NEARDATA struct objclass objects[]; 127 extern NEARDATA struct objdescr obj_descr[]; 128 129 /* 130 * All objects have a class. Make sure that all classes have a corresponding 131 * symbol below. 132 */ 133 #define RANDOM_CLASS 0 /* used for generating random objects */ 134 #define ILLOBJ_CLASS 1 135 #define WEAPON_CLASS 2 136 #define ARMOR_CLASS 3 137 #define RING_CLASS 4 138 #define AMULET_CLASS 5 139 #define TOOL_CLASS 6 140 #define FOOD_CLASS 7 141 #define POTION_CLASS 8 142 #define SCROLL_CLASS 9 143 #define SPBOOK_CLASS 10 /* actually SPELL-book */ 144 #define WAND_CLASS 11 145 #define COIN_CLASS 12 146 #define GEM_CLASS 13 147 #define ROCK_CLASS 14 148 #define BALL_CLASS 15 149 #define CHAIN_CLASS 16 150 #define VENOM_CLASS 17 151 #define MAXOCLASSES 18 152 153 #define ALLOW_COUNT (MAXOCLASSES+1) /* Can be used in the object class */ 154 #define ALL_CLASSES (MAXOCLASSES+2) /* input to getobj(). */ 155 #define ALLOW_NONE (MAXOCLASSES+3) /* */ 156 #define ALLOW_FLOOROBJ (MAXOCLASSES+4) /* */ 157 #define ALLOW_THISPLACE (MAXOCLASSES+5) /* */ 158 159 #define BURNING_OIL (MAXOCLASSES+1) /* Can be used as input to explode. */ 160 #define MON_EXPLODE (MAXOCLASSES+2) /* Exploding monster (e.g. gas spore) */ 161 162 #if 0 /* moved to decl.h so that makedefs.c won't see them */ 163 extern const char def_oc_syms[MAXOCLASSES]; /* default class symbols */ 164 extern uchar oc_syms[MAXOCLASSES]; /* current class symbols */ 165 #endif 166 167 /* Default definitions of all object-symbols (must match classes above). */ 168 169 #define ILLOBJ_SYM ']' /* also used for mimics */ 170 #define WEAPON_SYM ')' 171 #define ARMOR_SYM '[' 172 #define RING_SYM '=' 173 #define AMULET_SYM '"' 174 #define TOOL_SYM '(' 175 #define FOOD_SYM '%' 176 #define POTION_SYM '!' 177 #define SCROLL_SYM '?' 178 #define SPBOOK_SYM '+' 179 #define WAND_SYM '/' 180 #define GOLD_SYM '$' 181 #define GEM_SYM '*' 182 #define ROCK_SYM '`' 183 #define BALL_SYM '0' 184 #define CHAIN_SYM '_' 185 #define VENOM_SYM '.' 186 187 struct fruit { 188 char fname[PL_FSIZ]; 189 int fid; 190 struct fruit *nextf; 191 }; 192 #define newfruit() (struct fruit *)alloc(sizeof(struct fruit)) 193 #define dealloc_fruit(rind) free((genericptr_t) (rind)) 194 195 #define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name) 196 #define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr) 197 #endif /* OBJCLASS_H */ 198