home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume7 / nethack3 / patch6o < prev    next >
Internet Message Format  |  1989-11-27  |  62KB

  1. Path: uunet!zephyr.ens.tek.com!tekgen!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v08i068:  NetHack3 -  display oriented dungeons & dragons (Ver. 3.0), Patch6o
  5. Message-ID: <4857@tekred.CNA.TEK.COM>
  6. Date: 22 Nov 89 19:57:01 GMT
  7. Sender: nobody@tekred.CNA.TEK.COM
  8. Lines: 2398
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: Izchak Miller <izchak@linc.cis.upenn.edu>
  12. Posting-number: Volume 8, Issue 68
  13. Archive-name: NetHack3/Patch6o
  14. Patch-To: NetHack3: Volume 7, Issue 56-93
  15.  
  16.  
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 15 (of 15)."
  25. # Contents:  include/extern.h src/dbridge.c
  26. # Wrapped by billr@saab on Wed Nov 22 10:50:23 1989
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'include/extern.h' -a "${1}" != "-c" ; then 
  29.   echo shar: clobbering existing file \"'include/extern.h'\"
  30. fi
  31. echo shar: Extracting \"'include/extern.h'\" \(37999 characters\)
  32. sed "s/^X//" >'include/extern.h' <<'END_OF_FILE'
  33. X/*    SCCS Id: @(#)extern.h    3.0    88/10/18 */
  34. X/*     Copyright (c)   Steve Creps, 1988.          */
  35. X/* NetHack may be freely redistributed.  See license for details. */
  36. X
  37. X#ifndef EXTERN_H
  38. X#define EXTERN_H
  39. X
  40. X#if defined(MSDOS) && defined(MSC)
  41. X/* MSC include files do not contain "extern" keyword */
  42. X#define E
  43. X#else
  44. X#define E extern
  45. X#endif
  46. X
  47. X/* ### allmain.c ### */
  48. X
  49. XE int (*occupation)();
  50. XE int (*afternmv)();
  51. XE void moveloop();
  52. XE void stop_occupation();
  53. XE void newgame();
  54. X
  55. X/* ### alloc.c ### */
  56. X
  57. X#ifndef __TURBOC__
  58. XE long *FDECL(alloc, (unsigned int));
  59. X#endif
  60. X
  61. X#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C)
  62. X
  63. X/* ### apply.c ### */
  64. X
  65. X#ifdef OVERLAY
  66. XE int dig();
  67. X#endif
  68. XE int doapply();
  69. XE int holetime();
  70. XE void dighole();
  71. XE int dorub();
  72. XE int dojump();
  73. X#ifdef WALKIES
  74. XE int number_leashed();
  75. XE void FDECL(o_unleash, (struct obj *));
  76. XE void FDECL(m_unleash, (struct monst *));
  77. XE void unleash_all();
  78. XE boolean next_to_u();
  79. XE struct obj *FDECL(get_mleash, (struct monst *));
  80. XE void FDECL(check_leash, (XCHAR_P,XCHAR_P));
  81. X#endif
  82. XE boolean FDECL(um_dist, (XCHAR_P,XCHAR_P,XCHAR_P));
  83. XE int FDECL(use_unicorn_horn, (struct obj *));
  84. X
  85. X/* ### artifact.c ### */
  86. X
  87. X#ifdef NAMED_ITEMS
  88. XE void FDECL(mkartifact, (struct obj **));
  89. XE boolean FDECL(is_artifact, (struct obj *));
  90. XE boolean FDECL(spec_ability, (struct obj *,unsigned));
  91. XE int FDECL(restr_name, (struct obj *,char *));
  92. X# if defined(THEOLOGY) && defined(ALTARS)
  93. XE struct obj *FDECL(mk_aligned_artifact, (unsigned));
  94. X# endif
  95. XE int FDECL(defends, (int,struct obj *));
  96. XE int FDECL(spec_abon, (struct obj *,struct permonst *));
  97. XE int FDECL(spec_dbon, (struct obj *,struct permonst *,int));
  98. X#endif
  99. X
  100. X/* ### attrib.c ### */
  101. X
  102. XE void FDECL(adjattrib, (int,int,BOOLEAN_P));
  103. XE void FDECL(change_luck, (SCHAR_P));
  104. XE int FDECL(stone_luck, (BOOLEAN_P));
  105. XE void FDECL(gainstr, (struct obj *,int));
  106. XE void FDECL(losestr, (int));
  107. XE void restore_attrib();
  108. XE void FDECL(init_attr, (int));
  109. XE void redist_attr();
  110. XE void FDECL(adjabil, (int));
  111. XE int newhp();
  112. XE schar acurr();
  113. XE void FDECL(adjalign, (int));
  114. X
  115. X/* ### bones.c ### */
  116. X
  117. XE void savebones();
  118. XE int getbones();
  119. XE void FDECL(name_file, (char *,int));
  120. X
  121. X/* ### cmd.c ### */
  122. X
  123. X#ifdef OVERLAY
  124. XE int doextcmd();
  125. X#ifdef POLYSELF
  126. XE int domonability();
  127. X#endif /* POLYSELF */
  128. XE int timed_occupation();
  129. X#if defined(WIZARD) || defined(EXPLORE_MODE)
  130. XE int wiz_attributes();
  131. X#endif /* WIZARD */
  132. X#ifdef WIZARD
  133. XE int wiz_detect();
  134. XE int wiz_genesis();
  135. XE int wiz_identify();
  136. XE int wiz_level_tele();
  137. XE int wiz_map();
  138. XE int wiz_where();
  139. XE int wiz_wish();
  140. X#endif /* WIZARD */
  141. X#endif /* OVERLAY */
  142. XE void reset_occupations();
  143. XE void FDECL(set_occupation, (int(*)(),char *,int));
  144. X#ifdef REDO
  145. XE char pgetchar();
  146. XE void FDECL(pushch, (CHAR_P));
  147. XE void FDECL(savech, (CHAR_P));
  148. X#endif
  149. XE void FDECL(rhack, (char *));
  150. XE char FDECL(lowc, (CHAR_P));
  151. XE void enlightenment();
  152. XE int FDECL(xytod, (SCHAR_P,SCHAR_P));
  153. XE void FDECL(dtoxy, (coord *,int));
  154. XE int FDECL(movecmd, (CHAR_P));
  155. XE int FDECL(getdir, (BOOLEAN_P));
  156. XE void confdir();
  157. XE int FDECL(isok, (int,int));
  158. XE int doextlist();
  159. X
  160. X/* ### dbridge.c ### */
  161. X
  162. XE boolean FDECL(is_pool, (int,int));
  163. X#ifdef STRONGHOLD
  164. XE void FDECL(initsym, (int,int));
  165. XE int FDECL(is_drawbridge_wall, (int, int));
  166. XE boolean FDECL(is_db_wall, (int, int));
  167. XE boolean FDECL(find_drawbridge, (int *, int*));
  168. XE boolean FDECL(create_drawbridge, (int, int, int, BOOLEAN_P));
  169. XE void FDECL(open_drawbridge, (int, int));
  170. XE void FDECL(close_drawbridge, (int, int));
  171. XE void FDECL(destroy_drawbridge, (int, int));
  172. X#endif    /* STRONGHOLD /**/
  173. X
  174. X/* ### decl.c ### */
  175. X
  176. X/* ### demon.c ### */
  177. X
  178. XE void FDECL(dsummon, (struct permonst *));
  179. XE int FDECL(demon_talk, (struct monst *));
  180. XE long FDECL(bribe, (struct monst *));
  181. XE int dprince();
  182. XE int dlord();
  183. XE int ndemon();
  184. X
  185. X/* ### do.c ### */
  186. X
  187. X#ifdef OVERLAY
  188. XE int FDECL(drop, (struct obj *));
  189. XE int wipeoff();
  190. X#endif
  191. XE int dodrop();
  192. XE boolean FDECL(flooreffects, (struct obj *,int,int));
  193. XE void FDECL(doaltarobj, (struct obj *));
  194. XE boolean FDECL(canletgo, (struct obj *,char *));
  195. XE void FDECL(dropx, (struct obj *));
  196. XE void FDECL(dropy, (struct obj *));
  197. XE int doddrop();
  198. XE int dodown();
  199. XE int doup();
  200. XE void FDECL(goto_level, (int,BOOLEAN_P,BOOLEAN_P));
  201. XE int donull();
  202. XE int dowipe();
  203. XE struct obj *FDECL(splitobj, (struct obj *,int));
  204. XE void FDECL(set_wounded_legs, (long,int));
  205. XE void heal_legs();
  206. X
  207. X/* ### do_name.c ### */
  208. X
  209. XE void FDECL(getpos, (coord *,int,char *));
  210. XE int do_mname();
  211. XE struct obj *FDECL(oname, (struct obj *,char *,int));
  212. XE int ddocall();
  213. XE void FDECL(docall, (struct obj *));
  214. XE char *FDECL(x_monnam, (struct monst *,int));
  215. XE char *FDECL(lmonnam, (struct monst *));
  216. XE char *FDECL(mon_nam, (struct monst *));
  217. XE char *FDECL(Monnam, (struct monst *));
  218. XE char *FDECL(a_monnam, (struct monst *,char *));
  219. XE char *FDECL(a2_monnam, (struct monst *,char *));
  220. XE char *FDECL(Amonnam, (struct monst *,char *));
  221. XE char *FDECL(Xmonnam, (struct monst *));
  222. XE char *FDECL(defmonnam, (struct monst *));
  223. XE char *rndmonnam();
  224. X#ifdef REINCARNATION
  225. XE char *roguename();
  226. X#endif
  227. X
  228. X/* ### do_wear.c ### */
  229. X
  230. X#ifdef OVERLAY
  231. XE int Armor_on();
  232. XE int Boots_on();
  233. XE int Gloves_on();
  234. XE int Helmet_on();
  235. XE int FDECL(select_off, (struct obj *otmp));
  236. XE int take_off();
  237. X#endif
  238. XE void FDECL(off_msg, (struct obj *));
  239. XE boolean FDECL(is_helmet, (struct obj *));
  240. XE boolean FDECL(is_gloves, (struct obj *));
  241. XE boolean FDECL(is_boots, (struct obj *));
  242. XE boolean FDECL(is_cloak, (struct obj *));
  243. XE boolean FDECL(is_shield, (struct obj *));
  244. XE void set_wear();
  245. XE boolean FDECL(donning, (struct obj *));
  246. XE int Armor_off();
  247. XE int Armor_gone();
  248. XE int Helmet_off();
  249. XE int Gloves_off();
  250. XE int Boots_off();
  251. XE int Cloak_off();
  252. XE int Shield_off();
  253. XE void Amulet_off();
  254. XE void FDECL(Ring_on, (struct obj *));
  255. XE void FDECL(Ring_off, (struct obj *));
  256. XE void FDECL(Ring_gone, (struct obj *));
  257. XE void FDECL(Blindf_on, (struct obj *));
  258. XE void FDECL(Blindf_off, (struct obj *));
  259. XE int dotakeoff();
  260. XE int doremring();
  261. XE int FDECL(cursed, (struct obj *));
  262. XE int FDECL(armoroff, (struct obj *));
  263. XE int dowear();
  264. XE int doputon();
  265. XE void find_ac();
  266. XE void glibr();
  267. XE struct obj *some_armor();
  268. XE void corrode_armor();
  269. XE void reset_remarm();
  270. XE int doddoremarm();
  271. XE int FDECL(destroy_arm, (struct obj *));
  272. XE void FDECL(adj_abon, (struct obj *,SCHAR_P));
  273. X
  274. X/* ### dog.c ### */
  275. X
  276. XE void FDECL(initedog, (struct monst *));
  277. XE void FDECL(make_familiar, (struct obj *));
  278. XE struct monst *makedog();
  279. XE void losedogs();
  280. XE void keepdogs();
  281. XE void FDECL(fall_down, (struct monst *,int));
  282. XE int FDECL(dogfood, (struct monst *,struct obj *));
  283. XE int FDECL(inroom, (XCHAR_P,XCHAR_P));
  284. XE int FDECL(tamedog, (struct monst *,struct obj *));
  285. X
  286. X/* ### dogmove.c ### */
  287. X
  288. XE int FDECL(dog_move, (struct monst *,int));
  289. X
  290. X/* ### dokick.c ### */
  291. X
  292. XE boolean FDECL(ghitm, (struct monst *,long));
  293. XE boolean FDECL(bad_kick_throw_pos, (XCHAR_P,XCHAR_P));
  294. XE struct monst *FDECL(ghit, (int,int,int));
  295. XE int dokick();
  296. X
  297. X/* ### dothrow.c ### */
  298. X
  299. XE int dothrow();
  300. XE int FDECL(throwit, (struct obj *));
  301. XE int FDECL(thitmonst, (struct monst *,struct obj *));
  302. XE int FDECL(breaks, (struct obj *,BOOLEAN_P));
  303. X
  304. X/* ### eat.c ### */
  305. X
  306. X#ifdef OVERLAY
  307. XE int Meatdone();
  308. XE int eatfood();
  309. XE int opentin();
  310. XE int unfaint();
  311. X#endif
  312. XE void init_uhunger();
  313. XE int Hear_again();
  314. XE void reset_eat();
  315. XE int doeat();
  316. XE void gethungry();
  317. XE void FDECL(morehungry, (int));
  318. XE void FDECL(lesshungry, (int));
  319. XE void FDECL(newuhs, (BOOLEAN_P));
  320. XE struct obj *FDECL(floorfood, (char *,BOOLEAN_P));
  321. XE void vomit();
  322. XE int FDECL(eaten_stat, (int, struct obj *));
  323. X
  324. X/* ### end.c ### */
  325. X
  326. XE int done1();
  327. XE int done2();
  328. XE void FDECL(done_in_by, (struct monst *));
  329. XE void VDECL(panic, (char *,...));
  330. XE void FDECL(done, (int));
  331. XE void clearlocks();
  332. X#ifdef NOSAVEONHANGUP
  333. XE void hangup();
  334. X#endif
  335. X
  336. X/* ### engrave.c ### */
  337. X
  338. X#ifdef ELBERETH
  339. XE int FDECL(sengr_at, (char *,XCHAR_P,XCHAR_P));
  340. X#endif
  341. XE void FDECL(u_wipe_engr, (int));
  342. XE void FDECL(wipe_engr_at, (XCHAR_P,XCHAR_P,XCHAR_P));
  343. XE void FDECL(read_engr_at, (int,int));
  344. XE void FDECL(make_engr_at, (int,int,char *));
  345. XE int freehand();
  346. XE int doengrave();
  347. XE void FDECL(save_engravings, (int));
  348. XE void FDECL(rest_engravings, (int));
  349. X
  350. X/* ### exper.c ### */
  351. X
  352. XE long FDECL(newuexp, (unsigned));
  353. XE int FDECL(experience, (struct monst *,int));
  354. XE void FDECL(more_experienced, (int,int));
  355. XE void losexp();
  356. XE void newexplevel();
  357. XE void pluslvl();
  358. XE long rndexp();
  359. X
  360. X/* ### extralev.c ### */
  361. X
  362. X#ifdef REINCARNATION
  363. XE void makeroguerooms();
  364. XE void FDECL(corr, (int,int));
  365. XE void makerogueghost();
  366. X#endif
  367. X
  368. X/* ### fountain.c ### */
  369. X
  370. X#ifdef FOUNTAINS
  371. XE void dryup();
  372. XE void drinkfountain();
  373. XE void FDECL(dipfountain, (struct obj *));
  374. X#endif /* FOUNTAINS */
  375. X#ifdef SINKS
  376. XE void drinksink();
  377. X#endif
  378. X
  379. X/* ### getline.c ### */
  380. X
  381. XE void FDECL(getlin, (char *));
  382. XE void getret();
  383. XE void FDECL(cgetret, (char *));
  384. XE void FDECL(xwaitforspace, (char *));
  385. XE char *parse();
  386. XE char readchar();
  387. X#ifdef COM_COMPL
  388. XE void FDECL(get_ext_cmd, (char *));
  389. X#endif /* COM_COMPL */
  390. X
  391. X/* ### hack.c ### */
  392. X
  393. XE void unsee();
  394. XE void FDECL(seeoff, (int));
  395. XE void FDECL(movobj, (struct obj *,XCHAR_P,XCHAR_P));
  396. XE boolean FDECL(may_dig, (XCHAR_P,XCHAR_P));
  397. XE void domove();
  398. XE void spoteffects();
  399. XE int dopickup();
  400. XE void lookaround();
  401. XE int monster_nearby();
  402. XE int FDECL(cansee, (XCHAR_P,XCHAR_P));
  403. XE int FDECL(sgn, (int));
  404. XE void FDECL(getcorners, (xchar *,xchar *,xchar *,xchar *,xchar *,xchar *,xchar *,xchar *));
  405. XE void setsee();
  406. XE void FDECL(nomul, (int));
  407. XE void FDECL(losehp, (int,const char *));
  408. XE int weight_cap();
  409. XE int inv_weight();
  410. XE int inv_cnt();
  411. XE int FDECL(identify, (struct obj *));
  412. X#ifdef STUPID_CPP    /* otherwise these functions are macros in hack.h */
  413. XE char yn();
  414. XE char ynq();
  415. XE char ynaq();
  416. XE char nyaq();
  417. XE char *FDECL(plur, (long));
  418. XE void FDECL(makeknown, (unsigned));
  419. X#endif
  420. X
  421. X/* ### invent.c ### */
  422. X
  423. X#ifdef OVERLAY
  424. XE int FDECL(ckunpaid, (struct obj *));
  425. X#endif
  426. XE struct obj *FDECL(addinv, (struct obj *));
  427. XE void FDECL(useup, (struct obj *));
  428. XE void FDECL(freeinv, (struct obj *));
  429. XE void FDECL(delobj, (struct obj *));
  430. XE void FDECL(freeobj, (struct obj *));
  431. XE void FDECL(freegold, (struct gold *));
  432. XE struct obj *FDECL(sobj_at, (int,int,int));
  433. XE int FDECL(carried, (struct obj *));
  434. XE struct obj *FDECL(carrying, (int));
  435. XE boolean have_lizard();
  436. XE struct obj *FDECL(o_on, (unsigned int,struct obj *));
  437. XE boolean FDECL(obj_here, (struct obj *,int,int));
  438. XE struct gold *FDECL(g_at, (int,int));
  439. XE struct obj *FDECL(getobj, (const char *,const char *));
  440. XE int FDECL(ggetobj, (char *,int(*)(),int));
  441. XE int FDECL(askchain, (struct obj *,int,char *,int,int(*)(),int(*)(),int,char *));
  442. XE void FDECL(prinv, (struct obj *));
  443. XE int ddoinv();
  444. XE void FDECL(doinv, (char *));
  445. XE int dotypeinv();
  446. XE int dolook();
  447. XE void FDECL(stackobj, (struct obj *));
  448. XE int doprgold();
  449. XE int doprwep();
  450. XE int doprarm();
  451. XE int doprring();
  452. XE int dopramulet();
  453. XE int doprtool();
  454. XE int FDECL(digit, (CHAR_P));
  455. XE void FDECL(useupf, (struct obj *));
  456. XE char *FDECL(let_to_name, (CHAR_P));
  457. XE void reassign();
  458. X
  459. X/* ### ioctl.c ### */
  460. X
  461. X#ifdef UNIX
  462. XE void getioctls();
  463. XE void setioctls();
  464. X# ifdef SUSPEND
  465. XE int dosuspend();
  466. X# endif /* SUSPEND */
  467. X#endif /* UNIX */
  468. X
  469. X/* ### lock.c ### */
  470. X
  471. X#ifdef OVERLAY
  472. XE int forcelock();
  473. XE int picklock();
  474. X#endif
  475. XE void reset_pick();
  476. XE int FDECL(pick_lock, (struct obj *));
  477. XE int doforce();
  478. XE int FDECL(boxlock, (struct obj *,struct obj *));
  479. XE int FDECL(doorlock, (struct obj *,int,int));
  480. XE int doopen();
  481. XE int doclose();
  482. X
  483. X/* ### mac.c ### */
  484. X#ifdef MACOS
  485. XE int tgetch();
  486. XE void gethdate();
  487. XE int uptodate();
  488. X# ifndef THINKC4
  489. XE char *getenv();
  490. XE int memcmp();
  491. X# else
  492. XE int kbhit();
  493. X# endif
  494. XE int mcurs();
  495. XE int mputc();
  496. XE int mputs();
  497. XE int mprintf();
  498. XE int about();
  499. X#endif  /* MACOS */
  500. X
  501. X/* ### macfile.c ### */
  502. X#ifdef MACOS
  503. XE short findNamedFile();
  504. XE FILE *openFile();
  505. X#endif    /* MACOS */
  506. X
  507. X/* ### macinit.c ### */
  508. X#ifdef MACOS
  509. XE int initterm();
  510. XE int freeterm();
  511. X#ifdef SMALLDATA
  512. XE void init_decl();
  513. XE void free_decl();
  514. X#endif  /* SMALLDATA */
  515. X#endif    /* MACOS */
  516. X
  517. X/* ### mail.c ### */
  518. X
  519. X#ifdef MAIL
  520. X# ifdef UNIX
  521. XE void getmailstatus();
  522. X# endif
  523. XE void ckmailstatus();
  524. XE void readmail();
  525. X#endif /* MAIL */
  526. X
  527. X/* ### makemon.c ### */
  528. X
  529. XE struct monst *FDECL(makemon, (struct permonst *,int,int));
  530. XE void FDECL(enexto, (coord *,XCHAR_P,XCHAR_P,struct permonst *));
  531. XE int FDECL(goodpos, (int,int, struct permonst *));
  532. XE void FDECL(rloc, (struct monst *));
  533. XE void FDECL(vloc, (struct monst *));
  534. XE void init_monstr();
  535. XE struct permonst *rndmonst();
  536. XE struct permonst *FDECL(mkclass, (CHAR_P));
  537. XE int FDECL(adj_lev, (struct permonst *));
  538. XE struct permonst *FDECL(grow_up, (struct monst *));
  539. XE int FDECL(mongets, (struct monst *,int));
  540. X#ifdef REINCARNATION
  541. XE struct permonst *roguemon();
  542. X#endif
  543. X#ifdef GOLEMS
  544. XE int FDECL(golemhp, (int));
  545. X#endif /* GOLEMS */
  546. XE boolean FDECL(peace_minded, (struct permonst *));
  547. XE void FDECL(set_malign, (struct monst *));
  548. XE void FDECL(set_mimic_sym, (struct monst *));
  549. X
  550. X/* ### mcastu.c ### */
  551. X
  552. XE int FDECL(castmu, (struct monst *,struct attack *));
  553. XE int FDECL(buzzmu, (struct monst *,struct attack *));
  554. X
  555. X/* ### mhitm.c ### */
  556. X
  557. XE int FDECL(fightm, (struct monst *));
  558. XE int FDECL(mattackm, (struct monst *,struct monst *));
  559. XE int FDECL(noattacks, (struct permonst *));
  560. X
  561. X/* ### mhitu.c ### */
  562. X
  563. X#ifdef POLYSELF
  564. XE struct monst *cloneu();
  565. X#endif
  566. XE void FDECL(regurgitates, (struct monst *));
  567. XE int FDECL(mattacku, (struct monst *));
  568. XE void FDECL(mdamageu, (struct monst *,int));
  569. XE int FDECL(could_seduce, (struct monst *,struct monst *,struct attack *));
  570. X#ifdef SEDUCE
  571. XE int FDECL(doseduce, (struct monst *));
  572. X#endif
  573. X
  574. X/* ### mklev.c ### */
  575. X
  576. XE int FDECL(somex, (struct mkroom *));
  577. XE int FDECL(somey, (struct mkroom *));
  578. X#ifdef ORACLE
  579. XE boolean FDECL(place_oracle, (struct mkroom *,int *,int *,int *));
  580. X#endif
  581. XE void mklev();
  582. XE int FDECL(okdoor, (XCHAR_P,XCHAR_P));
  583. XE void FDECL(dodoor, (int,int,struct mkroom *));
  584. XE void FDECL(mktrap, (int,int,struct mkroom *));
  585. XE void FDECL(mkfount, (int,struct mkroom *));
  586. X
  587. X/* ### mkmaze.c ### */
  588. X
  589. X#if defined(WALLIFIED_MAZE) || defined(STRONGHOLD)
  590. XE void FDECL(wallification, (int,int,int,int,BOOLEAN_P));
  591. X#endif
  592. XE void FDECL(walkfrom, (int,int));
  593. XE void makemaz();
  594. XE void FDECL(move, (int *,int *,int));
  595. XE void FDECL(mazexy, (coord *));
  596. XE void bound_digging();
  597. X
  598. X/* ### mkobj.c ### */
  599. X
  600. XE struct obj *FDECL(mkobj_at, (CHAR_P,int,int));
  601. XE struct obj *FDECL(mksobj_at, (int,int,int));
  602. XE struct obj *FDECL(mkobj, (CHAR_P,BOOLEAN_P));
  603. XE int rndmonnum();
  604. XE struct obj *FDECL(mksobj, (int,BOOLEAN_P));
  605. XE int FDECL(letter, (int));
  606. XE int FDECL(weight, (struct obj *));
  607. XE void FDECL(mkgold, (long,int,int));
  608. XE struct obj *FDECL(mkcorpstat, (int,struct permonst *,int,int));
  609. XE struct obj *FDECL(mk_tt_object, (int,int,int));
  610. XE struct obj *FDECL(mk_named_object, (int,struct permonst *,int,int,char *,int));
  611. XE void FDECL(bless, (struct obj *));
  612. XE void FDECL(curse, (struct obj *));
  613. XE void FDECL(blessorcurse, (struct obj *,int));
  614. X#ifdef STUPID_CPP
  615. XE boolean FDECL(is_flammable, (struct obj *));
  616. XE boolean FDECL(is_rustprone, (struct obj *));
  617. XE boolean FDECL(is_corrodeable, (struct obj *));
  618. XE boolean FDECL(OBJ_AT, (int, int));
  619. X#endif
  620. XE void FDECL(place_object, (struct obj *,int,int));
  621. XE void FDECL(move_object, (struct obj *,int,int));
  622. XE void FDECL(remove_object, (struct obj *));
  623. X
  624. X/* ### mkroom.c ### */
  625. X
  626. XE void FDECL(mkroom, (int));
  627. XE void FDECL(shrine_pos, (int *, int*, struct mkroom *));
  628. XE boolean FDECL(nexttodoor, (int,int));
  629. XE boolean FDECL(has_dnstairs, (struct mkroom *));
  630. XE boolean FDECL(has_upstairs, (struct mkroom *));
  631. XE int FDECL(dist2, (int,int,int,int));
  632. XE struct permonst *courtmon();
  633. XE int FDECL(bcsign, (struct obj *));
  634. X
  635. X/* ### mon.c ### */
  636. X
  637. XE void movemon();
  638. XE void FDECL(meatgold, (struct monst *));
  639. XE void FDECL(meatobj, (struct monst *));
  640. XE void FDECL(mpickgold, (struct monst *));
  641. XE void FDECL(mpickgems, (struct monst *));
  642. XE int FDECL(curr_mon_load, (struct monst *));
  643. XE int FDECL(max_mon_load, (struct monst *));
  644. XE boolean FDECL(can_carry, (struct monst *,struct obj *));
  645. XE void FDECL(mpickstuff, (struct monst *,char *));
  646. XE int FDECL(mfndpos, (struct monst *,coord *,long *,long));
  647. XE int FDECL(dist, (int,int));
  648. XE boolean FDECL(monnear, (struct monst *,int,int));
  649. XE void FDECL(poisontell, (int));
  650. XE void FDECL(poisoned, (char *,int,char *));
  651. XE void FDECL(mondead, (struct monst *));
  652. XE void FDECL(replmon, (struct monst *,struct monst *));
  653. XE void FDECL(relmon, (struct monst *));
  654. XE void FDECL(monfree, (struct monst *));
  655. XE void FDECL(unstuck, (struct monst *));
  656. XE void FDECL(killed, (struct monst *));
  657. XE void FDECL(xkilled, (struct monst *,int));
  658. XE void rescham();
  659. XE void restartcham();
  660. XE int FDECL(newcham, (struct monst *,struct permonst *));
  661. XE void FDECL(mnexto, (struct monst *));
  662. XE void FDECL(mnearto, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P));
  663. XE void FDECL(setmangry, (struct monst *));
  664. XE int FDECL(disturb, (struct monst *));
  665. XE void FDECL(mondied, (struct monst *));
  666. XE void FDECL(mongone, (struct monst *));
  667. XE void FDECL(monstone, (struct monst *));
  668. X#ifdef GOLEMS
  669. XE void FDECL(golemeffects, (struct monst *, int, int));
  670. X#endif /* GOLEMS */
  671. X
  672. X/* ### mondata.c ### */
  673. X
  674. XE boolean FDECL(attacktype, (struct permonst *,int));
  675. XE boolean FDECL(resists_ston, (struct permonst *));
  676. XE boolean FDECL(resists_drli, (struct permonst *));
  677. XE boolean FDECL(ranged_attk, (struct permonst *));
  678. XE boolean FDECL(can_track, (struct permonst *));
  679. X#ifdef POLYSELF
  680. XE boolean FDECL(breakarm, (struct permonst *));
  681. XE boolean FDECL(sliparm, (struct permonst *));
  682. X#endif
  683. XE boolean FDECL(sticks, (struct permonst *));
  684. XE boolean FDECL(canseemon, (struct monst *));
  685. XE boolean FDECL(dmgtype, (struct permonst *,int));
  686. XE int FDECL(monsndx, (struct permonst *));
  687. XE int FDECL(name_to_mon, (char *));
  688. X#ifdef POLYSELF
  689. XE boolean FDECL(webmaker, (struct permonst *));
  690. X#endif
  691. XE boolean FDECL(is_female, (struct monst *));
  692. XE int FDECL(gender, (struct monst *));
  693. XE boolean FDECL(levl_follower, (struct monst *));
  694. XE struct permonst *player_mon();
  695. XE int FDECL(little_to_big, (int));
  696. XE int FDECL(big_to_little, (int));     
  697. X
  698. X/* ### monmove.c ### */
  699. X
  700. XE boolean FDECL(mb_trapped, (struct monst *));
  701. XE int FDECL(dochugw, (struct monst *));
  702. XE boolean FDECL(onscary, (int,int,struct monst *));
  703. XE int FDECL(dochug, (struct monst *));
  704. XE int FDECL(m_move, (struct monst *,int));
  705. XE void FDECL(set_apparxy, (struct monst *));
  706. XE boolean FDECL(mdig_tunnel, (struct monst *));
  707. X#ifdef STUPID_CPP
  708. XE boolean FDECL(MON_AT, (int, int));
  709. XE void FDECL(place_monster, (struct monst *, int, int));
  710. XE void FDECL(place_worm_seg, (struct monst *, int, int));
  711. XE void FDECL(remove_monster, (int, int));
  712. XE struct monst *FDECL(m_at, (int, int));
  713. X#endif
  714. X
  715. X/* ### monst.c ### */
  716. X
  717. X/* ### msdos.c ### */
  718. X
  719. X#ifdef MSDOS
  720. XE void flushout();
  721. XE int tgetch();
  722. XE int dosh();
  723. X# ifdef DGK
  724. XE long FDECL(freediskspace, (char *));
  725. XE long FDECL(filesize, (char *));
  726. XE void FDECL(eraseall, (const char *,const char *));
  727. XE void FDECL(copybones, (int));
  728. XE void playwoRAMdisk();
  729. XE int FDECL(saveDiskPrompt, (int));
  730. XE void gameDiskPrompt();
  731. X# endif
  732. XE void read_config_file();
  733. XE void set_lock_and_bones();
  734. XE void FDECL(append_slash, (char *));
  735. XE void FDECL(getreturn, (const char *));
  736. XE void VDECL(msmsg, (const char *,...));
  737. XE void FDECL(chdrive, (char *));
  738. X# ifndef TOS
  739. XE void disable_ctrlP();
  740. XE void enable_ctrlP();
  741. X# endif
  742. X# ifdef DGK
  743. XE FILE *FDECL(fopenp, (char *,char *));
  744. X# endif
  745. XE void FDECL(msexit, (int));
  746. X# ifdef DGK
  747. XE void get_scr_size();
  748. X# endif
  749. X#endif /* MSDOS */
  750. X#ifdef TOS
  751. XE int FDECL(_copyfile, (char *, char *));
  752. XE int kbhit();
  753. XE void restore_colors();
  754. XE void set_colors();
  755. X#endif /* TOS */
  756. X
  757. X/* ### mthrowu.c ### */
  758. X
  759. XE int FDECL(thitu, (int,int,struct obj *,char *));
  760. XE int FDECL(thrwmu, (struct monst *));
  761. XE int FDECL(spitmu, (struct monst *));
  762. XE int FDECL(breamu, (struct monst *,struct attack *));
  763. XE boolean FDECL(linedup, (XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P));
  764. XE boolean FDECL(lined_up, (struct monst *));
  765. XE struct obj *FDECL(m_carrying, (struct monst *,int));
  766. XE void FDECL(m_useup, (struct monst *,struct obj *));
  767. X
  768. X/* ### music.c ### */
  769. X
  770. X#ifdef MUSIC
  771. XE int FDECL(do_play_instrument, (struct obj *));
  772. X#endif /* MUSIC /**/
  773. X
  774. X/* ### o_init.c ### */
  775. X
  776. XE int FDECL(letindex, (CHAR_P));
  777. XE void init_objects();
  778. XE void oinit();
  779. XE void FDECL(savenames, (int));
  780. XE void FDECL(restnames, (int));
  781. XE int dodiscovered();
  782. X
  783. X/* ### objnam.c ### */
  784. X
  785. XE char *FDECL(typename, (int));
  786. XE char *FDECL(distant_name, (struct obj *, char *(*)(struct obj *)));
  787. XE char *FDECL(xname, (struct obj *));
  788. XE char *FDECL(doname, (struct obj *));
  789. XE char *FDECL(singular, (struct obj *, char *(*)(struct obj *)));
  790. XE char *FDECL(an, (char *));
  791. XE char *FDECL(An, (char *));
  792. XE char *FDECL(aobjnam, (struct obj *,char *));
  793. XE char *FDECL(Doname2, (struct obj *));
  794. XE void FDECL(lcase, (char *));
  795. XE char *FDECL(makeplural, (char *));
  796. XE struct obj *FDECL(readobjnam, (char *));
  797. X
  798. X/* ### options.c ### */
  799. X
  800. XE void initoptions();
  801. XE void FDECL(assign_graphics, (unsigned int *, int));
  802. XE void FDECL(parseoptions, (char *,BOOLEAN_P));
  803. XE int doset();
  804. XE int dotogglepickup();
  805. XE void option_help();
  806. X#ifdef TUTTI_FRUTTI
  807. XE int FDECL(fruitadd, (char *));
  808. X#endif
  809. X
  810. X/* ### pager.c ### */
  811. X
  812. XE int dowhatis();
  813. XE int dowhatdoes();
  814. XE void set_whole_screen();
  815. X#ifdef NEWS
  816. XE int readnews();
  817. X#endif /* NEWS */
  818. XE void FDECL(set_pager, (int));
  819. XE int FDECL(page_line, (char *));
  820. XE void FDECL(cornline, (int,char *));
  821. XE int dohelp();
  822. XE int dohistory();
  823. XE int FDECL(page_file, (char *,BOOLEAN_P));
  824. X#ifdef UNIX
  825. X# ifdef SHELL
  826. XE int dosh();
  827. X# endif /* SHELL */
  828. X# if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER)
  829. XE int FDECL(child, (int));
  830. X# endif
  831. X#endif /* UNIX */
  832. X
  833. X/* ### pcmain.c ### */
  834. X
  835. X#if defined(MSDOS) || defined(MACOS)
  836. XE void askname();
  837. X# ifdef CHDIR
  838. XE void FDECL(chdirx, (char *,BOOLEAN_P));
  839. X# endif /* CHDIR */
  840. X#endif /* MSDOS || MACOS */
  841. X
  842. X/* ### pctty.c ### */
  843. X
  844. X#if defined(MSDOS) || defined(MACOS)
  845. XE void gettty();
  846. XE void FDECL(settty, (char *));
  847. XE void VDECL(error, (char *,...));
  848. X#endif /* MSDOS || MACOS  */
  849. X
  850. X/* ### pcunix.c ### */
  851. X
  852. X#if defined(MSDOS) || defined(MACOS)
  853. X# ifndef OLD_TOS
  854. XE void setrandom();
  855. XE int getyear();
  856. XE char *getdate();
  857. XE int phase_of_the_moon();
  858. XE int night();
  859. XE int midnight();
  860. XE void FDECL(gethdate, (char *));
  861. XE int FDECL(uptodate, (int));
  862. X# endif /* TOS */
  863. XE void FDECL(regularize, (char *));
  864. X#endif /* MSDOS */
  865. X
  866. X/* ### pickup.c ### */
  867. X
  868. X#ifdef OVERLAY
  869. XE int ck_bag();
  870. XE int FDECL(ck_container, (struct obj *));
  871. XE int FDECL(in_container, (struct obj *));
  872. XE int FDECL(out_container, (struct obj *));
  873. X#endif
  874. XE void FDECL(pickup, (int));
  875. XE struct obj *FDECL(pick_obj, (struct obj *));
  876. XE int doloot();
  877. XE void get_all_from_box();
  878. XE void FDECL(use_container, (struct obj *, int));
  879. XE void FDECL(inc_cwt, (struct obj *, struct obj *));
  880. XE void FDECL(delete_contents, (struct obj *));
  881. XE void FDECL(dec_cwt, (struct obj *, struct obj *));
  882. X
  883. X/* ### polyself.c ### */
  884. X
  885. XE void newman();
  886. X#ifdef POLYSELF
  887. XE void polyself();
  888. XE int FDECL(polymon, (int));
  889. XE void rehumanize();
  890. XE int dobreathe();
  891. XE int dospit();
  892. XE int doremove();
  893. XE int dospinweb();
  894. XE int dosummon();
  895. XE int doconfuse();
  896. XE int dohide();
  897. X#endif
  898. XE char *FDECL(body_part, (int));
  899. XE int poly_gender();
  900. X#ifdef POLYSELF
  901. X# ifdef GOLEMS
  902. XE void FDECL(ugolemeffects, (int, int));
  903. X# endif /* GOLEMS */
  904. X#endif
  905. X
  906. X/* ### potion.c ### */
  907. X
  908. XE void FDECL(make_confused, (long,BOOLEAN_P));
  909. XE void FDECL(make_stunned, (long,BOOLEAN_P));
  910. XE void FDECL(make_blinded, (long,BOOLEAN_P));
  911. XE void FDECL(make_sick, (long,BOOLEAN_P));
  912. XE void FDECL(make_vomiting, (long,BOOLEAN_P));
  913. XE void FDECL(make_hallucinated, (long,BOOLEAN_P));
  914. XE int dodrink();
  915. XE int FDECL(dopotion, (struct obj *));
  916. XE int FDECL(peffects, (struct obj *));
  917. XE void FDECL(healup, (int,int,BOOLEAN_P,BOOLEAN_P));
  918. XE void FDECL(strange_feeling, (struct obj *,char *));
  919. XE void FDECL(potionhit, (struct monst *,struct obj *));
  920. XE void FDECL(potionbreathe, (struct obj *));
  921. XE boolean FDECL(get_wet, (struct obj *));
  922. XE int dodip();
  923. XE void FDECL(djinni_from_bottle, (struct obj *));
  924. XE int FDECL(monster_detect, (struct obj *));
  925. XE int FDECL(object_detect, (struct obj *));
  926. XE int FDECL(trap_detect, (struct obj *));
  927. X
  928. X/* ### pray.c ### */
  929. X
  930. X# ifdef THEOLOGY
  931. XE int dosacrifice();
  932. XE int dopray();
  933. XE char *u_gname();
  934. X#endif /* THEOLOGY */
  935. XE int doturn();
  936. X#ifdef ALTARS
  937. XE char *a_gname();
  938. XE char *FDECL(a_gname_at, (XCHAR_P,XCHAR_P));
  939. X# ifdef THEOLOGY
  940. XE void FDECL(altar_wrath, (int,int));
  941. X# endif
  942. X#endif
  943. X
  944. X/* ### pri.c ### */
  945. X
  946. XE void swallowed();
  947. XE void setclipped();
  948. X#ifdef CLIPPING
  949. XE void FDECL(cliparound, (int, int));
  950. X#endif
  951. XE boolean FDECL(showmon, (struct monst *));
  952. XE void FDECL(at, (XCHAR_P,XCHAR_P,UCHAR_P,UCHAR_P));
  953. XE void prme();
  954. XE void FDECL(shieldeff, (XCHAR_P,XCHAR_P));
  955. XE int doredraw();
  956. XE void docrt();
  957. XE void FDECL(docorner, (int,int));
  958. XE void seeglds();
  959. XE void seeobjs();
  960. XE void seemons();
  961. XE void FDECL(pmon, (struct monst *));
  962. XE void FDECL(unpmon, (struct monst *));
  963. XE void nscr();
  964. XE void bot();
  965. XE void FDECL(mstatusline, (struct monst *));
  966. XE void ustatusline();
  967. XE void cls();
  968. XE void max_rank_sz();
  969. XE char rndmonsym();
  970. XE char rndobjsym();
  971. XE const char *hcolor();
  972. X
  973. X/* ### priest.c ### */
  974. X
  975. XE int FDECL(move_special, (struct monst *,SCHAR_P,SCHAR_P,BOOLEAN_P,BOOLEAN_P,
  976. X            XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P));
  977. X#if defined(ALTARS) && defined(THEOLOGY)
  978. XE struct mkroom *FDECL(in_temple, (int,int));
  979. XE int FDECL(pri_move, (struct monst *));
  980. XE void FDECL(priestini, (int,int,int,int));
  981. XE char *FDECL(priestname, (struct monst *));
  982. XE boolean FDECL(p_coaligned, (struct monst *));
  983. XE void intemple();
  984. XE void FDECL(priest_talk, (struct monst *));
  985. XE boolean FDECL(u_in_sanctuary, (struct mkroom *));
  986. XE void ghod_hitsu();
  987. XE void angry_priest();
  988. X#endif
  989. X
  990. X/* ### prisym.c ### */
  991. X
  992. XE void FDECL(atl, (int,int,CHAR_P));
  993. XE void FDECL(on_scr, (int,int));
  994. XE void FDECL(tmp_at, (int,int));
  995. XE void FDECL(Tmp_at2, (int,int));
  996. XE void curs_on_u();
  997. XE void pru();
  998. XE void FDECL(prl, (int,int));
  999. XE uchar FDECL(news0, (XCHAR_P,XCHAR_P));
  1000. XE void FDECL(newsym, (int,int));
  1001. XE void FDECL(mnewsym, (int,int));
  1002. XE void FDECL(nosee, (int,int));
  1003. XE void FDECL(prl1, (int,int));
  1004. XE void FDECL(nose1, (int,int));
  1005. XE int FDECL(vism_at, (int,int));
  1006. X#ifdef NEWSCR
  1007. XE void FDECL(pobj, (struct obj *));
  1008. X#endif /* NEWSCR */
  1009. XE void FDECL(unpobj, (struct obj *));
  1010. X#ifdef STUPID_CPP    /* otherwise these functions are macros in rm.h */
  1011. XE boolean FDECL(IS_WALL, (unsigned));
  1012. XE boolean FDECL(IS_STWALL, (unsigned));
  1013. XE boolean FDECL(IS_ROCK, (unsigned));
  1014. XE boolean FDECL(IS_DOOR, (unsigned));
  1015. XE boolean FDECL(IS_FLOOR, (unsigned));
  1016. XE boolean FDECL(ACCESSIBLE, (unsigned));
  1017. XE boolean FDECL(IS_ROOM, (unsigned));
  1018. XE boolean FDECL(ZAP_POS, (unsigned));
  1019. XE boolean FDECL(SPACE_POS, (unsigned));
  1020. XE boolean FDECL(IS_POOL, (unsigned));
  1021. XE boolean FDECL(IS_THRONE, (unsigned));
  1022. XE boolean FDECL(IS_FOUNTAIN, (unsigned));
  1023. XE boolean FDECL(IS_SINK, (unsigned));
  1024. XE boolean FDECL(IS_ALTAR, (unsigned));
  1025. XE boolean FDECL(IS_DRAWBRIDGE, (unsigned));
  1026. XE boolean FDECL(IS_FURNITURE, (unsigned));
  1027. X#endif /* STUPID_CPP */
  1028. X
  1029. X/* ### read.c ### */
  1030. X
  1031. XE int doread();
  1032. XE int FDECL(seffects, (struct obj *));
  1033. XE void FDECL(litroom, (BOOLEAN_P));
  1034. XE void FDECL(do_genocide, (int));
  1035. XE void do_mapping();
  1036. XE void do_vicinity_map();
  1037. XE int FDECL(gold_detect, (struct obj *));
  1038. XE int FDECL(food_detect, (struct obj *));
  1039. XE void FDECL(punish, (struct obj *));
  1040. XE void unpunish();
  1041. XE boolean FDECL(cant_create, (int *));
  1042. X#if defined(WIZARD) || defined(EXPLORE_MODE)
  1043. XE boolean create_particular();
  1044. X#endif
  1045. X
  1046. X/* ### restore.c ### */
  1047. X
  1048. XE int FDECL(dorecover, (int));
  1049. XE void FDECL(getlev, (int,int,XCHAR_P,BOOLEAN_P));
  1050. X#ifdef ZEROCOMP
  1051. XE void minit();
  1052. XE int FDECL(mread, (int,genericptr_t,unsigned int));
  1053. X#else
  1054. XE void FDECL(mread, (int,genericptr_t,unsigned int));
  1055. X#endif
  1056. X
  1057. X/* ### rip.c ### */
  1058. X
  1059. XE void outrip();
  1060. X
  1061. X/* ### rnd.c ### */
  1062. X
  1063. XE int FDECL(rn1, (int,int));
  1064. XE int FDECL(rn2, (int));
  1065. XE int FDECL(rnl, (int));
  1066. XE int FDECL(rnd, (int));
  1067. XE int FDECL(d, (int,int));
  1068. XE int FDECL(rne, (int));
  1069. X#ifdef THEOLOGY
  1070. XE int FDECL(rnz, (int));
  1071. X#endif
  1072. X
  1073. X/* ### rumors.c ### */
  1074. X
  1075. XE void FDECL(outrumor, (int,BOOLEAN_P));
  1076. X#ifdef ORACLE
  1077. XE int FDECL(doconsult, (struct monst *));
  1078. X#endif
  1079. X
  1080. X/* ### save.c ### */
  1081. X
  1082. XE int dosave();
  1083. X#ifndef NOSAVEONHANGUP
  1084. XE int hangup();
  1085. X#endif /* NOSAVEONHANGUP */
  1086. XE int dosave0();
  1087. X#if defined(DGK) && !defined(OLD_TOS)
  1088. XE boolean FDECL(savelev, (int,XCHAR_P,int));
  1089. XE boolean FDECL(swapin_file, (int));
  1090. X#else /* DGK && !OLD_TOS */
  1091. XE void FDECL(savelev, (int, XCHAR_P));
  1092. X#endif /* DGK && !OLD_TOS */
  1093. X#ifdef ZEROCOMP
  1094. XE void FDECL(bflush, (int));
  1095. X#endif
  1096. XE void FDECL(bwrite, (int,genericptr_t,unsigned int));
  1097. X#ifdef TUTTI_FRUTTI
  1098. XE void FDECL(savefruitchn, (int));
  1099. X#endif
  1100. X
  1101. X/* ### search.c ### */
  1102. X
  1103. XE int findit();
  1104. XE int dosearch();
  1105. XE int FDECL(dosearch0, (int));
  1106. XE int doidtrap();
  1107. XE void FDECL(wakeup, (struct monst *));
  1108. XE void FDECL(seemimic, (struct monst *));
  1109. X
  1110. X/* ### shk.c ### */
  1111. X
  1112. XE char *FDECL(shkname, (struct monst *));
  1113. XE void FDECL(shkdead, (struct monst *));
  1114. XE void FDECL(replshk, (struct monst *,struct monst *));
  1115. XE int inshop();
  1116. XE int FDECL(inhishop, (struct monst *));
  1117. XE boolean FDECL(tended_shop, (struct mkroom *));
  1118. XE void FDECL(obfree, (struct obj *,struct obj *));
  1119. XE int dopay();
  1120. XE void FDECL(home_shk, (struct monst *));
  1121. XE void FDECL(make_happy_shk, (struct monst *));
  1122. XE boolean paybill();
  1123. XE void FDECL(pay_for_door, (int,int,char *));
  1124. XE void FDECL(addtobill, (struct obj *,BOOLEAN_P));
  1125. XE void FDECL(splitbill, (struct obj *,struct obj *));
  1126. XE void FDECL(sellobj, (struct obj *));
  1127. XE int FDECL(doinvbill, (int));
  1128. XE int FDECL(shkcatch, (struct obj *));
  1129. XE int FDECL(shk_move, (struct monst *));
  1130. XE int FDECL(online, (XCHAR_P,XCHAR_P));
  1131. XE boolean FDECL(is_fshk, (struct monst *));
  1132. XE void FDECL(shopdig, (int));
  1133. XE boolean FDECL(in_shop, (int,int));
  1134. XE boolean FDECL(costly_spot, (int,int));
  1135. XE void FDECL(check_unpaid, (struct obj *));
  1136. X
  1137. X/* ### shknam.c ### */
  1138. X
  1139. XE void FDECL(stock_room, (struct shclass *,struct mkroom *));
  1140. XE int FDECL(saleable, (int,struct obj *));
  1141. XE int FDECL(get_shop_item, (int));
  1142. X
  1143. X/* ### sit.c ### */
  1144. X
  1145. X#if defined(THRONES) || defined(SPELLS)
  1146. XE void take_gold();
  1147. X#endif
  1148. XE int dosit();
  1149. XE void rndcurse();
  1150. XE void attrcurse();
  1151. X
  1152. X/* ### sounds.c ### */
  1153. X
  1154. XE void FDECL(verbalize, (char *));
  1155. X#ifdef SOUNDS
  1156. XE void dosounds();
  1157. XE void FDECL(growl, (struct monst *));
  1158. XE void FDECL(yelp, (struct monst *));
  1159. XE void FDECL(whimper, (struct monst *));
  1160. X#endif
  1161. XE int dotalk();
  1162. X
  1163. X/* ### sp_lev.c ### */
  1164. X
  1165. X#ifdef STRONGHOLD
  1166. XE boolean FDECL(load_special, (char *));
  1167. X#endif /* STRONGHOLD /**/
  1168. X
  1169. X/* ### spell.c ### */
  1170. X#ifdef SPELLS
  1171. X#ifdef OVERLAY
  1172. XE int learn();
  1173. X#endif
  1174. XE int FDECL(study_book, (struct obj *));
  1175. XE int docast();
  1176. XE int FDECL(spelleffects, (int, BOOLEAN_P));
  1177. XE void losespells();
  1178. XE int dovspell();
  1179. X#endif /* SPELLS */
  1180. X
  1181. X/* ### steal.c ### */
  1182. X
  1183. X#ifdef OVERLAY
  1184. XE int stealarm();
  1185. X#endif
  1186. XE long somegold();
  1187. XE void FDECL(stealgold, (struct monst *));
  1188. XE int FDECL(steal, (struct monst *));
  1189. XE void FDECL(mpickobj, (struct monst *,struct obj *));
  1190. XE void FDECL(stealamulet, (struct monst *));
  1191. XE void FDECL(relobj, (struct monst *,int));
  1192. X
  1193. X/* ### termcap.c ### */
  1194. X
  1195. XE void startup();
  1196. XE void start_screen();
  1197. XE void end_screen();
  1198. X#ifdef CLIPPING
  1199. XE boolean FDECL(win_curs, (int,int));
  1200. X#endif
  1201. XE void FDECL(curs, (int,int));
  1202. XE void FDECL(cmov, (int,int));
  1203. XE void FDECL(xputc, (CHAR_P));
  1204. XE void FDECL(xputs, (char *));
  1205. XE void cl_end();
  1206. XE void clear_screen();
  1207. XE void home();
  1208. XE void standoutbeg();
  1209. XE void standoutend();
  1210. XE void revbeg();
  1211. X#if 0
  1212. XE void boldbeg();
  1213. XE void blinkbeg();
  1214. XE void dimbeg();
  1215. X#endif
  1216. XE void m_end();
  1217. XE void backsp();
  1218. XE void bell();
  1219. XE void graph_on();
  1220. XE void graph_off();
  1221. XE void delay_output();
  1222. XE void cl_eos();
  1223. X
  1224. X/* ### timeout.c ### */
  1225. X
  1226. XE void timeout();
  1227. XE void hatch_eggs();
  1228. X
  1229. X/* ### topl.c ### */
  1230. X
  1231. XE int doredotopl();
  1232. XE void remember_topl();
  1233. XE void FDECL(addtopl, (char *));
  1234. XE void more();
  1235. XE void FDECL(cmore, (char *));
  1236. XE void clrlin();
  1237. X#ifdef NEED_VARARGS
  1238. X# if defined(USE_STDARG) || defined(USE_VARARGS)
  1239. XE void FDECL(vpline, (const char *, va_list));
  1240. X# endif
  1241. X#endif
  1242. XE void VDECL(pline, (const char *,...));
  1243. XE void VDECL(Norep, (const char *,...));
  1244. XE void VDECL(You, (const char *,...));
  1245. XE void VDECL(Your, (const char *,...));
  1246. XE void VDECL(kludge, (char *,char *,...));
  1247. XE void FDECL(putsym, (CHAR_P));
  1248. XE void FDECL(putstr, (const char *));
  1249. XE char FDECL(yn_function, (const char *,CHAR_P));
  1250. XE void VDECL(impossible, (char *,...));
  1251. X
  1252. X/* ### topten.c ### */
  1253. X
  1254. XE void topten();
  1255. XE char *FDECL(eos, (char *));
  1256. XE void FDECL(prscore, (int,char **));
  1257. XE struct obj *FDECL(tt_oname, (struct obj *));
  1258. X
  1259. X/* ### track.c ### */
  1260. X
  1261. XE void initrack();
  1262. XE void settrack();
  1263. XE coord *FDECL(gettrack, (int,int));
  1264. X
  1265. X/* ### trap.c ### */
  1266. X
  1267. XE boolean FDECL(rust_dmg, (struct obj *,char *,int,BOOLEAN_P));
  1268. XE struct trap *FDECL(maketrap, (int,int,int));
  1269. XE int FDECL(teleok, (int,int));
  1270. XE void FDECL(dotrap, (struct trap *));
  1271. XE int FDECL(mintrap, (struct monst *));
  1272. XE void FDECL(selftouch, (char *));
  1273. XE void float_up();
  1274. XE int float_down();
  1275. XE void tele();
  1276. XE void FDECL(teleds, (int,int));
  1277. XE int dotele();
  1278. XE void FDECL(placebc, (int));
  1279. XE void unplacebc();
  1280. XE void level_tele();
  1281. XE void drown();
  1282. X#ifdef SPELLS
  1283. XE void FDECL(drain_en, (int));
  1284. X#endif
  1285. XE int dountrap();
  1286. XE void FDECL(chest_trap, (struct obj *,int));
  1287. XE void wake_nearby();
  1288. XE void FDECL(deltrap, (struct trap *));
  1289. XE struct trap *FDECL(t_at, (int,int));
  1290. XE void b_trapped();
  1291. XE boolean unconscious();
  1292. X
  1293. X/* ### u_init.c ### */
  1294. X
  1295. XE void u_init();
  1296. XE void plnamesuffix();
  1297. X
  1298. X/* ### uhitm.c ### */
  1299. X
  1300. XE struct monst *FDECL(clone_mon, (struct monst *));
  1301. XE boolean FDECL(special_case, (struct monst *));
  1302. XE schar FDECL(find_roll_to_hit, (struct monst *));
  1303. XE boolean FDECL(attack, (struct monst *));
  1304. XE boolean FDECL(hmon, (struct monst *,struct obj *,int));
  1305. XE int FDECL(damageum, (struct monst *, struct attack *));
  1306. XE void FDECL(missum, (struct monst *, struct attack *));
  1307. XE int FDECL(passive, (struct monst *,BOOLEAN_P,int,BOOLEAN_P));
  1308. XE void FDECL(stumble_onto_mimic, (struct monst *));
  1309. X
  1310. X/* ### unixmain.c ### */
  1311. X
  1312. X#ifdef UNIX
  1313. XE void FDECL(glo, (int));
  1314. XE void askname();
  1315. X#endif /* UNIX */
  1316. X
  1317. X/* ### unixtty.c ### */
  1318. X
  1319. X#ifdef UNIX
  1320. XE void gettty();
  1321. XE void FDECL(settty, (char *));
  1322. XE void setftty();
  1323. XE void intron();
  1324. XE void introff();
  1325. XE void VDECL(error, (char *,...));
  1326. X#endif /* UNIX */
  1327. X
  1328. X/* ### unixunix.c ### */
  1329. X
  1330. X#ifdef UNIX
  1331. XE void setrandom();
  1332. XE int getyear();
  1333. XE char *getdate();
  1334. XE int phase_of_the_moon();
  1335. XE int night();
  1336. XE int midnight();
  1337. XE void FDECL(gethdate, (char *));
  1338. XE int FDECL(uptodate, (int));
  1339. XE void getlock();
  1340. XE void FDECL(regularize, (char *));
  1341. X#endif /* UNIX */
  1342. X
  1343. X/* ### vault.c ### */
  1344. X
  1345. XE void setgd();
  1346. XE void invault();
  1347. XE int gd_move();
  1348. XE void gddead();
  1349. XE void FDECL(replgd, (struct monst *,struct monst *));
  1350. XE void paygd();
  1351. X
  1352. X/* ### version.c ### */
  1353. X
  1354. XE int doversion();
  1355. X
  1356. X/* ### vmsmain.c ### */
  1357. X
  1358. X#ifdef VMS
  1359. X# ifdef CHDIR
  1360. XE void FDECL(chdirx, (char *,char));
  1361. X# endif /* CHDIR */
  1362. XE void FDECL(glo, (int));
  1363. XE void askname();
  1364. X#endif /* VMS */
  1365. X
  1366. X/* ### vmsmisc.c ### */
  1367. X
  1368. X#ifdef VMS
  1369. XE void vms_abort();
  1370. XE void vms_exit();
  1371. X#endif /* VMS */
  1372. X
  1373. X/* ### vmstty.c ### */
  1374. X
  1375. X#ifdef VMS
  1376. XE void gettty();
  1377. XE void FDECL(settty, (char *));
  1378. XE void setftty();
  1379. XE void intron();
  1380. XE void introff();
  1381. XE void VDECL(error, (char *,...));
  1382. X#endif /* VMS */
  1383. X
  1384. X/* ### vmsunix.c ### */
  1385. X
  1386. X#ifdef VMS
  1387. XE void setrandom();
  1388. XE int getyear();
  1389. XE char *getdate();
  1390. XE int phase_of_the_moon();
  1391. XE int night();
  1392. XE int midnight();
  1393. XE void FDECL(gethdate, (char *));
  1394. XE int FDECL(uptodate, (int));
  1395. XE void getlock();
  1396. XE void FDECL(regularize, (char *));
  1397. XE int FDECL(vms_creat, (char *,unsigned int));
  1398. XE int vms_getuid();
  1399. XE void privoff();
  1400. XE void privon();
  1401. X# ifdef SHELL
  1402. XE int dosh();
  1403. X# endif
  1404. X#endif /* VMS */
  1405. X
  1406. X/* ### weapon.c ### */
  1407. X
  1408. XE int FDECL(hitval, (struct obj *,struct permonst *));
  1409. XE int FDECL(dmgval, (struct obj *,struct permonst *));
  1410. XE void set_uasmon();
  1411. XE struct obj *FDECL(select_rwep, (struct monst *));
  1412. XE struct obj *FDECL(select_hwep, (struct monst *));
  1413. XE int abon();
  1414. XE int dbon();
  1415. X
  1416. X/* ### were.c ### */
  1417. X
  1418. XE void FDECL(were_change, (struct monst *));
  1419. XE void FDECL(new_were, (struct monst *));
  1420. XE boolean FDECL(were_summon, (struct permonst *,BOOLEAN_P));
  1421. X#ifdef POLYSELF
  1422. XE void you_were();
  1423. X#endif /* POLYSELF */
  1424. X
  1425. X/* ### wield.c ### */
  1426. X
  1427. XE void FDECL(setuwep, (struct obj *));
  1428. XE void uwepgone();
  1429. XE int dowield();
  1430. XE void corrode_weapon();
  1431. XE int FDECL(chwepon, (struct obj *,int));
  1432. XE int FDECL(welded, (struct obj *));
  1433. XE void FDECL(weldmsg, (struct obj *,BOOLEAN_P));
  1434. X
  1435. X/* ### wizard.c ### */
  1436. X
  1437. XE void amulet();
  1438. XE int FDECL(mon_has_amulet, (struct monst *));
  1439. XE int FDECL(wiz_get_amulet, (struct monst *));
  1440. XE void aggravate();
  1441. XE void clonewiz();
  1442. X#ifdef HARD
  1443. XE void nasty();
  1444. XE void resurrect();
  1445. XE void intervene();
  1446. XE void FDECL(wizdead, (struct monst *));
  1447. X#endif /* HARD */
  1448. XE void FDECL(cuss, (struct monst *));
  1449. X
  1450. X/* ### worm.c ### */
  1451. X
  1452. X#ifdef WORM
  1453. XE int FDECL(getwn, (struct monst *));
  1454. XE void FDECL(initworm, (struct monst *));
  1455. XE void FDECL(worm_move, (struct monst *));
  1456. XE void FDECL(worm_nomove, (struct monst *));
  1457. XE void FDECL(wormdead, (struct monst *));
  1458. XE void FDECL(wormhit, (struct monst *));
  1459. XE void FDECL(wormsee, (unsigned int));
  1460. XE void FDECL(cutworm, (struct monst *,XCHAR_P,XCHAR_P,unsigned));
  1461. X#endif /* WORM */
  1462. X
  1463. X/* ### worn.c ### */
  1464. X
  1465. XE void FDECL(setworn, (struct obj *,long));
  1466. XE void FDECL(setnotworn, (struct obj *));
  1467. X
  1468. X/* ### write.c ### */
  1469. X
  1470. XE void FDECL(dowrite, (struct obj *));
  1471. X
  1472. X/* ### zap.c ### */
  1473. X
  1474. X#ifdef OVERLAY
  1475. XE int FDECL(bhito, (struct obj *, struct obj *));
  1476. XE int FDECL(bhitm, (struct monst *, struct obj *));
  1477. X#endif
  1478. XE struct monst *FDECL(revive, (struct obj *,BOOLEAN_P));
  1479. XE int FDECL(zappable, (struct obj *));
  1480. XE void FDECL(zapnodir, (struct obj *));
  1481. XE int dozap();
  1482. XE int FDECL(zapyourself, (struct obj *));
  1483. XE void FDECL(weffects, (struct obj *));
  1484. XE char *FDECL(exclam, (int));
  1485. XE void FDECL(hit, (const char *,struct monst *,const char *));
  1486. XE void FDECL(miss, (const char *,struct monst *));
  1487. XE struct monst *FDECL(bhit, (int,int,int,CHAR_P,int(*)(),int(*)(),struct obj *));
  1488. XE struct monst *FDECL(boomhit, (int,int));
  1489. XE void FDECL(buzz, (int,int,XCHAR_P,XCHAR_P,int,int));
  1490. XE void FDECL(rlocgold, (struct gold *));
  1491. XE void FDECL(rloco, (struct obj *));
  1492. XE void FDECL(fracture_rock, (struct obj *));
  1493. XE boolean FDECL(break_statue, (struct obj *));
  1494. XE void FDECL(destroy_item, (int,int));
  1495. XE int FDECL(destroy_mitem, (struct monst *,int,int));
  1496. XE int FDECL(resist, (struct monst *,CHAR_P,int,int));
  1497. XE void makewish();
  1498. X
  1499. X#endif /* !MAKEDEFS_C && !LEV_LEX_C */
  1500. X
  1501. X#undef E
  1502. X
  1503. X#endif /* EXTERN_H /**/
  1504. END_OF_FILE
  1505. if test 37999 -ne `wc -c <'include/extern.h'`; then
  1506.     echo shar: \"'include/extern.h'\" unpacked with wrong size!
  1507. fi
  1508. # end of 'include/extern.h'
  1509. if test -f 'src/dbridge.c' -a "${1}" != "-c" ; then 
  1510.   echo shar: clobbering existing file \"'src/dbridge.c'\"
  1511. fi
  1512. echo shar: Extracting \"'src/dbridge.c'\" \(19606 characters\)
  1513. sed "s/^X//" >'src/dbridge.c' <<'END_OF_FILE'
  1514. X/*     SCCS Id: @(#)dbridge.c  3.0     88/18/12
  1515. X/*     Copyright (c) 1989 by Jean-Christophe Collet */
  1516. X/* NetHack may be freely redistributed.  See license for details. */
  1517. X
  1518. X/*
  1519. X * This file contains the drawbridge manipulation (create, open, close,
  1520. X * destroy).
  1521. X *
  1522. X * Added comprehensive monster-handling, and the "entity" structure to 
  1523. X * deal with players as well. - 11/89
  1524. X */
  1525. X
  1526. X#include "hack.h"
  1527. X
  1528. Xboolean
  1529. Xis_pool(x,y)
  1530. Xint x,y;
  1531. X{
  1532. X       if(levl[x][y].typ == POOL || levl[x][y].typ == MOAT) return TRUE;
  1533. X#ifdef STRONGHOLD
  1534. X       if(levl[x][y].typ == DRAWBRIDGE_UP &&
  1535. X               (levl[x][y].drawbridgemask & DB_UNDER) == DB_MOAT) return TRUE;
  1536. X#endif
  1537. X       return FALSE;
  1538. X}
  1539. X
  1540. X#ifdef STRONGHOLD
  1541. Xvoid
  1542. Xinitsym(x,y)
  1543. Xint x,y;
  1544. X{
  1545. X    char oldseen;
  1546. X    struct rm *crm = &levl[x][y];
  1547. X
  1548. X    oldseen = crm->seen;
  1549. X    crm->seen = 1;
  1550. X    crm->scrsym = news0(x,y);
  1551. X    crm->seen = oldseen;
  1552. X}
  1553. X
  1554. Xstatic void
  1555. Xredosym(x,y)
  1556. Xint x,y;
  1557. X{
  1558. X    if(cansee(x,y)) {
  1559. X        levl[x][y].seen = 0;            /* force prl */
  1560. X        prl(x, y);
  1561. X    } else {
  1562. X        initsym(x,y);
  1563. X        levl[x][y].seen = 0;
  1564. X    }
  1565. X}
  1566. X
  1567. X/* 
  1568. X * We want to know whether a wall (or a door) is the portcullis (passageway)
  1569. X * of an eventual drawbridge.
  1570. X *
  1571. X * Return value:  the direction of the drawbridge.
  1572. X */
  1573. X
  1574. Xint
  1575. Xis_drawbridge_wall(x,y)
  1576. Xint x,y;
  1577. X{
  1578. X    struct rm *lev;
  1579. X
  1580. X    lev = &levl[x][y];
  1581. X    if (lev->typ != DOOR && !(lev->diggable & W_GATEWAY))
  1582. X        return (-1);
  1583. X    switch (lev->typ) {
  1584. X    case DOOR:
  1585. X    case VWALL:
  1586. X        if (IS_DRAWBRIDGE(levl[x+1][y].typ) &&
  1587. X             (levl[x+1][y].drawbridgemask & DB_DIR) == DB_WEST)
  1588. X            return (DB_WEST);
  1589. X        if (IS_DRAWBRIDGE(levl[x-1][y].typ) && 
  1590. X            (levl[x-1][y].drawbridgemask & DB_DIR) == DB_EAST)
  1591. X            return (DB_EAST);
  1592. X        if (lev->typ == VWALL) break;
  1593. X    case HWALL:
  1594. X        if (IS_DRAWBRIDGE(levl[x][y-1].typ) && 
  1595. X            (levl[x][y-1].drawbridgemask & DB_DIR) == DB_SOUTH)
  1596. X            return (DB_SOUTH);
  1597. X        if (IS_DRAWBRIDGE(levl[x][y+1].typ) && 
  1598. X            (levl[x][y+1].drawbridgemask & DB_DIR) == DB_NORTH)
  1599. X            return (DB_NORTH);
  1600. X    }
  1601. X    return (-1);
  1602. X}
  1603. X
  1604. X/*
  1605. X * Use is_db_wall where you want to verify that a
  1606. X * drawbridge "wall" is UP in the location x, y
  1607. X * (instead of UP or DOWN, as with is_drawbridge_wall). 
  1608. X */ 
  1609. Xboolean
  1610. Xis_db_wall(x,y)
  1611. Xint x,y;
  1612. X{
  1613. X    return( (levl[x][y].typ == VWALL || levl[x][y].typ == HWALL) &&
  1614. X        levl[x][y].diggable & W_GATEWAY);
  1615. X}
  1616. X
  1617. X/*
  1618. X * Return true with x,y pointing to the drawbridge if x,y initially indicate
  1619. X * a drawbridge or drawbridge wall.
  1620. X */
  1621. Xboolean
  1622. Xfind_drawbridge(x,y)
  1623. Xint *x,*y;
  1624. X{
  1625. X    int dir;
  1626. X
  1627. X    if (IS_DRAWBRIDGE(levl[*x][*y].typ))
  1628. X        return TRUE;
  1629. X    dir = is_drawbridge_wall(*x,*y);
  1630. X    if (dir >= 0) {
  1631. X        switch(dir) {
  1632. X            case DB_NORTH: (*y)++; break;
  1633. X            case DB_SOUTH: (*y)--; break;
  1634. X            case DB_EAST:  (*x)--; break;
  1635. X            case DB_WEST:  (*x)++; break;
  1636. X        }
  1637. X        return TRUE;
  1638. X    }
  1639. X    return FALSE;
  1640. X}
  1641. X
  1642. X/* 
  1643. X * Find the drawbridge wall associated with a drawbridge.
  1644. X */
  1645. Xstatic void
  1646. Xget_wall_for_db(x,y)
  1647. Xint *x,*y;
  1648. X{
  1649. X    switch (levl[*x][*y].drawbridgemask & DB_DIR) {
  1650. X        case DB_NORTH: (*y)--; break;
  1651. X        case DB_SOUTH: (*y)++; break;
  1652. X        case DB_EAST:  (*x)++; break;
  1653. X        case DB_WEST:  (*x)--; break;
  1654. X    }
  1655. X}
  1656. X
  1657. X/*
  1658. X * Creation of a drawbridge at pos x,y.
  1659. X *     dir is the direction.
  1660. X *     flag must be put to TRUE if we want the drawbridge to be opened.
  1661. X */
  1662. X
  1663. Xboolean
  1664. Xcreate_drawbridge(x,y,dir,flag)
  1665. Xint x,y,dir;
  1666. Xboolean flag;
  1667. X{
  1668. X    int x2,y2;
  1669. X    uchar wall;
  1670. X
  1671. X    x2 = x; y2 = y;
  1672. X    switch(dir) {
  1673. X        case DB_NORTH:
  1674. X            wall = HWALL;
  1675. X            y2--;
  1676. X            break;
  1677. X        case DB_SOUTH:
  1678. X            wall = HWALL;
  1679. X            y2++;
  1680. X            break;
  1681. X        case DB_EAST:
  1682. X            wall = VWALL;
  1683. X            x2++;
  1684. X            break;
  1685. X        case DB_WEST:
  1686. X            wall = VWALL;
  1687. X            x2--;
  1688. X            break;
  1689. X    }
  1690. X    if (!IS_WALL(levl[x2][y2].typ))
  1691. X        return(FALSE);
  1692. X    if (flag) {             /* We want the bridge open */
  1693. X        levl[x][y].typ = DRAWBRIDGE_DOWN;
  1694. X        levl[x2][y2].typ = DOOR;
  1695. X        levl[x2][y2].doormask = D_NODOOR;
  1696. X    } else {
  1697. X        levl[x][y].typ = DRAWBRIDGE_UP;
  1698. X        levl[x2][y2].typ = wall;
  1699. X        /* Beware, drawbridges are non-diggable. */
  1700. X        levl[x2][y2].diggable = (W_NONDIGGABLE | W_GATEWAY);
  1701. X    }
  1702. X    levl[x][y].drawbridgemask = dir;        /* always have DB_MOAT */
  1703. X    initsym(x,y);
  1704. X    initsym(x2,y2);
  1705. X    return(TRUE);           
  1706. X}
  1707. X
  1708. Xstruct entity {
  1709. X    struct monst *emon;       /* youmonst for the player */
  1710. X    struct permonst *edata;    /* must be non-zero for record to be valid */
  1711. X    int ex, ey;
  1712. X};
  1713. X
  1714. X#define ENTITIES 2
  1715. X
  1716. Xstatic struct entity occupants[ENTITIES];
  1717. X
  1718. Xstatic
  1719. Xstruct entity *
  1720. Xe_at(x, y)
  1721. Xint x, y;
  1722. X{
  1723. X    int entitycnt;
  1724. X    
  1725. X    for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++)
  1726. X        if ((occupants[entitycnt].edata) && 
  1727. X            (occupants[entitycnt].ex == x) &&
  1728. X            (occupants[entitycnt].ey == y))
  1729. X            break;
  1730. X#ifdef D_DEBUG
  1731. X    pline("entitycnt = %d", entitycnt);
  1732. X    fflush(stdout);
  1733. X#endif
  1734. X    return((entitycnt == ENTITIES)? 
  1735. X           (struct entity *)0 : &(occupants[entitycnt]));
  1736. X}
  1737. X
  1738. Xstatic void
  1739. Xm_to_e(mtmp, etmp)
  1740. Xstruct monst *mtmp;
  1741. Xstruct entity *etmp;
  1742. X{
  1743. X    etmp->emon = mtmp;
  1744. X    if (mtmp) {
  1745. X        etmp->ex = mtmp->mx;
  1746. X        etmp->ey = mtmp->my;
  1747. X        etmp->edata = mtmp->data;
  1748. X    } else
  1749. X        etmp->edata = (struct permonst *)0;
  1750. X}
  1751. X
  1752. Xstatic void
  1753. Xu_to_e(etmp)
  1754. Xstruct entity *etmp;
  1755. X{
  1756. X    etmp->emon = &youmonst;
  1757. X    etmp->ex = u.ux;
  1758. X    etmp->ey = u.uy;
  1759. X    etmp->edata = uasmon;
  1760. X}
  1761. X
  1762. Xstatic void
  1763. Xset_entity(x, y, etmp)
  1764. Xint x, y;
  1765. Xstruct entity *etmp;
  1766. X{
  1767. X    if ((x == u.ux) && (y == u.uy))
  1768. X        u_to_e(etmp);
  1769. X    else
  1770. X        if (MON_AT(x, y))
  1771. X            m_to_e(m_at(x, y), etmp);
  1772. X        else
  1773. X            etmp->edata = (struct permonst *)0;
  1774. X}
  1775. X
  1776. X#ifdef POLYSELF
  1777. X#define is_u(etmp) (etmp->emon == &youmonst)
  1778. X#else
  1779. X#define is_u(x) FALSE
  1780. X#endif
  1781. X
  1782. X/* 
  1783. X * WARNING! THE FOLLOWING IS ONLY USEFUL FOR CANSEEMON, OR OTHER FUNCS WHICH 
  1784. X * ALWAYS RETURN TRUE FOR U.
  1785. X */
  1786. X
  1787. X#define e_boolean(etmp, func) (is_u(etmp)? (boolean)TRUE : func(etmp->emon)) 
  1788. X
  1789. X/*
  1790. X * e_strg is a utility routine which is not actually in use anywhere, since 
  1791. X * the specialized routines below suffice for all current purposes. 
  1792. X */
  1793. X
  1794. X/* #define e_strg(etmp, func) (is_u(etmp)? (char *)0 : func(etmp->emon)) */
  1795. X
  1796. Xstatic char *
  1797. Xe_nam(etmp)
  1798. Xstruct entity *etmp;
  1799. X{
  1800. X    return(is_u(etmp)? "you" : mon_nam(etmp->emon));
  1801. X}
  1802. X
  1803. X/*
  1804. X * Enam is another unused utility routine:  E_phrase is preferable.
  1805. X */
  1806. X
  1807. X/*
  1808. Xstatic char *
  1809. XEnam(etmp)
  1810. Xstruct entity *etmp;
  1811. X{
  1812. X    return(is_u(etmp)? "You" : Monnam(etmp->emon));
  1813. X}
  1814. X*/
  1815. X
  1816. X/*
  1817. X * Generates capitalized entity name, makes 2nd -> 3rd person conversion on 
  1818. X * verb, where necessary.
  1819. X */
  1820. X
  1821. Xstatic char *
  1822. XE_phrase(etmp, verb)
  1823. Xstruct entity *etmp;
  1824. Xchar *verb;
  1825. X{
  1826. X    char wholebuf[80], verbbuf[30];
  1827. X
  1828. X    if (is_u(etmp)) 
  1829. X        Strcpy(wholebuf, "You");
  1830. X    else
  1831. X        Strcpy(wholebuf, Monnam(etmp->emon));
  1832. X    if (!*verb)
  1833. X        return(wholebuf);
  1834. X    Strcat(wholebuf, " ");
  1835. X    verbbuf[0] = '\0';
  1836. X    if (is_u(etmp)) 
  1837. X        Strcpy(verbbuf, verb);
  1838. X    else {
  1839. X        if (!strcmp(verb, "are"))
  1840. X            Strcpy(verbbuf, "is");
  1841. X        if (!strcmp(verb, "have"))
  1842. X            Strcpy(verbbuf, "has");
  1843. X        if (!verbbuf[0]) {
  1844. X            Strcpy(verbbuf, verb);
  1845. X            switch (verbbuf[strlen(verbbuf) - 1]) {
  1846. X                case 'y':
  1847. X                    verbbuf[strlen(verbbuf) - 1] = '\0';
  1848. X                    Strcat(verbbuf, "ies");
  1849. X                    break;
  1850. X                case 'h':
  1851. X                case 'o':
  1852. X                case 's':
  1853. X                    Strcat(verbbuf, "es");
  1854. X                    break;
  1855. X                default:
  1856. X                    Strcat(verbbuf, "s");
  1857. X                    break;
  1858. X            }
  1859. X        }
  1860. X    }
  1861. X    Strcat(wholebuf, verbbuf);
  1862. X    return(wholebuf);
  1863. X}
  1864. X
  1865. X/*
  1866. X * Simple-minded "can it be here?" routine
  1867. X */
  1868. X
  1869. Xstatic boolean
  1870. Xe_survives_at(etmp, x, y)
  1871. Xstruct entity *etmp;
  1872. Xint x, y;
  1873. X{
  1874. X    if (noncorporeal(etmp->edata))
  1875. X        return(TRUE);
  1876. X    if (is_pool(x, y))
  1877. X        return((is_u(etmp) && (Wwalking || Levitation)) ||
  1878. X               is_swimmer(etmp->edata) || is_flyer(etmp->edata) ||
  1879. X               is_floater(etmp->edata));
  1880. X    if (is_db_wall(x, y))
  1881. X        return(passes_walls(etmp->edata));
  1882. X    return(TRUE);
  1883. X}
  1884. X
  1885. Xstatic void
  1886. Xe_died(etmp, dest, how)
  1887. Xstruct entity *etmp;
  1888. Xint dest, how;
  1889. X{
  1890. X    if (is_u(etmp)) {
  1891. X        if (how == DROWNING)
  1892. X            drown();
  1893. X        else {
  1894. X            coord xy;
  1895. X
  1896. X            done(how);
  1897. X            /* So, you didn't die */
  1898. X            if (!e_survives_at(etmp, etmp->ex, etmp->ey)) {
  1899. X                pline("A %s force teleports you away...",
  1900. X                            Hallucination ? "normal" : "strange");
  1901. X                enexto(&xy, etmp->ex, etmp->ey, etmp->edata);
  1902. X                teleds(xy.x, xy.y);
  1903. X            }
  1904. X        }
  1905. X    } else {
  1906. X        xkilled(etmp->emon, dest);
  1907. X        etmp->edata = (struct permonst *)0;    
  1908. X    }
  1909. X}
  1910. X
  1911. X
  1912. X/*
  1913. X * These are never directly affected by a bridge or portcullis.
  1914. X */
  1915. X
  1916. Xstatic boolean
  1917. Xautomiss(etmp)
  1918. Xstruct entity *etmp;
  1919. X{
  1920. X    return(passes_walls(etmp->edata) || noncorporeal(etmp->edata));
  1921. X}
  1922. X
  1923. X/*
  1924. X * Does falling drawbridge or portcullis miss etmp?
  1925. X */
  1926. X
  1927. Xstatic boolean
  1928. Xe_missed(etmp, chunks)
  1929. Xstruct entity *etmp;
  1930. Xboolean chunks;
  1931. X{
  1932. X    int misses;
  1933. X
  1934. X#ifdef D_DEBUG
  1935. X    if (chunks)
  1936. X        pline("Do chunks miss?");
  1937. X#endif
  1938. X    if (automiss(etmp))
  1939. X        return(TRUE);    
  1940. X
  1941. X    if (is_flyer(etmp->edata) && 
  1942. X        (is_u(etmp)? !Sleeping : 
  1943. X         (!etmp->emon->mfroz && !etmp->emon->msleep)))
  1944. X                          /* flying requires mobility */
  1945. X        misses = 5;    /* out of 8 */    
  1946. X    else
  1947. X        if (is_floater(etmp->edata) ||
  1948. X            (is_u(etmp) && Levitation))      /* doesn't require mobility */
  1949. X            misses = 3;
  1950. X        else
  1951. X            if (chunks && is_pool(etmp->ex, etmp->ey))
  1952. X                misses = 2;              /* sitting ducks */
  1953. X            else
  1954. X                misses = 0;      
  1955. X
  1956. X    if (is_db_wall(etmp->ex, etmp->ey))
  1957. X        misses -= 3;                     /* less airspace */
  1958. X
  1959. X#ifdef D_DEBUG
  1960. X    pline("Miss chance = %d (out of 8)", misses);
  1961. X#endif
  1962. X
  1963. X    return((misses >= rnd(8))? TRUE : FALSE);
  1964. X}
  1965. X
  1966. X/*
  1967. X * Can etmp jump from death?
  1968. X */ 
  1969. X
  1970. Xstatic boolean
  1971. Xe_jumps(etmp)
  1972. Xstruct entity *etmp;
  1973. X{
  1974. X    int tmp = 4;         /* out of 10 */
  1975. X
  1976. X    if (is_u(etmp)? (Sleeping || Fumbling) : 
  1977. X                (etmp->emon->mfroz || etmp->emon->msleep || 
  1978. X             !etmp->edata->mmove))
  1979. X        return(FALSE);
  1980. X
  1981. X    if (is_u(etmp)? Confusion : etmp->emon->mconf)
  1982. X        tmp -= 2;
  1983. X
  1984. X    if (is_u(etmp)? Stunned : etmp->emon->mstun)
  1985. X        tmp -= 3;
  1986. X
  1987. X    if (is_db_wall(etmp->ex, etmp->ey))
  1988. X        tmp -= 2;                 /* less room to maneuver */
  1989. X    
  1990. X#ifdef D_DEBUG
  1991. X    pline("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp);
  1992. X#endif
  1993. X    return((tmp >= rnd(10))? TRUE : FALSE);
  1994. X}
  1995. X
  1996. Xstatic void
  1997. Xdo_entity(etmp)
  1998. Xstruct entity *etmp;
  1999. X{
  2000. X    int newx, newy, at_portcullis, oldx, oldy;
  2001. X    boolean must_jump = FALSE, relocates = FALSE, e_inview;
  2002. X    struct rm *crm;
  2003. X
  2004. X    if (!etmp->edata)
  2005. X        return;
  2006. X
  2007. X    e_inview = e_boolean(etmp, canseemon);
  2008. X
  2009. X    oldx = etmp->ex;
  2010. X    oldy = etmp->ey;
  2011. X
  2012. X    at_portcullis = is_db_wall(oldx, oldy);
  2013. X
  2014. X    crm = &levl[oldx][oldy];
  2015. X
  2016. X    if (automiss(etmp) && e_survives_at(etmp, oldx, oldy)) {
  2017. X        char edifice[20];
  2018. X
  2019. X        if (e_inview) {
  2020. X            *edifice = '\0';
  2021. X            if ((crm->typ == DRAWBRIDGE_DOWN) ||
  2022. X                    (crm->typ == DRAWBRIDGE_UP))
  2023. X                Strcpy(edifice, "drawbridge");
  2024. X            else
  2025. X                     if (at_portcullis) 
  2026. X                    Strcpy(edifice, "portcullis");
  2027. X            if (*edifice)
  2028. X                pline("The %s passes through %s!", edifice, 
  2029. X                            e_nam(etmp));            
  2030. X        }
  2031. X        return;
  2032. X    }
  2033. X    if (e_missed(etmp, FALSE)) { 
  2034. X        if (at_portcullis)
  2035. X            pline("The portcullis misses %s!",
  2036. X                  e_nam(etmp));
  2037. X#ifdef D_DEBUG
  2038. X        else
  2039. X            pline("The drawbridge misses %s!", 
  2040. X                  e_nam(etmp));
  2041. X#endif
  2042. X        if (e_survives_at(etmp, oldx, oldy)) 
  2043. X            return;
  2044. X        else {
  2045. X#ifdef D_DEBUG
  2046. X            pline("Mon can't survive here");
  2047. X#endif
  2048. X            if (at_portcullis)
  2049. X                must_jump = TRUE;
  2050. X            else
  2051. X                relocates = TRUE;  /* just ride drawbridge in */
  2052. X        }
  2053. X    } else {
  2054. X        if (crm->typ == DRAWBRIDGE_DOWN) {
  2055. X            pline("%s crushed underneath the drawbridge.",
  2056. X                        E_phrase(etmp, "are"));              /* no jump */
  2057. X            e_died(etmp, e_inview? 2 : 3, CRUSHING); /* no corpse */
  2058. X            return;   /* Note: Beyond this point, we know we're   */
  2059. X        }                 /* not at an opened drawbridge, since all   */
  2060. X        must_jump = TRUE; /* *missable* creatures survive on the      */
  2061. X    }              /* square, and all the unmissed ones die.   */
  2062. X    if (must_jump) 
  2063. X        if (at_portcullis) {
  2064. X            if (e_jumps(etmp)) {
  2065. X                relocates = TRUE;
  2066. X#ifdef D_DEBUG
  2067. X                pline("Jump succeeds!");
  2068. X#endif
  2069. X            } else {
  2070. X                if (e_inview)
  2071. X                   pline("%s crushed by the falling portcullis!",
  2072. X                                 E_phrase(etmp, "are"));
  2073. X                else
  2074. X                    if (flags.soundok)
  2075. X                        You("hear a crushing sound.");
  2076. X                e_died(etmp, e_inview? 1 : 0, CRUSHING);
  2077. X                                    /* corpse */
  2078. X                return;
  2079. X            }
  2080. X        } else {       /* tries to jump off bridge to original square */
  2081. X            relocates = !e_jumps(etmp); 
  2082. X#ifdef D_DEBUG
  2083. X            pline("Jump %s!", (relocates)? "fails" : "succeeds");
  2084. X#endif
  2085. X        }
  2086. X
  2087. X/*
  2088. X * Here's where we try to do relocation.  Assumes that etmp is not arriving
  2089. X * at the portcullis square while the drawbridge is falling, since this square
  2090. X * would be inaccessible (i.e. etmp started on drawbridge square) or 
  2091. X * unnecessary (i.e. etmp started here) in such a situation.
  2092. X */
  2093. X#ifdef D_DEBUG
  2094. X    pline("Doing relocation");
  2095. X#endif
  2096. X    newx = oldx;
  2097. X    newy = oldy;
  2098. X    (void)find_drawbridge(&newx, &newy);
  2099. X    if ((newx == oldx) && (newy == oldy))
  2100. X        get_wall_for_db(&newx, &newy);
  2101. X#ifdef D_DEBUG
  2102. X    pline("Checking new square for occupancy");
  2103. X#endif
  2104. X    if (relocates && (e_at(newx, newy))) { 
  2105. X
  2106. X/* 
  2107. X * Standoff problem:  one or both entities must die, and/or both switch 
  2108. X * places.  Avoid infinite recursion by checking first whether the other 
  2109. X * entity is staying put.  Clean up if we happen to move/die in recursion.
  2110. X */
  2111. X        struct entity *other;
  2112. X
  2113. X        other = e_at(newx, newy);
  2114. X#ifdef D_DEBUG
  2115. X        pline("New square is occupied by %s", e_nam(other));
  2116. X#endif
  2117. X        if (e_survives_at(other, newx, newy) && automiss(other)) {
  2118. X            relocates = FALSE;                /* "other" won't budge */
  2119. X#ifdef D_DEBUG
  2120. X            pline("%s suicide.", E_phrase(etmp, "commit"));
  2121. X#endif
  2122. X        } else {
  2123. X
  2124. X#ifdef D_DEBUG
  2125. X            pline("Handling %s", e_nam(other));
  2126. X#endif
  2127. X            while ((e_at(newx, newy)) && 
  2128. X                   (e_at(newx, newy) != etmp))
  2129. X                       do_entity(other);
  2130. X#ifdef D_DEBUG
  2131. X            pline("Checking existence of %s", 
  2132. X                  e_nam(etmp));
  2133. X            fflush(stdout);
  2134. X#endif
  2135. X            if (e_at(oldx, oldy) != etmp) {
  2136. X#ifdef D_DEBUG
  2137. X                    pline("%s moved or died in recursion somewhere",
  2138. X                      E_phrase(etmp, "have"));
  2139. X                fflush(stdout);
  2140. X#endif
  2141. X                return;
  2142. X            }
  2143. X        }
  2144. X    }
  2145. X    if (relocates) {
  2146. X#ifdef D_DEBUG
  2147. X        pline("Moving %s", e_nam(etmp));
  2148. X#endif
  2149. X        if (!is_u(etmp)) {
  2150. X            remove_monster(etmp->ex, etmp->ey);
  2151. X            place_monster(etmp->emon, newx, newy);
  2152. X        } else {
  2153. X            u.ux = newx;
  2154. X            u.uy = newy;
  2155. X        }
  2156. X        etmp->ex = newx;
  2157. X        etmp->ey = newy;
  2158. X        e_inview = e_boolean(etmp, canseemon);
  2159. X    }
  2160. X#ifdef D_DEBUG
  2161. X    pline("Final disposition of %s", e_nam(etmp));
  2162. X    fflush(stdout);
  2163. X#endif
  2164. X    if (is_db_wall(etmp->ex, etmp->ey)) {
  2165. X#ifdef D_DEBUG
  2166. X        pline("%s in portcullis chamber", E_phrase(etmp, "are"));
  2167. X        fflush(stdout);
  2168. X#endif
  2169. X        if (e_inview)
  2170. X            if (is_u(etmp)) {
  2171. X                You("tumble towards the closed portcullis!"); 
  2172. X                if (automiss(etmp))
  2173. X                    You("pass through it!");
  2174. X                else
  2175. X                    pline("The drawbridge closes in...");
  2176. X            } else
  2177. X                pline("%s behind the drawbridge.",
  2178. X                                  E_phrase(etmp, "disappear"));
  2179. X        if (!e_survives_at(etmp, etmp->ex, etmp->ey)) {
  2180. X            killer = "closing drawbridge";
  2181. X            e_died(etmp, 0, CRUSHING);         /* no message */
  2182. X            return;
  2183. X        }
  2184. X#ifdef D_DEBUG
  2185. X        pline("%s in here", E_phrase(etmp, "survive"));
  2186. X#endif
  2187. X    } else {
  2188. X#ifdef D_DEBUG
  2189. X        pline("%s on drawbridge square", E_phrase(etmp, "are"));
  2190. X#endif
  2191. X        if (is_pool(etmp->ex, etmp->ey) && !e_inview)
  2192. X            if (flags.soundok)
  2193. X                You("hear a splash.");
  2194. X        if (e_survives_at(etmp, etmp->ex, etmp->ey)) {
  2195. X            if (e_inview && !is_flyer(etmp->edata) &&
  2196. X                !is_floater(etmp->edata))
  2197. X                pline("%s from the bridge.",
  2198. X                                  E_phrase(etmp, "fall"));    
  2199. X            return;    
  2200. X        }
  2201. X#ifdef D_DEBUG
  2202. X        pline("%s cannot survive on the drawbridge square", Enam(etmp));
  2203. X#endif
  2204. X        if (is_pool(etmp->ex, etmp->ey))
  2205. X            if (e_inview && 
  2206. X                !is_u(etmp))  /* drown() will supply msgs if nec. */
  2207. X                if (Hallucination)
  2208. X                      pline("%s the moat and disappears.",
  2209. X                        E_phrase(etmp, "drink"));
  2210. X                else
  2211. X                      pline("%s into the moat.",
  2212. X                                  E_phrase(etmp, "fall"));
  2213. X        killer = "fall from a drawbridge";
  2214. X        e_died(etmp, e_inview? 1 : 0,        /* CRUSHING is arbitrary */
  2215. X               (is_pool(etmp->ex, etmp->ey))? DROWNING : CRUSHING);
  2216. X                                           /* corpse */
  2217. X        return;
  2218. X    }
  2219. X}
  2220. X
  2221. X/*
  2222. X * Close the drawbridge located at x,y
  2223. X */
  2224. X
  2225. Xvoid
  2226. Xclose_drawbridge(x,y)
  2227. Xint x,y;
  2228. X{
  2229. X    register struct rm *lev1, *lev2;
  2230. X    struct obj *otmp, *otmp2;
  2231. X    int x2, y2;
  2232. X
  2233. X    lev1 = &levl[x][y];
  2234. X    if (lev1->typ != DRAWBRIDGE_DOWN) return;
  2235. X    x2 = x; y2 = y;
  2236. X    get_wall_for_db(&x2,&y2);
  2237. X    if (cansee(x,y))   /* change msgs if you are a w-walker at portcullis */
  2238. X        You("see a drawbridge %s up!", 
  2239. X            ((u.ux == x2) && (u.uy == y2))? "coming" : "going");
  2240. X    lev1->typ = DRAWBRIDGE_UP;
  2241. X    lev2 = &levl[x2][y2];
  2242. X    switch (lev1->drawbridgemask & DB_DIR) {
  2243. X        case DB_NORTH:
  2244. X        case DB_SOUTH:
  2245. X            lev2->typ = HWALL;
  2246. X            break;
  2247. X        case DB_WEST:
  2248. X        case DB_EAST:
  2249. X            lev2->typ = VWALL;
  2250. X            break;
  2251. X    }
  2252. X    lev2->diggable = (W_NONDIGGABLE | W_GATEWAY);
  2253. X    set_entity(x, y, &(occupants[0]));
  2254. X    set_entity(x2, y2, &(occupants[1]));
  2255. X    do_entity(&(occupants[0]));
  2256. X    do_entity(&(occupants[1]));
  2257. X    redosym(x, y);
  2258. X    for (otmp = level.objects[x][y]; otmp; otmp = otmp2) {
  2259. X        otmp2 = otmp->nexthere;
  2260. X        delobj(otmp);
  2261. X    }
  2262. X    for (otmp = level.objects[x2][y2]; otmp; otmp = otmp2) {
  2263. X        otmp2 = otmp->nexthere;
  2264. X        delobj(otmp);
  2265. X    }
  2266. X    redosym(x2, y2);
  2267. X}
  2268. X
  2269. X/* 
  2270. X * Open the drawbridge located at x,y
  2271. X */
  2272. X
  2273. Xvoid
  2274. Xopen_drawbridge(x,y)
  2275. Xint x,y;
  2276. X{
  2277. X    register struct rm *lev1, *lev2;
  2278. X    int x2, y2;
  2279. X
  2280. X    lev1 = &levl[x][y];
  2281. X    if (lev1->typ != DRAWBRIDGE_UP) return;
  2282. X    x2 = x; y2 = y;
  2283. X    get_wall_for_db(&x2,&y2);
  2284. X    if (cansee(x,y))   /* change msgs if you are a w-walker at portcullis */
  2285. X        You("see a drawbridge %s down!",
  2286. X            ((x2 == u.ux) && (y2 == u.uy))? "going" : "coming");
  2287. X    lev1->typ = DRAWBRIDGE_DOWN;
  2288. X    lev2 = &levl[x2][y2];
  2289. X    lev2->typ = DOOR;
  2290. X    lev2->doormask = D_NODOOR;
  2291. X    set_entity(x, y, &(occupants[0]));
  2292. X    set_entity(x2, y2, &(occupants[1]));
  2293. X    do_entity(&(occupants[0]));
  2294. X    do_entity(&(occupants[1]));
  2295. X    redosym(x, y);
  2296. X    redosym(x2, y2);
  2297. X}
  2298. X
  2299. X/*
  2300. X * Let's destroy the drawbridge located at x,y
  2301. X */
  2302. X
  2303. Xvoid
  2304. Xdestroy_drawbridge(x,y)
  2305. Xint x,y;
  2306. X{
  2307. X    register struct rm *lev1, *lev2;
  2308. X    int x2, y2;
  2309. X    boolean e_inview;
  2310. X    struct entity *etmp1 = &(occupants[0]), *etmp2 = &(occupants[1]);
  2311. X
  2312. X    lev1 = &levl[x][y];
  2313. X    if (!IS_DRAWBRIDGE(lev1->typ))
  2314. X        return;
  2315. X    x2 = x; y2 = y;
  2316. X    get_wall_for_db(&x2,&y2);
  2317. X    lev2 = &levl[x2][y2];
  2318. X    if ((lev1->drawbridgemask & DB_UNDER) == DB_MOAT) {
  2319. X        if (lev1->typ == DRAWBRIDGE_UP) {
  2320. X            if (cansee(x2,y2))
  2321. X        pline("The portcullis of the drawbridge falls into the moat!");
  2322. X            else if (flags.soundok)
  2323. X                You("hear a loud *SPLASH*!");
  2324. X        } else {
  2325. X            if (cansee(x,y))
  2326. X                pline("The drawbridge collapses into the moat!");
  2327. X            else if (flags.soundok)
  2328. X                You("hear a loud *SPLASH*!");
  2329. X        }
  2330. X        lev1->typ = MOAT;
  2331. X        lev1->drawbridgemask = 0;
  2332. X    } else {
  2333. X        if (cansee(x,y))
  2334. X            pline("The drawbridge disintegrates!");
  2335. X        else
  2336. X            You("hear a loud *CRASH*!");
  2337. X        lev1->typ = ROOM;
  2338. X        lev1->icedpool =
  2339. X            ((lev1->drawbridgemask & DB_ICE) ? ICED_MOAT : 0);
  2340. X    }
  2341. X    set_entity(x2, y2, etmp2); /* currently, only automissers can be here */
  2342. X    if (etmp2->edata) {
  2343. X        e_inview = e_boolean(etmp2, canseemon);
  2344. X        if (!automiss(etmp2)) {               /* i.e. no-one yet */
  2345. X            if (e_inview)
  2346. X                pline("%s blown apart by flying debris",
  2347. X                            E_phrase(etmp2, "are"));
  2348. X            killer = "exploding drawbridge";
  2349. X            e_died(etmp2, e_inview? 2 : 3, CRUSHING);/* no corpse */
  2350. X        }          /* nothing which is vulnerable can survive this */
  2351. X    }
  2352. X    lev2->typ = DOOR;
  2353. X    lev2->doormask = D_NODOOR;
  2354. X    set_entity(x, y, etmp1);
  2355. X    e_inview = e_boolean(etmp1, canseemon);
  2356. X    if (etmp1->edata) {
  2357. X        if (e_missed(etmp1, TRUE)) {
  2358. X#ifdef D_DEBUG
  2359. X            pline("%s spared!", E_phrase(etmp1, "are"));
  2360. X#endif
  2361. X        } else {
  2362. X            if (e_inview) 
  2363. X                if (!is_u(etmp1) && Hallucination)
  2364. X                    pline("%s into some heavy metal",
  2365. X                          E_phrase(etmp1, "get"));
  2366. X                else
  2367. X                    pline("%s hit by a huge chunk of metal!",
  2368. X                                E_phrase(etmp1, "are"));
  2369. X            else 
  2370. X                if (flags.soundok && !is_u(etmp1) && 
  2371. X                    !is_pool(x, y))
  2372. X                    You("hear a crushing sound");
  2373. X#ifdef D_DEBUG
  2374. X                else
  2375. X                    pline("%s from shrapnel", 
  2376. X                          E_phrase(etmp1, "die"));
  2377. X#endif
  2378. X            killer = "collapsing drawbridge";
  2379. X            e_died(etmp1, e_inview? 0 : 1, CRUSHING);   /* corpse */
  2380. X        }
  2381. X    }
  2382. X    redosym(x,y);
  2383. X    redosym(x2,y2);
  2384. X}
  2385. X
  2386. X#endif /* STRONGHOLD /**/
  2387. END_OF_FILE
  2388. if test 19606 -ne `wc -c <'src/dbridge.c'`; then
  2389.     echo shar: \"'src/dbridge.c'\" unpacked with wrong size!
  2390. fi
  2391. # end of 'src/dbridge.c'
  2392. echo shar: End of archive 15 \(of 15\).
  2393. cp /dev/null ark15isdone
  2394. MISSING=""
  2395. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
  2396.     if test ! -f ark${I}isdone ; then
  2397.     MISSING="${MISSING} ${I}"
  2398.     fi
  2399. done
  2400. if test "${MISSING}" = "" ; then
  2401.     echo You have unpacked all 15 archives.
  2402.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2403. else
  2404.     echo You still need to unpack the following archives:
  2405.     echo "        " ${MISSING}
  2406. fi
  2407. ##  End of shell archive.
  2408. exit 0
  2409.