Source:NetHack 5.0.0/include/botl.h
Jump to navigation
Jump to search
Below is the full text to botl.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/botl.h#line12]], for example.
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. /* NetHack 5.0 botl.h $NHDT-Date: 1694893330 2023/09/16 19:42:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.37 $ */ 2. /* Copyright (c) Michael Allison, 2003 */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef BOTL_H 6. #define BOTL_H 7. 8. /* Note: this comment is about the pre-VIA_WINDOWPORT two line status 9. * which is still available but has not added a bunch of conditional 10. * extra status conditions (Grab, InLava, Held, Zzz and many others) 11. * or the new fields Weapon, Armor, and Terrain. 12. * 13. * MAXCO must hold longest uncompressed status line, and must be larger 14. * than COLNO 15. * 16. * longest practical second status line at the moment is 17. Astral Plane \GXXXXNNNN:123456 HP:1234(1234) Pw:1234(1234) AC:-127 18. Xp:30/123456789 T:123456 Stone Slime Strngl FoodPois TermIll 19. Satiated Overloaded Blind Deaf Stun Conf Hallu Lev Ride 20. * -- or about 185 characters. '$' gets encoded even when it 21. * could be used as-is. The first five status conditions are fatal 22. * so it's rare to have more than one at a time. 23. * 24. * When the full line is wider than the map, the basic status line 25. * formatting will move less important fields to the end, so if/when 26. * truncation is necessary, it will chop off the least significant 27. * information. 28. */ 29. #if COLNO <= 160 30. #define MAXCO 200 31. #else 32. #define MAXCO (COLNO + 40) 33. #endif 34. 35. /* limit of the player's name in the status window */ 36. #define BOTL_NSIZ 16 37. 38. struct condmap { 39. const char *id; 40. unsigned long bitmask; 41. }; 42. 43. enum statusfields { 44. BL_CHARACTERISTICS = -3, /* alias for BL_STR..BL_CH */ 45. BL_RESET = -2, /* Force everything to redisplay */ 46. BL_FLUSH = -1, /* Finished cycling through bot fields */ 47. /* 48. * Note: status_sanity_check() in wintty.c has strings for the rest 49. * of these, so if any get renumbered or more get added, be sure to 50. * keep those in sync. 51. */ 52. BL_TITLE = 0, 53. BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, /* 1.. 6 */ 54. BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, /* 7..10 */ 55. BL_ENE, BL_ENEMAX, BL_XP, BL_AC, BL_HD, /* 11..15 */ 56. BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, /* 16..19 */ 57. BL_LEVELDESC, BL_EXP, BL_CONDITION, /* 20..22 */ 58. BL_WEAPON, BL_ARMOR, BL_TERRAIN, /* 23..25 */ 59. BL_VERS, /* 26 */ 60. MAXBLSTATS /* [27] */ 61. }; 62. 63. enum relationships { 64. NO_LTEQGT = -1, 65. EQ_VALUE, LT_VALUE, LE_VALUE, 66. GE_VALUE, GT_VALUE, TXT_VALUE 67. }; 68. 69. enum blconditions { 70. bl_bareh, /* deprecated -- bl_weapon encompasses this */ 71. bl_blind, 72. bl_busy, 73. bl_conf, 74. bl_deaf, 75. bl_elf_iron, 76. bl_fly, 77. bl_foodpois, 78. bl_glowhands, 79. bl_grab, 80. bl_hallu, 81. bl_held, 82. bl_icy, /* bl_terrain encompasses this */ 83. bl_inlava, 84. bl_lev, 85. bl_parlyz, 86. bl_ride, 87. bl_sleeping, 88. bl_slime, 89. bl_slippery, 90. bl_stone, 91. bl_strngl, 92. bl_stun, 93. bl_submerged, /* bl_terrain encompasses this */ 94. bl_termill, 95. bl_tethered, 96. bl_trapped, 97. bl_unconsc, 98. bl_woundedl, 99. bl_holding, 100. 101. CONDITION_COUNT 102. }; 103. 104. /* Boolean condition bits for the condition mask */ 105. 106. /* clang-format off */ 107. #define BL_MASK_BAREH 0x00000001L 108. #define BL_MASK_BLIND 0x00000002L 109. #define BL_MASK_BUSY 0x00000004L 110. #define BL_MASK_CONF 0x00000008L 111. #define BL_MASK_DEAF 0x00000010L 112. #define BL_MASK_ELF_IRON 0x00000020L 113. #define BL_MASK_FLY 0x00000040L 114. #define BL_MASK_FOODPOIS 0x00000080L 115. #define BL_MASK_GLOWHANDS 0x00000100L 116. #define BL_MASK_GRAB 0x00000200L 117. #define BL_MASK_HALLU 0x00000400L 118. #define BL_MASK_HELD 0x00000800L 119. #define BL_MASK_ICY 0x00001000L 120. #define BL_MASK_INLAVA 0x00002000L 121. #define BL_MASK_LEV 0x00004000L 122. #define BL_MASK_PARLYZ 0x00008000L 123. #define BL_MASK_RIDE 0x00010000L 124. #define BL_MASK_SLEEPING 0x00020000L 125. #define BL_MASK_SLIME 0x00040000L 126. #define BL_MASK_SLIPPERY 0x00080000L 127. #define BL_MASK_STONE 0x00100000L 128. #define BL_MASK_STRNGL 0x00200000L 129. #define BL_MASK_STUN 0x00400000L 130. #define BL_MASK_SUBMERGED 0x00800000L 131. #define BL_MASK_TERMILL 0x01000000L 132. #define BL_MASK_TETHERED 0x02000000L 133. #define BL_MASK_TRAPPED 0x04000000L 134. #define BL_MASK_UNCONSC 0x08000000L 135. #define BL_MASK_WOUNDEDL 0x10000000L 136. #define BL_MASK_HOLDING 0x20000000L 137. #define BL_MASK_BITS 30 /* number of mask bits that can be set */ 138. /* clang-format on */ 139. 140. struct conditions_t { 141. int ranking; 142. long mask; 143. enum blconditions c; 144. const char *text[3]; 145. }; 146. extern const struct conditions_t conditions[CONDITION_COUNT]; 147. 148. struct condtests_t { 149. enum blconditions c; 150. const char *useroption; 151. enum optchoice opt; 152. boolean enabled; 153. boolean choice; 154. boolean test; 155. }; 156. 157. extern struct condtests_t condtests[CONDITION_COUNT]; 158. extern int cond_idx[CONDITION_COUNT]; 159. 160. #define BEFORE 0 161. #define NOW 1 162. 163. /* 164. * Possible additional conditions: 165. * major: 166. * grab - grabbed by eel so about to be drowned ("wrapd"? damage type 167. * is AD_WRAP but message is "<mon> swings itself around you") 168. * digst - swallowed and being digested 169. * lava - trapped sinking into lava 170. * in_between: (potentially severe but don't necessarily lead to death; 171. * explains to player why he isn't getting to take any turns) 172. * unconc - unconscious 173. * parlyz - (multi < 0 && (!strncmp(multi_reason, "paralyzed", 9) 174. * || !strncmp(multi_reason, "frozen", 6))) 175. * asleep - (multi < 0 && !strncmp(multi_reason, "sleeping", 8)) 176. * busy - other multi < 0 177. * minor: 178. * held - grabbed by non-eel or by eel but not susceptible to drowning 179. * englf - engulfed or swallowed but not being digested (usually 180. * obvious but the blank symbol set makes that uncertain) 181. * vomit - vomiting (causes confusion and stun late in countdown) 182. * trap - trapped in pit, bear trap, web, or floor (solidified lava) 183. * teth - tethered to buried iron ball 184. * chain - punished 185. * slip - slippery fingers 186. * ice - standing on ice (movement becomes uncertain) 187. * [underwater - movement uncertain, vision truncated, equipment at risk] 188. * other: 189. * [hold - poly'd into grabber and holding adjacent monster] 190. * Stormbringer - wielded weapon poses risks 191. * Cleaver - wielded weapon risks unintended consequences 192. * barehand - not wielding any weapon nor wearing gloves 193. * no-weapon - not wielding any weapon 194. * bow/xbow/sling - wielding a missile launcher of specified type 195. * pole - wielding a polearm 196. * pick - wielding a pickaxe 197. * junk - wielding non-weapon, non-weptool 198. * naked - no armor 199. * no-gloves - self-explanatory 200. * no-cloak - ditto 201. * [no-{other armor slots?} - probably much too verbose] 202. * conduct? 203. * [maybe if third status line is added] 204. * 205. * Can't add all of these and probably don't want to. But maybe we 206. * can add some of them and it's not as many as first appears: 207. * lava/trap/teth are mutually exclusive; 208. * digst/grab/englf/held/hold are also mutually exclusive; 209. * Stormbringer/Cleaver/barehand/no-weapon/bow&c/pole/pick/junk too; 210. * naked/no-{any armor slot} likewise. 211. */ 212. 213. #define VIA_WINDOWPORT() \ 214. ((windowprocs.wincap2 & (WC2_HILITE_STATUS | WC2_FLUSH_STATUS)) != 0) 215. 216. #define REASSESS_ONLY TRUE 217. 218. /* #ifdef STATUS_HILITES */ 219. /* hilite status field behavior - coloridx values */ 220. #define BL_HILITE_NONE -1 /* no hilite of this field */ 221. 222. #if 0 223. #define BL_HILITE_BOLD -2 /* bold hilite */ 224. #define BL_HILITE_DIM -3 /* dim hilite */ 225. #define BL_HILITE_ITALIC -4 /* italic hilite */ 226. #define BL_HILITE_ULINE -5 /* underline hilite */ 227. #define BL_HILITE_BLINK -6 /* blink hilite */ 228. #define BL_HILITE_INVERSE -7 /* inverse hilite */ 229. /* or any CLR_ index (0 - 15) */ 230. #endif 231. 232. #define BL_TH_NONE 0 233. #define BL_TH_VAL_PERCENTAGE 100 /* threshold is percentage */ 234. #define BL_TH_VAL_ABSOLUTE 101 /* threshold is particular value */ 235. #define BL_TH_UPDOWN 102 /* threshold is up or down change */ 236. #define BL_TH_CONDITION 103 /* threshold is bitmask of conditions */ 237. #define BL_TH_TEXTMATCH 104 /* threshold text value to match against */ 238. #define BL_TH_ALWAYS_HILITE 105 /* highlight regardless of value */ 239. #define BL_TH_CRITICALHP 106 /* highlight critically low HP */ 240. 241. #define HL_ATTCLR_NONE CLR_MAX + 1 242. #define HL_ATTCLR_BOLD CLR_MAX + 2 243. #define HL_ATTCLR_DIM CLR_MAX + 3 244. #define HL_ATTCLR_ITALIC CLR_MAX + 4 245. #define HL_ATTCLR_ULINE CLR_MAX + 5 246. #define HL_ATTCLR_BLINK CLR_MAX + 6 247. #define HL_ATTCLR_INVERSE CLR_MAX + 7 248. #define BL_ATTCLR_MAX CLR_MAX + 8 249. 250. enum hlattribs { 251. HL_UNDEF = 0x00, 252. HL_NONE = 0x01, 253. HL_BOLD = 0x02, 254. HL_DIM = 0x04, 255. HL_ITALIC = 0x08, 256. HL_ULINE = 0x10, 257. HL_BLINK = 0x20, 258. HL_INVERSE = 0x40 259. }; 260. 261. #define MAXVALWIDTH 80 /* actually less, but was using 80 to allocate title 262. * and leveldesc then using QBUFSZ everywhere else */ 263. #ifdef STATUS_HILITES 264. struct hilite_s { 265. enum statusfields fld; 266. boolean set; 267. enum any_types anytype; 268. anything value; 269. int behavior; 270. char textmatch[MAXVALWIDTH]; 271. enum relationships rel; 272. int coloridx; 273. struct hilite_s *next; 274. }; 275. #endif 276. 277. /* 278. * Note: If you add/change/remove fields in istat_s, you need to 279. * update the initialization of the istat_s struct blstats[][] 280. * array in instance_globals_b (decl.c). 281. */ 282. struct istat_s { 283. const char *fldname; 284. const char *fldfmt; 285. long time; /* moves when this field hilite times out */ 286. boolean chg; /* need to recalc time? */ 287. boolean percent_matters; 288. short percent_value; 289. enum any_types anytype; 290. anything a, rawval; 291. char *val; 292. int valwidth; 293. enum statusfields idxmax; 294. enum statusfields fld; 295. #ifdef STATUS_HILITES 296. struct hilite_s *hilite_rule; /* the entry, if any, in 'thresholds' 297. * list that currently applies */ 298. struct hilite_s *thresholds; 299. #endif 300. }; 301. 302. extern const char *status_fieldnames[]; /* in botl.c */ 303. 304. #endif /* BOTL_H */