home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sources / games / 194 < prev    next >
Encoding:
Internet Message Format  |  1992-08-22  |  57.3 KB

  1. Path: sparky!uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v14i064:  umoria4 - single player dungeon simulation (ver. 5.5), Part32/39
  5. Message-ID: <3428@master.CNA.TEK.COM>
  6. Date: 22 Aug 92 22:14:46 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1957
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: grabiner@math.harvard.edu (David Grabiner)
  12. Posting-number: Volume 14, Issue 64
  13. Archive-name: umoria4/Part32
  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 32 (of 39)."
  26. # Contents:  ibmpc/TCCONFIG.TCU mac/macscore.c misc/damage.chg
  27. #   misc/wex.msg source/config.h source/wizard.c
  28. # Wrapped by billr@saab on Thu Aug 20 09:11:35 1992
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'ibmpc/TCCONFIG.TCU' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'ibmpc/TCCONFIG.TCU'\"
  32. else
  33. echo shar: Extracting \"'ibmpc/TCCONFIG.TCU'\" \(2402 characters\)
  34. sed "s/^X//" >'ibmpc/TCCONFIG.TCU' <<'END_OF_FILE'
  35. XA uuencoded copy of a TCCONFIG.TCU file.
  36. X
  37. Xbegin 640 TCCONFIG.TC
  38. XM5'5R8F\@0R!#;VYF:6=U<F%T:6]N($9I;&4@&@ !#1(7 1H  @$!  (  0 "
  39. XM  (  0 #  (  @ $  $   4  0  !@ !   (  $ !0D  @ !  T  @    X 
  40. XM @   !$  0 $$@ "  $ $P " !D %  "  $ %0 "  $ %@ "  ( %P "    
  41. XM&  "    9  !  %E  $  68  0 !9P !  %H  $  6D  0 !:@ !  %K  $ 
  42. XM 6P  0 !;0 !  %N  $  6\  0 !<  !  %Q  $  7(  0 !<P !  %T  $ 
  43. XM 74  0 !=@ !  %W  $  7@  0 !>0 !  %Z  $  7L  0  ?  !  %]  $ 
  44. XM 7X  0  ?P !  &   $  8(  0  A  !  "%  $  <@  0 !R0 !  #*  $ 
  45. XM LL  0  S  !  #-  $  ,X  0 !SP !  #0  $ &=$  0!DT@ ! "#5  $ 
  46. XM -<  0  V  !  #9  $  =H  0 !VP !  #<  $  -T  0 !W@ !  '?  $ 
  47. XM .   0  X0 !  #B  $  2P!1  N                                
  48. XM                                                         "T!
  49. XM@ !$.EQ455)"3UQ#7$E.0TQ51$4                                 
  50. XM                                                            
  51. XM                                                     "X!@ !$
  52. XM.EQ455)"3UQ#7$Q)0@                                          
  53. XM                                                            
  54. XM                                                 "\!4 !534]2
  55. XM24$N4%)*                                                    
  56. XM                                         # !!  S,@  ,0$% #(U
  57. XM    ,@$% #$P,   ,P%_ $U31$]3                                
  58. XM                                                            
  59. XM                                                            
  60. XM           T 1X *@                                      -0$>
  61. XM "H                                      #8!'@ J            
  62. XM                           W 1X *@                          
  63. XM            . $> "H                                      #D!
  64. XM'@ J                                       Z 1X *@          
  65. XM                            .P$> "H                         
  66. XM             #P!'@ J                                       ]
  67. XM 8                                                          
  68. XM                                                            
  69. XM                                                       ^ 00 
  70. XM-    #\!4 !40U!)0TLN5$,                                     
  71. XM                                                         $ !
  72. XM1 !$.EQ455)"3UQ#7$))3@                                      
  73. XM                                 $$!4                       
  74. XM                                                            
  75. X9                         /__ @ :    
  76. Xend
  77. END_OF_FILE
  78. if test 2402 -ne `wc -c <'ibmpc/TCCONFIG.TCU'`; then
  79.     echo shar: \"'ibmpc/TCCONFIG.TCU'\" unpacked with wrong size!
  80. fi
  81. # end of 'ibmpc/TCCONFIG.TCU'
  82. fi
  83. if test -f 'mac/macscore.c' -a "${1}" != "-c" ; then 
  84.   echo shar: Will not clobber existing file \"'mac/macscore.c'\"
  85. else
  86. echo shar: Extracting \"'mac/macscore.c'\" \(10176 characters\)
  87. sed "s/^X//" >'mac/macscore.c' <<'END_OF_FILE'
  88. X/* mac/macscore.c: scorefile code
  89. X
  90. X   Copyright (c) 1989-1991 Curtis McCauley, James E. Wilson
  91. X
  92. X   This software may be copied and distributed for educational, research, and
  93. X   not for profit purposes provided that this copyright and statement are
  94. X   included in all such copies. */
  95. X
  96. X#include <stdio.h>
  97. X
  98. X#ifndef THINK_C
  99. X#include <Types.h>
  100. X#include <Resources.h>
  101. X#include <Events.h>
  102. X#include <Quickdraw.h>
  103. X#include <Fonts.h>
  104. X#include <Controls.h>
  105. X#include <Dialogs.h>
  106. X#include <TextEdit.h>
  107. X#include <Lists.h>
  108. X#include <Packages.h>
  109. X#include <Files.h>
  110. X#include <SysEqu.h>
  111. X#include <Errors.h>
  112. X
  113. X#include <String.h>
  114. X#include <Strings.h>
  115. X
  116. X#include <ScrnMgr.h>
  117. X
  118. X#else
  119. X
  120. X#include <string.h>
  121. X
  122. X#include "ScrnMgr.h"
  123. X
  124. X#define p2cstr(x)    (char *)PtoCstr((char *)x)
  125. X#define c2pstr(x)    (char *)CtoPstr((char *)x)
  126. X
  127. X#endif
  128. X
  129. X#include "config.h"
  130. X#include "constant.h"
  131. X#include "types.h"
  132. X#include "externs.h"
  133. X
  134. X#define maxEntries                100
  135. X
  136. X#define horizIndent                4                /* same as std LDEF 0 */
  137. X
  138. X#define ldefType                'LDEF'
  139. X#define ldefID                    514
  140. X
  141. X#define scoresDlgID                514
  142. X#define dfltBorder                2
  143. X#define listBox                    3
  144. X#define titleBox                4
  145. X
  146. X#define codeEnter                0x03
  147. X#define codeReturn                0x0D
  148. X
  149. X#ifdef THINK_C
  150. X/* Cover up error in THINK C library.  */
  151. X#define ok    OK
  152. X#define cancel    Cancel
  153. X#endif
  154. X
  155. Xtypedef struct LDEFRec {
  156. X    short braInstruction;
  157. X    short flags;
  158. X    int32 resType;
  159. X    short resID;
  160. X    short version;
  161. X    short jmpInstuction;
  162. X#ifdef THINK_C
  163. X    void (*defProc)();
  164. X#else
  165. X    pascal void (*defProc)();
  166. X#endif
  167. X} LDEFRec, *LDEFPtr, **LDEFHandle;
  168. X
  169. Xstatic short scoresRefNum;
  170. X
  171. Xstatic short lastVisTop;
  172. Xstatic Rect titleRect;
  173. X
  174. Xstatic ControlHandle okButton;
  175. X
  176. Xstatic ListHandle theList;
  177. X
  178. Xvoid CreateScoreFile()
  179. X
  180. X{
  181. X    Str255 fileName;
  182. X    OSErr err;
  183. X
  184. X    strncpy((char *)fileName, MORIA_TOP, 255);
  185. X    fileName[255] = '\0';
  186. X    (void) c2pstr(fileName);
  187. X
  188. X    appldirectory();
  189. X    err = FSOpen(fileName, 0, &scoresRefNum);
  190. X    if (err == noErr)
  191. X        (void) FSClose(scoresRefNum);
  192. X    else
  193. X        err = Create(fileName, 0, MORIA_FCREATOR, SCORE_FTYPE);
  194. X    restoredirectory();
  195. X
  196. X    if (err != noErr)
  197. X        alert_error("Ooops!  Could not create the high scores \
  198. Xfile.  Disk may be locked.");
  199. X
  200. X    return;
  201. X}
  202. X
  203. Xvoid EnterScoreFile(theScore)
  204. Xint32 *theScore;
  205. X
  206. X{
  207. X#if 0
  208. X    Str255 fileName;
  209. X    OSErr err;
  210. X    Boolean bump, append;
  211. X    int32 i, pos, count;
  212. X    int32 prev, next;
  213. X    char message[80];
  214. X
  215. X    strncpy(fileName, MORIA_TOP, 255);
  216. X    fileName[255] = '\0';
  217. X    (void) c2pstr(fileName);
  218. X
  219. X    appldirectory();
  220. X    err = FSOpen(fileName, 0, &scoresRefNum);
  221. X    restoredirectory();
  222. X
  223. X    if (err != noErr) {
  224. X        alert_error("Sorry.  High scores file could not be opened.");
  225. X        return;
  226. X    }
  227. X
  228. X    bump = false;
  229. X    append = false;
  230. X
  231. X    prev = *theScore;
  232. X
  233. X    for (i = 0, pos = 0; i < maxEntries; pos += sizeof(int32), i++) {
  234. X
  235. X        count = sizeof(int32);
  236. X        err = FSRead(scoresRefNum, &count, (Ptr) &next);
  237. X
  238. X        if (err == noErr)
  239. X            bump = (bump) || (prev.points >= next.points);
  240. X        else if (err == eofErr)
  241. X            append = true;
  242. X        else
  243. X            break;
  244. X
  245. X        if ( (!bump) && (!append) ) continue;
  246. X
  247. X        SetFPos(scoresRefNum, fsFromStart, pos);
  248. X
  249. X        count = sizeof(int32);
  250. X        err = FSWrite(scoresRefNum, &count, (Ptr) &prev);
  251. X
  252. X        if ( (err != noErr) || (append) ) break;
  253. X
  254. X        prev = next;
  255. X
  256. X    }
  257. X
  258. X    (void) FSClose(scoresRefNum);
  259. X
  260. X    if (err != noErr) {
  261. X        sprintf(message, "Bad news.  Error %d while updating scores file.", err);
  262. X        alert_error(message);
  263. X    }
  264. X
  265. X    return;
  266. X#else
  267. X#pragma unused(theScore)
  268. X#endif
  269. X}
  270. X
  271. Xstatic void Init(list)
  272. XListHandle list;
  273. X
  274. X{
  275. X    GrafPtr thePort;
  276. X    FontInfo fi;
  277. X    short saveFont, saveSize;
  278. X
  279. X    GetPort(&thePort);
  280. X
  281. X    saveFont = thePort->txFont;
  282. X    saveSize = thePort->txSize;
  283. X
  284. X    TextFont(monaco);
  285. X    TextSize(9);
  286. X
  287. X    GetFontInfo(&fi);
  288. X
  289. X    TextFont(saveFont);
  290. X    TextSize(saveSize);
  291. X
  292. X    (*list)->indent.v = fi.ascent;
  293. X    (*list)->indent.h = horizIndent;
  294. X
  295. X    return;
  296. X}
  297. X
  298. Xstatic void Draw(scoreptr, clip, indent)
  299. Xint32 *scoreptr;
  300. XRect *clip;
  301. XPoint indent;
  302. X
  303. X{
  304. X#if 0
  305. X    char line[80];
  306. X    GrafPtr thePort;
  307. X    short saveFont, saveSize;
  308. X
  309. X    if (scoreptr != NULL) {
  310. X        (void) sprintf(line, "%-7d%-15.15s%-10.10s%-10.10s%-5d%-25.25s%5d",
  311. X                        (int32) scoreptr->points, scoreptr->name,
  312. X                        race[scoreptr->prace].trace, class[scoreptr->pclass].title,
  313. X                        (int32) scoreptr->lev, scoreptr->died_from, scoreptr->dun_level);
  314. X        (void) c2pstr(line);
  315. X    }
  316. X    else
  317. X        (void) c2pstr(strcpy(line, "No Scores\311"));
  318. X
  319. X    GetPort(&thePort);
  320. X
  321. X    saveFont = thePort->txFont;
  322. X    saveSize = thePort->txSize;
  323. X
  324. X    TextFont(monaco);
  325. X    TextSize(9);
  326. X
  327. X    PenNormal();
  328. X    EraseRect(clip);
  329. X
  330. X    MoveTo(clip->left + indent.h, clip->top + indent.v);
  331. X    DrawString(line);
  332. X
  333. X    TextFont(saveFont);
  334. X    TextSize(saveSize);
  335. X
  336. X    return;
  337. X#else
  338. X#pragma unused(scoreptr, clip, indent)
  339. X#endif
  340. X}
  341. X
  342. Xstatic pascal void HighScoresLDEF(msg, select, clip, cno, dataOffset,
  343. X                  dataLen, list)
  344. Xshort msg;
  345. XBoolean select;
  346. XRect *clip;
  347. XCell cno;
  348. Xshort dataOffset, dataLen;
  349. XListHandle list;
  350. X
  351. X{
  352. X#ifndef THINK_C
  353. X    #pragma unused(select, cno, dataLen)
  354. X#endif
  355. X    short offset;
  356. X    int32 count;
  357. X    int32 score;
  358. X
  359. X    switch (msg) {
  360. X
  361. X        case lInitMsg:
  362. X            Init(list);
  363. X            break;
  364. X
  365. X        case lDrawMsg:
  366. X            offset = *((short *) (*(*list)->cells + dataOffset));
  367. X            if (offset == -1) {
  368. X                Draw(NULL, clip, (*list)->indent);
  369. X            }
  370. X            else {
  371. X                count = sizeof(int32);
  372. X                (void) SetFPos(scoresRefNum, fsFromStart, (int32) offset);
  373. X                (void) FSRead(scoresRefNum, &count, (Ptr) &score);
  374. X                Draw(&score, clip, (*list)->indent);
  375. X            }
  376. X            break;
  377. X
  378. X    }
  379. X
  380. X    return;
  381. X}
  382. X
  383. Xstatic void InvalScoreRange()
  384. X
  385. X{
  386. X    char from[8], to[8];
  387. X    short first, last;
  388. X
  389. X    first = (*theList)->visible.top + 1;
  390. X    last = (*theList)->visible.bottom;
  391. X    if (last > (*theList)->dataBounds.bottom)
  392. X      last = (*theList)->dataBounds.bottom;
  393. X
  394. X    NumToString(first, from);
  395. X    NumToString(last, to);
  396. X
  397. X    ParamText(from, to, NULL, NULL);
  398. X
  399. X    InvalRect(&titleRect);
  400. X
  401. X    lastVisTop = (*theList)->visible.top;
  402. X
  403. X    return;
  404. X}
  405. X
  406. Xstatic pascal Boolean ScoresDlgFilter(theDialog, theEvent, itemHit)
  407. XDialogPtr theDialog;
  408. XEventRecord *theEvent;
  409. Xshort *itemHit;
  410. X
  411. X{
  412. X    GrafPtr oldPort;
  413. X    Point localPt;
  414. X    WindowPtr theWindow;
  415. X    ControlHandle theControl;
  416. X    Boolean handled;
  417. X    char key;
  418. X    short part;
  419. X
  420. X    handled = false;
  421. X
  422. X    switch (theEvent->what) {
  423. X
  424. X        case keyDown:
  425. X            key = theEvent->message & charCodeMask;
  426. X            if ( (key == codeEnter) || (key == codeReturn) ) {
  427. X                handled = true;
  428. X                HiliteControl(okButton, inButton);
  429. X                *itemHit = ok;
  430. X            }
  431. X            break;
  432. X
  433. X        case mouseDown:
  434. X            part = FindWindow(theEvent->where, &theWindow);
  435. X            if ( (theWindow == (WindowPtr) theDialog) && (part == inContent) ) {
  436. X                GetPort(&oldPort);
  437. X                SetPort((GrafPtr) theWindow);
  438. X                localPt = theEvent->where;
  439. X                GlobalToLocal(&localPt);
  440. X                part = FindControl(localPt, theWindow, &theControl);
  441. X                if (theControl == (*theList)->vScroll) {
  442. X                    handled = true;
  443. X                    (void) LClick(localPt, theEvent->modifiers, theList);
  444. X                    if ((*theList)->visible.top != lastVisTop) InvalScoreRange();
  445. X                    *itemHit = listBox;
  446. X                }
  447. X                SetPort(oldPort);
  448. X            }
  449. X            break;
  450. X
  451. X    }
  452. X
  453. X    return(handled);
  454. X}
  455. X
  456. Xstatic pascal void DrawListBox(theWindow, theItem)
  457. XWindowPtr theWindow;
  458. Xshort theItem;
  459. X
  460. X{
  461. X    GrafPtr thePort;
  462. X    short saveFont, saveSize;
  463. X    short itsType;
  464. X    Handle itsHandle;
  465. X    Rect itsRect;
  466. X
  467. X    GetDItem((DialogPtr) theWindow, theItem, &itsType, &itsHandle, &itsRect);
  468. X
  469. X    GetPort(&thePort);
  470. X
  471. X    saveFont = thePort->txFont;
  472. X    saveSize = thePort->txSize;
  473. X
  474. X    TextFont(monaco);
  475. X    TextSize(9);
  476. X
  477. X    MoveTo(itsRect.left + (*theList)->indent.h + 1,
  478. X           itsRect.top + (*theList)->indent.v);
  479. X    DrawString("\pPoints Name           Race      Class     Lv   Killed \
  480. XBy                Dun Lv");
  481. X
  482. X    TextFont(saveFont);
  483. X    TextSize(saveSize);
  484. X
  485. X    itsRect.top += (*theList)->cellSize.v;
  486. X    FrameRect(&itsRect);
  487. X
  488. X    EraseRect(&(*theList)->rView);
  489. X    LUpdate(theWindow->visRgn, theList);
  490. X
  491. X    return;
  492. X}
  493. X
  494. Xvoid DoScoresDlg()
  495. X
  496. X{
  497. X    Str255 fileName;
  498. X    OSErr err;
  499. X    int32 bytes;
  500. X    short entries;
  501. X    GrafPtr oldPort;
  502. X    FontInfo fi;
  503. X    short saveFont, saveSize;
  504. X    DialogPtr theDialog;
  505. X    Handle itsHandle;
  506. X    Handle ldef;
  507. X    short itemHit;
  508. X    short itsType;
  509. X    Rect itsRect;
  510. X    Rect listRect, cellRect;
  511. X    Point cellSize;
  512. X    int32 i;
  513. X    int32 h, v;
  514. X    Point cno;
  515. X    short offset;
  516. X
  517. X    CreateScoreFile();
  518. X
  519. X    strncpy((char *)fileName, MORIA_TOP, 255);
  520. X    fileName[255] = '\0';
  521. X    (void) c2pstr(fileName);
  522. X
  523. X    appldirectory();
  524. X    err = FSOpen(fileName, 0, &scoresRefNum);
  525. X    restoredirectory();
  526. X
  527. X    if (err != noErr) {
  528. X        alert_error("Sorry.  High scores file could not be opened.");
  529. X        return;
  530. X    }
  531. X
  532. X    (void) GetEOF(scoresRefNum, &bytes);
  533. X    entries = bytes / sizeof(int32);
  534. X
  535. X    theDialog = GetNewDialog(scoresDlgID, nil, (WindowPtr) -1);
  536. X
  537. X    GetPort(&oldPort);
  538. X    SetPort((GrafPtr) theDialog);
  539. X
  540. X    saveFont = theDialog->txFont;
  541. X    saveSize= theDialog->txSize;
  542. X
  543. X    TextFont(monaco);
  544. X    TextSize(9);
  545. X
  546. X    GetFontInfo(&fi);
  547. X
  548. X    TextFont(saveFont);
  549. X    TextSize(saveSize);
  550. X
  551. X    CenterScreenDLOG(scoresDlgID, fixHalf, fixHalf, &h, &v);
  552. X    MoveWindow((WindowPtr) theDialog, (short) h, (short) v, false);
  553. X
  554. X    GetDItem(theDialog, ok, &itsType, (Handle *) &okButton, &itsRect);
  555. X    InsetRect(&itsRect, -4, -4);
  556. X
  557. X    SetDItem(theDialog, dfltBorder, userItem, (Handle) DrawDefaultBorder,
  558. X         &itsRect);
  559. X
  560. X    GetDItem(theDialog, titleBox, &itsType, &itsHandle, &titleRect);
  561. X
  562. X    GetDItem(theDialog, listBox, &itsType, &itsHandle, &listRect);
  563. X
  564. X    SetPt(&cellSize, listRect.right - listRect.left - 2,
  565. X          fi.ascent + fi.descent + fi.leading);
  566. X
  567. X    listRect.bottom =
  568. X        listRect.top +
  569. X        ((listRect.bottom - listRect.top - 2) / cellSize.v) * cellSize.v +
  570. X        2;
  571. X
  572. X    SetDItem(theDialog, listBox, userItem, (Handle) DrawListBox, &listRect);
  573. X
  574. X    InsetRect(&listRect, 1, 1);
  575. X    listRect.top += cellSize.v;
  576. X    listRect.right -= 15;
  577. X
  578. X    ldef = GetResource(ldefType, ldefID);
  579. X    MoveHHi(ldef);
  580. X    HLock(ldef);
  581. X
  582. X    (*((LDEFHandle) ldef))->defProc = HighScoresLDEF;
  583. X
  584. X    SetRect(&cellRect, 0, 0, 1, entries ? entries : 1);
  585. X
  586. X    theList = LNew(
  587. X        &listRect, &cellRect, cellSize,
  588. X        ldefID, (WindowPtr) theDialog,
  589. X        false, false, false, true);
  590. X
  591. X    if (!entries) {
  592. X        offset = -1;
  593. X        SetPt(&cno, 0, 0);
  594. X        LSetCell((Ptr) &offset, (short) sizeof(offset), cno, theList);
  595. X    }
  596. X    else {
  597. X        for (i = 0, offset = 0; i < entries; i++, offset += sizeof(int32)) {
  598. X            SetPt(&cno, 0, i);
  599. X            LSetCell((Ptr) &offset, (short) sizeof(offset), cno, theList);
  600. X        }
  601. X    }
  602. X
  603. X    LDoDraw(true, theList);
  604. X
  605. X    InvalScoreRange();
  606. X
  607. X    ShowWindow((WindowPtr) theDialog);
  608. X
  609. X    do {
  610. X        ModalDialog(ScoresDlgFilter, &itemHit);
  611. X    } while (itemHit != ok);
  612. X
  613. X    LDispose(theList);
  614. X
  615. X    HUnlock(ldef);
  616. X
  617. X    SetPort(oldPort);
  618. X
  619. X    DisposDialog(theDialog);
  620. X
  621. X    (void) FSClose(scoresRefNum);
  622. X
  623. X    return;
  624. X}
  625. END_OF_FILE
  626. if test 10176 -ne `wc -c <'mac/macscore.c'`; then
  627.     echo shar: \"'mac/macscore.c'\" unpacked with wrong size!
  628. fi
  629. # end of 'mac/macscore.c'
  630. fi
  631. if test -f 'misc/damage.chg' -a "${1}" != "-c" ; then 
  632.   echo shar: Will not clobber existing file \"'misc/damage.chg'\"
  633. else
  634. echo shar: Extracting \"'misc/damage.chg'\" \(10400 characters\)
  635. sed "s/^X//" >'misc/damage.chg' <<'END_OF_FILE'
  636. XFrom grabiner@zariski.harvard.edu Sun Nov 18 11:55:11 1990
  637. XReceived: from ernie.Berkeley.EDU by ylem.berkeley.edu (5.61/1.34)
  638. X    id AA19024; Sun, 18 Nov 90 11:55:09 -0800
  639. XReceived: from brauer.harvard.edu by ernie.Berkeley.EDU (5.63/1.41)
  640. X    id AA04665; Sun, 18 Nov 90 12:02:59 -0800
  641. XDate: Sun, 18 Nov 90 15:03:18 EST
  642. XFrom: grabiner@zariski.harvard.edu (David Grabiner)
  643. XMessage-Id: <9011182003.AA02675@brauer.harvard.edu>
  644. XTo: wilson@ernie.Berkeley.EDU
  645. XSubject: Patch file fixed; now it compiles
  646. XStatus: RO
  647. X
  648. X
  649. XI made some stupid typos in the patch file I sent you Friday.  Now
  650. XI have compiled the program with the revise patch file, and checked
  651. Xthat it works.  Here is the corrected patch file.
  652. X
  653. X*** misc2.c.~1~    Fri Nov 16 22:08:51 1990
  654. X--- misc2.c    Sat Nov 17 00:10:07 1990
  655. X***************
  656. X*** 981,987 ****
  657. X      }
  658. X      }
  659. X    prt_num("+ To Hit    ", m_ptr->dis_th,  9, 1);
  660. X!   prt_num("+ To Damage ", m_ptr->dis_td, 10, 1);
  661. X    prt_num("+ To AC     ", m_ptr->dis_tac, 11, 1);
  662. X    prt_num("  Total AC  ", m_ptr->dis_ac, 12, 1);
  663. X  }
  664. X--- 981,987 ----
  665. X      }
  666. X      }
  667. X    prt_num("+ To Hit    ", m_ptr->dis_th,  9, 1);
  668. X!   prt_num("Damage Bonus", m_ptr->dis_td, 10, 1);
  669. X    prt_num("+ To AC     ", m_ptr->dis_tac, 11, 1);
  670. X    prt_num("  Total AC  ", m_ptr->dis_ac, 12, 1);
  671. X  }
  672. X***************
  673. X*** 2253,2260 ****
  674. X--- 2253,2273 ----
  675. X      }
  676. X  }
  677. X
  678. X+ /* Add damage bonus to weapon damage            -DJG-    */
  679. X+ /* Damage bonuses have greater effect on larger weapon damages,
  680. X+    so that daggers are not the best weapons in the game.    */
  681. X+ int add_dam_bonus(dam, bonus)
  682. X+ register int dam, bonus;
  683. X+ {
  684. X+   /* Add 2 to dam, multiply by 1+(bonus/9), round off, subtract 2;
  685. X+      thus bonus is added unchanged to a damage of 7 points, halved
  686. X+      on 1d4 damage, and nearly doubled on 4d6 damage */
  687. X+   return ((((dam+2) * (18+(2*bonus)) + 9) / 18) - 2);
  688. X+ }
  689. X
  690. X  /* Special damage due to magical abilities of object    -RAK-    */
  691. X+ /* Multipliers have been reduced here, but they now apply to
  692. X+    magical bonuses as well                -DJG-    */
  693. X  int tot_dam(i_ptr, tdam, monster)
  694. X  register inven_type *i_ptr;
  695. X  register int tdam;
  696. X***************
  697. X*** 2280,2286 ****
  698. X        /* Slay Dragon  */
  699. X        if ((m_ptr->cdefense & CD_DRAGON) && (i_ptr->flags & TR_SLAY_DRAGON))
  700. X      {
  701. X!       tdam = tdam * 4;
  702. X        r_ptr->r_cdefense |= CD_DRAGON;
  703. X      }
  704. X        /* Slay Undead  */
  705. X--- 2293,2299 ----
  706. X        /* Slay Dragon  */
  707. X        if ((m_ptr->cdefense & CD_DRAGON) && (i_ptr->flags & TR_SLAY_DRAGON))
  708. X      {
  709. X!       tdam = tdam * 5 / 2;
  710. X        r_ptr->r_cdefense |= CD_DRAGON;
  711. X      }
  712. X        /* Slay Undead  */
  713. X***************
  714. X*** 2292,2298 ****
  715. X             && (i_ptr->flags & TR_SLAY_UNDEAD))
  716. X  #endif
  717. X      {
  718. X!       tdam = tdam * 3;
  719. X        r_ptr->r_cdefense |= CD_UNDEAD;
  720. X      }
  721. X        /* Slay Animal  */
  722. X--- 2305,2311 ----
  723. X             && (i_ptr->flags & TR_SLAY_UNDEAD))
  724. X  #endif
  725. X      {
  726. X!       tdam = tdam * 2;
  727. X        r_ptr->r_cdefense |= CD_UNDEAD;
  728. X      }
  729. X        /* Slay Animal  */
  730. X***************
  731. X*** 2299,2311 ****
  732. X        else if ((m_ptr->cdefense & CD_ANIMAL)
  733. X             && (i_ptr->flags & TR_SLAY_ANIMAL))
  734. X      {
  735. X!       tdam = tdam * 2;
  736. X        r_ptr->r_cdefense |= CD_ANIMAL;
  737. X      }
  738. X        /* Slay Evil     */
  739. X        else if ((m_ptr->cdefense & CD_EVIL) && (i_ptr->flags & TR_SLAY_EVIL))
  740. X      {
  741. X!       tdam = tdam * 2;
  742. X        r_ptr->r_cdefense |= CD_EVIL;
  743. X      }
  744. X        /* Frost           */
  745. X--- 2312,2324 ----
  746. X        else if ((m_ptr->cdefense & CD_ANIMAL)
  747. X             && (i_ptr->flags & TR_SLAY_ANIMAL))
  748. X      {
  749. X!       tdam = tdam * 3 / 2;
  750. X        r_ptr->r_cdefense |= CD_ANIMAL;
  751. X      }
  752. X        /* Slay Evil     */
  753. X        else if ((m_ptr->cdefense & CD_EVIL) && (i_ptr->flags & TR_SLAY_EVIL))
  754. X      {
  755. X!       tdam = tdam * 3 / 2;
  756. X        r_ptr->r_cdefense |= CD_EVIL;
  757. X      }
  758. X        /* Frost           */
  759. X***************
  760. X*** 2317,2323 ****
  761. X             && (i_ptr->flags & TR_FROST_BRAND))
  762. X  #endif
  763. X      {
  764. X!       tdam = tdam * 3 / 2;
  765. X        r_ptr->r_cdefense |= CD_FROST;
  766. X      }
  767. X        /* Fire          */
  768. X--- 2330,2336 ----
  769. X             && (i_ptr->flags & TR_FROST_BRAND))
  770. X  #endif
  771. X      {
  772. X!       tdam = tdam * 5 / 4;
  773. X        r_ptr->r_cdefense |= CD_FROST;
  774. X      }
  775. X        /* Fire          */
  776. X***************
  777. X*** 2329,2335 ****
  778. X             && (i_ptr->flags & TR_FLAME_TONGUE))
  779. X  #endif
  780. X      {
  781. X!       tdam = tdam * 3 / 2;
  782. X        r_ptr->r_cdefense |= CD_FIRE;
  783. X      }
  784. X      }
  785. X--- 2342,2348 ----
  786. X             && (i_ptr->flags & TR_FLAME_TONGUE))
  787. X  #endif
  788. X      {
  789. X!       tdam = tdam * 5 / 4;
  790. X        r_ptr->r_cdefense |= CD_FIRE;
  791. X      }
  792. X      }
  793. X*** moria2.c.~1~    Fri Nov 16 21:59:04 1990
  794. X--- moria2.c    Sat Nov 17 00:10:04 1990
  795. X***************
  796. X*** 751,756 ****
  797. X--- 751,757 ----
  798. X        if (i_ptr->tval != TV_NOTHING)
  799. X          {
  800. X            k = pdamroll(i_ptr->damage);
  801. X+           k = add_dam_bonus(k, p_ptr->ptodam);
  802. X            k = tot_dam(i_ptr, k, monptr);
  803. X            k = critical_blow((int)i_ptr->weight, tot_tohit, k, CLA_BTH);
  804. X          }
  805. X***************
  806. X*** 757,765 ****
  807. X        else                  /* Bare hands!?  */
  808. X          {
  809. X            k = damroll(1, 1);
  810. X            k = critical_blow(1, 0, k, CLA_BTH);
  811. X          }
  812. X-       k += p_ptr->ptodam;
  813. X        if (k < 0)  k = 0;
  814. X
  815. X        if (py.flags.confuse_monster)
  816. X--- 758,766 ----
  817. X        else                  /* Bare hands!?  */
  818. X          {
  819. X            k = damroll(1, 1);
  820. X+           k = add_dam_bonus(k, p_ptr->ptodam);
  821. X            k = critical_blow(1, 0, k, CLA_BTH);
  822. X          }
  823. X        if (k < 0)  k = 0;
  824. X
  825. X        if (py.flags.confuse_monster)
  826. X*** treasure.c.~1~    Fri Nov 16 23:53:35 1990
  827. X--- treasure.c    Sat Nov 17 00:10:06 1990
  828. X***************
  829. X*** 169,175 ****
  830. X  {"& Small Sword"        ,0x00000000L,    TV_SWORD, '|',    /* 49*/
  831. X      0,      48,    22,   1,  75,    0,   0,     0,   0, {1,6}    ,  5},
  832. X  {"& Two-Handed Sword (Zweihander)",0x00000000L,    TV_SWORD, '|',    /* 50*/
  833. X!     0,    1000,    23,   1, 280,    0,   0,     0,   0, {4,6}    , 50},
  834. X  {"& Broken sword"        ,0x00000000L,    TV_SWORD, '|',    /* 51*/
  835. X      0,       0,    24,   1,  75,  -2,  -2,     0,   0, {1,1}    ,  0},
  836. X  {"& Ball and Chain"        ,0x00000000L,    TV_HAFTED, '\\',/* 52*/
  837. X--- 169,175 ----
  838. X  {"& Small Sword"        ,0x00000000L,    TV_SWORD, '|',    /* 49*/
  839. X      0,      48,    22,   1,  75,    0,   0,     0,   0, {1,6}    ,  5},
  840. X  {"& Two-Handed Sword (Zweihander)",0x00000000L,    TV_SWORD, '|',    /* 50*/
  841. X!     0,    1500,    23,   1, 280,    0,   0,     0,   0, {4,6}    , 50},
  842. X  {"& Broken sword"        ,0x00000000L,    TV_SWORD, '|',    /* 51*/
  843. X      0,       0,    24,   1,  75,  -2,  -2,     0,   0, {1,1}    ,  0},
  844. X  {"& Ball and Chain"        ,0x00000000L,    TV_HAFTED, '\\',/* 52*/
  845. X
  846. XFrom grabiner@math.harvard.edu Sun Nov 25 14:41:25 1990
  847. XReceived: from zariski.harvard.edu by ylem.berkeley.edu (5.61/1.34)
  848. X    id AA01764; Sun, 25 Nov 90 14:41:22 -0800
  849. XDate: Sun, 25 Nov 90 17:52:59 EST
  850. XFrom: grabiner@math.harvard.edu (David Grabiner)
  851. XMessage-Id: <9011252252.AA04462@zariski.harvard.edu>
  852. XTo: wilson@ylem.berkeley.edu
  853. XSubject: Re:  When damage bonuses get added in
  854. XStatus: RO
  855. X
  856. X>    In this patch, I also rewrote the damage code to add all bonuses and
  857. X>    then multiply, and compensated for the strengthening of ego weapons by
  858. X>    halving the extra multiplier; thus, in my patch, a SD weapon does 2.5x
  859. X>    damage, instead of 4x, and a FT does 1.25x, not 1.5x.
  860. X>
  861. X>This instantly makes all current spoilers obsolete, and will confuse a hell
  862. X>of a lot of people.
  863. X
  864. XThese same people have been confused by the present system.  Until I
  865. Xchecked the source code two weeks ago, I assumed that 2x damage meant 2x
  866. Xdamage, so that a blow which would have done 15 would do 45 if the
  867. Xweapon was SU.  I proposed this change in order to keep the actual
  868. Xeffects, rather than the multipliers, comparable.
  869. X
  870. X>On the other hand, reducing the pluses for EGO weapons
  871. X>seems less confusing since it won't obsolete the spoilers list and is less
  872. X>noticable to the players.  I would like a good reason before making your
  873. X>change; I will have to think about this.  A change of this magnutude
  874. X>should probably include a change to the minor version number, i.e. 5.3.0
  875. X>to make it easier to remember where the change occurs.
  876. X
  877. XIf the pluses for ego weapons are reduced, the effect won't be that
  878. Xgreat, because you can always enchant an ego weapon up to about +8.
  879. XAlso, strength and ring of increase damage bonuses will still be
  880. Xmultiplied.
  881. X
  882. XIn particular, SU and SD will become much more powerful no matter what
  883. Xis done.  A typical SD, say 2d6, +8, does 15 normally, 36 to dragons,
  884. Xunder the old system.  It would do 36 to dragons under the new system
  885. Xeven if its damage bonus were reduced to +2 (adding -3 instead of +3
  886. Xwhen the ego weapon was generated), and at +2, it would be very easy to
  887. Xenchant.  And this does not even consider the fact that SD weapons are
  888. Xusually wielded by players who have high strength and damage bonuses
  889. Xfrom other items.
  890. X
  891. XIt would be possible just to weaken ego weapons by removing all of their
  892. Xextra bonuses to hit and damage, except for DF's, which aren't helped by
  893. Xthe change at all and thus should keep their bonuses, and HA's, which
  894. Xmight keep +2 to hit and +2 to damage.  This would still strengthen all
  895. Xego weapons except DF's significantly.  We might compensate for such a
  896. Xchange by removing the 3/2 multiplier for the chance of ego weapons, but
  897. Xwe have still given a great reward to the player who finds a HA.
  898. X
  899. XThe only sensible alternative I can see is to leave the old system for
  900. Xcalculating damage, and to compute the added damage bonus with my
  901. Xfunction, then multiply for ego weapons and critical hits, and then add
  902. Xin the added damage bonus.
  903. X
  904. X>Also, your patch makes it much harder for people to figure out how two
  905. X>weapons compare, because the damage formula is now more complicated,
  906. X>and can not be easily calculated from the info available on screen.
  907. X>Fixing the damage shown by the 'C' command would help, that should be easy.
  908. X
  909. XThe damage should probably be displayed as
  910. X
  911. XDamage Bonus: +8(+12)
  912. X
  913. Xwith the +8 the sum of all your bonuses, and the +12 the rounded-off
  914. Xbonus as it applies to the average damage of your current weapon (or
  915. Xto 1d1 if you have no weapon wielded).
  916. X
  917. X>Or maybe use a simpler formula, for example a +1 weapons does 10% more
  918. X>damage than normal (minimum of 1 extra damage point), and a +10 weapon
  919. X>does twice normal damage, although this is probably far too much of a
  920. X>difference between light and heavy weapons.
  921. X
  922. XI thought of this before, and rejected it because this had too great an
  923. Xeffect on daggers.  That's why I included the 2-point offset, so that a
  924. X+9 weapon doubles the quantity (damage+2).
  925. X
  926. XDavid Grabiner, grabiner@zariski.harvard.edu
  927. X"We are sorry, but the number you have dialed is imaginary."
  928. X"Please rotate your phone 90 degrees and try again."
  929. XDisclaimer: I speak for no one and no one speaks for me...
  930. X
  931. END_OF_FILE
  932. if test 10400 -ne `wc -c <'misc/damage.chg'`; then
  933.     echo shar: \"'misc/damage.chg'\" unpacked with wrong size!
  934. fi
  935. # end of 'misc/damage.chg'
  936. fi
  937. if test -f 'misc/wex.msg' -a "${1}" != "-c" ; then 
  938.   echo shar: Will not clobber existing file \"'misc/wex.msg'\"
  939. else
  940. echo shar: Extracting \"'misc/wex.msg'\" \(10662 characters\)
  941. sed "s/^X//" >'misc/wex.msg' <<'END_OF_FILE'
  942. XFrom @MCC.COM:wex@MCC.COM Tue Sep 29 07:05:44 1987
  943. XReceived: from MCC.COM by ji.Berkeley.EDU (5.58/1.25)
  944. X    id AA07225; Tue, 29 Sep 87 07:05:40 PDT
  945. XReceived: from milano.SW.MCC.COM by MCC.COM with TCP; Tue 29 Sep 87 09:06:24-CDT
  946. XReceived: from banzai-inst by milano.SW.MCC.COM (5.52/STP1.51) 
  947. X    id AA19878; Tue, 29 Sep 87 09:05:12 CDT
  948. XDate: Tue, 29 Sep 87 09:04:58 CDT
  949. XFrom: Buckaroo Banzai <wex@MCC.COM>
  950. XMessage-Id: <8709291404.AA11679@banzai-inst.SW.MCC.COM>
  951. XReceived: by banzai-inst.SW.MCC.COM (3.2/STP1.14) 
  952. X    id AA11679; Tue, 29 Sep 87 09:04:58 CDT
  953. XTo: wilson@ji.Berkeley.EDU
  954. XIn-Reply-To: James E. Wilson's message of Mon, 28 Sep 87 20:11:15 PDT <8709290311.AA03868@ji.Berkeley.EDU>
  955. XSubject: UNIX Moria
  956. XStatus: RO
  957. X
  958. XNo, I haven't looked at your sources yet.  There are some serious bugs
  959. Xin the original, which I hope you caught (naturally, I didn't keep a
  960. Xlist of them :-( ).  I, too, corrected the zillions of spelling
  961. Xmistakes.  Mine doesn't pass lint or run on SYS V.  I haven't decided
  962. Xhow to deal with the rogue-ists who want to use h,j,k,l, etc.
  963. X
  964. XI do have a help program and an extended help library.  I've also made
  965. Xsome changes to make the game better.  EG:
  966. X
  967. X   - you can now recover items from thieving monsters.
  968. X
  969. X   - when monsters drop treasures, they are dropped where the player
  970. X   can recover them, instead of inside walls.
  971. X
  972. X   - priests' spells are a little better - they now have
  973. X   Word-Of-Recall as a high-level spell.
  974. X
  975. X   - breath weapons, fireballs, etc. now affect everyone in the blast
  976. X   radius, including the player and monsters.
  977. X
  978. X   - monsters are now a little smarter about which spells they use (eg
  979. X   no fireballs from range 1; no teleport-to-me spells from range 1).
  980. X
  981. X   - a number of useful hints/noises have been added (eg. a
  982. X   multiplying monster now goes 'POP'; some potions have helpful
  983. X   messages - not giveaways; just enough so that they don't all appear
  984. X   to be no-ops).
  985. X
  986. X   - there are error traps and messages (eg lots of places where there
  987. X   was no 'default' case on a switch) so that the game doesn't do
  988. X   funny things.
  989. X
  990. X   - the shops' inventories have been fixed up so that more and more-
  991. X   useful items are available  (shop inventories can now be multiple
  992. X   pages instead of just two).
  993. X
  994. X   - there's a Yes/No prompt for accepting a character or re-rolling.
  995. X
  996. X   - the save file is expanded so that the monster list is kept; as it
  997. X   was, you could escape a monster by saving and restoring.
  998. X
  999. X   - there was a bug whereby if you were carrying 10 +2,+2 arrows and
  1000. X   picked up 10 +0,+0 arrows you'd end up with 20 +2,+2 arrows.
  1001. X   That's fixed.  There was a bug whereby if you ever got too many
  1002. X   treasures on a level, the game could go into an infinite loop.
  1003. X
  1004. XThere are others, but I can't remember them off the top.  I assume the
  1005. Xmoria files are on ji.berkeley.edu?  What directory?
  1006. X
  1007. X--Alan
  1008. X
  1009. XFrom @MCC.COM:wex@MCC.COM Tue Sep 29 12:12:25 1987
  1010. XReceived: from MCC.COM by ji.Berkeley.EDU (5.58/1.25)
  1011. X    id AA10246; Tue, 29 Sep 87 12:12:21 PDT
  1012. XReceived: from milano.SW.MCC.COM by MCC.COM with TCP; Tue 29 Sep 87 14:12:48-CDT
  1013. XReceived: from banzai-inst by milano.SW.MCC.COM (5.52/STP1.51) 
  1014. X    id AA22469; Tue, 29 Sep 87 14:08:46 CDT
  1015. XDate: Tue, 29 Sep 87 14:08:33 CDT
  1016. XFrom: Buckaroo Banzai <wex@MCC.COM>
  1017. XMessage-Id: <8709291908.AA12132@banzai-inst.SW.MCC.COM>
  1018. XReceived: by banzai-inst.SW.MCC.COM (3.2/STP1.14) 
  1019. X    id AA12132; Tue, 29 Sep 87 14:08:33 CDT
  1020. XTo: wilson@ji.Berkeley.EDU
  1021. XIn-Reply-To: James E. Wilson's message of Tue, 29 Sep 87 11:11:15 PDT <8709291811.AA09240@ji.Berkeley.EDU>
  1022. XSubject: UNIX Moria
  1023. XStatus: RO
  1024. X
  1025. XIn some ways, I've made the game "easier," but I think it's more
  1026. Xbalanced.  EG: there's zillions of monsters that drain ST, DX, CO, so
  1027. XI made elven waybread restore those things.  I also found that priest
  1028. Xhad a huge advantage with Sense Invisible, so I made a Ring of See
  1029. XInvisible available in the Mages' shop.  (Of course, it's still
  1030. Xrandom, so it doesn't appear most of the time, but there's a chance.)
  1031. XThere are a couple of other minor tweaks like that.
  1032. X
  1033. XThe reroll-character option was the first request I got from my
  1034. Xplaytesters.  I sort of agree - some days I want to play a mage and
  1035. Xit's stupid for me to have to quit lots of games.
  1036. X
  1037. XAnother *major* change:  I've improved the scoring algorithm.  It used
  1038. Xto count just gold and exp.  Now I add in a bunch of other things.
  1039. XThe total score is higher, and the overall effect is to reward smart
  1040. Xplay (eg if you've spent all your gold to improve your weapon to +4,+4
  1041. XI now recognize and reward that as if you still had the gold).
  1042. X
  1043. XWe should get together and merge our ideas if possible, no?
  1044. X
  1045. X--Alan
  1046. X
  1047. XFrom @MCC.COM:wex@MCC.COM Wed Sep 30 09:02:55 1987
  1048. XReceived: from MCC.COM by ji.Berkeley.EDU (5.58/1.25)
  1049. X    id AA21194; Wed, 30 Sep 87 09:02:52 PDT
  1050. XReceived: from milano.SW.MCC.COM by MCC.COM with TCP; Wed 30 Sep 87 11:02:14-CDT
  1051. XReceived: from banzai-inst by milano.SW.MCC.COM (5.52/STP1.51) 
  1052. X    id AA12165; Wed, 30 Sep 87 11:02:08 CDT
  1053. XDate: Wed, 30 Sep 87 11:01:54 CDT
  1054. XFrom: Buckaroo Banzai <wex@MCC.COM>
  1055. XMessage-Id: <8709301601.AA14128@banzai-inst.SW.MCC.COM>
  1056. XReceived: by banzai-inst.SW.MCC.COM (3.2/STP1.14) 
  1057. X    id AA14128; Wed, 30 Sep 87 11:01:54 CDT
  1058. XTo: wilson@ji.Berkeley.EDU
  1059. XIn-Reply-To: James E. Wilson's message of Tue, 29 Sep 87 14:05:51 PDT <8709292105.AA11513@ji.Berkeley.EDU>
  1060. XSubject: UNIX Moria
  1061. XStatus: RO
  1062. X
  1063. XGot the files transferred and compiled.  You haven't reorganized them,
  1064. XI see.  I got bloody tired of trying to figure out which routines were
  1065. Xin what file (main, moria1, moria2, misc1, misc2?? - BLEAH) and
  1066. Xrestructured the code into more logical modules.  The sizes even out
  1067. Xbetter, too.
  1068. X
  1069. XYou also seem to have the problem that's been plaguing me - monsters
  1070. Xaren't always visible when they ought to be, especially in dark rooms
  1071. Xand corridors.  I think there's something wrong in draw_block().
  1072. XDrat!  I was hoping you'd solved that one.
  1073. X
  1074. XCan I transfer you a copy of my code so you can see what I've done?
  1075. XI can also ship you the help files and program that runs on them.
  1076. X
  1077. XAlso, how do I get into wizard mode on your moria?  ^p doesn't seem to
  1078. Xdo it, as it does on mine.
  1079. X
  1080. X--Alan
  1081. X
  1082. X
  1083. XFrom @MCC.COM:wex@MCC.COM Wed Sep 30 15:19:08 1987
  1084. XReceived: from MCC.COM by ji.Berkeley.EDU (5.58/1.25)
  1085. X    id AA25694; Wed, 30 Sep 87 15:19:04 PDT
  1086. XReceived: from milano.SW.MCC.COM by MCC.COM with TCP; Wed 30 Sep 87 17:18:31-CDT
  1087. XReceived: from banzai-inst by milano.SW.MCC.COM (5.52/STP1.51) 
  1088. X    id AA20759; Wed, 30 Sep 87 17:18:27 CDT
  1089. XDate: Wed, 30 Sep 87 17:18:12 CDT
  1090. XFrom: Buckaroo Banzai <wex@MCC.COM>
  1091. XMessage-Id: <8709302218.AA16205@banzai-inst.SW.MCC.COM>
  1092. XReceived: by banzai-inst.SW.MCC.COM (3.2/STP1.14) 
  1093. X    id AA16205; Wed, 30 Sep 87 17:18:12 CDT
  1094. XTo: wilson@ji.Berkeley.EDU
  1095. XIn-Reply-To: James E. Wilson's message of Wed, 30 Sep 87 11:21:20 PDT <8709301821.AA23038@ji.Berkeley.EDU>
  1096. XSubject: UNIX Moria
  1097. XStatus: RO
  1098. X
  1099. XHokay - the files are in place.  The source file is pretty massive; I
  1100. Xhad to segment it into three pieces in order to fit it through our
  1101. Xgateway machine.  Just cat the segments together before unsharing.
  1102. XIt's not compressed or anything.
  1103. X
  1104. XThe best thing to do is copy all the shar files to the directory you
  1105. Xwant to install in, then unshar moria.shar first.  There's a README
  1106. Xthat explains how to compile and install.  The wizard passwords are a
  1107. Xlittle hidden (just enough so that someone with the strings program
  1108. Xcan't find them easily).  They are DeadlyBalrog and MoriaDungeon.
  1109. XCapitals count, no carriage return needed.
  1110. X
  1111. X--Alan
  1112. X
  1113. XFrom @MCC.COM:wex@MCC.COM Wed Sep 30 11:35:53 1987
  1114. XReceived: from MCC.COM by ji.Berkeley.EDU (5.58/1.25)
  1115. X    id AA23167; Wed, 30 Sep 87 11:35:49 PDT
  1116. XReceived: from milano.SW.MCC.COM by MCC.COM with TCP; Wed 30 Sep 87 13:35:31-CDT
  1117. XReceived: from banzai-inst by milano.SW.MCC.COM (5.52/STP1.51) 
  1118. X    id AA17587; Wed, 30 Sep 87 13:35:26 CDT
  1119. XDate: Wed, 30 Sep 87 13:35:12 CDT
  1120. XFrom: Buckaroo Banzai <wex@MCC.COM>
  1121. XMessage-Id: <8709301835.AA14738@banzai-inst.SW.MCC.COM>
  1122. XReceived: by banzai-inst.SW.MCC.COM (3.2/STP1.14) 
  1123. X    id AA14738; Wed, 30 Sep 87 13:35:12 CDT
  1124. XTo: wilson@ji.Berkeley.EDU
  1125. XIn-Reply-To: James E. Wilson's message of Wed, 30 Sep 87 11:21:20 PDT <8709301821.AA23038@ji.Berkeley.EDU>
  1126. XSubject: UNIX Moria
  1127. XStatus: RO
  1128. X
  1129. X> >You also seem to have the problem that's been plaguing me - monsters
  1130. X> >aren't always visible when they ought to be, especially in dark rooms
  1131. X> >and corridors.  I think there's something wrong in draw_block().
  1132. X> >Drat!  I was hoping you'd solved that one.
  1133. X> I have never noticed this.  Could you be a little more specific?
  1134. X> How can I reproduce this?
  1135. X
  1136. XGo to any dark room (preferrably with a human character so infravision
  1137. Xdoesn't mess things up) and wander around.  Sometimes you'll be right
  1138. Xnext to a monster but be unable to see it.  It also happens in
  1139. Xcorridors, if you bump into a monster unexpectedly.  You get messages
  1140. Xlike "You hit it," when you should get messages with the monster's
  1141. Xname.
  1142. X
  1143. XI've tracked the problem down to the 'ml' field in the monster record.
  1144. XY'see, draw_block() redraws the area around the player, but doesn't
  1145. Xalways set that field when it should.  I'd like to find a VMS version
  1146. Xto play with and see if it works, but I haven't been able to get the
  1147. XVMS code I have to run, and I don't know the wizard passwords for it
  1148. Xeither :-(
  1149. X
  1150. XRe: passwords.  Nope.  I just went back and tried again - ^p and ^P
  1151. Xdon't ask for the password.  I've compiled it on my Sun3 - have you
  1152. Xtried it on that machine yet?
  1153. X
  1154. X> >The rogue-command interface is really kludgey - I'm going to hold off
  1155. X> >installing that in my code for a while.
  1156. X> Yeah, sort of, but it IS nice if you don't have a numeric keypad.
  1157. X
  1158. XI guess.  it didn't take me long to adjust, but then I don't play
  1159. Xrogue/hack much anymore.  I'm thinking of including a patch to handle
  1160. Xthe Sun's keypad (which generates weird escape-strings).
  1161. X
  1162. X> The signals are some of the most important code.  I never would have
  1163. X> gotten any serious playtesters if they lost games due to bugs.
  1164. X> I had some people fighting the Balrog even with buggy versions of the
  1165. X> game, because they did not have to start all over again every time the
  1166. X> program crashed.  (anecdotal evidence: my first game of xconq was lost
  1167. X> due to a floating point exception, I immediately added signal handlers
  1168. X> to save games before core dumping, this proved useful during my second game :-)
  1169. X
  1170. XI guess.  I was too embarrassed to let other people use the code while
  1171. Xit crashed like that.  For myself, I just used wizard mode and dbx to
  1172. Xregenerate games that got blown away by bugs.  Want to ship me your
  1173. Xdiffs to xconq?  I'm getting tired of having it core dump on me all
  1174. Xthe time.
  1175. X
  1176. XI will try putting my files on ucbarpa and let you know when they're
  1177. Xthere.
  1178. X
  1179. X--Alan
  1180. X
  1181. END_OF_FILE
  1182. if test 10662 -ne `wc -c <'misc/wex.msg'`; then
  1183.     echo shar: \"'misc/wex.msg'\" unpacked with wrong size!
  1184. fi
  1185. # end of 'misc/wex.msg'
  1186. fi
  1187. if test -f 'source/config.h' -a "${1}" != "-c" ; then 
  1188.   echo shar: Will not clobber existing file \"'source/config.h'\"
  1189. else
  1190. echo shar: Extracting \"'source/config.h'\" \(9787 characters\)
  1191. sed "s/^X//" >'source/config.h' <<'END_OF_FILE'
  1192. X/* source/config.h: configuration definitions
  1193. X
  1194. X   Copyright (c) 1989-92 James E. Wilson
  1195. X
  1196. X   This software may be copied and distributed for educational, research, and
  1197. X   not for profit purposes provided that this copyright and statement are
  1198. X   included in all such copies. */
  1199. X
  1200. X#define CONFIG_H_INCLUDED
  1201. X#ifdef CONSTANT_H_INCLUDED
  1202. XConstant.h should always be included after config.h, because it uses
  1203. Xsome of the system defines set up here.
  1204. X#endif
  1205. X
  1206. X/* Person to bother if something goes wrong.  */
  1207. X/* Recompile files.c and misc2.c if this changes.  */
  1208. X#define WIZARD    "David Grabiner"
  1209. X/* The wizard password and wizard uid are no longer used.  */
  1210. X
  1211. X
  1212. X/* System definitions.  You must define one of these as appropriate for
  1213. X   the system you are compiling moria on.  */
  1214. X
  1215. X/* No system definition is needed for 4.3BSD, SUN OS, DG/UX.  */
  1216. X
  1217. X/* If you are compiling on an ultrix/4.2BSD/Dynix/etc. version of UNIX,
  1218. X   define this.  It is not needed for SUNs.  */
  1219. X/* #ifndef ultrix
  1220. X#define ultrix
  1221. X#endif */
  1222. X
  1223. X/* If you are compiling under IBM's AIX 3.0, then you can either define
  1224. X   SYS_V, or you can define nothing (thus compiling as if on a BSD system)
  1225. X   but you must comment out the AIX LFLAG line in the Makefile so that
  1226. X   moria will be linked with -lbsd.  */
  1227. X
  1228. X/* If you are compiling on a SYS V version of UNIX, define this.  */
  1229. X/* #define SYS_V */
  1230. X
  1231. X/* If you are compiling on a SYS III version of UNIX, define this.
  1232. X   The SYS_III support may not be complete.  I do not know if this works.  */
  1233. X/* #define SYS_III */
  1234. X
  1235. X/* If you are compiling on an ATARI ST with Mark Williams C, define this.  */
  1236. X/* #define ATARIST_MWC */
  1237. X
  1238. X/* If you are compiling on an Atari ST with GCC, you do not need to define
  1239. X   anything.  */
  1240. X
  1241. X/* If you are compiling on an Atari ST with TC, define this.  */
  1242. X/* #define ATARIST_TC */
  1243. X
  1244. X/* If you are compiling on a Macintosh with MPW C 3.0, define this.  */
  1245. X/* #define MAC */
  1246. X
  1247. X/* If we are in Think C, then we must be on a mac.  */
  1248. X#ifdef THINK_C
  1249. X#define MAC
  1250. X#endif
  1251. X
  1252. X/* For Xenix systems, define SYS_V and unix.  */
  1253. X#ifdef M_XENIX
  1254. X#define SYS_V
  1255. X#define unix
  1256. X#endif
  1257. X
  1258. X/* If you are compiling under VMS, define this.  */
  1259. X/* #define VMS */
  1260. X
  1261. X/* If you are using the tcio.c file instead of io.c, then define this.
  1262. X   The tcio.c file uses TURBO C builtin functions instead of curses library
  1263. X   calls.  It only works if you are using TURBO C.
  1264. X   The default is to assume you are using it if you are using TURBO C
  1265. X   on an IBM-PC.  */
  1266. X#if defined(MSDOS) && defined(__TURBOC__)
  1267. X#define USING_TCIO
  1268. X#endif
  1269. X
  1270. X
  1271. X/* Files used by moria, set these to valid pathnames for your system.  */
  1272. X
  1273. X#ifdef MSDOS
  1274. X/* Files which can be in a varying place */
  1275. X#define MORIA_SAV    moriasav
  1276. X#define MORIA_TOP    moriatop
  1277. X#define MORIA_MOR    "news"
  1278. X#define MORIA_TOP_NAME    "scores"
  1279. X#define MORIA_SAV_NAME    "MORIA.SAV"
  1280. X#define MORIA_CNF_NAME    "MORIA.CNF"
  1281. X#define MORIA_HELP    "roglcmds.hlp"
  1282. X#define MORIA_ORIG_HELP    "origcmds.hlp"
  1283. X#define MORIA_WIZ_HELP    "rwizcmds.hlp"
  1284. X#define MORIA_OWIZ_HELP    "owizcmds.hlp"
  1285. X#define MORIA_WELCOME    "welcome.hlp"
  1286. X#define MORIA_VER    "version.hlp"
  1287. X
  1288. X#else
  1289. X#ifdef MAC
  1290. X
  1291. X/* These files are concatenated into the data fork of the app */
  1292. X/* The names are retained to find the appropriate text */
  1293. X#define MORIA_MOR    "news"
  1294. X#define MORIA_HELP    "roglcmds.hlp"
  1295. X#define MORIA_ORIG_HELP    "origcmds.hlp"
  1296. X#define MORIA_WIZ_HELP    "rwizcmds.hlp"
  1297. X#define MORIA_OWIZ_HELP    "owizcmds.hlp"
  1298. X#define MORIA_WELCOME    "welcome.hlp"
  1299. X#define MORIA_VER    "version.hlp"
  1300. X/* Do not know what will happen with these yet */
  1301. X#define MORIA_TOP    "Moria High Scores"
  1302. X/* File types and creators for the Mac */
  1303. X#define MORIA_FCREATOR    'MRIA'
  1304. X#define SAVE_FTYPE    'SAVE'
  1305. X#define INFO_FTYPE    'TEXT'
  1306. X#define SCORE_FTYPE    'SCOR'
  1307. X#define CONFIG_FTYPE    'CNFG'
  1308. X
  1309. X/* Options for building resources:
  1310. X   THINK C doesn't have -D switch, so we need to define this stuff here.
  1311. X   Uncomment RSRC when building DumpRes1 or DumpRes2; uncomment RSRC_PARTn
  1312. X   as appropriate.  When building application, comment all of them.
  1313. X   I don't think any of this is necessary for MPW C -- BS.  */
  1314. X#ifdef THINK_C
  1315. X/* #define RSRC */    /* This copy is for creating resources.  */
  1316. X
  1317. X/* THINK C can only take 32K data, so we need to dump the resources in
  1318. X   two parts.  */
  1319. X/* #define RSRC_PART1 */
  1320. X/* #define RSRC_PART2 */
  1321. X#endif
  1322. X
  1323. X#else
  1324. X
  1325. X#ifdef VMS
  1326. X#define MORIA_SAV    "moria.sav"
  1327. X/* These 3 files need a dot at the end to prevent VMS from deciding that
  1328. X   they are *.DAT files or anything else equally wierd. */
  1329. X#define MORIA_HOU    "moria:hours."
  1330. X#define MORIA_MOR    "moria:news."
  1331. X#define MORIA_TOP    "moria:scores."
  1332. X#define MORIA_HELP    "moria:roglcmds.hlp"
  1333. X#define MORIA_ORIG_HELP "moria:origcmds.hlp"
  1334. X#define MORIA_WIZ_HELP  "moria:rwizcmds.hlp"
  1335. X#define MORIA_OWIZ_HELP "moria:owizcmds.hlp"
  1336. X#define MORIA_WELCOME    "moria:welcome.hlp"
  1337. X#define MORIA_VER    "moria:version.hlp"
  1338. X
  1339. X#else
  1340. X
  1341. X#ifdef AMIGA
  1342. X#define MORIA_SAV     "moria.sav"
  1343. X#define MORIA_HOU    "moria:hours"
  1344. X#define MORIA_MOR    "moria:news"
  1345. X#define MORIA_TOP    "moria:scores"
  1346. X#define MORIA_HELP    "moria:roglcmds.hlp"
  1347. X#define MORIA_ORIG_HELP "moria:origcmds.hlp"
  1348. X#define MORIA_WIZ_HELP  "moria:rwizcmds.hlp"
  1349. X#define MORIA_OWIZ_HELP "moria:owizcmds.hlp"
  1350. X#define MORIA_WELCOME    "moria:welcome.hlp"
  1351. X#define MORIA_VER    "moria:version.hlp"
  1352. X
  1353. X#else
  1354. X#if defined(GEMDOS)
  1355. X/* Atari ST */
  1356. X#define MORIA_SAV    "moria.sav"
  1357. X#define MORIA_HOU    "files\\hours"
  1358. X#define MORIA_MOR    "files\\news"
  1359. X#define MORIA_TOP    "files\\scores"
  1360. X#define MORIA_HELP    "files\\roglcmds.hlp"
  1361. X#define MORIA_ORIG_HELP    "files\\origcmds.hlp"
  1362. X#define MORIA_WIZ_HELP    "files\\rwizcmds.hlp"
  1363. X#define MORIA_OWIZ_HELP    "files\\owizcmds.hlp"
  1364. X#define MORIA_WELCOME    "files\\welcome.hlp"
  1365. X#define MORIA_VER    "files\\version.hlp"
  1366. X
  1367. X#else
  1368. X#if defined(atarist) && defined(__GNUC__)
  1369. X/* atari-st compiled with gnu-c  */
  1370. X
  1371. X#define MORIA_SAV    "moria.save"
  1372. X#define MORIA_HOU    (char *)prefix_file("files/hours")
  1373. X#define MORIA_MOR    (char *)prefix_file("files/news")
  1374. X#define MORIA_TOP    (char *)prefix_file("files/scores")
  1375. X#define MORIA_HELP    (char *)prefix_file("files/roglcmds.hlp")
  1376. X#define MORIA_ORIG_HELP    (char *)prefix_file("files/origcmds.hlp")
  1377. X#define MORIA_WIZ_HELP    (char *)prefix_file("files/rwizcmds.hlp")
  1378. X#define MORIA_OWIZ_HELP    (char *)prefix_file("files/owizcmds.hlp")
  1379. X#define MORIA_WELCOME    (char *)prefix_file("files/welcome.hlp")
  1380. X#define MORIA_VER    (char *)prefix_file("files/version.hlp")
  1381. X
  1382. X#else
  1383. X
  1384. X/* This must be unix.  */
  1385. X#define MORIA_SAV    "moria.save"
  1386. X#define MORIA_HOU    "/home/zariski/grabiner/moria/files/hours"
  1387. X#define MORIA_MOR    "/home/zariski/grabiner/moria/files/news"
  1388. X#define MORIA_TOP    "/home/zariski/grabiner/moria/files/scores"
  1389. X#define MORIA_HELP    "/home/zariski/grabiner/moria/files/roglcmds.hlp"
  1390. X#define MORIA_ORIG_HELP    "/home/zariski/grabiner/moria/files/origcmds.hlp"
  1391. X#define MORIA_WIZ_HELP    "/home/zariski/grabiner/moria/files/rwizcmds.hlp"
  1392. X#define MORIA_OWIZ_HELP    "/home/zariski/grabiner/moria/files/owizcmds.hlp"
  1393. X#define MORIA_WELCOME    "/home/zariski/grabiner/moria/files/welcome.hlp"
  1394. X#define MORIA_VER    "/home/zariski/grabiner/moria/files/version.hlp"
  1395. X
  1396. X#endif
  1397. X#endif
  1398. X#endif
  1399. X#endif
  1400. X#endif
  1401. X#endif
  1402. X
  1403. X
  1404. X/* This sets the default user interface.  */
  1405. X/* To use the original key bindings (keypad for movement) set ROGUE_LIKE
  1406. X   to FALSE; to use the rogue-like key bindings (vi style movement)
  1407. X   set ROGUE_LIKE to TRUE.  */
  1408. X/* If you change this, you only need to recompile main.c.  */
  1409. X#define ROGUE_LIKE FALSE
  1410. X
  1411. X
  1412. X/* For the ANDREW distributed file system, define this to ensure that
  1413. X   the program is secure with respect to the setuid code, this prohibits
  1414. X   inferior shells.  It also does not relinquish setuid priviledges at the
  1415. X   start, but instead calls the ANDREW library routines bePlayer(), beGames(),
  1416. X   and Authenticate().  */
  1417. X/* #define SECURE */
  1418. X
  1419. X
  1420. X
  1421. X/* System dependent defines follow.  You should not need to change anything
  1422. X   below.  */
  1423. X
  1424. X#ifdef ATARIST_TC
  1425. X#define USG
  1426. X#include <stdio.h>    /* Needed for TC ...printf */
  1427. X#endif
  1428. X
  1429. X#if defined(ATARIST_TC) || defined(ATARIST_MWC)
  1430. X#define ATARI_ST
  1431. X#endif
  1432. X
  1433. X/* Substitute strchr for index on USG versions of UNIX.  */
  1434. X#if defined(SYS_V) || defined(MSDOS) || defined(MAC) || defined(VMS)
  1435. X#define index strchr
  1436. X#endif
  1437. X#ifdef ATARIST_TC
  1438. X#define index strchr
  1439. X#endif
  1440. X
  1441. X#ifdef SYS_III
  1442. Xchar *index();
  1443. X#endif
  1444. X
  1445. X/* Define USG for many systems, this is basically to select SYS V style
  1446. X   system calls (as opposed to BSD style).  */
  1447. X#if defined(SYS_III) || defined(SYS_V) || defined(MSDOS) || defined(MAC)
  1448. X#ifndef USG
  1449. X#define USG
  1450. X#endif
  1451. X#endif
  1452. X
  1453. X#if defined(ATARIST_MWC) || defined(AMIGA) || defined(VMS)
  1454. X#define USG
  1455. X#endif
  1456. X
  1457. X#ifdef AMIGA
  1458. X#ifndef ultrix
  1459. X#define ultrix
  1460. X#endif
  1461. X#endif
  1462. X
  1463. X/* Pyramid runs 4.2BSD-like UNIX version */
  1464. X#if defined(Pyramid)
  1465. X#define ultrix
  1466. X#endif
  1467. X
  1468. X#if defined(_MSC_VER) && (_MSC_VER < 600)
  1469. X#define register      /* MSC 4.0 still has a problem with register bugs ... */
  1470. X#endif
  1471. X
  1472. X#ifdef MAC
  1473. X#ifdef RSRC
  1474. X#define MACRSRC        /* Defined if we are building the resources.  */
  1475. X#else
  1476. X#define MACGAME        /* Defined if we are building the game.  */
  1477. X#endif
  1478. X#endif
  1479. X
  1480. X#ifdef MAC
  1481. X/* Screen dimensions */
  1482. X#define SCRN_ROWS    24
  1483. X#define SCRN_COLS    80
  1484. X#endif
  1485. X
  1486. X#ifdef VMS
  1487. X#define unlink delete
  1488. X#define index strchr
  1489. X#define exit uexit
  1490. X/* In constants.h, ESCAPE is defined to be the CTRL-Z key, instead of the
  1491. X   escape key.  */
  1492. X#endif
  1493. X
  1494. X#if defined(SYS_V) && defined(lint)
  1495. X/* Define this to prevent <string.h> from including <NLchar.h> on a PC/RT
  1496. X   running AIX.  This prevents a bunch of lint errors.  */
  1497. X#define RTPC_NO_NLS
  1498. X#endif
  1499. X
  1500. X#ifdef SECURE
  1501. Xextern int PlayerUID;
  1502. X#define getuid() PlayerUID
  1503. X#define geteuid() PlayerUID
  1504. X#endif
  1505. X
  1506. X#ifdef THINK_C
  1507. X/* Apparently, THINK C is only happy if this is defined.  This can not
  1508. X   be defined in general, because some systems have include files which
  1509. X   merely test whether STDC is defined, they do not test the value.  */
  1510. X/* Check how standard we are: Some code tests value of __STDC__.  */
  1511. X#ifndef __STDC__
  1512. X#define __STDC__    0
  1513. X#endif
  1514. X#endif
  1515. END_OF_FILE
  1516. if test 9787 -ne `wc -c <'source/config.h'`; then
  1517.     echo shar: \"'source/config.h'\" unpacked with wrong size!
  1518. fi
  1519. # end of 'source/config.h'
  1520. fi
  1521. if test -f 'source/wizard.c' -a "${1}" != "-c" ; then 
  1522.   echo shar: Will not clobber existing file \"'source/wizard.c'\"
  1523. else
  1524. echo shar: Extracting \"'source/wizard.c'\" \(9196 characters\)
  1525. sed "s/^X//" >'source/wizard.c' <<'END_OF_FILE'
  1526. X/* source/wizard.c: Version history and info, and wizard mode debugging aids.
  1527. X
  1528. X   Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke
  1529. X
  1530. X   This software may be copied and distributed for educational, research, and
  1531. X   not for profit purposes provided that this copyright and statement are
  1532. X   included in all such copies. */
  1533. X
  1534. X#ifdef __TURBOC__
  1535. X#include    <stdio.h>
  1536. X#include    <stdlib.h>
  1537. X#endif /* __TURBOC__ */
  1538. X#include "config.h"
  1539. X#include "constant.h"
  1540. X#include "types.h"
  1541. X#include "externs.h"
  1542. X
  1543. X#ifdef USG
  1544. X#ifndef ATARIST_MWC
  1545. X#include <string.h>
  1546. X#endif
  1547. X#else
  1548. X#include <strings.h>
  1549. X#endif
  1550. X
  1551. X#ifdef ATARIST_TC
  1552. X/* Include this to get prototypes for standard library functions.  */
  1553. X#include <stdlib.h>
  1554. X#endif
  1555. X
  1556. Xlong atol();
  1557. X
  1558. X/* Light up the dungeon                    -RAK-    */
  1559. Xvoid wizard_light()
  1560. X{
  1561. X  register cave_type *c_ptr;
  1562. X  register int k, l, i, j;
  1563. X  int flag;
  1564. X
  1565. X  if (cave[char_row][char_col].pl)
  1566. X    flag = FALSE;
  1567. X  else
  1568. X    flag = TRUE;
  1569. X  for (i = 0; i < cur_height; i++)
  1570. X    for (j = 0; j < cur_width; j++)
  1571. X      if (cave[i][j].fval <= MAX_CAVE_FLOOR)
  1572. X    for (k = i-1; k <= i+1; k++)
  1573. X      for (l = j-1; l <= j+1; l++)
  1574. X        {
  1575. X          c_ptr = &cave[k][l];
  1576. X          c_ptr->pl = flag;
  1577. X          if (!flag)
  1578. X        c_ptr->fm = FALSE;
  1579. X        }
  1580. X  prt_map();
  1581. X}
  1582. X
  1583. X
  1584. X/* Wizard routine for gaining on stats            -RAK-    */
  1585. Xvoid change_character()
  1586. X{
  1587. X  register int tmp_val;
  1588. X  register int32 tmp_lval;
  1589. X  int8u *a_ptr;
  1590. X  vtype tmp_str;
  1591. X  register struct misc *m_ptr;
  1592. X
  1593. X  a_ptr = py.stats.max_stat;
  1594. X  prt("(3 - 118) Strength     = ", 0, 0);
  1595. X  if (get_string(tmp_str, 0, 25, 3))
  1596. X    {
  1597. X      tmp_val = atoi(tmp_str);
  1598. X      if ((tmp_val > 2) && (tmp_val < 119))
  1599. X    {
  1600. X      a_ptr[A_STR] = tmp_val;
  1601. X      (void) res_stat(A_STR);
  1602. X    }
  1603. X    }
  1604. X  else
  1605. X    return;
  1606. X
  1607. X  prt("(3 - 118) Intelligence = ", 0, 0);
  1608. X  if (get_string(tmp_str, 0, 25, 3))
  1609. X    {
  1610. X      tmp_val = atoi(tmp_str);
  1611. X      if ((tmp_val > 2) && (tmp_val < 119))
  1612. X    {
  1613. X      a_ptr[A_INT] = tmp_val;
  1614. X      (void) res_stat(A_INT);
  1615. X    }
  1616. X    }
  1617. X  else
  1618. X    return;
  1619. X
  1620. X  prt("(3 - 118) Wisdom       = ", 0, 0);
  1621. X  if (get_string(tmp_str, 0, 25, 3))
  1622. X    {
  1623. X      tmp_val = atoi(tmp_str);
  1624. X      if ((tmp_val > 2) && (tmp_val < 119))
  1625. X    {
  1626. X      a_ptr[A_WIS] = tmp_val;
  1627. X      (void) res_stat(A_WIS);
  1628. X    }
  1629. X    }
  1630. X  else
  1631. X    return;
  1632. X
  1633. X  prt("(3 - 118) Dexterity    = ", 0, 0);
  1634. X  if (get_string(tmp_str, 0, 25, 3))
  1635. X    {
  1636. X      tmp_val = atoi(tmp_str);
  1637. X      if ((tmp_val > 2) && (tmp_val < 119))
  1638. X    {
  1639. X      a_ptr[A_DEX] = tmp_val;
  1640. X      (void) res_stat(A_DEX);
  1641. X    }
  1642. X    }
  1643. X  else
  1644. X    return;
  1645. X
  1646. X  prt("(3 - 118) Constitution = ", 0, 0);
  1647. X  if (get_string(tmp_str, 0, 25, 3))
  1648. X    {
  1649. X      tmp_val = atoi(tmp_str);
  1650. X      if ((tmp_val > 2) && (tmp_val < 119))
  1651. X    {
  1652. X      a_ptr[A_CON] = tmp_val;
  1653. X      (void) res_stat(A_CON);
  1654. X    }
  1655. X    }
  1656. X  else
  1657. X    return;
  1658. X
  1659. X  prt("(3 - 118) Charisma     = ", 0, 0);
  1660. X  if (get_string(tmp_str, 0, 25, 3))
  1661. X    {
  1662. X      tmp_val = atoi(tmp_str);
  1663. X      if ((tmp_val > 2) && (tmp_val < 119))
  1664. X    {
  1665. X      a_ptr[A_CHR] = tmp_val;
  1666. X      (void) res_stat(A_CHR);
  1667. X    }
  1668. X    }
  1669. X  else
  1670. X    return;
  1671. X
  1672. X  m_ptr = &py.misc;
  1673. X  prt("(1 - 32767) Hit points = ", 0, 0);
  1674. X  if (get_string(tmp_str, 0, 25, 5))
  1675. X    {
  1676. X      tmp_val = atoi(tmp_str);
  1677. X      if ((tmp_val > 0) && (tmp_val <= MAX_SHORT))
  1678. X    {
  1679. X      m_ptr->mhp  = tmp_val;
  1680. X      m_ptr->chp  = tmp_val;
  1681. X      m_ptr->chp_frac = 0;
  1682. X      prt_mhp();
  1683. X      prt_chp();
  1684. X    }
  1685. X    }
  1686. X  else
  1687. X    return;
  1688. X
  1689. X  prt("(0 - 32767) Mana       = ", 0, 0);
  1690. X  if (get_string(tmp_str, 0, 25, 5))
  1691. X    {
  1692. X      tmp_val = atoi(tmp_str);
  1693. X      if ((tmp_val > -1) && (tmp_val <= MAX_SHORT) && (*tmp_str != '\0'))
  1694. X    {
  1695. X      m_ptr->mana  = tmp_val;
  1696. X      m_ptr->cmana = tmp_val;
  1697. X      m_ptr->cmana_frac = 0;
  1698. X      prt_cmana();
  1699. X    }
  1700. X    }
  1701. X  else
  1702. X    return;
  1703. X
  1704. X  (void) sprintf(tmp_str, "Current=%ld  Gold = ", m_ptr->au);
  1705. X  tmp_val = strlen(tmp_str);
  1706. X  prt(tmp_str, 0, 0);
  1707. X  if (get_string(tmp_str, 0, tmp_val, 7))
  1708. X    {
  1709. X      tmp_lval = atol(tmp_str);
  1710. X      if (tmp_lval > -1 && (*tmp_str != '\0'))
  1711. X    {
  1712. X      m_ptr->au = tmp_lval;
  1713. X      prt_gold();
  1714. X    }
  1715. X    }
  1716. X  else
  1717. X    return;
  1718. X
  1719. X  (void) sprintf(tmp_str, "Current=%d  (0-200) Searching = ", m_ptr->srh);
  1720. X  tmp_val = strlen(tmp_str);
  1721. X  prt(tmp_str, 0, 0);
  1722. X  if (get_string(tmp_str, 0, tmp_val, 3))
  1723. X    {
  1724. X      tmp_val = atoi(tmp_str);
  1725. X      if ((tmp_val > -1) && (tmp_val < 201) && (*tmp_str != '\0'))
  1726. X    m_ptr->srh  = tmp_val;
  1727. X    }
  1728. X  else
  1729. X    return;
  1730. X
  1731. X  (void) sprintf(tmp_str, "Current=%d  (-1-18) Stealth = ", m_ptr->stl);
  1732. X  tmp_val = strlen(tmp_str);
  1733. X  prt(tmp_str, 0, 0);
  1734. X  if (get_string(tmp_str, 0, tmp_val, 3))
  1735. X    {
  1736. X      tmp_val = atoi(tmp_str);
  1737. X      if ((tmp_val > -2) && (tmp_val < 19) && (*tmp_str != '\0'))
  1738. X    m_ptr->stl  = tmp_val;
  1739. X    }
  1740. X  else
  1741. X    return;
  1742. X
  1743. X  (void) sprintf(tmp_str, "Current=%d  (0-200) Disarming = ", m_ptr->disarm);
  1744. X  tmp_val = strlen(tmp_str);
  1745. X  prt(tmp_str, 0, 0);
  1746. X  if (get_string(tmp_str, 0, tmp_val, 3))
  1747. X    {
  1748. X      tmp_val = atoi(tmp_str);
  1749. X      if ((tmp_val > -1) && (tmp_val < 201) && (*tmp_str != '\0'))
  1750. X    m_ptr->disarm = tmp_val;
  1751. X    }
  1752. X  else
  1753. X    return;
  1754. X
  1755. X  (void) sprintf(tmp_str, "Current=%d  (0-100) Save = ", m_ptr->save);
  1756. X  tmp_val = strlen(tmp_str);
  1757. X  prt(tmp_str, 0, 0);
  1758. X  if (get_string(tmp_str, 0, tmp_val, 3))
  1759. X    {
  1760. X      tmp_val = atoi(tmp_str);
  1761. X      if ((tmp_val > -1) && (tmp_val < 201) && (*tmp_str != '\0'))
  1762. X    m_ptr->save = tmp_val;
  1763. X    }
  1764. X  else
  1765. X    return;
  1766. X
  1767. X  (void) sprintf(tmp_str, "Current=%d  (0-200) Base to hit = ", m_ptr->bth);
  1768. X  tmp_val = strlen(tmp_str);
  1769. X  prt(tmp_str, 0, 0);
  1770. X  if (get_string(tmp_str, 0, tmp_val, 3))
  1771. X    {
  1772. X      tmp_val = atoi(tmp_str);
  1773. X      if ((tmp_val > -1) && (tmp_val < 201) && (*tmp_str != '\0'))
  1774. X    m_ptr->bth  = tmp_val;
  1775. X    }
  1776. X  else
  1777. X    return;
  1778. X
  1779. X  (void) sprintf(tmp_str, "Current=%d  (0-200) Bows/Throwing = ",
  1780. X         m_ptr->bthb);
  1781. X  tmp_val = strlen(tmp_str);
  1782. X  prt(tmp_str, 0, 0);
  1783. X  if (get_string(tmp_str, 0, tmp_val, 3))
  1784. X    {
  1785. X      tmp_val = atoi(tmp_str);
  1786. X      if ((tmp_val > -1) && (tmp_val < 201) && (*tmp_str != '\0'))
  1787. X    m_ptr->bthb = tmp_val;
  1788. X    }
  1789. X  else
  1790. X    return;
  1791. X
  1792. X  (void) sprintf(tmp_str, "Current=%d  Weight = ", m_ptr->wt);
  1793. X  tmp_val = strlen(tmp_str);
  1794. X  prt(tmp_str, 0, 0);
  1795. X  if (get_string(tmp_str, 0, tmp_val, 3))
  1796. X    {
  1797. X      tmp_val = atoi(tmp_str);
  1798. X      if (tmp_val > -1 && (*tmp_str != '\0'))
  1799. X    m_ptr->wt = tmp_val;
  1800. X    }
  1801. X  else
  1802. X    return;
  1803. X
  1804. X  while(get_com("Alter speed? (+/-)", tmp_str))
  1805. X    {
  1806. X      if (*tmp_str == '+')
  1807. X    change_speed(-1);
  1808. X      else if (*tmp_str == '-')
  1809. X    change_speed(1);
  1810. X      else
  1811. X    break;
  1812. X      prt_speed();
  1813. X    }
  1814. X}
  1815. X
  1816. X
  1817. X/* Wizard routine for creating objects            -RAK-    */
  1818. Xvoid wizard_create()
  1819. X{
  1820. X  register int tmp_val;
  1821. X  int32 tmp_lval;
  1822. X  vtype tmp_str;
  1823. X  register inven_type *i_ptr;
  1824. X  inven_type forge;
  1825. X  register cave_type *c_ptr;
  1826. X  char pattern[4];
  1827. X
  1828. X  msg_print("Warning: This routine can cause a fatal error.");
  1829. X  i_ptr = &forge;
  1830. X  i_ptr->index = OBJ_WIZARD;
  1831. X  i_ptr->name2 = 0;
  1832. X  inscribe(i_ptr, "wizard item");
  1833. X  i_ptr->ident = ID_KNOWN2|ID_STOREBOUGHT;
  1834. X
  1835. X  prt("Tval   : ", 0, 0);
  1836. X  if (!get_string(tmp_str, 0, 9, 3))
  1837. X    return;
  1838. X  tmp_val = atoi(tmp_str);
  1839. X  i_ptr->tval = tmp_val;
  1840. X
  1841. X  prt("Tchar  : ", 0, 0);
  1842. X  if (!get_string(tmp_str, 0, 9, 1))
  1843. X    return;
  1844. X  i_ptr->tchar = tmp_str[0];
  1845. X
  1846. X  prt("Subval : ", 0, 0);
  1847. X  if (!get_string(tmp_str, 0, 9, 5))
  1848. X    return;
  1849. X  tmp_val = atoi(tmp_str);
  1850. X  i_ptr->subval = tmp_val;
  1851. X
  1852. X  prt("Weight : ", 0, 0);
  1853. X  if (!get_string(tmp_str, 0, 9, 5))
  1854. X    return;
  1855. X  tmp_val = atoi(tmp_str);
  1856. X  i_ptr->weight = tmp_val;
  1857. X
  1858. X  prt("Number : ", 0, 0);
  1859. X  if (!get_string(tmp_str, 0, 9, 5))
  1860. X    return;
  1861. X  tmp_val = atoi(tmp_str);
  1862. X  i_ptr->number = tmp_val;
  1863. X
  1864. X  prt("Damage (dice): ", 0, 0);
  1865. X  if (!get_string(tmp_str, 0, 15, 3))
  1866. X    return;
  1867. X  tmp_val = atoi(tmp_str);
  1868. X  i_ptr->damage[0] = tmp_val;
  1869. X
  1870. X  prt("Damage (sides): ", 0, 0);
  1871. X  if (!get_string(tmp_str, 0, 16, 3))
  1872. X    return;
  1873. X  tmp_val = atoi(tmp_str);
  1874. X  i_ptr->damage[1] = tmp_val;
  1875. X
  1876. X  prt("+To hit: ", 0, 0);
  1877. X  if (!get_string(tmp_str, 0, 9, 3))
  1878. X    return;
  1879. X  tmp_val = atoi(tmp_str);
  1880. X  i_ptr->tohit = tmp_val;
  1881. X
  1882. X  prt("+To dam: ", 0, 0);
  1883. X  if (!get_string(tmp_str, 0, 9, 3))
  1884. X    return;
  1885. X  tmp_val = atoi(tmp_str);
  1886. X  i_ptr->todam = tmp_val;
  1887. X
  1888. X  prt("AC     : ", 0, 0);
  1889. X  if (!get_string(tmp_str, 0, 9, 3))
  1890. X    return;
  1891. X  tmp_val = atoi(tmp_str);
  1892. X  i_ptr->ac = tmp_val;
  1893. X
  1894. X  prt("+To AC : ", 0, 0);
  1895. X  if (!get_string(tmp_str, 0, 9, 3))
  1896. X    return;
  1897. X  tmp_val = atoi(tmp_str);
  1898. X  i_ptr->toac = tmp_val;
  1899. X
  1900. X  prt("P1     : ", 0, 0);
  1901. X  if (!get_string(tmp_str, 0, 9, 5))
  1902. X    return;
  1903. X  tmp_val = atoi(tmp_str);
  1904. X  i_ptr->p1 = tmp_val;
  1905. X
  1906. X  prt("Flags (In HEX): ", 0, 0);
  1907. X  if (!get_string(tmp_str, 0, 16, 8))
  1908. X    return;
  1909. X  /* can't be constant string, this causes problems with the GCC compiler
  1910. X     and some scanf routines */
  1911. X  (void) strcpy (pattern, "%lx");
  1912. X  (void) sscanf(tmp_str, pattern, &tmp_lval);
  1913. X  i_ptr->flags = tmp_lval;
  1914. X
  1915. X  prt("Cost : ", 0, 0);
  1916. X  if (!get_string(tmp_str, 0, 9, 8))
  1917. X    return;
  1918. X  tmp_lval = atol(tmp_str);
  1919. X  i_ptr->cost = tmp_lval;
  1920. X
  1921. X  prt("Level : ", 0, 0);
  1922. X  if (!get_string(tmp_str, 0, 10, 3))
  1923. X    return;
  1924. X  tmp_val = atoi(tmp_str);
  1925. X  i_ptr->level = tmp_val;
  1926. X
  1927. X  if (get_check("Allocate?"))
  1928. X    {
  1929. X      /* delete object first if any, before call popt */
  1930. X      c_ptr = &cave[char_row][char_col];
  1931. X      if (c_ptr->tptr != 0)
  1932. X    (void) delete_object(char_row, char_col);
  1933. X
  1934. X      tmp_val = popt();
  1935. X      t_list[tmp_val] = forge;
  1936. X      c_ptr->tptr = tmp_val;
  1937. X      msg_print("Allocated.");
  1938. X    }
  1939. X  else
  1940. X    msg_print("Aborted.");
  1941. X}
  1942. END_OF_FILE
  1943. if test 9196 -ne `wc -c <'source/wizard.c'`; then
  1944.     echo shar: \"'source/wizard.c'\" unpacked with wrong size!
  1945. fi
  1946. # end of 'source/wizard.c'
  1947. fi
  1948. echo shar: End of archive 32 \(of 39\).
  1949. cp /dev/null ark32isdone
  1950. MISSING=""
  1951. 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
  1952.     if test ! -f ark${I}isdone ; then
  1953.     MISSING="${MISSING} ${I}"
  1954.     fi
  1955. done
  1956. if test "${MISSING}" = "" ; then
  1957.     echo You have unpacked all 39 archives.
  1958.     echo "Now run "bldfiles.sh" to build split files"
  1959.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1960. else
  1961.     echo You still need to unpack the following archives:
  1962.     echo "        " ${MISSING}
  1963. fi
  1964. ##  End of shell archive.
  1965. exit 0
  1966.