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