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

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v16i022:  nethack31 - display oriented dungeons & dragons (Ver. 3.1), Part22/108
  5. Message-ID: <4310@master.CNA.TEK.COM>
  6. Date: 29 Jan 93 20:44:07 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 2304
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1579
  11.  
  12. Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
  13. Posting-number: Volume 16, Issue 22
  14. Archive-name: nethack31/Part22
  15. Supersedes: nethack3p9: Volume 10, Issue 46-102
  16. Environment: Amiga, Atari, Mac, MS-DOS, OS2, Unix, VMS, X11
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 22 (of 108)."
  27. # Contents:  sys/amiga/wb.c2 sys/vms/vmsbuild.com
  28. # Wrapped by billr@saab on Wed Jan 27 16:08:54 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'sys/amiga/wb.c2' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'sys/amiga/wb.c2'\"
  32. else
  33. echo shar: Extracting \"'sys/amiga/wb.c2'\" \(43875 characters\)
  34. sed "s/^X//" >'sys/amiga/wb.c2' <<'END_OF_FILE'
  35. Xvoid menu_config()
  36. X{
  37. X    register struct Window *cwin;
  38. X    int done = 0, quit;
  39. X    long class, code, qual;
  40. X    register struct IntuiMessage *imsg;
  41. X    struct IntuiText *ip;
  42. X    register struct Gadget *gd;
  43. X    static int once = 0;
  44. X    int txtdiff = scrn->RastPort.TxHeight - 8;
  45. X
  46. X    strcpy( StrPath, options[ PATH_IDX ] );
  47. X    strcpy( StrHackdir, options[ HACKDIR_IDX ] );
  48. X    strcpy( StrPens, options[ PENS_IDX ] );
  49. X    strcpy( StrLevels, options[ LEVELS_IDX ] );
  50. X    strcpy( StrSave, options[ SAVE_IDX ] );
  51. X
  52. X    if( !once )
  53. X    {
  54. X    for( gd = Conf_NewWindowStructure4.FirstGadget;
  55. X            gd; gd = gd->NextGadget )
  56. X    {
  57. X        switch( gd->GadgetID )
  58. X        {
  59. X        case GADSTRPATH:
  60. X            /* Look for "Path:" string */
  61. X            for( ip = &Conf_IntuiTextList4;
  62. X                ip && *ip->IText != 'P'; )
  63. X            ip = ip->NextText;
  64. X            gd->TopEdge += txtdiff;
  65. X            gd->Height += txtdiff;
  66. X            SetBorder( gd, -1 );
  67. X            break;
  68. X        case GADSTRHACKDIR:
  69. X            /* Look for "Hackdir:" string */
  70. X            for( ip = &Conf_IntuiTextList4;
  71. X                ip && *ip->IText != 'H'; )
  72. X            ip = ip->NextText;
  73. X            if( ip )
  74. X            ip->TopEdge += txtdiff;
  75. X            gd->TopEdge += txtdiff*2;
  76. X            gd->Height += txtdiff;
  77. X            SetBorder( gd, -1 );
  78. X            break;
  79. X        case GADSTRPENS:
  80. X            /* Look for "Pens:" string */
  81. X            for( ip = &Conf_IntuiTextList4; ip &&
  82. X            !(*ip->IText == 'P' && ip->IText[1] == 'e'); )
  83. X            {
  84. X            ip = ip->NextText;
  85. X            }
  86. X            if( ip )
  87. X            ip->TopEdge += txtdiff*2;
  88. X            gd->TopEdge += txtdiff*3;
  89. X            gd->Height += txtdiff;
  90. X            SetBorder( gd, -1 );
  91. X            break;
  92. X        case GADSTRLEVELS:
  93. X            /* Look for "Levels:" string */
  94. X            for( ip = &Conf_IntuiTextList4; ip && *ip->IText != 'L'; )
  95. X            ip = ip->NextText;
  96. X            if( ip )
  97. X            ip->TopEdge += txtdiff*3;
  98. X            gd->TopEdge += txtdiff*4;
  99. X            gd->Height += txtdiff;
  100. X            SetBorder( gd, -1 );
  101. X            break;
  102. X        case GADSTRSAVE:
  103. X            /* Look for "Save Dir:" string */
  104. X            for( ip = &Conf_IntuiTextList4; ip && *ip->IText != 'S'; )
  105. X            ip = ip->NextText;
  106. X            if( ip )
  107. X            ip->TopEdge += txtdiff*4;
  108. X            gd->TopEdge += txtdiff*5;
  109. X            gd->Height += txtdiff;
  110. X            SetBorder( gd, -1 );
  111. X            break;
  112. X        case GADCONFLOAD:
  113. X        case GADCONFSAVE:
  114. X            gd->TopEdge += txtdiff*6;
  115. X            gd->Height += txtdiff;
  116. X            SetBorder( gd, -1 );
  117. X            break;
  118. X        case GADCONFNAME:
  119. X            for( ip = &Conf_IntuiTextList4; ip && *ip->IText != 'C'; )
  120. X            ip = ip->NextText;
  121. X            if( ip )
  122. X            ip->TopEdge += txtdiff*6;
  123. X            gd->TopEdge += txtdiff*7;
  124. X            gd->Height += txtdiff;
  125. X            SetBorder( gd, -1 );
  126. X            break;
  127. X
  128. X        default:
  129. X            break;
  130. X        }
  131. X    }
  132. X    Conf_NewWindowStructure4.Height += txtdiff*8;
  133. X    if( Conf_NewWindowStructure4.TopEdge +
  134. X        Conf_NewWindowStructure4.Height > scrn->Height )
  135. X    {
  136. X        Conf_NewWindowStructure4.TopEdge -=
  137. X        ( Conf_NewWindowStructure4.TopEdge +
  138. X        Conf_NewWindowStructure4.Height ) - scrn->Height + 1;
  139. X        if( Conf_NewWindowStructure4.TopEdge < 0 )
  140. X        {
  141. X        Conf_NewWindowStructure4.TopEdge = 0;
  142. X        Conf_NewWindowStructure4.Height = scrn->Height - 1;
  143. X        }
  144. X    }
  145. X    once = 1;
  146. X    }
  147. X
  148. X    Conf_NewWindowStructure4.Screen = scrn;
  149. X    if( ( cwin = MyOpenWindow( &Conf_NewWindowStructure4 ) ) == NULL )
  150. X    {
  151. X    errmsg( FLASH, "Can't create requester window" );
  152. X    return;
  153. X    }
  154. X
  155. X    PrintIText( cwin->RPort, &Conf_IntuiTextList4, 0, txtdiff );
  156. X    while( !done )
  157. X    {
  158. X    WaitPort( cwin->UserPort );
  159. X    while( ( imsg = (void *) GetMsg( cwin->UserPort ) ) != NULL )
  160. X    {
  161. X        class = imsg->Class;
  162. X        code = imsg->Code;
  163. X        qual = imsg->Qualifier;
  164. X        gd = (struct Gadget *)imsg->IAddress;
  165. X
  166. X        ReplyMsg( (struct Message *)imsg );
  167. X
  168. X        switch( class )
  169. X        {
  170. X        case VANILLAKEY:
  171. X            if( code == '\33' || (code == 'b' && (qual&AMIGALEFT)))
  172. X            {
  173. X            done = 0;
  174. X            quit = 1;
  175. X            }
  176. X            break;
  177. X
  178. X        case ACTIVEWINDOW:
  179. X            if( gd = FindGadget( cwin, NULL, GADCONFNAME ) )
  180. X            ActivateGadget( gd, cwin, NULL );
  181. X            break;
  182. X
  183. X        case CLOSEWINDOW:
  184. X            done = 1;
  185. X            quit = 0;
  186. X            break;
  187. X
  188. X        case GADGETUP:
  189. X            switch( gd->GadgetID )
  190. X            {
  191. X            case GADSTRPATH:
  192. X                if( gd = FindGadget( cwin, NULL,GADSTRHACKDIR) )
  193. X                ActivateGadget( gd, cwin, NULL );
  194. X                break;
  195. X            case GADSTRHACKDIR:
  196. X                if( gd = FindGadget( cwin, NULL,GADSTRPENS) )
  197. X                ActivateGadget( gd, cwin, NULL );
  198. X                break;
  199. X            case GADSTRPENS:
  200. X                if( gd = FindGadget( cwin, NULL,GADSTRLEVELS) )
  201. X                ActivateGadget( gd, cwin, NULL );
  202. X                break;
  203. X            case GADSTRLEVELS:
  204. X                if( gd = FindGadget( cwin, NULL, GADSTRSAVE ) )
  205. X                ActivateGadget( gd, cwin, NULL );
  206. X                break;
  207. X            case GADSTRSAVE:
  208. X                if( gd = FindGadget( cwin, NULL, GADCONFNAME ) )
  209. X                ActivateGadget( gd, cwin, NULL );
  210. X                break;
  211. X
  212. X            case GADCONFLOAD: case GADCONFNAME:
  213. X                ReadConfig( );
  214. X                strcpy( StrPath, options[ PATH_IDX ] );
  215. X                strcpy( StrHackdir, options[ HACKDIR_IDX ] );
  216. X                strcpy( StrPens, options[ PENS_IDX ] );
  217. X                strcpy( StrLevels, options[ LEVELS_IDX ] );
  218. X                strcpy( StrSave, options[ SAVE_IDX ] );
  219. X                RefreshGList( cwin->FirstGadget, cwin, NULL, -1 );
  220. X                break;
  221. X
  222. X            case GADCONFSAVE:
  223. X                errmsg( FLASH, "Save not implemented" );
  224. X                break;
  225. X
  226. X            default:
  227. X                break;
  228. X            }
  229. X            break;
  230. X        }
  231. X    }
  232. X    }
  233. X
  234. X    setoneopt( PATH_IDX, StrPath );
  235. X    PutOptions( curopts );
  236. X    setoneopt( HACKDIR_IDX, StrHackdir );
  237. X    setoneopt( PENS_IDX, StrPens );
  238. X    setoneopt( LEVELS_IDX, StrLevels );
  239. X    setoneopt( SAVE_IDX, StrSave );
  240. X
  241. X    SafeCloseWindow( cwin );
  242. X
  243. X    /* Display icons in possibly new save directory */
  244. X
  245. X    MapGadgets( R_DISK, 1 );
  246. X}
  247. X
  248. Xvoid menu_editdef( gametype )
  249. X    int gametype;
  250. X{
  251. X    register struct Window *cwin;
  252. X    int done = 0;
  253. X    USHORT mcode;
  254. X    long class, qual, code;
  255. X    register struct IntuiMessage *imsg;
  256. X    register struct Gadget *gd;
  257. X    char buf[ 100 ];
  258. X    struct IntuiText *ip;
  259. X    static int once = 0;
  260. X    int txtdiff = scrn->RastPort.TxHeight - 8;
  261. X    register GPTR gptr;
  262. X
  263. X    /* If gametype indicates an INFO request... */
  264. X    if( gametype == GAME_FROM_INFO )
  265. X    {
  266. X    register char *t;
  267. X
  268. X    if( ( gptr = NeedGame() ) == NULL )
  269. X    {
  270. X        errmsg( FLASH, "No Game selected to edit options for" );
  271. X        return;
  272. X    }
  273. X
  274. X    strcpy( DefOutFile, gptr->name );
  275. X    if( ( t = strrchr( DefOutFile, '.' ) ) &&
  276. X        stricmp( t, ".sav" ) == 0 )
  277. X    {
  278. X        *t = 0;
  279. X    }
  280. X    LoadDefaults( DefOutFile );
  281. X    }
  282. X    else /* if( gametype == GAME_FROM_DEFAULT ) */
  283. X    {
  284. X    /* Find the newgame gadget... */
  285. X
  286. X    for( gptr = windowgads; gptr; gptr = gptr->nextwgad )
  287. X    {
  288. X        if( gptr->dobj->do_Gadget.GadgetID == GADNEWGAME )
  289. X        break;
  290. X    }
  291. X
  292. X    if( !gptr )
  293. X    {
  294. X        errmsg( FLASH, "Can't find NewGame information" );
  295. X        return;
  296. X    }
  297. X
  298. X    strcpy( DefOutFile, defgname );
  299. X    LoadDefaults( DefOutFile );
  300. X    }
  301. X
  302. X    /* Copy the defgame.* date into the Defs_ window gadgets */
  303. X    CopyDefs2Gad();
  304. X
  305. X    /* Do one time window setup and initialization */
  306. X
  307. X    if( !once )
  308. X    {
  309. X    /* Rearrange the gadgets based on fonts text height */
  310. X
  311. X    for( gd = Defs_NewWindowStructure11.FirstGadget;
  312. X        gd; gd = gd->NextGadget )
  313. X    {
  314. X        if( gd->GadgetID != 0 )
  315. X        {
  316. X        gd->TopEdge += txtdiff;
  317. X        gd->Height += txtdiff;
  318. X        switch( gd->GadgetID )
  319. X        {
  320. X            case GADOUTFILE:
  321. X            gd->TopEdge += txtdiff;
  322. X            break;
  323. X            case GADDEFLOAD:
  324. X            case GADDEFSAVE:
  325. X            case GADEDOPTIONS:
  326. X            gd->TopEdge += txtdiff * 3;
  327. X            break;
  328. X            default:
  329. X            if( ( gd->Flags & GADGHIGHBITS ) == GADGHNONE )
  330. X                gd->TopEdge += txtdiff * 2;
  331. X            break;
  332. X        }
  333. X        SetBorder( gd, -1 );
  334. X        }
  335. X    }
  336. X
  337. X    /* Move the text down as appropriate */
  338. X
  339. X    for( ip = &Defs_IntuiTextList11; ip; ip = ip->NextText )
  340. X    {
  341. X        if( *ip->IText == 'C' )
  342. X        ip->TopEdge += txtdiff * 2;
  343. X        else if( *ip->IText == 'O' )
  344. X        ip->TopEdge += txtdiff;
  345. X    }
  346. X
  347. X    /* Adjust the height of the window */
  348. X    Defs_NewWindowStructure11.Height += txtdiff * 5;
  349. X    ++once;
  350. X    }
  351. X
  352. X    Defs_NewWindowStructure11.Screen = scrn;
  353. X
  354. X    /* Set Correct title */
  355. X    if( gametype == GAME_FROM_DEFAULT )
  356. X    Defs_NewWindowStructure11.Title = "Edit Default Game Definition";
  357. X    else if( gametype == GAME_FROM_INFO )
  358. X    Defs_NewWindowStructure11.Title = "Edit Game Definition";
  359. X    else
  360. X    {
  361. X    errmsg( FLASH, "Can't edit game of type %d", gametype );
  362. X    return;
  363. X    }
  364. X
  365. X    if( ( cwin = MyOpenWindow( &Defs_NewWindowStructure11 ) ) == NULL )
  366. X    {
  367. X    errmsg( FLASH, "Can't create requester window" );
  368. X    return;
  369. X    }
  370. X
  371. X    PrintIText( cwin->RPort, &Defs_IntuiTextList11, 0, txtdiff );
  372. X    UpdateTypes( cwin );
  373. X
  374. X    /* Do Menu Layouts Based on FontHeight */
  375. X    SetUpMenus( &Defs_MenuList11, scrn );
  376. X    SetMenuStrip( cwin, &Defs_MenuList11 );
  377. X
  378. X    /* Process messages */
  379. X    while( !done )
  380. X    {
  381. X    WaitPort( cwin->UserPort );
  382. X    while( ( imsg = (void *) GetMsg( cwin->UserPort ) ) != NULL )
  383. X    {
  384. X        mcode = imsg->Code;
  385. X        gd = (struct Gadget *)imsg->IAddress;
  386. X        qual = imsg->Qualifier;
  387. X        class = imsg->Class;
  388. X        code = imsg->Code;
  389. X
  390. X        ReplyMsg( (struct Message *)imsg );
  391. X
  392. X        switch( class )
  393. X        {
  394. X        case VANILLAKEY:
  395. X            /* Escape or LEFT_AMIGA-b aborts the requester... */
  396. X            if( code == '\33' || (code == 'b' && (qual&AMIGALEFT)))
  397. X            {
  398. X            done = 1;
  399. X            }
  400. X            break;
  401. X
  402. X        case ACTIVEWINDOW:
  403. X            if( gd = FindGadget( cwin, NULL, GADCHARNAME ) )
  404. X            ActivateGadget( gd, cwin, NULL );
  405. X            break;
  406. X
  407. X        case MENUPICK:
  408. X            while( mcode != MENUNULL )
  409. X            {
  410. X            switch(MENUNUM(mcode))
  411. X            {
  412. X                case PLAYERMENU:
  413. X                defgame.pltype = ITEMNUM( mcode );
  414. X                UpdateTypes( cwin );
  415. X                break;
  416. X            }
  417. X            mcode = ((struct MenuItem *)
  418. X                ItemAddress( &Defs_MenuList11,
  419. X                mcode))->NextSelect;
  420. X            }
  421. X            break;
  422. X
  423. X        case CLOSEWINDOW:
  424. X            CopyGad2Defs( );
  425. X            done = 1;
  426. X            break;
  427. X
  428. X        case GADGETUP:
  429. X            switch( gd->GadgetID )
  430. X            {
  431. X            case GADEDOPTIONS:
  432. X                CopyOptions( curopts, gptr );
  433. X                if( EditOptions( curopts ) )
  434. X                SetOptions( curopts, gptr );
  435. X                break;
  436. X
  437. X            case GADDEFSAVE:
  438. X                CopyGad2Defs( );
  439. X                sprintf( buf,
  440. X                "Game definition saved in: %s", DefOutFile );
  441. X                errmsg( NO_FLASH, buf );
  442. X                SaveDefaults( DefOutFile );
  443. X                break;
  444. X
  445. X            case GADDEFLOAD:
  446. X                LoadDefaults( DefPlayerName );
  447. X                strcpy( DefOutFile, DefPlayerName );
  448. X                CopyDefs2Gad();
  449. X                UpdateTypes( cwin );
  450. X                sprintf( buf, "Game definition loaded from: %s",
  451. X                DefPlayerName );
  452. X                errmsg( NO_FLASH, buf );
  453. X                break;
  454. X
  455. X            default:
  456. X                break;
  457. X            }
  458. X            break;
  459. X        }
  460. X    }
  461. X    }
  462. X
  463. X    SafeCloseWindow( cwin );
  464. X}
  465. X
  466. Xvoid do_gadgetup( imsg )
  467. X    register struct IntuiMessage *imsg;
  468. X{
  469. X    register struct Gadget *gd;
  470. X    register unsigned long hid;
  471. X    int ncol, pot;
  472. X
  473. X    gd = (struct Gadget *) imsg->IAddress;
  474. X
  475. X    switch( gd->GadgetID )
  476. X    {
  477. X    case GADSCROLL:
  478. X        hid = max( cols - vcols, 0 );
  479. X        pot = ( ( struct PropInfo * ) gd->SpecialInfo )->HorizPot;
  480. X        ncol = (hid * pot) / MAXPOT;
  481. X        if( ncol != curcol )
  482. X        {
  483. X        curcol = ncol;
  484. X        MapGadgets( R_SCROLL, 0 ); /* redisplay the icons */
  485. X        }
  486. X        break;
  487. X    }
  488. X}
  489. X
  490. Xvoid do_buttons( imsg )
  491. X    register struct IntuiMessage *imsg;
  492. X{
  493. X    if( imsg->Code == SELECTDOWN || imsg->Code == SELECTUP )
  494. X    {
  495. X    if( lastgaddown )
  496. X    {
  497. X        SetGadgetUP( &lastgaddown->dobj->do_Gadget );
  498. X        lastgaddown->secs = 0;
  499. X        lastgaddown->mics = 0;
  500. X    }
  501. X    lastgaddown = NULL;
  502. X    ChgGameItems( &MenuList1, 0 );
  503. X    }
  504. X}
  505. X
  506. Xvoid do_gadgetdown( imsg )
  507. X    register struct IntuiMessage *imsg;
  508. X{
  509. X    register GPTR gptr;
  510. X    register struct Gadget *gd;
  511. X
  512. X    gd = (struct Gadget *) imsg->IAddress;
  513. X
  514. X    /* Don't do anything for these gadgets */
  515. X
  516. X    if( gd->GadgetID < GADNEWGAME )
  517. X    {
  518. X    return;
  519. X    }
  520. X
  521. X    /* Check just to make sure we got it */
  522. X
  523. X    for( gptr = windowgads; gptr &&
  524. X    gptr->dobj->do_Gadget.GadgetID != gd->GadgetID; )
  525. X    {
  526. X    gptr = gptr->nextwgad;
  527. X    }
  528. X
  529. X    if( !gptr )
  530. X    {
  531. X    errmsg( FLASH, "Bad GadgetID for GadgetDOWN" );
  532. X    return;
  533. X    }
  534. X
  535. X    /* Fix the gadget images */
  536. X
  537. X    if( lastgaddown && &lastgaddown->dobj->do_Gadget != gd )
  538. X    {
  539. X    SetGadgetUP( &lastgaddown->dobj->do_Gadget );
  540. X    gptr->secs = 0;
  541. X    gptr->mics = 0;
  542. X    }
  543. X    SetGadgetDOWN( &((lastgaddown = gptr)->dobj->do_Gadget) );
  544. X
  545. X    /* Only allow game gadgets to be manipulated */
  546. X
  547. X    if( lastgaddown->dobj->do_Gadget.GadgetID == GADNEWGAME )
  548. X    ChgNewGameItems( &MenuList1, 1 );
  549. X    else
  550. X    ChgGameItems( &MenuList1, 1 );
  551. X
  552. X    /* Check if this gadget has been double clicked */
  553. X
  554. X    if( DoubleClick( gptr->secs, gptr->mics, imsg->Seconds, imsg->Micros ) )
  555. X    {
  556. X    run_game( gptr );
  557. X    gptr->secs = 0;
  558. X    gptr->mics = 0;
  559. X    return;
  560. X    }
  561. X
  562. X    gptr->secs = imsg->Seconds;
  563. X    gptr->mics = imsg->Micros;
  564. X}
  565. X
  566. Xvoid menu_setopt()
  567. X{
  568. X    register GPTR gptr;
  569. X
  570. X    if( ( gptr = NeedGame() ) == NULL )
  571. X    return;
  572. X    CopyOptions( curopts, gptr );
  573. X    if( EditOptions( curopts ) )
  574. X    SetOptions( curopts, gptr );
  575. X}
  576. X
  577. Xvoid menu_info()
  578. X{
  579. X    register struct IntuiMessage *imsg;
  580. X    struct IntuiText *ip;
  581. X    char *t;
  582. X    register GPTR gptr;
  583. X    register struct Gadget *gd;
  584. X    register struct FileInfoBlock *finfo;
  585. X    register struct Window *cwin;
  586. X    register int i;
  587. X    int done = 0, quit;
  588. X    char **sp;
  589. X    static int once = 0;
  590. X    register BPTR lock;
  591. X    long code, class, qual;
  592. X    static struct IntuiText itext[ 4 ];
  593. X    char commentstr[ 100 ], namestr[ 50 ];
  594. X    int txtdiff = scrn->RastPort.TxHeight - 8;
  595. X
  596. X    if( ( gptr = NeedGame() ) == NULL )
  597. X    return;
  598. X
  599. X    if( ( lock = Lock( GameName( gptr, NULL ), ACCESS_READ ) ) == NULL )
  600. X    {
  601. X    /* Can't get lock, reload and return */
  602. X
  603. X    errmsg( FLASH, "Can't Lock game save file: %s",
  604. X        GameName( gptr, NULL ) );
  605. X    MapGadgets( R_DISK, 1 );
  606. X    return;
  607. X    }
  608. X
  609. X    finfo = (struct FileInfoBlock *)xmalloc(sizeof(struct FileInfoBlock));
  610. X    Examine( lock, finfo );
  611. X    UnLock( lock );
  612. X    strncpy( commentstr, finfo->fib_Comment, sizeof( finfo->fib_Comment ) );
  613. X    commentstr[ sizeof( finfo->fib_Comment ) ] = 0;
  614. X    free( finfo );
  615. X
  616. X    for( i = 0; i < 4; ++i )
  617. X    {
  618. X    itext[ i ].FrontPen = C_BLACK;
  619. X    itext[ i ].BackPen = C_GREY;
  620. X    itext[ i ].DrawMode = JAM2;
  621. X    itext[ i ].TopEdge = 2;
  622. X    itext[ i ].LeftEdge = 4;
  623. X    }
  624. X    ReallocTools( gptr, 0 );
  625. X    sp = gptr->dobj->do_ToolTypes;
  626. X
  627. X    if( !once )
  628. X    {
  629. X    Info_Comment.TopEdge += txtdiff*2;
  630. X    Info_Class.TopEdge += txtdiff;
  631. X    Info_NewWindowStructure6.Height += txtdiff * 6;
  632. X    for( gd = Info_NewWindowStructure6.FirstGadget;
  633. X        gd; gd = gd->NextGadget )
  634. X    {
  635. X        gd->TopEdge += txtdiff;
  636. X        if( gd->GadgetID != GADTOOLUP && gd->GadgetID != GADTOOLDOWN )
  637. X        gd->Height += txtdiff;
  638. X        switch( gd->GadgetID )
  639. X        {
  640. X        case 0:
  641. X            break;
  642. X
  643. X        case GADTOOLTYPES:
  644. X            gd->TopEdge += txtdiff*4;
  645. X            SetBorder( gd, -1 );
  646. X            break;
  647. X
  648. X        case GADDELTOOL:
  649. X            gd->TopEdge += txtdiff*3;
  650. X            SetBorder( gd, -1 );
  651. X            break;
  652. X
  653. X        case GADADDTOOL:
  654. X            gd->TopEdge += txtdiff*3;
  655. X            SetBorder( gd, -1 );
  656. X            break;
  657. X
  658. X        case GADTOOLUP:
  659. X            gd->TopEdge += txtdiff*4;
  660. X            gd->Flags &= ~GADGHIGHBITS;
  661. X            gd->Flags |= GADGIMAGE|GADGHIMAGE;
  662. X            gd->GadgetRender = (APTR)&up_selectimage;
  663. X            gd->SelectRender = (APTR)&up_renderimage;
  664. X            break;
  665. X
  666. X        case GADTOOLDOWN:
  667. X            gd->TopEdge += txtdiff*5;
  668. X            gd->Flags &= ~GADGHIGHBITS;
  669. X            gd->Flags |= GADGIMAGE|GADGHIMAGE;
  670. X            gd->GadgetRender = (APTR)&down_selectimage;
  671. X            gd->SelectRender = (APTR)&down_renderimage;
  672. X            break;
  673. X
  674. X        default:
  675. X            SetBorder( gd, -1 );
  676. X        }
  677. X    }
  678. X    for( ip = &Info_IntuiTextList6; ip; ip = ip->NextText )
  679. X    {
  680. X        if( *ip->IText == 'C' )
  681. X        {
  682. X        if( ip->IText[1] == 'o' )
  683. X            ip->TopEdge += 2*txtdiff;
  684. X        else
  685. X            ip->TopEdge += txtdiff;
  686. X        }
  687. X        else if( *ip->IText == 'T' )
  688. X        ip->TopEdge += 4*txtdiff;
  689. X    }
  690. X    ++once;
  691. X    }
  692. X
  693. X    gd = &Info_EditDef;
  694. X    if( access( GameName( gptr, gptr->name ), 1 ) == 0 )
  695. X    gd->Flags |= GADGDISABLED;
  696. X    else
  697. X    gd->Flags &= ~GADGDISABLED;
  698. X
  699. X    /* Put in the comment */
  700. X
  701. X    Info_Comment.GadgetText = &itext[ 0 ];
  702. X    itext[ 0 ].IText = commentstr;
  703. X
  704. X    /* The players name */
  705. X
  706. X    Info_Player.GadgetText = &itext[ 1 ];
  707. X    strncpy( namestr, ToolsEntry( gptr, "NAME" ), sizeof( namestr ) );
  708. X    namestr[ sizeof( namestr ) - 1 ] = 0;
  709. X    if( *namestr == 0 )
  710. X    {
  711. X    strncpy( namestr, gptr->name, sizeof( namestr ) );
  712. X    namestr[ sizeof( namestr ) - 1 ] = 0;
  713. X    }
  714. X    if( ( t = strrchr( namestr, '.' ) ) && stricmp( t, ".sav" ) == 0 )
  715. X    *t = 0;
  716. X    itext[ 1 ].IText = namestr;
  717. X
  718. X    /* The character class of the player */
  719. X
  720. X    Info_Class.GadgetText = &itext[ 2 ];
  721. X    itext[ 2 ].IText = ToolsEntry( gptr, "CHARACTER" );
  722. X
  723. X    /* If there are ToolTypes entries, put the first one into the gadget */
  724. X
  725. X    if( sp && *sp )
  726. X    strcpy( StrTools, *sp );
  727. X
  728. X    if( IsEditEntry( StrTools, gptr ) )
  729. X    Info_ToolTypes.Flags &= ~GADGDISABLED;
  730. X    else
  731. X    Info_ToolTypes.Flags |= GADGDISABLED;
  732. X
  733. X    Info_NewWindowStructure6.Screen = scrn;
  734. X    if( ( cwin = MyOpenWindow( &Info_NewWindowStructure6 ) ) == NULL )
  735. X    {
  736. X    errmsg( FLASH, "Can't create info window" );
  737. X    return;
  738. X    }
  739. X    PrintIText( cwin->RPort, &Info_IntuiTextList6, 0, txtdiff );
  740. X
  741. X    while( !done )
  742. X    {
  743. X    WaitPort( cwin->UserPort );
  744. X    while( ( imsg = (void *) GetMsg( cwin->UserPort ) ) != NULL )
  745. X    {
  746. X        class = imsg->Class;
  747. X        code = imsg->Code;
  748. X        qual = imsg->Qualifier;
  749. X        gd = (struct Gadget *)imsg->IAddress;
  750. X
  751. X        ReplyMsg( (struct Message *)imsg );
  752. X
  753. X        switch( class )
  754. X        {
  755. X        case VANILLAKEY:
  756. X            if( code == '\33' || (code == 'b' && (qual&AMIGALEFT)) )
  757. X            {
  758. X            done = 1;
  759. X            quit = 0;
  760. X            }
  761. X            break;
  762. X
  763. X        case CLOSEWINDOW:
  764. X            if( sp )
  765. X            {
  766. X            if( *sp )
  767. X                free( *sp );
  768. X            *sp = strdup( StrTools );
  769. X            }
  770. X            done = 1;
  771. X            quit = 0;
  772. X            break;
  773. X
  774. X        case GADGETUP:
  775. X            switch( gd->GadgetID )
  776. X            {
  777. X            case GADEDDEF:
  778. X                /* Put the game values into the defaults */
  779. X
  780. X                Game2Defs( gptr );
  781. X
  782. X                /* Put the options into the options array */
  783. X
  784. X                CopyOptions( curopts, gptr );
  785. X
  786. X                /* Edit the defaults */
  787. X
  788. X                menu_editdef( GAME_FROM_INFO );
  789. X
  790. X                /* Put the options back in */
  791. X
  792. X                SetOptions( curopts, gptr );
  793. X
  794. X                /* Move defaults to game */
  795. X
  796. X                SetToolLine( gptr, "NAME", defgame.plname );
  797. X                SetToolLine( gptr, "CHARACTER",
  798. X                defgame.pltype ?
  799. X                players[ defgame.pltype ] : "" );
  800. X                itext[ 2 ].IText =
  801. X                ToolsEntry( gptr, "CHARACTER" );
  802. X                strncpy( namestr, ToolsEntry( gptr, "NAME" ),
  803. X                sizeof( namestr ) );
  804. X                namestr[ sizeof( namestr ) - 1 ] = 0;
  805. X                if( *namestr == 0 )
  806. X                {
  807. X                strncpy( namestr, gptr->name, sizeof(namestr) );
  808. X                namestr[ sizeof( namestr ) - 1 ] = 0;
  809. X                }
  810. X                if( ( t = strrchr( namestr, '.' ) ) &&
  811. X                stricmp( t, ".sav" ) == 0 )
  812. X                {
  813. X                *t = 0;
  814. X                }
  815. X                itext[ 1 ].IText = namestr;
  816. X
  817. X                /* Make sure that the correct ToolTypes line
  818. X                 * is displayed in the gadget.
  819. X                 */
  820. X
  821. X                strcpy( StrTools, *sp );
  822. X                UpdateInfoWin( cwin );
  823. X                break;
  824. X
  825. X            case GADADDTOOL:
  826. X                ReallocTools( gptr, 1 );
  827. X                sp = gptr->dobj->do_ToolTypes;
  828. X                for( i = 0; sp[ i ]; ++i )
  829. X                ;
  830. X                sp[i] = strdup( "" );
  831. X                sp[i+1] = NULL;
  832. X                itext[ 2 ].IText =
  833. X                ToolsEntry( gptr, "CHARACTER" );
  834. X                *StrTools = 0;
  835. X                UpdateInfoWin( cwin );
  836. X                sp += i;
  837. X                break;
  838. X
  839. X            case GADDELTOOL:
  840. X                while( *sp = sp[1] )
  841. X                ++sp;
  842. X                sp = gptr->dobj->do_ToolTypes;
  843. X                strcpy( StrTools, *sp ? *sp : "" );
  844. X                UpdateInfoWin( cwin );
  845. X                break;
  846. X
  847. X            case GADTOOLTYPES:
  848. X                if( sp && *sp && CheckAndCopy( StrTools, *sp ) )
  849. X                {
  850. X                if( *sp )
  851. X                    free( *sp );
  852. X                *sp = strdup( StrTools );
  853. X                }
  854. X                break;
  855. X
  856. X            case GADTOOLDOWN:
  857. X                if( sp && *sp && CheckAndCopy( StrTools, *sp ) )
  858. X                {
  859. X                if( *sp )
  860. X                    free( *sp );
  861. X                *sp = strdup( StrTools );
  862. X                }
  863. X                if( sp != NULL && sp[1] != NULL )
  864. X                {
  865. X                ++sp;
  866. X                strcpy( StrTools, *sp );
  867. X                if( IsEditEntry( StrTools, gptr ) )
  868. X                    Info_ToolTypes.Flags &= ~GADGDISABLED;
  869. X                else
  870. X                    Info_ToolTypes.Flags |= GADGDISABLED;
  871. X                }
  872. X                else
  873. X                {
  874. X                if( sp && *sp )
  875. X                    strcpy( StrTools, *sp );
  876. X                DisplayBeep( NULL );
  877. X                }
  878. X                break;
  879. X
  880. X            case GADTOOLUP:
  881. X                if( sp && *sp && CheckAndCopy( StrTools, *sp ) )
  882. X                {
  883. X                if( *sp )
  884. X                    free( *sp );
  885. X                *sp = strdup( StrTools );
  886. X                }
  887. X                if( sp && sp > gptr->dobj->do_ToolTypes )
  888. X                {
  889. X                --sp;
  890. X                strcpy( StrTools, *sp );
  891. X                if( IsEditEntry( StrTools, gptr ) )
  892. X                    Info_ToolTypes.Flags &= ~GADGDISABLED;
  893. X                else
  894. X                    Info_ToolTypes.Flags |= GADGDISABLED;
  895. X                }
  896. X                else
  897. X                {
  898. X                DisplayBeep( NULL );
  899. X                }
  900. X                break;
  901. X            }
  902. X            RefreshGList( &Info_ToolTypes, cwin, NULL, 1 );
  903. X            break;
  904. X        }
  905. X    }
  906. X    }
  907. X
  908. X    SafeCloseWindow( cwin );
  909. X}
  910. X
  911. Xstatic void
  912. XUpdateInfoWin( cwin )
  913. X    struct Window *cwin;
  914. X{
  915. X    SetAPen( cwin->RPort, 0 );
  916. X    SetBPen( cwin->RPort, 0 );
  917. X    SetDrMd( cwin->RPort, JAM2 );
  918. X    RectFill( cwin->RPort,
  919. X    Info_Class.LeftEdge,
  920. X    Info_Class.TopEdge,
  921. X    Info_Class.LeftEdge + Info_Class.Width-1,
  922. X    Info_Class.TopEdge + Info_Class.Height-1 );
  923. X    RectFill( cwin->RPort,
  924. X    Info_Player.LeftEdge,
  925. X    Info_Player.TopEdge,
  926. X    Info_Player.LeftEdge + Info_Player.Width-1,
  927. X    Info_Player.TopEdge + Info_Player.Height-1 );
  928. X    RefreshGList( cwin->FirstGadget, cwin, NULL, -1 );
  929. X}
  930. X
  931. Xvoid
  932. Xerrmsg(int flash, char *str, ...)
  933. X{
  934. X    static char buf[ 200 ];
  935. X    int wid;
  936. X    va_list vp;
  937. X
  938. X    va_start( vp, str );
  939. X
  940. X    if( !win || !wbopen )
  941. X    {
  942. X    vprintf( str, vp );
  943. X    va_end( vp );
  944. X    return;
  945. X    }
  946. X    errup = 1;
  947. X    wid = ( win->Width + Message.LeftEdge - win->BorderRight - 3 ) /
  948. X            win->RPort->TxWidth;
  949. X    vsprintf( buf, str, vp );
  950. X    va_end( vp );
  951. X
  952. X    SetAPen( win->RPort, 0 );
  953. X    SetBPen( win->RPort, 0 );
  954. X    SetDrMd( win->RPort, JAM2 );
  955. X    RectFill( win->RPort, Message.LeftEdge, Message.TopEdge,
  956. X    win->Width + Message.Width,
  957. X    Message.TopEdge + Message.Height - 1 );
  958. X
  959. X    Message.GadgetText->IText = buf;
  960. X    RefreshGList( &Message, win, 0, 1 );
  961. X
  962. X    if( flash == FLASH )
  963. X    DisplayBeep( scrn );
  964. X}
  965. X
  966. X/*
  967. X * Issue an error message to the users window because it can not be done
  968. X * any other way.
  969. X */
  970. X
  971. Xvoid error( str )
  972. X    register char *str;
  973. X{
  974. X    char s[ 50 ];
  975. X    if( scrn ) ScreenToBack( scrn );
  976. X    Delay( 10 );
  977. X    fprintf( stderr, "%s\n", str );
  978. X    fprintf( stderr, "Hit Return: " );
  979. X    fflush( stderr );
  980. X    gets( s );
  981. X    if( scrn ) ScreenToFront( scrn );
  982. X}
  983. X
  984. X/*
  985. X * Make the gadget deselected
  986. X */
  987. X
  988. Xvoid SetGadgetUP( gad )
  989. X    register struct Gadget *gad;
  990. X{
  991. X    RemoveGadget( win, gad );
  992. X    gad->Flags &= ~(SELECTED|GADGHIGHBITS);
  993. X    gad->Flags |= GADGHIMAGE|GADGIMAGE;
  994. X    gad->Activation |= TOGGLESELECT;
  995. X    AddGadget( win, gad, 0 );
  996. X    RefreshGList( gad, win, NULL, 1 );
  997. X    RemoveGadget( win, gad );
  998. X    gad->Flags &= ~(GADGHIGHBITS);
  999. X    gad->Flags |= GADGHNONE;
  1000. X    gad->Activation &= ~TOGGLESELECT;
  1001. X    AddGadget( win, gad, 0 );
  1002. X}
  1003. X
  1004. X/*
  1005. X * Make the gadget selected
  1006. X */
  1007. X
  1008. Xvoid SetGadgetDOWN( gad )
  1009. X    register struct Gadget *gad;
  1010. X{
  1011. X    RemoveGadget( win, gad );
  1012. X    gad->Flags &= ~GADGHIGHBITS;
  1013. X    gad->Flags |= GADGHIMAGE|GADGIMAGE|SELECTED;
  1014. X    gad->Activation |= TOGGLESELECT;
  1015. X    AddGadget( win, gad, 0 );
  1016. X    RefreshGList( gad, win, NULL, 1 );
  1017. X    RemoveGadget( win, gad );
  1018. X    gad->Flags &= ~(GADGHIGHBITS);
  1019. X    gad->Flags |= GADGHNONE;
  1020. X    gad->Activation &= ~TOGGLESELECT;
  1021. X    AddGadget( win, gad, 0 );
  1022. X}
  1023. X
  1024. X/*
  1025. X * Generate a requester for a string value.
  1026. X */
  1027. X
  1028. Xint StrRequest( prompt, buff, val )
  1029. X    char *prompt, *buff, *val;
  1030. X{
  1031. X    struct Window *cwin;
  1032. X    struct IntuiMessage *imsg;
  1033. X    int done = 0, notcan = 1;
  1034. X    long class, code, qual;
  1035. X    struct Gadget *gd;
  1036. X    static int once = 0;
  1037. X    int txtdiff = scrn->RastPort.TxHeight - 8;
  1038. X
  1039. X    *StrString = 0;
  1040. X    if( val )
  1041. X    strcpy( StrString, val );
  1042. X    Str_NewWindowStructure5.Title = prompt;
  1043. X
  1044. X    if( !once )
  1045. X    {
  1046. X    for( gd = Str_NewWindowStructure5.FirstGadget;
  1047. X            gd; gd = gd->NextGadget )
  1048. X    {
  1049. X        if( gd->GadgetID != 0 )
  1050. X        {
  1051. X        gd->TopEdge += txtdiff;
  1052. X        gd->Height += txtdiff;
  1053. X        SetBorder( gd, -1 );
  1054. X        }
  1055. X    }
  1056. X    ++once;
  1057. X    Str_NewWindowStructure5.Height += txtdiff * 2;
  1058. X    }
  1059. X
  1060. X    Str_NewWindowStructure5.Screen = scrn;
  1061. X    if( ( cwin = MyOpenWindow( &Str_NewWindowStructure5 ) ) == NULL )
  1062. X    {
  1063. X    errmsg( FLASH, "Can't create requester window" );
  1064. X    return( 0 );
  1065. X    }
  1066. X
  1067. X    while( !done )
  1068. X    {
  1069. X    WaitPort( cwin->UserPort );
  1070. X    while( ( imsg = (void *) GetMsg( cwin->UserPort ) ) != NULL )
  1071. X    {
  1072. X        class = imsg->Class;
  1073. X        code = imsg->Code;
  1074. X        qual = imsg->Qualifier;
  1075. X        gd = (struct Gadget *) imsg->IAddress;
  1076. X        ReplyMsg( (struct Message *) imsg );
  1077. X        switch( class )
  1078. X        {
  1079. X        case ACTIVEWINDOW:
  1080. X            ActivateGadget( &Str_String, cwin, NULL );
  1081. X            break;
  1082. X
  1083. X        case GADGETUP:
  1084. X            switch( gd->GadgetID )
  1085. X            {
  1086. X            case GADSTRCANCEL:
  1087. X                notcan = 0;
  1088. X                done = 1;
  1089. X                break;
  1090. X
  1091. X            default:
  1092. X                strcpy( buff, StrString );
  1093. X                done = 1;
  1094. X                break;
  1095. X            }
  1096. X            break;
  1097. X
  1098. X        case CLOSEWINDOW:
  1099. X            strcpy( buff, StrString );
  1100. X            done = 1;
  1101. X            break;
  1102. X
  1103. X        case VANILLAKEY:
  1104. X            if( code == '\33' || code == 'b' && (qual&AMIGALEFT) )
  1105. X            {
  1106. X            done = 1;
  1107. X            notcan = 0;
  1108. X            }
  1109. X            break;
  1110. X        }
  1111. X    }
  1112. X    }
  1113. X
  1114. X    SafeCloseWindow( cwin );
  1115. X    return( notcan );
  1116. X}
  1117. X
  1118. X/*
  1119. X * Load a defaults file into global structures
  1120. X */
  1121. X
  1122. Xvoid LoadDefaults( player )
  1123. X    char *player;
  1124. X{
  1125. X    FILE *fp;
  1126. X    int i;
  1127. X    char fname[ 100 ];
  1128. X    char buf[ 200 ];
  1129. X    char *t;
  1130. X
  1131. X    sprintf( fname, "%s.def", player );
  1132. X
  1133. X    if( ( fp = fopen( fname, "r" ) ) == NULL )
  1134. X    {
  1135. X    errmsg( FLASH,
  1136. X        "Can't open defaults, %s, in current directory", fname );
  1137. X    return;
  1138. X    }
  1139. X
  1140. X    while( fgets( buf, sizeof( buf ), fp ) != NULL )
  1141. X    {
  1142. X    if( *buf == '#' )
  1143. X        continue;
  1144. X
  1145. X    if( ( t = strchr( buf, '\n' ) ) != NULL )
  1146. X        *t = 0;
  1147. X    if( strnicmp( "PLAYER=", buf, 7 ) == 0 )
  1148. X    {
  1149. X        if( defgame.plname )
  1150. X        free( defgame.plname );
  1151. X        defgame.plname = strdup( buf + 7 );
  1152. X    }
  1153. X    else if( strnicmp( "PLAYERTYPE=", buf, 11 ) == 0 )
  1154. X    {
  1155. X        for( i = 0; players[ i ]; ++i )
  1156. X        {
  1157. X        if( strnicmp( &buf[11], players[ i ], 1 ) == 0 )
  1158. X            break;
  1159. X        }
  1160. X
  1161. X        if( players[ i ] )
  1162. X        defgame.pltype = i;
  1163. X        else
  1164. X        defgame.pltype = 0;
  1165. X    }
  1166. X    else if( strnicmp( "OPTIONS=", buf, 8 ) == 0 )
  1167. X    {
  1168. X        errmsg( FLASH, "OPTIONS set by game configuration" );
  1169. X        setoneopt( OPTIONS_IDX, buf+8 );
  1170. X        defgame.options = strdup( buf + 8 );
  1171. X    }
  1172. X    else
  1173. X        errmsg( FLASH, "Invalid line in defaults file" );
  1174. X    }
  1175. X    fclose( fp );
  1176. X}
  1177. X
  1178. X/*
  1179. X * Create a defaults file my the name given with all of the global
  1180. X * information currently set.
  1181. X */
  1182. X
  1183. Xvoid SaveDefaults( player )
  1184. X    char *player;
  1185. X{
  1186. X    FILE *fp;
  1187. X    char fname[ 100 ];
  1188. X    int err;
  1189. X
  1190. X    sprintf( fname, "%s.def", player );
  1191. X
  1192. X    if( ( fp = fopen( fname, "w" ) ) == NULL )
  1193. X    {
  1194. X    errmsg( FLASH, "Can't open defaults file: %s", fname );
  1195. X    return;
  1196. X    }
  1197. X
  1198. X    err = fprintf( fp, "PLAYER=%s\n", defgame.plname );
  1199. X    if( defgame.pltype )
  1200. X    err |= fprintf( fp, "PLAYERTYPE=%s\n", players[ defgame.pltype ] );
  1201. X    else
  1202. X    err |= fprintf( fp, "PLAYERTYPE=<RANDOM>\n" );
  1203. X
  1204. X    /* Get the options. */
  1205. X    PutOptions( curopts );
  1206. X
  1207. X    /* Put them in too */
  1208. X    err |= fprintf( fp, "OPTIONS=%s\n", options[ OPTIONS_IDX ] );
  1209. X    err |= fclose( fp );
  1210. X
  1211. X    if( err == EOF )
  1212. X    errmsg( FLASH, "Error writing out defaults for: %s", fname );
  1213. X}
  1214. X
  1215. X/*
  1216. X * Copy the defgame structure values into the Defs windows gadgets
  1217. X */
  1218. X
  1219. Xvoid CopyDefs2Gad()
  1220. X{
  1221. X    if( defgame.plname )
  1222. X    strcpy( DefPlayerName, defgame.plname );
  1223. X    else
  1224. X    *DefPlayerName = 0;
  1225. X
  1226. X    CheckOnly( &Defs_MenuList11, 0, defgame.pltype );
  1227. X
  1228. X    /* If there are default options fill them in, else reset
  1229. X     * to the real defaults.
  1230. X     */
  1231. X    if( defgame.options )
  1232. X    CopyOptionStr( curopts, defgame.options );
  1233. X    else
  1234. X    ZapOptions( curopts );
  1235. X}
  1236. X
  1237. X/*
  1238. X * Copy the Defs window gadgets into the defgame structure
  1239. X */
  1240. X
  1241. Xvoid CopyGad2Defs( )
  1242. X{
  1243. X    if( defgame.plname )
  1244. X    free( defgame.plname );
  1245. X    defgame.plname = strdup( DefPlayerName );
  1246. X
  1247. X    defgame.pltype = FindChecked( &Defs_MenuList11, 0 );
  1248. X}
  1249. X
  1250. X/*
  1251. X * Make sure that the correct character type is checked
  1252. X */
  1253. X
  1254. Xvoid UpdateTypes( cwin )
  1255. X    register struct Window *cwin;
  1256. X{
  1257. X    register struct RastPort *rp = cwin->RPort;
  1258. X
  1259. X    SetAPen( rp, 0 );
  1260. X    SetBPen( rp, 0 );
  1261. X    SetDrMd( rp, JAM2 );
  1262. X    RectFill( cwin->RPort,
  1263. X    Defs_PlayerType.LeftEdge+1,
  1264. X    Defs_PlayerType.TopEdge+1,
  1265. X    Defs_PlayerType.LeftEdge+Defs_PlayerType.Width-1,
  1266. X    Defs_PlayerType.TopEdge+Defs_PlayerType.Height-1 );
  1267. X
  1268. X    Defs_PlayerType.GadgetText->IText = players[ defgame.pltype ];
  1269. X    RefreshGList( &Defs_PlayerType, cwin, NULL, 1 );
  1270. X}
  1271. X
  1272. X/*
  1273. X * Ask the user if they really want to do something.
  1274. X */
  1275. X
  1276. XAsk( quest )
  1277. X    char *quest;
  1278. X{
  1279. X    register struct Window *qwin;
  1280. X    register struct Gadget *gd;
  1281. X    register struct IntuiMessage *imsg;
  1282. X    register int done = 0, quit = 1;
  1283. X    int txtdiff;
  1284. X    long class, code, qual;
  1285. X    static int once = 0;
  1286. X    static WORD areabuffer[ 80 ];
  1287. X    static USHORT apat[] = { 0x5555, 0xaaaa };
  1288. X    static struct AreaInfo areaInfo = { 0 };
  1289. X    PLANEPTR pp;
  1290. X    struct TmpRas tmpras;
  1291. X
  1292. X    Quest_NewWindowStructure2.Screen = scrn;
  1293. X    txtdiff = scrn->RastPort.TxHeight - 8;
  1294. X    if( !once )
  1295. X    {
  1296. X    Quest_IntuiTextList2.TopEdge += txtdiff;
  1297. X    Quest_Borders2.TopEdge += txtdiff;
  1298. X    Quest_NewWindowStructure2.Height += txtdiff * 2;
  1299. X    SetBorder( &Quest_Borders2, 3 );
  1300. X    Quest_Yes.TopEdge += txtdiff;
  1301. X    Quest_Yes.Height += txtdiff;
  1302. X    SetBorder( &Quest_Yes, -1 );
  1303. X    Quest_No.TopEdge += txtdiff;
  1304. X    Quest_No.Height += txtdiff;
  1305. X    SetBorder( &Quest_No, -1 );
  1306. X    }
  1307. X
  1308. X    memset( areabuffer, 0, sizeof( areabuffer ) );
  1309. X    if( ( qwin = MyOpenWindow( &Quest_NewWindowStructure2 ) ) == NULL )
  1310. X    {
  1311. X    errmsg( FLASH, "Can't create requester window" );
  1312. X    return( 1 );
  1313. X    }
  1314. X
  1315. X    pp = AllocRaster( qwin->Width, qwin->Height );
  1316. X    if( pp )
  1317. X    {
  1318. X    InitArea( &areaInfo, areabuffer, 160/5 );
  1319. X    qwin->RPort->AreaInfo = &areaInfo;
  1320. X
  1321. X    InitTmpRas( &tmpras, pp, RASSIZE( qwin->Width, qwin->Height ) );
  1322. X    qwin->RPort->TmpRas = &tmpras;
  1323. X
  1324. X    SetAPen( qwin->RPort, C_WHITE );
  1325. X    SetBPen( qwin->RPort, C_GREY );
  1326. X    SetDrMd( qwin->RPort, JAM2 );
  1327. X    SetAfPt( qwin->RPort, apat, 1 );
  1328. X
  1329. X    AreaMove( qwin->RPort, qwin->BorderLeft, qwin->BorderTop );
  1330. X    AreaDraw( qwin->RPort, qwin->Width-qwin->BorderRight, qwin->BorderTop );
  1331. X    AreaDraw( qwin->RPort, qwin->Width - qwin->BorderRight,
  1332. X        qwin->Height - qwin->BorderBottom );
  1333. X    AreaDraw( qwin->RPort, qwin->BorderLeft,
  1334. X        qwin->Height - qwin->BorderBottom );
  1335. X    AreaDraw( qwin->RPort, qwin->BorderLeft, qwin->BorderTop );
  1336. X    AreaEnd( qwin->RPort );
  1337. X
  1338. X    SetAPen( qwin->RPort, C_GREY );
  1339. X    SetBPen( qwin->RPort, C_GREY );
  1340. X    SetDrMd( qwin->RPort, JAM2 );
  1341. X    SetAfPt( qwin->RPort, NULL, 0 );
  1342. X
  1343. X    RectFill( qwin->RPort,
  1344. X        Quest_Borders2.LeftEdge,
  1345. X        Quest_Borders2.TopEdge,
  1346. X        Quest_Borders2.LeftEdge + Quest_Borders2.Width - 1,
  1347. X        Quest_Borders2.TopEdge + Quest_Borders2.Height - 1 );
  1348. X    RectFill( qwin->RPort,
  1349. X        Quest_No.LeftEdge,
  1350. X        Quest_No.TopEdge,
  1351. X        Quest_No.LeftEdge + Quest_No.Width - 1,
  1352. X        Quest_No.TopEdge + Quest_No.Height - 1 );
  1353. X    RectFill( qwin->RPort,
  1354. X        Quest_Yes.LeftEdge,
  1355. X        Quest_Yes.TopEdge,
  1356. X        Quest_Yes.LeftEdge + Quest_Yes.Width - 1,
  1357. X        Quest_Yes.TopEdge + Quest_Yes.Height - 1 );
  1358. X    RefreshGList( qwin->FirstGadget, qwin, NULL, -1 );
  1359. X    }
  1360. X
  1361. X    Quest_IntuiTextList2.LeftEdge = ( qwin->Width -
  1362. X    ( qwin->RPort->TxWidth * strlen( quest ) ) ) / 2;
  1363. X    Quest_IntuiTextList2.IText = quest;
  1364. X    PrintIText( qwin->RPort, &Quest_IntuiTextList2, 0, 0 );
  1365. X    while( !done )
  1366. X    {
  1367. X    WaitPort( qwin->UserPort );
  1368. X    while( ( imsg = (void *) GetMsg( qwin->UserPort ) ) != NULL )
  1369. X    {
  1370. X        class = imsg->Class;
  1371. X        code = imsg->Code;
  1372. X        qual = imsg->Qualifier;
  1373. X        gd = (struct Gadget *)imsg->IAddress;
  1374. X
  1375. X        ReplyMsg( (struct Message *)imsg );
  1376. X
  1377. X        switch( class )
  1378. X        {
  1379. X        case VANILLAKEY:
  1380. X            if( imsg->Qualifier & AMIGALEFT )
  1381. X            {
  1382. X            switch( imsg->Code )
  1383. X            {
  1384. X                case 'v': done = 1; quit = 0; break;
  1385. X                case '\33':
  1386. X                case 'b': done = 1; quit = 1; break;
  1387. X            }
  1388. X            }
  1389. X            break;
  1390. X
  1391. X        case CLOSEWINDOW:
  1392. X            done = 1; quit = 1; break;
  1393. X            break;
  1394. X
  1395. X        case GADGETUP:
  1396. X            switch( gd->GadgetID )
  1397. X            {
  1398. X            case GADQUESTYES: done = 1; quit = 0; break;
  1399. X            case GADQUESTNO: done = 1; quit = 1; break;
  1400. X            }
  1401. X            break;
  1402. X        }
  1403. X    }
  1404. X    }
  1405. X
  1406. X    if( pp )
  1407. X    FreeRaster( pp, qwin->Width, qwin->Height );
  1408. X    once = 1;
  1409. X    SafeCloseWindow( qwin );
  1410. X    return( quit == 0 );
  1411. X}
  1412. X
  1413. X/* Make sure that a game icon is selected and return the pointer to
  1414. X * the GPTR structure associated with it.
  1415. X */
  1416. X
  1417. XGPTR NeedGame()
  1418. X{
  1419. X    register GPTR gptr;
  1420. X
  1421. X    if( lastgaddown == NULL )
  1422. X    {
  1423. X    errmsg( FLASH, "Must select a game" );
  1424. X    return( NULL );
  1425. X    }
  1426. X
  1427. X    for( gptr = windowgads; gptr; gptr = gptr->nextwgad )
  1428. X    {
  1429. X    if( &gptr->dobj->do_Gadget == &lastgaddown->dobj->do_Gadget )
  1430. X        break;
  1431. X    }
  1432. X
  1433. X    if( !gptr )
  1434. X    {
  1435. X    errmsg( FLASH, "BUG: invalid gadget selected for processing" );
  1436. X    return( NULL );
  1437. X    }
  1438. X    return( gptr );
  1439. X}
  1440. X
  1441. X/* Set menu items SELECT flag based on 'enable' */
  1442. X
  1443. Xvoid ChgGameItems( menup, enable )
  1444. X    struct Menu *menup;
  1445. X    int enable;
  1446. X{
  1447. X    struct MenuItem *ip;
  1448. X    int i;
  1449. X    int ino;
  1450. X
  1451. X    /* Make sure the 'Game' menu is there. */
  1452. X
  1453. X    if( !menup || !(menup = menup->NextMenu) || !( ip = menup->FirstItem ) )
  1454. X    {
  1455. X    errmsg( FLASH, "BUG: invalid menu to disable with" );
  1456. X    return;
  1457. X    }
  1458. X
  1459. X    /* Go through all items */
  1460. X
  1461. X    for( i = 0; ip; ip = ip->NextItem, ++i )
  1462. X    {
  1463. X    switch( i )
  1464. X    {
  1465. X        case ITEM_INFO:
  1466. X        case ITEM_SETCOMMENT:
  1467. X        case ITEM_SETOPT:
  1468. X        case ITEM_COPYOPT:
  1469. X        case ITEM_DISCARD:
  1470. X        case ITEM_RENAME:
  1471. X        ino = MENUITEMNO( 1,i,NOSUB );
  1472. X        if( enable )
  1473. X            OnMenu( win, ino );
  1474. X        else
  1475. X            OffMenu( win, ino );
  1476. X        break;
  1477. X    }
  1478. X    }
  1479. X}
  1480. X
  1481. X/* Set menu items SELECT flag based on 'enable' for NEWGAME gadget */
  1482. X
  1483. Xvoid ChgNewGameItems( menup, enable )
  1484. X    struct Menu *menup;
  1485. X    int enable;
  1486. X{
  1487. X    struct MenuItem *ip;
  1488. X    int i;
  1489. X    int ino;
  1490. X
  1491. X    /* Make sure the 'Game' menu is there. */
  1492. X
  1493. X    if( !menup || !(menup = menup->NextMenu) || !( ip = menup->FirstItem ) )
  1494. X    {
  1495. X    errmsg( FLASH, "BUG: invalid menu to disable with" );
  1496. X    return;
  1497. X    }
  1498. X
  1499. X    /* Go through all items */
  1500. X
  1501. X    for( i = 0; ip; ip = ip->NextItem, ++i )
  1502. X    {
  1503. X    switch( i )
  1504. X    {
  1505. X        case ITEM_SETOPT:
  1506. X        case ITEM_RENAME:
  1507. X        case ITEM_DISCARD:
  1508. X        case ITEM_COPYOPT:
  1509. X        ino = MENUITEMNO( 1,i,NOSUB );
  1510. X        OffMenu( win, ino );
  1511. X        break;
  1512. X
  1513. X        case ITEM_INFO:
  1514. X        case ITEM_SETCOMMENT:
  1515. X        ino = MENUITEMNO( 1,i,NOSUB );
  1516. X        if( enable )
  1517. X            OnMenu( win, ino );
  1518. X        else
  1519. X            OffMenu( win, ino );
  1520. X        break;
  1521. X    }
  1522. X    }
  1523. X}
  1524. X
  1525. X/* Edit the OPTIONS= line with a window.  The optr[] array is set up
  1526. X * for the editing already, and will be returned with the values
  1527. X * of the members changed based on the users input
  1528. X */
  1529. X
  1530. Xint EditOptions( optr )
  1531. X    OPTR optr;
  1532. X{
  1533. X    int done = 0, quit = 0;
  1534. X    register struct Window *cwin;
  1535. X    register struct IntuiMessage *imsg;
  1536. X    register struct Gadget *gd;
  1537. X    long code, class, qual;
  1538. X    struct IntuiText *ip;
  1539. X    static int once = 0;
  1540. X    int i;
  1541. X    int txtdiff = scrn->RastPort.TxHeight - 8;
  1542. X
  1543. X    if( !once )
  1544. X    {
  1545. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOCOLOR ))
  1546. X    {
  1547. X        struct Gadget *g;
  1548. X        for( g = Options_NewWindowStructure3.FirstGadget;
  1549. X                g; g = g->NextGadget )
  1550. X        {
  1551. X        if( g == gd )
  1552. X            continue;
  1553. X        if( g->TopEdge == gd->TopEdge )
  1554. X        {
  1555. X            g->Height += txtdiff;
  1556. X        }
  1557. X        }
  1558. X        gd->Height += txtdiff;
  1559. X    }
  1560. X
  1561. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOTIME ))
  1562. X    {
  1563. X        struct Gadget *g;
  1564. X        for( g = Options_NewWindowStructure3.FirstGadget;
  1565. X                g; g = g->NextGadget )
  1566. X        {
  1567. X        if( g == gd )
  1568. X            continue;
  1569. X        if( g->TopEdge == gd->TopEdge )
  1570. X        {
  1571. X            g->TopEdge += txtdiff;
  1572. X            g->Height += txtdiff;
  1573. X        }
  1574. X        }
  1575. X        gd->TopEdge += txtdiff;
  1576. X        gd->Height += txtdiff;
  1577. X    }
  1578. X
  1579. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOPICKUP ))
  1580. X    {
  1581. X        struct Gadget *g;
  1582. X        for( g = Options_NewWindowStructure3.FirstGadget; g; g = g->NextGadget )
  1583. X        {
  1584. X        if( g == gd )
  1585. X            continue;
  1586. X        if( g->TopEdge == gd->TopEdge )
  1587. X        {
  1588. X            g->TopEdge += txtdiff*2;
  1589. X            g->Height += txtdiff;
  1590. X        }
  1591. X        }
  1592. X        gd->TopEdge += txtdiff*2;
  1593. X        gd->Height += txtdiff;
  1594. X    }
  1595. X
  1596. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOHILITEPET ))
  1597. X    {
  1598. X        struct Gadget *g;
  1599. X        for( g = Options_NewWindowStructure3.FirstGadget; g; g = g->NextGadget )
  1600. X        {
  1601. X        if( g == gd )
  1602. X            continue;
  1603. X        if( g->TopEdge == gd->TopEdge )
  1604. X        {
  1605. X            g->TopEdge += txtdiff*3;
  1606. X            g->Height += txtdiff;
  1607. X        }
  1608. X        }
  1609. X        gd->TopEdge += txtdiff*3;
  1610. X        gd->Height += txtdiff;
  1611. X    }
  1612. X
  1613. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOPACKORDER ))
  1614. X    {
  1615. X        gd->TopEdge += txtdiff*4;
  1616. X        gd->Height += txtdiff;
  1617. X    }
  1618. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOCATNAME ))
  1619. X    {
  1620. X        gd->TopEdge += txtdiff*5;
  1621. X        gd->Height += txtdiff;
  1622. X    }
  1623. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADODOGNAME ))
  1624. X    {
  1625. X        gd->TopEdge += txtdiff*6;
  1626. X        gd->Height += txtdiff;
  1627. X    }
  1628. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOFRUIT ))
  1629. X    {
  1630. X        gd->TopEdge += txtdiff*7;
  1631. X        gd->Height += txtdiff;
  1632. X    }
  1633. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOOBJECTS ))
  1634. X    {
  1635. X        gd->TopEdge += txtdiff*8;
  1636. X        gd->Height += txtdiff;
  1637. X    }
  1638. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOOKAY ))
  1639. X    {
  1640. X        gd->TopEdge += txtdiff*9;
  1641. X        gd->Height += txtdiff;
  1642. X    }
  1643. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, GADOCANCEL ))
  1644. X    {
  1645. X        gd->TopEdge += txtdiff*9;
  1646. X        gd->Height += txtdiff;
  1647. X    }
  1648. X    Options_NewWindowStructure3.Height += txtdiff*11;
  1649. X    Options_NewWindowStructure3.TopEdge -= txtdiff*6;
  1650. X    if( Options_NewWindowStructure3.Height +
  1651. X        Options_NewWindowStructure3.TopEdge >= scrn->Height )
  1652. X    {
  1653. X        Options_NewWindowStructure3.TopEdge = scrn->Height -
  1654. X        Options_NewWindowStructure3.Height - 1;
  1655. X    }
  1656. X    if( Options_NewWindowStructure3.TopEdge < 0 )
  1657. X        Options_NewWindowStructure3.TopEdge = 0;
  1658. X    {
  1659. X        if( Options_NewWindowStructure3.Height > scrn->Height )
  1660. X        Options_NewWindowStructure3.Height = scrn->Height;
  1661. X    }
  1662. X
  1663. X    /* Now that heights are correct, render borders */
  1664. X    for( gd = Options_NewWindowStructure3.FirstGadget;
  1665. X        gd; gd = gd->NextGadget )
  1666. X    {
  1667. X        if( gd->GadgetID != 0 )
  1668. X        {
  1669. X        gd->TopEdge += txtdiff;
  1670. X        SetBorder( gd, -1 );
  1671. X        }
  1672. X    }
  1673. X    for( ip = &Options_IntuiTextList3; ip; ip = ip->NextText )
  1674. X    {
  1675. X        if( *ip->IText == 'P' )
  1676. X        ip->TopEdge += txtdiff * 5;
  1677. X        else if( *ip->IText == 'C' )
  1678. X        ip->TopEdge += txtdiff * 6;
  1679. X        else if( *ip->IText == 'D' )
  1680. X        ip->TopEdge += txtdiff * 7;
  1681. X        else if( *ip->IText == 'F' )
  1682. X        ip->TopEdge += txtdiff * 8;
  1683. X        else if( *ip->IText == 'O' )
  1684. X        ip->TopEdge += txtdiff * 9;
  1685. X    }
  1686. X    once = 1;
  1687. X    }
  1688. X
  1689. X    /* Set Gadgets based on options settings */
  1690. X
  1691. X    for( i = 0; optr[ i ].name; ++i )
  1692. X    {
  1693. X    if( gd = FindGadget( NULL, &Options_NewWindowStructure3, optr[i].id ))
  1694. X    {
  1695. X        /* If string valued option, set string */
  1696. X        if( optr[ i ].optstr )
  1697. X        {
  1698. X        strcpy( Sbuff( gd ), optr[i].optstr );
  1699. X        }
  1700. X        else
  1701. X        {
  1702. X        /* If binary option, set the gadget state */
  1703. X        if( optr[i].optval )
  1704. X            gd->Flags |= SELECTED;
  1705. X        else
  1706. X            gd->Flags &= ~SELECTED;
  1707. X        }
  1708. X    }
  1709. X    else
  1710. X    {
  1711. X        errmsg( FLASH, "Can't find gadget %d in options window",
  1712. X                                optr[i].id);
  1713. X    }
  1714. X    }
  1715. X
  1716. X    Options_NewWindowStructure3.Screen = scrn;
  1717. X    if( ( cwin = MyOpenWindow( &Options_NewWindowStructure3 ) ) == NULL )
  1718. X    {
  1719. X    errmsg( FLASH, "Can't create requester window" );
  1720. X    return(0);
  1721. X    }
  1722. X    PrintIText( cwin->RPort, &Options_IntuiTextList3, 0, txtdiff );
  1723. X
  1724. X    while( !done )
  1725. X    {
  1726. X    WaitPort( cwin->UserPort );
  1727. X    while( ( imsg = (void *) GetMsg( cwin->UserPort ) ) != NULL )
  1728. X    {
  1729. X        class = imsg->Class;
  1730. X        code = imsg->Code;
  1731. X        qual = imsg->Qualifier;
  1732. X        gd = (struct Gadget *)imsg->IAddress;
  1733. X        ReplyMsg( (struct Message *) imsg );
  1734. X        switch( class )
  1735. X        {
  1736. X        case ACTIVEWINDOW:
  1737. X            ActivateGadget(
  1738. X            FindGadget( cwin, 0, GADOPACKORDER ), cwin, 0 );
  1739. X            break;
  1740. X
  1741. X        case VANILLAKEY:
  1742. X            if( code == '\33' )
  1743. X            {
  1744. X            done = 1;
  1745. X            quit = 1;
  1746. X            }
  1747. X            else if( code == 'v' && (qual & AMIGALEFT) )
  1748. X            done = 1;
  1749. X            else if( code == 'b' && (qual & AMIGALEFT) )
  1750. X            {
  1751. X            done = 1;
  1752. X            quit = 1;
  1753. X            }
  1754. X            else
  1755. X            {
  1756. X            switch( code )
  1757. X            {
  1758. X                case 'p':
  1759. X                case 'P':
  1760. X                ActivateGadget(
  1761. X                    FindGadget( cwin, 0, GADOPACKORDER ),
  1762. X                    cwin, 0 );
  1763. X                break;
  1764. X                case 'c':
  1765. X                case 'C':
  1766. X                ActivateGadget(
  1767. X                    FindGadget( cwin, 0, GADOCATNAME ),
  1768. X                    cwin, 0 );
  1769. X                break;
  1770. X                case 'd':
  1771. X                case 'D':
  1772. X                ActivateGadget(
  1773. X                    FindGadget( cwin, 0, GADODOGNAME ),
  1774. X                    cwin, 0 );
  1775. X                break;
  1776. X                case 'f':
  1777. X                case 'F':
  1778. X                ActivateGadget(
  1779. X                    FindGadget( cwin, 0, GADOFRUIT ),
  1780. X                    cwin, 0 );
  1781. X                break;
  1782. X                case 'o':
  1783. X                case 'O':
  1784. X                ActivateGadget(
  1785. X                    FindGadget( cwin, 0, GADOOBJECTS ),
  1786. X                    cwin, 0 );
  1787. X                break;
  1788. X            }
  1789. X            }
  1790. X            break;
  1791. X
  1792. X        case CLOSEWINDOW:
  1793. X            done = 1;
  1794. X            break;
  1795. X
  1796. X        case GADGETUP:
  1797. X            switch( gd->GadgetID )
  1798. X            {
  1799. X            case GADOPACKORDER:
  1800. X                ActivateGadget(
  1801. X                FindGadget( cwin, 0, GADOCATNAME ),
  1802. X                cwin, 0 );
  1803. X                break;
  1804. X
  1805. X            case GADOCATNAME:
  1806. X                ActivateGadget(
  1807. X                FindGadget( cwin, 0, GADODOGNAME ),
  1808. X                cwin, 0 );
  1809. X                break;
  1810. X
  1811. X            case GADODOGNAME:
  1812. X                ActivateGadget(
  1813. X                FindGadget( cwin, 0, GADOFRUIT ),
  1814. X                cwin, 0 );
  1815. X                break;
  1816. X
  1817. X            case GADOFRUIT:
  1818. X                ActivateGadget(
  1819. X                FindGadget( cwin, 0, GADOOBJECTS ),
  1820. X                cwin, 0 );
  1821. X                break;
  1822. X
  1823. X            case GADOOBJECTS:
  1824. X                break;
  1825. X
  1826. X            case GADOOKAY:
  1827. X                done = 1;
  1828. X                break;
  1829. X
  1830. X            case GADOCANCEL:
  1831. X                quit = 1;
  1832. X                done = 1;
  1833. X                break;
  1834. X
  1835. X            default:
  1836. X                for( i = 0; optr[i].name; ++i )
  1837. X                {
  1838. X                if( optr[i].id == gd->GadgetID )
  1839. X                    break;
  1840. X                }
  1841. X
  1842. X                if( optr[i].name )
  1843. X                {
  1844. X                if( optr[ i ].optstr != NULL )
  1845. X                {
  1846. X                    if( optr[i].optstr && *optr[i].optstr )
  1847. X                    free( optr[i].optstr );
  1848. X
  1849. X                    if( *Sbuff(gd) == 0 )
  1850. X                    {
  1851. X                    optr[i].optstr = "";
  1852. X                    }
  1853. X                    else
  1854. X                    {
  1855. X                    optr[i].optstr = strdup(Sbuff(gd));
  1856. X                    }
  1857. X                }
  1858. X                else
  1859. X                {
  1860. X                    optr[i].optval =
  1861. X                        ( gd->Flags & SELECTED ) != 0;
  1862. X                }
  1863. X                }
  1864. X                break;
  1865. X            }
  1866. X            break;
  1867. X        }
  1868. X    }
  1869. X    }
  1870. X
  1871. X    SafeCloseWindow( cwin );
  1872. X    return( quit == 0 );
  1873. X}
  1874. X
  1875. X/*
  1876. X * Put options structure into a string and then make that the
  1877. X * options[ OPTIONS_IDX ] value
  1878. X */
  1879. X
  1880. Xvoid PutOptions( optr )
  1881. X    register OPTR optr;
  1882. X{
  1883. X    register struct Gadget *gd;
  1884. X    register int i, olen = 4096, rlen, didone;
  1885. X    register char *optbuf;
  1886. X
  1887. X    while( olen > 256 )
  1888. X    {
  1889. X    if( ( optbuf = xmalloc( olen ) ) != NULL )
  1890. X    {
  1891. X        break;
  1892. X    }
  1893. X    olen /= 2;
  1894. X    }
  1895. X
  1896. X    if( optbuf == NULL )
  1897. X    {
  1898. X    errmsg( FLASH, "No memory left for options buffer" );
  1899. X    return;
  1900. X    }
  1901. X
  1902. X    /* Account for nul terminator */
  1903. X    *optbuf = 0;
  1904. X
  1905. X    for( i = 0; optr[i].name; ++i )
  1906. X    {
  1907. X    --olen;
  1908. X    didone = 0;
  1909. X    rlen = 0;
  1910. X    gd = FindGadget( 0, &Options_NewWindowStructure3, optr[i].id );
  1911. X
  1912. X    /* If name:value option */
  1913. X    if( optr[i].optstr != NULL )
  1914. X    {
  1915. X        /* If gadget contains some text */
  1916. X        if( gd && *Sbuff( gd ) )
  1917. X        {
  1918. X        /* Free a previously allocated string */
  1919. X        if( optr[i].optstr && *optr[i].optstr )
  1920. X            free( optr[i].optstr );
  1921. X
  1922. X        /* Store "" or save string away */
  1923. X        if( *Sbuff(gd) == 0 )
  1924. X            optr[i].optstr = "";
  1925. X        else
  1926. X            optr[i].optstr = strdup(Sbuff(gd));
  1927. X
  1928. X        rlen = strlen( optr[i].optstr ) + strlen( optr[i].name ) + 1;
  1929. X        if( rlen <= olen )
  1930. X        {
  1931. X            sprintf( optbuf + strlen(optbuf), "%s:%s",
  1932. X            optr[i].name, optr[i].optstr );
  1933. X        }
  1934. X        didone = 1;
  1935. X        }
  1936. X    }
  1937. X    else
  1938. X    {
  1939. X        if( optr[i].optval != optr[i].defval )
  1940. X        {
  1941. X        if( olen >= (rlen = strlen( optr[i].name ) +
  1942. X            (optr[i].optval == 0 ) ) )
  1943. X        {
  1944. X            if( optr[i].optval == 0 )
  1945. X            strcat( optbuf, "!" );
  1946. X            strcat( optbuf, optr[i].name );
  1947. X        }
  1948. X        didone = 1;
  1949. X        }
  1950. X    }
  1951. X
  1952. X    if( rlen > olen )
  1953. X    {
  1954. X        errmsg( FLASH, "Out of space for options" );
  1955. X        break;
  1956. X    }
  1957. X    if( didone )
  1958. X        strcat( optbuf, "," );
  1959. X    }
  1960. X
  1961. X    /* Remove trailing ',' */
  1962. X
  1963. X    if( *optbuf )
  1964. X    optbuf[ strlen( optbuf ) - 1 ] = 0;
  1965. X
  1966. X    setoneopt( OPTIONS_IDX, optbuf );
  1967. X    free( optbuf );
  1968. X}
  1969. X
  1970. Xvoid Game2Defs( gptr )
  1971. X    register GPTR gptr;
  1972. X{
  1973. X    register char *s;
  1974. X    register int i;
  1975. X
  1976. X    if( defgame.plname )
  1977. X    free( defgame.plname );
  1978. X    defgame.plname = strdup( ToolsEntry( gptr, "NAME" ) );
  1979. X
  1980. X    s = ToolsEntry( gptr, "CHARACTER" );
  1981. X    for( i = 0; players[ i ]; ++i )
  1982. X    {
  1983. X    if( strnicmp( s, players[ i ], strlen(s) ) == 0 )
  1984. X        break;
  1985. X    }
  1986. X
  1987. X    if( players[ i ] )
  1988. X    defgame.pltype = i;
  1989. X    else
  1990. X    defgame.pltype = 0;
  1991. X
  1992. X    if( defgame.options )
  1993. X    free( defgame.options );
  1994. X    defgame.options = strdup( ToolsEntry( gptr, "OPTIONS" ) );
  1995. X}
  1996. END_OF_FILE
  1997. if test 43875 -ne `wc -c <'sys/amiga/wb.c2'`; then
  1998.     echo shar: \"'sys/amiga/wb.c2'\" unpacked with wrong size!
  1999. fi
  2000. # end of 'sys/amiga/wb.c2'
  2001. fi
  2002. if test -f 'sys/vms/vmsbuild.com' -a "${1}" != "-c" ; then 
  2003.   echo shar: Will not clobber existing file \"'sys/vms/vmsbuild.com'\"
  2004. else
  2005. echo shar: Extracting \"'sys/vms/vmsbuild.com'\" \(11318 characters\)
  2006. sed "s/^X//" >'sys/vms/vmsbuild.com' <<'END_OF_FILE'
  2007. X$ ! vms/vmsbuild.com -- compile and link NetHack 3.1 patchlevel 0    [pr]
  2008. X$ !
  2009. X$ ! usage:
  2010. X$ !   $ set default [.src]    !or [-.-.src] if starting from [.sys.vms]
  2011. X$ !   $ @[-.sys.vms]vmsbuild  [compiler-option]  [link-option]  [cc-switches]
  2012. X$ ! options:
  2013. X$ !    compiler-option :  either "VAXC" or "GNUC" or ""    !default VAXC
  2014. X$ !    link-option    :  either "SHARE[able]" or "LIB[rary]"    !default SHARE
  2015. X$ !    cc-switches    :  optional qualifiers for CC (such as "/noOpt/Debug")
  2016. X$ ! notes:
  2017. X$ !    If the symbol "CC" is defined, compiler-option is not used.
  2018. X$ !    The link-option refers to VAXCRTL (C Run-Time Library) handling;
  2019. X$ !      to specify it while letting compiler-option default, use "" as
  2020. X$ !      the compiler-option.
  2021. X$ !    To re-link without compiling, use "LINK" as special 'compiler-option';
  2022. X$ !      to re-link with GNUC library, 'CC' must begin with "G" (or "g").
  2023. X$ !    Default wizard definition moved to include/vmsconf.h.
  2024. X$
  2025. X$    vaxc_ = "CC/NOLIST/OPTIMIZE=NOINLINE"        !vaxc v3.x (2.x fixed below)
  2026. X$    gnuc_ = "GCC"
  2027. X$    gnulib = "gnu_cc:[000000]gcclib/Library"    !(not used w/ vaxc)
  2028. X$ ! common CC options (/obj=file doesn't work for GCC 1.36, use rename instead)
  2029. X$    c_c_  = "/INCLUDE=[-.INCLUDE]"
  2030. X$    veryold_vms = f$extract(1,1,f$getsyi("VERSION")).eqs."4" -
  2031. X        .and. f$extract(3,3,f$getsyi("VERSION")).lts."6"
  2032. X$    if veryold_vms then  c_c_ = c_c_ + "/DEFINE=(""VERYOLD_VMS"")"
  2033. X$ ! miscellaneous setup
  2034. X$    ivqual = %x00038240    !DCL-W-IVQUAL (used to check for ancient vaxc)
  2035. X$    abort := exit %x1000002A
  2036. X$    cur_dir  = f$environment("DEFAULT")
  2037. X$    vmsbuild = f$environment("PROCEDURE")
  2038. X$ ! validate first parameter
  2039. X$    p1 := 'p1'
  2040. X$    o_VAXC = 0    !(c_opt substring positions)
  2041. X$    o_GNUC = 5
  2042. X$    o_LINK = 10
  2043. X$    o_SPCL = 15
  2044. X$    c_opt = f$locate("|"+p1, "|VAXC|GNUC|LINK|SPECIAL|") !5
  2045. X$     if (c_opt/5)*5 .eq. c_opt then  goto p1_ok
  2046. X$    copy sys$input: sys$error:    !p1 usage
  2047. X%first arg is compiler option; it must be one of
  2048. X       "VAXC" -- use VAX C to compile everything
  2049. X   or  "GNUC" -- use GNU C to compile everything
  2050. X   or  "LINK" -- skip compilation, just relink nethack.exe
  2051. X   or  "SPEC[IAL]" -- just compile and link lev_comp.exe
  2052. X   or    ""   -- default operation (VAXC unless 'CC' is defined)
  2053. X
  2054. XNote: if a DCL symbol for CC is defined, "VAXC" and "GNUC" are no-ops.
  2055. X      If the symbol value begins with "G" (or "g"), then the GNU C
  2056. X      library will be included in all link operations.  Do not rebuild
  2057. X      lev_comp with "SPECIAL" unless you have a CC symbol setup with
  2058. X      the proper options.
  2059. X$    abort
  2060. X$p1_ok:
  2061. X$ ! validate second parameter
  2062. X$    p2 := 'p2'
  2063. X$    l_opt = f$locate("|"+p2, "|SHAREABLE|LIBRARY__|") !10
  2064. X$     if (l_opt/10)*10 .eq. l_opt then    goto p2_ok
  2065. X$    copy sys$input: sys$error:    !p2 usage
  2066. X%second arg is VAXCRTL handling; it must be one of
  2067. X       "SHAREABLE" -- link with SYS$SHARE:VAXCRTL.EXE/SHAREABLE
  2068. X   or   "LIBRARY"  -- link with SYS$LIBRARY:VAXCRTL.OLB/LIBRARY
  2069. X   or      ""      -- default operation (use shareable image)
  2070. X
  2071. XNote: for MicroVMS 4.x, "SHAREABLE" (which is the default) is required.
  2072. X$    abort
  2073. X$p2_ok:
  2074. X$ ! start from a known location -- [.sys.vms], then move to [-.-.src]
  2075. X$    set default 'f$parse(vmsbuild,,,"DIRECTORY")'
  2076. X$    set default [-.-.src]    !move to source directory
  2077. X$ ! compiler setup; if a symbol for "CC" is already defined it will be used
  2078. X$     if f$type(cc).eqs."STRING" then  goto got_cc
  2079. X$    cc = vaxc_            !assume "VAXC" requested or defaulted
  2080. X$    if c_opt.eq.o_GNUC then  goto chk_gcc !explicitly invoked w/ "GNUC" option
  2081. X$    if c_opt.ne.o_VAXC then  goto got_cc !"SPEC" or "LINK", skip compiler check
  2082. X$    ! we want to prevent function inlining with vaxc v3.x (/opt=noinline)
  2083. X$    !   but we can't use noInline with v2.x, so need to determine version
  2084. X$      set noOn
  2085. X$      msgenv = f$environment("MESSAGE")
  2086. X$      set message/noFacil/noSever/noIdent/noText
  2087. X$      cc/noObject _NLA0:/Include=[]     !strip 'noinline' if error
  2088. X$      sts = $status
  2089. X$    if sts then  goto reset_msg    !3.0 or later will check out OK
  2090. X$    ! must be dealing with vaxc 2.x; ancient version (2.2 or earlier)
  2091. X$    !   can't handle /include='dir', needs c$include instead
  2092. X$      cc = cc - "=NOINLINE" - ",NOINLINE" - "NOINLINE,"
  2093. X$      if sts.ne.IVQUAL then  goto reset_msg
  2094. X$        define/noLog c$include [-.INCLUDE]
  2095. X$        c_c_ = "/DEFINE=(""ANCIENT_VAXC"")"
  2096. X$        if veryold_vms then  c_c_ = c_c_ - ")" + ",""VERYOLD_VMS"")"
  2097. X$reset_msg:
  2098. X$      set message 'msgenv'
  2099. X$      set On
  2100. X$      goto got_cc
  2101. X$ !
  2102. X$chk_gcc:
  2103. X$    cc = gnuc_
  2104. X$ ! old versions of gcc-vms don't have <varargs.h> or <stdarg.h> available
  2105. X$      c_c_ = "/DEFINE=(""USE_OLDARGS"")"
  2106. X$      if veryold_vms then  c_c_ = c_c_ - ")" + ",""VERYOLD_VMS"")"
  2107. X$      if veryold_vms then  goto chk_gas    !avoid varargs & stdarg
  2108. X$      if f$search("gnu_cc_include:[000000]varargs.h").nes."" then -
  2109. X        c_c_ = "/DEFINE=(""USE_VARARGS"")"
  2110. X$      if f$search("gnu_cc_include:[000000]stdarg.h").nes."" then -
  2111. X        c_c_ = "/DEFINE=(""USE_STDARG"")"
  2112. X$chk_gas:
  2113. X$ ! test whether this version of gas handles the 'const' construct correctly
  2114. X$ gas_chk_tmp = "sys$scratch:gcc-gas-chk.tmp"
  2115. X$ if f$search(gas_chk_tmp).nes."" then  delete/noconfirm/nolog 'gas_chk_tmp';*
  2116. X$ gas_ok = 0    !assume bad
  2117. X$ on warning then goto skip_gas
  2118. X$ define/user/nolog sys$error 'gas_chk_tmp'
  2119. X$ mcr gnu_cc:[000000]gcc-as sys$input: -o _NLA0:
  2120. X$DECK
  2121. X.const
  2122. X.comm dummy,0
  2123. X.const
  2124. X.comm dummy,0
  2125. X$EOD
  2126. X$ gas_ok = 1    !assume good
  2127. X$ if f$search(gas_chk_tmp).eqs."" then  goto skip_gas
  2128. X$ ! if the error file is empty, gas can deal properly with const
  2129. X$  gas_ok = f$file_attrib(gas_chk_tmp,"EOF") .eq. 0
  2130. X$  delete/noconfirm/nolog 'gas_chk_tmp';*
  2131. X$skip_gas:
  2132. X$ on warning then continue
  2133. X$      if .not.gas_ok then  c_c_ = c_c_ - ")" + ",""const="")"
  2134. X$      c_c_ = "/INCLUDE=[-.INCLUDE]" + c_c_
  2135. X$ !
  2136. X$got_cc:
  2137. X$    cc = cc + c_c_            !append common qualifiers
  2138. X$    if p3.nes."" then  cc = cc + p3 !append optional user preferences
  2139. X$    g := 'f$extract(0,1,cc)'
  2140. X$    if g.nes."G" .and. c_opt.ne.o_GNUC then  gnulib = ""
  2141. X$    if g.eqs."G"  .or. c_opt.eq.o_GNUC then  gnulib = "," + gnulib
  2142. X$ ! linker setup; if a symbol for "LINK" is defined, we'll use it
  2143. X$    if f$type(link).nes."STRING" then  link = "LINK/NOMAP"
  2144. X$    if p4.nes."" then  link = link + p4 !append optional user preferences
  2145. X$    crtl = "sys$library:vaxcrtl.olb/Library"    !object library
  2146. X$     if l_opt.ne.0 then  goto crtl_ok
  2147. X$    crtl = "sys$disk:[-.src]crtl.opt/Options"    !shareable image
  2148. X$     if f$search("crtl.opt").nes."" then  goto crtl_ok !assume its right
  2149. X$    create sys$disk:[-.src]crtl.opt
  2150. Xsys$share:vaxcrtl.exe/Shareable
  2151. X$crtl_ok:
  2152. X$ ! final setup
  2153. X$    nethacklib = "[-.src]nethack.olb"
  2154. X$    milestone = "write sys$output f$fao("" !5%T "",0),"
  2155. X$     if c_opt.eq.o_LINK then  goto link  !"LINK" requested, skip compilation
  2156. X$    rename     := rename/New_Vers
  2157. X$    touch     := set file/Truncate
  2158. X$    makedefs := $sys$disk:[-.util]makedefs
  2159. X$    show symbol cc
  2160. X$    goto begin    !skip subroutines
  2161. X$!
  2162. X$compile_file:    !input via 'c_file'
  2163. X$    no_lib = ( f$extract(0,1,c_file) .eqs. "#" )
  2164. X$    if no_lib then    c_file = f$extract(1,255,c_file)
  2165. X$    c_name = f$edit(f$parse(c_file,,,"NAME"),"LOWERCASE")
  2166. X$    f_opts = ""    !options for this file
  2167. X$    if f$type('c_name'_options).nes."" then  f_opts = 'c_name'_options
  2168. X$    milestone " (",c_name,")"
  2169. X$    if f$search("''c_name'.obj").nes."" then  delete 'c_name'.obj;*
  2170. X$    cc 'f_opts' 'c_file'.c
  2171. X$    if .not.no_lib then  nh_obj_list == nh_obj_list + ",''c_name'.obj;0"
  2172. X$     return
  2173. X$!
  2174. X$compile_list:    !input via 'c_list'
  2175. X$    nh_obj_list == ""
  2176. X$    j = -1
  2177. X$ c_loop:
  2178. X$    j = j + 1
  2179. X$    c_file = f$element(j,",",c_list)  !get next file
  2180. X$    if c_file.nes."," then    gosub compile_file
  2181. X$    if c_file.nes."," then    goto c_loop
  2182. X$    nh_obj_list == f$extract(1,999,nh_obj_list)
  2183. X$    if nh_obj_list.nes."" then  libr/Obj 'nethacklib' 'nh_obj_list'/Replace
  2184. X$    if nh_obj_list.nes."" then  delete 'nh_obj_list'
  2185. X$    delete/symbol/global nh_obj_list
  2186. X$     return
  2187. X$!
  2188. X$begin:
  2189. X$!
  2190. X$! miscellaneous special source file setup
  2191. X$!
  2192. X$ if f$search("monst.c").eqs."" then  copy/Concat monst.c1+.c2 monst.c
  2193. X$ if f$search("random.c").eqs."" then  copy [-.sys.share]random.c []*.*
  2194. X$ if f$search("[-.util]lev_yacc.c").eqs."" then  @[-.sys.vms]spec_lev.com
  2195. X$!
  2196. X$! create object library
  2197. X$!
  2198. X$ libr/Obj 'nethacklib'/Create=(Block=3000,Hist=0)
  2199. X$ if f$search("''nethacklib';-1").nes."" then  purge 'nethacklib'
  2200. X$!
  2201. X$! compile and link makedefs, then nethack, finally lev_comp & dgn_comp.
  2202. X$!
  2203. X$ milestone "<compiling...>"
  2204. X$ c_list = "[-.sys.vms]vmsmisc,[]alloc,monst,objects"
  2205. X$     if c_opt.eq.o_SPCL then  c_list = c_list + ",decl,drawing"
  2206. X$ gosub compile_list
  2207. X$     if c_opt.eq.o_SPCL then  goto special !"SPECIAL" requested, skip main build
  2208. X$ set default [-.util]
  2209. X$ c_list = "#makedefs"
  2210. X$ gosub compile_list
  2211. X$ link makedefs.obj,'nethacklib'/Lib,'crtl''gnulib',sys$input:/Opt
  2212. Xidentification="makedefs 3.1.0"
  2213. X$ milestone "makedefs"
  2214. X$! create some build-time files
  2215. X$ makedefs -p    !pm.h
  2216. X$ makedefs -o    !onames.h
  2217. X$ makedefs -v    !date.h
  2218. X$ milestone " (*.h)"
  2219. X$ makedefs -m    !../src/monstr.c
  2220. X$ makedefs -z    !../src/vis_tab.c, ../include/vis_tab.h
  2221. X$ milestone " (*.c)"
  2222. X$ set default [-.src]
  2223. X$! compile most of the source files:
  2224. X$    gnutermcap_options = "/Define=(""bcopy(s,d,n)=memcpy(d,s,n)"",""exit=vms_exit"")"
  2225. X$    if c_opt.eq.o_GNUC then  gnutermcap_options = "/Define=(""exit=vms_exit"")"  !gcc
  2226. X$ c_list = "decl,version,[-.sys.vms]vmsmain,[-.sys.vms]vmsunix" -
  2227. X    + ",[-.sys.vms]vmstty,[-.sys.vms]vmsmail,[-.sys.vms]vmsfiles" -
  2228. X    + ",[]random"    !copied from [-.sys.share]
  2229. X$ gosub compile_list
  2230. X$ c_list = "[-.win.tty]getline,[-.win.tty]termcap" -
  2231. X    + ",[-.win.tty]topl,[-.win.tty]wintty" -
  2232. X    + ",[-.sys.vms]gnutparam,[-.sys.vms]gnutermcap"
  2233. X$ gosub compile_list
  2234. X$ c_list = "allmain,apply,artifact,attrib,ball,bones,botl,cmd,dbridge,detect" -
  2235. X    + ",display,do,do_name,do_wear,dog,dogmove,dokick,dothrow,drawing" -
  2236. X    + ",dungeon,eat,end,engrave,exper,explode,extralev,files,fountain"
  2237. X$ gosub compile_list
  2238. X$ c_list = "hack,hacklib,invent,lock,mail,makemon,mcastu,mhitm,mhitu" -
  2239. X    + ",minion,mklev,mkmap,mkmaze,mkobj,mkroom,mon,mondata,monmove,monstr" -
  2240. X    + ",mplayer,mthrowu,muse,music,o_init,objnam,options,pager,pickup"
  2241. X$ gosub compile_list
  2242. X$ c_list = "pline,polyself,potion,pray,priest,quest,questpgr,read" -
  2243. X    + ",rect,restore,rip,rnd,rumors,save,shk,shknam,sit,sounds" -
  2244. X    + ",sp_lev,spell,steal,timeout,topten,track,trap,u_init"
  2245. X$ gosub compile_list
  2246. X$ c_list = "uhitm,vault,vision,vis_tab,weapon,were,wield,windows" -
  2247. X    + ",wizard,worm,worn,write,zap"
  2248. X$ gosub compile_list
  2249. X$!
  2250. X$link:
  2251. X$ milestone "<linking...>"
  2252. X$ link/Exe=nethack 'nethacklib'/Lib/Incl=(vmsmain),'crtl''gnulib',-
  2253. X    sys$input:/Opt
  2254. Xidentification="NetHack 3.1.0"
  2255. X$ milestone "NetHack"
  2256. X$     if c_opt.eq.o_LINK then  goto done    !"LINK" only
  2257. X$special:
  2258. X$!
  2259. X$! build special level and dungeon compilers
  2260. X$!
  2261. X$ set default [-.util]
  2262. X$ c_list = "#panic,#lev_main,#lev_yacc,#dgn_main,#dgn_yacc"
  2263. X$     if c_opt.eq.o_SPCL then  c_list = "[-.sys.vms]vmsfiles," + c_list
  2264. X$ gosub compile_list
  2265. X$ c_list = "#lev_lex,#dgn_lex"
  2266. X$ copy [-.sys.vms]lev_lex.h stdio.*/Prot=(s:rwd,o:rwd)
  2267. X$ gosub compile_list
  2268. X$ rename stdio.h lev_lex.*
  2269. X$ link/exe=lev_comp lev_main,lev_yacc,lev_lex,-
  2270. X    panic.obj,'nethacklib'/Lib,'crtl''gnulib',sys$input:/Opt
  2271. Xidentification="lev_comp 3.1.0"
  2272. X$ milestone "lev_comp"
  2273. X$ link/exe=dgn_comp dgn_main,dgn_yacc,dgn_lex,-
  2274. X    panic.obj,'nethacklib'/Lib,'crtl''gnulib',sys$input:/Opt
  2275. Xidentification="dgn_comp 3.1.0"
  2276. X$ milestone "dgn_comp"
  2277. X$!
  2278. X$ c_list = "#recover"
  2279. X$ gosub compile_list
  2280. X$ link/exe=[] recover.obj,'nethacklib'/Lib,'crtl''gnulib',sys$input:/Opt
  2281. Xidentification="recover 3.1.0"
  2282. X$ milestone "recover"
  2283. X$!
  2284. X$done:
  2285. X$    set default 'cur_dir'
  2286. X$ exit
  2287. END_OF_FILE
  2288. if test 11318 -ne `wc -c <'sys/vms/vmsbuild.com'`; then
  2289.     echo shar: \"'sys/vms/vmsbuild.com'\" unpacked with wrong size!
  2290. fi
  2291. # end of 'sys/vms/vmsbuild.com'
  2292. fi
  2293. echo shar: End of archive 22 \(of 108\).
  2294. cp /dev/null ark22isdone
  2295. MISSING=""
  2296. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  2297. 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
  2298. 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
  2299. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
  2300. 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 \
  2301. 101 102 103 104 105 106 107 108 ; do
  2302.     if test ! -f ark${I}isdone ; then
  2303.     MISSING="${MISSING} ${I}"
  2304.     fi
  2305. done
  2306. if test "${MISSING}" = "" ; then
  2307.     echo You have unpacked all 108 archives.
  2308.     echo "Now execute 'rebuild.sh'"
  2309.     rm -f ark10[0-8]isdone ark[1-9]isdone ark[1-9][0-9]isdone
  2310. else
  2311.     echo You still need to unpack the following archives:
  2312.     echo "        " ${MISSING}
  2313. fi
  2314. ##  End of shell archive.
  2315. exit 0
  2316.