1 /* SCCS Id: @(#)you.h 3.4 2000/05/21 */ 2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3 /* NetHack may be freely redistributed. See license for details. */ 4 5 #ifndef YOU_H 6 #define YOU_H 7 8 #include "attrib.h" 9 #include "monst.h" 10 #ifndef PROP_H 11 #include "prop.h" /* (needed here for util/makedefs.c) */ 12 #endif 13 #include "skills.h" 14 15 /*** Substructures ***/ 16 17 struct RoleName { 18 const char *m; /* name when character is male */ 19 const char *f; /* when female; null if same as male */ 20 }; 21 22 struct RoleAdvance { 23 /* "fix" is the fixed amount, "rnd" is the random amount */ 24 xchar infix, inrnd; /* at character initialization */ 25 xchar lofix, lornd; /* gained per level < urole.xlev */ 26 xchar hifix, hirnd; /* gained per level >= urole.xlev */ 27 }; 28 29 struct u_have { 30 Bitfield(amulet,1); /* carrying Amulet */ 31 Bitfield(bell,1); /* carrying Bell */ 32 Bitfield(book,1); /* carrying Book */ 33 Bitfield(menorah,1); /* carrying Candelabrum */ 34 Bitfield(questart,1); /* carrying the Quest Artifact */ 35 Bitfield(unused,3); 36 }; 37 38 struct u_event { 39 Bitfield(minor_oracle,1); /* received at least 1 cheap oracle */ 40 Bitfield(major_oracle,1); /* " expensive oracle */ 41 Bitfield(qcalled,1); /* called by Quest leader to do task */ 42 Bitfield(qexpelled,1); /* expelled from the Quest dungeon */ 43 Bitfield(qcompleted,1); /* successfully completed Quest task */ 44 Bitfield(uheard_tune,2); /* 1=know about, 2=heard passtune */ 45 Bitfield(uopened_dbridge,1); /* opened the drawbridge */ 46 47 Bitfield(invoked,1); /* invoked Gate to the Sanctum level */ 48 Bitfield(gehennom_entered,1); /* entered Gehennom via Valley */ 49 #ifdef ELBERETH 50 Bitfield(uhand_of_elbereth,2); /* became Hand of Elbereth */ 51 #endif 52 Bitfield(udemigod,1); /* killed the wiz */ 53 Bitfield(ascended,1); /* has offered the Amulet */ 54 }; 55 56 /* KMH, conduct -- 57 * These are voluntary challenges. Each field denotes the number of 58 * times a challenge has been violated. 59 */ 60 struct u_conduct { /* number of times... */ 61 long unvegetarian; /* eaten any animal */ 62 long unvegan; /* ... or any animal byproduct */ 63 long food; /* ... or any comestible */ 64 long gnostic; /* used prayer, priest, or altar */ 65 long weaphit; /* hit a monster with a weapon */ 66 long killer; /* killed a monster yourself */ 67 long literate; /* read something (other than BotD) */ 68 long polypiles; /* polymorphed an object */ 69 long polyselfs; /* transformed yourself */ 70 long wishes; /* used a wish */ 71 long wisharti; /* wished for an artifact */ 72 /* genocides already listed at end of game */ 73 }; 74 75 /*** Unified structure containing role information ***/ 76 struct Role { 77 /*** Strings that name various things ***/ 78 struct RoleName name; /* the role's name (from u_init.c) */ 79 struct RoleName rank[9]; /* names for experience levels (from botl.c) */ 80 const char *lgod, *ngod, *cgod; /* god names (from pray.c) */ 81 const char *filecode; /* abbreviation for use in file names */ 82 const char *homebase; /* quest leader's location (from questpgr.c) */ 83 const char *intermed; /* quest intermediate goal (from questpgr.c) */ 84 85 /*** Indices of important monsters and objects ***/ 86 short malenum, /* index (PM_) as a male (botl.c) */ 87 femalenum, /* ...or as a female (NON_PM == same) */ 88 petnum, /* PM_ of preferred pet (NON_PM == random) */ 89 ldrnum, /* PM_ of quest leader (questpgr.c) */ 90 guardnum, /* PM_ of quest guardians (questpgr.c) */ 91 neminum, /* PM_ of quest nemesis (questpgr.c) */ 92 enemy1num, /* specific quest enemies (NON_PM == random) */ 93 enemy2num; 94 char enemy1sym, /* quest enemies by class (S_) */ 95 enemy2sym; 96 short questarti; /* index (ART_) of quest artifact (questpgr.c) */ 97 98 /*** Bitmasks ***/ 99 short allow; /* bit mask of allowed variations */ 100 #define ROLE_RACEMASK 0x0ff8 /* allowable races */ 101 #define ROLE_GENDMASK 0xf000 /* allowable genders */ 102 #define ROLE_MALE 0x1000 103 #define ROLE_FEMALE 0x2000 104 #define ROLE_NEUTER 0x4000 105 #define ROLE_ALIGNMASK AM_MASK /* allowable alignments */ 106 #define ROLE_LAWFUL AM_LAWFUL 107 #define ROLE_NEUTRAL AM_NEUTRAL 108 #define ROLE_CHAOTIC AM_CHAOTIC 109 110 /*** Attributes (from attrib.c and exper.c) ***/ 111 xchar attrbase[A_MAX]; /* lowest initial attributes */ 112 xchar attrdist[A_MAX]; /* distribution of initial attributes */ 113 struct RoleAdvance hpadv; /* hit point advancement */ 114 struct RoleAdvance enadv; /* energy advancement */ 115 xchar xlev; /* cutoff experience level */ 116 xchar initrecord; /* initial alignment record */ 117 118 /*** Spell statistics (from spell.c) ***/ 119 int spelbase; /* base spellcasting penalty */ 120 int spelheal; /* penalty (-bonus) for healing spells */ 121 int spelshld; /* penalty for wearing any shield */ 122 int spelarmr; /* penalty for wearing metal armour */ 123 int spelstat; /* which stat (A_) is used */ 124 int spelspec; /* spell (SPE_) the class excels at */ 125 int spelsbon; /* penalty (-bonus) for that spell */ 126 127 /*** Properties in variable-length arrays ***/ 128 /* intrinsics (see attrib.c) */ 129 /* initial inventory (see u_init.c) */ 130 /* skills (see u_init.c) */ 131 132 /*** Don't forget to add... ***/ 133 /* quest leader, guardians, nemesis (monst.c) */ 134 /* quest artifact (artilist.h) */ 135 /* quest dungeon definition (dat/Xyz.dat) */ 136 /* quest text (dat/quest.txt) */ 137 /* dictionary entries (dat/data.bas) */ 138 }; 139 140 extern const struct Role roles[]; /* table of available roles */ 141 extern struct Role urole; 142 #define Role_if(X) (urole.malenum == (X)) 143 #define Role_switch (urole.malenum) 144 145 /* used during initialization for race, gender, and alignment 146 as well as for character class */ 147 #define ROLE_NONE (-1) 148 #define ROLE_RANDOM (-2) 149 150 /*** Unified structure specifying race information ***/ 151 152 struct Race { 153 /*** Strings that name various things ***/ 154 const char *noun; /* noun ("human", "elf") */ 155 const char *adj; /* adjective ("human", "elven") */ 156 const char *coll; /* collective ("humanity", "elvenkind") */ 157 const char *filecode; /* code for filenames */ 158 struct RoleName individual; /* individual as a noun ("man", "elf") */ 159 160 /*** Indices of important monsters and objects ***/ 161 short malenum, /* PM_ as a male monster */ 162 femalenum, /* ...or as a female (NON_PM == same) */ 163 mummynum, /* PM_ as a mummy */ 164 zombienum; /* PM_ as a zombie */ 165 166 /*** Bitmasks ***/ 167 short allow; /* bit mask of allowed variations */ 168 short selfmask, /* your own race's bit mask */ 169 lovemask, /* bit mask of always peaceful */ 170 hatemask; /* bit mask of always hostile */ 171 172 /*** Attributes ***/ 173 xchar attrmin[A_MAX]; /* minimum allowable attribute */ 174 xchar attrmax[A_MAX]; /* maximum allowable attribute */ 175 struct RoleAdvance hpadv; /* hit point advancement */ 176 struct RoleAdvance enadv; /* energy advancement */ 177 #if 0 /* DEFERRED */ 178 int nv_range; /* night vision range */ 179 int xray_range; /* X-ray vision range */ 180 #endif 181 182 /*** Properties in variable-length arrays ***/ 183 /* intrinsics (see attrib.c) */ 184 185 /*** Don't forget to add... ***/ 186 /* quest leader, guardians, nemesis (monst.c) */ 187 /* quest dungeon definition (dat/Xyz.dat) */ 188 /* quest text (dat/quest.txt) */ 189 /* dictionary entries (dat/data.bas) */ 190 }; 191 192 extern const struct Race races[]; /* Table of available races */ 193 extern struct Race urace; 194 #define Race_if(X) (urace.malenum == (X)) 195 #define Race_switch (urace.malenum) 196 197 /*** Unified structure specifying gender information ***/ 198 struct Gender { 199 const char *adj; /* male/female/neuter */ 200 const char *he; /* he/she/it */ 201 const char *him; /* him/her/it */ 202 const char *his; /* his/her/its */ 203 const char *filecode; /* file code */ 204 short allow; /* equivalent ROLE_ mask */ 205 }; 206 #define ROLE_GENDERS 2 /* number of permitted player genders */ 207 /* increment to 3 if you allow neuter roles */ 208 209 extern const struct Gender genders[]; /* table of available genders */ 210 #define uhe() (genders[flags.female ? 1 : 0].he) 211 #define uhim() (genders[flags.female ? 1 : 0].him) 212 #define uhis() (genders[flags.female ? 1 : 0].his) 213 #define mhe(mtmp) (genders[pronoun_gender(mtmp)].he) 214 #define mhim(mtmp) (genders[pronoun_gender(mtmp)].him) 215 #define mhis(mtmp) (genders[pronoun_gender(mtmp)].his) 216 217 218 /*** Unified structure specifying alignment information ***/ 219 struct Align { 220 const char *noun; /* law/balance/chaos */ 221 const char *adj; /* lawful/neutral/chaotic */ 222 const char *filecode; /* file code */ 223 short allow; /* equivalent ROLE_ mask */ 224 aligntyp value; /* equivalent A_ value */ 225 }; 226 #define ROLE_ALIGNS 3 /* number of permitted player alignments */ 227 228 extern const struct Align aligns[]; /* table of available alignments */ 229 230 231 /*** Information about the player ***/ 232 struct you { 233 xchar ux, uy; 234 schar dx, dy, dz; /* direction of move (or zap or ... ) */ 235 schar di; /* direction of FF */ 236 xchar tx, ty; /* destination of travel */ 237 xchar ux0, uy0; /* initial position FF */ 238 d_level uz, uz0; /* your level on this and the previous turn */ 239 d_level utolev; /* level monster teleported you to, or uz */ 240 uchar utotype; /* bitmask of goto_level() flags for utolev */ 241 boolean umoved; /* changed map location (post-move) */ 242 int last_str_turn; /* 0: none, 1: half turn, 2: full turn */ 243 /* +: turn right, -: turn left */ 244 int ulevel; /* 1 to MAXULEV */ 245 int ulevelmax; 246 unsigned utrap; /* trap timeout */ 247 unsigned utraptype; /* defined if utrap nonzero */ 248 #define TT_BEARTRAP 0 249 #define TT_PIT 1 250 #define TT_WEB 2 251 #define TT_LAVA 3 252 #define TT_INFLOOR 4 253 char urooms[5]; /* rooms (roomno + 3) occupied now */ 254 char urooms0[5]; /* ditto, for previous position */ 255 char uentered[5]; /* rooms (roomno + 3) entered this turn */ 256 char ushops[5]; /* shop rooms (roomno + 3) occupied now */ 257 char ushops0[5]; /* ditto, for previous position */ 258 char ushops_entered[5]; /* ditto, shops entered this turn */ 259 char ushops_left[5]; /* ditto, shops exited this turn */ 260 261 int uhunger; /* refd only in eat.c and shk.c */ 262 unsigned uhs; /* hunger state - see eat.c */ 263 264 struct prop uprops[LAST_PROP+1]; 265 266 unsigned umconf; 267 char usick_cause[PL_PSIZ+20]; /* sizeof "unicorn horn named "+1 */ 268 Bitfield(usick_type,2); 269 #define SICK_VOMITABLE 0x01 270 #define SICK_NONVOMITABLE 0x02 271 #define SICK_ALL 0x03 272 273 /* These ranges can never be more than MAX_RANGE (vision.h). */ 274 int nv_range; /* current night vision range */ 275 int xray_range; /* current xray vision range */ 276 277 /* 278 * These variables are valid globally only when punished and blind. 279 */ 280 #define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */ 281 #define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */ 282 int bglyph; /* glyph under the ball */ 283 int cglyph; /* glyph under the chain */ 284 int bc_order; /* ball & chain order [see bc_order() in ball.c] */ 285 int bc_felt; /* mask for ball/chain being felt */ 286 287 int umonster; /* hero's "real" monster num */ 288 int umonnum; /* current monster number */ 289 290 int mh, mhmax, mtimedone; /* for polymorph-self */ 291 struct attribs macurr, /* for monster attribs */ 292 mamax; /* for monster attribs */ 293 int ulycn; /* lycanthrope type */ 294 295 unsigned ucreamed; 296 unsigned uswldtim; /* time you have been swallowed */ 297 298 Bitfield(uswallow,1); /* true if swallowed */ 299 Bitfield(uinwater,1); /* if you're currently in water (only 300 underwater possible currently) */ 301 Bitfield(uundetected,1); /* if you're a hiding monster/piercer */ 302 Bitfield(mfemale,1); /* saved human value of flags.female */ 303 Bitfield(uinvulnerable,1); /* you're invulnerable (praying) */ 304 Bitfield(uburied,1); /* you're buried */ 305 Bitfield(uedibility,1); /* blessed food detection; sense unsafe food */ 306 /* 1 free bit! */ 307 308 unsigned udg_cnt; /* how long you have been demigod */ 309 struct u_event uevent; /* certain events have happened */ 310 struct u_have uhave; /* you're carrying special objects */ 311 struct u_conduct uconduct; /* KMH, conduct */ 312 struct attribs acurr, /* your current attributes (eg. str)*/ 313 aexe, /* for gain/loss via "exercise" */ 314 abon, /* your bonus attributes (eg. str) */ 315 amax, /* your max attributes (eg. str) */ 316 atemp, /* used for temporary loss/gain */ 317 atime; /* used for loss/gain countdown */ 318 align ualign; /* character alignment */ 319 #define CONVERT 2 320 #define A_ORIGINAL 1 321 #define A_CURRENT 0 322 aligntyp ualignbase[CONVERT]; /* for ualign conversion record */ 323 schar uluck, moreluck; /* luck and luck bonus */ 324 #define Luck (u.uluck + u.moreluck) 325 #define LUCKADD 3 /* added value when carrying luck stone */ 326 #define LUCKMAX 10 /* on moonlit nights 11 */ 327 #define LUCKMIN (-10) 328 schar uhitinc; 329 schar udaminc; 330 schar uac; 331 uchar uspellprot; /* protection by SPE_PROTECTION */ 332 uchar usptime; /* #moves until uspellprot-- */ 333 uchar uspmtime; /* #moves between uspellprot-- */ 334 int uhp,uhpmax; 335 int uen, uenmax; /* magical energy - M. Stephenson */ 336 int ugangr; /* if the gods are angry at you */ 337 int ugifts; /* number of artifacts bestowed */ 338 int ublessed, ublesscnt; /* blessing/duration from #pray */ 339 #ifndef GOLDOBJ 340 long ugold, ugold0; 341 #else 342 long umoney0; 343 #endif 344 long uexp, urexp; 345 long ucleansed; /* to record moves when player was cleansed */ 346 long usleep; /* sleeping; monstermove you last started */ 347 int uinvault; 348 struct monst *ustuck; 349 #ifdef STEED 350 struct monst *usteed; 351 long ugallop; 352 int urideturns; 353 #endif 354 int umortality; /* how many times you died */ 355 int ugrave_arise; /* you die and become something aside from a ghost */ 356 time_t ubirthday; /* real world time when game began */ 357 358 int weapon_slots; /* unused skill slots */ 359 int skills_advanced; /* # of advances made so far */ 360 xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */ 361 struct skills weapon_skills[P_NUM_SKILLS]; 362 boolean twoweap; /* KMH -- Using two-weapon combat */ 363 364 }; /* end of `struct you' */ 365 366 #define Upolyd (u.umonnum != u.umonster) 367 368 #endif /* YOU_H */ 369