About: Source:NetHack 3.1.0/display.h   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Below is the full text to display.h from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.0/display.h#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code

AttributesValues
rdfs:label
  • Source:NetHack 3.1.0/display.h
rdfs:comment
  • Below is the full text to display.h from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.0/display.h#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code
dcterms:subject
dbkwik:nethack/pro...iPageUsesTemplate
abstract
  • Below is the full text to display.h from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.0/display.h#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)display.h 3.1 92/07/11 */ 2. /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ 3. /* and Dave Cohrs, 1990. */ 4. /* NetHack may be freely redistributed. See license for details. */ 5. 6. #ifndef DISPLAY_H 7. #define DISPLAY_H 8. 9. #ifndef VISION_H 10. #include "vision.h" 11. #endif 12. 13. #ifndef MONDATA_H 14. #include "mondata.h" /* for mindless() */ 15. #endif 16. 17. #ifndef INVISIBLE_OBJECTS 18. #define vobj_at(x,y) (level.objects[x][y]) 19. #endif 20. 21. /* 22. * sensemon() 23. * 24. * Returns true if the hero can sense the given monster. This includes 25. * monsters that are hiding or mimicing other monsters. 26. */ 27. #define sensemon(mon) ( /* The hero can always sense a monster IF: */\ 28. (!mindless(mon->data)) && /* 1. the monster has a brain to sense AND */\ 29. ((Blind && Telepat) || /* 2a. hero is blind and telepathic OR */\ 30. /* 2b. hero is wearing a telepathy inducing */\ 31. /* object and in range */\ 32. ((HTelepat & (WORN_HELMET|WORN_AMUL|W_ART)) && \ 33. (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))) \ 34. ) 35. 36. 37. /* 38. * mon_visible() 39. * 40. * Returns true if the hero can see the monster. It is assumed that the 41. * hero can physically see the location of the monster. The function 42. * vobj_at() returns a pointer to an object that the hero can see there. 43. */ 44. #define mon_visible(mon) ( /* The hero can see the monster */\ 45. /* IF the monster */\ 46. (!mon->minvis || See_invisible) && /* 1. is not invisible AND */\ 47. (!mon->mundetected) /* 2. not an undetected hider */\ 48. ) 49. 50. 51. /* 52. * canseemon() 53. * 54. * This is the globally used canseemon(). It is not called within the display 55. * routines. 56. */ 57. #define canseemon(mon) (cansee(mon->mx, mon->my) && mon_visible(mon)) 58. 59. 60. /* 61. * canspotmon(mon) 62. * 63. * This is sensemon() or mon_visible() except that hiding under objects 64. * is considered irrelevant for this special case. 65. */ 66. #define canspotmon(mon) \ 67. (mon && (Blind ? sensemon(mon) : (!mon->minvis || See_invisible))) 68. 69. /* 70. * is_safepet(mon) 71. * 72. * A special case check used in attack() and domove(). Placing the 73. * definition here is convenient. 74. */ 75. #define is_safepet(mon) \ 76. (mon && mon->mtame && canspotmon(mon) && flags.safe_dog \ 77. && !Confusion && !Hallucination && !Stunned) 78. 79. 80. /* 81. * canseeself() 82. * 83. * This returns true if the hero can see her/himself. 84. * 85. * The u.uswallow check assumes that you can see yourself even if you are 86. * invisible. If not, then we don't need the check. 87. */ 88. #ifdef POLYSELF 89. #define canseeself() (Blind || u.uswallow || (!Invisible && !u.uundetected)) 90. #else 91. #define canseeself() (Blind || u.uswallow || !Invisible) 92. #endif 93. 94. 95. /* 96. * random_monster() 97. * random_object() 98. * 99. * Respectively return a random monster or object number. 100. */ 101. #define random_monster() rn2(NUMMONS) 102. #define random_object() (rn2(NROFOBJECTS) + 1) 103. 104. 105. /* 106. * what_obj() 107. * what_mon() 108. * 109. * If hallucinating, choose a random object/monster, otherwise, use the one 110. * given. 111. */ 112. #define what_obj(obj) (Hallucination ? random_object() : obj) 113. #define what_mon(mon) (Hallucination ? random_monster() : mon) 114. 115. 116. /* 117. * covers_objects() 118. * covers_traps() 119. * 120. * These routines are true if what is really at the given location will 121. * "cover" any objects or traps that might be there. 122. */ 123. #define covers_objects(xx,yy) \ 124. ((is_pool(xx,yy) && !Underwater) || (levl[xx][yy].typ == LAVAPOOL)) 125. 126. #define covers_traps(xx,yy) covers_objects(xx,yy) 127. 128. 129. /* 130. * tmp_at() control calls. 131. */ 132. #define DISP_BEAM (-1) /* Keep all glyphs showing & clean up at end. */ 133. #define DISP_FLASH (-2) /* Clean up each glyph before displaying new one. */ 134. #define DISP_CHANGE (-3) /* Change glyph. */ 135. #define DISP_END (-4) /* Clean up. */ 136. 137. 138. /* Total number of cmap indices in the sheild_static[] array. */ 139. #define SHIELD_COUNT 21 140. 141. 142. /* 143. * display_self() 144. * 145. * Display the hero. This has degenerated down to this. Perhaps there is 146. * more needed here, but I can't think of any cases. 147. */ 148. #ifdef POLYSELF 149. #define display_self() \ 150. show_glyph(u.ux, u.uy, \ 151. u.usym == 0 ? objnum_to_glyph(GOLD_PIECE) : \ 152. monnum_to_glyph((u.umonnum < 0 ? u.umonster : u.umonnum))) 153. #else 154. #define display_self() \ 155. show_glyph(u.ux, u.uy, \ 156. u.usym == 0 ? objnum_to_glyph(GOLD_PIECE) : \ 157. monnum_to_glyph(u.umonster)) 158. #endif 159. 160. 161. /* 162. * A glyph is an abstraction that represents a _unique_ monster, object, 163. * dungeon part, or effect. The uniqueness is important. For example, 164. * It is not enough to have four (one for each "direction") zap beam glyphs, 165. * we need a set of four for each beam type. Why go to so much trouble? 166. * Because it is possible that any given window dependent display driver 167. * [print_glyph()] can produce something different for each type of glyph. 168. * That is, a beam of cold and a beam of fire would not only be different 169. * colors, but would also be represented by different symbols. 170. * 171. * Glyphs are grouped for easy accessibility: 172. * 173. * monster Represents all the wild (not tame) monsters. Count: NUMMONS. 174. * 175. * pet Represents all of the tame monsters. Count: NUMMONS 176. * 177. * corpse One for each monster. Count: NUMMONS 178. * 179. * object One for each object. Count: NROFOBJECTS+1 (we need the +1 180. * because NROFOBJECTS does not include the illegal object) 181. * 182. * trap One for each trap type. Count: TRAPNUM 183. * 184. * cmap One for each entry in the character map. The character map 185. * is the dungeon features and other miscellaneous things. 186. * Count: MAXPCHARS 187. * 188. * zap beam A set of four (there are four directions) for each beam type. 189. * The beam type is shifted over 2 positions and the direction 190. * is stored in the lower 2 bits. Count: NUM_ZAP << 2 191. * 192. * swallow A set of eight for each monster. The eight positions rep- 193. * resent those surrounding the hero. The monster number is 194. * shifted over 3 positions and the swallow position is stored 195. * in the lower three bits. Count: NUMMONS << 3 196. * 197. * The following are offsets used to convert to and from a glyph. 198. */ 199. #define NUM_ZAP 8 /* number of zap beam types */ 200. 201. #define GLYPH_MON_OFF 0 202. #define GLYPH_PET_OFF (NUMMONS + GLYPH_MON_OFF) 203. #define GLYPH_BODY_OFF (NUMMONS + GLYPH_PET_OFF) 204. #define GLYPH_OBJ_OFF (NUMMONS + GLYPH_BODY_OFF) 205. #define GLYPH_TRAP_OFF (NROFOBJECTS+1 + GLYPH_OBJ_OFF) 206. #define GLYPH_CMAP_OFF (TRAPNUM + GLYPH_TRAP_OFF) 207. #define GLYPH_ZAP_OFF (MAXPCHARS + GLYPH_CMAP_OFF) 208. #define GLYPH_SWALLOW_OFF ((NUM_ZAP << 2) + GLYPH_ZAP_OFF) 209. 210. #define MAX_GLYPH ((NUMMONS << 3) + GLYPH_SWALLOW_OFF) 211. 212. 213. #define mon_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_MON_OFF) 214. #define pet_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_PET_OFF) 215. 216. /* This has the unfortunate side effect of needing a global variable */ 217. /* to store a result. 'otg_temp' is defined and declared in decl.{ch}. */ 218. #define obj_to_glyph(obj) \ 219. (Hallucination ? \ 220. ((otg_temp = random_object()) == CORPSE ? \ 221. random_monster() + GLYPH_BODY_OFF : \ 222. otg_temp + GLYPH_OBJ_OFF) : \ 223. ((obj)->otyp == CORPSE ? \ 224. (int) (obj)->corpsenm + GLYPH_BODY_OFF : \ 225. (int) (obj)->otyp + GLYPH_OBJ_OFF)) 226. 227. #define trap_to_glyph(trap) ((int) (trap)->ttyp + GLYPH_TRAP_OFF) 228. #define cmap_to_glyph(cmap_idx) ((int) (cmap_idx) + GLYPH_CMAP_OFF) 229. 230. /* Not affected by hallucination. Gives a generic body for CORPSE */ 231. #define objnum_to_glyph(onum) ((int) (onum) + GLYPH_OBJ_OFF) 232. #define monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_MON_OFF) 233. #define petnum_to_glyph(mnum) ((int) (mnum) + GLYPH_PET_OFF) 234. 235. 236. /* 237. * Change the given glyph into it's given type. Note: 238. * 1) Pets are animals and are converted to the proper monster number. 239. * 2) Bodies are all mapped into the generic CORPSE object 240. * 3) glyph_to_swallow() does not return a showsyms[] index, but an 241. * offset from the first swallow symbol. 242. * 4) These functions assume that the glyph type has already been 243. * determined. That is, you have checked it with a glyph_is_XXXX() 244. * call. 245. */ 246. #define glyph_to_mon(glyph) ((int) ((glyph) < GLYPH_PET_OFF ? \ 247. glyph - GLYPH_MON_OFF : glyph - GLYPH_PET_OFF)) 248. #define glyph_to_obj(glyph) ((int) ((glyph) < GLYPH_OBJ_OFF ? \ 249. CORPSE : (glyph) - GLYPH_OBJ_OFF)) 250. #define glyph_to_trap(glyph) ((int) (glyph) - GLYPH_TRAP_OFF) 251. #define glyph_to_cmap(glyph) ((int) (glyph) - GLYPH_CMAP_OFF) 252. #define glyph_to_swallow(glyph) (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) 253. 254. /* 255. * Return true if the given glyph is what we want. Note that bodies are 256. * considered objects. 257. */ 258. #define glyph_is_monster(glyph) \ 259. ((glyph) >= GLYPH_MON_OFF && (glyph) < GLYPH_BODY_OFF) 260. #define glyph_is_object(glyph) \ 261. ((glyph) >= GLYPH_BODY_OFF && (glyph) < GLYPH_TRAP_OFF) 262. #define glyph_is_trap(glyph) \ 263. ((glyph) >= GLYPH_TRAP_OFF && (glyph) < GLYPH_CMAP_OFF) 264. #define glyph_is_cmap(glyph) \ 265. ((glyph) >= GLYPH_CMAP_OFF && (glyph) < GLYPH_ZAP_OFF) 266. #define glyph_is_swallow(glyph) \ 267. ((glyph) >= GLYPH_SWALLOW_OFF && (glyph) < MAX_GLYPH) 268. 269. #endif /* DISPLAY_H */
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software