Source:NetHack 3.2.0/you.h
Revision as of 10:02, 4 March 2008 by Kernigh bot (talk | contribs) (NetHack 3.2.0/you.h moved to Source:NetHack 3.2.0/you.h: Robot: moved page)
Below is the full text to you.h from the source code of NetHack 3.2.0. To link to a particular line, write [[NetHack 3.2.0/you.h#line123]], for example.
Warning! This is the source code from an old release. For the latest release, see 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.2 95/08/13 */ 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. #ifndef ALIGN_H 9. #include "align.h" 10. #endif 11. #ifndef ATTRIB_H 12. #include "attrib.h" 13. #endif 14. #ifndef MONST_H 15. #include "monst.h" 16. #endif 17. #ifndef YOUPROP_H 18. #include "youprop.h" 19. #endif 20. 21. /* 22. * [this stuff should be moved into a separate "weapon.h" file] 23. */ 24. #ifdef WEAPON_SKILLS 25. 26. /* Weapon Skills - Stephen White */ 27. #define P_DAGGER 0 28. #define P_KNIFE 1 29. #define P_AXE 2 30. #define P_PICK_AXE 3 31. #define P_SHORT_SWORD 4 32. #define P_BROAD_SWORD 5 33. #define P_LONG_SWORD 6 34. #define P_TWO_HANDED_SWORD 7 35. #define P_SCIMITAR 8 36. #define P_SABER 9 37. #define P_CLUB 10 38. #define P_MACE 11 39. #define P_MORNING_STAR 12 40. #define P_FLAIL 13 41. #define P_HAMMER 14 42. #define P_QUARTERSTAFF 15 43. #define P_POLEARMS 16 44. #define P_SPEAR 17 45. #define P_JAVELIN 18 46. #define P_TRIDENT 19 47. #define P_LANCE 20 48. #define P_BOW 21 49. #define P_SLING 22 50. #define P_CROSSBOW 23 51. #define P_DART 24 52. #define P_SHURIKEN 25 53. #define P_BOOMERANG 26 54. #define P_WHIP 27 55. #define P_UNICORN_HORN 28 /* last weapon */ 56. #define P_TWO_WEAPON_COMBAT 29 57. #define P_BARE_HANDED_COMBAT 30 58. #define P_MARTIAL_ARTS 31 /* currently unused */ 59. #define P_NUM_SKILLS 32 /* should always be the last entry */ 60. 61. #define P_NO_TYPE P_NUM_SKILLS 62. #define P_LAST_WEAPON P_UNICORN_HORN 63. 64. /* 65. * These are the standard weapon skill levels. It is important that 66. * the lowest "valid" skill be be 1. The code calculates the 67. * previous amount to practice by calling practice_needed_to_advance() 68. * with the current skill-1. To work out for the UNSKILLED case, 69. * a value of 0 needed. 70. */ 71. #define P_ISRESTRICTED 0 72. #define P_UNSKILLED 1 73. #define P_BASIC 2 74. #define P_SKILLED 3 75. #define P_EXPERT 4 76. 77. #define practice_needed_to_advance(level) ((level)*(level)*20) 78. 79. /* The hero's skill in various weapons. */ 80. struct skills { 81. xchar skill; 82. xchar max_skill; 83. unsigned short advance; 84. }; 85. 86. #define P_SKILL(type) (u.weapon_skills[type].skill) 87. #define P_MAX_SKILL(type) (u.weapon_skills[type].max_skill) 88. #define P_ADVANCE(type) (u.weapon_skills[type].advance) 89. #define P_RESTRICTED(type) (u.weapon_skills[type].skill == P_ISRESTRICTED) 90. 91. #define PN_POLEARMS (NUM_OBJECTS+0) 92. #define PN_TWO_WEAPON_COMBAT (NUM_OBJECTS+1) 93. #define PN_BARE_HANDED_COMBAT (NUM_OBJECTS+2) 94. #define PN_MARTIAL_ARTS (NUM_OBJECTS+3) 95. #define PN_SABER (NUM_OBJECTS+4) 96. 97. #define P_SKILL_LIMIT 60 /* max number of skill advancements */ 98. 99. /* initial skill matrix structure; used in u_init.c and weapon.c */ 100. struct def_skill { 101. xchar skill; 102. xchar skmax; 103. }; 104. 105. #endif /* WEAPON_SKILLS */ 106. 107. 108. struct prop { 109. 110. #define TIMEOUT 007777 /* mask */ 111. 112. #define LEFT_RING W_RINGL /* 010000L */ 113. #define RIGHT_RING W_RINGR /* 020000L */ 114. #define LEFT_SIDE LEFT_RING 115. #define RIGHT_SIDE RIGHT_RING 116. #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) 117. 118. #define WORN_ARMOR W_ARM /* 040000L */ 119. #define WORN_CLOAK W_ARMC /* 0100000L */ 120. #define WORN_HELMET W_ARMH /* 0200000L */ 121. #define WORN_SHIELD W_ARMS /* 0400000L */ 122. #define WORN_GLOVES W_ARMG /* 01000000L */ 123. #define WORN_BOOTS W_ARMF /* 02000000L */ 124. #define WORN_AMUL W_AMUL /* 04000000L */ 125. #define WORN_BLINDF W_TOOL /* 010000000L */ 126. #ifdef TOURIST 127. #define WORN_SHIRT W_ARMU /* 01000L */ 128. #endif 129. 130. /* 131. * FROMEXPER is for a property gained by virtue of your experience level, 132. * which will be lost if you lose that level; FROMOUTSIDE is one that is 133. * gained in some other way (e.g., a throne, a prayer, or a corpse). 134. * INTRINSIC is either FROMEXPER or FROMOUTSIDE 135. */ 136. #define FROMOUTSIDE 0200000000L 137. #define FROMEXPER 0400000000L 138. #define INTRINSIC (FROMOUTSIDE|FROMEXPER) 139. 140. /* 141. * Sometimes an intrinsic may be overridden or controllable. 142. */ 143. #define I_BLOCKED 01000000000L 144. #define I_SPECIAL 02000000000L 145. 146. long p_flgs; 147. }; 148. 149. struct u_have { 150. Bitfield(amulet,1); /* carrying Amulet */ 151. Bitfield(bell,1); /* carrying Bell */ 152. Bitfield(book,1); /* carrying Book */ 153. Bitfield(menorah,1); /* carrying Candelabrum */ 154. Bitfield(questart,1); /* carrying the Quest Artifact */ 155. Bitfield(unused,3); 156. }; 157. 158. struct u_event { 159. Bitfield(minor_oracle,1); /* received at least 1 cheap oracle */ 160. Bitfield(major_oracle,1); /* " expensive oracle */ 161. Bitfield(qcalled,1); /* called by Quest leader to do task */ 162. Bitfield(qexpelled,1); /* expelled from the Quest dungeon */ 163. Bitfield(qcompleted,1); /* successfully completed Quest task */ 164. Bitfield(uheard_tune,2); /* 1=know about, 2=heard passtune */ 165. Bitfield(uopened_dbridge,1); /* opened the drawbridge */ 166. 167. Bitfield(invoked,1); /* invoked Gate to the Sanctum level */ 168. Bitfield(gehennom_entered,1); /* entered Gehennom via Valley */ 169. #ifdef ELBERETH 170. Bitfield(uhand_of_elbereth,2); /* became Hand of Elbereth */ 171. #endif 172. Bitfield(udemigod,1); /* killed the wiz */ 173. Bitfield(ascended,1); /* has offered the Amulet */ 174. }; 175. 176. 177. struct you { 178. xchar ux, uy; 179. schar dx, dy, dz; /* direction of move (or zap or ... ) */ 180. schar di; /* direction of FF */ 181. xchar ux0, uy0; /* initial position FF */ 182. d_level uz, uz0; /* your level on this and the previous turn */ 183. d_level utolev; /* level monster teleported you to, or uz */ 184. uchar utotype; /* bitmask of goto_level() flags for utolev */ 185. char role; /* 'A'==archeologist, 'K'==knight, &c */ 186. char usym; /* usually '@' */ 187. boolean umoved; /* changed map location (post-move) */ 188. int last_str_turn; /* 0: none, 1: half turn, 2: full turn */ 189. /* +: turn right, -: turn left */ 190. int ulevel; /* 1 - MAXULEV */ 191. unsigned utrap; /* trap timeout */ 192. unsigned utraptype; /* defined if utrap nonzero */ 193. #define TT_BEARTRAP 0 194. #define TT_PIT 1 195. #define TT_WEB 2 196. #define TT_LAVA 3 197. #define TT_INFLOOR 4 198. char urooms[5]; /* rooms (roomno + 3) occupied now */ 199. char urooms0[5]; /* ditto, for previous position */ 200. char uentered[5]; /* rooms (roomno + 3) entered this turn */ 201. char ushops[5]; /* shop rooms (roomno + 3) occupied now */ 202. char ushops0[5]; /* ditto, for previous position */ 203. char ushops_entered[5]; /* ditto, shops entered this turn */ 204. char ushops_left[5]; /* ditto, shops exited this turn */ 205. 206. int uhunger; /* refd only in eat.c and shk.c */ 207. unsigned uhs; /* hunger state - see eat.c */ 208. 209. struct prop uprops[LAST_PROP+1]; 210. 211. unsigned umconf; 212. char usick_cause[PL_PSIZ+20]; /* sizeof "unicorn horn named "+1 */ 213. Bitfield(usick_type,2); 214. #define SICK_VOMITABLE 0x01 215. #define SICK_NONVOMITABLE 0x02 216. #define SICK_ALL 0x03 217. 218. /* For messages referring to hands, eyes, feet, etc... when polymorphed */ 219. #define ARM 0 220. #define EYE 1 221. #define FACE 2 222. #define FINGER 3 223. #define FINGERTIP 4 224. #define FOOT 5 225. #define HAND 6 226. #define HANDED 7 227. #define HEAD 8 228. #define LEG 9 229. #define LIGHT_HEADED 10 230. #define NECK 11 231. #define SPINE 12 232. #define TOE 13 233. #define HAIR 14 234. 235. /* These ranges can never be more than MAX_RANGE (vision.h). */ 236. int nv_range; /* current night vision range */ 237. int xray_range; /* current xray vision range */ 238. 239. /* 240. * These variables are valid globally only when punished and blind. 241. */ 242. #define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */ 243. #define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */ 244. int bglyph; /* glyph under the ball */ 245. int cglyph; /* glyph under the chain */ 246. int bc_order; /* ball & chain order [see bc_order() in ball.c] */ 247. int bc_felt; /* mask for ball/chain being felt */ 248. 249. 250. /* 251. * Player type monster (e.g. PM_VALKYRIE). This is set in u_init 252. * and never changed afterward. 253. */ 254. int umonster; 255. int umonnum; /* monster number or -1 */ 256. int mh, mhmax, mtimedone; /* for polymorph-self */ 257. struct attribs macurr, /* for monster attribs */ 258. mamax; /* for monster attribs */ 259. int ulycn; /* lycanthrope type */ 260. 261. unsigned ucreamed; 262. unsigned uswldtim; /* time you have been swallowed */ 263. 264. Bitfield (uswallow,1); /* true if swallowed */ 265. Bitfield(uinwater,1); /* if you're currently in water (only 266. underwater possible currently) */ 267. Bitfield(uundetected,1); /* if you're a hiding monster/piercer */ 268. Bitfield(mfemale,1); /* saved human value of flags.female */ 269. Bitfield(uinvulnerable,1); /* you're invulnerable (praying) */ 270. Bitfield(uburied,1); /* you're buried */ 271. /* 2 free bits! */ 272. 273. unsigned udg_cnt; /* how long you have been demigod */ 274. struct u_event uevent; /* certain events have happened */ 275. struct u_have uhave; /* you're carrying special objects */ 276. struct attribs acurr, /* your current attributes (eg. str)*/ 277. aexe, /* for gain/loss via "exercise" */ 278. abon, /* your bonus attributes (eg. str) */ 279. amax, /* your max attributes (eg. str) */ 280. atemp, /* used for temporary loss/gain */ 281. atime; /* used for loss/gain countdown */ 282. align ualign; /* character alignment */ 283. #define CONVERT 2 284. aligntyp ualignbase[CONVERT]; /* for ualign conversion record */ 285. schar uluck, moreluck; /* luck and luck bonus */ 286. #define LUCKADD 3 /* added value when carrying luck stone */ 287. #define Luck (u.uluck + u.moreluck) 288. #define LUCKMAX 10 /* on moonlit nights 11 */ 289. #define LUCKMIN (-10) 290. schar udaminc; 291. schar uac; 292. int uhp,uhpmax; 293. int uen, uenmax; /* magical energy - M. Stephenson */ 294. int ugangr; /* if the gods are angry at you */ 295. int ublessed, ublesscnt; /* blessing/duration from #pray */ 296. long ugold, ugold0; 297. long uexp, urexp; 298. long ucleansed; /* to record moves when player was cleansed */ 299. long usleep; /* sleeping; monstermove you last started */ 300. int uinvault; 301. struct monst *ustuck; 302. int umortality; /* how many times you died */ 303. int ugrave_arise; /* you die and become something aside from a ghost */ 304. time_t ubirthday; /* real world time when game began */ 305. 306. #ifdef WEAPON_SKILLS 307. int weapon_slots; /* unused skill slots */ 308. int skills_advanced; /* # of advances made so far */ 309. xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */ 310. struct skills weapon_skills[P_NUM_SKILLS]; 311. #endif /* WEAPON_SKILLS */ 312. 313. }; /* end of `struct you' */ 314. 315. #define Role_is(X) (u.role == X) 316. #define human_role() (!Role_is('E')) 317. #define Upolyd (u.mtimedone != 0) 318. 319. #endif /* YOU_H */