home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume16 / nethck31 / part103 < prev    next >
Encoding:
Internet Message Format  |  1993-02-05  |  59.1 KB

  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: v16i111:  nethack31 - display oriented dungeons & dragons (Ver. 3.1), Part103/108
  5. Message-ID: <4476@master.CNA.TEK.COM>
  6. Date: 5 Feb 93 22:03:49 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1692
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1662
  11.  
  12. Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
  13. Posting-number: Volume 16, Issue 111
  14. Archive-name: nethack31/Part103
  15. Supersedes: nethack3p9: Volume 10, Issue 46-108
  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 103 (of 108)."
  27. # Contents:  dat/hh dat/history dat/license include/monst.h
  28. #   include/obj.h src/write.c sys/atari/setup.g sys/mac/Install.mpw
  29. #   sys/mac/macerrs.c sys/share/NetHack.cnf sys/unix/Makefile.top
  30. #   win/tty/getline.c
  31. # Wrapped by billr@saab on Wed Jan 27 16:09:31 1993
  32. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  33. if test -f 'dat/hh' -a "${1}" != "-c" ; then 
  34.   echo shar: Will not clobber existing file \"'dat/hh'\"
  35. else
  36. echo shar: Extracting \"'dat/hh'\" \(4490 characters\)
  37. sed "s/^X//" >'dat/hh' <<'END_OF_FILE'
  38. Xy k u   7 8 9   Move commands:
  39. X \|/     \|/            yuhjklbn: go one step in specified direction
  40. Xh-.-l   4-.-6           YUHJKLBN: go in specified direction until you
  41. X /|\     /|\                        hit a wall or run into something
  42. Xb j n   1 2 3           g<dir>:   run in direction <dir> until something
  43. X      numberpad                     interesting is seen
  44. X                        G<dir>,   same, except a branching corridor isn't
  45. X                        ^<dir>:     considered interesting
  46. X                        m<dir>:   move without picking up objects
  47. X                If the number_pad option is set, the number keys move instead.
  48. X
  49. XGeneral commands:
  50. X?       help    display one of several informative texts
  51. XQ       quit    end the game
  52. XS       save    save the game (to be continued later)
  53. X!       sh      escape to some SHELL (if allowed)
  54. X^Z      suspend suspend the game (independent of your current suspend char)
  55. XO       options set options
  56. X/       whatis  tell what a map symbol represents
  57. X\       known   display list of what's been discovered
  58. Xv       version display version number
  59. XV       history display game history
  60. XX       explore switch the game to explore (discovery) mode
  61. X^A      again   redo the previous command (^A denotes the keystroke CTRL-A)
  62. X^R      redraw  redraw the screen
  63. X^P      prevmsg repeat previous message (subsequent ^P's repeat earlier ones)
  64. X#               introduces an extended command (#? for a list of them)
  65. X
  66. XGame commands:
  67. X^D      kick    kick (a door, or something else)
  68. X^T      'port   teleport (if you can)
  69. Xa       apply   apply or use a tool (pick-axe, key, camera, etc.)
  70. XA       armor   take off all armor
  71. Xc       close   close a door
  72. XC       call    name an individual monster (ex. baptize your dog)
  73. Xd       drop    drop an object.  d7a:  drop seven items of object 'a'
  74. XD       Drop    drop selected types of objects
  75. Xe       eat     eat something
  76. XE       engrave write a message in the dust on the floor  (E-  use fingers)
  77. Xi       invent  list your inventory (all objects you are carrying)
  78. XI       Invent  list selected parts of your inventory
  79. X                Iu: list unpaid objects
  80. X                Ix: list unpaid but used up items
  81. X                I$: count your money
  82. Xo       open    open a door
  83. Xp       pay     pay your bill (in a shop)
  84. XP       puton   put on an accessory (ring, amulet, etc)
  85. Xq       quaff   drink a potion
  86. Xr       read    read a scroll or spell book
  87. XR       remove  remove an accessory (ring, amulet, etc)
  88. Xs       search  search for secret doors, hidden traps and monsters
  89. Xt       throw   throw or shoot a weapon
  90. XT       takeoff take off some armor
  91. Xw       wield   wield a weapon  (w-  wield nothing)
  92. XW       wear    put on some armor
  93. Xx       spells  list the spells you know
  94. Xz       zap     zap a wand
  95. XZ       Zap     cast a spell
  96. X<       up      go up the stairs
  97. X>       down    go down the stairs
  98. X^       trap_id identify a previously found trap
  99. X),[,=,",(               ask for current items of specified symbol in use
  100. X$       gold    count your gold
  101. X+       spells  list the spells you know
  102. X.       rest    wait a moment
  103. X,       pickup  pick up all you can carry
  104. X@               toggle "pickup" (auto pickup) option on and off
  105. X:       look    look at what is here
  106. X;       farlook look at what is somewhere else by selecting a map symbol
  107. X
  108. XKeyboards that have a meta key can also use these extended commands:
  109. X
  110. XM-a     adjust  adjust inventory letters
  111. XM-c     chat    talk to someone
  112. XM-d     dip     dip an object into something
  113. XM-f     force   force a lock
  114. XM-i     invoke  invoke an object's special powers
  115. XM-j     jump    jump to another location
  116. XM-l     loot    loot a box on the floor
  117. XM-m     monster use a monster's special ability (only if defined)
  118. XM-n     name    name an item or type of object
  119. XM-o     offer   offer a sacrifice to the gods
  120. XM-p     pray    pray to the gods for help
  121. XM-r     rub     rub a lamp
  122. XM-s     sit     sit down
  123. XM-t     turn    turn undead
  124. XM-u     untrap  untrap something (usually a trapped object)
  125. XM-v     version print compile time options for this version
  126. XM-w     wipe    wipe off your face
  127. X
  128. XIf the "number_pad" option is on, these additional commands are available:
  129. X
  130. Xn               followed by number of times to repeat the next command
  131. Xj       jump    jump to another location
  132. Xk       kick    kick something (usually a door)
  133. Xl       loot    loot a box on the floor
  134. XN       name    name an item or type of object
  135. Xu       untrap  untrap something (usually a trapped object)
  136. END_OF_FILE
  137. if test 4490 -ne `wc -c <'dat/hh'`; then
  138.     echo shar: \"'dat/hh'\" unpacked with wrong size!
  139. fi
  140. # end of 'dat/hh'
  141. fi
  142. if test -f 'dat/history' -a "${1}" != "-c" ; then 
  143.   echo shar: Will not clobber existing file \"'dat/history'\"
  144. else
  145. echo shar: Extracting \"'dat/history'\" \(4962 characters\)
  146. sed "s/^X//" >'dat/history' <<'END_OF_FILE'
  147. X
  148. XBehold, mortal, the origins of NetHack...
  149. X
  150. XJay Fenlason wrote the original Hack with help from Kenny Woodland,
  151. XMike Thome, and Jon Payne.
  152. X
  153. XAndries Brouwer did a major re-write, transforming Hack into a very different
  154. Xgame, and published (at least) three versions (1.0.1, 1.0.2, and 1.0.3) for
  155. XUNIX(tm) machines to the Usenet.
  156. X
  157. XDon G. Kneller ported Hack 1.0.3 to Microsoft(tm) C and MS-DOS(tm), producing
  158. XPC HACK 1.01e, added support for DEC Rainbow graphics in version 1.03g, and
  159. Xwent on to produce at least four more versions (3.0, 3.2, 3.51, and 3.6).
  160. X
  161. XR. Black ported PC HACK 3.51 to Lattice(tm) C and the Atari 520/1040ST,
  162. Xproducing ST Hack 1.03.
  163. X
  164. XMike Stephenson merged these various versions back together, incorporating
  165. Xmany of the added features, and produced NetHack version 1.4.  He then
  166. Xcoordinated a cast of thousands in enhancing and debugging NetHack 1.4 and
  167. Xreleased NetHack versions 2.2 and 2.3.
  168. XLater, Mike coordinated a major rewrite of the game, heading a team which
  169. Xincluded Ken Arromdee, Jean-Christophe Collet, Steve Creps, Eric Hendrickson,
  170. XIzchak Miller, Eric S. Raymond, John Rupley, Mike Threepoint, and Janet Walz,
  171. Xto produce NetHack 3.0c.  The same group subsequently released ten patch-
  172. Xlevel revisions and updates of 3.0.
  173. X
  174. XNetHack 3.0 was ported to the Atari by Eric R. Smith, to OS/2 by Timo
  175. XHakulinen, and to VMS by David Gentzel.  The three of them and Kevin Darcy
  176. Xlater joined the main development team to produce subsequent revisions of
  177. X3.0.
  178. X
  179. XOlaf Seibert ported NetHack 2.3 and 3.0 to the Amiga.  Norm Meluch, Stephen
  180. XSpackman and Pierre Martineau designed overlay code for PC NetHack 3.0.
  181. XJohnny Lee ported NetHack 3.0 to the Macintosh.  Along with various other
  182. XDungeoneers, they continued to enhance the PC, Macintosh, and Amiga ports
  183. Xthrough the later revisions of 3.0.
  184. XHeaded by Mike Stephenson and coordinated by Izchak Miller and Janet Walz,
  185. Xthe development team which now included Ken Arromdee, David Cohrs,
  186. XJean-Christophe Collet, Kevin Darcy, Matt Day, Timo Hakulinen, Steve Linhart,
  187. XDean Luick, Pat Rankin, Eric Raymond, and Eric Smith undertook a radical
  188. Xrevision of 3.0.  They re-structured the game's design, and re-wrote major
  189. Xparts of the code.  They added multiple dungeons, a new display, special
  190. Xindividual character quests, a new endgame and many other new features, and
  191. Xproduced NetHack 3.1.
  192. X
  193. XKen Lorber, Gregg Wonderly and Greg Olson, with help from Richard Addison,
  194. XMike Passaretti, and Olaf Seibert, developed NetHack 3.1 for the Amiga.
  195. X
  196. XNorm Meluch and Kevin Smolkowski, with help from Carl Schelin, Stephen
  197. XSpackman, Steve VanDevender, and Paul Winner, ported NetHack 3.1 to the PC.
  198. X
  199. XJon W{tte, with help from Ross Brown, Mike Engber, David Hairston, Michael
  200. XHamel, Jonathan Handler, Johnny Lee, Tim Lennan, Rob Menke, Andy Swanson, and
  201. Xespecially from Hao-yang Wang, developed NetHack 3.1 for the Macintosh.
  202. X
  203. XTimo Hakulinen ported NetHack 3.1 to OS/2.  Eric Smith ported NetHack 3.1
  204. Xto the Atari.  Pat Rankin, with help from Joshua Delahunty, is responsible
  205. Xfor the VMS version of NetHack 3.1.
  206. X
  207. XDean Luick, with help from David Cohrs, developed NetHack 3.1 for X11.
  208. X
  209. X                           - - - - - - - - - -
  210. XFrom time to time, some depraved individual out there in netland sends a
  211. Xparticularly intriguing modification to help out with the game.  The Gods of
  212. Xthe Dungeon sometimes make note of the names of the worst of these miscreants
  213. Xin this, the list of Dungeoneers:
  214. X
  215. X    Richard Addison           Eric Hendrickson       Mike Passaretti
  216. X    Tom Almy                  Bruce Holloway         Pat Rankin
  217. X    Ken Arromdee              Richard P. Hughey      Eric S. Raymond
  218. X    Eric Backus               Ari Huttunen           Frederick Roeber
  219. X    John S. Bien              John Kallen            John Rupley
  220. X    Ralf Brown                Del Lamb               Carl Schelin
  221. X    Ross Brown                Greg Laskin            Olaf Seibert
  222. X    David Cohrs               Johnny Lee             Kevin Sitze
  223. X    Jean-Christophe Collet    Tim Lennan             Eric R. Smith
  224. X    Steve Creps               Merlyn LeRoy           Kevin Smolkowski
  225. X    Kevin Darcy               Steve Linhart          Michael Sokolov
  226. X    Matthew Day               Ken Lorber             Stephen Spackman
  227. X    Joshua Delahunty          Dean Luick             Andy Swanson
  228. X    Bill Dyer                 Benson I. Margulies    Kevin Sweet
  229. X    Mike Engber               Pierre Martineau       Scott R. Turner
  230. X    Jochen Erwied             Roland McGrath         Steve VanDevender
  231. X    Mike Gallop               Norm Meluch            Janet Walz   
  232. X    David Gentzel             Rob Menke              Hao-yang Wang
  233. X    Mark Gooderum             Deron Meranda          Jon W{tte
  234. X    David Hairston            Bruce Mewborne         Tom West
  235. X    Timo Hakulinen            Izchak Miller          Paul Winner
  236. X    Michael Hamel             Gil Neiger             Gregg Wonderly
  237. X    Jonathan Handler          Greg Olson
  238. END_OF_FILE
  239. if test 4962 -ne `wc -c <'dat/history'`; then
  240.     echo shar: \"'dat/history'\" unpacked with wrong size!
  241. fi
  242. # end of 'dat/history'
  243. fi
  244. if test -f 'dat/license' -a "${1}" != "-c" ; then 
  245.   echo shar: Will not clobber existing file \"'dat/license'\"
  246. else
  247. echo shar: Extracting \"'dat/license'\" \(4975 characters\)
  248. sed "s/^X//" >'dat/license' <<'END_OF_FILE'
  249. X                    NETHACK GENERAL PUBLIC LICENSE
  250. X                    (Copyright 1989 M. Stephenson)
  251. X
  252. X               (Based on the BISON general public license,
  253. X                   copyright 1988 Richard M. Stallman)
  254. X
  255. X Everyone is permitted to copy and distribute verbatim copies of this
  256. X license, but changing it is not allowed.  You can also use this wording to
  257. X make the terms for other programs.
  258. X
  259. X  The license agreements of most software companies keep you at the mercy of
  260. Xthose companies.  By contrast, our general public license is intended to give
  261. Xeveryone the right to share NetHack.  To make sure that you get the rights we
  262. Xwant you to have, we need to make restrictions that forbid anyone to deny you
  263. Xthese rights or to ask you to surrender the rights.  Hence this license
  264. Xagreement.
  265. X
  266. X  Specifically, we want to make sure that you have the right to give away
  267. Xcopies of NetHack, that you receive source code or else can get it if you
  268. Xwant it, that you can change NetHack or use pieces of it in new free
  269. Xprograms, and that you know you can do these things.
  270. X
  271. X  To make sure that everyone has such rights, we have to forbid you to
  272. Xdeprive anyone else of these rights.  For example, if you distribute copies
  273. Xof NetHack, you must give the recipients all the rights that you have.  You
  274. Xmust make sure that they, too, receive or can get the source code.  And you
  275. Xmust tell them their rights.
  276. X
  277. X  Also, for our own protection, we must make certain that everyone finds out
  278. Xthat there is no warranty for NetHack.  If NetHack is modified by someone
  279. Xelse and passed on, we want its recipients to know that what they have is
  280. Xnot what we distributed.
  281. X
  282. X  Therefore we (Mike Stephenson and other holders of NetHack copyrights) make
  283. Xthe following terms which say what you must do to be allowed to distribute or
  284. Xchange NetHack.
  285. X
  286. X
  287. X                        COPYING POLICIES
  288. X
  289. X  1. You may copy and distribute verbatim copies of NetHack source code as
  290. Xyou receive it, in any medium, provided that you keep intact the notices on
  291. Xall files that refer to copyrights, to this License Agreement, and to the
  292. Xabsence of any warranty; and give any other recipients of the NetHack
  293. Xprogram a copy of this License Agreement along with the program.
  294. X
  295. X  2. You may modify your copy or copies of NetHack or any portion of it, and
  296. Xcopy and distribute such modifications under the terms of Paragraph 1 above
  297. X(including distributing this License Agreement), provided that you also do the
  298. Xfollowing:
  299. X
  300. X    a) cause the modified files to carry prominent notices stating that you
  301. X    changed the files and the date of any change; and
  302. X
  303. X    b) cause the whole of any work that you distribute or publish, that in
  304. X    whole or in part contains or is a derivative of NetHack or any part
  305. X    thereof, to be licensed at no charge to all third parties on terms
  306. X    identical to those contained in this License Agreement (except that you
  307. X    may choose to grant more extensive warranty protection to some or all
  308. X    third parties, at your option)
  309. X
  310. X    c) You may charge a distribution fee for the physical act of
  311. X    transferring a copy, and you may at your option offer warranty protection
  312. X    in exchange for a fee.
  313. X
  314. X  3. You may copy and distribute NetHack (or a portion or derivative of it,
  315. Xunder Paragraph 2) in object code or executable form under the terms of
  316. XParagraphs 1 and 2 above provided that you also do one of the following:
  317. X
  318. X    a) accompany it with the complete machine-readable source code, which
  319. X    must be distributed under the terms of Paragraphs 1 and 2 above; or,
  320. X
  321. X    b) accompany it with full information as to how to obtain the complete
  322. X    machine-readable source code from an appropriate archive site.  (This
  323. X    alternative is allowed only for noncommercial distribution.)
  324. X
  325. XFor these purposes, complete source code means either the full source
  326. Xdistribution as originally released over Usenet or updated copies of the
  327. Xfiles in this distribution used to create the object code or executable.
  328. X
  329. X  4. You may not copy, sublicense, distribute or transfer NetHack except as
  330. Xexpressly provided under this License Agreement.  Any attempt otherwise to
  331. Xcopy, sublicense, distribute or transfer NetHack is void and your rights to
  332. Xuse the program under this License agreement shall be automatically
  333. Xterminated.  However, parties who have received computer software programs
  334. Xfrom you with this License Agreement will not have their licenses terminated
  335. Xso long as such parties remain in full compliance.
  336. X
  337. X
  338. XStated plainly:  You are prohibited by the terms of this License Agreement
  339. Xfrom using NetHack for gainful purposes.  You are permitted to modify
  340. XNetHack, or otherwise use parts of NetHack, provided that you comply with
  341. Xthe conditions specified above; in particular, your modified NetHack or
  342. Xprogram containing parts of NetHack must remain freely available as provided
  343. Xin this License Agreement.  In other words, go ahead and share NetHack, but
  344. Xdon't try to stop anyone else from sharing it farther.
  345. END_OF_FILE
  346. if test 4975 -ne `wc -c <'dat/license'`; then
  347.     echo shar: \"'dat/license'\" unpacked with wrong size!
  348. fi
  349. # end of 'dat/license'
  350. fi
  351. if test -f 'include/monst.h' -a "${1}" != "-c" ; then 
  352.   echo shar: Will not clobber existing file \"'include/monst.h'\"
  353. else
  354. echo shar: Extracting \"'include/monst.h'\" \(4837 characters\)
  355. sed "s/^X//" >'include/monst.h' <<'END_OF_FILE'
  356. X/*    SCCS Id: @(#)monst.h    3.1    92/10/18    */
  357. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  358. X/* NetHack may be freely redistributed.  See license for details. */
  359. X
  360. X#ifndef MONST_H
  361. X#define MONST_H
  362. X
  363. X#ifdef MUSE
  364. X/* The weapon_check flag is used two ways:
  365. X * 1) When calling mon_wield_item, is 2 or 3 depending on what is desired.
  366. X * 2) Between calls to mon_wield_item, is 0 or 1 depending on whether or not
  367. X *    the weapon is known by the monster to be cursed (so it shouldn't bother
  368. X *    trying for another weapon).
  369. X * I originally planned to also use 0 if the monster already had its best
  370. X * weapon, to avoid the overhead of a call to mon_wield_item, but it turns out
  371. X * that there are enough situations which might make a monster change its
  372. X * weapon that this is impractical.
  373. X */
  374. X#define NO_WEAPON_WANTED 0
  375. X#define NEED_WEAPON 1
  376. X#define NEED_RANGED_WEAPON 2
  377. X#define NEED_HTH_WEAPON 3
  378. X#define NEED_PICK_AXE 4
  379. X#endif
  380. X
  381. X#ifndef ALIGN_H
  382. X#include "align.h"
  383. X#endif
  384. X
  385. Xstruct monst {
  386. X    struct monst *nmon;
  387. X    struct permonst *data;
  388. X    unsigned m_id;
  389. X    short mnum;        /* permanent monster index number */
  390. X    uchar m_lev;        /* adjusted difficulty level of monster */
  391. X    aligntyp malign;    /* alignment of this monster, relative to the
  392. X                   player (positive = good to kill) */
  393. X    xchar mx, my;
  394. X    xchar mux, muy;        /* where the monster thinks you are */
  395. X#define MTSZ    4
  396. X    coord mtrack[MTSZ];    /* monster track */
  397. X    int mhp, mhpmax;
  398. X    unsigned mappearance;    /* for undetected mimics and the wiz */
  399. X    uchar     m_ap_type;    /* what mappearance is describing: */
  400. X#define M_AP_NOTHING    0    /* mappearance is unused -- monster appears
  401. X                   as itself */
  402. X#define M_AP_FURNITURE    1    /* stairs, a door, an altar, etc. */
  403. X#define M_AP_OBJECT    2    /* an object */
  404. X#define M_AP_MONSTER    3    /* a monster */
  405. X
  406. X    schar mtame;        /* level of tameness, implies peaceful */
  407. X    int mspec_used;        /* monster's special ability attack timeout */
  408. X
  409. X    Bitfield(female,1);    /* is female */
  410. X    Bitfield(minvis,1);    /* invisible */
  411. X    Bitfield(cham,1);    /* shape-changer */
  412. X    Bitfield(mundetected,1);    /* not seen in present hiding place */
  413. X                /* implies one of M1_CONCEAL or M1_HIDE,
  414. X                 * but not mimic (that is, snake, spider,
  415. X                 * trapper, piercer)
  416. X                 */
  417. X    Bitfield(mcan,1);    /* has been cancelled */
  418. X    Bitfield(mspeed,2);
  419. X    /* free bit! */
  420. X
  421. X    Bitfield(mflee,1);    /* fleeing */
  422. X    Bitfield(mfleetim,7);    /* timeout for mflee */
  423. X
  424. X    Bitfield(mcansee,1);    /* cansee 1, temp.blinded 0, blind 0 */
  425. X    Bitfield(mblinded,7);    /* cansee 0, temp.blinded n, blind 0 */
  426. X
  427. X    Bitfield(mcanmove,1);    /* paralysis, similar to mblinded */
  428. X    Bitfield(mfrozen,7);
  429. X
  430. X    Bitfield(msleep,1);    /* sleeping */
  431. X    Bitfield(mstun,1);    /* stunned (off balance) */
  432. X    Bitfield(mconf,1);    /* confused */
  433. X    Bitfield(mpeaceful,1);    /* does not attack unprovoked */
  434. X    Bitfield(mtrapped,1);    /* trapped in a pit or bear trap */
  435. X    Bitfield(mleashed,1);    /* monster is on a leash */
  436. X    Bitfield(isshk,1);    /* is shopkeeper */
  437. X    Bitfield(isminion,1);    /* is a minion */
  438. X
  439. X    Bitfield(isgd,1);    /* is guard */
  440. X    Bitfield(ispriest,1);    /* is a priest */
  441. X    Bitfield(iswiz,1);    /* is the Wizard of Yendor */
  442. X    Bitfield(wormno,5);    /* at most 31 worms on any level */
  443. X#define MAX_NUM_WORMS    32    /* should be 2^(wormno bitfield size) */
  444. X
  445. X    long mstrategy;        /* for monsters with mflag3: current strategy */
  446. X    long mtrapseen;        /* bitmap of traps we've been trapped in */
  447. X    long mlstmv;        /* prevent two moves at once */
  448. X    long mgold;
  449. X    struct obj *minvent;
  450. X#ifdef MUSE
  451. X    struct obj *mw;
  452. X    long misc_worn_check;
  453. X    xchar weapon_check;
  454. X#endif
  455. X    uchar mnamelth;        /* length of name (following mxlth) */
  456. X    short mxlth;        /* length of following data */
  457. X    /* in order to prevent alignment problems mextra should
  458. X       be (or follow) a long int */
  459. X    int meating;        /* monster is eating timeout */
  460. X    long mextra[1];    /* monster dependent info */
  461. X};
  462. X
  463. X/*
  464. X * Note that mextra[] may correspond to any of a number of structures, which
  465. X * are indicated by some of the other fields.
  466. X *    isgd     ->    struct egd
  467. X *    ispriest ->    struct epri
  468. X *    isshk     ->    struct eshk
  469. X *    isminion ->    struct emin
  470. X *            (struct epri for roaming priests and angels, which is
  471. X *             compatible with emin for polymorph purposes)
  472. X *    mtame     ->    struct edog
  473. X *            (struct epri for guardian angels, which do not eat
  474. X *             or do other doggy things)
  475. X * Since at most one structure can be indicated in this manner, it is not
  476. X * possible to tame any creatures using the other structures (the only
  477. X * exception being the guardian angels which are tame on creation).
  478. X */
  479. X
  480. X#define newmonst(xl) (struct monst *)alloc((unsigned)(xl) + sizeof(struct monst))
  481. X#define dealloc_monst(mon) free((genericptr_t)(mon))
  482. X
  483. X/* these are in mspeed */
  484. X#define MSLOW 1        /* slow monster */
  485. X#define MFAST 2        /* speeded monster */
  486. X
  487. X#define NAME(mtmp)    (((char *)(mtmp)->mextra) + (mtmp)->mxlth)
  488. X
  489. X#define MON_WEP(mon)    ((mon)->mw)
  490. X#define MON_NOWEP(mon)    ((mon)->mw = (struct obj *)0)
  491. X
  492. X#endif /* MONST_H */
  493. END_OF_FILE
  494. if test 4837 -ne `wc -c <'include/monst.h'`; then
  495.     echo shar: \"'include/monst.h'\" unpacked with wrong size!
  496. fi
  497. # end of 'include/monst.h'
  498. fi
  499. if test -f 'include/obj.h' -a "${1}" != "-c" ; then 
  500.   echo shar: Will not clobber existing file \"'include/obj.h'\"
  501. else
  502. echo shar: Extracting \"'include/obj.h'\" \(4629 characters\)
  503. sed "s/^X//" >'include/obj.h' <<'END_OF_FILE'
  504. X/*    SCCS Id: @(#)obj.h    3.1    92/10/18    */
  505. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  506. X/* NetHack may be freely redistributed.  See license for details. */
  507. X
  508. X#ifndef OBJ_H
  509. X#define OBJ_H
  510. X
  511. X/* #define obj obj_nh    /* uncomment for SCO UNIX, which has a conflicting
  512. X             * typedef for "obj" in <sys/types.h> */
  513. X
  514. Xstruct obj {
  515. X    struct obj *nobj;
  516. X    struct obj *nexthere;    /* for location lists */
  517. X    struct obj *cobj;    /* contents list for containers */
  518. X/*    unsigned o_cwt;        /* container weight capacity */
  519. X    unsigned o_id;
  520. X    xchar ox,oy;
  521. X    short otyp;        /* object class number */
  522. X    unsigned owt;
  523. X    long quan;        /* number of items */
  524. X
  525. X    schar spe;        /* quality of weapon, armor or ring (+ or -)
  526. X                   number of charges for wand ( >= -1 )
  527. X                   marks your eggs, spinach tins
  528. X                   indicates statues have spellbooks inside
  529. X                   tells which fruit a fruit is
  530. X                   marks diluted potions
  531. X                   special for uball and amulet %% BAH */
  532. X    char    oclass;        /* object class */
  533. X    char    invlet;        /* designation in inventory */
  534. X    char    oartifact;    /* artifact array index */
  535. X
  536. X    Bitfield(cursed,1);
  537. X    Bitfield(blessed,1);
  538. X    Bitfield(unpaid,1);    /* on some bill */
  539. X    Bitfield(no_charge,1);    /* if shk shouldn't charge for this */
  540. X    Bitfield(known,1);    /* exact nature known */
  541. X    Bitfield(dknown,1);    /* color or text known */
  542. X    Bitfield(bknown,1);    /* blessing or curse known */
  543. X    Bitfield(rknown,1);    /* rustproof or not known */
  544. X
  545. X    Bitfield(oeroded,2);    /* rusted/corroded/burnt/rotted weapon/armor */
  546. X#define MAX_ERODE 3
  547. X#define orotten oeroded        /* rotten food */
  548. X    Bitfield(oerodeproof,1); /* erodeproof weapon/armor */
  549. X    Bitfield(olocked,1);    /* object is locked */
  550. X#define recharged olocked    /* recharged once */
  551. X    Bitfield(obroken,1);    /* lock has been broken */
  552. X    Bitfield(otrapped,1);    /* container is trapped */
  553. X#define opoisoned otrapped    /* object (weapon) is coated with poison */
  554. X    Bitfield(oldcorpse,1);    /* for troll corpses too old to revive */
  555. X#ifndef NO_SIGNAL
  556. X# define in_use oldcorpse    /* for magic items before useup items */
  557. X#endif
  558. X    Bitfield(lamplit,1);    /* a light-source -- can be lit */
  559. X
  560. X    Bitfield(oinvis,1);    /* not yet implemented */
  561. X    Bitfield(greased,1);    /* covered with grease */
  562. X    Bitfield(onamelth,6);
  563. X
  564. X    int    corpsenm;    /* type of corpse is mons[corpsenm] */
  565. X#define leashmon  corpsenm    /* gets m_id of attached pet */
  566. X#define spestudied corpsenm    /* how many times a spellbook has been studied */
  567. X    unsigned oeaten;    /* nutrition left in food, if partly eaten */
  568. X    long age;        /* creation date */
  569. X    long owornmask;
  570. X
  571. X/* note that TIMEOUT in you.h is defined as 07777L; no bits for items that
  572. X * confer properties may overlap that mask, or timeout.c will happily
  573. X * rearrange the bits behind the back of the property code
  574. X * shirts, balls, and chains are currently safe
  575. X * FROMOUTSIDE and FROMEXPER in you.h are defined as 020000000L and 0400000000L
  576. X * respectively.  Declarations here should not overlap with those bits either.
  577. X */
  578. X#define W_BALL    02000L
  579. X#define W_CHAIN    04000L
  580. X#define W_RINGL    010000L        /* make W_RINGL = RING_LEFT (see uprop) */
  581. X#define W_RINGR    020000L
  582. X#define W_RING    (W_RINGL | W_RINGR)
  583. X#define W_ARM    040000L
  584. X#define W_ARMC    0100000L
  585. X#define W_ARMH    0200000L
  586. X#define W_ARMS    0400000L
  587. X#define W_ARMG    01000000L
  588. X#define W_ARMF    02000000L
  589. X#define W_AMUL    04000000L
  590. X#define W_TOOL    010000000L    /* wearing another tool (see uprop) */
  591. X#define W_WEP    020000000L
  592. X#define W_ART    040000000L    /* _carrying_ an artifact, not really worn */
  593. X#define W_ARTI    0100000000L    /* an invoked artifact, not really worn */
  594. X#ifdef TOURIST
  595. X#define W_ARMU    01000L
  596. X#define W_ARMOR    (W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF | W_ARMU)
  597. X#else
  598. X#define W_ARMOR    (W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF)
  599. X#endif
  600. X    long oextra[1];        /* used for name of ordinary objects - length
  601. X                   is flexible; amount for tmp gold objects */
  602. X};
  603. X
  604. X#define newobj(xl)    (struct obj *)alloc((unsigned)(xl) + sizeof(struct obj))
  605. X#define dealloc_obj(obj) free((genericptr_t) (obj))
  606. X#define ONAME(otmp)    ((char *)(otmp)->oextra)
  607. X
  608. X#define Is_container(otmp) (otmp->otyp >= LARGE_BOX && \
  609. X                otmp->otyp <= BAG_OF_TRICKS)
  610. X#define Is_box(otmp)    (otmp->otyp == LARGE_BOX || otmp->otyp == CHEST)
  611. X#define Is_mbag(otmp)    (otmp->otyp == BAG_OF_HOLDING || \
  612. X             otmp->otyp == BAG_OF_TRICKS)
  613. X
  614. X#define is_sword(otmp)    (otmp->otyp >= SHORT_SWORD && \
  615. X             otmp->otyp <= RUNESWORD)
  616. X#define is_blade(otmp)    (otmp->otyp >= DAGGER && \
  617. X             otmp->otyp <= BILL_GUISARME)
  618. X#define bimanual(otmp)    ((otmp->oclass == WEAPON_CLASS || \
  619. X              otmp->otyp == UNICORN_HORN) && \
  620. X             objects[otmp->otyp].oc_bimanual)
  621. X
  622. X#define Is_candle(otmp)    (otmp->otyp == TALLOW_CANDLE || \
  623. X             otmp->otyp == WAX_CANDLE)
  624. X
  625. X#endif /* OBJ_H */
  626. END_OF_FILE
  627. if test 4629 -ne `wc -c <'include/obj.h'`; then
  628.     echo shar: \"'include/obj.h'\" unpacked with wrong size!
  629. fi
  630. # end of 'include/obj.h'
  631. fi
  632. if test -f 'src/write.c' -a "${1}" != "-c" ; then 
  633.   echo shar: Will not clobber existing file \"'src/write.c'\"
  634. else
  635. echo shar: Extracting \"'src/write.c'\" \(4618 characters\)
  636. sed "s/^X//" >'src/write.c' <<'END_OF_FILE'
  637. X/*    SCCS Id: @(#)write.c    3.1    91/01/04
  638. X/* NetHack may be freely redistributed.  See license for details. */
  639. X
  640. X#include "hack.h"
  641. X
  642. Xstatic int FDECL(cost,(struct obj *));
  643. X
  644. X/*
  645. X * returns basecost of a scroll or a spellbook
  646. X */
  647. Xstatic int
  648. Xcost(otmp)
  649. Xregister struct obj *otmp;
  650. X{
  651. X
  652. X    if (otmp->oclass == SPBOOK_CLASS)
  653. X        return(10 * objects[otmp->otyp].oc_level);
  654. X
  655. X    switch(otmp->otyp)  {
  656. X# ifdef MAIL
  657. X    case SCR_MAIL:
  658. X        return(2);
  659. X/*        break; */
  660. X# endif
  661. X    case SCR_LIGHT:
  662. X    case SCR_GOLD_DETECTION:
  663. X    case SCR_FOOD_DETECTION:
  664. X    case SCR_MAGIC_MAPPING:
  665. X    case SCR_AMNESIA:
  666. X    case SCR_FIRE:
  667. X        return(8);
  668. X/*        break; */
  669. X    case SCR_DESTROY_ARMOR:
  670. X    case SCR_CREATE_MONSTER:
  671. X    case SCR_PUNISHMENT:
  672. X        return(10);
  673. X/*        break; */
  674. X    case SCR_CONFUSE_MONSTER:
  675. X        return(12);
  676. X/*        break; */
  677. X    case SCR_IDENTIFY:
  678. X        return(14);
  679. X/*        break; */
  680. X    case SCR_ENCHANT_ARMOR:
  681. X    case SCR_REMOVE_CURSE:
  682. X    case SCR_ENCHANT_WEAPON:
  683. X    case SCR_CHARGING:
  684. X        return(16);
  685. X/*        break; */
  686. X    case SCR_SCARE_MONSTER:
  687. X    case SCR_TAMING:
  688. X    case SCR_TELEPORTATION:
  689. X        return(20);
  690. X/*        break; */
  691. X    case SCR_GENOCIDE:
  692. X        return(30);
  693. X/*        break; */
  694. X    case SCR_BLANK_PAPER:
  695. X    default:
  696. X        impossible("You can't write such a weird scroll!");
  697. X    }
  698. X    return(1000);
  699. X}
  700. X
  701. Xstatic const char NEARDATA write_on[] = { SCROLL_CLASS, SPBOOK_CLASS, 0 };
  702. X
  703. Xint
  704. Xdowrite(pen)
  705. Xregister struct obj *pen;
  706. X{
  707. X    register struct obj *paper;
  708. X    char namebuf[BUFSZ], scrbuf[BUFSZ];
  709. X    register struct obj *new_obj;
  710. X    int basecost, actualcost;
  711. X    int curseval;
  712. X    char qbuf[QBUFSZ];
  713. X    
  714. X    if(!pen)
  715. X        return(0);
  716. X    /* already tested before only call of dowrite() (from doapply())
  717. X    if(pen->otyp != MAGIC_MARKER)  {
  718. X        You("can't write with that!");
  719. X        return(0);
  720. X    }
  721. X    */
  722. X
  723. X    /* get paper to write on */
  724. X    paper = getobj(write_on,"write on");
  725. X    if(!paper)
  726. X        return(0);
  727. X    if(Blind && !paper->dknown) {
  728. X        You("can't tell if that %s's blank or not!",
  729. X              paper->oclass == SPBOOK_CLASS ? "spellbook" :
  730. X              "scroll");
  731. X        return(1);
  732. X    }
  733. X    paper->dknown = 1;
  734. X    if(paper->otyp != SCR_BLANK_PAPER && paper->otyp != SPE_BLANK_PAPER) {
  735. X        You("fool, that %s's not blank!",
  736. X            paper->oclass == SPBOOK_CLASS ? "spellbook" :
  737. X            "scroll");
  738. X        return(1);
  739. X    }
  740. X
  741. X    /* what to write */
  742. X    Sprintf(qbuf, "What type of %s do you want to write? ",
  743. X          paper->oclass == SPBOOK_CLASS ? "spellbook" :
  744. X          "scroll");
  745. X    getlin(qbuf, namebuf);
  746. X    if(namebuf[0] == '\033' || !namebuf[0])
  747. X        return(1);
  748. X    scrbuf[0] = '\0';
  749. X    if (paper->oclass == SPBOOK_CLASS) {
  750. X        if(strncmp(namebuf,"spellbook of ",13) != 0)
  751. X            Strcpy(scrbuf,"spellbook of ");
  752. X    }
  753. X    else if(strncmp(namebuf,"scroll of ",10) != 0)
  754. X        Strcpy(scrbuf,"scroll of ");
  755. X    Strcat(scrbuf,namebuf);
  756. X    new_obj = readobjnam(scrbuf);
  757. X
  758. X    new_obj->bknown = (paper->bknown && pen->bknown);
  759. X
  760. X    if((new_obj->oclass != SCROLL_CLASS ||
  761. X                  new_obj->otyp == SCR_BLANK_PAPER)
  762. X        && (new_obj->oclass != SPBOOK_CLASS || 
  763. X                      new_obj->otyp == SPE_BLANK_PAPER)) {
  764. X        You("can't write that!");
  765. X        pline("It's obscene!");
  766. X        obfree(new_obj, (struct obj *) 0); /* pb@ethz.uucp */
  767. X        return(1);
  768. X    }
  769. X
  770. X    /* see if there's enough ink */
  771. X    basecost = cost(new_obj);
  772. X    if(pen->spe < basecost/2)  {
  773. X        Your("marker is too dry to write that!");
  774. X        obfree(new_obj, (struct obj *) 0);
  775. X        return(1);
  776. X    }
  777. X
  778. X    /* we're really going to write now, so calculate cost
  779. X     */
  780. X    actualcost = rn1(basecost/2,basecost/2);
  781. X    curseval = bcsign(pen) + bcsign(paper);
  782. X    exercise(A_WIS, TRUE);
  783. X    /* dry out marker */
  784. X    if(pen->spe < actualcost)  {
  785. X        Your("marker dries out!");
  786. X        /* scrolls disappear, spellbooks don't */
  787. X        if (paper->oclass == SPBOOK_CLASS)
  788. X            pline("The spellbook is left unfinished.");
  789. X        else {
  790. X            pline("The scroll is now useless and disappears!");
  791. X            useup(paper);
  792. X        }
  793. X        pen->spe = 0;
  794. X        obfree(new_obj, (struct obj *) 0);
  795. X        return(1);
  796. X    }
  797. X    pen->spe -= actualcost;
  798. X
  799. X    /* can't write if we don't know it - unless we're lucky */
  800. X    if(!(objects[new_obj->otyp].oc_name_known) && 
  801. X       !(objects[new_obj->otyp].oc_uname) && 
  802. X       (rnl(pl_character[0] == 'W' ? 3 : 15))) {
  803. X        You("don't know how to write that!");
  804. X        /* scrolls disappear, spellbooks don't */
  805. X        if (paper->oclass == SPBOOK_CLASS)
  806. X            You("write in your best handwriting:  \"My Diary\".");
  807. X        else {
  808. X            You("write \"%s was here!\" and the scroll disappears.",plname);
  809. X            useup(paper);
  810. X        }
  811. X        obfree(new_obj, (struct obj *) 0);
  812. X        return(1);
  813. X    }
  814. X
  815. X    /* useup old scroll / spellbook */
  816. X    useup(paper);
  817. X
  818. X    /* now you know it! */
  819. X    makeknown(new_obj->otyp);
  820. X
  821. X    /* success */
  822. X    new_obj = addinv(new_obj);
  823. X    new_obj->blessed = (curseval > 0);
  824. X    new_obj->cursed = (curseval < 0);
  825. X    prinv(NULL, new_obj, 1L);
  826. X#ifdef MAIL
  827. X    if (new_obj->otyp == SCR_MAIL) new_obj->spe = 1;
  828. X#endif
  829. X    new_obj->known = 1;
  830. X    return(1);
  831. X}
  832. X
  833. X/*write.c*/
  834. END_OF_FILE
  835. if test 4618 -ne `wc -c <'src/write.c'`; then
  836.     echo shar: \"'src/write.c'\" unpacked with wrong size!
  837. fi
  838. # end of 'src/write.c'
  839. fi
  840. if test -f 'sys/atari/setup.g' -a "${1}" != "-c" ; then 
  841.   echo shar: Will not clobber existing file \"'sys/atari/setup.g'\"
  842. else
  843. echo shar: Extracting \"'sys/atari/setup.g'\" \(288 characters\)
  844. sed "s/^X//" >'sys/atari/setup.g' <<'END_OF_FILE'
  845. X# gulam shell script -- should work with tcsh and many
  846. X# other Atari shells, too
  847. X
  848. Xcp ..\unix\Makefile.top ..\..\Makefile
  849. Xcp ..\unix\Makefile.dat ..\..\dat\Makefile
  850. Xcp ..\unix\Makefile.doc ..\..\doc\Makefile
  851. Xcp ..\unix\Makefile.src ..\..\src\Makefile
  852. Xcp .\Makefile.utl ..\..\util\Makefile
  853. END_OF_FILE
  854. if test 288 -ne `wc -c <'sys/atari/setup.g'`; then
  855.     echo shar: \"'sys/atari/setup.g'\" unpacked with wrong size!
  856. fi
  857. # end of 'sys/atari/setup.g'
  858. fi
  859. if test -f 'sys/mac/Install.mpw' -a "${1}" != "-c" ; then 
  860.   echo shar: Will not clobber existing file \"'sys/mac/Install.mpw'\"
  861. else
  862. echo shar: Extracting \"'sys/mac/Install.mpw'\" \(4858 characters\)
  863. sed "s/^X//" >'sys/mac/Install.mpw' <<'END_OF_FILE'
  864. XHow to make Mac NetHack 3.1 using MPW
  865. XCopyright (c) 1992-11-23 Jon W{tte
  866. X
  867. X
  868. XPlease read these instructions through carefully before starting to
  869. Xbuild NetHack for the Macintosh.  Most important is the part about
  870. Xkeeping the folder structure intact, and how to move a few files
  871. Xaround.
  872. X
  873. XFor me, having done this a few times, steps 1-7 take less than five
  874. Xminutes.  Add to that an average compilation time of 25 minutes
  875. X(without VISION_TABLES, see below) and a full build of NetHack from
  876. Xscratch doesn't take more than a lunch break.
  877. X
  878. X0)    Requirements:
  879. X    - MPW C 3.2
  880. X    - Mac with 68020 or better CPU (this is required to run MPW 3.2)
  881. X    - 10 MB free disk (at least)
  882. X    - 8 MB memory (using System 6, or a slimmed System 7)
  883. X      More is quite preferable.
  884. X    - About 7 minutes of time on a Quadra with a RAM disk that fits
  885. X      the entire compilation.  Less than an hour for an SE/30 with
  886. X      standard hard disk.
  887. X    - Do NOT use virtual memory, or the compilation will quite possibly
  888. X      take the whole weekend.  We're serious.
  889. X
  890. X1)    Move all source files onto your hard disk.  Make sure to keep the
  891. X    folder structure the way it is.  You can skip the "tty" "X11" "amiga"
  892. X    "msdos" "os2" and "vms" folders if you are hard pressed for space.
  893. X    Also make sure the files are in native mac text format (i.e. ASCII
  894. X    13 is used for newlines).
  895. X
  896. X2)    De-binhex the file :sys:mac:NHmake.hqx using Stuffit, Compact Pro,
  897. X    tickle, or any other de-binhexer.  Move the resulting file
  898. X    (Nethack.make) into the "top" folder (the one containing the
  899. X    folders "src" "include" etc).
  900. X
  901. X3)    De-binhex the files :sys:mac:NHrez.hqx, :sys:mac:NHrsrc.hqx and
  902. X    :sys:mac:NHsound.hqx. If there is no sound file, or you do not
  903. X    want the sounds (they take up 200K in the final binary) you must
  904. X    create an empty resource file called "Sounds.rsrc" in the folder
  905. X    :sys:mac, using ResEdit.
  906. X    The resulting files should be left in :sys:mac:
  907. X
  908. X4)    Edit the make file Nethack.make to set the Top variable.  If your top
  909. X    folder is called "nh31" and is in the MPW folder, this is not needed.
  910. X
  911. X5)    Create two new folders in the top folder, named "Dungeon" and "Obj".
  912. X
  913. X6)    You may want to edit some of the options in :include:config.h to suit
  914. X    your tastes.  However, using MPW, this file will self-configure for
  915. X    the default Mac distribution.
  916. X
  917. X    NOTE: The make file defines VISION_TABLES, and macconf.h sets
  918. X    the option BRACES to match, so you should not concern yourself
  919. X    with that option in config.h. However, compiling with the option
  920. X    VISION_TABLES will generate a faster binary, at the expense of
  921. X    the size of the application, and compilation time.
  922. X
  923. X    Your MPW shell will need at least 7000K REAL MEMORY (TempMem
  924. X    won't do) for this compile to work. If you don't have it, you
  925. X    can try removing the VISION_TABLES option in the make file,
  926. X    you will however still need around 3000K for the MPW shell.
  927. X
  928. X7)    Use BuildProgram on the make file. This is Cmd-B for most folks.
  929. X    Sit back and relax. The linker will spew out a lot of warnings
  930. X    about global data size (Error 34) but that's OK. If you don't
  931. X    want the warnings, turn on -model far in the make file; this will
  932. X    make a slightly less efficient program but gives no warnings.
  933. X
  934. X8)    When the build is done, a short melody is played, and the results are
  935. X    in the Dungeon folder.  Enjoy!
  936. X
  937. X9)    If you want to make any changes to the dungeon compiler or the special
  938. X    level compiler, you will need to edit the makefile to remove the
  939. X    dependencies for dgn_comp.h and lev_comp.h.  You should then add 
  940. X    dependencies for dgn_lex.c and lev_lex.c (output by lex) You
  941. X    will also need dependencies for dgn_yacc.c and lev_yacc.c (Output
  942. X    of yacc).  All four of these files should end up in the Top:sys:share
  943. X    folder.  Finally, the y.tab.h output from yacc should end up in
  944. X    the include folder as dgn_comp.h/lev_comp.h.
  945. X    
  946. X
  947. X10)    If, heaven forbid, you experience any configuration problems or make
  948. X    errors, try to fix it yourself (there are several READMEs and the
  949. X    like you can check), but be sure to save a copy of the original files
  950. X    if you change anything.  There should be no problems if you use the
  951. X    correct versions etc. as per step 0 but you never know.  As always,
  952. X    turn off all INITs and re-boot if you have any problems, and they
  953. X    might go away.
  954. X
  955. X    If you experience any bugs, please mail them to the bug report address
  956. X    nethack-bugs@linc.cis.upenn.edu
  957. X    Be sure to include what computer you use, how it is configured, what
  958. X    version of MPW and C and the headers you use, where you got the
  959. X    NetHack code etc. etc.
  960. X
  961. X11)    This code is provided "as is" free of charge, and no warranty of any
  962. X    kind can or will cover it.  Use at your own risk.  This code is
  963. X    protected under copyright law, and may only be re-distributed under
  964. X    the terms of the NetHack license also found in this package, or
  965. X    otherwise with the authors' permission.  (If the license is missing,
  966. X    mail the bug report address for a copy.)
  967. END_OF_FILE
  968. if test 4858 -ne `wc -c <'sys/mac/Install.mpw'`; then
  969.     echo shar: \"'sys/mac/Install.mpw'\" unpacked with wrong size!
  970. fi
  971. # end of 'sys/mac/Install.mpw'
  972. fi
  973. if test -f 'sys/mac/macerrs.c' -a "${1}" != "-c" ; then 
  974.   echo shar: Will not clobber existing file \"'sys/mac/macerrs.c'\"
  975. else
  976. echo shar: Extracting \"'sys/mac/macerrs.c'\" \(4349 characters\)
  977. sed "s/^X//" >'sys/mac/macerrs.c' <<'END_OF_FILE'
  978. X/*    SCCS Id: @(#)macerrs.c    3.1    93/01/24          */
  979. X/* Copyright (c) Michael Hamel, 1991 */
  980. X/* NetHack may be freely redistributed.  See license for details. */
  981. X
  982. X#ifdef applec    /* This needs to be resident always */
  983. X#pragma segment Main
  984. X#endif
  985. X
  986. X#include "hack.h"
  987. X
  988. X#include <OSUtils.h>
  989. X#include <files.h>
  990. X#include <Types.h>
  991. X#ifdef MAC_MPW32
  992. X#include <String.h>
  993. X#include <Strings.h>
  994. X#endif
  995. X#ifdef MAC_THINKC5
  996. X#include <pascal.h>
  997. X#endif
  998. X#include <Dialogs.h>
  999. X#include <Packages.h>
  1000. X#include <ToolUtils.h>
  1001. X#include <Resources.h>
  1002. X
  1003. X#define stackDepth  4
  1004. X#define errAlertID 129
  1005. X#define stdIOErrID 1999
  1006. X
  1007. Xvoid FDECL(comment,(char *, long));
  1008. Xvoid FDECL(showerror,(char *, const char *));
  1009. XBoolean FDECL(itworked,(short));
  1010. Xvoid FDECL(mustwork,(short));
  1011. Xstatic void VDECL(vprogerror,(const char *line, va_list the_args));
  1012. Xvoid FDECL(attemptingto,( char * activity ));
  1013. Xvoid FDECL(pushattemptingto,( char * activity ));
  1014. Xvoid NDECL(popattempt);
  1015. X
  1016. Xstatic Str255 gActivities[stackDepth] = {"","","",""};
  1017. Xstatic short gTopactivity = 1;
  1018. X
  1019. Xvoid  comment( char *s, long n )
  1020. X{
  1021. X  Str255 paserr;
  1022. X  short itemHit;
  1023. X  
  1024. X  sprintf((char *)paserr, "%s - %d",s,n);
  1025. X  ParamText(c2pstr((char *)paserr),(StringPtr)"",(StringPtr)"",(StringPtr)"");
  1026. X  itemHit = Alert(128, (ModalFilterProcPtr)nil);
  1027. X}
  1028. X
  1029. Xvoid showerror( char * errdesc, const char * errcomment )
  1030. X{
  1031. X       short        itemHit;
  1032. X    Str255        paserr,
  1033. X                pascomment;
  1034. X                
  1035. X    SetCursor(&qd.arrow);
  1036. X    if (errcomment == nil)  pascomment[0] = '\0';
  1037. X      else strcpy((char *)pascomment,(char *)errcomment);
  1038. X    strcpy((char *)paserr,(char *)errdesc);
  1039. X    ParamText(c2pstr((char *)paserr),c2pstr((char *)pascomment),gActivities[gTopactivity],(StringPtr)"");
  1040. X    itemHit = Alert(errAlertID, (ModalFilterProcPtr)nil);
  1041. X}
  1042. X
  1043. X
  1044. XBoolean itworked( short errcode )
  1045. X/* Return TRUE if it worked, do an error message and return false if it didn't. Error
  1046. X   strings for native C errors are in STR#1999, Mac errs in STR 2000-errcode, e.g
  1047. X   2108 for not enough memory */
  1048. X
  1049. X{
  1050. X  if (errcode != 0) {
  1051. X    short         itemHit;
  1052. X    Str255          errdesc;
  1053. X    StringHandle strh;
  1054. X    Ptr             junk;
  1055. X    
  1056. X    errdesc[0] = '\0';
  1057. X    if (errcode > 0) GetIndString(errdesc,stdIOErrID,errcode);  /* STDIO file rres, etc */
  1058. X    else {
  1059. X       strh = GetString(2000-errcode);
  1060. X       if (strh != (StringHandle) nil) {
  1061. X          memcpy(errdesc,*strh,256);
  1062. X          ReleaseResource((Handle)strh);
  1063. X       }
  1064. X    }
  1065. X    if (errdesc[0] == '\0') {  /* No description found, just give the number */
  1066. X       sprintf((char *)errdesc,"a %d error occurred",errcode);
  1067. X       (void)c2pstr((char *)errdesc);
  1068. X    }
  1069. X    SetCursor(&qd.arrow);
  1070. X    ParamText(errdesc,(StringPtr)"",gActivities[gTopactivity],(StringPtr)"");
  1071. X    itemHit = Alert(errAlertID, (ModalFilterProcPtr)nil);
  1072. X
  1073. X  }
  1074. X  return(errcode==0);
  1075. X}
  1076. X
  1077. Xvoid mustwork( short errcode )
  1078. X/* For cases where we can't recover from the error by any means */
  1079. X{
  1080. X  if (itworked(errcode)) ;
  1081. X       else ExitToShell();
  1082. X}
  1083. X
  1084. X
  1085. X#if defined(USE_STDARG) || defined(USE_VARARGS)
  1086. X# ifdef USE_STDARG
  1087. Xstatic void vprogerror(const char *line, va_list the_args);
  1088. X# else
  1089. Xstatic void vprogerror();
  1090. X# endif
  1091. X
  1092. X/* Macro substitute for error() */
  1093. Xvoid progerror VA_DECL(const char *, line)
  1094. X    VA_START(line);
  1095. X    VA_INIT(line, char *);
  1096. X    vprogerror(line, VA_ARGS);
  1097. X    VA_END();
  1098. X}
  1099. X
  1100. X# ifdef USE_STDARG
  1101. Xstatic void
  1102. Xvprogerror(const char *line, va_list the_args) {
  1103. X# else
  1104. Xstatic void
  1105. Xvprogerror(line, the_args) const char *line; va_list the_args; {
  1106. X# endif
  1107. X
  1108. X#else  /* USE_STDARG | USE_VARARG */
  1109. X
  1110. Xvoid
  1111. Xprogerror VA_DECL(const char *, line)
  1112. X#endif
  1113. X/* Do NOT use VA_START and VA_END in here... see above */
  1114. X
  1115. X    if(!index(line, '%'))
  1116. X        showerror("of an internal error",line);
  1117. X    else {
  1118. X        char pbuf[BUFSZ];
  1119. X        Vsprintf(pbuf,line,VA_ARGS);
  1120. X        showerror("of an internal error",pbuf);
  1121. X    }
  1122. X}
  1123. X
  1124. Xvoid attemptingto( char * activity )
  1125. X/* Say what we are trying to do for subsequent error-handling: will appear as x in an
  1126. X   alert in the form "Could not x because y" */
  1127. X{
  1128. X   strcpy((char *)gActivities[gTopactivity],activity);
  1129. X   activity = (char *)c2pstr((char *)gActivities[gTopactivity]);
  1130. X}
  1131. X
  1132. Xvoid pushattemptingto( char * activity )
  1133. X/* Push a new description onto stack so we can pop later to previous state */
  1134. X{
  1135. X  if (gTopactivity < stackDepth) {
  1136. X    gTopactivity++;
  1137. X    attemptingto(activity);
  1138. X  }
  1139. X  else progerror("activity stack overflow");
  1140. X}
  1141. X
  1142. Xvoid popattempt( void )
  1143. X/* Pop to previous state */
  1144. X{
  1145. X  if (gTopactivity > 1) --gTopactivity;
  1146. X                   else progerror("activity stack underflow");
  1147. X}
  1148. END_OF_FILE
  1149. if test 4349 -ne `wc -c <'sys/mac/macerrs.c'`; then
  1150.     echo shar: \"'sys/mac/macerrs.c'\" unpacked with wrong size!
  1151. fi
  1152. # end of 'sys/mac/macerrs.c'
  1153. fi
  1154. if test -f 'sys/share/NetHack.cnf' -a "${1}" != "-c" ; then 
  1155.   echo shar: Will not clobber existing file \"'sys/share/NetHack.cnf'\"
  1156. else
  1157. echo shar: Extracting \"'sys/share/NetHack.cnf'\" \(4547 characters\)
  1158. sed "s/^X//" >'sys/share/NetHack.cnf' <<'END_OF_FILE'
  1159. X# A '#' at the beginning of a line means the rest of the line is a comment.
  1160. X#
  1161. X# This configuration file is set up for two cases, for a hard disk
  1162. X# (as drive C:), and for two floppy disks.
  1163. X#
  1164. X# To change the configuration, comment out the unwanted lines, and
  1165. X# uncomment the configuration you want.
  1166. X
  1167. X
  1168. X# *** OPTIONS ***
  1169. X#
  1170. X# These two options should be used for most setups.  If you're machine isn't
  1171. X# very IBM-compatible, and NetHack doesn't work, try commenting out this line.
  1172. X#
  1173. XOPTIONS=rawio,BIOS,IBMgraphics
  1174. X# DEC Rainbows will hang if rawio is set, so they should instead use:
  1175. X#OPTIONS=BIOS,DECgraphics
  1176. X#
  1177. X#
  1178. X# Some options to set personal preferences.  Uncomment and change these to
  1179. X# suit your personal preference.  If several people are to use the same
  1180. X# configuration, options like these should not be set.
  1181. X#
  1182. X#OPTIONS=name:Janet-V,female,dogname:Fido,catname:Morris,fruit:apricot
  1183. X#OPTIONS=packorder:")[%?+/=!(*0_`,scores:10 top/2 around/own
  1184. X#
  1185. X#
  1186. X# Other general options.  You might also set "silent" so as not to attract
  1187. X# the boss's attention.
  1188. X#
  1189. XOPTIONS=time,rest_on_space,nopickup,number_pad
  1190. X
  1191. X
  1192. X# *** HARD DISK CONFIGURATION ***
  1193. X#
  1194. XHACKDIR=c:\games\nethack
  1195. X#
  1196. X#   LEVELS and SAVE default to HACKDIR
  1197. X#
  1198. X#LEVELS=c:\games\nethack\bones
  1199. X#SAVE=c:\games\nethack\bones;n
  1200. X#
  1201. X#   appending a ";n" to SAVE means don't prompt to insert a disk.
  1202. XSAVE=;n
  1203. X#
  1204. X# Note that RAMDISK must *not* be the same (or even implicitly
  1205. X# get expanded to the same path by the OS) as HACKDIR.
  1206. X#
  1207. X#RAMDISK=d:
  1208. X
  1209. X
  1210. X# *** 2-FLOPPY CONFIGURATION ***
  1211. X#
  1212. X# HACKDIR=a:\
  1213. X# LEVELS=b:\
  1214. X# SAVE=b:\
  1215. X# RAMDISK=c:
  1216. X
  1217. X
  1218. X# *** CHARACTER GRAPHICS ***
  1219. X#
  1220. X# The 69 GRAPHICS characters (0-68) are:
  1221. X#
  1222. X# stone,
  1223. X# walls: vertical, horizontal,
  1224. X#     4 corners: top left, top right, bottom left, bottom right,
  1225. X#     cross wall,
  1226. X#     4 T walls: upward, downward, left, right,
  1227. X# doors: no door,
  1228. X#     open doors: vertical, horizontal,
  1229. X#     closed doors: vertical, horizontal,
  1230. X# floor,
  1231. X# corridors: unlit, lit,
  1232. X# stairs up, stairs down, ladder up, ladder down,
  1233. X# trap, web, altar, throne, sink, fountain, pool/moat, ice, lava,
  1234. X# lowered drawbridge: vertical, horizontal,
  1235. X# raised drawbridge: vertical, horizontal,
  1236. X# air, cloud, water,
  1237. X# 4 beams: vertical, horizontal, left slant, right slant,
  1238. X# digging beam, camera flash beam, left boomerang, right boomerang,
  1239. X# 4 magic shield display symbols,
  1240. X# 8 swallowed: top left/middle/right, mid left/right, bottom left/mid/right,
  1241. X# 9 explosion: [3 rows (top, middle, bottom) of 3 characters]
  1242. X#
  1243. X# If you specify fewer that 69 ASCII values, the remaining characters will be
  1244. X# set to their respective defaults:
  1245. X#       ' '  |   -   -   -   -   -   -   -   -
  1246. X#           |   |   .   -   |   +   +   .   #   #
  1247. X#        <   >   <   >   ^   "   _   \   #   {
  1248. X#        }   .   }   .   .   #   #  ' '  #   }
  1249. X#        |   -   \   /   *   !   )   (   0   #
  1250. X#        @   *   /   -   \   |   |   \   -   /
  1251. X#        /   -   \   |  ' '  |   \   -   /
  1252. X#
  1253. X# If you merely set the IBMgraphics option as above, NetHack will use IBM
  1254. X# extended ASCII for dungeon characters.  If you don't like the selections,
  1255. X# you can make up your own via the graphics option, but you should still set
  1256. X# IBMgraphics if you are using IBM graphics characters to get the correct
  1257. X# processing.
  1258. X#
  1259. X# An example using the IBM graphics character set:
  1260. X#GRAPHICS= 032 179 196 218 191 192 217 197 193 194 \
  1261. X#       180 195 249 239 239 254 254 249 177 177 \
  1262. X#       060 062 060 062 094 157 220 190 035 244 \
  1263. X#       247 249 247 042 042 186 205 046 035 247 \
  1264. X#       179 196 092 047 042 033 041 040 048 035 \
  1265. X#       064 042 047 045 092 058 058 092 045 047 \
  1266. X#       047 045 092 058 032 058 092 045 047
  1267. X# An alternative:
  1268. X#GRAPHICS= 032 186 205 201 187 200 188 206 202 203 \
  1269. X#       185 204 249 239 239 254 254 249 177 177 \
  1270. X#       060 062 060 062 094 034 095 092 035 244 \
  1271. X#       247 249 247 042 042 179 196 046 035 247 \
  1272. X#       179 196 092 047 042 033 041 040 048 035 \
  1273. X#       064 042 047 045 092 058 058 092 045 047 \
  1274. X#       047 045 092 058 032 058 092 045 047
  1275. X#
  1276. X
  1277. X#
  1278. X# Using the DEC Rainbow/ANSI line-drawing character set:
  1279. X#
  1280. X# If you have compiled with TERMLIB, merely set the DECgraphics option as
  1281. X# above.  NetHack will then switch into the VTxxx line-drawing character set
  1282. X# (aka ANSI ruling character set '0') for dungeon characters.  If you don't
  1283. X# like the selections, you can make up your own via the graphics option,
  1284. X# adding 128 to the value of any line-drawing character you want to use.
  1285. X# (But you should still set DECgraphics to get the correct processing.)
  1286. X#
  1287. X#GRAPHICS= 032 248 241 236 235 237 234 238 246 247 \
  1288. X#       245 244 248 241 092 047 254 241 248 043 \
  1289. X#       254 225
  1290. END_OF_FILE
  1291. if test 4547 -ne `wc -c <'sys/share/NetHack.cnf'`; then
  1292.     echo shar: \"'sys/share/NetHack.cnf'\" unpacked with wrong size!
  1293. fi
  1294. # end of 'sys/share/NetHack.cnf'
  1295. fi
  1296. if test -f 'sys/unix/Makefile.top' -a "${1}" != "-c" ; then 
  1297.   echo shar: Will not clobber existing file \"'sys/unix/Makefile.top'\"
  1298. else
  1299. echo shar: Extracting \"'sys/unix/Makefile.top'\" \(4893 characters\)
  1300. sed "s/^X//" >'sys/unix/Makefile.top' <<'END_OF_FILE'
  1301. X#    NetHack Makefile.
  1302. X#    SCCS Id: @(#)Makefile.top    3.1    92/01/05
  1303. X
  1304. X# newer makes predefine $(MAKE) to 'make' and do smarter processing of
  1305. X# recursive make calls if $(MAKE) is used
  1306. X# these makes allow $(MAKE) to be overridden by the environment if someone
  1307. X# wants to (or has to) use something other than the standard make, so we do
  1308. X# not want to unconditionally set $(MAKE) here
  1309. X#
  1310. X# unfortunately, some older makes do not predefine $(MAKE); if you have one of
  1311. X# these, uncomment the following line
  1312. X# (you will know that you have one if you get complaints about unable to
  1313. X# execute things like 'data' and 'rumors')
  1314. X# MAKE = make
  1315. X
  1316. X# make NetHack
  1317. XGAME     = nethack
  1318. XGAMEUID  = games
  1319. XGAMEGRP  = bin
  1320. X
  1321. X# Permissions - some places use setgid instead of setuid, for instance
  1322. X# See also the option "SECURE" in include/config.h
  1323. XGAMEPERM = 04755
  1324. XFILEPERM = 0644
  1325. XEXEPERM  = 0755
  1326. XDIRPERM  = 0755
  1327. X
  1328. X# GAMEDIR also appears in config.h as "HACKDIR".
  1329. X#
  1330. X# note that 'make install' believes in creating a nice tidy GAMEDIR for
  1331. X# installation, free of debris from previous NetHack versions --
  1332. X# therefore there should not be anything in GAMEDIR that you want to keep
  1333. X# (if there is, you'll have to do the installation by hand or modify the
  1334. X# instructions)
  1335. XGAMEDIR  = /usr/games/lib/$(GAME)dir
  1336. XSHELLDIR = /usr/games
  1337. X
  1338. XDATHELP = help hh cmdhelp history opthelp wizhelp
  1339. XVARDAT = data oracles options quest.dat rumors
  1340. X
  1341. XSPEC_LEVS = asmodeus.lev baalz.lev bigroom.lev castle.lev fakewiz?.lev \
  1342. X    juiblex.lev knox.lev medusa-?.lev mine_end.lev minefill.lev \
  1343. X    minetown.lev oracle.lev orcus.lev sanctum.lev tower?.lev valley.lev \
  1344. X    wizard?.lev astral.lev air.lev earth.lev fire.lev water.lev
  1345. XQUEST_LEVS = ?-goal.lev ?-fill?.lev ?-locate.lev ?-start.lev
  1346. X
  1347. XSCRIPT = dungeon
  1348. XDAT = $(DATHELP) $(VARDAT) $(SPEC_LEVS) $(QUEST_LEVS) $(SCRIPT) license
  1349. X
  1350. X$(GAME):
  1351. X    ( cd src ; $(MAKE) )
  1352. X
  1353. Xall:    $(GAME) Guidebook $(VARDAT) dungeon spec_levs
  1354. X    @echo "Done."
  1355. X
  1356. XGuidebook:
  1357. X    ( cd doc ; $(MAKE) Guidebook )
  1358. X
  1359. Xmanpages:
  1360. X    ( cd doc ; $(MAKE) manpages )
  1361. X
  1362. Xdata:
  1363. X    ( cd dat ; $(MAKE) data )
  1364. X
  1365. Xrumors:
  1366. X    ( cd dat ; $(MAKE) rumors )
  1367. X
  1368. Xoracles:
  1369. X    ( cd dat ; $(MAKE) oracles )
  1370. X
  1371. X#    Note: options should have already been made with make, but...
  1372. Xoptions:
  1373. X    ( cd dat ; $(MAKE) options )
  1374. X
  1375. Xquest.dat:
  1376. X    ( cd dat ; $(MAKE) quest.dat )
  1377. X
  1378. Xspec_levs:
  1379. X    ( cd util ; $(MAKE) lev_comp )
  1380. X    ( cd dat ; $(MAKE) spec_levs )
  1381. X    ( cd dat ; $(MAKE) quest_levs )
  1382. X    
  1383. Xdungeon:
  1384. X    ( cd util ; $(MAKE) dgn_comp )
  1385. X    ( cd dat ; $(MAKE) dungeon )
  1386. X    
  1387. Xupdate: $(GAME) $(VARDAT) dungeon spec_levs
  1388. X#    (don't yank the old version out from under people who're playing it)
  1389. X    -mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
  1390. X#    quest.dat is also kept open and has the same problems over NFS
  1391. X    -mv $(GAMEDIR)/quest.dat $(GAMEDIR)/quest.dat.old
  1392. X# copy over new versions of the game files
  1393. X    ( cd dat ; cp $(DAT) $(GAMEDIR) )
  1394. X    cp src/$(GAME) $(GAMEDIR)
  1395. X    -rm -f $(SHELLDIR)/$(GAME)
  1396. X    sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  1397. X        -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  1398. X        < sys/unix/nethack.sh \
  1399. X        > $(SHELLDIR)/$(GAME)
  1400. X# correct the permissions on the new versions
  1401. X    -( cd $(GAMEDIR) ; chown $(GAMEUID) $(DAT) $(GAME) ; \
  1402. X            chgrp $(GAMEGRP) $(DAT) $(GAME) ; \
  1403. X            chmod $(FILEPERM) $(DAT) )
  1404. X    -chown $(GAMEUID) $(SHELLDIR)/$(GAME)
  1405. X    chgrp $(GAMEGRP) $(SHELLDIR)/$(GAME)
  1406. X    chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
  1407. X    chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
  1408. X# touch time-sensitive files
  1409. X    -touch -c $(GAMEDIR)/bones* $(GAMEDIR)/?lock* $(GAMEDIR)/wizard*
  1410. X    -touch -c $(GAMEDIR)/save/*
  1411. X    touch $(GAMEDIR)/perm $(GAMEDIR)/record
  1412. X# and a reminder
  1413. X    @echo You may also want to install the man pages via the doc Makefile.
  1414. X
  1415. Xinstall: $(GAME) $(VARDAT) dungeon spec_levs
  1416. X# set up the directories
  1417. X    -mkdir $(SHELLDIR)
  1418. X    -rm -rf $(GAMEDIR)
  1419. X    -mkdir $(GAMEDIR) $(GAMEDIR)/save
  1420. X# create some files
  1421. X    touch $(GAMEDIR)/perm $(GAMEDIR)/record $(GAMEDIR)/logfile
  1422. X# copy over the game files
  1423. X    ( cd dat ; cp $(DAT) $(GAMEDIR) )
  1424. X    cp src/$(GAME) $(GAMEDIR)
  1425. X    -rm -f $(SHELLDIR)/$(GAME)
  1426. X    sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  1427. X        -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  1428. X        < sys/unix/nethack.sh \
  1429. X        > $(SHELLDIR)/$(GAME)
  1430. X# set up the permissions
  1431. X    -( cd $(GAMEDIR) ; chown $(GAMEUID) . * $(SHELLDIR)/$(GAME) )
  1432. X    ( cd $(GAMEDIR) ; chgrp $(GAMEGRP) . * $(SHELLDIR)/$(GAME) )
  1433. X    chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
  1434. X    chmod $(FILEPERM) $(GAMEDIR)/*
  1435. X    chmod $(DIRPERM) $(GAMEDIR) $(GAMEDIR)/save
  1436. X    chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
  1437. X# and a reminder
  1438. X    @echo You may also want to reinstall the man pages via the doc Makefile.
  1439. X
  1440. X# 'make clean' removes all the .o files, but leaves around all the executables
  1441. X# and compiled data files
  1442. Xclean:
  1443. X    ( cd src ; $(MAKE) clean )
  1444. X    ( cd util ; $(MAKE) clean )
  1445. X
  1446. X# 'make spotless' returns the source tree to near-distribution condition.
  1447. X# it removes .o files, executables, and compiled data files
  1448. Xspotless:
  1449. X    ( cd src ; $(MAKE) spotless )
  1450. X    ( cd util ; $(MAKE) spotless )
  1451. X    ( cd dat ; $(MAKE) spotless )
  1452. X    ( cd doc ; $(MAKE) spotless )
  1453. END_OF_FILE
  1454. if test 4893 -ne `wc -c <'sys/unix/Makefile.top'`; then
  1455.     echo shar: \"'sys/unix/Makefile.top'\" unpacked with wrong size!
  1456. fi
  1457. # end of 'sys/unix/Makefile.top'
  1458. fi
  1459. if test -f 'win/tty/getline.c' -a "${1}" != "-c" ; then 
  1460.   echo shar: Will not clobber existing file \"'win/tty/getline.c'\"
  1461. else
  1462. echo shar: Extracting \"'win/tty/getline.c'\" \(4670 characters\)
  1463. sed "s/^X//" >'win/tty/getline.c' <<'END_OF_FILE'
  1464. X/*    SCCS Id: @(#)getline.c    3.1    92/01/05    */
  1465. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  1466. X/* NetHack may be freely redistributed.  See license for details. */
  1467. X
  1468. X#include "hack.h"
  1469. X#include "wintty.h"
  1470. X#include "func_tab.h"
  1471. X
  1472. X#ifdef OVL1
  1473. X
  1474. Xchar morc = 0;    /* tell the outside world what char you chose */
  1475. X
  1476. X#endif /* OVL1 */
  1477. X
  1478. Xextern char erase_char, kill_char;    /* from appropriate tty.c file */
  1479. X
  1480. X#ifdef OVL1
  1481. X
  1482. X/*
  1483. X * Read a line closed with '\n' into the array char bufp[BUFSZ].
  1484. X * (The '\n' is not stored. The string is closed with a '\0'.)
  1485. X * Reading can be interrupted by an escape ('\033') - now the
  1486. X * resulting string is "\033".
  1487. X */
  1488. Xvoid
  1489. Xtty_getlin(query, bufp)
  1490. Xconst char *query;
  1491. Xregister char *bufp;
  1492. X{
  1493. X    register char *obufp = bufp;
  1494. X    register int c;
  1495. X    struct WinDesc *cw = wins[WIN_MESSAGE];
  1496. X    boolean doprev = 0;
  1497. X
  1498. X    if(ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP)) more();
  1499. X    cw->flags &= ~WIN_STOP;
  1500. X    ttyDisplay->toplin = 3; /* special prompt state */
  1501. X    ttyDisplay->inread++;
  1502. X    pline("%s ", query);
  1503. X    for(;;) {
  1504. X        (void) fflush(stdout);
  1505. X        if((c = Getchar()) == EOF) {
  1506. X            *bufp = 0;
  1507. X            break;
  1508. X        }
  1509. X        if(c == '\033') {
  1510. X            *obufp = c;
  1511. X            obufp[1] = 0;
  1512. X            break;
  1513. X        }
  1514. X        if(c == '\020') { /* ctrl-P */
  1515. X            if(!doprev)
  1516. X            (void) tty_doprev_message(); /* need two initially */
  1517. X            (void) tty_doprev_message();
  1518. X            doprev = 1;
  1519. X            continue;
  1520. X        } else if(doprev) {
  1521. X            tty_clear_nhwindow(WIN_MESSAGE);
  1522. X            cw->maxcol = cw->maxrow;
  1523. X            doprev = 0;
  1524. X            addtopl(query);
  1525. X            addtopl(" ");
  1526. X            *bufp = 0;
  1527. X            addtopl(obufp);
  1528. X        }
  1529. X        if(c == erase_char || c == '\b') {
  1530. X            if(bufp != obufp) {
  1531. X                bufp--;
  1532. X                putsyms("\b \b");/* putsym converts \b */
  1533. X            } else    tty_nhbell();
  1534. X#if defined(apollo)
  1535. X        } else if(c == '\n' || c == '\r') {
  1536. X#else
  1537. X        } else if(c == '\n') {
  1538. X#endif
  1539. X            *bufp = 0;
  1540. X            break;
  1541. X        } else if(' ' <= c && c < '\177' && 
  1542. X                (bufp-obufp < BUFSZ-1 || bufp-obufp < COLNO)) {
  1543. X                /* avoid isprint() - some people don't have it
  1544. X                   ' ' is not always a printing char */
  1545. X            *bufp = c;
  1546. X            bufp[1] = 0;
  1547. X            putsyms(bufp);
  1548. X            bufp++;
  1549. X        } else if(c == kill_char || c == '\177') { /* Robert Viduya */
  1550. X                /* this test last - @ might be the kill_char */
  1551. X            while(bufp != obufp) {
  1552. X                bufp--;
  1553. X                putsyms("\b \b");
  1554. X            }
  1555. X        } else
  1556. X            tty_nhbell();
  1557. X    }
  1558. X    ttyDisplay->toplin = 2;        /* nonempty, no --More-- required */
  1559. X    ttyDisplay->inread--;
  1560. X}
  1561. X
  1562. Xvoid
  1563. Xxwaitforspace(s)
  1564. Xregister const char *s;    /* chars allowed besides space or return */
  1565. X{
  1566. X    register int c;
  1567. X
  1568. X    morc = 0;
  1569. X
  1570. X    while((c = tty_nhgetch()) != '\n') {
  1571. X    if(flags.cbreak) {
  1572. X        if(c == ' ') break;
  1573. X        if(s && index(s,c)) {
  1574. X        morc = c;
  1575. X        break;
  1576. X        }
  1577. X        tty_nhbell();
  1578. X    }
  1579. X    }
  1580. X
  1581. X}
  1582. X
  1583. X#endif /* OVL1 */
  1584. X#ifdef OVL2
  1585. X
  1586. X#ifdef COM_COMPL
  1587. X/* Read in an extended command - doing command line completion for
  1588. X * when enough characters have been entered to make a unique command.
  1589. X * This is just a modified getlin().   -jsb
  1590. X */
  1591. Xvoid
  1592. Xtty_get_ext_cmd(bufp)
  1593. Xregister char *bufp;
  1594. X{
  1595. X    register char *obufp = bufp;
  1596. X    register int c;
  1597. X    int com_index, oindex;
  1598. X
  1599. X    pline("# ");
  1600. X    ttyDisplay->toplin = 2;        /* nonempty, no --More-- required */
  1601. X
  1602. X    for(;;) {
  1603. X        (void) fflush(stdout);
  1604. X        if((c = readchar()) == EOF) {
  1605. X            *bufp = 0;
  1606. X            return;
  1607. X        }
  1608. X        if(c == '\033') {
  1609. X            *obufp = c;
  1610. X            obufp[1] = 0;
  1611. X            return;
  1612. X        }
  1613. X        if(c == erase_char || c == '\b') {
  1614. X            if(bufp != obufp) {
  1615. X                bufp--;
  1616. X                putsyms("\b \b"); /* putsym converts \b */
  1617. X            } else    tty_nhbell();
  1618. X#if defined(apollo)
  1619. X        } else if(c == '\n' || c == '\r') {
  1620. X#else
  1621. X        } else if(c == '\n') {
  1622. X#endif
  1623. X            *bufp = 0;
  1624. X            return;
  1625. X        } else if(' ' <= c && c < '\177') {
  1626. X                /* avoid isprint() - some people don't have it
  1627. X                   ' ' is not always a printing char */
  1628. X            *bufp = c;
  1629. X            bufp[1] = 0;
  1630. X            oindex = 0;
  1631. X            com_index = -1;
  1632. X
  1633. X            while(extcmdlist[oindex].ef_txt != NULL){
  1634. X                if(!strncmpi(obufp, extcmdlist[oindex].ef_txt,
  1635. X                    strlen(obufp)))
  1636. X                    if(com_index == -1) /* No matches yet*/
  1637. X                        com_index = oindex;
  1638. X                    else /* More than 1 match */
  1639. X                        com_index = -2;
  1640. X                oindex++;
  1641. X            }
  1642. X            if(com_index >= 0){
  1643. X                Strcpy(obufp, extcmdlist[com_index].ef_txt);
  1644. X                /* finish printing our string */
  1645. X                putsyms(bufp);
  1646. X                bufp = obufp; /* reset it */
  1647. X                if((int)strlen(obufp) < BUFSZ-1 &&
  1648. X                        (int)strlen(obufp) < COLNO)
  1649. X                    /* set bufp at the end of our string */
  1650. X                    bufp += strlen(obufp);
  1651. X            } else {
  1652. X                putsyms(bufp);
  1653. X                if(bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO)
  1654. X                    bufp++;
  1655. X            }
  1656. X        } else if(c == kill_char || c == '\177') { /* Robert Viduya */
  1657. X                /* this test last - @ might be the kill_char */
  1658. X            while(bufp != obufp) {
  1659. X                bufp--;
  1660. X                putsyms("\b \b");
  1661. X            }
  1662. X        } else
  1663. X            tty_nhbell();
  1664. X    }
  1665. X
  1666. X}
  1667. X#endif /* COM_COMPL */
  1668. X
  1669. X#endif /* OVL2 */
  1670. X
  1671. X/*getline.c*/
  1672. END_OF_FILE
  1673. if test 4670 -ne `wc -c <'win/tty/getline.c'`; then
  1674.     echo shar: \"'win/tty/getline.c'\" unpacked with wrong size!
  1675. fi
  1676. # end of 'win/tty/getline.c'
  1677. fi
  1678. echo shar: End of archive 103 \(of 108\).
  1679. cp /dev/null ark103isdone
  1680. MISSING=""
  1681. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1682. 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
  1683. 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
  1684. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
  1685. 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 \
  1686. 101 102 103 104 105 106 107 108 ; do
  1687.     if test ! -f ark${I}isdone ; then
  1688.     MISSING="${MISSING} ${I}"
  1689.     fi
  1690. done
  1691. if test "${MISSING}" = "" ; then
  1692.     echo You have unpacked all 108 archives.
  1693.     echo "Now execute 'rebuild.sh'"
  1694.     rm -f ark10[0-8]isdone ark[1-9]isdone ark[1-9][0-9]isdone
  1695. else
  1696.     echo You still need to unpack the following archives:
  1697.     echo "        " ${MISSING}
  1698. fi
  1699. ##  End of shell archive.
  1700. exit 0
  1701.