home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / games / volume14 / umoria4 / part36 < prev    next >
Internet Message Format  |  1992-08-31  |  59KB

  1. Path: uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v14i068:  umoria4 - single player dungeon simulation (ver. 5.5), Part36/39
  5. Message-ID: <3432@master.CNA.TEK.COM>
  6. Date: 22 Aug 92 22:15:42 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 2430
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: grabiner@math.harvard.edu (David Grabiner)
  12. Posting-number: Volume 14, Issue 68
  13. Archive-name: umoria4/Part36
  14. Supersedes: umoria3: Volume 9, Issue 55-97; Volume 10, Issue 15-17
  15. Environment: Curses, Unix, Mac, MS-DOS, Atari-ST, Amiga, VMS
  16.  
  17.  
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of archive 36 (of 39)."
  26. # Contents:  mac/macconf.c mac/scrnmgr/ScrnMgr.ro
  27. #   mac/scrnmgr/ScrnTest.r source/eat.c source/magic.c source/sets.c
  28. #   source/wands.c util/mcheck.inf util/scores/print.c vms/Makefile
  29. #   vms/getch.c
  30. # Wrapped by billr@saab on Thu Aug 20 09:11:36 1992
  31. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  32. if test -f 'mac/macconf.c' -a "${1}" != "-c" ; then 
  33.   echo shar: Will not clobber existing file \"'mac/macconf.c'\"
  34. else
  35. echo shar: Extracting \"'mac/macconf.c'\" \(4470 characters\)
  36. sed "s/^X//" >'mac/macconf.c' <<'END_OF_FILE'
  37. X/* mac/macconf.c: configuration routines
  38. X
  39. X   Copyright (c) 1989-1991 Curtis McCauley, James E. Wilson
  40. X
  41. X   This software may be copied and distributed for educational, research, and
  42. X   not for profit purposes provided that this copyright and statement are
  43. X   included in all such copies. */
  44. X
  45. X#ifndef THINK_C
  46. X#include <Types.h>
  47. X#include <Quickdraw.h>
  48. X#include <Controls.h>
  49. X#include <Dialogs.h>
  50. X
  51. X#include <ScrnMgr.h>
  52. X#else
  53. X#include "ScrnMgr.h"
  54. X#endif
  55. X
  56. X#include "constant.h"
  57. X#include "types.h"
  58. X
  59. X#define rogueFlag                '-r\0\0'
  60. X#define originalFlag            '-o\0\0'
  61. X
  62. X#define cmdsetDlgID                256
  63. X#define cmdsetRogue                3
  64. X#define cmdsetOriginal            4
  65. X#define cmdsetGrpRect            6
  66. X#define cmdsetDfltBrdr            8
  67. X
  68. X#define teDlgID                    257
  69. X#define teFCFirst                3
  70. X#define teFCLast                5
  71. X#define teFCCount                (teFCLast - teFCFirst + 1)
  72. X#define teFCOther                6
  73. X#define teGrpRect                8
  74. X#define teDfltBrdr                10
  75. X
  76. X#ifdef THINK_C
  77. X/* Cover up error in THINK C library.  */
  78. X#define ok    OK
  79. X#define cancel    Cancel
  80. X#endif
  81. X
  82. Xint32 GetCommandSet(hndl)
  83. Xint32 **hndl;
  84. X
  85. X{
  86. X    DialogPtr theDialog;
  87. X    short theItem;
  88. X    Handle theHandle;
  89. X    short itemHit;
  90. X    short itsType;
  91. X    Handle itsHandle;
  92. X    Rect itsRect;
  93. X    int32 h, v;
  94. X
  95. X    theDialog = GetNewDialog(cmdsetDlgID, nil, (WindowPtr) -1);
  96. X
  97. X    CenterScreenDLOG(cmdsetDlgID, fixHalf, fixThird, &h, &v);
  98. X    MoveWindow((WindowPtr) theDialog, (short) h, (short) v, false);
  99. X
  100. X    GetDItem(theDialog, ok, &itsType, &itsHandle, &itsRect);
  101. X    InsetRect(&itsRect, -4, -4);
  102. X
  103. X    SetDItem(theDialog, cmdsetDfltBrdr, userItem,
  104. X         (Handle) DrawDefaultBorder, &itsRect);
  105. X
  106. X    GetDItem(theDialog, cmdsetGrpRect, &itsType, &itsHandle, &itsRect);
  107. X    SetDItem(theDialog, cmdsetGrpRect, itsType, (Handle) DrawGroupRect,
  108. X         &itsRect);
  109. X
  110. X    theItem = (**hndl == originalFlag) ? cmdsetOriginal : cmdsetRogue;
  111. X    GetDItem(theDialog, theItem, &itsType, &theHandle, &itsRect);
  112. X    SetCtlValue((ControlHandle) theHandle, true);
  113. X
  114. X    ShowWindow((WindowPtr) theDialog);
  115. X
  116. X    do {
  117. X        ModalDialog(nil, &itemHit);
  118. X        if ((itemHit != theItem)
  119. X            && ((itemHit == cmdsetOriginal) || (itemHit == cmdsetRogue))) {
  120. X            SetCtlValue((ControlHandle) theHandle, false);
  121. X            theItem = itemHit;
  122. X            GetDItem(theDialog, theItem, &itsType, &theHandle, &itsRect);
  123. X            SetCtlValue((ControlHandle) theHandle, true);
  124. X        }
  125. X    } while ( (itemHit != ok) && (itemHit != cancel) );
  126. X
  127. X    if (itemHit == ok)
  128. X        **hndl = (theItem == cmdsetOriginal) ? originalFlag : rogueFlag;
  129. X
  130. X    DisposDialog(theDialog);
  131. X
  132. X    return(itemHit == ok);
  133. X}
  134. X
  135. Xint32 GetTextEditor(hndl)
  136. Xint32 **hndl;
  137. X
  138. X{
  139. X    DialogPtr theDialog;
  140. X    short theItem;
  141. X    Handle theHandle, fcHandle;
  142. X    short itemHit;
  143. X    short itsType;
  144. X    Handle itsHandle;
  145. X    Rect itsRect;
  146. X    int32 h, v;
  147. X    char *p, *q;
  148. X    Str255 fc;
  149. X    static int32 editors[teFCCount-1] = { 'MACA', 'MSWD' };
  150. X
  151. X    theDialog = GetNewDialog(teDlgID, nil, (WindowPtr) -1);
  152. X
  153. X    CenterScreenDLOG(teDlgID, fixHalf, fixThird, &h, &v);
  154. X    MoveWindow((WindowPtr) theDialog, (short) h, (short) v, false);
  155. X
  156. X    GetDItem(theDialog, ok, &itsType, &itsHandle, &itsRect);
  157. X    InsetRect(&itsRect, -4, -4);
  158. X
  159. X    SetDItem(theDialog, teDfltBrdr, userItem, (Handle) DrawDefaultBorder,
  160. X         &itsRect);
  161. X
  162. X    GetDItem(theDialog, teGrpRect, &itsType, &itsHandle, &itsRect);
  163. X    SetDItem(theDialog, teGrpRect, itsType, (Handle) DrawGroupRect, &itsRect);
  164. X
  165. X    GetDItem(theDialog, teFCOther, &itsType, &fcHandle, &itsRect);
  166. X
  167. X    for (theItem = 0; theItem < teFCCount-1; theItem++)
  168. X        if (**hndl == editors[theItem])
  169. X            break;
  170. X
  171. X    theItem += teFCFirst;
  172. X    GetDItem(theDialog, theItem, &itsType, &theHandle, &itsRect);
  173. X    SetCtlValue((ControlHandle) theHandle, true);
  174. X
  175. X    if (theItem == teFCLast) {
  176. X        p = (char *)fc;
  177. X        q = (char *) *hndl;
  178. X        *p++ = 4;
  179. X        *p++ = *q++;
  180. X        *p++ = *q++;
  181. X        *p++ = *q++;
  182. X        *p = *q;
  183. X        SetIText(fcHandle, fc);
  184. X    }
  185. X
  186. X    ShowWindow((WindowPtr) theDialog);
  187. X
  188. X    do {
  189. X
  190. X        do {
  191. X            ModalDialog(nil, &itemHit);
  192. X            if ( (itemHit != theItem) && (itemHit >= teFCFirst)
  193. X                && (itemHit <= teFCLast) ) {
  194. X                SetCtlValue((ControlHandle) theHandle, false);
  195. X                theItem = itemHit;
  196. X                GetDItem(theDialog, theItem, &itsType, &theHandle, &itsRect);
  197. X                SetCtlValue((ControlHandle) theHandle, true);
  198. X            }
  199. X        } while ( (itemHit != ok) && (itemHit != cancel) );
  200. X
  201. X        if (itemHit == ok) {
  202. X            if (theItem != teFCLast)
  203. X                **hndl = editors[theItem - teFCFirst];
  204. X            else {
  205. X                GetIText(fcHandle, fc);
  206. X                p = (char *) *hndl;
  207. X                q = (char *)fc + 1;
  208. X                *p++ = (fc[0] > 0) ? *q++ : ' ';
  209. X                *p++ = (fc[0] > 1) ? *q++ : ' ';
  210. X                *p++ = (fc[0] > 2) ? *q++ : ' ';
  211. X                *p = (fc[0] > 3) ? *q : ' ';
  212. X            }
  213. X        }
  214. X
  215. X    } while (!ok);
  216. X
  217. X    DisposDialog(theDialog);
  218. X
  219. X    return(itemHit == ok);
  220. X}
  221. END_OF_FILE
  222. if test 4470 -ne `wc -c <'mac/macconf.c'`; then
  223.     echo shar: \"'mac/macconf.c'\" unpacked with wrong size!
  224. fi
  225. # end of 'mac/macconf.c'
  226. fi
  227. if test -f 'mac/scrnmgr/ScrnMgr.ro' -a "${1}" != "-c" ; then 
  228.   echo shar: Will not clobber existing file \"'mac/scrnmgr/ScrnMgr.ro'\"
  229. else
  230. echo shar: Extracting \"'mac/scrnmgr/ScrnMgr.ro'\" \(4878 characters\)
  231. sed "s/^X//" >'mac/scrnmgr/ScrnMgr.ro' <<'END_OF_FILE'
  232. XScrnMgr.rsrc
  233. X????????
  234. X
  235. X*/*    Copyright (C) Curtis McCauley, 1989.  All rights reserved.
  236. X*
  237. X*    You may copy this subroutine package freely, modify it as you desire,
  238. X*    and distribute it at will, as long as the copyright notice in the source
  239. X*    material is not disturbed, excepting that no one may use this package or
  240. X*    any part of it for commercial purposes of any kind without the express
  241. X*    written consent of its author. */
  242. X*
  243. X* TC 4.0 Version by Benjamin Schreiber, 1991
  244. X*
  245. X*#include "Types.r"
  246. X*
  247. X*type 'INFO'    {
  248. X*    rect;
  249. X*    integer;
  250. X*    longint white, black, red, green, blue, cyan, magenta, yellow;
  251. X*    longint white, black, red, green, blue, cyan, magenta, yellow;
  252. X*};
  253. X*
  254. X*type 'acur' {
  255. X*    integer = $$Countof(cursors);
  256. X*    integer = 0;
  257. X*    array cursors {
  258. X*        integer;
  259. X*        integer = 0;
  260. X*    };
  261. X*};
  262. X
  263. XTYPE acur = GNRL
  264. XRotating Watch, 128
  265. X.I
  266. X8
  267. X0
  268. X256 0  ;; union { struct { short id, fill; }; Handle cursHandle };
  269. X257 0
  270. X258 0
  271. X259 0
  272. X260 0
  273. X261 0
  274. X262 0
  275. X263 0
  276. X
  277. X
  278. XTYPE CURS = GNRL
  279. X    ,256
  280. X.H
  281. X 3F00 3F00 3F00 3F00 4080 8440 8440 8460
  282. X 9C60 8040 8040 4080 3F00 3F00 3F00 3F00
  283. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  284. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  285. X.I
  286. X8 8
  287. X
  288. X
  289. XTYPE CURS = GNRL
  290. X    ,257
  291. X.H
  292. X 3F00 3F00 3F00 3F00 4080 8040 8140 8260
  293. X 9C60 8040 8040 4080 3F00 3F00 3F00 3F00
  294. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  295. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  296. X.I
  297. X8 8
  298. X
  299. X
  300. XTYPE CURS = GNRL
  301. X    ,258
  302. X.H
  303. X 3F00 3F00 3F00 3F00 4080 8040 8040 8060
  304. X 9F60 8040 8040 4080 3F00 3F00 3F00 3F00
  305. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  306. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  307. X.I
  308. X8 8
  309. X
  310. X
  311. XTYPE CURS = GNRL
  312. X    ,259
  313. X.H
  314. X 3F00 3F00 3F00 3F00 4080 8040 8040 8060
  315. X 9C60 8240 8040 4080 3F00 3F00 3F00 3F00
  316. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  317. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  318. X.I
  319. X8 8
  320. X
  321. X
  322. XTYPE CURS = GNRL
  323. X    ,260
  324. X.H
  325. X 3F00 3F00 3F00 3F00 4080 8040 8040 8060
  326. X 9C60 8440 8440 4080 3F00 3F00 3F00 3F00
  327. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  328. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  329. X.I
  330. X8 8
  331. X
  332. X
  333. XTYPE CURS = GNRL
  334. X    ,261
  335. X.H
  336. X 3F00 3F00 3F00 3F00 4080 8040 8040 8060
  337. X 9C60 8840 9040 4080 3F00 3F00 3F00 3F00
  338. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  339. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  340. X.I
  341. X8 8
  342. X
  343. X
  344. XTYPE CURS = GNRL
  345. X    ,262
  346. X.H
  347. X 3F00 3F00 3F00 3F00 4080 8040 8040 8060
  348. X BC60 8040 8040 4080 3F00 3F00 3F00 3F00
  349. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  350. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  351. X.I
  352. X8 8
  353. X
  354. X
  355. XTYPE CURS = GNRL
  356. X    ,263
  357. X.H
  358. X 3F00 3F00 3F00 3F00 4080 8040 9040 8860
  359. X 9C60 8040 8040 4080 3F00 3F00 3F00 3F00
  360. X 3F00 3F00 3F00 3F00 7F80 FFC0 FFC0 FFC0
  361. X FFC0 FFC0 FFC0 7F80 3F00 3F00 3F00 3F00
  362. X.I
  363. X8 8
  364. X
  365. X
  366. XTYPE STR
  367. XAbout Title, 128 (32)
  368. XAbout ScrnMgr\C9
  369. X
  370. XTYPE STR
  371. XFont Name, 129 (32)
  372. XMonaco
  373. X
  374. XTYPE DLOG
  375. X"About", 128
  376. X"About ScrnMgr"        ;; Huh?
  377. X44 26 162 314
  378. XInvisible NoGoAway
  379. X0                    ;; dBoxProc (I think)
  380. X0                    ;; Refcon
  381. X128                    ;; DITL ID
  382. X
  383. XTYPE DLOG
  384. XColors, 129
  385. XColors
  386. X56 32 228 364
  387. XInvisible NoGoAway
  388. X0
  389. X0
  390. X129
  391. X
  392. XTYPE DLOG
  393. XYes or No, 130 (32)
  394. XYes or No
  395. X40 40 142 300
  396. XInvisible NoGoAway
  397. X0
  398. X0
  399. X130
  400. X
  401. XTYPE DITL
  402. XAbout, 128 (32)
  403. X4
  404. X
  405. Xbutton
  406. X73 103 97 191
  407. XOK
  408. X
  409. XuserItem disabled
  410. X80 158 89 167
  411. X
  412. XstaticText
  413. X16 8 32 273
  414. XScrnMgr: Version 1.0.1 b1 4 January 1991
  415. X
  416. XstaticText
  417. X40 8 56 273
  418. XCurtis McCauley, Benjamin Schreiber
  419. X
  420. X
  421. XTYPE DITL
  422. XColors, 129 (32)
  423. X23
  424. X
  425. Xbutton
  426. X40 256 60 316
  427. XOK
  428. X
  429. Xbutton
  430. X88 256 108 316
  431. XCancel
  432. X
  433. XradioButton
  434. X32 32 48 112
  435. XWhite
  436. X
  437. XradioButton
  438. X48 32 64 112
  439. XBlack
  440. X
  441. XradioButton
  442. X64 32 80 112
  443. XRed
  444. X
  445. XradioButton
  446. X80 32 96 112
  447. XGreed
  448. X
  449. XradioButton
  450. X96 32 112 112
  451. XBlue
  452. X
  453. XradioButton
  454. X112 32 128 112
  455. XCyan
  456. X
  457. XradioButton
  458. X128 32 144 112
  459. XMagenta
  460. X
  461. XradioButton
  462. X144 32 160 112
  463. XYellow
  464. X
  465. XradioButton
  466. X32 152 48 232
  467. XWhite
  468. X
  469. XradioButton
  470. X48 152 64 232
  471. XBlack
  472. X
  473. XradioButton
  474. X64 152 80 232
  475. XRed
  476. X
  477. XradioButton
  478. X80 152 96 232
  479. XGreen
  480. X
  481. XradioButton
  482. X96 152 112 232
  483. XBlue
  484. X
  485. XradioButton
  486. X112 152 128 232
  487. XCyan
  488. X
  489. XradioButton
  490. X128 152 144 232
  491. XMagenta
  492. X
  493. XradioButton
  494. X144 152 160 232
  495. XYellow
  496. X
  497. XuserItem disabled
  498. X16 16 168 120
  499. X
  500. XuserItem disabled
  501. X16 136 168 240
  502. X
  503. XstaticText disabled
  504. X8 24 24 104
  505. XForeground
  506. X
  507. XstaticText disabled
  508. X8 144 24 224
  509. XBackground
  510. X
  511. XuserItem disabled
  512. X48 296 56 304
  513. X
  514. X
  515. XTYPE DITL
  516. XYes or No, 130 (32)
  517. X5
  518. X
  519. Xbutton
  520. X16 184 36 244
  521. XYes
  522. X
  523. Xbutton
  524. X64 184 84 244
  525. XNo
  526. X
  527. XuserItem disabled
  528. X19 227 33 241
  529. X
  530. XstaticText disabled
  531. X9 48 89 168
  532. XAre you sure?
  533. X
  534. XiconItem disabled
  535. X8 8 40 40
  536. X0
  537. X
  538. X
  539. XTYPE MENU
  540. XApple, 128
  541. X\14
  542. XAbout ScrnMgr\C9
  543. X(-
  544. X
  545. X
  546. XTYPE MENU
  547. XFile, 129
  548. XFile
  549. XOpen/O
  550. XClose/W
  551. X(-
  552. XQuit/Q
  553. X
  554. X
  555. XTYPE MENU
  556. XEdit, 130
  557. XEdit
  558. X(Undo/Z
  559. X(-
  560. X(Cut/X
  561. X(Copy/C
  562. X(Paste/V
  563. X(Clear
  564. X
  565. X
  566. XTYPE MENU
  567. XFile (No Keys), 229
  568. XFile
  569. XOpen
  570. XClose
  571. X(-
  572. XQuit
  573. X
  574. X
  575. XTYPE MENU
  576. XEdit (No Keys), 230
  577. XEdit
  578. X(Undo
  579. X(-
  580. X(Cut
  581. X(Copy
  582. X(Paste
  583. X(Clear
  584. X
  585. X
  586. XTYPE MENU
  587. XScreen, 131
  588. XScreen
  589. XColors\C9
  590. X(-
  591. X
  592. X
  593. XTYPE MENU
  594. XFontSize, 132
  595. XFontSize
  596. X
  597. X
  598. XTYPE MBAR = GNRL
  599. XMain Menu, 128
  600. X.I
  601. X3    ;; 3 items
  602. X128  ;; apple
  603. X129  ;; file
  604. X130  ;; edit
  605. X
  606. X
  607. XTYPE MBAR = GNRL
  608. XMain Menu (No Keys), 228
  609. X.I
  610. X3
  611. X128
  612. X229
  613. X230
  614. X
  615. X
  616. XTYPE INFO = GNRL
  617. XScreen Info, 1
  618. X.I
  619. X46 4 333 507    ;; Size of window - this will give 24x80 in monaco 9 pt
  620. X9               ;; Point size to use (font in 'STR ' 129)
  621. X.L
  622. X0                 ;; Black (Foreground)
  623. X1                ;; White (Background)
  624. X
  625. END_OF_FILE
  626. if test 4878 -ne `wc -c <'mac/scrnmgr/ScrnMgr.ro'`; then
  627.     echo shar: \"'mac/scrnmgr/ScrnMgr.ro'\" unpacked with wrong size!
  628. fi
  629. # end of 'mac/scrnmgr/ScrnMgr.ro'
  630. fi
  631. if test -f 'mac/scrnmgr/ScrnTest.r' -a "${1}" != "-c" ; then 
  632.   echo shar: Will not clobber existing file \"'mac/scrnmgr/ScrnTest.r'\"
  633. else
  634. echo shar: Extracting \"'mac/scrnmgr/ScrnTest.r'\" \(1871 characters\)
  635. sed "s/^X//" >'mac/scrnmgr/ScrnTest.r' <<'END_OF_FILE'
  636. X/* mac/scrnmgr/ScrnTest.r: resources for scrnmgr test driver
  637. X
  638. X   Copyright (C) 1989-1991 Curtis McCauley, James E. Wilson
  639. X
  640. X   You may copy this subroutine package freely, modify it as you desire,
  641. X   and distribute it at will, as long as the copyright notice in the source
  642. X   material is not disturbed, excepting that no one may use this package or
  643. X   any part of it for commercial purposes of any kind without the express
  644. X   written consent of its author. */
  645. X
  646. X#include "Types.r"
  647. X
  648. Xinclude "ScrnMgr.rsrc";
  649. X
  650. Xresource 'STR ' (128, "About Title", purgeable) {
  651. X    "About ScrnTest\311"
  652. X};
  653. X
  654. Xresource 'DITL' (1024, "Dummy Alert", purgeable) {
  655. X    {    /* array DITLarray: 2 elements */
  656. X        /* [1] */
  657. X        {88, 224, 108, 284},
  658. X        Button {
  659. X            enabled,
  660. X            "Ok"
  661. X        },
  662. X        /* [2] */
  663. X        {8, 64, 72, 288},
  664. X        StaticText {
  665. X            disabled,
  666. X            "This is a dummy alert."
  667. X        }
  668. X    }
  669. X};
  670. X
  671. Xresource 'ALRT' (1024, "Dummy Alert", purgeable) {
  672. X    {40, 42, 158, 352},
  673. X    1024,
  674. X    {    /* array: 4 elements */
  675. X        /* [1] */
  676. X        OK, visible, sound1,
  677. X        /* [2] */
  678. X        OK, visible, sound1,
  679. X        /* [3] */
  680. X        OK, visible, sound1,
  681. X        /* [4] */
  682. X        OK, visible, sound1
  683. X    }
  684. X};
  685. X
  686. Xresource 'MENU' (133, "ScrnTest") {
  687. X    133,
  688. X    textMenuProc,
  689. X    allEnabled,
  690. X    enabled,
  691. X    "ScrnTest",
  692. X    {    /* array: 2 elements */
  693. X        /* [1] */
  694. X        "X Out", noIcon, "", "", plain,
  695. X        /* [2] */
  696. X        "Dummy Alert", noIcon, "A", "", plain
  697. X    }
  698. X};
  699. X
  700. Xresource 'MENU' (233, "ScrnTest (No Keys)") {
  701. X    233,
  702. X    textMenuProc,
  703. X    allEnabled,
  704. X    enabled,
  705. X    "ScrnTest",
  706. X    {    /* array: 2 elements */
  707. X        /* [1] */
  708. X        "X Out", noIcon, "", "", plain,
  709. X        /* [2] */
  710. X        "Dummy Alert", noIcon, "", "", plain
  711. X    }
  712. X};
  713. X
  714. Xresource 'SIZE' (-1) {
  715. X    dontSaveScreen,
  716. X    acceptSuspendResumeEvents,
  717. X    enableOptionSwitch,
  718. X    canBackground,
  719. X    multiFinderAware,
  720. X    backgroundAndForeground,
  721. X    dontGetFrontClicks,
  722. X    ignoreChildDiedEvents,
  723. X    not32BitCompatible,
  724. X    reserved,
  725. X    reserved,
  726. X    reserved,
  727. X    reserved,
  728. X    reserved,
  729. X    reserved,
  730. X    reserved,
  731. X    128 * 1024,
  732. X    128 * 1024
  733. X};
  734. END_OF_FILE
  735. if test 1871 -ne `wc -c <'mac/scrnmgr/ScrnTest.r'`; then
  736.     echo shar: \"'mac/scrnmgr/ScrnTest.r'\" unpacked with wrong size!
  737. fi
  738. # end of 'mac/scrnmgr/ScrnTest.r'
  739. fi
  740. if test -f 'source/eat.c' -a "${1}" != "-c" ; then 
  741.   echo shar: Will not clobber existing file \"'source/eat.c'\"
  742. else
  743. echo shar: Extracting \"'source/eat.c'\" \(5068 characters\)
  744. sed "s/^X//" >'source/eat.c' <<'END_OF_FILE'
  745. X/* source/eat.c: food code
  746. X
  747. X   Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke
  748. X
  749. X   This software may be copied and distributed for educational, research, and
  750. X   not for profit purposes provided that this copyright and statement are
  751. X   included in all such copies. */
  752. X
  753. X#include "config.h"
  754. X#include "constant.h"
  755. X#include "types.h"
  756. X#include "externs.h"
  757. X
  758. X#ifdef USG
  759. X#include <string.h>
  760. X#else
  761. X#include <strings.h>
  762. X#endif
  763. X
  764. X/* Eat some food.                    -RAK-    */
  765. Xvoid eat()
  766. X{
  767. X  int32u i;
  768. X  int j, k, item_val, ident;
  769. X  register struct flags *f_ptr;
  770. X  register struct misc *m_ptr;
  771. X  register inven_type *i_ptr;
  772. X#ifdef ATARIST_MWC
  773. X  int32u holder;
  774. X#endif
  775. X
  776. X  free_turn_flag = TRUE;
  777. X  if (inven_ctr == 0)
  778. X    msg_print("But you are not carrying anything.");
  779. X  else if (!find_range(TV_FOOD, TV_NEVER, &j, &k))
  780. X    msg_print("You are not carrying any food.");
  781. X  else if (get_item(&item_val, "Eat what?", j, k, CNIL, CNIL))
  782. X    {
  783. X      i_ptr = &inventory[item_val];
  784. X      free_turn_flag = FALSE;
  785. X      i = i_ptr->flags;
  786. X      ident = FALSE;
  787. X      while (i != 0)
  788. X    {
  789. X      j = bit_pos(&i) + 1;
  790. X      /* Foods                    */
  791. X      switch(j)
  792. X        {
  793. X        case 1:
  794. X          f_ptr = &py.flags;
  795. X          f_ptr->poisoned += randint(10) + i_ptr->level;
  796. X          ident = TRUE;
  797. X          break;
  798. X        case 2:
  799. X          f_ptr = &py.flags;
  800. X          f_ptr->blind += randint(250) + 10*i_ptr->level + 100;
  801. X          draw_cave();
  802. X          msg_print("A veil of darkness surrounds you.");
  803. X          ident = TRUE;
  804. X          break;
  805. X        case 3:
  806. X          f_ptr = &py.flags;
  807. X          f_ptr->afraid += randint(10) + i_ptr->level;
  808. X          msg_print("You feel terrified!");
  809. X          ident = TRUE;
  810. X          break;
  811. X        case 4:
  812. X          f_ptr = &py.flags;
  813. X          f_ptr->confused += randint(10) + i_ptr->level;
  814. X          msg_print("You feel drugged.");
  815. X          ident = TRUE;
  816. X          break;
  817. X        case 5:
  818. X          f_ptr = &py.flags;
  819. X          f_ptr->image += randint(200) + 25*i_ptr->level + 200;
  820. X          msg_print("You feel drugged.");
  821. X          ident = TRUE;
  822. X          break;
  823. X        case 6:
  824. X          ident = cure_poison();
  825. X          break;
  826. X        case 7:
  827. X          ident = cure_blindness();
  828. X          break;
  829. X        case 8:
  830. X          f_ptr = &py.flags;
  831. X          if (f_ptr->afraid > 1)
  832. X        {
  833. X          f_ptr->afraid = 1;
  834. X          ident = TRUE;
  835. X        }
  836. X          break;
  837. X        case 9:
  838. X          ident = cure_confusion();
  839. X          break;
  840. X        case 10:
  841. X          ident = TRUE;
  842. X          lose_str();
  843. X          break;
  844. X        case 11:
  845. X          ident = TRUE;
  846. X          lose_con();
  847. X          break;
  848. X#if 0  /* 12 through 15 are not used */
  849. X        case 12:
  850. X          ident = TRUE;
  851. X          lose_int();
  852. X          break;
  853. X        case 13:
  854. X          ident = TRUE;
  855. X          lose_wis();
  856. X          break;
  857. X        case 14:
  858. X          ident = TRUE;
  859. X          lose_dex();
  860. X          break;
  861. X        case 15:
  862. X          ident = TRUE;
  863. X          lose_chr();
  864. X          break;
  865. X#endif
  866. X        case 16:
  867. X          if (res_stat (A_STR))
  868. X        {
  869. X          msg_print("You feel your strength returning.");
  870. X          ident = TRUE;
  871. X        }
  872. X          break;
  873. X        case 17:
  874. X          if (res_stat (A_CON))
  875. X        {
  876. X          msg_print("You feel your health returning.");
  877. X          ident = TRUE;
  878. X        }
  879. X          break;
  880. X        case 18:
  881. X          if (res_stat (A_INT))
  882. X        {
  883. X          msg_print("Your head spins a moment.");
  884. X          ident = TRUE;
  885. X        }
  886. X          break;
  887. X        case 19:
  888. X          if (res_stat (A_WIS))
  889. X        {
  890. X          msg_print("You feel your wisdom returning.");
  891. X          ident = TRUE;
  892. X        }
  893. X          break;
  894. X        case 20:
  895. X          if (res_stat (A_DEX))
  896. X        {
  897. X          msg_print("You feel more dextrous.");
  898. X          ident = TRUE;
  899. X        }
  900. X          break;
  901. X        case 21:
  902. X          if (res_stat (A_CHR))
  903. X        {
  904. X          msg_print("Your skin stops itching.");
  905. X          ident = TRUE;
  906. X        }
  907. X          break;
  908. X        case 22:
  909. X          ident = hp_player(randint(6));
  910. X          break;
  911. X        case 23:
  912. X          ident = hp_player(randint(12));
  913. X          break;
  914. X        case 24:
  915. X          ident = hp_player(randint(18));
  916. X          break;
  917. X#if 0  /* 25 is not used */
  918. X        case 25:
  919. X          ident = hp_player(damroll(3, 6));
  920. X          break;
  921. X#endif
  922. X        case 26:
  923. X          ident = hp_player(damroll(3, 12));
  924. X          break;
  925. X        case 27:
  926. X          take_hit(randint(18), "poisonous food.");
  927. X          ident = TRUE;
  928. X          break;
  929. X#if 0 /* 28 through 30 are not used */
  930. X        case 28:
  931. X          take_hit(randint(8), "poisonous food.");
  932. X          ident = TRUE;
  933. X          break;
  934. X        case 29:
  935. X          take_hit(damroll(2, 8), "poisonous food.");
  936. X          ident = TRUE;
  937. X          break;
  938. X        case 30:
  939. X          take_hit(damroll(3, 8), "poisonous food.");
  940. X          ident = TRUE;
  941. X          break;
  942. X#endif
  943. X        default:
  944. X          msg_print("Internal error in eat()");
  945. X          break;
  946. X        }
  947. X      /* End of food actions.                */
  948. X    }
  949. X      if (ident)
  950. X    {
  951. X      if (!known1_p(i_ptr))
  952. X        {
  953. X          /* use identified it, gain experience */
  954. X          m_ptr = &py.misc;
  955. X          /* round half-way case up */
  956. X          m_ptr->exp += (i_ptr->level + (m_ptr->lev >> 1)) / m_ptr->lev;
  957. X          prt_experience();
  958. X
  959. X          identify (&item_val);
  960. X          i_ptr = &inventory[item_val];
  961. X        }
  962. X    }
  963. X      else if (!known1_p(i_ptr))
  964. X    sample (i_ptr);
  965. X      add_food(i_ptr->p1);
  966. X#ifdef ATARIST_MWC
  967. X      py.flags.status &= ~(holder = PY_WEAK|PY_HUNGRY);
  968. X#else
  969. X      py.flags.status &= ~(PY_WEAK|PY_HUNGRY);
  970. X#endif
  971. X      prt_hunger();
  972. X      desc_remain(item_val);
  973. X      inven_destroy(item_val);
  974. X    }
  975. X}
  976. END_OF_FILE
  977. if test 5068 -ne `wc -c <'source/eat.c'`; then
  978.     echo shar: \"'source/eat.c'\" unpacked with wrong size!
  979. fi
  980. # end of 'source/eat.c'
  981. fi
  982. if test -f 'source/magic.c' -a "${1}" != "-c" ; then 
  983.   echo shar: Will not clobber existing file \"'source/magic.c'\"
  984. else
  985. echo shar: Extracting \"'source/magic.c'\" \(5184 characters\)
  986. sed "s/^X//" >'source/magic.c' <<'END_OF_FILE'
  987. X/* source/magic.c: code for mage spells
  988. X
  989. X   Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke
  990. X
  991. X   This software may be copied and distributed for educational, research, and
  992. X   not for profit purposes provided that this copyright and statement are
  993. X   included in all such copies. */
  994. X
  995. X#include "config.h"
  996. X#include "constant.h"
  997. X#include "types.h"
  998. X#include "externs.h"
  999. X
  1000. X
  1001. X/* Throw a magic spell                    -RAK-    */
  1002. Xvoid cast()
  1003. X{
  1004. X  int i, j, item_val, dir;
  1005. X  int choice, chance, result;
  1006. X  register struct flags *f_ptr;
  1007. X  register struct misc *p_ptr;
  1008. X  register inven_type *i_ptr;
  1009. X  register spell_type *m_ptr;
  1010. X#ifdef ATARIST_MWC
  1011. X  int32u holder;
  1012. X#endif
  1013. X
  1014. X  free_turn_flag = TRUE;
  1015. X  if (py.flags.blind > 0)
  1016. X    msg_print("You can't see to read your spell book!");
  1017. X  else if (no_light())
  1018. X    msg_print("You have no light to read by.");
  1019. X  else if (py.flags.confused > 0)
  1020. X    msg_print("You are too confused.");
  1021. X  else if (class[py.misc.pclass].spell != MAGE)
  1022. X    msg_print("You can't cast spells!");
  1023. X  else if (!find_range(TV_MAGIC_BOOK, TV_NEVER, &i, &j))
  1024. X    msg_print("But you are not carrying any spell-books!");
  1025. X  else if (get_item(&item_val, "Use which spell-book?", i, j, CNIL, CNIL))
  1026. X    {
  1027. X      result = cast_spell("Cast which spell?", item_val, &choice, &chance);
  1028. X      if (result < 0)
  1029. X    msg_print("You don't know any spells in that book.");
  1030. X      else if (result > 0)
  1031. X    {
  1032. X      m_ptr = &magic_spell[py.misc.pclass-1][choice];
  1033. X      free_turn_flag = FALSE;
  1034. X
  1035. X      if (randint(100) < chance)
  1036. X        msg_print("You failed to get the spell off!");
  1037. X      else
  1038. X        {
  1039. X          /* Spells.  */
  1040. X          switch(choice+1)
  1041. X        {
  1042. X        case 1:
  1043. X          if (get_dir(CNIL, &dir))
  1044. X            fire_bolt(GF_MAGIC_MISSILE, dir, char_row, char_col,
  1045. X                  damroll(2, 6), spell_names[0]);
  1046. X          break;
  1047. X        case 2:
  1048. X          (void) detect_monsters();
  1049. X          break;
  1050. X        case 3:
  1051. X          teleport(10);
  1052. X          break;
  1053. X        case 4:
  1054. X          (void) light_area(char_row, char_col);
  1055. X          break;
  1056. X        case 5:
  1057. X          (void) hp_player(damroll(4, 4));
  1058. X          break;
  1059. X        case 6:
  1060. X          (void) detect_sdoor();
  1061. X          (void) detect_trap();
  1062. X          break;
  1063. X        case 7:
  1064. X          if (get_dir(CNIL, &dir))
  1065. X            fire_ball(GF_POISON_GAS, dir, char_row, char_col, 12,
  1066. X                  spell_names[6]);
  1067. X          break;
  1068. X        case 8:
  1069. X          if (get_dir(CNIL, &dir))
  1070. X            (void) confuse_monster(dir, char_row, char_col);
  1071. X          break;
  1072. X        case 9:
  1073. X          if (get_dir(CNIL, &dir))
  1074. X            fire_bolt(GF_LIGHTNING, dir, char_row, char_col,
  1075. X                  damroll(4, 8), spell_names[8]);
  1076. X          break;
  1077. X        case 10:
  1078. X          (void) td_destroy();
  1079. X          break;
  1080. X        case 11:
  1081. X          if (get_dir(CNIL, &dir))
  1082. X            (void) sleep_monster(dir, char_row, char_col);
  1083. X          break;
  1084. X        case 12:
  1085. X          (void) cure_poison();
  1086. X          break;
  1087. X        case 13:
  1088. X          teleport((int)(py.misc.lev*5));
  1089. X          break;
  1090. X        case 14:
  1091. X          for (i = 22; i < INVEN_ARRAY_SIZE; i++)
  1092. X            {
  1093. X              i_ptr = &inventory[i];
  1094. X#ifdef ATARIST_MWC
  1095. X              i_ptr->flags = (i_ptr->flags & ~(holder = TR_CURSED));
  1096. X#else
  1097. X              i_ptr->flags = (i_ptr->flags & ~TR_CURSED);
  1098. X#endif
  1099. X            }
  1100. X          break;
  1101. X        case 15:
  1102. X          if (get_dir(CNIL, &dir))
  1103. X            fire_bolt(GF_FROST, dir, char_row, char_col,
  1104. X                  damroll(6, 8), spell_names[14]);
  1105. X          break;
  1106. X        case 16:
  1107. X          if (get_dir(CNIL, &dir))
  1108. X            (void) wall_to_mud(dir, char_row, char_col);
  1109. X          break;
  1110. X        case 17:
  1111. X          create_food();
  1112. X          break;
  1113. X        case 18:
  1114. X          (void) recharge(20);
  1115. X          break;
  1116. X        case 19:
  1117. X          (void) sleep_monsters1(char_row, char_col);
  1118. X          break;
  1119. X        case 20:
  1120. X          if (get_dir(CNIL, &dir))
  1121. X            (void) poly_monster(dir, char_row, char_col);
  1122. X          break;
  1123. X        case 21:
  1124. X          (void) ident_spell();
  1125. X          break;
  1126. X        case 22:
  1127. X          (void) sleep_monsters2();
  1128. X          break;
  1129. X        case 23:
  1130. X          if (get_dir(CNIL, &dir))
  1131. X            fire_bolt(GF_FIRE, dir, char_row, char_col,
  1132. X                  damroll(9, 8), spell_names[22]);
  1133. X          break;
  1134. X        case 24:
  1135. X          if (get_dir(CNIL, &dir))
  1136. X            (void)speed_monster(dir, char_row, char_col, -1);
  1137. X          break;
  1138. X        case 25:
  1139. X          if (get_dir(CNIL, &dir))
  1140. X            fire_ball(GF_FROST, dir, char_row, char_col, 48,
  1141. X                  spell_names[24]);
  1142. X          break;
  1143. X        case 26:
  1144. X          (void) recharge(60);
  1145. X          break;
  1146. X        case 27:
  1147. X          if (get_dir(CNIL, &dir))
  1148. X            (void) teleport_monster(dir, char_row, char_col);
  1149. X          break;
  1150. X        case 28:
  1151. X          f_ptr = &py.flags;
  1152. X          f_ptr->fast += randint(20) + py.misc.lev;
  1153. X          break;
  1154. X        case 29:
  1155. X          if (get_dir(CNIL, &dir))
  1156. X            fire_ball(GF_FIRE, dir, char_row, char_col, 72,
  1157. X                  spell_names[28]);
  1158. X          break;
  1159. X        case 30:
  1160. X          destroy_area(char_row, char_col);
  1161. X          break;
  1162. X        case 31:
  1163. X          (void) genocide();
  1164. X          break;
  1165. X        default:
  1166. X          break;
  1167. X        }
  1168. X          /* End of spells.                     */
  1169. X          if (!free_turn_flag)
  1170. X        {
  1171. X          p_ptr = &py.misc;
  1172. X          if ((spell_worked & (1L << choice)) == 0)
  1173. X            {
  1174. X              p_ptr->exp += m_ptr->sexp << 2;
  1175. X              spell_worked |= (1L << choice);
  1176. X              prt_experience();
  1177. X            }
  1178. X        }
  1179. X        }
  1180. X      p_ptr = &py.misc;
  1181. X      if (!free_turn_flag)
  1182. X        {
  1183. X          if (m_ptr->smana > p_ptr->cmana)
  1184. X        {
  1185. X          msg_print("You faint from the effort!");
  1186. X          py.flags.paralysis =
  1187. X            randint((int)(5*(m_ptr->smana-p_ptr->cmana)));
  1188. X          p_ptr->cmana = 0;
  1189. X          p_ptr->cmana_frac = 0;
  1190. X          if (randint(3) == 1)
  1191. X            {
  1192. X              msg_print("You have damaged your health!");
  1193. X              (void) dec_stat (A_CON);
  1194. X            }
  1195. X        }
  1196. X          else
  1197. X        p_ptr->cmana -= m_ptr->smana;
  1198. X          prt_cmana();
  1199. X        }
  1200. X    }
  1201. X    }
  1202. X}
  1203. END_OF_FILE
  1204. if test 5184 -ne `wc -c <'source/magic.c'`; then
  1205.     echo shar: \"'source/magic.c'\" unpacked with wrong size!
  1206. fi
  1207. # end of 'source/magic.c'
  1208. fi
  1209. if test -f 'source/sets.c' -a "${1}" != "-c" ; then 
  1210.   echo shar: Will not clobber existing file \"'source/sets.c'\"
  1211. else
  1212. echo shar: Extracting \"'source/sets.c'\" \(5213 characters\)
  1213. sed "s/^X//" >'source/sets.c' <<'END_OF_FILE'
  1214. X/* source/sets.c: code to emulate the original Pascal sets
  1215. X
  1216. X   Copyright (c) 1989-92 James E. Wilson
  1217. X
  1218. X   This software may be copied and distributed for educational, research, and
  1219. X   not for profit purposes provided that this copyright and statement are
  1220. X   included in all such copies. */
  1221. X
  1222. X#include "config.h"
  1223. X#include "constant.h"
  1224. X#include "types.h"
  1225. X
  1226. Xint set_room(element)
  1227. Xregister int element;
  1228. X{
  1229. X  if ((element == DARK_FLOOR) || (element == LIGHT_FLOOR))
  1230. X    return(TRUE);
  1231. X  return(FALSE);
  1232. X}
  1233. X
  1234. Xint set_corr(element)
  1235. Xregister int element;
  1236. X{
  1237. X  if (element == CORR_FLOOR || element == BLOCKED_FLOOR)
  1238. X    return(TRUE);
  1239. X  return(FALSE);
  1240. X}
  1241. X
  1242. Xint set_floor(element)
  1243. Xint element;
  1244. X{
  1245. X  if (element <= MAX_CAVE_FLOOR)
  1246. X    return(TRUE);
  1247. X  else
  1248. X    return(FALSE);
  1249. X}
  1250. X
  1251. Xint set_corrodes(item)
  1252. Xinven_type *item;
  1253. X{
  1254. X  switch(item->tval)
  1255. X    {
  1256. X    case TV_SWORD: case TV_HELM: case TV_SHIELD: case TV_HARD_ARMOR:
  1257. X    case TV_WAND:
  1258. X      return (TRUE);
  1259. X    }
  1260. X  return(FALSE);
  1261. X}
  1262. X
  1263. X
  1264. Xint set_flammable(item)
  1265. Xinven_type *item;
  1266. X{
  1267. X  switch(item->tval)
  1268. X    {
  1269. X    case TV_ARROW: case TV_BOW: case TV_HAFTED: case TV_POLEARM:
  1270. X    case TV_BOOTS: case TV_GLOVES: case TV_CLOAK: case TV_SOFT_ARMOR:
  1271. X      /* Items of (RF) should not be destroyed.  */
  1272. X      if (item->flags & TR_RES_FIRE)
  1273. X    return FALSE;
  1274. X      else
  1275. X    return TRUE;
  1276. X
  1277. X    case TV_STAFF: case TV_SCROLL1: case TV_SCROLL2:
  1278. X      return TRUE;
  1279. X    }
  1280. X  return(FALSE);
  1281. X}
  1282. X
  1283. X
  1284. Xint set_frost_destroy(item)
  1285. Xinven_type *item;
  1286. X{
  1287. X  if ((item->tval == TV_POTION1) || (item->tval == TV_POTION2)
  1288. X      || (item->tval == TV_FLASK))
  1289. X    return(TRUE);
  1290. X  return(FALSE);
  1291. X}
  1292. X
  1293. X
  1294. Xint set_acid_affect(item)
  1295. Xinven_type *item;
  1296. X{
  1297. X  switch(item->tval)
  1298. X    {
  1299. X    case TV_MISC: case TV_CHEST:
  1300. X      return TRUE;
  1301. X    case TV_BOLT: case TV_ARROW:
  1302. X    case TV_BOW: case TV_HAFTED: case TV_POLEARM: case TV_BOOTS:
  1303. X    case TV_GLOVES: case TV_CLOAK: case TV_SOFT_ARMOR:
  1304. X      if (item->flags & TR_RES_ACID)
  1305. X    return (FALSE);
  1306. X      else
  1307. X    return (TRUE);
  1308. X    }
  1309. X  return(FALSE);
  1310. X}
  1311. X
  1312. X
  1313. Xint set_lightning_destroy(item)
  1314. Xinven_type *item;
  1315. X{
  1316. X  if ((item->tval == TV_RING) || (item->tval == TV_WAND)
  1317. X      || (item->tval == TV_SPIKE))
  1318. X    return(TRUE);
  1319. X  else
  1320. X    return(FALSE);
  1321. X}
  1322. X
  1323. X
  1324. X/*ARGSUSED*/    /* to shut up lint about unused argument */
  1325. X#ifdef __TURBOC__
  1326. X    #pragma argused
  1327. X#endif
  1328. Xint set_null(item)
  1329. Xinven_type *item;
  1330. X#if defined(MAC) && !defined(THINK_C)
  1331. X    #pragma unused(item)
  1332. X#endif
  1333. X{
  1334. X  return(FALSE);
  1335. X}
  1336. X
  1337. X
  1338. Xint set_acid_destroy(item)
  1339. Xinven_type *item;
  1340. X{
  1341. X  switch(item->tval)
  1342. X    {
  1343. X    case TV_ARROW: case TV_BOW: case TV_HAFTED: case TV_POLEARM:
  1344. X    case TV_BOOTS: case TV_GLOVES: case TV_CLOAK: case TV_HELM:
  1345. X    case TV_SHIELD: case TV_HARD_ARMOR: case TV_SOFT_ARMOR:
  1346. X      if (item->flags & TR_RES_ACID)
  1347. X    return FALSE;
  1348. X      else
  1349. X    return TRUE;
  1350. X    case TV_STAFF:
  1351. X    case TV_SCROLL1: case TV_SCROLL2: case TV_FOOD: case TV_OPEN_DOOR:
  1352. X    case TV_CLOSED_DOOR:
  1353. X      return(TRUE);
  1354. X    }
  1355. X  return(FALSE);
  1356. X}
  1357. X
  1358. X
  1359. Xint set_fire_destroy(item)
  1360. Xinven_type *item;
  1361. X{
  1362. X  switch(item->tval)
  1363. X    {
  1364. X    case TV_ARROW: case TV_BOW: case TV_HAFTED: case TV_POLEARM:
  1365. X    case TV_BOOTS: case TV_GLOVES: case TV_CLOAK: case TV_SOFT_ARMOR:
  1366. X      if (item->flags & TR_RES_FIRE)
  1367. X    return FALSE;
  1368. X      else
  1369. X    return TRUE;
  1370. X    case TV_STAFF: case TV_SCROLL1: case TV_SCROLL2: case TV_POTION1:
  1371. X    case TV_POTION2: case TV_FLASK: case TV_FOOD: case TV_OPEN_DOOR:
  1372. X    case TV_CLOSED_DOOR:
  1373. X      return(TRUE);
  1374. X    }
  1375. X  return(FALSE);
  1376. X}
  1377. X
  1378. X
  1379. Xint general_store(element)
  1380. Xint element;
  1381. X{
  1382. X  switch(element)
  1383. X    {
  1384. X    case TV_DIGGING: case TV_BOOTS: case TV_CLOAK: case TV_FOOD:
  1385. X    case TV_FLASK: case TV_LIGHT: case TV_SPIKE:
  1386. X      return(TRUE);
  1387. X    }
  1388. X  return(FALSE);
  1389. X}
  1390. X
  1391. X
  1392. Xint armory(element)
  1393. Xint element;
  1394. X{
  1395. X  switch(element)
  1396. X    {
  1397. X    case TV_BOOTS: case TV_GLOVES: case TV_HELM: case TV_SHIELD:
  1398. X    case TV_HARD_ARMOR: case TV_SOFT_ARMOR:
  1399. X      return(TRUE);
  1400. X    }
  1401. X  return(FALSE);
  1402. X}
  1403. X
  1404. X
  1405. Xint weaponsmith(element)
  1406. Xint element;
  1407. X{
  1408. X  switch(element)
  1409. X    {
  1410. X    case TV_SLING_AMMO: case TV_BOLT: case TV_ARROW: case TV_BOW:
  1411. X    case TV_HAFTED: case TV_POLEARM: case TV_SWORD:
  1412. X      return(TRUE);
  1413. X    }
  1414. X  return(FALSE);
  1415. X}
  1416. X
  1417. X
  1418. Xint temple(element)
  1419. Xint element;
  1420. X{
  1421. X  switch(element)
  1422. X    {
  1423. X    case TV_HAFTED: case TV_SCROLL1: case TV_SCROLL2: case TV_POTION1:
  1424. X    case TV_POTION2: case TV_PRAYER_BOOK:
  1425. X      return(TRUE);
  1426. X    }
  1427. X  return(FALSE);
  1428. X}
  1429. X
  1430. X
  1431. Xint alchemist(element)
  1432. Xint element;
  1433. X{
  1434. X  switch(element)
  1435. X    {
  1436. X    case TV_SCROLL1: case TV_SCROLL2: case TV_POTION1: case TV_POTION2:
  1437. X      return(TRUE);
  1438. X    }
  1439. X  return(FALSE);
  1440. X}
  1441. X
  1442. X
  1443. Xint magic_shop(element)
  1444. Xint element;
  1445. X{
  1446. X  switch(element)
  1447. X    {
  1448. X    case TV_AMULET: case TV_RING: case TV_STAFF: case TV_WAND:
  1449. X    case TV_SCROLL1: case TV_SCROLL2: case TV_POTION1: case TV_POTION2:
  1450. X    case TV_MAGIC_BOOK:
  1451. X      return(TRUE);
  1452. X    }
  1453. X  return(FALSE);
  1454. X}
  1455. X
  1456. X#ifdef MAC
  1457. X/* The last time tried, MPW failed to handle the initialized array of
  1458. X   function pointers properly.  hence, this hack. */
  1459. Xint store_buy(storeno, element)
  1460. Xint storeno;
  1461. Xint element;
  1462. X{
  1463. X  switch (storeno)
  1464. X    {
  1465. X    case 0: return(general_store(element));
  1466. X    case 1: return(armory(element));
  1467. X    case 2: return(weaponsmith(element));
  1468. X    case 3: return(temple(element));
  1469. X    case 4: return(alchemist(element));
  1470. X    case 5: return(magic_shop(element));
  1471. X    }
  1472. X  return(FALSE);
  1473. X}
  1474. X#endif
  1475. END_OF_FILE
  1476. if test 5213 -ne `wc -c <'source/sets.c'`; then
  1477.     echo shar: \"'source/sets.c'\" unpacked with wrong size!
  1478. fi
  1479. # end of 'source/sets.c'
  1480. fi
  1481. if test -f 'source/wands.c' -a "${1}" != "-c" ; then 
  1482.   echo shar: Will not clobber existing file \"'source/wands.c'\"
  1483. else
  1484. echo shar: Extracting \"'source/wands.c'\" \(4757 characters\)
  1485. sed "s/^X//" >'source/wands.c' <<'END_OF_FILE'
  1486. X/* source/wands.c: wand code
  1487. X
  1488. X   Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke
  1489. X
  1490. X   This software may be copied and distributed for educational, research, and
  1491. X   not for profit purposes provided that this copyright and statement are
  1492. X   included in all such copies. */
  1493. X
  1494. X#include "config.h"
  1495. X#include "constant.h"
  1496. X#include "types.h"
  1497. X#include "externs.h"
  1498. X
  1499. X#ifdef USG
  1500. X#ifndef ATARIST_MWC
  1501. X#include <string.h>
  1502. X#endif
  1503. X#else
  1504. X#include <strings.h>
  1505. X#endif
  1506. X
  1507. X/* Wands for the aiming.                */
  1508. Xvoid aim()
  1509. X{
  1510. X  int32u i;
  1511. X  register int l, ident;
  1512. X  int item_val, j, k, chance, dir;
  1513. X  register inven_type *i_ptr;
  1514. X  register struct misc *m_ptr;
  1515. X
  1516. X  free_turn_flag = TRUE;
  1517. X  if (inven_ctr == 0)
  1518. X    msg_print("But you are not carrying anything.");
  1519. X  else if (!find_range(TV_WAND, TV_NEVER, &j, &k))
  1520. X    msg_print("You are not carrying any wands.");
  1521. X  else if (get_item(&item_val, "Aim which wand?", j, k, CNIL, CNIL))
  1522. X    {
  1523. X      i_ptr = &inventory[item_val];
  1524. X      free_turn_flag = FALSE;
  1525. X      if (get_dir(CNIL, &dir))
  1526. X    {
  1527. X      if (py.flags.confused > 0)
  1528. X        {
  1529. X          msg_print("You are confused.");
  1530. X          do
  1531. X        {
  1532. X          dir = randint(9);
  1533. X        }
  1534. X          while (dir == 5);
  1535. X        }
  1536. X      ident = FALSE;
  1537. X      m_ptr = &py.misc;
  1538. X      chance = m_ptr->save + stat_adj(A_INT) - (int)i_ptr->level
  1539. X        + (class_level_adj[m_ptr->pclass][CLA_DEVICE] * m_ptr->lev / 3);
  1540. X      if (py.flags.confused > 0)
  1541. X        chance = chance / 2;
  1542. X      if ((chance < USE_DEVICE) && (randint(USE_DEVICE - chance + 1) == 1))
  1543. X        chance = USE_DEVICE; /* Give everyone a slight chance */
  1544. X      if (chance <= 0)  chance = 1;
  1545. X      if (randint(chance) < USE_DEVICE)
  1546. X        msg_print("You failed to use the wand properly.");
  1547. X      else if (i_ptr->p1 > 0)
  1548. X        {
  1549. X          i = i_ptr->flags;
  1550. X          (i_ptr->p1)--;
  1551. X          while (i != 0)
  1552. X        {
  1553. X          j = bit_pos(&i) + 1;
  1554. X          k = char_row;
  1555. X          l = char_col;
  1556. X          /* Wands             */
  1557. X          switch(j)
  1558. X            {
  1559. X            case 1:
  1560. X              msg_print("A line of blue shimmering light appears.");
  1561. X              light_line(dir, char_row, char_col);
  1562. X              ident = TRUE;
  1563. X              break;
  1564. X            case 2:
  1565. X              fire_bolt(GF_LIGHTNING, dir, k, l, damroll(4, 8),
  1566. X                spell_names[8]);
  1567. X              ident = TRUE;
  1568. X              break;
  1569. X            case 3:
  1570. X              fire_bolt(GF_FROST, dir, k, l, damroll(6, 8),
  1571. X                spell_names[14]);
  1572. X              ident = TRUE;
  1573. X              break;
  1574. X            case 4:
  1575. X              fire_bolt(GF_FIRE, dir, k, l, damroll(9, 8),
  1576. X                spell_names[22]);
  1577. X              ident = TRUE;
  1578. X              break;
  1579. X            case 5:
  1580. X              ident = wall_to_mud(dir, k, l);
  1581. X              break;
  1582. X            case 6:
  1583. X              ident = poly_monster(dir, k, l);
  1584. X              break;
  1585. X            case 7:
  1586. X              ident = hp_monster(dir, k, l, -damroll(4, 6));
  1587. X              break;
  1588. X            case 8:
  1589. X              ident = speed_monster(dir, k, l, 1);
  1590. X              break;
  1591. X            case 9:
  1592. X              ident = speed_monster(dir, k, l, -1);
  1593. X              break;
  1594. X            case 10:
  1595. X              ident = confuse_monster(dir, k, l);
  1596. X              break;
  1597. X            case 11:
  1598. X              ident = sleep_monster(dir, k, l);
  1599. X              break;
  1600. X            case 12:
  1601. X              ident = drain_life(dir, k, l);
  1602. X              break;
  1603. X            case 13:
  1604. X              ident = td_destroy2(dir, k, l);
  1605. X              break;
  1606. X            case 14:
  1607. X              fire_bolt(GF_MAGIC_MISSILE, dir, k, l, damroll(2, 6),
  1608. X                spell_names[0]);
  1609. X              ident = TRUE;
  1610. X              break;
  1611. X            case 15:
  1612. X              ident = build_wall(dir, k, l);
  1613. X              break;
  1614. X            case 16:
  1615. X              ident = clone_monster(dir, k, l);
  1616. X              break;
  1617. X            case 17:
  1618. X              ident = teleport_monster(dir, k, l);
  1619. X              break;
  1620. X            case 18:
  1621. X              ident = disarm_all(dir, k, l);
  1622. X              break;
  1623. X            case 19:
  1624. X              fire_ball(GF_LIGHTNING, dir, k, l, 32, "Lightning Ball");
  1625. X              ident = TRUE;
  1626. X              break;
  1627. X            case 20:
  1628. X              fire_ball(GF_FROST, dir, k, l, 48, "Cold Ball");
  1629. X              ident = TRUE;
  1630. X              break;
  1631. X            case 21:
  1632. X              fire_ball(GF_FIRE, dir, k, l, 72, spell_names[28]);
  1633. X              ident = TRUE;
  1634. X              break;
  1635. X            case 22:
  1636. X              fire_ball(GF_POISON_GAS, dir, k, l, 12, spell_names[6]);
  1637. X              ident = TRUE;
  1638. X              break;
  1639. X            case 23:
  1640. X              fire_ball(GF_ACID, dir, k, l, 60, "Acid Ball");
  1641. X              ident = TRUE;
  1642. X              break;
  1643. X            case 24:
  1644. X              i = 1L << (randint(23) - 1);
  1645. X              break;
  1646. X            default:
  1647. X              msg_print("Internal error in wands()");
  1648. X              break;
  1649. X            }
  1650. X          /* End of Wands.            */
  1651. X        }
  1652. X          if (ident)
  1653. X        {
  1654. X          if (!known1_p(i_ptr))
  1655. X            {
  1656. X              m_ptr = &py.misc;
  1657. X              /* round half-way case up */
  1658. X              m_ptr->exp += (i_ptr->level +(m_ptr->lev >> 1)) /
  1659. X            m_ptr->lev;
  1660. X              prt_experience();
  1661. X
  1662. X              identify(&item_val);
  1663. X              i_ptr = &inventory[item_val];
  1664. X            }
  1665. X        }
  1666. X          else if (!known1_p(i_ptr))
  1667. X        sample (i_ptr);
  1668. X          desc_charges(item_val);
  1669. X        }
  1670. X      else
  1671. X        {
  1672. X          msg_print("The wand has no charges left.");
  1673. X          if (!known2_p(i_ptr))
  1674. X        add_inscribe(i_ptr, ID_EMPTY);
  1675. X        }
  1676. X    }
  1677. X    }
  1678. X}
  1679. END_OF_FILE
  1680. if test 4757 -ne `wc -c <'source/wands.c'`; then
  1681.     echo shar: \"'source/wands.c'\" unpacked with wrong size!
  1682. fi
  1683. # end of 'source/wands.c'
  1684. fi
  1685. if test -f 'util/mcheck.inf' -a "${1}" != "-c" ; then 
  1686.   echo shar: Will not clobber existing file \"'util/mcheck.inf'\"
  1687. else
  1688. echo shar: Extracting \"'util/mcheck.inf'\" \(5237 characters\)
  1689. sed "s/^X//" >'util/mcheck.inf' <<'END_OF_FILE'
  1690. X
  1691. XGoal: write a little program that will check the monster file for consistency,
  1692. X    since I am tired of doing this manually; the comments below detail
  1693. X    everything that the program will verify
  1694. X
  1695. X****************
  1696. X
  1697. XCreature classification scheme
  1698. X
  1699. Xdragon: d, D
  1700. X    never invisible, can't open doors, never phase, never eats others,
  1701. X    never pick up objects, never multiply, carry objects/gold, breath
  1702. X    weapons, cast spells, hurt by slay dragon, hurt by slay evil, can be
  1703. X    slept, seen by infravision, young/mature 20% random movement
  1704. X
  1705. Xhumanoid: h, H, k, n, o, p, P, T, U, y, Y
  1706. X    can open doors, never eats others, all that carry treasure pick up obj,
  1707. X    never multiply, h/U/Y and some people don't carry treasure,
  1708. X    some cast spells, no breath weapons, all except some humans evil,
  1709. X    hurt by slay evil, can be slept, seen by infravision, never random
  1710. X    movement (except 0 level humans which are all 20% random)
  1711. X
  1712. Xundead: G, L, M, s, V, W, Z
  1713. X    only G invisible, all except s/Z open doors, only G/W phase,
  1714. X    never eats others, only G picks up objects, never multiply,
  1715. X    only s/Z do not carry objects/gold, some cast spells,
  1716. X    no breath weapons, all evil except s/Z, hurt by slay evil,
  1717. X    hurt by slay undead, can't be slept, never seen by infravision,
  1718. X    G very random movement, W 20% random movement, others never random
  1719. X    movement
  1720. X
  1721. Xanimal: a, A, b, c, f, F, j, K, l, r, R, S, t, w
  1722. X    only one of a/c invisible, can't open doors, never phase,
  1723. X    only A eats others, never pick up objects, only a/b/F/l/r/w multiply,
  1724. X    never carry objects or gold, never cast spells, some breath weapons,
  1725. X    not evil, hurt by slay animal, can be slept, mammals seen by
  1726. X    infravision, most have 20% random movement
  1727. X
  1728. Xdemons: B, p(Evil Iggy), q
  1729. X    always invisible, only B can phase, only B eats others, always pick up
  1730. X    objects, never multiply, carry objects/gold, cast spells, only B
  1731. X    breath weapon, all evil, hurt by slay evil, can not be slept, not seen
  1732. X    by infravision, never random movement
  1733. X
  1734. Xquylthulg: Q
  1735. X    in a class by itself, almost exactly the same as demon except not
  1736. X    evil and does not carry objects/gold, should be in class other
  1737. X
  1738. Xother: C, e, E, g, i, J, m, O, X, $, ','
  1739. X    some can be invisible, never open doors, only X phase,
  1740. X    only C/E/i/O eats others, only C/E/i/O pick up objects, only
  1741. X    O/',' multiply, only C/i/O carry objects/gold, $ carries only
  1742. X    gold, no breath weapons, not evil (all brainless
  1743. X    creatures), not hurt by any special weapon, can't be slept,
  1744. X    never seen with infravision, brainless creatures,
  1745. X    some drain mana/exp/etc., fire/air elementals (includes invisible
  1746. X    stalker) move quickly, golems are animated and should never move
  1747. X    randomly, the rest never move or move slowly/randomly if they do
  1748. X
  1749. XMiscellaneous overriding factors:
  1750. X    if invisible, not seen by infravision
  1751. X    if invisible, not hurt by blue light
  1752. X    if frost attack, not seen by infravion
  1753. X    if frost attack, not hurt by cold
  1754. X    if frost attack, hurt by fire
  1755. X    if fire attack, seen by infravision
  1756. X    if fire attack, not hurt by fire
  1757. X    if fire attack, hurt by frost
  1758. X    if fire&frost attack, not hurt by fire nor cold, infravision depends
  1759. X        on class
  1760. X    if acid attack, not hurt by acid
  1761. X    if poison/corrosion gas attack, not hurt by poison
  1762. X    if lightning attack, not hurt by blue light
  1763. X    if lungless, can not breathe/spit damage
  1764. X    if invisible can not gaze damage
  1765. X    if stone-to-mud hurt, not cold/fire hurt
  1766. X    if not move and brainless, in general, not carry objects/gold
  1767. X    if move and brainless, in general, carry objects/gold only if pick
  1768. X        up objects
  1769. X
  1770. XPossible changes:
  1771. X    examine vulnerability list for errors, changes, things that don't
  1772. X        make sense, additions, etc...
  1773. X    need to classify lungless creatures here somewhere
  1774. X    creatures without limbs should not claw for damage
  1775. X    creatures without mouths should not bite for damage
  1776. X
  1777. XSpecial vulnerabilities for each class:
  1778. Xa: none
  1779. XA: cold, fire
  1780. Xb: fire, poison, blue light
  1781. XB: none
  1782. Xc: none
  1783. XC: fire
  1784. Xd: none
  1785. XD: none
  1786. Xe: blue light
  1787. XE: cold(fire), fire(water), stone-to-mud(earth), none (stalker,air)
  1788. Xf: acid, fire
  1789. XF: cold, fire, poison
  1790. Xg: cold, fire, acid, blue light(flesh)
  1791. Xg: stone-to-mud (clay/stone)
  1792. Xg: acid (iron)
  1793. XG: none
  1794. Xh: cold, fire
  1795. XH: cold, fire
  1796. Xi: none
  1797. XI: {no monster}
  1798. Xj: cold, fire
  1799. XJ: fire, acid, blue light
  1800. Xk: cold, fire
  1801. XK: none
  1802. Xl: cold, fire, acid, poison, blue light
  1803. XL: none
  1804. Xm: fire, acid
  1805. XM: fire
  1806. Xn: fire, poison, acid
  1807. XN: {no monster}
  1808. Xo: cold, fire
  1809. XO: fire, acid
  1810. Xp: fire, cold
  1811. XP: stone-to-mud (stone)
  1812. XP: cold, fire (all except stone)
  1813. Xq: none
  1814. XQ: none
  1815. Xr: cold, fire, poison
  1816. XR: cold, fire, acid
  1817. Xs: none
  1818. XS: none
  1819. Xt: fire
  1820. XT: fire
  1821. Xu: {no monster}
  1822. XU: fire, blue light
  1823. Xv: {no monster}
  1824. XV: fire, blue light
  1825. Xw: cold, fire, acid, blue light
  1826. XW: fire, blue light
  1827. Xx: {no monster}
  1828. XX: stone-to-mud
  1829. Xy: cold, fire
  1830. XY: fire
  1831. Xz: fire
  1832. XZ: {no monster}
  1833. X$: none
  1834. X,: fire, acid
  1835. X
  1836. XObvious errors in monster.c file:
  1837. XHere is a list of errors in the monster.c file, assuming that the above
  1838. Xclassification scheme is used.    I have not examined the entire list.
  1839. X
  1840. Xsquint-eyed rogue should move 20% randomly
  1841. X
  1842. Xspirit troll should not be type 'T',
  1843. X    since this is not an undead type, should carry objects depending on
  1844. X        which type it is changed to
  1845. X    if make zombie must remove phase ability
  1846. X    if make ghost must make invisible
  1847. X
  1848. Xcreeping coins: touch for normal damage, bite for poison damage
  1849. X
  1850. Xdepends: pick_up_obj, movement
  1851. END_OF_FILE
  1852. if test 5237 -ne `wc -c <'util/mcheck.inf'`; then
  1853.     echo shar: \"'util/mcheck.inf'\" unpacked with wrong size!
  1854. fi
  1855. # end of 'util/mcheck.inf'
  1856. fi
  1857. if test -f 'util/scores/print.c' -a "${1}" != "-c" ; then 
  1858.   echo shar: Will not clobber existing file \"'util/scores/print.c'\"
  1859. else
  1860. echo shar: Extracting \"'util/scores/print.c'\" \(4599 characters\)
  1861. sed "s/^X//" >'util/scores/print.c' <<'END_OF_FILE'
  1862. X/* util/scores/print.c: standalone program to print score file
  1863. X
  1864. X   Copyright (c) 1991 James E. Wilson
  1865. X
  1866. X   This software may be copied and distributed for educational, research, and
  1867. X   not for profit purposes provided that this copyright and statement are
  1868. X   included in all such copies. */
  1869. X
  1870. X#include <stdio.h>
  1871. X
  1872. X#include "../../source/config.h"
  1873. X#include "../../source/constant.h"
  1874. X#include "../../source/types.h"
  1875. X#include "../../source/externs.h"
  1876. X
  1877. X#if defined(USG) || defined(VMS)
  1878. X#ifndef L_SET
  1879. X#define L_SET 0
  1880. X#endif
  1881. X#ifndef L_INCR
  1882. X#define L_INCR 1
  1883. X#endif
  1884. X#endif
  1885. X
  1886. X#undef fopen
  1887. X
  1888. X#ifndef USG
  1889. X/* only needed for Berkeley UNIX */
  1890. X#include <sys/param.h>
  1891. X#include <sys/types.h>
  1892. X#include <sys/file.h>
  1893. X#endif
  1894. X
  1895. Xextern race_type race[MAX_RACES];
  1896. Xextern class_type class[MAX_CLASS];
  1897. X
  1898. XFILE *highscore_fp;
  1899. XFILE *fileptr;
  1900. Xint8u xor_byte;
  1901. X
  1902. Xvoid set_fileptr();
  1903. X
  1904. Xmain(argc, argv)
  1905. X     int argc;
  1906. X     char *argv[];
  1907. X{
  1908. X  register int i, rank;
  1909. X  high_scores score;
  1910. X  char string[100];
  1911. X  int8u version_maj, version_min, patch_level;
  1912. X  int16 player_uid;
  1913. X
  1914. X  if (argc != 2)
  1915. X    {
  1916. X      printf ("Usage: print scorefile\n");
  1917. X      exit (-2);
  1918. X    }
  1919. X
  1920. X  if ((highscore_fp = fopen (argv[1], "r")) == NULL)
  1921. X    {
  1922. X      printf ("Error opening score file \"%s\"\n", MORIA_TOP);
  1923. X      exit (-1);
  1924. X    }
  1925. X
  1926. X#ifdef MSDOS
  1927. X  (void) setmode (fileno(highscore_fp), O_BINARY);
  1928. X#endif
  1929. X
  1930. X#ifndef BSD4_3
  1931. X  (void) fseek(highscore_fp, (long)0, L_SET);
  1932. X#else
  1933. X  (void) fseek(highscore_fp, (off_t)0, L_SET);
  1934. X#endif
  1935. X
  1936. X  /* Read version numbers from the score file, and check for validity.  */
  1937. X  version_maj = getc (highscore_fp);
  1938. X  version_min = getc (highscore_fp);
  1939. X  patch_level = getc (highscore_fp);
  1940. X  /* Support score files from 5.2.2 to present.  */
  1941. X  if (feof (highscore_fp))
  1942. X    {
  1943. X      printf ("The scorefile is empty.\n");
  1944. X      exit (-1);
  1945. X    }
  1946. X  else if ((version_maj != CUR_VERSION_MAJ)
  1947. X      || (version_min > CUR_VERSION_MIN)
  1948. X      || (version_min == CUR_VERSION_MIN && patch_level > PATCH_LEVEL)
  1949. X      || (version_min == 2 && patch_level < 2)
  1950. X      || (version_min < 2))
  1951. X    {
  1952. X      printf("Sorry. This scorefile is from a different version of umoria.\n");
  1953. X      exit (-1);
  1954. X    }
  1955. X
  1956. X#ifdef unix
  1957. X  player_uid = getuid ();
  1958. X#else
  1959. X#ifdef VMS
  1960. X  player_uid = (getgid()*1000) + getuid();
  1961. X#else
  1962. X  player_uid = 0;
  1963. X#endif
  1964. X#endif
  1965. X
  1966. X  /* set the static fileptr in save.c to the highscore file pointer */
  1967. X  set_fileptr(highscore_fp);
  1968. X
  1969. X  rank = 1;
  1970. X  rd_highscore(&score);
  1971. X  printf("Rank  Points Name              Sex Race       Class  Lvl Killed By\n");
  1972. X  while (!feof(highscore_fp))
  1973. X    {
  1974. X      i = 1;
  1975. X      /* Put twenty scores on each page, on lines 2 through 21. */
  1976. X      while (!feof(highscore_fp) && i < 21)
  1977. X    {
  1978. X      (void) sprintf(string,
  1979. X             "%-4d%8ld %-19.19s %c %-10.10s %-7.7s%3d %-22.22s\n",
  1980. X             rank, score.points, score.name, score.sex,
  1981. X             race[score.race].trace, class[score.class].title,
  1982. X             score.lev, score.died_from);
  1983. X      printf (string, ++i);
  1984. X      rank++;
  1985. X      rd_highscore(&score);
  1986. X    }
  1987. X    }
  1988. X
  1989. X  /* Success.  */
  1990. X  exit (0);
  1991. X}
  1992. X
  1993. Xstatic void rd_byte(ptr)
  1994. Xint8u *ptr;
  1995. X{
  1996. X  int8u c;
  1997. X
  1998. X  c = getc(fileptr) & 0xFF;
  1999. X  *ptr = c ^ xor_byte;
  2000. X  xor_byte = c;
  2001. X}
  2002. X
  2003. Xstatic void rd_short(ptr)
  2004. Xint16u *ptr;
  2005. X{
  2006. X  int8u c;
  2007. X  int16u s;
  2008. X
  2009. X  c = (getc(fileptr) & 0xFF);
  2010. X  s = c ^ xor_byte;
  2011. X  xor_byte = (getc(fileptr) & 0xFF);
  2012. X  s |= (int16u)(c ^ xor_byte) << 8;
  2013. X  *ptr = s;
  2014. X}
  2015. X
  2016. Xstatic void rd_long(ptr)
  2017. Xint32u *ptr;
  2018. X{
  2019. X  register int32u l;
  2020. X  register int8u c;
  2021. X
  2022. X  c = (getc(fileptr) & 0xFF);
  2023. X  l = c ^ xor_byte;
  2024. X  xor_byte = (getc(fileptr) & 0xFF);
  2025. X  l |= (int32u)(c ^ xor_byte) << 8;
  2026. X  c = (getc(fileptr) & 0xFF);
  2027. X  l |= (int32u)(c ^ xor_byte) << 16;
  2028. X  xor_byte = (getc(fileptr) & 0xFF);
  2029. X  l |= (int32u)(c ^ xor_byte) << 24;
  2030. X  *ptr = l;
  2031. X}
  2032. X
  2033. Xstatic void rd_bytes(ch_ptr, count)
  2034. Xint8u *ch_ptr;
  2035. Xregister int count;
  2036. X{
  2037. X  register int i;
  2038. X  register int8u *ptr;
  2039. X  register int8u c;
  2040. X
  2041. X  ptr = ch_ptr;
  2042. X  for (i = 0; i < count; i++)
  2043. X    {
  2044. X      c = (getc(fileptr) & 0xFF);
  2045. X      *ptr++ = c ^ xor_byte;
  2046. X      xor_byte = c;
  2047. X    }
  2048. X}
  2049. X
  2050. X/* set the local fileptr to the scorefile fileptr */
  2051. Xvoid set_fileptr(file)
  2052. XFILE *file;
  2053. X{
  2054. X  fileptr = file;
  2055. X}
  2056. X
  2057. Xvoid rd_highscore(score)
  2058. Xhigh_scores *score;
  2059. X{
  2060. X  /* Read the encryption byte.  */
  2061. X  rd_byte (&xor_byte);
  2062. X
  2063. X  rd_long((int32u *)&score->points);
  2064. X  rd_long((int32u *)&score->birth_date);
  2065. X  rd_short((int16u *)&score->uid);
  2066. X  rd_short((int16u *)&score->mhp);
  2067. X  rd_short((int16u *)&score->chp);
  2068. X  rd_byte(&score->dun_level);
  2069. X  rd_byte(&score->lev);
  2070. X  rd_byte(&score->max_dlv);
  2071. X  rd_byte(&score->sex);
  2072. X  rd_byte(&score->race);
  2073. X  rd_byte(&score->class);
  2074. X  rd_bytes((int8u *)score->name, PLAYER_NAME_SIZE);
  2075. X  rd_bytes((int8u *)score->died_from, 25);
  2076. X}
  2077. END_OF_FILE
  2078. if test 4599 -ne `wc -c <'util/scores/print.c'`; then
  2079.     echo shar: \"'util/scores/print.c'\" unpacked with wrong size!
  2080. fi
  2081. # end of 'util/scores/print.c'
  2082. fi
  2083. if test -f 'vms/Makefile' -a "${1}" != "-c" ; then 
  2084.   echo shar: Will not clobber existing file \"'vms/Makefile'\"
  2085. else
  2086. echo shar: Extracting \"'vms/Makefile'\" \(4426 characters\)
  2087. sed "s/^X//" >'vms/Makefile' <<'END_OF_FILE'
  2088. X# COPTS = /nowarning
  2089. XCOPTS =
  2090. X
  2091. XOBJS1 = create.obj creature.obj death.obj desc.obj dungeon.obj eat.obj \
  2092. X    files.obj generate.obj getch.obj help.obj io.obj magic.obj main.obj \
  2093. X    misc1.obj misc2.obj misc3.obj misc4.obj monsters.obj
  2094. XOBJS2 = moria1.obj moria2.obj moria3.obj moria4.obj player.obj potions.obj \
  2095. X    prayer.obj recall.obj rnd.obj save.obj scrolls.obj sets.obj \
  2096. X    signals.obj spells.obj staffs.obj store1.obj store2.obj tables.obj
  2097. XOBJS3 =  treasure.obj uexit.obj variable.obj wands.obj wizard.obj
  2098. X
  2099. Xmoria : $(OBJS1) $(OBJS2) $(OBJS3)
  2100. X    link moria/opt
  2101. X
  2102. Xcreate.obj : create.c constant.h types.h externs.h config.h
  2103. X    cc $(COPTS) create.c /obj=create.obj
  2104. X
  2105. Xcreature.obj : creature.c constant.h types.h externs.h config.h
  2106. X    cc $(COPTS) creature.c /obj=creature.obj
  2107. X
  2108. Xdeath.obj : death.c constant.h types.h externs.h config.h
  2109. X    cc $(COPTS) death.c /obj=death.obj
  2110. X
  2111. Xdesc.obj : desc.c constant.h types.h externs.h config.h
  2112. X    cc $(COPTS) desc.c /obj=desc.obj
  2113. X
  2114. Xdungeon.obj : dungeon.c constant.h types.h externs.h config.h
  2115. X    cc $(COPTS) dungeon.c /obj=dungeon.obj
  2116. X
  2117. Xeat.obj : eat.c constant.h types.h externs.h config.h
  2118. X    cc $(COPTS) eat.c /obj=eat.obj
  2119. X
  2120. Xfiles.obj : files.c constant.h types.h externs.h config.h
  2121. X    cc $(COPTS) files.c /obj=files.obj
  2122. X
  2123. Xgenerate.obj : generate.c constant.h types.h externs.h config.h
  2124. X    cc $(COPTS) generate.c /obj=generate.obj
  2125. X
  2126. Xgetch.obj : getch.c
  2127. X    cc $(COPTS) getch.c /obj=getch.obj
  2128. X
  2129. Xhelp.obj : help.c constant.h types.h externs.h config.h
  2130. X    cc $(COPTS) help.c /obj=help.obj
  2131. X
  2132. Xio.obj : io.c constant.h types.h externs.h config.h
  2133. X    cc $(COPTS) io.c /obj=io.obj
  2134. X
  2135. Xmagic.obj : magic.c constant.h types.h externs.h config.h
  2136. X    cc $(COPTS) magic.c /obj=magic.obj
  2137. X
  2138. Xmain.obj : main.c constant.h types.h externs.h config.h
  2139. X    cc $(COPTS) main.c /obj=main.obj
  2140. X
  2141. Xmisc1.obj : misc1.c constant.h types.h externs.h config.h
  2142. X    cc $(COPTS) misc1.c /obj=misc1.obj
  2143. X
  2144. Xmisc2.obj : misc2.c constant.h types.h externs.h config.h
  2145. X    cc $(COPTS) misc2.c /obj=misc2.obj
  2146. X
  2147. Xmisc3.obj : misc3.c constant.h types.h externs.h config.h
  2148. X    cc $(COPTS) misc3.c /obj=misc3.obj
  2149. X
  2150. Xmisc4.obj : misc4.c constant.h types.h externs.h config.h
  2151. X    cc $(COPTS) misc4.c /obj=misc4.obj
  2152. X
  2153. Xmonsters.obj : monsters.c constant.h types.h config.h
  2154. X    cc $(COPTS) monsters.c /obj=monsters.obj
  2155. X
  2156. Xmoria1.obj : moria1.c constant.h types.h externs.h config.h
  2157. X    cc $(COPTS) moria1.c /obj=moria1.obj
  2158. X
  2159. Xmoria2.obj : moria2.c constant.h types.h externs.h config.h
  2160. X    cc $(COPTS) moria2.c /obj=moria2.obj
  2161. X
  2162. Xmoria3.obj : moria3.c constant.h types.h externs.h config.h
  2163. X    cc $(COPTS) moria3.c /obj=moria3.obj
  2164. X
  2165. Xmoria4.obj : moria4.c constant.h types.h externs.h config.h
  2166. X    cc $(COPTS) moria4.c /obj=moria4.obj
  2167. X
  2168. Xplayer.obj : player.c constant.h types.h config.h
  2169. X    cc $(COPTS) player.c /obj=player.obj
  2170. X
  2171. Xpotions.obj : potions.c constant.h types.h externs.h config.h
  2172. X    cc $(COPTS) potions.c /obj=potions.obj
  2173. X
  2174. Xprayer.obj : prayer.c constant.h types.h externs.h config.h
  2175. X    cc $(COPTS) prayer.c /obj=prayer.obj
  2176. X
  2177. Xrecall.obj : recall.c constant.h types.h externs.h config.h
  2178. X    cc $(COPTS) recall.c /obj=recall.obj
  2179. X
  2180. Xrnd.obj : rnd.c constant.h types.h
  2181. X    cc $(COPTS) rnd.c /obj=rnd.obj
  2182. X
  2183. Xsave.obj : save.c constant.h types.h externs.h config.h
  2184. X    cc $(COPTS) save.c /obj=save.obj
  2185. X
  2186. Xscrolls.obj : scrolls.c constant.h types.h externs.h config.h
  2187. X    cc $(COPTS) scrolls.c /obj=scrolls.obj
  2188. X
  2189. Xsets.obj : sets.c constant.h config.h
  2190. X    cc $(COPTS) sets.c /obj=sets.obj
  2191. X
  2192. Xsignals.obj : signals.c constant.h types.h externs.h config.h
  2193. X    cc $(COPTS) signals.c /obj=signals.obj
  2194. X
  2195. Xspells.obj : spells.c constant.h types.h externs.h config.h
  2196. X    cc $(COPTS) spells.c /obj=spells.obj
  2197. X
  2198. Xstaffs.obj : staffs.c constant.h types.h externs.h config.h
  2199. X    cc $(COPTS) staffs.c /obj=staffs.obj
  2200. X
  2201. Xstore1.obj : store1.c constant.h types.h externs.h config.h
  2202. X    cc $(COPTS) store1.c /obj=store1.obj
  2203. X
  2204. Xstore2.obj : store2.c constant.h types.h externs.h config.h
  2205. X    cc $(COPTS) store2.c /obj=store2.obj
  2206. X
  2207. Xtables.obj : tables.c constant.h types.h config.h
  2208. X    cc $(COPTS) tables.c /obj=tables.obj
  2209. X
  2210. Xtreasure.obj : treasure.c constant.h types.h config.h
  2211. X    cc $(COPTS) treasure.c /obj=treasure.obj
  2212. X
  2213. Xuexit.obj : uexit.c constant.h types.h config.h
  2214. X    cc $(COPTS) uexit.c /obj=uexit.obj
  2215. X
  2216. Xvariable.obj : variable.c constant.h types.h externs.h config.h
  2217. X    cc $(COPTS) variable.c /obj=variable.obj
  2218. X
  2219. Xwands.obj : wands.c constant.h types.h externs.h config.h
  2220. X    cc $(COPTS) wands.c /obj=wands.obj
  2221. X
  2222. Xwizard.obj : wizard.c constant.h types.h externs.h config.h
  2223. X    cc $(COPTS) wizard.c /obj=wizard.obj
  2224. X
  2225. X
  2226. END_OF_FILE
  2227. if test 4426 -ne `wc -c <'vms/Makefile'`; then
  2228.     echo shar: \"'vms/Makefile'\" unpacked with wrong size!
  2229. fi
  2230. # end of 'vms/Makefile'
  2231. fi
  2232. if test -f 'vms/getch.c' -a "${1}" != "-c" ; then 
  2233.   echo shar: Will not clobber existing file \"'vms/getch.c'\"
  2234. else
  2235. echo shar: Extracting \"'vms/getch.c'\" \(4982 characters\)
  2236. sed "s/^X//" >'vms/getch.c' <<'END_OF_FILE'
  2237. X/* vms/getch.c: input routines for VMS, integrated with smcurses for VMS
  2238. X
  2239. X   Copyright (c) 1986-92 Joshua Delahunty, James E. Wilson
  2240. X
  2241. X   This software may be copied and distributed for educational, research, and
  2242. X   not for profit purposes provided that this copyright and statement are
  2243. X   included in all such copies. */
  2244. X
  2245. X#include <iodef.h>
  2246. X#include <ssdef.h>
  2247. X#include <descrip.h>
  2248. X#include <stdio.h>
  2249. X
  2250. X#ifndef TRUE
  2251. X# define TRUE 1
  2252. X# define FALSE 0
  2253. X#endif
  2254. X
  2255. X/* the type of keyboard read we're doing */
  2256. X#define FUNC IO$_TTYREADALL|IO$M_NOECHO|IO$M_TRMNOECHO
  2257. X
  2258. X    static $DESCRIPTOR(chan, "tt:");
  2259. X    static char ungotch;
  2260. X    static unsigned short int kb_chan = 0;    /* channel # */
  2261. X    static unsigned short int    charwaiting = FALSE,
  2262. X                    crmode_status = TRUE,
  2263. X                    echo_status = FALSE;
  2264. X
  2265. X/* This code was tested and worked on a VAX 11/785 running VMS 5.2.
  2266. X   contributed by Ralph Waters, rwaters@jabba.ess.harris.com.  */
  2267. X
  2268. X/* Returns 1 is a character has been pressed, 0 otherwise.  */
  2269. Xint kbhit()
  2270. X{
  2271. X  /* sys$qiow ( [efn] ,chan ,func [,iosb] [,astadr] [,astprm]
  2272. X        [,p1] [,p2] [,p3] [,p4] [,p5] [,p6] )            */
  2273. X
  2274. X  /* The sys$qiow call with the IO$_SENSEMODE|IO$M_TYPEAHDCNT function
  2275. X     will return the following in p1:
  2276. X
  2277. X     31        24 23        16 15                     0
  2278. X     ------------|------------|------------------------
  2279. X     | reserved  |   first    | number of characters  |
  2280. X     |           | character  | in type-ahead buffer  |
  2281. X     |-----------|------------|-----------------------|
  2282. X     |                    reserved                    |
  2283. X     |                                                |
  2284. X     --------------------------------------------------
  2285. X  */
  2286. X
  2287. X  struct qio_return_type {
  2288. X     unsigned short int type_ahead_count;    /* type-ahead count */
  2289. X     unsigned char first_char;        /* first character in buffer */
  2290. X     unsigned char b_reserved;        /* reserved byte */
  2291. X     unsigned long int l_reserved; }    /* reserved long word */
  2292. X    qio_return;
  2293. X
  2294. X  sys$qiow (0, kb_chan, (IO$_SENSEMODE | IO$M_TYPEAHDCNT), 0, 0, 0,
  2295. X        &qio_return, 0, 0, 0, 0, 0);
  2296. X  if (qio_return.type_ahead_count > 0)
  2297. X    return(1);
  2298. X  else
  2299. X    return(0);
  2300. X}
  2301. X
  2302. X/* Another useful function courtesy of Ralph Waters.  */
  2303. X#include <jpidef.h>
  2304. X
  2305. X/* Stores the user's login name in the argument buf.  */
  2306. Xvoid user_name(buf)
  2307. Xchar *buf;
  2308. X{
  2309. X  /* sys$getjpiw ( [efn], [pidadr], [prcnam], itmlst [,iosb]
  2310. X                   [,astadr] [,astprm]                    */
  2311. X
  2312. X  long int return_length;
  2313. X  struct getjpi_itmlst_type {
  2314. X    unsigned short int buffer_length;    /* length of return buffer */
  2315. X    unsigned short int item_code;        /* item code to getjpi about */
  2316. X    unsigned long int buffer_address;    /* address of return data */
  2317. X    unsigned long int return_length_addr; }    /*actual size of return data */
  2318. X  getjpi_itmlst;
  2319. X
  2320. X  getjpi_itmlst.buffer_length = 12;    /* VMS usernames are 12 chars */
  2321. X  getjpi_itmlst.item_code = JPI$_USERNAME;
  2322. X  getjpi_itmlst.buffer_address = buf;
  2323. X  getjpi_itmlst.return_length_addr = &return_length;
  2324. X
  2325. X  sys$getjpiw (0, 0, 0, &getjpi_itmlst, 0, 0, 0);
  2326. X
  2327. X  return;
  2328. X}
  2329. X
  2330. X/* After calling this, vms_getch() returns unbuffered single chars.  */
  2331. Xvoid vms_crmode()    /* Character-Return MODE */
  2332. X{
  2333. X    if(kb_chan == 0)
  2334. X        opengetch();
  2335. X
  2336. X    crmode_status = TRUE;
  2337. X}
  2338. X
  2339. X/* After calling this, vms_getch() returns echoed, buffered characters.  */
  2340. Xvoid vms_nocrmode()    /* NO Character-Return MODE */
  2341. X{
  2342. X    if(kb_chan != 0)
  2343. X        closegetch();
  2344. X
  2345. X    crmode_status = FALSE;
  2346. X}
  2347. X
  2348. X/* Sets up terminal for getch() calls, returns VMS status code.  */
  2349. Xint opengetch()    /* does the actual assignment work */
  2350. X{
  2351. X    /* assign channel on keyboard */
  2352. X    return(sys$assign(&chan,&kb_chan,0,0));
  2353. X}
  2354. X
  2355. X/* Undoes affects of above, returns VMS status code for the operation.  */
  2356. Xint closegetch()    /* performs the actual deassignment work */
  2357. X{
  2358. X    int rv;
  2359. X
  2360. X    if(kb_chan != 0) {
  2361. X        /* deassign keyboard channel */
  2362. X        rv = sys$dassgn(kb_chan);
  2363. X        kb_chan = 0;
  2364. X        return(rv);
  2365. X    }
  2366. X}
  2367. X
  2368. X/* Returns an [optionally] unbuffered [non-]echoed input character.
  2369. X
  2370. X   If crmode_status is not set, then the code returns one character from
  2371. X   the buffered input.
  2372. X   If crmode_status is set, then the code returns an `ungot' character if
  2373. X   one exists, otherwise it tries to read one unbuffered character from the
  2374. X   keyboard.  If echo_status is set, then the character will be echoed
  2375. X   before returning.  */
  2376. Xchar vms_getch()
  2377. X{
  2378. X    int rv;
  2379. X    char kb_buf;                /* buffer for input char */
  2380. X
  2381. X    if(crmode_status) {
  2382. X
  2383. X        if(!charwaiting) {
  2384. X
  2385. X            /* open channel if it hasn't been done already */
  2386. X            if (kb_chan == 0)
  2387. X                opengetch();
  2388. X
  2389. X            /* que an i/o request for a character and wait */
  2390. X            rv = sys$qiow(0,kb_chan,FUNC,0,0,0,&kb_buf,1,0,0,0,0);
  2391. X
  2392. X            /* indicate if something is amiss */
  2393. X            if(rv != SS$_NORMAL) {
  2394. X                printf("?");
  2395. X                exit(rv);
  2396. X            }
  2397. X
  2398. X        } else { /* charwaiting */
  2399. X
  2400. X            kb_buf = ungotch;
  2401. X            charwaiting = FALSE;
  2402. X        }
  2403. X
  2404. X        /* massage for getchar() compatibility */
  2405. X        if (kb_buf == '\r') kb_buf='\n';
  2406. X
  2407. X        /* echo char if we're supposed to */
  2408. X        if (echo_status) putchar(kb_buf);
  2409. X
  2410. X        return(kb_buf);
  2411. X
  2412. X    } else    /* nocrmode */
  2413. X
  2414. X        return(getchar());
  2415. X
  2416. X}
  2417. END_OF_FILE
  2418. if test 4982 -ne `wc -c <'vms/getch.c'`; then
  2419.     echo shar: \"'vms/getch.c'\" unpacked with wrong size!
  2420. fi
  2421. # end of 'vms/getch.c'
  2422. fi
  2423. echo shar: End of archive 36 \(of 39\).
  2424. cp /dev/null ark36isdone
  2425. MISSING=""
  2426. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ; do
  2427.     if test ! -f ark${I}isdone ; then
  2428.     MISSING="${MISSING} ${I}"
  2429.     fi
  2430. done
  2431. if test "${MISSING}" = "" ; then
  2432.     echo You have unpacked all 39 archives.
  2433.     echo "Now run "bldfiles.sh" to build split files"
  2434.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2435. else
  2436.     echo You still need to unpack the following archives:
  2437.     echo "        " ${MISSING}
  2438. fi
  2439. ##  End of shell archive.
  2440. exit 0
  2441.