abstract
| - Below is the full text to drawing.c from the source code of NetHack 3.3.0. To link to a particular line, write [[NetHack 3.3.0/drawing.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)drawing.c 3.3 1999/12/02 */ 2. /* Copyright (c) NetHack Development Team 1992. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #include "hack.h" 6. #include "tcap.h" 7. 8. /* Relevent header information in rm.h and objclass.h. */ 9. 10. #ifdef C 11. #undef C 12. #endif 13. 14. #ifdef TEXTCOLOR 15. #define C(n) n 16. #else 17. #define C(n) 18. #endif 19. 20. #define g_FILLER(symbol) 0 21. 22. uchar oc_syms[MAXOCLASSES] = DUMMY; /* the current object display symbols */ 23. uchar showsyms[MAXPCHARS] = DUMMY; /* the current feature display symbols */ 24. uchar monsyms[MAXMCLASSES] = DUMMY; /* the current monster display symbols */ 25. 26. /* Default object class symbols. See objclass.h. */ 27. const char def_oc_syms[MAXOCLASSES] = { 28. /* 0*/ '\0', /* placeholder for the "random class" */ 29. ILLOBJ_SYM, 30. WEAPON_SYM, 31. ARMOR_SYM, 32. RING_SYM, 33. /* 5*/ AMULET_SYM, 34. TOOL_SYM, 35. FOOD_SYM, 36. POTION_SYM, 37. SCROLL_SYM, 38. /*10*/ SPBOOK_SYM, 39. WAND_SYM, 40. GOLD_SYM, 41. GEM_SYM, 42. ROCK_SYM, 43. /*15*/ BALL_SYM, 44. CHAIN_SYM, 45. VENOM_SYM 46. }; 47. 48. const char *invisexplain = "remembered, unseen, creature"; 49. 50. /* Object descriptions. Used in do_look(). */ 51. const char *objexplain[] = { /* these match def_oc_syms, above */ 52. /* 0*/ 0, 53. "strange object", 54. "weapon", 55. "suit or piece of armor", 56. "ring", 57. /* 5*/ "amulet", 58. "useful item (pick-axe, key, lamp...)", 59. "piece of food", 60. "potion", 61. "scroll", 62. /*10*/ "spellbook", 63. "wand", 64. "pile of coins", 65. "gem or rock", 66. "boulder or statue", 67. /*15*/ "iron ball", 68. "iron chain", 69. "splash of venom" 70. }; 71. 72. /* Object class names. Used in object_detect(). */ 73. const char *oclass_names[] = { 74. /* 0*/ 0, 75. "illegal objects", 76. "weapons", 77. "armor", 78. "rings", 79. /* 5*/ "amulets", 80. "tools", 81. "food", 82. "potions", 83. "scrolls", 84. /*10*/ "spellbooks", 85. "wands", 86. "coins", 87. "rocks", 88. "large stones", 89. /*15*/ "iron balls", 90. "chains", 91. "venoms" 92. }; 93. 94. /* Default monster class symbols. See monsym.h. */ 95. const char def_monsyms[MAXMCLASSES] = { 96. '\0', /* holder */ 97. DEF_ANT, 98. DEF_BLOB, 99. DEF_COCKATRICE, 100. DEF_DOG, 101. DEF_EYE, 102. DEF_FELINE, 103. DEF_GREMLIN, 104. DEF_HUMANOID, 105. DEF_IMP, 106. DEF_JELLY, /* 10 */ 107. DEF_KOBOLD, 108. DEF_LEPRECHAUN, 109. DEF_MIMIC, 110. DEF_NYMPH, 111. DEF_ORC, 112. DEF_PIERCER, 113. DEF_QUADRUPED, 114. DEF_RODENT, 115. DEF_SPIDER, 116. DEF_TRAPPER, /* 20 */ 117. DEF_UNICORN, 118. DEF_VORTEX, 119. DEF_WORM, 120. DEF_XAN, 121. DEF_LIGHT, 122. DEF_ZRUTY, 123. DEF_ANGEL, 124. DEF_BAT, 125. DEF_CENTAUR, 126. DEF_DRAGON, /* 30 */ 127. DEF_ELEMENTAL, 128. DEF_FUNGUS, 129. DEF_GNOME, 130. DEF_GIANT, 131. '\0', 132. DEF_JABBERWOCK, 133. DEF_KOP, 134. DEF_LICH, 135. DEF_MUMMY, 136. DEF_NAGA, /* 40 */ 137. DEF_OGRE, 138. DEF_PUDDING, 139. DEF_QUANTMECH, 140. DEF_RUSTMONST, 141. DEF_SNAKE, 142. DEF_TROLL, 143. DEF_UMBER, 144. DEF_VAMPIRE, 145. DEF_WRAITH, 146. DEF_XORN, /* 50 */ 147. DEF_YETI, 148. DEF_ZOMBIE, 149. DEF_HUMAN, 150. DEF_GHOST, 151. DEF_GOLEM, 152. DEF_DEMON, 153. DEF_EEL, 154. DEF_LIZARD, 155. DEF_WORM_TAIL, 156. DEF_MIMIC_DEF, /* 60 */ 157. }; 158. 159. /* The explanations below are also used when the user gives a string 160. * for blessed genocide, so no text should wholly contain any later 161. * text. They should also always contain obvious names (eg. cat/feline). 162. */ 163. const char *monexplain[MAXMCLASSES] = { 164. 0, 165. "ant or other insect", "blob", "cockatrice", 166. "dog or other canine", "eye or sphere", "cat or other feline", 167. "gremlin", "humanoid", "imp or minor demon", 168. "jelly", "kobold", "leprechaun", 169. "mimic", "nymph", "orc", 170. "piercer", "quadruped", "rodent", 171. "spider", "trapper or lurker above", "unicorn or horse", 172. "vortex", "worm", "xan or other mythical/fantastic insect", 173. "light", "zruty", 174. 175. "angelic being", "bat or bird", "centaur", 176. "dragon", "elemental", "fungus or mold", 177. "gnome", "giant humanoid", 0, 178. "jabberwock", "Keystone Kop", "lich", 179. "mummy", "naga", "ogre", 180. "pudding or ooze", "quantum mechanic", "rust monster or disenchanter", 181. "snake", "troll", "umber hulk", 182. "vampire", "wraith", "xorn", 183. "yeti, ape or other large beast", "zombie", 184. 185. "human or elf", "ghost", "golem", 186. "major demon", "sea monster", "lizard", 187. "long worm tail", "mimic" 188. }; 189. 190. /* 191. * Default screen symbols with explanations and colors. 192. * Note: {ibm|dec|mac}_graphics[] arrays also depend on this symbol order. 193. */ 194. const struct symdef defsyms[MAXPCHARS] = { 195. /* 0*/ {' ', "dark part of a room",C(NO_COLOR)}, /* stone */ 196. {'|', "wall", C(CLR_GRAY)}, /* vwall */ 197. {'-', "wall", C(CLR_GRAY)}, /* hwall */ 198. {'-', "wall", C(CLR_GRAY)}, /* tlcorn */ 199. {'-', "wall", C(CLR_GRAY)}, /* trcorn */ 200. {'-', "wall", C(CLR_GRAY)}, /* blcorn */ 201. {'-', "wall", C(CLR_GRAY)}, /* brcorn */ 202. {'-', "wall", C(CLR_GRAY)}, /* crwall */ 203. {'-', "wall", C(CLR_GRAY)}, /* tuwall */ 204. {'-', "wall", C(CLR_GRAY)}, /* tdwall */ 205. /*10*/ {'|', "wall", C(CLR_GRAY)}, /* tlwall */ 206. {'|', "wall", C(CLR_GRAY)}, /* trwall */ 207. {'.', "doorway", C(CLR_GRAY)}, /* ndoor */ 208. {'-', "open door", C(CLR_BROWN)}, /* vodoor */ 209. {'|', "open door", C(CLR_BROWN)}, /* hodoor */ 210. {'+', "closed door", C(CLR_BROWN)}, /* vcdoor */ 211. {'+', "closed door", C(CLR_BROWN)}, /* hcdoor */ 212. {'#', "iron bars", C(HI_METAL)}, /* bars */ 213. {'#', "tree", C(CLR_GREEN)}, /* tree */ 214. {'.', "floor of a room",C(CLR_GRAY)}, /* room */ 215. /*20*/ {'#', "corridor", C(CLR_GRAY)}, /* dark corr */ 216. {'#', "lit corridor", C(CLR_GRAY)}, /* lit corr */ 217. {'<', "staircase up", C(CLR_GRAY)}, /* upstair */ 218. {'>', "staircase down", C(CLR_GRAY)}, /* dnstair */ 219. {'<', "ladder up", C(CLR_BROWN)}, /* upladder */ 220. {'>', "ladder down", C(CLR_BROWN)}, /* dnladder */ 221. {'_', "altar", C(CLR_GRAY)}, /* altar */ 222. {'|', "grave", C(CLR_GRAY)}, /* grave */ 223. {'\\', "opulent throne",C(HI_GOLD)}, /* throne */ 224. #ifdef SINKS 225. {'#', "sink", C(CLR_GRAY)}, /* sink */ 226. #else 227. {'#', "", C(CLR_GRAY)}, /* sink */ 228. #endif 229. /*30*/ {'{', "fountain", C(CLR_BLUE)}, /* fountain */ 230. {'}', "water", C(CLR_BLUE)}, /* pool */ 231. {'.', "ice", C(CLR_CYAN)}, /* ice */ 232. {'}', "molten lava", C(CLR_RED)}, /* lava */ 233. {'.', "lowered drawbridge",C(CLR_BROWN)}, /* vodbridge */ 234. {'.', "lowered drawbridge",C(CLR_BROWN)}, /* hodbridge */ 235. {'#', "raised drawbridge",C(CLR_BROWN)},/* vcdbridge */ 236. {'#', "raised drawbridge",C(CLR_BROWN)},/* hcdbridge */ 237. {' ', "air", C(CLR_CYAN)}, /* open air */ 238. {'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */ 239. /*40*/ {'}', "water", C(CLR_BLUE)}, /* under water */ 240. {'^', "arrow trap", C(HI_METAL)}, /* trap */ 241. {'^', "dart trap", C(HI_METAL)}, /* trap */ 242. {'^', "falling rock trap",C(CLR_GRAY)}, /* trap */ 243. {'^', "squeaky board", C(CLR_BROWN)}, /* trap */ 244. {'^', "bear trap", C(HI_METAL)}, /* trap */ 245. {'^', "land mine", C(CLR_RED)}, /* trap */ 246. {'^', "rolling boulder trap", C(CLR_GRAY)}, /* trap */ 247. {'^', "sleeping gas trap",C(HI_ZAP)}, /* trap */ 248. {'^', "rust trap", C(CLR_BLUE)}, /* trap */ 249. /*50*/ {'^', "fire trap", C(CLR_ORANGE)}, /* trap */ 250. {'^', "pit", C(CLR_BLACK)}, /* trap */ 251. {'^', "spiked pit", C(CLR_BLACK)}, /* trap */ 252. {'^', "hole", C(CLR_BROWN)}, /* trap */ 253. {'^', "trap door", C(CLR_BROWN)}, /* trap */ 254. {'^', "teleportation trap", C(CLR_MAGENTA)}, /* trap */ 255. {'^', "level teleporter", C(CLR_MAGENTA)}, /* trap */ 256. {'^', "magic portal", C(CLR_BRIGHT_MAGENTA)}, /* trap */ 257. {'"', "web", C(CLR_GRAY)}, /* web */ 258. {'^', "statue trap", C(CLR_GRAY)}, /* trap */ 259. /*60*/ {'^', "magic trap", C(HI_ZAP)}, /* trap */ 260. {'^', "anti-magic trap field", C(HI_ZAP)}, /* trap */ 261. {'^', "polymorph trap", C(CLR_BRIGHT_GREEN)}, /* trap */ 262. {'|', "wall", C(CLR_GRAY)}, /* vbeam */ 263. {'-', "wall", C(CLR_GRAY)}, /* hbeam */ 264. {'\\',"wall", C(CLR_GRAY)}, /* lslant */ 265. {'/', "wall", C(CLR_GRAY)}, /* rslant */ 266. {'*', "", C(CLR_WHITE)}, /* dig beam */ 267. {'!', "", C(CLR_WHITE)}, /* camera flash beam */ 268. {')', "", C(HI_WOOD)}, /* boomerang open left */ 269. /*70*/ {'(', "", C(HI_WOOD)}, /* boomerang open right */ 270. {'0', "", C(HI_ZAP)}, /* 4 magic shield symbols */ 271. {'#', "", C(HI_ZAP)}, 272. {'@', "", C(HI_ZAP)}, 273. {'*', "", C(HI_ZAP)}, 274. {'/', "", C(CLR_GREEN)}, /* swallow top left */ 275. {'-', "", C(CLR_GREEN)}, /* swallow top center */ 276. {'\\', "", C(CLR_GREEN)}, /* swallow top right */ 277. {'|', "", C(CLR_GREEN)}, /* swallow middle left */ 278. {'|', "", C(CLR_GREEN)}, /* swallow middle right */ 279. /*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow bottom left */ 280. {'-', "", C(CLR_GREEN)}, /* swallow bottom center*/ 281. {'/', "", C(CLR_GREEN)}, /* swallow bottom right */ 282. {'/', "", C(CLR_ORANGE)}, /* explosion top left */ 283. {'-', "", C(CLR_ORANGE)}, /* explosion top center */ 284. {'\\', "", C(CLR_ORANGE)}, /* explosion top right */ 285. {'|', "", C(CLR_ORANGE)}, /* explosion middle left */ 286. {' ', "", C(CLR_ORANGE)}, /* explosion middle center*/ 287. {'|', "", C(CLR_ORANGE)}, /* explosion middle right */ 288. {'\\', "", C(CLR_ORANGE)}, /* explosion bottom left */ 289. /*90*/ {'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/ 290. {'/', "", C(CLR_ORANGE)}, /* explosion bottom right */ 291. /* 292. * Note: Additions to this array should be reflected in the 293. * {ibm,dec,mac}_graphics[] arrays below. 294. */ 295. }; 296. 297. #undef C 298. 299. #ifdef ASCIIGRAPH 300. 301. #ifdef PC9800 302. void NDECL((*ibmgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ 303. #endif /* PC9800 */ 304. 305. static uchar ibm_graphics[MAXPCHARS] = { 306. /* 0*/ g_FILLER(S_stone), 307. 0xb3, /* S_vwall: meta-3, vertical rule */ 308. 0xc4, /* S_hwall: meta-D, horizontal rule */ 309. 0xda, /* S_tlcorn: meta-Z, top left corner */ 310. 0xbf, /* S_trcorn: meta-?, top right corner */ 311. 0xc0, /* S_blcorn: meta-@, bottom left */ 312. 0xd9, /* S_brcorn: meta-Y, bottom right */ 313. 0xc5, /* S_crwall: meta-E, cross */ 314. 0xc1, /* S_tuwall: meta-A, T up */ 315. 0xc2, /* S_tdwall: meta-B, T down */ 316. /*10*/ 0xb4, /* S_tlwall: meta-4, T left */ 317. 0xc3, /* S_trwall: meta-C, T right */ 318. 0xfa, /* S_ndoor: meta-z, centered dot */ 319. 0xfe, /* S_vodoor: meta-~, small centered square */ 320. 0xfe, /* S_hodoor: meta-~, small centered square */ 321. g_FILLER(S_vcdoor), 322. g_FILLER(S_hcdoor), 323. 240, /* S_bars: equivalence symbol */ 324. 241, /* S_tree: plus or minus symbol */ 325. 0xfa, /* S_room: meta-z, centered dot */ 326. /*20*/ 0xb0, /* S_corr: meta-0, light shading */ 327. 0xb1, /* S_litcorr: meta-1, medium shading */ 328. g_FILLER(S_upstair), 329. g_FILLER(S_dnstair), 330. g_FILLER(S_upladder), 331. g_FILLER(S_dnladder), 332. g_FILLER(S_altar), 333. g_FILLER(S_grave), 334. g_FILLER(S_throne), 335. g_FILLER(S_sink), 336. /*30*/ 0xf4, /* S_fountain: meta-t, integral top half */ 337. 0xf7, /* S_pool: meta-w, approx. equals */ 338. 0xfa, /* S_ice: meta-z, centered dot */ 339. 0xf7, /* S_lava: meta-w, approx. equals */ 340. 0xfa, /* S_vodbridge: meta-z, centered dot */ 341. 0xfa, /* S_hodbridge: meta-z, centered dot */ 342. g_FILLER(S_vcdbridge), 343. g_FILLER(S_hcdbridge), 344. g_FILLER(S_air), 345. g_FILLER(S_cloud), 346. /*40*/ 0xf7, /* S_water: meta-w, approx. equals */ 347. g_FILLER(S_arrow_trap), 348. g_FILLER(S_dart_trap), 349. g_FILLER(S_falling_rock_trap), 350. g_FILLER(S_squeaky_board), 351. g_FILLER(S_bear_trap), 352. g_FILLER(S_land_mine), 353. g_FILLER(S_rolling_boulder_trap), 354. g_FILLER(S_sleeping_gas_trap), 355. g_FILLER(S_rust_trap), 356. /*50*/ g_FILLER(S_fire_trap), 357. g_FILLER(S_pit), 358. g_FILLER(S_spiked_pit), 359. g_FILLER(S_hole), 360. g_FILLER(S_trap_door), 361. g_FILLER(S_teleportation_trap), 362. g_FILLER(S_level_teleporter), 363. g_FILLER(S_magic_portal), 364. g_FILLER(S_web), 365. g_FILLER(S_statue_trap), 366. /*60*/ g_FILLER(S_magic_trap), 367. g_FILLER(S_anti_magic_trap), 368. g_FILLER(S_polymorph_trap), 369. 0xb3, /* S_vbeam: meta-3, vertical rule */ 370. 0xc4, /* S_hbeam: meta-D, horizontal rule */ 371. g_FILLER(S_lslant), 372. g_FILLER(S_rslant), 373. g_FILLER(S_digbeam), 374. g_FILLER(S_flashbeam), 375. g_FILLER(S_boomleft), 376. /*70*/ g_FILLER(S_boomright), 377. g_FILLER(S_ss1), 378. g_FILLER(S_ss2), 379. g_FILLER(S_ss3), 380. g_FILLER(S_ss4), 381. g_FILLER(S_sw_tl), 382. g_FILLER(S_sw_tc), 383. g_FILLER(S_sw_tr), 384. 0xb3, /* S_sw_ml: meta-3, vertical rule */ 385. 0xb3, /* S_sw_mr: meta-3, vertical rule */ 386. /*80*/ g_FILLER(S_sw_bl), 387. g_FILLER(S_sw_bc), 388. g_FILLER(S_sw_br), 389. g_FILLER(S_explode1), 390. g_FILLER(S_explode2), 391. g_FILLER(S_explode3), 392. 0xb3, /* S_explode4: meta-3, vertical rule */ 393. g_FILLER(S_explode5), 394. 0xb3, /* S_explode6: meta-3, vertical rule */ 395. g_FILLER(S_explode7), 396. /*90*/ g_FILLER(S_explode8), 397. g_FILLER(S_explode9) 398. }; 399. #endif /* ASCIIGRAPH */ 400. 401. #ifdef TERMLIB 402. void NDECL((*decgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ 403. 404. static uchar dec_graphics[MAXPCHARS] = { 405. /* 0*/ g_FILLER(S_stone), 406. 0xf8, /* S_vwall: meta-x, vertical rule */ 407. 0xf1, /* S_hwall: meta-q, horizontal rule */ 408. 0xec, /* S_tlcorn: meta-l, top left corner */ 409. 0xeb, /* S_trcorn: meta-k, top right corner */ 410. 0xed, /* S_blcorn: meta-m, bottom left */ 411. 0xea, /* S_brcorn: meta-j, bottom right */ 412. 0xee, /* S_crwall: meta-n, cross */ 413. 0xf6, /* S_tuwall: meta-v, T up */ 414. 0xf7, /* S_tdwall: meta-w, T down */ 415. /*10*/ 0xf5, /* S_tlwall: meta-u, T left */ 416. 0xf4, /* S_trwall: meta-t, T right */ 417. 0xfe, /* S_ndoor: meta-~, centered dot */ 418. 0xe1, /* S_vodoor: meta-a, solid block */ 419. 0xe1, /* S_hodoor: meta-a, solid block */ 420. g_FILLER(S_vcdoor), 421. g_FILLER(S_hcdoor), 422. 0xfb, /* S_bars: meta-{, small pi */ 423. 0xe7, /* S_tree: meta-g, plus-or-minus */ 424. 0xfe, /* S_room: meta-~, centered dot */ 425. /*20*/ g_FILLER(S_corr), 426. g_FILLER(S_litcorr), 427. g_FILLER(S_upstair), 428. g_FILLER(S_dnstair), 429. 0xf9, /* S_upladder: meta-y, greater-than-or-equals */ 430. 0xfa, /* S_dnladder: meta-z, less-than-or-equals */ 431. g_FILLER(S_altar), /* 0xc3, \E)3: meta-C, dagger */ 432. g_FILLER(S_grave), 433. g_FILLER(S_throne), 434. g_FILLER(S_sink), 435. /*30*/ g_FILLER(S_fountain), /* 0xdb, \E)3: meta-[, integral top half */ 436. 0xe0, /* S_pool: meta-\, diamond */ 437. 0xfe, /* S_ice: meta-~, centered dot */ 438. 0xe0, /* S_lava: meta-\, diamond */ 439. 0xfe, /* S_vodbridge: meta-~, centered dot */ 440. 0xfe, /* S_hodbridge: meta-~, centered dot */ 441. g_FILLER(S_vcdbridge), 442. g_FILLER(S_hcdbridge), 443. g_FILLER(S_air), 444. g_FILLER(S_cloud), 445. /*40*/ 0xe0, /* S_water: meta-\, diamond */ 446. g_FILLER(S_arrow_trap), 447. g_FILLER(S_dart_trap), 448. g_FILLER(S_falling_rock_trap), 449. g_FILLER(S_squeaky_board), 450. g_FILLER(S_bear_trap), 451. g_FILLER(S_land_mine), 452. g_FILLER(S_rolling_boulder_trap), 453. g_FILLER(S_sleeping_gas_trap), 454. g_FILLER(S_rust_trap), 455. /*50*/ g_FILLER(S_fire_trap), 456. g_FILLER(S_pit), 457. g_FILLER(S_spiked_pit), 458. g_FILLER(S_hole), 459. g_FILLER(S_trap_door), 460. g_FILLER(S_teleportation_trap), 461. g_FILLER(S_level_teleporter), 462. g_FILLER(S_magic_portal), 463. g_FILLER(S_web), /* 0xbd, \E)3: meta-=, int'l currency */ 464. g_FILLER(S_statue_trap), 465. /*60*/ g_FILLER(S_magic_trap), 466. g_FILLER(S_anti_magic_trap), 467. g_FILLER(S_polymorph_trap), 468. 0xf8, /* S_vbeam: meta-x, vertical rule */ 469. 0xf1, /* S_hbeam: meta-q, horizontal rule */ 470. g_FILLER(S_lslant), 471. g_FILLER(S_rslant), 472. g_FILLER(S_digbeam), 473. g_FILLER(S_flashbeam), 474. g_FILLER(S_boomleft), 475. /*70*/ g_FILLER(S_boomright), 476. g_FILLER(S_ss1), 477. g_FILLER(S_ss2), 478. g_FILLER(S_ss3), 479. g_FILLER(S_ss4), 480. g_FILLER(S_sw_tl), 481. 0xef, /* S_sw_tc: meta-o, high horizontal line */ 482. g_FILLER(S_sw_tr), 483. 0xf8, /* S_sw_ml: meta-x, vertical rule */ 484. 0xf8, /* S_sw_mr: meta-x, vertical rule */ 485. /*80*/ g_FILLER(S_sw_bl), 486. 0xf3, /* S_sw_bc: meta-s, low horizontal line */ 487. g_FILLER(S_sw_br), 488. g_FILLER(S_explode1), 489. 0xef, /* S_explode2: meta-o, high horizontal line */ 490. g_FILLER(S_explode3), 491. 0xf8, /* S_explode4: meta-x, vertical rule */ 492. g_FILLER(S_explode5), 493. 0xf8, /* S_explode6: meta-x, vertical rule */ 494. g_FILLER(S_explode7), 495. /*90*/ 0xf3, /* S_explode8: meta-s, low horizontal line */ 496. g_FILLER(S_explode9) 497. }; 498. #endif /* TERMLIB */ 499. 500. #ifdef MAC_GRAPHICS_ENV 501. static uchar mac_graphics[MAXPCHARS] = { 502. /* 0*/ g_FILLER(S_stone), 503. 0xba, /* S_vwall */ 504. 0xcd, /* S_hwall */ 505. 0xc9, /* S_tlcorn */ 506. 0xbb, /* S_trcorn */ 507. 0xc8, /* S_blcorn */ 508. 0xbc, /* S_brcorn */ 509. 0xce, /* S_crwall */ 510. 0xca, /* S_tuwall */ 511. 0xcb, /* S_tdwall */ 512. /*10*/ 0xb9, /* S_tlwall */ 513. 0xcc, /* S_trwall */ 514. 0xb0, /* S_ndoor */ 515. 0xee, /* S_vodoor */ 516. 0xee, /* S_hodoor */ 517. 0xef, /* S_vcdoor */ 518. 0xef, /* S_hcdoor */ 519. 0xf0, /* S_bars: equivalency symbol */ 520. 0xf1, /* S_tree: plus-or-minus */ 521. g_FILLER(S_Room), 522. /*20*/ 0xB0, /* S_corr */ 523. g_FILLER(S_litcorr), 524. g_FILLER(S_upstair), 525. g_FILLER(S_dnstair), 526. g_FILLER(S_upladder), 527. g_FILLER(S_dnladder), 528. g_FILLER(S_altar), 529. 0xef, /* S_grave: same as open door */ 530. g_FILLER(S_throne), 531. g_FILLER(S_sink), 532. /*30*/ g_FILLER(S_fountain), 533. 0xe0, /* S_pool */ 534. g_FILLER(S_ice), 535. g_FILLER(S_lava), 536. g_FILLER(S_vodbridge), 537. g_FILLER(S_hodbridge), 538. g_FILLER(S_vcdbridge), 539. g_FILLER(S_hcdbridge), 540. g_FILLER(S_air), 541. g_FILLER(S_cloud), 542. /*40*/ g_FILLER(S_water), 543. g_FILLER(S_arrow_trap), 544. g_FILLER(S_dart_trap), 545. g_FILLER(S_falling_rock_trap), 546. g_FILLER(S_squeaky_board), 547. g_FILLER(S_bear_trap), 548. g_FILLER(S_land_mine), 549. g_FILLER(S_rolling_boulder_trap), 550. g_FILLER(S_sleeping_gas_trap), 551. g_FILLER(S_rust_trap), 552. /*50*/ g_FILLER(S_fire_trap), 553. g_FILLER(S_pit), 554. g_FILLER(S_spiked_pit), 555. g_FILLER(S_hole), 556. g_FILLER(S_trap_door), 557. g_FILLER(S_teleportation_trap), 558. g_FILLER(S_level_teleporter), 559. g_FILLER(S_magic_portal), 560. g_FILLER(S_web), 561. g_FILLER(S_statue_trap), 562. /*60*/ g_FILLER(S_magic_trap), 563. g_FILLER(S_anti_magic_trap), 564. g_FILLER(S_polymorph_trap), 565. g_FILLER(S_vbeam), 566. g_FILLER(S_hbeam), 567. g_FILLER(S_lslant), 568. g_FILLER(S_rslant), 569. g_FILLER(S_digbeam), 570. g_FILLER(S_flashbeam), 571. g_FILLER(S_boomleft), 572. /*70*/ g_FILLER(S_boomright), 573. g_FILLER(S_ss1), 574. g_FILLER(S_ss2), 575. g_FILLER(S_ss3), 576. g_FILLER(S_ss4), 577. g_FILLER(S_sw_tl), 578. g_FILLER(S_sw_tc), 579. g_FILLER(S_sw_tr), 580. g_FILLER(S_sw_ml), 581. g_FILLER(S_sw_mr), 582. /*80*/ g_FILLER(S_sw_bl), 583. g_FILLER(S_sw_bc), 584. g_FILLER(S_sw_br), 585. g_FILLER(S_explode1), 586. g_FILLER(S_explode2), 587. g_FILLER(S_explode3), 588. g_FILLER(S_explode4), 589. g_FILLER(S_explode5), 590. g_FILLER(S_explode6), 591. g_FILLER(S_explode7), 592. /*90*/ g_FILLER(S_explode8), 593. g_FILLER(S_explode9) 594. }; 595. #endif /* MAC_GRAPHICS_ENV */ 596. 597. #ifdef PC9800 598. void NDECL((*ascgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ 599. #endif 600. 601. /* 602. * Convert the given character to an object class. If the character is not 603. * recognized, then MAXOCLASSES is returned. Used in invent.c, options.c, 604. * pickup.c, sp_lev.c, and lev_main.c. 605. */ 606. int 607. def_char_to_objclass(ch) 608. char ch; 609. { 610. int i; 611. for (i = 1; i < MAXOCLASSES; i++) 612. if (ch == def_oc_syms[i]) break; 613. return i; 614. } 615. 616. /* 617. * Convert a character into a monster class. This returns the _first_ 618. * match made. If there are are no matches, return MAXMCLASSES. 619. */ 620. int 621. def_char_to_monclass(ch) 622. char ch; 623. { 624. int i; 625. for (i = 1; i < MAXMCLASSES; i++) 626. if (def_monsyms[i] == ch) break; 627. return i; 628. } 629. 630. void 631. assign_graphics(graph_chars, glth, maxlen, offset) 632. register uchar *graph_chars; 633. int glth, maxlen, offset; 634. { 635. register int i; 636. 637. for (i = 0; i < maxlen; i++) 638. showsyms[i+offset] = (((i < glth) && graph_chars[i]) ? 639. graph_chars[i] : defsyms[i+offset].sym); 640. } 641. 642. void 643. switch_graphics(gr_set_flag) 644. int gr_set_flag; 645. { 646. switch (gr_set_flag) { 647. default: 648. case ASCII_GRAPHICS: 649. assign_graphics((uchar *)0, 0, MAXPCHARS, 0); 650. #ifdef PC9800 651. if (ascgraphics_mode_callback) (*ascgraphics_mode_callback)(); 652. #endif 653. break; 654. #ifdef ASCIIGRAPH 655. case IBM_GRAPHICS: 656. /* 657. * Use the nice IBM Extended ASCII line-drawing characters (codepage 437). 658. * 659. * OS/2 defaults to a multilingual character set (codepage 850, corresponding 660. * to the ISO 8859 character set. We should probably do a VioSetCp() call to 661. * set the codepage to 437. 662. */ 663. iflags.IBMgraphics = TRUE; 664. iflags.DECgraphics = FALSE; 665. assign_graphics(ibm_graphics, SIZE(ibm_graphics), MAXPCHARS, 0); 666. #ifdef PC9800 667. if (ibmgraphics_mode_callback) (*ibmgraphics_mode_callback)(); 668. #endif 669. break; 670. #endif /* ASCIIGRAPH */ 671. #ifdef TERMLIB 672. case DEC_GRAPHICS: 673. /* 674. * Use the VT100 line drawing character set. 675. */ 676. iflags.DECgraphics = TRUE; 677. iflags.IBMgraphics = FALSE; 678. assign_graphics(dec_graphics, SIZE(dec_graphics), MAXPCHARS, 0); 679. if (decgraphics_mode_callback) (*decgraphics_mode_callback)(); 680. break; 681. #endif /* TERMLIB */ 682. #ifdef MAC_GRAPHICS_ENV 683. case MAC_GRAPHICS: 684. assign_graphics(mac_graphics, SIZE(mac_graphics), MAXPCHARS, 0); 685. break; 686. #endif 687. } 688. return; 689. } 690. 691. 692. #ifdef REINCARNATION 693. 694. /* 695. * saved display symbols for objects & features. 696. */ 697. static uchar save_oc_syms[MAXOCLASSES] = DUMMY; 698. static uchar save_showsyms[MAXPCHARS] = DUMMY; 699. static uchar save_monsyms[MAXPCHARS] = DUMMY; 700. 701. static const uchar r_oc_syms[MAXOCLASSES] = { 702. /* 0*/ '\0', 703. ILLOBJ_SYM, 704. WEAPON_SYM, 705. ']', /* armor */ 706. RING_SYM, 707. /* 5*/ ',', /* amulet */ 708. TOOL_SYM, 709. ':', /* food */ 710. POTION_SYM, 711. SCROLL_SYM, 712. /*10*/ SPBOOK_SYM, 713. WAND_SYM, 714. GEM_SYM, /* gold -- yes it's the same as gems */ 715. GEM_SYM, 716. ROCK_SYM, 717. /*15*/ BALL_SYM, 718. CHAIN_SYM, 719. VENOM_SYM 720. }; 721. 722. # ifdef ASCIIGRAPH 723. static const uchar IBM_r_oc_syms[MAXOCLASSES] = { /* a la EPYX Rogue */ 724. /* 0*/ '\0', 725. ILLOBJ_SYM, 726. 0x18, /* weapon: up arrow */ 727. /* 0x0a, */ ARMOR_SYM, /* armor: Vert rect with o */ 728. /* 0x09, */ RING_SYM, /* ring: circle with arrow */ 729. /* 5*/ 0x0c, /* amulet: "female" symbol */ 730. TOOL_SYM, 731. 0x05, /* food: club (as in cards) */ 732. 0xad, /* potion: upside down '!' */ 733. 0x0e, /* scroll: musical note */ 734. /*10*/ SPBOOK_SYM, 735. 0xe7, /* wand: greek tau */ 736. 0x0f, /* gold: yes it's the same as gems */ 737. 0x0f, /* gems: fancy '*' */ 738. ROCK_SYM, 739. /*15*/ BALL_SYM, 740. CHAIN_SYM, 741. VENOM_SYM 742. }; 743. # endif /* ASCIIGRAPH */ 744. 745. void 746. assign_rogue_graphics(is_rlevel) 747. boolean is_rlevel; 748. { 749. /* Adjust graphics display characters on Rogue levels */ 750. 751. if (is_rlevel) { 752. register int i; 753. 754. (void) memcpy((genericptr_t)save_showsyms, 755. (genericptr_t)showsyms, sizeof showsyms); 756. (void) memcpy((genericptr_t)save_oc_syms, 757. (genericptr_t)oc_syms, sizeof oc_syms); 758. (void) memcpy((genericptr_t)save_monsyms, 759. (genericptr_t)monsyms, sizeof monsyms); 760. 761. /* Use a loop: char != uchar on some machines. */ 762. for (i = 0; i < MAXMCLASSES; i++) 763. monsyms[i] = def_monsyms[i]; 764. # ifdef ASCIIGRAPH 765. if (iflags.IBMgraphics 766. # if defined(USE_TILES) && defined(MSDOS) 767. && !iflags.grmode 768. # endif 769. ) 770. monsyms[S_HUMAN] = 0x01; /* smiley face */ 771. # endif 772. for (i = 0; i < MAXPCHARS; i++) 773. showsyms[i] = defsyms[i].sym; 774. 775. /* 776. * Some day if these rogue showsyms get much more extensive than this, 777. * we may want to create r_showsyms, and IBM_r_showsyms arrays to hold 778. * all of this info and to simply initialize it via a for() loop like r_oc_syms. 779. */ 780. 781. # ifdef ASCIIGRAPH 782. if (!iflags.IBMgraphics 783. # if defined(USE_TILES) && defined(MSDOS) 784. || iflags.grmode 785. # endif 786. ) { 787. # endif 788. showsyms[S_vodoor] = showsyms[S_hodoor] = showsyms[S_ndoor] = '+'; 789. showsyms[S_upstair] = showsyms[S_dnstair] = '%'; 790. # ifdef ASCIIGRAPH 791. } else { 792. /* a la EPYX Rogue */ 793. showsyms[S_vwall] = 0xba; /* all walls now use */ 794. showsyms[S_hwall] = 0xcd; /* double line graphics */ 795. showsyms[S_tlcorn] = 0xc9; 796. showsyms[S_trcorn] = 0xbb; 797. showsyms[S_blcorn] = 0xc8; 798. showsyms[S_brcorn] = 0xbc; 799. showsyms[S_crwall] = 0xce; 800. showsyms[S_tuwall] = 0xca; 801. showsyms[S_tdwall] = 0xcb; 802. showsyms[S_tlwall] = 0xb9; 803. showsyms[S_trwall] = 0xcc; 804. showsyms[S_ndoor] = 0xce; 805. showsyms[S_vodoor] = 0xce; 806. showsyms[S_hodoor] = 0xce; 807. showsyms[S_room] = 0xfa; /* centered dot */ 808. showsyms[S_corr] = 0xb1; 809. showsyms[S_litcorr] = 0xb2; 810. showsyms[S_upstair] = 0xf0; /* Greek Xi */ 811. showsyms[S_dnstair] = 0xf0; 812. showsyms[S_arrow_trap] = 0x04; /* diamond (cards) */ 813. showsyms[S_dart_trap] = 0x04; 814. showsyms[S_falling_rock_trap] = 0x04; 815. showsyms[S_squeaky_board] = 0x04; 816. showsyms[S_bear_trap] = 0x04; 817. showsyms[S_land_mine] = 0x04; 818. showsyms[S_rolling_boulder_trap] = 0x04; 819. showsyms[S_sleeping_gas_trap] = 0x04; 820. showsyms[S_rust_trap] = 0x04; 821. showsyms[S_fire_trap] = 0x04; 822. showsyms[S_pit] = 0x04; 823. showsyms[S_spiked_pit] = 0x04; 824. showsyms[S_hole] = 0x04; 825. showsyms[S_trap_door] = 0x04; 826. showsyms[S_teleportation_trap] = 0x04; 827. showsyms[S_level_teleporter] = 0x04; 828. showsyms[S_magic_portal] = 0x04; 829. showsyms[S_web] = 0x04; 830. showsyms[S_statue_trap] = 0x04; 831. showsyms[S_magic_trap] = 0x04; 832. showsyms[S_anti_magic_trap] = 0x04; 833. showsyms[S_polymorph_trap] = 0x04; 834. } 835. #endif /* ASCIIGRAPH */ 836. 837. for (i = 0; i < MAXOCLASSES; i++) { 838. #ifdef ASCIIGRAPH 839. if (iflags.IBMgraphics 840. # if defined(USE_TILES) && defined(MSDOS) 841. && !iflags.grmode 842. # endif 843. ) 844. oc_syms[i] = IBM_r_oc_syms[i]; 845. else 846. #endif /* ASCIIGRAPH */ 847. oc_syms[i] = r_oc_syms[i]; 848. } 849. #if defined(MSDOS) && defined(USE_TILES) 850. if (iflags.grmode) tileview(FALSE); 851. #endif 852. } else { 853. (void) memcpy((genericptr_t)showsyms, 854. (genericptr_t)save_showsyms, sizeof showsyms); 855. (void) memcpy((genericptr_t)oc_syms, 856. (genericptr_t)save_oc_syms, sizeof oc_syms); 857. (void) memcpy((genericptr_t)monsyms, 858. (genericptr_t)save_monsyms, sizeof monsyms); 859. #if defined(MSDOS) && defined(USE_TILES) 860. if (iflags.grmode) tileview(TRUE); 861. #endif 862. } 863. } 864. #endif /* REINCARNATION */ 865. 866. /*drawing.c*/
|