home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / games / volume16 / nethack31 / part75 < prev    next >
Text File  |  1993-02-06  |  59KB  |  1,654 lines

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v16i083:  nethack31 - display oriented dungeons & dragons (Ver. 3.1), Part75/108
  5. Message-ID: <4446@master.CNA.TEK.COM>
  6. Date: 5 Feb 93 19:19:57 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1642
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1634
  11.  
  12. Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
  13. Posting-number: Volume 16, Issue 83
  14. Archive-name: nethack31/Part75
  15. Supersedes: nethack3p9: Volume 10, Issue 46-102
  16. Environment: Amiga, Atari, Mac, MS-DOS, OS2, Unix, VMS, X11
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 75 (of 108)."
  27. # Contents:  dat/data.base win/X11/winmap.c
  28. # Wrapped by billr@saab on Wed Jan 27 16:09:16 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'dat/data.base' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'dat/data.base'\"
  32. else
  33. echo shar: Extracting \"'dat/data.base'\" \(25887 characters\)
  34. sed "s/^X//" >'dat/data.base' <<'END_OF_FILE'
  35. X#    NetHack data file - version 3.1a
  36. X#    The demons are all listed first because makedefs used to have to give
  37. X#    them special handling for #ifndef INFERNO; it doesn't matter any more.
  38. Xbalrog
  39. X        ...  It came to the edge of the fire and the light  faded as
  40. X        if a  cloud had  bent over it.  Then  with a rush it  leaped
  41. X        the fissure.  The flames roared up to greet it, and wreathed
  42. X        about  it; and a black smoke swirled in the air. Its stream-
  43. X        ing  mane kindled,  and blazed behind it.  In its right hand
  44. X        was a  blade like a stabbing tongue of fire;  in its left it
  45. X        held a whip of many thongs.
  46. X        'Ai, ai!'  wailed Legolas. 'A Balrog!  A Balrog is come!'
  47. X               [ The Fellowship of the Ring, by J.R.R. Tolkien ]
  48. Xhorned devil
  49. X        Horned devils lack any real special abilities,  though  they
  50. X        are quite difficult to kill.
  51. Xincubus
  52. Xsuccubus
  53. X        The incubus and succubus are male and female versions of the
  54. X        same  demon, one who lies with a human for its own purposes,
  55. X        usually to the detriment of the mortals who  are  unwise  in
  56. X        their dealings with them.
  57. Xerinyes
  58. X        These female-seeming devils  attack hand to hand  and poison
  59. X        their unwary victims as well.
  60. Xmarilith
  61. X        The marilith, a type V demon, has a torso shaped  like  that
  62. X        of  a human female, and the lower body of a great snake.  It
  63. X        has multiple arms, and can freely attack with all  of  them.
  64. X        Since it is intelligent enough to use weapons, this means it
  65. X        can cause great damage.
  66. Xbarbed devil
  67. X        Barbed devils lack any real special abilities,  though  they
  68. X        are quite difficult to kill.
  69. Xvrock
  70. X        The vrock is one of the weaker forms of demon, being only  a
  71. X        type  I.   It  resembles a cross between a human being and a
  72. X        vulture and does physical damage by biting and by using  the
  73. X        claws on both its arms and feet.
  74. Xhezrou
  75. X        ``Hezrou'' is the common name for the type II demon.  It  is
  76. X        among the weaker of demons, but still quite formidable.
  77. Xbone devil
  78. X        Bone devils attack with weapons and with a great hooked tail
  79. X        which causes a loss of strength to those they sting.
  80. Xnalfeshnee
  81. X        Not only do these demons, which are of type IV, do  physical
  82. X        damage  with  their  claws and bite, but they are capable of
  83. X        using magic as well.
  84. Xice devil
  85. X        Ice devils  are  large  semi-insectoid  creatures,  who  are
  86. X        equally  at home in the fires of Hell and the cold of Limbo,
  87. X        and who can cause the traveller to feel the latter with just
  88. X        a touch of their tail.
  89. Xpit fiend
  90. X        Pit fiends are among the more powerful of devils, capable of
  91. X        attacking  twice with weapons as well as grabbing and crush-
  92. X        ing the life out of  those  unwary  enough  to  enter  their
  93. X        domains.
  94. Xjuiblex
  95. Xjubilex
  96. X        Little is known about the Faceless Lord,  even  the  correct
  97. X        spelling  of  his name.  He does not have a physical form as
  98. X        we know it, and those who have peered into his  realm  claim
  99. X        he  is  a  slime-like  creature who swallows other creatures
  100. X        alive, spits acidic secretions, and causes  disease  in  his
  101. X        victims which can be almost instantly fatal.
  102. Xyeenoghu
  103. X        Yeenoghu, the demon lord of gnolls,  still  exists  although
  104. X        all his followers have been wiped off the face of the earth.
  105. X        He casts magic projectiles at those close to him, and a mere
  106. X        gaze  into  his  piercing  eyes  may  hopelessly confuse the
  107. X        battle-weary adventurer.
  108. Xorcus
  109. X        Orcus, Prince of the Undead, has a rams head  and  a  poison
  110. X        stinger.   He is most feared, though, for his powerful magic
  111. X        abilities.  His wand causes death to those he chooses.
  112. Xgeryon
  113. X        Geryon is an arch-devil sometimes  called  the  Wild  Beast,
  114. X        attacking  with  his claws and poison sting.  His ranking in
  115. X        Hell is rumored to be quite low.
  116. Xdispater
  117. X        Dispater is an arch-devil who rules the city of Dis.  He  is
  118. X        a powerful mage.
  119. Xbaalzebub
  120. X        Baalzebub has been known as the lord of the flies.  His bite
  121. X        drips  poison,  and a mere glance into his eyes can stun the
  122. X        hapless invader of his realm.
  123. Xasmodeus
  124. X        It is said that Asmodeus is the overlord over all  of  hell.
  125. X        His  appearance,  unlike  many  other  demons and devils, is
  126. X        human apart from his horns and tail.  He  can  freeze  flesh
  127. X        with a touch.
  128. Xdemogorgon
  129. X        Demogorgon, the prince of demons, wallows in filth  and  can
  130. X        spread  a quickly fatal illness to his victims while rending
  131. X        them.  He is a mighty spellcaster, and he can drain the life
  132. X        of mortals with a touch of his tail.
  133. Xathame
  134. X        The  consecrated ritual knife of  a Wiccan  initiate (one of
  135. X        four  basic  tools,  together  with the  wand,  chalice  and
  136. X        pentacle).   Traditionally, the  athame  is  a double-edged,
  137. X        black-handled,  cross-hilted   dagger  of  between  six  and
  138. X        eighteen inches length.
  139. X*centaur
  140. X        Of all the monsters put together by  the  Greek  imagination
  141. X        the  Centaurs (Kentauroi) constituted a class in themselves.
  142. X        Despite a strong streak  of  sensuality  in  their  make-up,
  143. X        their  normal  behaviour  was  moral, and they took a kindly
  144. X        thought of man's welfare. The attempted outrage of Nessos on
  145. X        Deianeira,  and  that  of the whole tribe of Centaurs on the
  146. X        Lapith women,  are more than offset  by the  hospitality  of
  147. X        Pholos and  by  the  wisdom of Cheiron,  physician, prophet,
  148. X        lyrist,  and the instructor of Achilles.  Further,  the Cen-
  149. X        taurs  were  peculiar in that their nature, which united the
  150. X        body of a horse with the trunk and head of a  man,  involved
  151. X        an  unthinkable  duplication  of  vital organs and important
  152. X        members.  So grotesque a combination seems almost  un-Greek.
  153. X        These  strange creatures  were said to live in the caves and
  154. X        clefts of the mountains, myths associating  them  especially
  155. X        with the hills of Thessaly and the range of Erymanthos.
  156. X                 [ Mythology of all races, Vol. 1, pp. 270-271 ]
  157. Xcockatrice
  158. X        Once in a great while, when the positions of the  stars  are
  159. X        just right, a seven-year-old rooster will lay an egg.  Then,
  160. X        along will come a snake, to coil around the egg, or a  toad,
  161. X        to  squat  upon  the  egg, keeping it warm and helping it to
  162. X        hatch.  When it hatches, out comes a creature called  basil-
  163. X        isk, or cockatrice, the most deadly of all creatures. A sin-
  164. X        gle glance from its yellow, piercing toad's eyes  will  kill
  165. X        both man  and beast.  Its power of destruction is said to be
  166. X        so great that sometimes simply to hear its  hiss  can  prove
  167. X        fatal.  Its  breath is so venomous  that it causes all vege-
  168. X        tation to wither.
  169. X    
  170. X        There is, however, one  creature  which  can  withstand  the
  171. X        basilisk's deadly gaze, and this is the weasel. No one knows
  172. X        why this is so, but although the fierce weasel can slay  the
  173. X        basilisk, it will itself be killed in the struggle.  Perhaps
  174. X        the weasel knows the basilisk's fatal weakness:  if it  ever
  175. X        sees  its own reflection in a mirror it will perish instant-
  176. X        ly.  But even a dead basilisk is dangerous, for  it is  said
  177. X        that merely touching its lifeless body can cause a person to
  178. X        sicken and die.
  179. X        [ Mythical Beasts by Deirdre Headon (The Leprechaun Library)
  180. X          and other sources ]
  181. X*dragon
  182. X        In the West  the dragon was  the  natural  enemy   of   man.
  183. X        Although  preferring  to live in bleak and desolate regions,
  184. X        whenever it was seen among men it left in its wake a   trail
  185. X        of   destruction   and disease. Yet any attempt to slay this
  186. X        beast was a perilous undertaking. For the dragon's assailant
  187. X        had  to  contend not  only  with clouds of  sulphurous fumes
  188. X        pouring from its fire-breathing nostrils, but also with  the
  189. X        thrashings  of  its  tail,  the  most   deadly  part  of its
  190. X        serpent-like body.
  191. X        [Mythical Beasts by Deirdre Headon (The Leprechaun Library)]
  192. X*elemental
  193. X        Elementals are manifestations of the  basic  nature  of  the
  194. X        universe.   There  are four known forms of elementals:  air,
  195. X        fire, water, and earth.  Some mystics  have  postulated  the
  196. X        necessity  for  a fifth type, the spirit elemental, but none
  197. X        have ever been encountered, at least on this  plane  of  ex-
  198. X        istence.
  199. X*giant
  200. Xgiant humanoid
  201. X        Giants have always walked the earth, though they are rare in
  202. X        these times.  They range in size from  little over nine feet
  203. X        to a towering twenty feet or more.  The larger ones use huge
  204. X        boulders as weapons, hurling them over large distances.  All
  205. X        types of giants share a love for men  -  roasted, boiled, or
  206. X        fried.  Their table manners are legendary.
  207. Xgnome*
  208. Xgnomish wizard
  209. X        ...  And then a gnome came by,  carrying a bundle,   an  old
  210. X        fellow three times  as large as an imp  and wearing  clothes
  211. X        of a sort, especially a hat.  And he was  clearly   just  as
  212. X        frightened   as  the  imps  though  he could not go so fast.
  213. X        Ramon Alonzo saw that there must be some great trouble  that
  214. X        was  vexing  magical  things;   and,  since gnomes speak the
  215. X        language of men, and will answer if spoken  to  gently,   he
  216. X        raised  his  hat,   and  asked  of the gnome  his name.  The
  217. X        gnome did not  stop  his  hasty  shuffle  a  moment   as  he
  218. X        answered 'Alaraba' and grabbed the rim of his hat but forgot
  219. X        to doff it.
  220. X        'What is the trouble, Alaraba?' said Ramon Alonzo.
  221. X        'White magic. Run!' said the gnome ...
  222. X                [ The Charwoman's Shadow, by Lord Dunsany. ]
  223. Xgold
  224. Xgold piece
  225. X        A metal of characteristic yellow colour, the  most  precious
  226. X        metal  used as a common commercial medium of exchange.  Sym-
  227. X        bol, Au; at.  no. 79; at. wt. 197.2.  It is the most  malle-
  228. X        able  and  ductile  of  all metals, and very heavy (sp. gr.,
  229. X        19.3).  It is quite unalterable by heat, moisture, and  most
  230. X        corrosive  agents,  and therefore well suited for its use in
  231. X        coin and jewelry.
  232. X                [ Webster's New International Dictionary
  233. X                  of the English Language, Second Edition ]
  234. X*golem
  235. X        These creatures, not quite living but not  really  nonliving
  236. X        either,   are   created from inanimate materials by powerful
  237. X        mages or priests.
  238. Xgremlin
  239. X        The  gremlin is a highly  intelligent and  completely   evil
  240. X        creature.   It lives to torment  other creatures and will go
  241. X        to great lengths to inflict pain or cause injury.
  242. Xgrid bug
  243. X        These  electrically based creatures are  not native  to this
  244. X        universe.  They  appear to come from a world  whose  laws of
  245. X        motion are radically different from ours.
  246. Xhobbit
  247. X        Hobbits  are  an unobtrusive  but very ancient people,  more
  248. X        numerous formerly than they are today;  for they love  peace
  249. X        and quiet and good tilled earth:  a  well-ordered and  well-
  250. X        farmed countryside  was their favourite haunt.  They  do not
  251. X        and  did  not  understand  or like machines more complicated
  252. X        than a forge-bellows, a water-mill, or a handloom,  although
  253. X        they  were skillful with tools.  Even  in ancient days  they
  254. X        were, as a rule, shy of "the Big Folk", as they call us, and
  255. X        now they avoid us with dismay and are becoming hard to find.
  256. X               [ The Fellowship of the Ring, by J.R.R. Tolkien ]
  257. Xhobgoblin
  258. X        Hobgoblin. Used by the  Puritans  and  in  later  times  for
  259. X        wicked  goblin  spirits,  as in Bunyan's 'Hobgoblin nor foul
  260. X        friend', but its more correct use is for the friendly  spir-
  261. X        its  of  the brownie type.  In 'A midsummer night's dream' a
  262. X        fairy says to Shakespeare's Puck:
  263. X                Those that Hobgoblin call you, and sweet Puck,
  264. X                You do their work, and they shall have good luck:
  265. X                Are you not he?
  266. X        and obviously Puck would not wish to be called  a  hobgoblin
  267. X        if that was an ill-omened word.
  268. X        Hobgoblins are on the whole, good-humoured and ready  to  be
  269. X        helpful,  but fond of practical joking, and like most of the
  270. X        fairies rather nasty people to annoy. Boggarts hover on  the
  271. X        verge of hobgoblindom.  Bogles are just over the edge.
  272. X        One Hob mentioned by Henderson, was Hob Headless who haunted
  273. X        the  road  between Hurworth and Neasham, but could not cross
  274. X        the little river Kent, which flowed into the  Tess.  He  was
  275. X        exorcised  and  laid under a large stone by the roadside for
  276. X        ninety-nine years and a day. If anyone was so unwary  as  to
  277. X        sit  on  that stone, he would be unable to quit it for ever.
  278. X        The ninety-nine years is nearly up, so trouble may  soon  be
  279. X        heard of on the road between Hurworth and Neasham.
  280. X                     [ Katharine Briggs, A  dictionary  of Fairies ]
  281. Xhumanoid
  282. X        Humanoids  are all approximately  the size of a human,   and
  283. X        may  be  mistaken for one  at a distance.  They  are usually
  284. X        of a tribal  nature, and will  fiercely defend their  lairs.
  285. X        Usually   hostile, they  may even band  together to raid and
  286. X        pillage human settlements.
  287. Xhuman
  288. Xarcheologist
  289. Xbarbarian
  290. Xcave*man
  291. Xelf
  292. Xhealer
  293. Xknight
  294. X*priest*
  295. Xrogue
  296. Xsamurai
  297. Xtourist
  298. Xvalkyrie
  299. Xwizard
  300. X        These strange creatures live mostly on the  surface  of  the
  301. X        earth, gathering together in societies of various forms, but
  302. X        occasionally a stray will descend into the depths and commit
  303. X        mayhem  among  the  dungeon  residents who, naturally, often
  304. X        resent the intrusion of such beasts.  They  are  capable  of
  305. X        using  weapons  and  magic,  and it is even rumored that the
  306. X        Wizard of Yendor is a member of this species.
  307. Ximp
  308. X         ... imps ... little creatures of two feet high  that  could
  309. X        gambol and jump prodigiously; ...
  310. X                 [ The Charwoman's Shadow, by Lord Dunsany ]
  311. X    
  312. X        An 'imp' is an off-shoot or cutting.  Thus an 'ymp tree' was
  313. X        a grafted tree, or one grown from a cutting, not from seed.
  314. X        'Imp' properly means a small devil, an off-shoot  of  Satan,
  315. X        but  the distinction between goblins or bogles and imps from
  316. X        hell is hard to make, and many in the  Celtic  countries  as
  317. X        well as the English Puritans regarded all fairies as devils.
  318. X        The fairies of tradition often hover  uneasily  between  the
  319. X        ghostly and the diabolic state.
  320. X                   [ Katharine Briggs, A Dictionary of Fairies ]
  321. Xjabberwock
  322. Xvorpal*
  323. X        "Beware the Jabberwock, my son!
  324. X          The jaws that bite, the claws that catch!
  325. X        Beware the Jubjub bird, and shun
  326. X          The frumious Bandersnatch!"
  327. X        
  328. X        He took his vorpal sword in hand;
  329. X          Long time the manxome foe he sought --
  330. X        So rested he by the Tumtum tree,
  331. X          And stood awhile in thought.
  332. X        
  333. X        And, as in uffish thought he stood,
  334. X          The Jabberwock, with eyes of flame,
  335. X        Came whiffling through the tulgey wood,
  336. X          And burbled as it came!
  337. X                    [ Jabberwocky, by Lewis Carroll ]
  338. Xkatana
  339. X        Also  known  as the  samurai  sword, the katana  is  a long,
  340. X        single-edged  sword  with slightly curved  blade.   Its long
  341. X        handle is designed to allow it to be wielded with either one
  342. X        or two hands.
  343. X*kobold*
  344. X        The race of kobolds are reputed to be an artificial creation
  345. X        of a master wizard (demi-god?).  They are about 3' tall with
  346. X        a vaguely dog-like face.  They bear a violent dislike of the
  347. X        Elven race, and  will go out  of their way to  cause trouble
  348. X        for Elves at any time.
  349. Xleprechaun
  350. X        The Irish Leprechaun is the Faeries' shoemaker and is  known
  351. X        under  various names  in different parts of Ireland:  Cluri-
  352. X        caune in Cork, Lurican in Kerry, Lurikeen in Kildare and Lu-
  353. X        rigadaun  in  Tipperary.  Although he works for the Faeries,
  354. X        the Leprechaun is not of the same species.  He is small, has
  355. X        dark  skin  and wears strange clothes.  His nature has some-
  356. X        thing of the manic-depressive about it:  first he  is  quite
  357. X        happy, whistling merrily as he nails a sole on to a shoe;  a
  358. X        few minutes later, he is sullen and  morose,  drunk  on  his
  359. X        home-made heather ale.  The Leprechaun's two great loves are
  360. X        tobacco and whiskey, and he is a first-rate con-man,  impos-
  361. X        sible  to  out-fox.  No  one, no matter how clever, has ever
  362. X        managed to cheat him out of his hidden pot of  gold  or  his
  363. X        magic shilling.  At the last minute he always thinks of some
  364. X        way to divert his captor's attention  and  vanishes  in  the
  365. X        twinkling  of  an eye.
  366. X                     [ A Field Guide to the Little People
  367. X                       by Nancy Arrowsmith & George Moorse ]
  368. Xleocrotta
  369. Xleu*otta
  370. X        ...the leucrocotta, a wild beast of extraordinary swiftness,
  371. X        the size of the wild ass, with the legs of a Stag, the neck,
  372. X        tail, and breast of a lion,  the head of a badger,  a cloven
  373. X        hoof, the mouth slit up as far as the ears,  and one contin-
  374. X        uous bone  instead of  teeth;  it is said,  too,  that  this
  375. X        animal can imitate the human voice.
  376. X                   [ Curious Creatures in Zoology, John Ashton ]
  377. X*lich
  378. X        Once in a great  while, an evil master wizard or priest will
  379. X        manage through use of great magics to extend his or her life
  380. X        far beyond the normal  span of a human.  The usual effect of
  381. X        this is to transform the human, over time, into an undead of
  382. X        great magical power.  A Lich  hates life in any form; even a
  383. X        touch from one of these  creatures will cause a numbing cold
  384. X        in the victim.  They all possess the capability to use magic.
  385. Xmedusa
  386. X        This hideous  creature from  ancient Greek myth was the doom
  387. X        of many a valiant adventurer.  It is said that one gaze from
  388. X        its eyes  could turn a man to stone.  One bite from the nest
  389. X        of  snakes which  crown its head could  cause instant death.
  390. X        The only  way to kill this  monstrosity is to turn its  gaze
  391. X        back upon itself.
  392. Xmind flayer
  393. X        This creature has a humanoid  body, but has tentacles around
  394. X        its covered mouth and only three long fingers  on each hand.
  395. X        Mind flayers are  telepathic, and love to devour intelligent
  396. X        beings, especially humans.  If they hit their victim  with a
  397. X        tentacle,  the mind flayer  will  slowly  drain  it  of  all
  398. X        intelligence, eventually killing the victim.
  399. Xmithril*
  400. X        _Mithril_!   All folk  desired it.  It could be  beaten like
  401. X        copper, and polished like glass;  and the Dwarves could make
  402. X        of it  a metal,  light and yet harder  than tempered  steel.
  403. X        Its beauty was like to that of common silver, but the beauty
  404. X        of _mithril_ did not tarnish  or grow dim.
  405. X               [ The Fellowship of the Ring, by J.R.R. Tolkien ]
  406. Xmumak*
  407. X        ... the Mumak of Harad was indeed  a beast of vast bulk, and
  408. X        the like of him  does not walk now in Middle-Earth;  his kin
  409. X        that live still in latter days are but memories of his girth
  410. X        and  majesty.   On he came, ... his great legs  like  trees,
  411. X        enormous sail-like ears spread out, long snout upraised like
  412. X        a huge serpent  about to strike,  his small red eyes raging.
  413. X        His upturned hornlike tusks ... dripped with blood.
  414. X                       [ The Two Towers, by J.R.R. Tolkien ]
  415. X*naga*
  416. X        The naga is a mystical creature with the body of a snake and
  417. X        the head of a man or woman.  They will fiercely  protect the
  418. X        territory they consider their own.  Some nagas can be forced
  419. X        to serve as a guardian by a spell caster of great power.
  420. X*ooze
  421. X*pudding
  422. X        These giant amoeboid creatures look like nothing  more  than
  423. X        puddles  of  slime,  but they both live and move, feeding on
  424. X        metal or wood as well as the occasional dungeon explorer  to
  425. X        supplement their diet.
  426. Xorcrist
  427. X        The  Great Goblin  gave a truly awful howl of  rage when  he
  428. X        looked  at  it,  and  all his soldiers  gnashed their teeth,
  429. X        clashed their shields,  and stamped.  They knew the sword at
  430. X        once.  It had killed hundreds of goblins in  its time,  when
  431. X        the  fair elves of Gondolin hunted them in the hills or  did
  432. X        battle  before  their  walls.  They  had called it  Orcrist,
  433. X        Goblin-cleaver, but the goblins called it simply Biter. They
  434. X        hated it and hated worse any one that carried it.
  435. X                       [ The Hobbit, by J.R.R. Tolkien ]
  436. Xosaku
  437. X        The osaku is a small tool for picking locks.
  438. Xpiercer
  439. X        Ye Piercer doth look like unto  a  stalactyte,  and  hangeth
  440. X        from  the  roofs of caves and caverns.  Unto the height of a
  441. X        man, and thicker than a man's thigh do  they  grow,  and  in
  442. X        groups  do they hang.  If a creature doth pass beneath them,
  443. X        they will by its heat and noise perceive it, and  fall  upon
  444. X        it  to kill and devour it, though in any other way they move
  445. X        but exceeding slow.
  446. X                           [ the Bestiary of Xygag ]
  447. Xquantum mechanic
  448. X        These creatures are not native to this universe;  they  seem
  449. X        to have strangely derived powers, and unknown motives.
  450. Xquadruped
  451. X        The woodlands and other regions  are inhabited by multitudes
  452. X        of four-legged creatures  which cannot be simply classified.
  453. X        They might not have fiery breath  or deadly stings,  but ad-
  454. X        venturers  have  nevertheless  met their end  numerous times
  455. X        due to the claws, hooves, or bites of such animals.
  456. Xrust monster
  457. X        These strange creatures live on a   diet  of  metals.   They
  458. X        will  turn  a  suit  of  armour into so much useless  rusted
  459. X        scrap in no time at all.
  460. Xsasquatch
  461. X        An ape-like humanoid  native to densely forested  mountains,
  462. X        the sasquatch is  also known as "bigfoot".   Normally benign
  463. X        are rarely seen,  this creature is reputed to be  a relative
  464. X        of the ferocious yeti.
  465. Xsnickersnee
  466. X        Ah, never shall I forget the cry, 
  467. X            or the shriek that shrieked he,
  468. X        As I gnashed my teeth, and from my sheath
  469. X            I drew my Snickersnee!
  470. X        --Koko, Lord high executioner of Titipu
  471. X                     [ The Mikado, by Sir W.S. Gilbert ]
  472. X*soldier
  473. Xsergeant
  474. Xlieutenant
  475. Xcaptain
  476. X        The soldiers  of Yendor are  well-trained in the art of war,
  477. X        many  trained by  the Wizard himself.  Some say the soldiers
  478. X        are explorers  who were  unfortunate enough  to be captured,
  479. X        and  put under the Wizard's spell.  Those who have  survived
  480. X        encounters  with  soldiers   say  they  travel  together  in
  481. X        platoons,  and are fierce fighters.  Because of the  load of
  482. X        their  combat gear,  however,  one can usually run away from
  483. X        them, and doing so is considered a wise thing.
  484. Xtengu
  485. X        The tengu was the  most  troublesome  creature  of  Japanese
  486. X        legend.   Part  bird  and part man, with red beak for a nose
  487. X        and flashing eyes, the tengu was notorious for  stirring  up
  488. X        feuds  and  prolonging  enmity between families. Indeed, the
  489. X        belligerent tengus were supposed to have  been  man's  first
  490. X        instructors in the use of arms.
  491. X        [Mythical Beasts by Deirdre Headon (The Leprechaun Library)]
  492. Xtsurugi
  493. X        The tsurugi,  also known  as  the long samurai sword,  is an
  494. X        extremely  sharp,  two-handed blade favored  by the samurai.
  495. X        It  is made of hardened steel,  and is manufactured  using a
  496. X        special  process, causing it  to never rust.  The tsurugi is
  497. X        rumored  to  be  so  sharp  that  it  can  occasionally  cut
  498. X        opponents in half!
  499. X*unicorn
  500. Xunicorn horn
  501. X        Men have always sought the elusive unicorn, for  the  single
  502. X        twisted  horn  which projected from its forehead was thought
  503. X        to be a powerful talisman.  It was said that the unicorn had
  504. X        simply  to  dip  the tip of its horn in a muddy pool for the
  505. X        water to become pure.  Men also believed that to  drink from
  506. X        this horn was a protection against all sickness, and that if
  507. X        the horn was ground to a powder it would act as an  antidote
  508. X        to all poisons.  Less than 200 years ago in France, the horn
  509. X        of a unicorn was used in a ceremony to test the  royal  food
  510. X        for poison.
  511. X    
  512. X        Although only the size of a small horse, the  unicorn  is  a
  513. X        very  fierce  beast,  capable  of killing an elephant with a
  514. X        single thrust from its horn.  Its  fleetness  of  foot  also
  515. X        makes  this solitary creature difficult to capture. However,
  516. X        it can be tamed and captured by a maiden. Made gentle by the
  517. X        sight  of a virgin, the unicorn can be lured to lay its head
  518. X        in her lap, and in this docile mood, the maiden  may  secure
  519. X        it with a golden rope.
  520. X        [Mythical Beasts by Deirdre Headon (The Leprechaun Library)]
  521. Xwakizashi
  522. X        The samurai  warrior  traditionally  wears  two  swords; the
  523. X        wakizashi is the shorter of the two.  See also katana.
  524. X*long worm
  525. Xworm tooth
  526. Xcrysknife
  527. X        [The crysknife] is manufactured in two forms from teeth tak-
  528. X        en  from dead sandworms.  The two forms are "fixed" and "un-
  529. X        fixed." An unfixed  knife  requires  proximity  to  a  human
  530. X        body's  electrical  field  to prevent disintegration.  Fixed
  531. X        knives are treated for storage.  All are about  20  centime-
  532. X        ters long.
  533. X                          [ Dune, by Frank Herbert ]
  534. Xwizard of yendor
  535. X        No  one knows how old this mighty wizard is,  or from whence
  536. X        he came.  It is known that,  having lived a span far greater
  537. X        than any normal man's, he grew weary of lesser mortals;  and
  538. X        so, spurning all human company,  he forsook the dwellings of
  539. X        men  and  went to live in the depths of the  Earth.  He took
  540. X        with him the mystical artifact, the Amulet of Yendor,  which
  541. X        is said to hold great power indeed. Many have sought to find
  542. X        the  wizard and  his treasure,  but none have found  him and
  543. X        lived to tell the tale.  Woe be to the incautious adventurer
  544. X        who disturbs this mighty sorcerer!
  545. Xxan
  546. X        They sent their friend the mosquito [xan] ahead of  them  to
  547. X        find  out  what lay ahead.  "Since you are the one who sucks
  548. X        the blood of men walking along paths," they told the mosqui-
  549. X        to,  "go  and  sting the men of Xibalba."  The mosquito flew
  550. X        down the dark road to the Underworld.  Entering the house of
  551. X        the Lords of Death, he stung the first person that he saw...
  552. X    
  553. X        The mosquito stung this man as well, and when he yelled, the
  554. X        man  next  to him asked, "Gathered Blood, what's wrong?"  So
  555. X        he flew along the row stinging all the seated men  until  he
  556. X        knew the names of all twelve.
  557. X                [ Popul Vuh, as translated by Ralph Nelson ]
  558. Xya
  559. X        The arrow  of  choice of the samurai,  ya  are  made of very
  560. X        straight bamboo, and are  tipped  with hardened steel.
  561. Xyeti
  562. X        An ape-like humanoid  native to inaccessible  mountain tops,
  563. X        the yeti is also known as "the abominable snowman".  Whether
  564. X        or not the title "man" is appropriate remains unknown.
  565. Xyumi
  566. X        The samurai is highly  trained  with a special type  of bow,
  567. X        the yumi.  Like the  ya, the yumi  is  made of bamboo.  With
  568. X        the yumi-ya, the bow and arrow, the samurai is an  extremely
  569. X        accurate and deadly warrior.
  570. X*zombie
  571. X        The zombi...  is a soulless human corpse,  still  dead,  but
  572. X        taken    from  the  grave  and  endowed    by  sorcery  with  a
  573. X        mechanical semblance of life, --  it is a dead body which is
  574. X        made to walk and act and move as if it were alive.
  575. X                              [ W. B. Seabrook ]
  576. Xzruty
  577. X        The zruty are  wild and gigantic beings,  living in the wil-
  578. X        dernesses of the Tatra mountains.
  579. END_OF_FILE
  580. if test 25887 -ne `wc -c <'dat/data.base'`; then
  581.     echo shar: \"'dat/data.base'\" unpacked with wrong size!
  582. fi
  583. # end of 'dat/data.base'
  584. fi
  585. if test -f 'win/X11/winmap.c' -a "${1}" != "-c" ; then 
  586.   echo shar: Will not clobber existing file \"'win/X11/winmap.c'\"
  587. else
  588. echo shar: Extracting \"'win/X11/winmap.c'\" \(28534 characters\)
  589. sed "s/^X//" >'win/X11/winmap.c' <<'END_OF_FILE'
  590. X/*    SCCS Id: @(#)winmap.c    3.1    92/04/30          */
  591. X/* Copyright (c) Dean Luick, 1992                  */
  592. X/* NetHack may be freely redistributed.  See license for details. */
  593. X
  594. X/*
  595. X * This file contains:
  596. X *    + global functions print_glyph() and cliparound()
  597. X *     + the map window routines
  598. X *    + the char and pointer input routines
  599. X *
  600. X * Notes:
  601. X *    + We don't really have a good way to get the compiled ROWNO and 
  602. X *      COLNO as defaults.  They are hardwired to the current "correct"
  603. X *      values in the Window widget.  I am _not_ in favor of including
  604. X *      some nethack include file for Window.c.
  605. X */
  606. X#include <X11/Intrinsic.h>
  607. X#include <X11/StringDefs.h>
  608. X#include <X11/Shell.h>
  609. X#include <X11/Xaw/Cardinals.h>
  610. X#include <X11/Xaw/Scrollbar.h>
  611. X#include <X11/Xaw/Viewport.h>
  612. X#include "Window.h"    /* map widget declarations */
  613. X
  614. X#include "hack.h"
  615. X#include "winX.h"
  616. X
  617. X/* Define these if you really want a lot of junk on your screen. */
  618. X/* #define VERBOSE        /* print various info & events as they happen */
  619. X/* #define VERBOSE_UPDATE    /* print screen update bounds */
  620. X/* #define VERBOSE_INPUT    /* print input events */
  621. X
  622. Xstatic void set_button_values();
  623. Xstatic void map_check_size_change();
  624. Xstatic void map_update();
  625. Xstatic void map_exposed();
  626. Xstatic void map_input();
  627. Xstatic void set_gc();
  628. Xstatic void get_gc();
  629. Xstatic void get_char_info();
  630. Xstatic void display_cursor();
  631. X
  632. X/* Global functions ======================================================== */
  633. X
  634. Xvoid
  635. XX11_print_glyph(window, x, y, glyph)
  636. X    winid window;
  637. X    xchar x, y;
  638. X    int glyph;
  639. X{
  640. X    uchar          ch;
  641. X    register int      offset;
  642. X    struct map_info_t *map_info;
  643. X    register unsigned char *ch_ptr;
  644. X#ifdef TEXTCOLOR
  645. X    int     color;
  646. X    register unsigned char *co_ptr;
  647. X
  648. X#define zap_color(n)  color = zapcolors[n]
  649. X#define cmap_color(n) color = defsyms[n].color
  650. X#define trap_color(n) color = (n == WEB) ? defsyms[S_web ].color : \
  651. X                       defsyms[S_trap].color
  652. X#define obj_color(n)  color = objects[n].oc_color
  653. X#define mon_color(n)  color = mons[n].mcolor
  654. X#define pet_color(n)  color = mons[n].mcolor
  655. X
  656. X# else /* no text color */
  657. X
  658. X#define zap_color(n)
  659. X#define cmap_color(n)
  660. X#define trap_color(n)
  661. X#define obj_color(n)
  662. X#define mon_color(n)
  663. X#define pet_color(n)
  664. X#endif
  665. X
  666. X    check_winid(window);
  667. X    if (window_list[window].type != NHW_MAP) {
  668. X    impossible("print_glyph: can (currently) only print to map windows");
  669. X    return;
  670. X    }
  671. X    map_info = window_list[window].map_information;
  672. X
  673. X    /*
  674. X     *  Map the glyph back to a character.
  675. X     *
  676. X     *  Warning:  For speed, this makes an assumption on the order of
  677. X     *            offsets.  The order is set in display.h.
  678. X     */
  679. X    if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) {        /* swallow */
  680. X    /* see swallow_to_glyph() in display.c */
  681. X    ch = (uchar) showsyms[S_sw_tl + (offset & 0x7)];
  682. X    mon_color(offset >> 3);
  683. X    } else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) {    /* zap beam */
  684. X    /* see zapdir_to_glyph() in display.c */
  685. X    ch = showsyms[S_vbeam + (offset & 0x3)];
  686. X    zap_color((offset >> 2));
  687. X    } else if ((offset = (glyph - GLYPH_CMAP_OFF)) >= 0) {    /* cmap */
  688. X    ch = showsyms[offset];
  689. X    cmap_color(offset);
  690. X    } else if ((offset = (glyph - GLYPH_TRAP_OFF)) >= 0) {    /* trap */
  691. X    ch = (offset == WEB) ? showsyms[S_web] : showsyms[S_trap];
  692. X    trap_color(offset);
  693. X    } else if ((offset = (glyph - GLYPH_OBJ_OFF)) >= 0) {    /* object */
  694. X    ch = oc_syms[objects[offset].oc_class];
  695. X    obj_color(offset);
  696. X    } else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) {    /* a corpse */
  697. X    ch = oc_syms[objects[CORPSE].oc_class];
  698. X    mon_color(offset);
  699. X    } else if ((offset = (glyph - GLYPH_PET_OFF)) >= 0) {    /* a pet */
  700. X    ch = monsyms[mons[offset].mlet];
  701. X    pet_color(offset);
  702. X    } else {                            /* a monster */
  703. X    ch = monsyms[mons[glyph].mlet];
  704. X    mon_color(glyph);
  705. X    }
  706. X
  707. X    /* Only update if we need to. */
  708. X    ch_ptr = &map_info->text[y][x];
  709. X
  710. X#ifdef TEXTCOLOR
  711. X    co_ptr = &map_info->colors[y][x];
  712. X    if (*ch_ptr != ch || *co_ptr != color)
  713. X#else
  714. X    if (*ch_ptr != ch)
  715. X#endif
  716. X    {
  717. X    *ch_ptr = ch;
  718. X#ifdef TEXTCOLOR
  719. X    *co_ptr = color;
  720. X#endif
  721. X    /* update row bbox */
  722. X    if ((uchar) x < map_info->t_start[y]) map_info->t_start[y] = x;
  723. X    if ((uchar) x > map_info->t_stop[y])  map_info->t_stop[y]  = x;
  724. X    }
  725. X
  726. X#undef zap_color
  727. X#undef cmap_color
  728. X#undef trap_color
  729. X#undef obj_color
  730. X#undef mon_color
  731. X#undef pet_color
  732. X}
  733. X
  734. X#ifdef CLIPPING
  735. X/*
  736. X * The is the tty clip call.  Since X can resize at any time, we can't depend
  737. X * on this being defined.
  738. X */
  739. X/*ARGSUSED*/
  740. Xvoid X11_cliparound(x, y) int x, y; { }
  741. X#endif /* CLIPPING */
  742. X
  743. X/* End global functions ==================================================== */
  744. X
  745. X
  746. X/*
  747. X * Make sure the map's cursor is always visible.
  748. X */
  749. Xvoid
  750. Xcheck_cursor_visibility(wp)
  751. X    struct xwindow *wp;
  752. X{
  753. X    Arg arg[2];
  754. X    Widget viewport, horiz_sb, vert_sb;
  755. X    float top, shown, cursor_middle;
  756. X    Boolean do_call, adjusted = False;
  757. X#ifdef VERBOSE
  758. X    char *s;
  759. X#endif
  760. X
  761. X    viewport = XtParent(wp->w);
  762. X    horiz_sb = XtNameToWidget(viewport, "horizontal");
  763. X    vert_sb  = XtNameToWidget(viewport, "vertical");
  764. X
  765. X#define V_BORDER 0.1        /* if this far from vert edge, shift */
  766. X#define H_BORDER 0.0625        /* if this from from horiz edge, shift */
  767. X
  768. X#define H_DELTA 0.25        /* distance of horiz shift */
  769. X                /* vert shift is half of curr distance */
  770. X/* The V_DELTA is 1/2 the value of shown. */
  771. X
  772. X    if (horiz_sb) {
  773. X    XtSetArg(arg[0], XtNshown,    &shown);
  774. X    XtSetArg(arg[1], XtNtopOfThumb, &top);
  775. X    XtGetValues(horiz_sb, arg, TWO);
  776. X
  777. X    cursor_middle = (((float) wp->cursx) + 0.5) / (float) COLNO;
  778. X    do_call = True;
  779. X
  780. X#ifdef VERBOSE
  781. X    if (cursor_middle < top) {
  782. X        s = " outside left";
  783. X    } else if (cursor_middle < top + H_BORDER) {
  784. X        s = " close to left";
  785. X    } else if (cursor_middle > (top + shown)) {
  786. X        s = " outside right";
  787. X    } else if (cursor_middle > (top + shown - H_BORDER)) {
  788. X        s = " close to right";
  789. X    } else {
  790. X        s = "";
  791. X    }
  792. X    printf("Horiz: shown = %3.2f, top = %3.2f%s", shown, top, s);
  793. X#endif
  794. X
  795. X    if (cursor_middle < top) {
  796. X        top = cursor_middle - H_DELTA;
  797. X        if (top < 0.0) top = 0;
  798. X    } else if (cursor_middle < top + H_BORDER) {
  799. X        top -= H_DELTA;
  800. X        if (top < 0.0) top = 0.0;
  801. X    } else if (cursor_middle > (top + shown)) {
  802. X        top = cursor_middle + H_DELTA;
  803. X        if (top + shown > 1.0) top = 1.0 - shown;
  804. X    } else if (cursor_middle > (top + shown - H_BORDER)) {
  805. X        top += H_DELTA;
  806. X        if (top + shown > 1.0) top = 1.0 - shown;
  807. X    } else {
  808. X        do_call = False;
  809. X    }
  810. X
  811. X    if (do_call) {
  812. X        XtCallCallbacks(horiz_sb, XtNjumpProc, &top);
  813. X        adjusted = True;
  814. X    }
  815. X    }
  816. X
  817. X    if (vert_sb) {
  818. X    XtSetArg(arg[0], XtNshown,      &shown);
  819. X    XtSetArg(arg[1], XtNtopOfThumb, &top);
  820. X    XtGetValues(vert_sb, arg, TWO);
  821. X
  822. X    cursor_middle = (((float) wp->cursy) + 0.5) / (float) ROWNO;
  823. X    do_call = True;
  824. X
  825. X#ifdef VERBOSE
  826. X    if (cursor_middle < top) {
  827. X        s = " above top";
  828. X    } else if (cursor_middle < top + V_BORDER) {
  829. X        s = " close to top";
  830. X    } else if (cursor_middle > (top + shown)) {
  831. X        s = " below bottom";
  832. X    } else if (cursor_middle > (top + shown - V_BORDER)) {
  833. X        s = " close to bottom";
  834. X    } else {
  835. X        s = "";
  836. X    }
  837. X    printf("%sVert: shown = %3.2f, top = %3.2f%s",
  838. X                    horiz_sb ? ";  " : "", shown, top, s);
  839. X#endif
  840. X
  841. X    if (cursor_middle < top) {
  842. X        top = cursor_middle - (shown / 2.0);
  843. X        if (top < 0.0) top = 0;
  844. X    } else if (cursor_middle < top + V_BORDER) {
  845. X        top -= shown / 2.0;
  846. X        if (top < 0.0) top = 0;
  847. X    } else if (cursor_middle > (top + shown)) {
  848. X        top = cursor_middle - (shown / 2.0);
  849. X        if (top < 0.0) top = 0;
  850. X        if (top + shown > 1.0) top = 1.0 - shown;
  851. X    } else if (cursor_middle > (top + shown - V_BORDER)) {
  852. X        top += shown / 2.0;
  853. X        if (top + shown > 1.0) top = 1.0 - shown;
  854. X    } else {
  855. X        do_call = False;
  856. X    }
  857. X
  858. X    if (do_call) {
  859. X        XtCallCallbacks(vert_sb, XtNjumpProc, &top);
  860. X        adjusted = True;
  861. X    }
  862. X    }
  863. X
  864. X    /* make sure cursor is displayed during dowhatis.. */
  865. X    if (adjusted) display_cursor(wp);
  866. X
  867. X#ifdef VERBOSE
  868. X    if (horiz_sb || vert_sb) printf("\n");
  869. X#endif
  870. X}
  871. X
  872. X
  873. X/*
  874. X * Check to see if the viewport has grown smaller.  If so, then we want to make
  875. X * sure that the cursor is still on the screen.  We do this to keep the cursor
  876. X * on the screen when the user resizes the nethack window.
  877. X */
  878. Xstatic void
  879. Xmap_check_size_change(wp)
  880. X    struct xwindow *wp;
  881. X{
  882. X    struct map_info_t *map_info = wp->map_information;
  883. X    Arg arg[2];
  884. X    Dimension new_width, new_height;
  885. X    Widget viewport;
  886. X
  887. X    viewport = XtParent(wp->w);
  888. X
  889. X    XtSetArg(arg[0], XtNwidth,  &new_width);
  890. X    XtSetArg(arg[1], XtNheight, &new_height);
  891. X    XtGetValues(viewport, arg, TWO);
  892. X
  893. X    /* Only do cursor check if new size is smaller. */
  894. X    if (new_width < map_info->viewport_width
  895. X            || new_height < map_info->viewport_height) {
  896. X    check_cursor_visibility(wp);
  897. X    }
  898. X
  899. X    map_info->viewport_width = new_width;
  900. X    map_info->viewport_height = new_height;
  901. X}
  902. X
  903. X/*
  904. X * Fill in parameters "regular" and "inverse" with newly created GCs.
  905. X * Using the given background pixel and the foreground pixel optained
  906. X * by querying the widget with the resource name.
  907. X */
  908. Xstatic void
  909. Xset_gc(w, font, resource_name, bgpixel, regular, inverse)
  910. X    Widget w;
  911. X    Font font;
  912. X    char *resource_name;
  913. X    Pixel bgpixel;
  914. X    GC   *regular, *inverse;
  915. X{
  916. X    XGCValues values;
  917. X    XtGCMask mask = GCFunction | GCForeground | GCBackground | GCFont;
  918. X    Pixel curpixel;
  919. X    Arg arg[1];
  920. X
  921. X    XtSetArg(arg[0], resource_name, &curpixel);
  922. X    XtGetValues(w, arg, ONE);
  923. X
  924. X    values.foreground = curpixel;
  925. X    values.background = bgpixel;
  926. X    values.function   = GXcopy;
  927. X    values.font          = font;
  928. X    *regular = XtGetGC(w, mask, &values);
  929. X    values.foreground = bgpixel;
  930. X    values.background = curpixel;
  931. X    values.function   = GXcopy;
  932. X    values.font          = font;
  933. X    *inverse = XtGetGC(w, mask, &values);
  934. X}
  935. X
  936. X/*
  937. X * Create the GC's for each color.
  938. X *
  939. X * I'm not sure if it is a good idea to have a GC for each color (and
  940. X * inverse). It might be faster to just modify the foreground and
  941. X * background colors on the current GC as needed.
  942. X */
  943. Xstatic void
  944. Xget_gc(wp, font)
  945. X    struct xwindow *wp;
  946. X    Font font;
  947. X{
  948. X    struct map_info_t *map_info = wp->map_information;
  949. X    Pixel bgpixel;
  950. X    Arg arg[1];
  951. X
  952. X    /* Get background pixel. */
  953. X    XtSetArg(arg[0], XtNbackground, &bgpixel);
  954. X    XtGetValues(wp->w, arg, ONE);
  955. X
  956. X#ifdef TEXTCOLOR
  957. X#define set_color_gc(nh_color, resource_name)            \
  958. X        set_gc(wp->w, font, resource_name, bgpixel,        \
  959. X            &map_info->color_gcs[nh_color],        \
  960. X            &map_info->inv_color_gcs[nh_color]);
  961. X
  962. X    set_color_gc(BLACK,         XtNblack);
  963. X    set_color_gc(RED,         XtNred);
  964. X    set_color_gc(GREEN,         XtNgreen);
  965. X    set_color_gc(BROWN,         XtNbrown);
  966. X    set_color_gc(BLUE,         XtNblue);
  967. X    set_color_gc(MAGENTA,     XtNmagenta);
  968. X    set_color_gc(CYAN,         XtNcyan);
  969. X    set_color_gc(GRAY,         XtNgray);
  970. X    set_color_gc(NO_COLOR,     XtNforeground);
  971. X    set_color_gc(ORANGE_COLORED, XtNorange);
  972. X    set_color_gc(BRIGHT_GREEN,     XtNbright_green);
  973. X    set_color_gc(YELLOW,     XtNyellow);
  974. X    set_color_gc(BRIGHT_BLUE,     XtNbright_blue);
  975. X    set_color_gc(BRIGHT_MAGENTA, XtNbright_magenta);
  976. X    set_color_gc(BRIGHT_CYAN,     XtNbright_cyan);
  977. X    set_color_gc(WHITE,         XtNwhite);
  978. X#else
  979. X    set_gc(wp->w, font, XtNforeground, bgpixel,
  980. X                &map_info->copy_gc, &map_info->inv_copy_gc);
  981. X#endif
  982. X}
  983. X
  984. X
  985. X/*
  986. X * Display the cursor on the map window.
  987. X */
  988. Xstatic void
  989. Xdisplay_cursor(wp)
  990. X    struct xwindow *wp;
  991. X{
  992. X    /* Redisplay the cursor location inverted. */
  993. X    map_update(wp, wp->cursy, wp->cursy, wp->cursx, wp->cursx, TRUE);
  994. X}
  995. X
  996. X
  997. X/*
  998. X * Check if there are any changed characters.  If so, then plaster them on
  999. X * the screen.
  1000. X */
  1001. Xvoid
  1002. Xdisplay_map_window(wp)
  1003. X    struct xwindow *wp;
  1004. X{
  1005. X    register int row;
  1006. X    struct map_info_t *map_info = wp->map_information;
  1007. X
  1008. X    /*
  1009. X     * If the previous cursor position is not the same as the current
  1010. X     * cursor position, then update the old cursor position.
  1011. X     */
  1012. X    if (wp->prevx != wp->cursx || wp->prevy != wp->cursy) {
  1013. X    register unsigned int x = wp->prevx, y = wp->prevy;
  1014. X    if (x < map_info->t_start[y]) map_info->t_start[y] = x;
  1015. X    if (x > map_info->t_stop[y])  map_info->t_stop[y]  = x;
  1016. X    }
  1017. X
  1018. X    for (row = 0; row < ROWNO; row++) {
  1019. X    if (map_info->t_start[row] <= map_info->t_stop[row]) {
  1020. X        map_update(wp, row, row,
  1021. X            (int) map_info->t_start[row],
  1022. X            (int) map_info->t_stop[row], FALSE);
  1023. X        map_info->t_start[row] = COLNO-1;
  1024. X        map_info->t_stop[row] = 0;
  1025. X    }
  1026. X    }
  1027. X    display_cursor(wp);
  1028. X    wp->prevx = wp->cursx;    /* adjust old cursor position */
  1029. X    wp->prevy = wp->cursy;
  1030. X}
  1031. X
  1032. X/*
  1033. X * Fill the saved screen characters with the "clear" character, and reset
  1034. X * all colors to the neutral color.  Flush out everything by resetting the
  1035. X * "new" bounds and calling display_map_window().
  1036. X */
  1037. Xvoid
  1038. Xclear_map_window(wp)
  1039. X    struct xwindow *wp;
  1040. X{
  1041. X    struct map_info_t *map_info = wp->map_information;
  1042. X
  1043. X    /* Fill with spaces, and update */
  1044. X    (void) memset((genericptr_t) map_info->text, ' ',
  1045. X            sizeof(map_info->text));
  1046. X    (void) memset((genericptr_t) map_info->t_start, (char) 0,
  1047. X            sizeof(map_info->t_start));
  1048. X    (void) memset((genericptr_t) map_info->t_stop, (char) COLNO-1,
  1049. X            sizeof(map_info->t_stop));
  1050. X#ifdef TEXTCOLOR
  1051. X    (void) memset((genericptr_t) map_info->colors, NO_COLOR,
  1052. X            sizeof(map_info->colors));
  1053. X#endif
  1054. X    display_map_window(wp);
  1055. X}
  1056. X
  1057. X/*
  1058. X * Retreive the font associated with the map window and save attributes
  1059. X * that are used when updating it.
  1060. X */
  1061. Xstatic void
  1062. Xget_char_info(wp)
  1063. X    struct xwindow *wp;
  1064. X{
  1065. X    XFontStruct *fs;
  1066. X
  1067. X    fs = WindowFontStruct(wp->w);
  1068. X    wp->map_information->char_width    = fs->max_bounds.width;
  1069. X    wp->map_information->char_height   = fs->max_bounds.ascent +
  1070. X                        fs->max_bounds.descent;
  1071. X    wp->map_information->char_ascent   = fs->max_bounds.ascent;
  1072. X    wp->map_information->char_lbearing = -fs->min_bounds.lbearing;
  1073. X
  1074. X#ifdef VERBOSE
  1075. X    printf("Font information:\n");
  1076. X    printf("fid = %d, direction = %d\n", fs->fid, fs->direction);
  1077. X    printf("first = %d, last = %d\n",
  1078. X            fs->min_char_or_byte2, fs->max_char_or_byte2);
  1079. X    printf("all chars exist? %s\n", fs->all_chars_exist?"yes":"no");
  1080. X    printf("min_bounds:lb=%d rb=%d width=%d asc=%d des=%d attr=%d\n",
  1081. X        fs->min_bounds.lbearing, fs->min_bounds.rbearing,
  1082. X        fs->min_bounds.width, fs->min_bounds.ascent,
  1083. X        fs->min_bounds.descent, fs->min_bounds.attributes);
  1084. X    printf("max_bounds:lb=%d rb=%d width=%d asc=%d des=%d attr=%d\n",
  1085. X        fs->max_bounds.lbearing, fs->max_bounds.rbearing,
  1086. X        fs->max_bounds.width, fs->max_bounds.ascent,
  1087. X        fs->max_bounds.descent, fs->max_bounds.attributes);
  1088. X    printf("per_char = 0x%x\n", fs->per_char);
  1089. X    printf("Text: (max) width = %d, height = %d\n",
  1090. X        wp->map_information->char_width, wp->map_information->char_height);
  1091. X#endif
  1092. X
  1093. X    if (fs->min_bounds.width != fs->max_bounds.width)
  1094. X    X11_raw_print("Warning:  map font is not monospaced!");
  1095. X}
  1096. X
  1097. X/*
  1098. X * keyhit buffer
  1099. X */
  1100. X#define INBUF_SIZE 64
  1101. Xint inbuf[INBUF_SIZE];
  1102. Xint incount = 0;
  1103. Xint inptr = 0;    /* points to valid data */
  1104. X
  1105. X
  1106. Xvoid
  1107. Xextern_map_input(event)
  1108. X    XEvent *event;
  1109. X{
  1110. X    if(event->type == KeyPress)
  1111. X    map_input(window_list[WIN_MAP].w, (XtPointer) 0, (XtPointer) event);
  1112. X}
  1113. X
  1114. X/*
  1115. X * Keyboard and button event handler for map window.
  1116. X */
  1117. X/* ARGSUSED */
  1118. Xstatic void
  1119. Xmap_input(w, client_data, call_data)
  1120. X    Widget w;
  1121. X    XtPointer client_data, call_data;
  1122. X{
  1123. X    XEvent *event = (XEvent *) call_data;
  1124. X    XKeyEvent *key;
  1125. X    XButtonEvent *button;
  1126. X    int i, nbytes;
  1127. X    char c;
  1128. X    char keystring[MAX_KEY_STRING];
  1129. X
  1130. X    switch (event->type) {
  1131. X    case ButtonPress:
  1132. X        button = (XButtonEvent *) event;
  1133. X#ifdef VERBOSE_INPUT
  1134. X        printf("button press\n");
  1135. X#endif
  1136. X        set_button_values(w, button->x, button->y, button->button);
  1137. X        break;
  1138. X    case KeyPress:
  1139. X#ifdef VERBOSE_INPUT
  1140. X        printf("key: ");
  1141. X#endif
  1142. X        if(appResources.slow && input_func) {
  1143. X        (*input_func)(w, event, NULL, NULL);
  1144. X        break;
  1145. X        }
  1146. X
  1147. X        /*
  1148. X         * Don't use key_event_to_char() because we want to be able
  1149. X         * to allow keys mapped to multiple characters.
  1150. X         */
  1151. X        key = (XKeyEvent *) event;
  1152. X        nbytes = XLookupString(key, keystring, MAX_KEY_STRING, NULL, NULL);
  1153. X        /* Modifier keys return a zero length string when pressed. */
  1154. X        if (nbytes) {
  1155. X#ifdef VERBOSE_INPUT
  1156. X        printf("\"");
  1157. X#endif
  1158. X        for (i = 0; i < nbytes; i++) {
  1159. X            c = keystring[i];
  1160. X
  1161. X            if (incount < INBUF_SIZE) {
  1162. X            inbuf[(inptr+incount)%INBUF_SIZE] =
  1163. X                ((int) c) + ((key->state & Mod1Mask) ? 0x80 : 0);
  1164. X            incount++;
  1165. X            } else {
  1166. X            X11_nhbell();
  1167. X            }
  1168. X#ifdef VERBOSE_INPUT
  1169. X            /*
  1170. X             * Assume that mod1 is really the meta key.
  1171. X             */
  1172. X            if (key->state & Mod1Mask)    /* meta will print as M<c> */
  1173. X            (void) putchar('M');
  1174. X            if (c < ' ') {        /* ctrl will print as ^<c> */
  1175. X            (void) putchar('^');
  1176. X            c += '@';
  1177. X            }
  1178. X            (void) putchar(c);
  1179. X#endif
  1180. X        }
  1181. X#ifdef VERBOSE_INPUT
  1182. X        printf("\" [%d bytes]\n", nbytes);
  1183. X#endif
  1184. X        }
  1185. X        break;
  1186. X
  1187. X    default:
  1188. X        impossible("unexpected X event, type = %d\n", (int) event->type);
  1189. X        break;
  1190. X    }
  1191. X}
  1192. X
  1193. Xstatic void
  1194. Xset_button_values(w, x, y, button)
  1195. X    Widget w;
  1196. X    int x;
  1197. X    int y;
  1198. X    unsigned int button;
  1199. X{
  1200. X    struct xwindow *wp;
  1201. X    struct map_info_t *map_info;
  1202. X
  1203. X    wp = find_widget(w);
  1204. X    map_info = wp->map_information;
  1205. X
  1206. X    click_x = x / map_info->char_width;
  1207. X    click_y = y / map_info->char_height;
  1208. X
  1209. X    /* The values can be out of range if the map window has been resized */
  1210. X    /* to be larger than the max size.                     */
  1211. X    if (click_x >= COLNO) click_x = COLNO-1;
  1212. X    if (click_y >= ROWNO) click_x = ROWNO-1;
  1213. X
  1214. X    /* Map all buttons but the first to the second click */
  1215. X    click_button = (button == Button1) ? CLICK_1 : CLICK_2;
  1216. X}
  1217. X
  1218. X/*
  1219. X * Map window expose callback.
  1220. X */
  1221. Xstatic void
  1222. Xmap_exposed(w, event)
  1223. X    Widget w;
  1224. X    XExposeEvent *event;
  1225. X{
  1226. X    int x, y;
  1227. X    struct xwindow *wp;
  1228. X    struct map_info_t *map_info;
  1229. X    unsigned width, height;
  1230. X    int start_row, stop_row, start_col, stop_col;
  1231. X
  1232. X    if (!XtIsRealized(w)) return;
  1233. X
  1234. X    wp = find_widget(w);
  1235. X    map_info = wp->map_information;
  1236. X    /*
  1237. X     * The map is sent an expose event when the viewport resizes.  Make sure
  1238. X     * that the cursor is still in the viewport after the resize.
  1239. X     */
  1240. X    map_check_size_change(wp);
  1241. X
  1242. X    if (event) {        /* called from button-event */
  1243. X    x      = event->x;
  1244. X    y      = event->y;
  1245. X    width  = event->width;
  1246. X    height = event->height;
  1247. X    } else {
  1248. X    x     = 0;
  1249. X    y     = 0;
  1250. X    width = wp->pixel_width;
  1251. X    height= wp->pixel_height;
  1252. X    }
  1253. X    /*
  1254. X     * Convert pixels into INCLUSIVE text rows and columns.
  1255. X     */
  1256. X    start_row = y / map_info->char_height;
  1257. X    stop_row = start_row + (height / map_info->char_height) +
  1258. X            (((height % map_info->char_height) == 0) ? 0 : 1) - 1;
  1259. X
  1260. X    start_col = x / map_info->char_width;
  1261. X    stop_col = start_col + (width / map_info->char_width) +
  1262. X            (((width % map_info->char_width) == 0) ? 0 : 1) - 1;
  1263. X
  1264. X#ifdef VERBOSE
  1265. X    printf("map_exposed: x = %d, y = %d, width = %d, height = %d\n",
  1266. X                            x, y, width, height);
  1267. X#endif
  1268. X
  1269. X    /* Out of range values are possible if the map window is resized to be */
  1270. X    /* bigger than the largest expected value.                   */
  1271. X    if (stop_row >= ROWNO) stop_row = ROWNO-1;
  1272. X    if (stop_col >= COLNO) stop_col = COLNO-1;
  1273. X
  1274. X    map_update(wp, start_row, stop_row, start_col, stop_col, FALSE);
  1275. X    display_cursor(wp);        /* make sure cursor shows up */
  1276. X}
  1277. X
  1278. X/*
  1279. X * Do the actual work of the putting characters onto our X window.  This
  1280. X * is called from the expose event routine, the display window (flush)
  1281. X * routine, and the display cursor routine.  The later is a kludge that
  1282. X * involves the inverted parameter of this function.  A better solution
  1283. X * would be to double the color count, with any color above MAXCOLORS
  1284. X * being inverted.
  1285. X *
  1286. X * This works for rectangular regions (this includes one line rectangles).
  1287. X * The start and stop columns are *inclusive*.
  1288. X */
  1289. Xstatic void
  1290. Xmap_update(wp, start_row, stop_row, start_col, stop_col, inverted)
  1291. X    struct xwindow *wp;
  1292. X    int start_row, stop_row, start_col, stop_col;
  1293. X    boolean inverted;
  1294. X{
  1295. X    int win_start_row, win_start_col;
  1296. X    struct map_info_t *map_info = wp->map_information;
  1297. X    int row;
  1298. X    register int count;
  1299. X
  1300. X    if (start_row < 0 || stop_row >= ROWNO) {
  1301. X    impossible("map_update:  bad row range %d-%d\n", start_row, stop_row);
  1302. X    return;
  1303. X    }
  1304. X    if (start_col < 0 || stop_col >=COLNO) {
  1305. X    impossible("map_update:  bad col range %d-%d\n", start_col, stop_col);
  1306. X    return;
  1307. X    }
  1308. X
  1309. X#ifdef VERBOSE_UPDATE
  1310. X    printf("update: [0x%x] %d %d %d %d\n", 
  1311. X        (int) wp->w, start_row, stop_row, start_col, stop_col);
  1312. X#endif
  1313. X    win_start_row = start_row;
  1314. X    win_start_col = start_col;
  1315. X
  1316. X#ifdef TEXTCOLOR
  1317. X    if (flags.use_color) {
  1318. X    register char *c_ptr;
  1319. X    char *t_ptr;
  1320. X    int cur_col, color, win_ystart;
  1321. X
  1322. X    for (row = start_row; row <= stop_row; row++) {
  1323. X        win_ystart = map_info->char_ascent +
  1324. X                    (row * map_info->char_height);
  1325. X
  1326. X        t_ptr = (char *) &(map_info->text[row][start_col]);
  1327. X        c_ptr = (char *) &(map_info->colors[row][start_col]);
  1328. X        cur_col = start_col;
  1329. X        while (cur_col <= stop_col) {
  1330. X        color = *c_ptr++;
  1331. X        count = 1;
  1332. X        while ((cur_col + count) <= stop_col && *c_ptr == color) {
  1333. X            count++;
  1334. X            c_ptr++;
  1335. X        }
  1336. X
  1337. X        XDrawImageString(XtDisplay(wp->w), XtWindow(wp->w),
  1338. X            inverted ? map_info->inv_color_gcs[color] :
  1339. X                   map_info->color_gcs[color],
  1340. X            map_info->char_lbearing + (map_info->char_width * cur_col),
  1341. X            win_ystart,
  1342. X            t_ptr, count);
  1343. X
  1344. X        /* move text pointer and column count */
  1345. X        t_ptr += count;
  1346. X        cur_col += count;
  1347. X        } /* col loop */
  1348. X    } /* row loop */
  1349. X    } else
  1350. X#endif /* TEXTCOLOR */
  1351. X    {
  1352. X    int win_row, win_xstart;
  1353. X
  1354. X    /* We always start at the same x window position and have    */
  1355. X    /* the same character count.                    */
  1356. X    win_xstart = map_info->char_lbearing +
  1357. X                    (win_start_col * map_info->char_width);
  1358. X    count = stop_col - start_col + 1;
  1359. X
  1360. X    for (row = start_row, win_row = win_start_row;
  1361. X                    row <= stop_row; row++, win_row++) {
  1362. X
  1363. X        XDrawImageString(XtDisplay(wp->w), XtWindow(wp->w),
  1364. X        inverted ? map_info->inv_copy_gc : map_info->copy_gc,
  1365. X        win_xstart,
  1366. X        map_info->char_ascent + (win_row * map_info->char_height),
  1367. X        (char *) &(map_info->text[row][start_col]), count);
  1368. X    }
  1369. X    }
  1370. X}
  1371. X
  1372. X/* Adjust the number of rows and columns on the given map window */
  1373. Xvoid
  1374. Xset_map_size(wp, cols, rows)
  1375. X    struct xwindow *wp;
  1376. X    Dimension cols, rows;
  1377. X{
  1378. X    Arg args[4];
  1379. X    Cardinal num_args;
  1380. X
  1381. X    wp->pixel_width  = wp->map_information->char_width  * cols;
  1382. X    wp->pixel_height = wp->map_information->char_height * rows;
  1383. X
  1384. X    num_args = 0;
  1385. X    XtSetArg(args[num_args], XtNwidth, wp->pixel_width);   num_args++;
  1386. X    XtSetArg(args[num_args], XtNheight, wp->pixel_height); num_args++;
  1387. X    XtSetValues(wp->w, args, num_args);
  1388. X}
  1389. X
  1390. X/*
  1391. X * The map window creation routine.
  1392. X */
  1393. Xvoid
  1394. Xcreate_map_window(wp, create_popup, parent)
  1395. X    struct xwindow *wp;
  1396. X    boolean create_popup;    /* parent is a popup shell that we create */
  1397. X    Widget parent;
  1398. X{
  1399. X    struct map_info_t *map_info;    /* map info pointer */
  1400. X    Widget map, viewport;
  1401. X    Arg args[10];
  1402. X    Cardinal num_args;
  1403. X    Dimension rows, columns;
  1404. X
  1405. X    wp->type = NHW_MAP;
  1406. X
  1407. X    map_info = wp->map_information =
  1408. X            (struct map_info_t *) alloc(sizeof(struct map_info_t));
  1409. X
  1410. X    map_info->viewport_width = map_info->viewport_height = 0;
  1411. X    (void) memset((genericptr_t) map_info->text, ' ', sizeof(map_info->text));
  1412. X    (void) memset((genericptr_t) map_info->t_start, (char) COLNO,
  1413. X            sizeof(map_info->t_start));
  1414. X    (void) memset((genericptr_t) map_info->t_stop, (char) 0,
  1415. X            sizeof(map_info->t_stop));
  1416. X#ifdef TEXTCOLOR
  1417. X    (void) memset((genericptr_t) map_info->colors, NO_COLOR,
  1418. X            sizeof(map_info->colors));
  1419. X#endif
  1420. X
  1421. X    if (create_popup) {
  1422. X    /*
  1423. X     * Create a popup that accepts key and button events.
  1424. X     */
  1425. X    num_args = 0;
  1426. X    XtSetArg(args[num_args], XtNinput, False);            num_args++;
  1427. X
  1428. X    wp->popup = parent = XtCreatePopupShell("nethack",
  1429. X                    topLevelShellWidgetClass,
  1430. X                       toplevel, args, num_args);
  1431. X    }
  1432. X
  1433. X    num_args = 0;
  1434. X    XtSetArg(args[num_args], XtNallowHoriz, True);    num_args++;
  1435. X    XtSetArg(args[num_args], XtNallowVert,  True);    num_args++;
  1436. X    /* XtSetArg(args[num_args], XtNforceBars,  True);    num_args++; */
  1437. X    XtSetArg(args[num_args], XtNuseBottom,  True);    num_args++;
  1438. X    viewport = XtCreateManagedWidget(
  1439. X            "map_viewport",        /* name */
  1440. X            viewportWidgetClass,    /* widget class from Window.h */
  1441. X            parent,            /* parent widget */
  1442. X            args,            /* set some values */
  1443. X            num_args);        /* number of values to set */
  1444. X
  1445. X    /*
  1446. X     * Create a map window.  We need to set the width and height to some
  1447. X     * value when we create it.  We will change it to the value we want
  1448. X     * later
  1449. X     */
  1450. X    num_args = 0;
  1451. X    XtSetArg(args[num_args], XtNwidth,  100); num_args++;
  1452. X    XtSetArg(args[num_args], XtNheight, 100); num_args++;
  1453. X
  1454. X    wp->w = map = XtCreateManagedWidget(
  1455. X        "map",            /* name */
  1456. X        windowWidgetClass,    /* widget class from Window.h */
  1457. X        viewport,        /* parent widget */
  1458. X        args,            /* set some values */
  1459. X        num_args);        /* number of values to set */
  1460. X
  1461. X    XtAddCallback(map, XtNcallback,      map_input,      (XtPointer) 0);
  1462. X    XtAddCallback(map, XtNexposeCallback, map_exposed, (XtPointer) 0);
  1463. X
  1464. X    get_char_info(wp);
  1465. X    get_gc(wp, WindowFont(map));
  1466. X
  1467. X    /*
  1468. X     * Initially, set the map widget to be the size specified by the
  1469. X     * widget rows and columns resources.  We need to do this to
  1470. X     * correctly set the viewport window size.  After the viewport is
  1471. X     * realized, then the map can resize to its normal size.
  1472. X     */
  1473. X    num_args = 0;
  1474. X    XtSetArg(args[num_args], XtNrows,    &rows);    num_args++;
  1475. X    XtSetArg(args[num_args], XtNcolumns, &columns);    num_args++;
  1476. X    XtGetValues(wp->w, args, num_args);
  1477. X
  1478. X    /* Don't bother with windows larger than ROWNOxCOLNO. */
  1479. X    if (columns > COLNO) columns = COLNO;
  1480. X    if (rows    > ROWNO) rows = ROWNO;
  1481. X
  1482. X    set_map_size(wp, columns, rows);
  1483. X
  1484. X    /*
  1485. X     * If we have created our own popup, then realize it so that the
  1486. X     * viewport is also realized.  Then resize the map window.
  1487. X     */
  1488. X    if (create_popup) {
  1489. X    XtRealizeWidget(wp->popup);
  1490. X    set_map_size(wp, COLNO, ROWNO);
  1491. X    }
  1492. X}
  1493. X
  1494. X/*
  1495. X * Destroy this map window.
  1496. X */
  1497. Xvoid
  1498. Xdestroy_map_window(wp)
  1499. X    struct xwindow *wp;
  1500. X{
  1501. X    struct map_info_t *map_info = wp->map_information;
  1502. X#ifdef TEXTCOLOR
  1503. X    int i;
  1504. X#endif
  1505. X
  1506. X    if (wp->popup) {
  1507. X    nh_XtPopdown(wp->popup);
  1508. X
  1509. X    /* Free allocated GCs. */
  1510. X#ifdef TEXTCOLOR
  1511. X    for (i = 0; i < MAXCOLORS; i++) {
  1512. X        XtReleaseGC(wp->w, map_info->color_gcs[i]);
  1513. X        XtReleaseGC(wp->w, map_info->inv_color_gcs[i]);
  1514. X    }
  1515. X#else
  1516. X    XtReleaseGC(wp->w, map_info->copy_gc);
  1517. X    XtReleaseGC(wp->w, map_info->inv_copy_gc);
  1518. X#endif
  1519. X
  1520. X    /* Free malloc'ed space. */
  1521. X    free((char *) map_info);
  1522. X
  1523. X    /* Destroy map widget. */
  1524. X    XtDestroyWidget(wp->popup);
  1525. X    }
  1526. X
  1527. X    wp->type = NHW_NONE;    /* allow re-use */
  1528. X}
  1529. X
  1530. X
  1531. X
  1532. Xboolean exit_x_event;    /* exit condition for the event loop */
  1533. X/*******
  1534. Xpkey(k)
  1535. X    int k;
  1536. X{
  1537. X    printf("key = '%s%c'\n", (k<32) ? "^":"", (k<32) ? '@'+k : k);
  1538. X}
  1539. X******/
  1540. X
  1541. X/*
  1542. X * Main X event loop.  Here we accept and dispatch X events.  We only exit
  1543. X * under certain circumstances.
  1544. X */
  1545. Xint
  1546. Xx_event(exit_condition)
  1547. X    int exit_condition;
  1548. X{
  1549. X    XEvent  event;
  1550. X    int     retval;
  1551. X    boolean keep_going = TRUE;
  1552. X
  1553. X#ifdef GCC_WARN
  1554. X    retval = 0;
  1555. X#endif
  1556. X
  1557. X    click_button = NO_CLICK;    /* reset click exit condition */
  1558. X    exit_x_event = FALSE;    /* reset callback exit condition */
  1559. X
  1560. X    /*
  1561. X     * Loop until we get a sent event, callback exit, or are accepting key
  1562. X     * press and button press events and we receive one.
  1563. X     */
  1564. X    if((exit_condition == EXIT_ON_KEY_PRESS ||
  1565. X    exit_condition == EXIT_ON_KEY_OR_BUTTON_PRESS) && incount)
  1566. X    goto try_test;
  1567. X
  1568. X    do {
  1569. X    XtAppNextEvent(app_context, &event);
  1570. X    XtDispatchEvent(&event);
  1571. X
  1572. X    /* See if we can exit. */
  1573. X    try_test:
  1574. X    switch (exit_condition) {
  1575. X        case EXIT_ON_SENT_EVENT: {
  1576. X        XAnyEvent *any = (XAnyEvent *) &event;
  1577. X        if (any->send_event) {
  1578. X            retval = 0;
  1579. X            keep_going = FALSE;
  1580. X        }
  1581. X        break;
  1582. X        }
  1583. X        case EXIT_ON_EXIT:
  1584. X        if (exit_x_event) {
  1585. X            incount = 0;
  1586. X            retval = 0;
  1587. X            keep_going = FALSE;
  1588. X        }
  1589. X        break;
  1590. X        case EXIT_ON_KEY_PRESS:
  1591. X        if (incount != 0) {
  1592. X            /* get first pressed key */
  1593. X            --incount;
  1594. X            retval = inbuf[inptr];
  1595. X            inptr = (inptr+1) % INBUF_SIZE;
  1596. X            /* pkey(retval); */
  1597. X            keep_going = FALSE;
  1598. X        }
  1599. X        break;
  1600. X        case EXIT_ON_KEY_OR_BUTTON_PRESS:
  1601. X        if (incount != 0 || click_button != NO_CLICK) {
  1602. X            if (click_button != NO_CLICK) {    /* button press */
  1603. X            /* click values are already set */
  1604. X            retval = 0;
  1605. X            } else {                /* key press */
  1606. X            /* get first pressed key */
  1607. X            --incount;
  1608. X            retval = inbuf[inptr];
  1609. X            inptr = (inptr+1) % INBUF_SIZE;
  1610. X            /* pkey(retval); */
  1611. X            }
  1612. X            keep_going = FALSE;
  1613. X        }
  1614. X        break;
  1615. X        default:
  1616. X        panic("x_event: unknown exit condition %d\n", exit_condition);
  1617. X        break;
  1618. X    }
  1619. X    } while (keep_going);
  1620. X
  1621. X    return retval;
  1622. X}
  1623. X
  1624. X/*winmap.c*/
  1625. END_OF_FILE
  1626. if test 28534 -ne `wc -c <'win/X11/winmap.c'`; then
  1627.     echo shar: \"'win/X11/winmap.c'\" unpacked with wrong size!
  1628. fi
  1629. # end of 'win/X11/winmap.c'
  1630. fi
  1631. echo shar: End of archive 75 \(of 108\).
  1632. cp /dev/null ark75isdone
  1633. MISSING=""
  1634. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1635. 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
  1636. 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
  1637. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
  1638. 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 \
  1639. 101 102 103 104 105 106 107 108 ; do
  1640.     if test ! -f ark${I}isdone ; then
  1641.     MISSING="${MISSING} ${I}"
  1642.     fi
  1643. done
  1644. if test "${MISSING}" = "" ; then
  1645.     echo You have unpacked all 108 archives.
  1646.     echo "Now execute 'rebuild.sh'"
  1647.     rm -f ark10[0-8]isdone ark[1-9]isdone ark[1-9][0-9]isdone
  1648. else
  1649.     echo You still need to unpack the following archives:
  1650.     echo "        " ${MISSING}
  1651. fi
  1652. ##  End of shell archive.
  1653. exit 0
  1654.