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

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v16i046:  nethack31 - display oriented dungeons & dragons (Ver. 3.1), Part38/108
  5. Message-ID: <4340@master.CNA.TEK.COM>
  6. Date: 30 Jan 93 01:12:17 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 2670
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1595
  11.  
  12. Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
  13. Posting-number: Volume 16, Issue 46
  14. Archive-name: nethack31/Part38
  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 38 (of 108)."
  27. # Contents:  sys/amiga/wbcli.c sys/msdos/trampoli.c
  28. # Wrapped by billr@saab on Wed Jan 27 16:09:01 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'sys/amiga/wbcli.c' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'sys/amiga/wbcli.c'\"
  32. else
  33. echo shar: Extracting \"'sys/amiga/wbcli.c'\" \(38406 characters\)
  34. sed "s/^X//" >'sys/amiga/wbcli.c' <<'END_OF_FILE'
  35. X/*    SCCS Id: @(#)wbcli.c  2.1   93/01/08              */
  36. X/*    Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1991      */
  37. X/*    Copyright (c) Gregg Wonderly, Naperville, IL, 1992, 1993    */
  38. X/* NetHack may be freely redistributed.  See license for details. */
  39. X
  40. X/* Friendly Intuition interface for NetHack 3.1 on the Amiga */
  41. X
  42. X/*
  43. X * This file contains many routines common to the CLI and WB interfaces,
  44. X * along with a few specific to each.  #defining CLI supports the CLI
  45. X * interface; not #defining it supports (along with wb.c) the WB interface.
  46. X */
  47. X
  48. X#include "Incl:date.h"          /* this gives us the version string */
  49. X
  50. X#ifdef AZTEC_C
  51. X/* Aztec doesn't recognize __chip syntax */
  52. X# define __chip
  53. X#endif
  54. X
  55. X#include "Amiga:wbdefs.h"       /* Miscellany information */
  56. X#ifdef  INTUI_NEW_LOOK
  57. X#define NewWindow   ExtNewWindow
  58. X#define NewScreen   ExtNewScreen
  59. X#endif
  60. X#include "Amiga:wbstruct.h"
  61. X#include "Amiga:wbprotos.h"
  62. X
  63. X#ifdef CLI
  64. X#include "Amiga:wbdata.c"       /* All structures and global data */
  65. X
  66. X#undef NetHackCnf
  67. Xchar NetHackCnf[50]="NetHack:NetHack.cnf";
  68. X#endif  /* CLI */
  69. X
  70. X#define C_GREY  0
  71. X#define C_BLACK 1
  72. X#define C_WHITE 2
  73. X#define C_BLUE  3
  74. X
  75. X#ifndef __SASC_60
  76. Xextern char *sys_errlist[];
  77. X#endif
  78. Xextern int errno;
  79. X
  80. X#define SPLIT           /* use splitter, if available */
  81. X
  82. Xvoid diskobj_filter(struct DiskObject *);
  83. XBPTR s_LoadSeg(char *);
  84. Xvoid s_UnLoadSeg(void);
  85. X
  86. X#ifdef CLI
  87. Xchar *cnfsavedir="NetHack:save";    /* unless overridden in cnf file */
  88. Xchar argline[255];  /* no overflow - bigger than ADOS will pass */
  89. X
  90. Xvoid WaitEOG(GPTR);
  91. Xchar *eos(char *);
  92. Xvoid condaddslash(char *);
  93. X
  94. X# ifdef SPLIT
  95. Xint running_split=0;        /* if 0, using normal LoadSeg/UnLoadSeg */
  96. X# endif
  97. X#else
  98. Xextern char *options[NUMIDX+1];
  99. Xextern GPTR gamehead,gameavail;
  100. Xextern DEFAULTS defgame;
  101. Xextern struct Window *win;
  102. X#endif  /* CLI */
  103. X
  104. X#ifdef AZTEC_C
  105. Xextern char *strdup(char *);
  106. X
  107. X/*
  108. X * Aztec has a strnicmp, but it doesn't work properly.
  109. X *
  110. X * Note: this came out of NHS:hacklib.c
  111. X */
  112. Xstatic char
  113. Xlowc(c)         /* force 'c' into lowercase */
  114. X    char c;
  115. X{
  116. X    return ('A' <= c && c <= 'Z') ? (c | 040) : c;
  117. X}
  118. X
  119. Xint
  120. Xstrnicmp(s1, s2, n)
  121. X    register const char *s1, *s2;
  122. X    register int n;
  123. X{
  124. X    register char t1, t2;
  125. X
  126. X    while (n--) {
  127. X    if (!*s2) return (*s1 != 0);    /* s1 >= s2 */
  128. X    else if (!*s1) return -1;   /* s1  < s2 */
  129. X    t1 = lowc(*s1++);
  130. X    t2 = lowc(*s2++);
  131. X    if (t1 != t2) return (t1 > t2) ? 1 : -1;
  132. X    }
  133. X    return 0;               /* s1 == s2 */
  134. X}
  135. X#endif
  136. X
  137. X#ifndef max
  138. X# define max(a, b) ((a) > (b) ? (a) : (b))
  139. X#endif
  140. X#ifndef min
  141. X# define min(x,y) ((x) < (y) ? (x) : (y))
  142. X#endif
  143. X
  144. Xchar *copyright_text[]={
  145. X"NetHack, Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993.",
  146. X"         By Stichting Mathematisch Centrum and M. Stephenson.",
  147. X"         See license for details.",
  148. X0
  149. X};
  150. X
  151. X#ifdef CLI
  152. X
  153. Xmain( argc, wbs )
  154. X    int argc;
  155. X    struct WBStartup *wbs;
  156. X{
  157. X    GPTR gptr;
  158. X    BPTR lc,lc2;
  159. X    struct FileInfoBlock finfo;
  160. X    char *name;
  161. X    char namebuf[50];
  162. X    char **argv=(char **)wbs;
  163. X
  164. X    ZapOptions( curopts );
  165. X    InitWB( argc, (struct WBStartup *)argv );
  166. X    errmsg( NO_FLASH, "Welcome to NetHack Version 3.1!\n" );
  167. X    CopyRight( );
  168. X
  169. X    ReadConfig( );
  170. X
  171. X    /* Wait till user quits */
  172. X
  173. X    while( !quit )
  174. X    {
  175. X    char tbuf[8];
  176. X    char *p=tbuf;
  177. X    char *dirname=cnfsavedir;
  178. X/* play a game */
  179. X    {
  180. X        int c;
  181. X        argline[0]='\0';
  182. X        name="NewGame.info";        /* this will fail - it's in NetHack: */
  183. X        for(c=1;c<argc;c++){
  184. X        /* slow but easy - not a critical path */
  185. X        strcpy(eos(argline),argv[c]);
  186. X        if(!strncmp(argv[c],"-u",2)){
  187. X            if(!strcmp(argv[c],"-u")){
  188. X            name= argv[c+1];
  189. X            }else{
  190. X            name= &argv[c][1];
  191. X            }
  192. X        }
  193. X        if(c<argc)strcpy(eos(argline)," ");
  194. X        }
  195. X        eos(argline)[-1]='\0';
  196. X    }
  197. X    strcpy(namebuf,cnfsavedir);
  198. X    condaddslash(namebuf);
  199. X    strcpy(eos(namebuf),name);
  200. X    lc=Lock(namebuf,ACCESS_READ);
  201. X    if(!lc){
  202. X        dirname="NetHack:";
  203. X        strcpy(namebuf,dirname);
  204. X        strcpy(eos(namebuf),"NewGame.info");
  205. X        lc=Lock(namebuf,ACCESS_READ);
  206. X        if(!lc){
  207. X        errmsg(NO_FLASH,"can't find NewGame.info");
  208. X        cleanup(1);
  209. X        }
  210. X    }
  211. X    Examine(lc,&finfo);
  212. X    lc2=ParentDir(lc);
  213. X    UnLock(lc);
  214. X    gptr=GetWBIcon(lc2,dirname,&finfo);
  215. X    UnLock(lc2);
  216. X    run_game(gptr);
  217. X
  218. X/* wait for game to end */
  219. X    WaitEOG(gptr);
  220. X    FreeGITEM(gptr);
  221. X/* ask about another? */
  222. X    printf("Play again? [yn] ");
  223. X    fgets(tbuf,sizeof(tbuf),stdin);
  224. X    while(*p && isspace(*p))p++;
  225. X    switch(*p){
  226. X    case 'n':
  227. X    case 'N':
  228. X        quit=1;
  229. X    }
  230. X    }
  231. X    cleanup(0);
  232. X}
  233. X
  234. X/* CLI */
  235. X
  236. Xvoid
  237. XWaitEOG(target)
  238. X    GPTR target;
  239. X{
  240. X    long mask, rmask;
  241. X    struct WBStartup *wbs;
  242. X    struct WBArg *wba;
  243. X    int i;
  244. X    /* Get a message */
  245. X    while(1){
  246. X    mask = ( 1L << dosport->mp_SigBit ) ;
  247. X    rmask = Wait( mask );
  248. X
  249. X
  250. X    if( rmask & ( 1L << dosport->mp_SigBit ) )
  251. X    {
  252. X        /* Get process termination messages */
  253. X
  254. X        while( wbs = (struct WBStartup *) GetMsg( dosport ) )
  255. X        {
  256. X        /* Find the game that has terminated */
  257. X
  258. X        if(target->seglist == wbs->sm_Segment)
  259. X        {
  260. X#ifdef SPLIT
  261. X            if(!running_split)
  262. X#endif
  263. X            /* Unload the code */
  264. X            UnLoadSeg( wbs->sm_Segment );
  265. X            /* Free the startup message resources */
  266. X
  267. X            wba = (struct WBArg *)
  268. X            ((long)wbs + sizeof( struct WBStartup ));
  269. X            for( i = 0; i < wbs->sm_NumArgs; ++i )
  270. X            {
  271. X            FreeMem( wba[i].wa_Name, strlen( wba[i].wa_Name ) + 1 );
  272. X            UnLock( wba[i].wa_Lock );
  273. X            }
  274. X            FreeMem( wbs, wbs->sm_Message.mn_Length );
  275. X            wbs = NULL;
  276. X
  277. X            return;
  278. X        }
  279. X        }
  280. X
  281. X    }
  282. X    }
  283. X}
  284. X
  285. X/* CLI */
  286. X
  287. Xvoid CopyRight()
  288. X{
  289. X    int line;
  290. X    for(line=0;copyright_text[line];line++){
  291. X    printf("%s\n",copyright_text[line]);
  292. X    }
  293. X}
  294. X
  295. X/* CLI */
  296. X
  297. X/*
  298. X * Do the one time initialization things.
  299. X */
  300. X
  301. Xvoid
  302. XInitWB( argc, wbs )
  303. X    int argc;
  304. X    register struct WBStartup *wbs;
  305. X{
  306. X
  307. X    /* Open Libraries */
  308. X    GfxBase= (struct GfxBase *) OldOpenLibrary("graphics.library");
  309. X    IconBase= OldOpenLibrary("icon.library");
  310. X    DiskfontBase= (struct DiskfontBase *)OldOpenLibrary("diskfont.library");
  311. X    IntuitionBase= (struct IntuitionBase *)OldOpenLibrary("intuition.library");
  312. X
  313. X    if(!GfxBase || !IconBase || !DiskfontBase || !IntuitionBase)
  314. X    {
  315. X    error("library open failed");
  316. X    cleanup( 1 );
  317. X    }
  318. X
  319. X    /* Get Port for replied WBStartup messages */
  320. X
  321. X    if( ( dosport = CreatePort( NULL, 0 ) ) == NULL )
  322. X    {
  323. X    error("failed to create dosport" );
  324. X    cleanup( 1 );
  325. X    }
  326. X
  327. X    /* If started from CLI */
  328. X    if( argc == 0 ){
  329. X    printf("Run this program from CLI only.\n");
  330. X    DisplayBeep(0);     /* could be more specific */
  331. X    Delay(400);
  332. X    cleanup(1);
  333. X    }
  334. X}
  335. X
  336. X/* CLI */
  337. X
  338. X/*
  339. X * Read a nethack.cnf like file and collect the configuration
  340. X * information from it.
  341. X */
  342. Xvoid ReadConfig()
  343. X{
  344. X    register FILE *fp;
  345. X    register char *buf, *t;
  346. X
  347. X    /* Use a dynamic buffer to limit stack use */
  348. X
  349. X    if( ( buf = xmalloc( 1024 ) ) == NULL )
  350. X    {
  351. X    error( "Can't alloc space to read config file" );
  352. X    cleanup( 1 );
  353. X    }
  354. X
  355. X    /* If the file is not there, can't load it */
  356. X
  357. X    if( ( fp = fopen( NetHackCnf, "r" ) ) == NULL )
  358. X    {
  359. X    errmsg( FLASH, "Can't load config file %s", NetHackCnf );
  360. X    free( buf );
  361. X    return;
  362. X    }
  363. X
  364. X    /* Read the lines... */
  365. X
  366. X    while( fgets( buf, 1024, fp ) != NULL )
  367. X    {
  368. X    if( *buf == '#' )
  369. X        continue;
  370. X
  371. X    if( ( t = strchr( buf, '\n' ) ) != NULL )
  372. X        *t = 0;
  373. X
  374. X    if( strnicmp( buf, "SAVE=", 5 ) == 0 )
  375. X    {
  376. X        cnfsavedir=strdup(buf+5);
  377. X    }
  378. X    else
  379. X    {
  380. X        /* We don't care about the rest */
  381. X    }
  382. X    }
  383. X    fclose( fp );
  384. X    free( buf );
  385. X}
  386. X
  387. X/* CLI */
  388. X
  389. Xvoid
  390. Xrun_game( gptr )
  391. X    register GPTR gptr;
  392. X{
  393. X    struct Task *ctask;
  394. X    register struct MsgPort *proc = NULL;
  395. X    int tidx;
  396. X
  397. X    tidx = 0;
  398. X
  399. X    gptr->gname = xmalloc( 20 + strlen( gptr->name ) );
  400. X
  401. X    SetToolLine(gptr, "INTERNALCLI", argline);
  402. X    gptr->wbs = AllocMem( sizeof( struct WBStartup ) +
  403. X    ( sizeof( struct WBArg ) * 2 ), MEMF_PUBLIC | MEMF_CLEAR );
  404. X
  405. X    /* Check if we got everything */
  406. X
  407. X    if( !gptr->gname || !gptr->wbs )
  408. X    {
  409. X    fprintf( stderr, "Can't allocate memory\n" );
  410. X    goto freemem;
  411. X    }
  412. X
  413. X    /* Get the arguments structure space */
  414. X
  415. X    gptr->wba = ( struct WBArg * ) ((long)gptr->wbs + 
  416. X    sizeof( struct WBStartup ) );
  417. X    /* Load the game into memory */
  418. X#ifdef SPLIT
  419. X    /* Which version do we run? */
  420. X    {
  421. X    char gi[80];
  422. X    BPTR tmplock;
  423. X
  424. X    sprintf( gi, "%s.dir", GAMEIMAGE );
  425. X    tmplock=Lock( gi, ACCESS_READ );
  426. X    if( tmplock ){
  427. X    UnLock( tmplock );
  428. X    gptr->seglist = (BPTR)s_LoadSeg( gi );
  429. X    if(gptr->seglist)running_split=1;
  430. X    }else{
  431. X    gptr->seglist = (BPTR)LoadSeg( GAMEIMAGE );
  432. X    }
  433. X    }
  434. X#else
  435. X    gptr->seglist = (BPTR)LoadSeg( GAMEIMAGE );
  436. X#endif
  437. X
  438. X    if( gptr->seglist == NULL)
  439. X    {
  440. X    errmsg( FLASH, "Can't load %s", GAMEIMAGE );
  441. X    goto freemem;
  442. X    }
  443. X
  444. X    /* Set the game name for the status command */
  445. X    sprintf( gptr->gname, "NetHack 3.1 %s", gptr->name );
  446. X
  447. X    /* Create a process for the game to execute in */
  448. X    ctask = FindTask( NULL );
  449. X    proc = CreateProc( gptr->gname, ctask->tc_Node.ln_Pri,
  450. X            gptr->seglist, GAMESTACK );
  451. X
  452. X    /* Check if the create failed */
  453. X
  454. X    if( proc == NULL )
  455. X    {
  456. X    fprintf(stderr, "Error creating process %d\n", IoErr() );
  457. X#ifdef SPLIT
  458. X    if(!running_split)
  459. X#endif
  460. X        UnLoadSeg( gptr->seglist );
  461. Xfreemem:
  462. X    if( gptr->gname ) free( gptr->gname );
  463. X    gptr->gname = NULL;
  464. X
  465. X    if( gptr->wbs ) FreeMem( gptr->wbs,
  466. X        sizeof( struct WBStartup ) + sizeof( struct WBArg ) * 2 );
  467. X    gptr->wbs = NULL;
  468. X    return;
  469. X    }
  470. X
  471. X    /* Get the Process structure pointer */
  472. X    gptr->prc = (struct Process *) (((long)proc) - sizeof( struct Task ));
  473. X
  474. X    /* Set the current directory */
  475. X    gptr->prc->pr_CurrentDir=((struct Process *)FindTask(NULL))->pr_CurrentDir;
  476. X
  477. X    /* Fill in the startup message */
  478. X    gptr->wbs->sm_Process = proc;
  479. X    gptr->wbs->sm_Segment = gptr->seglist;
  480. X    gptr->wbs->sm_NumArgs = 2;
  481. X    gptr->wbs->sm_ToolWindow = "con:0/0/100/300/NetHack 3.1";
  482. X    gptr->wbs->sm_ArgList = gptr->wba;
  483. X
  484. X    /* Fill in the args */
  485. X
  486. X    gptr->wba[0].wa_Name = Strdup( GAMEIMAGE );
  487. X    gptr->wba[0].wa_Lock = Lock( dirname( GAMEIMAGE ), ACCESS_READ );
  488. X
  489. X    gptr->wba[1].wa_Name = Strdup( gptr->name );
  490. X    gptr->wba[1].wa_Lock = Lock( gptr->dname, ACCESS_READ );
  491. X
  492. X    /* Write the updated tools types entries */
  493. X
  494. X    WriteDObj( gptr, gptr->wba[1].wa_Lock );
  495. X
  496. X    /* Set the message fields correctly */
  497. X
  498. X    gptr->wbs->sm_Message.mn_Node.ln_Type = NT_MESSAGE;
  499. X    gptr->wbs->sm_Message.mn_Node.ln_Pri = 0;
  500. X    gptr->wbs->sm_Message.mn_ReplyPort = dosport;
  501. X    gptr->wbs->sm_Message.mn_Length =
  502. X    sizeof( struct WBStartup ) + ( sizeof( struct WBArg ) * 2 );
  503. X
  504. X    /* Send the WB Startup message to let the game go... */
  505. X
  506. X    PutMsg( proc, &gptr->wbs->sm_Message );
  507. X}
  508. X
  509. X#else   /* CLI */
  510. X
  511. Xvoid RPText( rp, s )
  512. X    struct RastPort *rp;
  513. X    register char *s;
  514. X{
  515. X    Text( rp, s, strlen( s ) );
  516. X}
  517. X
  518. X/* !CLI */
  519. X
  520. Xvoid
  521. XSetUpMenus( mp, scrn )
  522. X    register struct Menu *mp;
  523. X    register struct Screen *scrn;
  524. X{
  525. X    register struct MenuItem *mip;
  526. X    register int i, leftoff = 0, horiz=0, len;
  527. X    register int com, chk;
  528. X
  529. X    for( ; mp; mp = mp->NextMenu )
  530. X    {
  531. X    i = 0;
  532. X    horiz = (scrn->RastPort.TxWidth*strlen(mp->MenuName))+16;
  533. X    /*mp->LeftEdge = leftoff;*/
  534. X    com = chk = 0;
  535. X    for( mip = mp->FirstItem; mip; mip = mip->NextItem )
  536. X    {
  537. X        if( mip->Flags & COMMSEQ )
  538. X        com = scrn->RastPort.TxWidth * 6;
  539. X        if( mip->Flags & CHECKIT )
  540. X        chk = scrn->RastPort.TxWidth * 3;
  541. X    }
  542. X    for( mip = mp->FirstItem; mip; mip = mip->NextItem )
  543. X    {
  544. X        mip->Height = scrn->RastPort.TxHeight;
  545. X        mip->TopEdge = scrn->RastPort.TxHeight * i++;
  546. X
  547. X        len = IntuiTextLength((struct IntuiText *)
  548. X            (mip->ItemFill))+8+com+chk;
  549. X        horiz = max( horiz,len );
  550. X    }
  551. X
  552. X    for( mip = mp->FirstItem; mip; mip = mip->NextItem )
  553. X    {
  554. X        mip->Width = horiz;
  555. X    }
  556. X    leftoff += horiz;
  557. X    }
  558. X}
  559. X
  560. X/* !CLI */
  561. X
  562. X/* Get a text line from the indicated file based on an array of per
  563. X * line offsets.
  564. X */
  565. X
  566. Xvoid getline( fp, offarr, which, buf, size )
  567. X    FILE *fp;
  568. X    long *offarr;
  569. X    int which, size;
  570. X    char *buf;
  571. X{
  572. X    fseek( fp, offarr[ which ], 0 );
  573. X    fgets( buf, size, fp );
  574. X}
  575. X
  576. X/* !CLI */
  577. X
  578. Xvoid
  579. Xdo_closewindow()
  580. X{
  581. X    /*set close flag - cleanup must be done elsewhere*/
  582. X    cleanup( 0 );
  583. X}
  584. X
  585. X/* !CLI */
  586. X
  587. Xvoid
  588. Xmenu_copyopt()
  589. X{
  590. X    GPTR gptr;
  591. X    char newname[ 100 ], oldname[ 100 ], cmd[ 200 ];
  592. X
  593. X    if( ( gptr = NeedGame() ) == NULL )
  594. X    return;
  595. X
  596. X    if( StrRequest( "Enter new player name", newname, gptr->fname ) == 0 )
  597. X    return;
  598. X
  599. X    if( strcmp( newname, gptr->fname ) == 0 )
  600. X    {
  601. X    errmsg( FLASH, "Copying aborted, new name same as old" );
  602. X    return;
  603. X    }
  604. X
  605. X    strcpy( oldname, GameName( gptr, NULL ) );
  606. X    strcpy( newname, GameName( gptr, newname ) );
  607. X
  608. X    sprintf( cmd, "c:copy \"%s\" \"%s\"", oldname, newname );
  609. X    Execute( cmd, NULL, NULL );
  610. X    MapGadgets( R_DISK, 1 );
  611. X}
  612. X
  613. X/* !CLI */
  614. X
  615. Xvoid
  616. Xmenu_rename()
  617. X{
  618. X    register GPTR gptr;
  619. X    char newname[ 100 ], oldname[ 100 ], cmd[ 200 ], name[100], *t;
  620. X
  621. X    if( ( gptr = NeedGame() ) == NULL )
  622. X    return;
  623. X
  624. X    strcpy( newname, gptr->name );
  625. X    if( t = strrchr( newname, '.' ) )
  626. X    {
  627. X    if( strcmp( t, ".sav" ) == 0 )
  628. X        *t = 0;
  629. X    }
  630. X
  631. X    if( StrRequest( "Enter New Name For Game", name, newname ) == 0)
  632. X    return;
  633. X
  634. X    /* Name can only be this long to allow inclusion of appropriate suffix */
  635. X    name[ 30 - strlen( ".sav.info " ) ] = '\0';
  636. X
  637. X    if( strcmp( name, newname ) == 0 )
  638. X    {
  639. X    errmsg( FLASH, "Rename aborted, name unchanged from %s", newname );
  640. X    return;
  641. X    }
  642. X
  643. X    strcat( name, ".sav" );
  644. X
  645. X    strcpy( oldname, GameName( gptr, NULL ) );
  646. X
  647. X    strcpy( newname, GameName( gptr, name ) );
  648. X    strcat( newname, ".info" );
  649. X
  650. X    /* Rename icon file */
  651. X    sprintf( cmd, "c:rename \"%s\" \"%s\"", oldname, newname );
  652. X    Execute( cmd, NULL, NULL );
  653. X
  654. X    strcpy( oldname, GameName( gptr, gptr->name ) );
  655. X
  656. X    strcpy( newname, GameName( gptr, name ) );
  657. X
  658. X    /* Rename save file if it is actually there */
  659. X    if( access( oldname, 0 ) == 0 )
  660. X    {
  661. X    sprintf( cmd, "c:rename \"%s\" \"%s\"", oldname, newname );
  662. X    Execute( cmd, NULL, NULL );
  663. X    }
  664. X
  665. X    MapGadgets( R_DISK, 1 );
  666. X}
  667. X
  668. X#endif  /* CLI */
  669. X
  670. Xvoid CleanUpLists( )
  671. X{
  672. X    register GPTR gptr;
  673. X
  674. X    while( gptr = gamehead )
  675. X    {
  676. X    gamehead = gamehead->next;
  677. X    FreeGITEM( gptr );
  678. X    }
  679. X
  680. X    while( gptr = gameavail )
  681. X    {
  682. X    gameavail = gameavail->next;
  683. X    free( gptr );
  684. X    }
  685. X}
  686. X
  687. X#ifndef CLI
  688. X
  689. Xvoid SafeCloseWindow( window )
  690. X    register struct Window *window;
  691. X{
  692. X    register struct Message *msg;
  693. X
  694. X    if( !window )
  695. X    return;
  696. X
  697. X    /* Remove any attached menu */
  698. X
  699. X    if( window->MenuStrip )
  700. X    {
  701. X    ClearMenuStrip( window );
  702. X    }
  703. X
  704. X    Forbid();
  705. X    while( window->UserPort != NULL &&
  706. X        ( msg = GetMsg( window->UserPort) ) != NULL )
  707. X    {
  708. X    ReplyMsg( msg );
  709. X    }
  710. X
  711. X    CloseWindow( window );
  712. X    Permit();
  713. X}
  714. X
  715. X#else   /* CLI */
  716. X
  717. Xvoid CloseLibraries( )
  718. X{
  719. X    if( IntuitionBase )     CloseLibrary( (void *) IntuitionBase );
  720. X    IntuitionBase = 0;
  721. X    if( DiskfontBase )      CloseLibrary( (void *) DiskfontBase );
  722. X    DiskfontBase = 0;
  723. X    if( IconBase )          CloseLibrary(  IconBase );
  724. X    IconBase = 0;
  725. X    if( GfxBase )           CloseLibrary( (void *) GfxBase );
  726. X    GfxBase = 0;
  727. X}
  728. X
  729. X/* CLI */
  730. X
  731. Xvoid cleanup( code )
  732. X    int code;
  733. X{
  734. X    if( dosport ) DeletePort( dosport );
  735. X    dosport = NULL;
  736. X
  737. X    CleanUpLists( );
  738. X    CloseLibraries( );
  739. X
  740. X#ifdef SPLIT
  741. X    if(running_split){
  742. X    s_UnLoadSeg();
  743. X    }
  744. X#endif
  745. X    exit( code );
  746. X}
  747. X
  748. X/* CLI */
  749. X
  750. XGPTR AllocGITEM( )
  751. X{
  752. X    register GPTR gptr;
  753. X
  754. X    if( gameavail )
  755. X    {
  756. X    gptr = gameavail;
  757. X    gameavail = gameavail->next;
  758. X    }
  759. X    else
  760. X    {
  761. X    gptr = xmalloc( sizeof( GAMEITEM ) );
  762. X    }
  763. X
  764. X    if( gptr )
  765. X    memset( gptr, 0, sizeof( GAMEITEM ) );
  766. X
  767. X    return( gptr );
  768. X}
  769. X
  770. X/* CLI */
  771. X
  772. Xvoid FreeGITEM( gptr )
  773. X    register GPTR gptr;
  774. X{
  775. X    /* Free all of the pieces first */
  776. X
  777. X    if( gptr->talloc )
  778. X    FreeTools( gptr );
  779. X
  780. X    if( gptr->dobj )
  781. X    FreeDObj( gptr->dobj );
  782. X
  783. X    gptr->dobj = NULL;
  784. X
  785. X    if( gptr->name )
  786. X    free( gptr->name );
  787. X    gptr->name = NULL;
  788. X
  789. X    if( gptr->dname )
  790. X    free( gptr->dname );
  791. X    gptr->dname = NULL;
  792. X
  793. X    if( gptr->fname )
  794. X    free( gptr->fname );
  795. X    gptr->fname = NULL;
  796. X
  797. X    /* Connect it to free list */
  798. X
  799. X    gptr->next = gameavail;
  800. X    gameavail = gptr;
  801. X}
  802. X
  803. X/* CLI */
  804. X
  805. Xstruct DiskObject *AllocDObj( str )
  806. X    register char *str;
  807. X{
  808. X    register struct DiskObject *doptr;
  809. X    register char *t, *t1;
  810. X
  811. X    if( ( t = strrchr( str, '.' ) ) && stricmp( t, ".info" ) == 0 )
  812. X    {
  813. X    *t = 0;
  814. X    } else {
  815. X    t = NULL;
  816. X    }
  817. X
  818. X    if( doptr = GetDiskObject( str ) )
  819. X    {
  820. X    struct IntuiText *ip;
  821. X
  822. X    diskobj_filter(doptr);  /* delete all but INTERNALCLI */
  823. X
  824. X    if( ip = xmalloc( sizeof( struct IntuiText ) ) )
  825. X    {
  826. X        memset( ip, 0, sizeof( struct IntuiText ) );
  827. X        ip->FrontPen = C_BLACK;
  828. X        ip->DrawMode = JAM1;
  829. X        ip->IText = strdup( str );
  830. X        doptr->do_Gadget.GadgetText = ip;
  831. X
  832. X        /* Trim any .sav off of the end. */
  833. X
  834. X        if( ( t1 = strrchr( ip->IText, '.' ) ) &&
  835. X        stricmp( t1, ".sav" ) == 0 )
  836. X        {
  837. X        *t1 = 0;
  838. X        ip->LeftEdge = (2 * win->RPort->TxWidth);
  839. X        }
  840. X        }
  841. X    }
  842. X    if( t ) *t = '.';
  843. X
  844. X    return( doptr );
  845. X}
  846. X
  847. X#endif  /* CLI */
  848. X
  849. Xvoid FreeDObj( doptr )
  850. X    register struct DiskObject *doptr;
  851. X{
  852. X    if( doptr->do_Gadget.GadgetText )
  853. X    {
  854. X    free( doptr->do_Gadget.GadgetText->IText );
  855. X    free( doptr->do_Gadget.GadgetText );
  856. X    }
  857. X    doptr->do_Gadget.GadgetText = NULL;
  858. X    FreeDiskObject( doptr );
  859. X}
  860. X
  861. X#ifdef CLI
  862. X#ifdef AZTEC_C
  863. Xvoid errmsg(int flash, char *str, ...)
  864. X#else
  865. Xvoid errmsg( flash, str )
  866. Xchar *str;
  867. Xint flash;
  868. X#endif
  869. X{
  870. X    va_list vp;
  871. X
  872. X    va_start( vp, str );
  873. X
  874. X/*  if( !win || !wbopen ) */
  875. X    {
  876. X    vprintf( str, vp );
  877. X    va_end( vp );
  878. X    return;
  879. X    }
  880. X
  881. X}
  882. X
  883. X/* CLI */
  884. X
  885. X/*
  886. X * Issue an error message to the users window because it can not be done
  887. X * any other way.
  888. X */
  889. X
  890. Xvoid error( str )
  891. X    register char *str;
  892. X{
  893. X    char s[ 50 ];
  894. X    if( scrn ) ScreenToBack( scrn );
  895. X    Delay( 10 );
  896. X    fprintf( stderr, "%s\n", str );
  897. X    fprintf( stderr, "Hit Return: " );
  898. X    fflush( stderr );
  899. X    gets( s );
  900. X    if( scrn ) ScreenToFront( scrn );
  901. X}
  902. X
  903. X#else   /* CLI */
  904. X
  905. Xvoid menu_scores()
  906. X{
  907. X    register char buf1[50];
  908. X    register char **oldtools;
  909. X    register GPTR gptr;
  910. X    int oldalloc;
  911. X    extern GPTR windowgads;
  912. X
  913. X    if( StrRequest( "Scores for whom?", buf1, "all" ) != 0 )
  914. X    {
  915. X    for( gptr = windowgads; gptr; gptr = gptr->nextwgad )
  916. X    {
  917. X        if( gptr->dobj->do_Gadget.GadgetID == GADNEWGAME )
  918. X        break;
  919. X    }
  920. X
  921. X    if( !gptr )
  922. X    {
  923. X        errmsg( FLASH, "Can't find NewGame icon" );
  924. X        return;
  925. X    }
  926. X
  927. X    /* Save current tools */
  928. X    oldtools = gptr->dobj->do_ToolTypes;
  929. X
  930. X    /* Force a new tooltypes array to be allocated */
  931. X    if( oldalloc = gptr->talloc )
  932. X    {
  933. X        gptr->dobj->do_ToolTypes = gptr->otools;
  934. X        gptr->talloc = 0;
  935. X    }
  936. X
  937. X    /* Add the scores entry */
  938. X        SetToolLine( gptr, "SCORES", *buf1 ? buf1 : "all" );
  939. X
  940. X    /* Get the scores */
  941. X    run_game( gptr );
  942. X
  943. X    /* Free the tools which contain "SCORES=" */
  944. X    FreeTools( gptr );
  945. X
  946. X    /* Restore the old tools.  When this game exits, the tools
  947. X     * will be written back out to disk to update things
  948. X     */
  949. X    gptr->dobj->do_ToolTypes = oldtools;
  950. X    gptr->talloc = oldalloc;
  951. X    Delay( 100 );
  952. X    UpdateGameIcon( gptr );
  953. X    }
  954. X}
  955. X
  956. X/* !CLI */
  957. X
  958. XCheckAndCopy( gadstr, origstr )
  959. X    char *gadstr, *origstr;
  960. X{
  961. X    char *t;
  962. X    int i;
  963. X
  964. X    if( t = strchr( gadstr, '=' ) )
  965. X    {
  966. X    i = t - gadstr;
  967. X    /* Check for original string and don't allow one line to be replaced with
  968. X     * another.
  969. X     */
  970. X    if( *origstr != 0 && strncmp( gadstr, origstr, i ) != 0 )
  971. X    {
  972. X        strcpy( gadstr, origstr );
  973. X        DisplayBeep( NULL );
  974. X        return( 0 );
  975. X    }
  976. X    }
  977. X    else
  978. X    {
  979. X    /* If added an equals, there wasn't one previously, so signal an error */
  980. X    if( t = strchr( origstr, '=' ) )
  981. X    {
  982. X        strcpy( gadstr, origstr );
  983. X        DisplayBeep( NULL );
  984. X        return( 0 );
  985. X    }
  986. X    }
  987. X    return( 1 );
  988. X}
  989. X
  990. X/* !CLI */
  991. X
  992. Xint IsEditEntry( str, gptr )
  993. X    char *str;
  994. X    register GPTR gptr;
  995. X{
  996. X    if( gptr->dobj->do_Gadget.GadgetID == GADNEWGAME )
  997. X    return( 1 );
  998. X    if( strncmp( str, "CHARACTER=", 10 ) == 0 )
  999. X    return( 0 );
  1000. X    return( 1 );
  1001. X}
  1002. X
  1003. X/* !CLI */
  1004. X
  1005. Xvoid menu_comment( )
  1006. X{
  1007. X    register GPTR gptr;
  1008. X    struct FileInfoBlock *finfo;
  1009. X    BPTR lock;
  1010. X    char commentstr[ 100 ];
  1011. X
  1012. X    if( ( gptr = NeedGame() ) == NULL )
  1013. X    return;
  1014. X
  1015. X    if( ( lock = Lock( GameName( gptr, NULL ), ACCESS_READ ) ) == NULL )
  1016. X    {
  1017. X    /* Can't get lock, reload and return */
  1018. X
  1019. X    errmsg( FLASH, "Can't Lock game save file: %s",
  1020. X            GameName( gptr, NULL ) );
  1021. X    MapGadgets( R_DISK, 1 );
  1022. X    return;
  1023. X    }
  1024. X
  1025. X    finfo = (struct FileInfoBlock *) xmalloc(sizeof(struct FileInfoBlock));
  1026. X    Examine( lock, finfo );
  1027. X    UnLock( lock );
  1028. X    strncpy( commentstr, finfo->fib_Comment, sizeof( finfo->fib_Comment ) );
  1029. X    commentstr[ sizeof( finfo->fib_Comment ) ] = 0;
  1030. X    free( finfo );
  1031. X
  1032. X    /* Set the correct size */
  1033. X    if( StrRequest( "Edit Comment as Desired",
  1034. X        commentstr, commentstr ) == 0 )
  1035. X    {
  1036. X    return;
  1037. X    }
  1038. X
  1039. X    SetComment( GameName( gptr, NULL ), commentstr );
  1040. X}
  1041. X
  1042. X/* !CLI */
  1043. X
  1044. X/*
  1045. X * Make the proportional gadget position match the values passed
  1046. X */
  1047. X
  1048. Xvoid UpdatePropGad( win, gad, vis, total, top )
  1049. X    struct Window *win;
  1050. X    struct Gadget *gad;
  1051. X    register long vis, total, top;
  1052. X{
  1053. X    register long hidden;
  1054. X    register int body, pot;
  1055. X
  1056. X    hidden = max( total-vis, 0 );
  1057. X
  1058. X    if( top > hidden )
  1059. X    top = hidden;
  1060. X
  1061. X    if( hidden > 0 )
  1062. X    body = (ULONG) (vis * MAXBODY) / total;
  1063. X    else
  1064. X    body = MAXBODY;
  1065. X
  1066. X    if( hidden > 0 )
  1067. X    pot = (top * MAXPOT) / hidden;
  1068. X    else
  1069. X    pot = 0;
  1070. X
  1071. X    NewModifyProp( gad, win, NULL,
  1072. X        AUTOKNOB|FREEHORIZ, pot, 0, body, MAXBODY, 1 );
  1073. X}
  1074. X
  1075. X#endif  /* CLI */
  1076. X
  1077. X/*
  1078. X * Allocate some memory
  1079. X */
  1080. X
  1081. Xvoid *xmalloc( nbytes )
  1082. X    unsigned nbytes;
  1083. X{
  1084. X    return( malloc( nbytes ) );
  1085. X}
  1086. X
  1087. X#ifndef CLI
  1088. X/*
  1089. X * Delete the game associated with the GAME structure passed
  1090. X */
  1091. X
  1092. Xint DeleteGame( gptr )
  1093. X    register GPTR gptr;
  1094. X{
  1095. X    register int err;
  1096. X
  1097. X    err = DeleteFile( GameName( gptr, gptr->name ) );
  1098. X    err += DeleteFile( GameName( gptr, NULL ) );
  1099. X    return( err );
  1100. X}
  1101. X#endif  /* CLI */
  1102. X
  1103. X/*
  1104. X * Look through the list of games for one named 'name'
  1105. X */
  1106. X
  1107. XGPTR FindGame( name )
  1108. X    char *name;
  1109. X{
  1110. X    register GPTR gptr;
  1111. X
  1112. X    for( gptr = gamehead; gptr; gptr = gptr->next )
  1113. X    {
  1114. X    if( stricmp( gptr->fname, name ) == 0 )
  1115. X        break;
  1116. X    }
  1117. X
  1118. X    return( gptr );
  1119. X}
  1120. X/*
  1121. X * Set the option string indicated by idx to 'str'
  1122. X */
  1123. X
  1124. Xvoid setoneopt( idx, str )
  1125. X    int idx;
  1126. X    char *str;
  1127. X{
  1128. X    /* This space accumulates, but is recovered at process exit */
  1129. X
  1130. X    options[ idx ] = strdup( str );
  1131. X}
  1132. X
  1133. X/*
  1134. X * Get just the directory name of str
  1135. X */
  1136. X
  1137. Xchar *dirname( str )
  1138. X    char *str;
  1139. X{
  1140. X    static char buf[ 300 ];
  1141. X    char *t;
  1142. X
  1143. X    strncpy( buf, str, sizeof( buf ) );
  1144. X    buf[ sizeof( buf ) - 1 ] = 0;
  1145. X
  1146. X    if( (t = strrchr( buf, '/' ) ) == NULL ||
  1147. X        (t = strrchr( buf, ':' ) ) == NULL )
  1148. X    {
  1149. X    return( "/" );
  1150. X    }
  1151. X    *t = 0;
  1152. X    return( buf );
  1153. X}
  1154. X
  1155. X#ifndef CLI
  1156. X
  1157. X/*
  1158. X * Make sure that only itemno is checked in 'menu' off of menuptr
  1159. X */
  1160. X
  1161. Xvoid CheckOnly( menuptr, menu, itemno )
  1162. X    register struct Menu *menuptr;
  1163. X    register int menu, itemno;
  1164. X{
  1165. X    register struct MenuItem *ip;
  1166. X
  1167. X    while( menuptr && menu-- )
  1168. X    menuptr = menuptr->NextMenu;
  1169. X
  1170. X    if( menuptr )
  1171. X    {
  1172. X    for( ip = menuptr->FirstItem; ip && itemno; itemno--)
  1173. X    {
  1174. X        ip->Flags &= ~CHECKED;
  1175. X        ip = ip->NextItem;
  1176. X    }
  1177. X
  1178. X    if( ip )
  1179. X    {
  1180. X        ip->Flags |= CHECKED;
  1181. X        ip = ip->NextItem;
  1182. X    }
  1183. X
  1184. X    while( ip )
  1185. X    {
  1186. X        ip->Flags &= ~CHECKED;
  1187. X        ip = ip->NextItem;
  1188. X    }
  1189. X    }
  1190. X}
  1191. X
  1192. X/* !CLI */
  1193. X
  1194. Xint FindChecked( menuptr, menu )
  1195. X    register struct Menu *menuptr;
  1196. X    register int menu;
  1197. X{
  1198. X    register int itemno;
  1199. X    register struct MenuItem *ip;
  1200. X
  1201. X    while( menuptr && menu-- )
  1202. X    menuptr = menuptr->NextMenu;
  1203. X
  1204. X    if( menuptr )
  1205. X    {
  1206. X    for( itemno = 0, ip = menuptr->FirstItem; ip; ip = ip->NextItem )
  1207. X    {
  1208. X        if( ip->Flags & CHECKED )
  1209. X        return( itemno );
  1210. X        ++itemno;
  1211. X    }
  1212. X    }
  1213. X    return( 0 );
  1214. X}
  1215. X
  1216. X/* !CLI */
  1217. X
  1218. X/*
  1219. X * Create a file name based in the GAMEs directory.  If file is NULL,
  1220. X * the file name is the icon file.  Otherwise it is 'file'.
  1221. X */
  1222. X
  1223. Xchar *GameName( gptr, file )
  1224. X    GPTR gptr;
  1225. X    char *file;
  1226. X{
  1227. X    static char buf[200];
  1228. X
  1229. X    if( file == NULL )
  1230. X    file = gptr->fname;
  1231. X
  1232. X    if( strchr( "/:", gptr->dname[ strlen( gptr->dname ) - 1 ] ) )
  1233. X    sprintf( buf, "%s%s", gptr->dname, file );
  1234. X    else
  1235. X    sprintf( buf, "%s/%s", gptr->dname, file );
  1236. X    return( buf );
  1237. X}
  1238. X
  1239. X#endif  /* CLI */
  1240. X
  1241. X/*
  1242. X * Allocate a new GAME structure for the file passed and fill it in
  1243. X */
  1244. X
  1245. XGPTR GetWBIcon( lock, dir, finfo )
  1246. X    register BPTR lock;
  1247. X    register char *dir;
  1248. X    register struct FileInfoBlock *finfo;
  1249. X{
  1250. X    register BPTR odir;
  1251. X    register char *t;
  1252. X    register GPTR gptr;
  1253. X
  1254. X    if( ( gptr = AllocGITEM( ) ) == NULL )
  1255. X    goto noitems;
  1256. X
  1257. X    if( ( gptr->dname = strdup( dir ) ) == NULL )
  1258. X    goto outofmem;
  1259. X
  1260. X    if( ( gptr->fname = strdup( finfo->fib_FileName ) ) == NULL )
  1261. X    goto outofmem;
  1262. X
  1263. X    /* Strip the .info off. */
  1264. X    if( t = strrchr( finfo->fib_FileName, '.' ) )
  1265. X    {
  1266. X    if( stricmp( t, ".info" ) == 0 )
  1267. X        *t = 0;
  1268. X    else
  1269. X        t = NULL;
  1270. X    }
  1271. X
  1272. X    if( ( gptr->name = strdup( finfo->fib_FileName ) ) == NULL )
  1273. X    goto outofmem;
  1274. X
  1275. X    /* If removed .info, put it back */
  1276. X
  1277. X    if( t )
  1278. X    *t = '.';
  1279. X
  1280. X    /* Change to saved game directory */
  1281. X
  1282. X    odir = CurrentDir( lock );
  1283. X
  1284. X    /* Allocate a diskobj structure */
  1285. X
  1286. X    if( ( gptr->dobj = AllocDObj( finfo->fib_FileName ) ) == NULL )
  1287. X    {
  1288. X    (void) CurrentDir( odir );
  1289. Xoutofmem:
  1290. X    FreeGITEM( gptr );
  1291. X
  1292. X    if( gptr->fname )
  1293. X        free( gptr->fname );
  1294. X    gptr->fname = NULL;
  1295. X
  1296. X    if( gptr->name )
  1297. X        free( gptr->name );
  1298. X    gptr->name = NULL;
  1299. X
  1300. X    if( gptr->dname )
  1301. X        free( gptr->dname );
  1302. X    gptr->dname = NULL;
  1303. X
  1304. Xnoitems:
  1305. X    errmsg( FLASH, "Can't get Disk Object: %s", finfo->fib_FileName );
  1306. X    return( NULL );
  1307. X    }
  1308. X    gptr->oflag = gptr->dobj->do_Gadget.Flags;
  1309. X    gptr->oact = gptr->dobj->do_Gadget.Activation;
  1310. X    gptr->dobj->do_Gadget.Activation |=
  1311. X        ( RELVERIFY | GADGIMMEDIATE | FOLLOWMOUSE );
  1312. X    gptr->dobj->do_Gadget.Flags &= ~(GADGHIGHBITS);
  1313. X    gptr->dobj->do_Gadget.Flags |= GADGHNONE;
  1314. X
  1315. X    /* Make sure gptr->dobj->do_ToolTypes is not NULL */
  1316. X    ReallocTools( gptr, 0 );
  1317. X
  1318. X    (void) CurrentDir( odir );
  1319. X    return( gptr );
  1320. X}
  1321. X
  1322. X#ifndef CLI
  1323. X
  1324. X/*
  1325. X * Put a 3-D motif border around the gadget.  String gadgets or those
  1326. X * which do not have highlighting are rendered down.  Boolean gadgets
  1327. X * are rendered in the up position by default.
  1328. X */
  1329. X
  1330. Xvoid SetBorder( gd, val )
  1331. X    register struct Gadget *gd;
  1332. X    int val;
  1333. X{
  1334. X    register struct Border *bp;
  1335. X    register short *sp;
  1336. X    register int i;
  1337. X    int borders = 6;
  1338. X
  1339. X    /* Allocate two border structures one for up image and one for down
  1340. X     * image, plus vector arrays for the border lines.
  1341. X     */
  1342. X
  1343. X    if( gd->GadgetType == STRGADGET )
  1344. X    borders = 12;
  1345. X
  1346. X    if( ( bp = xmalloc( ( ( sizeof( struct Border ) * 2 ) +
  1347. X        ( sizeof( short ) * borders ) ) * 2 ) ) == NULL )
  1348. X    {
  1349. X    return;
  1350. X    }
  1351. X
  1352. X    /* Remove any special rendering flags to avoid confusing intuition
  1353. X     */
  1354. X
  1355. X    gd->Flags &= ~(GADGHIGHBITS|GADGIMAGE|GRELWIDTH|
  1356. X            GRELHEIGHT|GRELRIGHT|GRELBOTTOM);
  1357. X
  1358. X    sp = (short *)(bp + 4);
  1359. X    if( val == 0 || val == 2 ||
  1360. X    gd->GadgetType == STRGADGET || ( gd->GadgetType == BOOLGADGET &&
  1361. X        ( gd->Flags & GADGHIGHBITS ) == GADGHNONE ) )
  1362. X    {
  1363. X    /* For a string gadget, we expand the border beyond the area where
  1364. X     * the text will be entered.
  1365. X     */
  1366. X
  1367. X    sp[0] = -1;
  1368. X    sp[1] = gd->Height - 1;
  1369. X    sp[2] = -1;
  1370. X    sp[3] = -1;
  1371. X    sp[4] = gd->Width - 1;
  1372. X    sp[5] = -1;
  1373. X
  1374. X    sp[6] = gd->Width + 1;
  1375. X    sp[7] = -2;
  1376. X    sp[8] = gd->Width + 1;
  1377. X    sp[9] = gd->Height + 1;
  1378. X    sp[10] = -2;
  1379. X    sp[11] = gd->Height + 1;
  1380. X
  1381. X    sp[12] = -2;
  1382. X    sp[13] = gd->Height;
  1383. X    sp[14] = -2;
  1384. X    sp[15] = -2;
  1385. X    sp[16] = gd->Width;
  1386. X    sp[17] = -2;
  1387. X    sp[18] = gd->Width;
  1388. X    sp[19] = gd->Height;
  1389. X    sp[20] = -2;
  1390. X    sp[21] = gd->Height;
  1391. X
  1392. X    for( i = 0; i < 3; ++i )
  1393. X    {
  1394. X        bp[ i ].LeftEdge = bp[ i ].TopEdge = -1;
  1395. X        if( val == 2 )
  1396. X        bp[ i ].FrontPen = ( i == 0 || i == 1 ) ? C_WHITE : C_BLACK;
  1397. X        else
  1398. X        bp[ i ].FrontPen = ( i == 0 || i == 1 ) ? C_BLACK : C_WHITE;
  1399. X
  1400. X        /* Have to use JAM2 so that the old colors disappear. */
  1401. X        bp[ i ].BackPen = C_GREY;
  1402. X        bp[ i ].DrawMode = JAM2;
  1403. X        bp[ i ].Count = ( i == 0 || i == 1 ) ? 3 : 5;
  1404. X        bp[ i ].XY = &sp[ i*6 ];
  1405. X        bp[ i ].NextBorder = ( i == 2 ) ? NULL : &bp[ i + 1 ];
  1406. X    }
  1407. X
  1408. X    /* Set the up image */
  1409. X    gd->GadgetRender = (APTR) bp;
  1410. X
  1411. X    /* Same image for select image */
  1412. X    gd->SelectRender = (APTR) bp;
  1413. X
  1414. X    gd->LeftEdge++;
  1415. X    gd->TopEdge++;
  1416. X    gd->Flags |= GADGHCOMP;
  1417. X    }
  1418. X    else
  1419. X    {
  1420. X    /* Create the border vector values for up and left side, and
  1421. X     * also the lower and right side.
  1422. X     */
  1423. X
  1424. X    sp[0] = 0;
  1425. X    sp[1] = gd->Height;
  1426. X    sp[2] = 0;
  1427. X    sp[3] = 0;
  1428. X    sp[4] = gd->Width;
  1429. X    sp[5] = 0;
  1430. X
  1431. X    sp[6] = gd->Width;
  1432. X    sp[7] = 0;
  1433. X    sp[8] = gd->Width;
  1434. X    sp[9] = gd->Height;
  1435. X    sp[10] = 0;
  1436. X    sp[11] = gd->Height;
  1437. X
  1438. X    /* We are creating 4 sets of borders, the two sides of the
  1439. X     * rectangle share the border vectors with the opposite image,
  1440. X     * but specify different colors.
  1441. X     */
  1442. X
  1443. X    for( i = 0; i < 4; ++i )
  1444. X    {
  1445. X        bp[ i ].TopEdge = bp[ i ].LeftEdge = 0;
  1446. X
  1447. X        /* A GADGHNONE is always down */
  1448. X
  1449. X        if( val != 3 && gd->GadgetType == BOOLGADGET &&
  1450. X        ( gd->Flags & GADGHIGHBITS ) != GADGHNONE )
  1451. X        {
  1452. X        bp[ i ].FrontPen =
  1453. X            ( i == 1 || i == 2 ) ? C_BLACK : C_WHITE;
  1454. X        }
  1455. X        else
  1456. X        {
  1457. X        bp[ i ].FrontPen =
  1458. X            ( i == 1 || i == 3 ) ? C_WHITE : C_BLACK;
  1459. X        }
  1460. X
  1461. X        /* Have to use JAM2 so that the old colors disappear. */
  1462. X        bp[ i ].BackPen = C_GREY;
  1463. X        bp[ i ].DrawMode = JAM2;
  1464. X        bp[ i ].Count = 3;
  1465. X        bp[ i ].XY = &sp[ 6 * ((i &1) != 0) ];
  1466. X        bp[ i ].NextBorder =
  1467. X        ( i == 1 || i == 3 ) ? NULL : &bp[ i + 1 ];
  1468. X    }
  1469. X
  1470. X    /* bp[0] and bp[1] two pieces for the up image */
  1471. X    gd->GadgetRender = (APTR) bp;
  1472. X
  1473. X    /* bp[2] and bp[3] two pieces for the down image */
  1474. X    gd->SelectRender = (APTR) (bp + 2);
  1475. X    gd->Flags |= GADGHIMAGE;
  1476. X    }
  1477. X}
  1478. X
  1479. X/* !CLI */
  1480. X
  1481. Xstruct Gadget *FindGadget( window, newwindow, id )
  1482. X    struct Window *window;
  1483. X    struct NewWindow *newwindow;
  1484. X    int id;
  1485. X{
  1486. X    struct Gadget *gd = NULL;
  1487. X
  1488. X    if( window )
  1489. X    gd = window->FirstGadget;
  1490. X    else if( newwindow )
  1491. X    gd = newwindow->FirstGadget;
  1492. X
  1493. X    while( gd )
  1494. X    {
  1495. X    if( gd->GadgetID == id )
  1496. X        break;
  1497. X    gd = gd->NextGadget;
  1498. X    }
  1499. X
  1500. X    return( gd );
  1501. X}
  1502. X
  1503. X#endif  /* CLI */
  1504. X
  1505. X/*
  1506. X * Clear all previous values from passed options array
  1507. X */
  1508. Xvoid ZapOptions( optr )
  1509. X    OPTR optr;
  1510. X{
  1511. X    int i;
  1512. X
  1513. X    for( i = 0; optr[ i ].name; ++i )
  1514. X    {
  1515. X    if( optr[i].optstr )
  1516. X    {
  1517. X        if( *optr[i].optstr )
  1518. X        {
  1519. X        free( optr[i].optstr );
  1520. X        optr[i].optstr = "";
  1521. X        }
  1522. X    }
  1523. X    else
  1524. X    {
  1525. X        optr[i].optval = optr[i].defval;
  1526. X    }
  1527. X    }
  1528. X}
  1529. X
  1530. X#ifndef CLI
  1531. X
  1532. X/*
  1533. X * Copy Options from GAMES OPTIONS= tooltypes element to the gadgets
  1534. X */
  1535. Xvoid CopyOptions( optr, gptr )
  1536. X    OPTR optr;
  1537. X    GPTR gptr;
  1538. X{
  1539. X    char **sp;
  1540. X
  1541. X    for( sp = gptr->dobj->do_ToolTypes; *sp; ++sp )
  1542. X    {
  1543. X    if( strnicmp( *sp, "options=", 8 ) == 0 )
  1544. X    {
  1545. X        break;
  1546. X    }
  1547. X    }
  1548. X
  1549. X    if( *sp == NULL )
  1550. X    {
  1551. X    errmsg( NO_FLASH, "Options not set for %s", gptr->name );
  1552. X    return;
  1553. X    }
  1554. X
  1555. X    CopyOptionStr( optr, *sp + 8 );
  1556. X}
  1557. X
  1558. X/* !CLI */
  1559. X
  1560. Xvoid CopyOptionStr( optr, str )
  1561. X    OPTR optr;
  1562. X    char *str;
  1563. X{
  1564. X    char *s, *t, buf[ 100 ];
  1565. X    int i, sidx, state = 0;
  1566. X    int done = 0;
  1567. X
  1568. X    ZapOptions( optr );
  1569. X    s = buf;
  1570. X    *buf = 0;
  1571. X    sidx = -1;
  1572. X
  1573. X    /* Start past the 'options=' part */
  1574. X    for( t = str; !done; ++t )
  1575. X    {
  1576. X    if( state == 0 && isspace( *t ) )
  1577. X        continue;
  1578. X
  1579. X    /* If at end remember so... */
  1580. X    if( !*t )
  1581. X        done = 1;
  1582. X
  1583. X    /* If looking for an option value */
  1584. X    if( state == 0 )
  1585. X    {
  1586. X        /* If found string value... */
  1587. X        if( *t == ':' )
  1588. X        {
  1589. X        *s = 0;
  1590. X        state = 1;
  1591. X        sidx = -1;
  1592. X
  1593. X        /* Look for the particular named option */
  1594. X        for( i = 0; optr[i].name; ++i )
  1595. X        {
  1596. X            if( stricmp( optr[i].name, buf ) == 0 )
  1597. X            {
  1598. X            sidx = i;
  1599. X            break;
  1600. X            }
  1601. X        }
  1602. X
  1603. X        /* Set buffer pointer */
  1604. X        *(s = buf) = 0;
  1605. X
  1606. X        if( sidx == -1 )
  1607. X        {
  1608. X            errmsg( FLASH, "Invalid option name %s", buf );
  1609. X            return;
  1610. X        }
  1611. X        if( !optr[i].optstr )
  1612. X        {
  1613. X            errmsg( FLASH, "%s is not a string option", buf );
  1614. X            return;
  1615. X        }
  1616. X        continue;
  1617. X        }
  1618. X    }
  1619. X
  1620. X    /* If at end of string or comma and we have some text... */
  1621. X    if( !*t || *t == ',' && *buf )
  1622. X    {
  1623. X        /* Mark end */
  1624. X        *s = 0;
  1625. X
  1626. X        /* If have collected string option value... */
  1627. X        if( sidx != -1 )
  1628. X        {
  1629. X        /* Free old string */
  1630. X        if( optr[sidx].optstr )
  1631. X        {
  1632. X            if( *optr[sidx].optstr )
  1633. X            free( optr[sidx].optstr );
  1634. X        }
  1635. X
  1636. X        /* Store new string */
  1637. X        if( *buf )
  1638. X            optr[sidx].optstr = strdup( buf );
  1639. X        else
  1640. X            optr[sidx].optstr = "";
  1641. X        sidx = -1;
  1642. X        }
  1643. X        else
  1644. X        {
  1645. X        /* Look for boolean option */
  1646. X        for( i = 0; optr[i].name; ++i )
  1647. X        {
  1648. X            if( *buf == '!' )
  1649. X            {
  1650. X            if( stricmp( optr[i].name, buf + 1 ) == 0 )
  1651. X                break;
  1652. X            }
  1653. X            else
  1654. X            {
  1655. X            if( stricmp( optr[i].name, buf ) == 0 )
  1656. X                break;
  1657. X            }
  1658. X        }
  1659. X
  1660. X        if( optr[i].name )
  1661. X        {
  1662. X            optr[i].optval = *buf != '!';
  1663. X        }
  1664. X        else
  1665. X        {
  1666. X            errmsg( FLASH, "Unrecognized option %s", buf );
  1667. X            return;
  1668. X        }
  1669. X        }
  1670. X        *(s = buf) = 0;
  1671. X        state = 0;
  1672. X    }
  1673. X    else
  1674. X    {
  1675. X        if( *t == ',' )
  1676. X        *(s = buf) = 0;
  1677. X        else
  1678. X        *s++ = *t;
  1679. X    }
  1680. X    }
  1681. X}
  1682. X
  1683. X/* !CLI */
  1684. X
  1685. X/*
  1686. X *  Set the GAMES OPTIONS tooltypes to the data in the Options windows
  1687. X *  gadgetry.
  1688. X */
  1689. Xvoid SetOptions( optr, gptr )
  1690. X    register OPTR optr;
  1691. X    register GPTR gptr;
  1692. X{
  1693. X    PutOptions( optr );
  1694. X    SetToolLine( gptr, "OPTIONS", options[ OPTIONS_IDX ] );
  1695. X    UpdateGameIcon( gptr );
  1696. X}
  1697. X
  1698. Xvoid
  1699. XUpdateGameIcon( gptr )
  1700. X    register GPTR gptr;
  1701. X{
  1702. X    register long lock;
  1703. X
  1704. X    if( lock = Lock( gptr->dname, ACCESS_READ ) )
  1705. X    {
  1706. X    /* Write out the DiskObject */
  1707. X
  1708. X    WriteDObj( gptr, lock );
  1709. X    UnLock( lock );
  1710. X    }
  1711. X    else
  1712. X    {
  1713. X    errmsg( FLASH, "Can't change directory to %s", gptr->dname );
  1714. X    }
  1715. X}
  1716. X
  1717. X#endif  /* CLI */
  1718. X
  1719. Xchar *ToolsEntry( gptr, name )
  1720. X    GPTR gptr;
  1721. X    char *name;
  1722. X{
  1723. X    char *str;
  1724. X
  1725. X    if( ! ( str = FindToolType( (char **) gptr->dobj->do_ToolTypes, name ) ) )
  1726. X    str = "";
  1727. X
  1728. X    return( str );
  1729. X}
  1730. X
  1731. X/* Reallocate the toolstype information into dynamic memory so that some
  1732. X * parts of it can be easily changed, but we can still do "FreeDiskObject"
  1733. X * later to clean up whatever "GetDiskObject" allocated.
  1734. X */
  1735. Xvoid ReallocTools( gptr, add )
  1736. X    GPTR gptr;
  1737. X    int add;
  1738. X{
  1739. X    int i, cnt;
  1740. X    char **sp, **tp;
  1741. X
  1742. X    for( cnt = 0, tp = gptr->dobj->do_ToolTypes; tp && *tp ; ++tp )
  1743. X    ++cnt;
  1744. X
  1745. X    if( !tp )
  1746. X    {
  1747. X    /* If no tooltypes array, fudge something to start with */
  1748. X    if( sp = xmalloc( 2 * sizeof( char * ) ) )
  1749. X    {
  1750. X        sp[0] = strdup("HACKDIR=NetHack:");
  1751. X        sp[1] = NULL;
  1752. X    }
  1753. X    }
  1754. X    else if( sp = xmalloc( (cnt+1+add) * sizeof( char * ) ) )
  1755. X    {
  1756. X    for( i = 0, tp = gptr->dobj->do_ToolTypes;
  1757. X            tp && *tp && i < cnt; ++tp )
  1758. X    {
  1759. X        sp[i++] = strdup( *tp );
  1760. X    }
  1761. X
  1762. X    sp[i] = NULL;
  1763. X    }
  1764. X    gptr->otools = gptr->dobj->do_ToolTypes;
  1765. X    gptr->dobj->do_ToolTypes = sp;
  1766. X    gptr->toolcnt = cnt + 1;
  1767. X    gptr->talloc = 1;
  1768. X}
  1769. X
  1770. Xvoid FreeTools( gptr )
  1771. X    GPTR gptr;
  1772. X{
  1773. X    int i;
  1774. X    char **sp;
  1775. X
  1776. X    if( !gptr->talloc )
  1777. X    return;
  1778. X
  1779. X    for( i = 0, sp = gptr->dobj->do_ToolTypes; sp[i]; ++i )
  1780. X    {
  1781. X    free( sp[ i ] );
  1782. X    sp[ i ] = NULL;
  1783. X    }
  1784. X    free( sp );
  1785. X    gptr->dobj->do_ToolTypes = gptr->otools;
  1786. X    gptr->talloc = 0;
  1787. X}
  1788. X
  1789. Xvoid SetToolLine( gptr, name, value )
  1790. X    GPTR gptr;
  1791. X    char *name, *value;
  1792. X{
  1793. X    char **sp, **osp;
  1794. X    int i, len;
  1795. X
  1796. X    /* Realloc ToolTypes to be in memory we know how to manage */
  1797. X
  1798. X    if( gptr->talloc == 0 )
  1799. X    ReallocTools( gptr, 0 );
  1800. X
  1801. X    sp = gptr->dobj->do_ToolTypes;
  1802. X    len = strlen( name );
  1803. X
  1804. X    /* Find any previous definition */
  1805. X    for( i = 0; sp[i] && i < gptr->toolcnt - 1; ++i )
  1806. X    {
  1807. X    if( strnicmp( name, sp[i], len ) == 0 && sp[i][len] == '=' )
  1808. X        break;
  1809. X    }
  1810. X
  1811. X    /* Free up the space, or allocate new space if not there */
  1812. X    if( sp[ i ] )
  1813. X    free( sp[ i ] );
  1814. X    else
  1815. X    {
  1816. X    /* Check for need to realloc */
  1817. X
  1818. X    if( i >= gptr->toolcnt - 1 )
  1819. X    {
  1820. X        int j=i;
  1821. X        osp = sp;
  1822. X        sp = xmalloc( ( i + 2 ) * sizeof( char * ) );
  1823. X        gptr->toolcnt = i + 2;
  1824. X        sp[ i + 1 ] = NULL;
  1825. X        while( j >= 0 )
  1826. X        {
  1827. X        sp[ j ] = osp[ j ];
  1828. X        --j;
  1829. X        }
  1830. X        free( osp );
  1831. X        /* i = gptr->toolcnt - 1; */
  1832. X        gptr->dobj->do_ToolTypes = sp;
  1833. X    }
  1834. X    else
  1835. X    {
  1836. X        sp[ i + 1 ] = NULL;
  1837. X    }
  1838. X    }
  1839. X
  1840. X    /* Set the string */
  1841. X
  1842. X    if( sp[ i ] = xmalloc( strlen (value) + strlen( name ) + 2 ) )
  1843. X    sprintf( sp[i], "%s=%s", name, value );
  1844. X    else
  1845. X    {
  1846. X    sp[ i ] = NULL;     /* redundant */
  1847. X    errmsg( FLASH, "Could not allocate string for value" );
  1848. X    }
  1849. X}
  1850. X
  1851. Xvoid WriteDObj( gptr, lock )
  1852. X    register GPTR gptr;
  1853. X    long lock;
  1854. X{
  1855. X    register long odir;
  1856. X    long flag, act;
  1857. X
  1858. X    /* Don't write gadget out as selected */
  1859. X
  1860. X    flag = gptr->dobj->do_Gadget.Flags;
  1861. X    act = gptr->dobj->do_Gadget.Activation;
  1862. X    gptr->dobj->do_Gadget.Flags = gptr->oflag;
  1863. X    gptr->dobj->do_Gadget.Activation = gptr->oact;
  1864. X    odir = CurrentDir( lock );
  1865. X
  1866. X    if( PutDiskObject( gptr->name, gptr->dobj ) == 0 )
  1867. X    errmsg( FLASH, "Could not write disk object values" );
  1868. X
  1869. X    gptr->dobj->do_Gadget.Flags = flag;
  1870. X    gptr->dobj->do_Gadget.Activation = act;
  1871. X
  1872. X    if( odir )
  1873. X    (void) CurrentDir( odir );
  1874. X}
  1875. X
  1876. Xchar *Strdup( str )
  1877. X    char *str;
  1878. X{
  1879. X    char *t;
  1880. X
  1881. X    if( t = AllocMem( strlen( str ) + 1, MEMF_PUBLIC ) )
  1882. X    strcpy( t, str );
  1883. X    return( t );
  1884. X}
  1885. X
  1886. X#ifdef CLI
  1887. X
  1888. Xchar *
  1889. Xeos(s)
  1890. X    char *s;
  1891. X{
  1892. X    while(*s)s++;
  1893. X    return s;
  1894. X}
  1895. X
  1896. X/* CLI */
  1897. X
  1898. Xvoid
  1899. Xcondaddslash(s)
  1900. X    char *s;
  1901. X{
  1902. X    s=eos(s);
  1903. X    switch(s[-1]){
  1904. X    case ':':
  1905. X    case '/':
  1906. X    break;
  1907. X    default:
  1908. X    s[0]='/';
  1909. X    s[1]='\0';
  1910. X    break;
  1911. X    }
  1912. X    return;
  1913. X}
  1914. X
  1915. X/* CLI */
  1916. X
  1917. X#if 0
  1918. X/* for debug only */
  1919. X#define BP __builtin_printf
  1920. Xdumptools(sp,i)
  1921. X    char **sp;
  1922. X    int i;
  1923. X{
  1924. X    int x;
  1925. X    BP("Dumptools: cnt=%d\n",i);
  1926. X    for(x=0;sp[x];x++)
  1927. X    BP("%d: '%s'\n",x,sp[x]);
  1928. X}
  1929. X#endif
  1930. X
  1931. X#else   /* CLI */
  1932. X
  1933. Xvoid ClearDelGames()
  1934. X{
  1935. X    register GPTR gptr, pgptr = NULL;
  1936. X
  1937. X    for( gptr = gamehead; gptr; )
  1938. X    {
  1939. X    /* Skip New Game */
  1940. X
  1941. X    if( gptr->fname == NULL )
  1942. X    {
  1943. X        gptr = gptr->next;
  1944. X        continue;
  1945. X    }
  1946. X
  1947. X    /* If gone, then remove structures */
  1948. X
  1949. X    if( access( GameName( gptr, NULL ), 0 ) == -1 )
  1950. X    {
  1951. X        if( pgptr )
  1952. X        pgptr->next = gptr->next;
  1953. X        else
  1954. X        gamehead = gptr->next;
  1955. X
  1956. X        FreeGITEM( gptr );
  1957. X        gptr = pgptr ? pgptr : gamehead;
  1958. X    }
  1959. X    else
  1960. X    {
  1961. X        pgptr = gptr;
  1962. X        gptr = gptr->next;
  1963. X    }
  1964. X    }
  1965. X}
  1966. X
  1967. X/* !CLI */
  1968. X
  1969. Xstruct TagItem tags[] =
  1970. X{
  1971. X    TAG_DONE, 0l,
  1972. X};
  1973. X
  1974. Xstruct Window *
  1975. XMyOpenWindow( nw )
  1976. X#ifdef  INTUI_NEW_LOOK
  1977. X    struct ExtNewWindow *nw;
  1978. X#else
  1979. X    struct NewWindow *nw;
  1980. X#endif
  1981. X{
  1982. X#ifdef  INTUI_NEW_LOOK
  1983. X    /*nw->Extension = tags;
  1984. X    nw->Flags = WFLG_NW_EXTENDED;*/
  1985. X#endif
  1986. X#undef  NewWindow
  1987. X    return( OpenWindow( (struct NewWindow *) nw ) );
  1988. X}
  1989. X
  1990. X#endif  /* CLI */
  1991. X
  1992. Xvoid
  1993. Xdiskobj_filter( dobj )
  1994. X    struct DiskObject *dobj;
  1995. X{
  1996. X    char **ta=dobj->do_ToolTypes;
  1997. X    int x;
  1998. X
  1999. X    /* if nothing there, just return. */
  2000. X    if( !ta )
  2001. X        return;
  2002. X
  2003. X#ifdef CLI
  2004. X    /* kill everything except INTERNALCLI */
  2005. X
  2006. X    for(x=0;ta[x];x++){
  2007. X    if(!strncmp(ta[x],"INTERNALCLI=",12)){
  2008. X        ta[0]=ta[x];
  2009. X        ta[1]=0;
  2010. X        return;
  2011. X    }
  2012. X    }
  2013. X    ta[0]=0;
  2014. X#else
  2015. X    /* kill INTERNALCLI */
  2016. X    for(x=0;ta[x];x++){
  2017. X        int offset=0;
  2018. X    while(ta[x+offset] && !strncmp(ta[x+offset],"INTERNALCLI=",12)){
  2019. X        offset++;
  2020. X        }
  2021. X        ta[x]=ta[x+offset];
  2022. X    }
  2023. X#endif
  2024. X}
  2025. END_OF_FILE
  2026. if test 38406 -ne `wc -c <'sys/amiga/wbcli.c'`; then
  2027.     echo shar: \"'sys/amiga/wbcli.c'\" unpacked with wrong size!
  2028. fi
  2029. # end of 'sys/amiga/wbcli.c'
  2030. fi
  2031. if test -f 'sys/msdos/trampoli.c' -a "${1}" != "-c" ; then 
  2032.   echo shar: Will not clobber existing file \"'sys/msdos/trampoli.c'\"
  2033. else
  2034. echo shar: Extracting \"'sys/msdos/trampoli.c'\" \(15116 characters\)
  2035. sed "s/^X//" >'sys/msdos/trampoli.c' <<'END_OF_FILE'
  2036. X/*    SCCS Id: @(#)trampoli.c     3.1    93/01/18      */
  2037. X/* Copyright (c) 1989 - 1993 by Norm Meluch and Stephen Spackman  */
  2038. X/* NetHack may be freely redistributed.  See license for details. */
  2039. X
  2040. X#include "hack.h"
  2041. X
  2042. X/****************************************************************************/
  2043. X/*                                        */
  2044. X/*    This file contains a series of definitions of "one liner"        */
  2045. X/*    functions corresponding to *all* functions that NetHack calls        */
  2046. X/*    via pointers.                                */
  2047. X/*         IF ANY CALLS TO FUNCTIONS VIA POINTERS ARE ADDED            */
  2048. X/*         TO THE CODE, AN ENTRY FOR THE FUNCTION CALLED MUST            */
  2049. X/*         BE ADDED TO THIS FILE AND TO TRAMPOLI.H.                */
  2050. X/*    This mess is necessary for the Microsoft Compiler implementation    */
  2051. X/*    of overlaid code (v5.1 - 6.0ax).                    */
  2052. X/*                                        */
  2053. X/*    The original function (eg foo) has been #defined to be foo_        */
  2054. X/*    via double inclusion of trampoli.h in hack.h, and            */
  2055. X/*    now the definition of foo is placed in this file calling foo        */
  2056. X/*    directly.  This module is _never_ placed in an overlay so        */
  2057. X/*    calls via pointers to these functions will not cause difficulties.  */
  2058. X/*                                        */
  2059. X/*    This leads to what could be called a "trampoline" effect, and        */
  2060. X/*    hence the silly name for these files. :-)                */
  2061. X/*                                        */
  2062. X/****************************************************************************/
  2063. X
  2064. X#ifdef OVERLAY
  2065. X
  2066. X/* ### apply.c ### */
  2067. X#undef dig
  2068. X#undef doapply
  2069. X#undef dojump
  2070. X#undef dorub
  2071. X
  2072. Xint dig()     { return dig_();     }
  2073. Xint doapply() { return doapply_(); }
  2074. Xint dojump()  { return dojump_();  }
  2075. Xint dorub()   { return dorub_();   }
  2076. X
  2077. X
  2078. X/* ### cmd.c ### */
  2079. X#undef doextcmd
  2080. X#undef doextlist
  2081. X#undef doprev_message
  2082. X
  2083. X#ifdef POLYSELF
  2084. X#undef domonability
  2085. X#endif /* POLYSELF */
  2086. X
  2087. X#ifdef EXPLORE_MODE
  2088. X#undef enter_explore_mode
  2089. X
  2090. Xint enter_explore_mode() { return enter_explore_mode_(); }
  2091. X#endif
  2092. X
  2093. X#undef timed_occupation
  2094. X
  2095. X#if defined(WIZARD) || defined(EXPLORE_MODE)
  2096. X#undef wiz_attributes
  2097. X#endif
  2098. X
  2099. X#ifdef WIZARD
  2100. X#undef wiz_detect
  2101. X#undef wiz_genesis
  2102. X#undef wiz_identify
  2103. X#undef wiz_level_tele
  2104. X#undef wiz_map
  2105. X#undef wiz_where
  2106. X#undef wiz_wish
  2107. X#endif
  2108. X
  2109. Xint doextcmd()         { return doextcmd_();         }
  2110. Xint doextlist()        { return doextlist_();        }
  2111. Xint doprev_message()   { return doprev_message_();   }
  2112. X
  2113. X#ifdef POLYSELF
  2114. Xint domonability()     { return domonability_();     }
  2115. X#endif /* POLYSELF */
  2116. X
  2117. Xint timed_occupation() { return timed_occupation_(); }
  2118. X
  2119. X#if defined(WIZARD) || defined(EXPLORE_MODE)
  2120. Xint wiz_attributes()   { return wiz_attributes_();   }
  2121. X#endif
  2122. X
  2123. X#ifdef WIZARD
  2124. Xint wiz_detect()       { return wiz_detect_();       }
  2125. Xint wiz_genesis()      { return wiz_genesis_();      }
  2126. Xint wiz_identify()     { return wiz_identify_();     }
  2127. Xint wiz_level_tele()   { return wiz_level_tele_();   }
  2128. Xint wiz_map()          { return wiz_map_();          }
  2129. Xint wiz_where()        { return wiz_where_();        }
  2130. Xint wiz_wish()         { return wiz_wish_();         }
  2131. X#endif
  2132. X
  2133. X
  2134. X/* ### do.c ### */
  2135. X#undef doddrop
  2136. X#undef dodown
  2137. X#undef dodrop
  2138. X#undef donull
  2139. X#undef doup
  2140. X#undef dowipe
  2141. X#undef drop
  2142. X#undef wipeoff
  2143. X
  2144. Xint doddrop()             { return doddrop_(); }
  2145. Xint dodown()              { return dodown_();  }
  2146. Xint dodrop()              { return dodrop_();  }
  2147. Xint donull()              { return donull_();  }
  2148. Xint doup()                { return doup_();    }
  2149. Xint dowipe()              { return dowipe_();  }
  2150. Xint drop(obj)
  2151. Xregister struct obj *obj; { return drop_(obj); }
  2152. Xint wipeoff()             { return wipeoff_(); }
  2153. X
  2154. X
  2155. X/* ### do_name.c ### */
  2156. X#undef ddocall
  2157. X#undef do_mname
  2158. X
  2159. Xint ddocall()  { return ddocall_();  }
  2160. Xint do_mname() { return do_mname_(); } 
  2161. X
  2162. X
  2163. X/* ### do_wear.c ### */
  2164. X#undef Armor_off
  2165. X#undef Boots_off
  2166. X#undef Gloves_off
  2167. X#undef Helmet_off
  2168. X#undef Armor_on
  2169. X#undef Boots_on
  2170. X#undef Gloves_on
  2171. X#undef Helmet_on
  2172. X#undef doddoremarm
  2173. X#undef doputon
  2174. X#undef doremring
  2175. X#undef dotakeoff
  2176. X#undef dowear
  2177. X#undef select_off
  2178. X#undef take_off
  2179. X
  2180. Xint Armor_off()   { return Armor_off_();   }
  2181. Xint Boots_off()   { return Boots_off_();   }
  2182. Xint Gloves_off()  { return Gloves_off_();  }
  2183. Xint Helmet_off()  { return Helmet_off_();  }
  2184. Xint Armor_on()    { return Armor_on_();    }
  2185. Xint Boots_on()    { return Boots_on_();    }
  2186. Xint Gloves_on()   { return Gloves_on_();   }
  2187. Xint Helmet_on()   { return Helmet_on_();   }
  2188. Xint doddoremarm() { return doddoremarm_(); }
  2189. Xint doputon()     { return doputon_();     }
  2190. Xint doremring()   { return doremring_();   }
  2191. Xint dotakeoff()   { return dotakeoff_();   }
  2192. Xint dowear()      { return dowear_();      }
  2193. Xint select_off(otmp) struct obj *otmp; { return select_off_(otmp); }
  2194. Xint take_off()    { return take_off_();    }
  2195. X
  2196. X
  2197. X/* ### dogmove ### */
  2198. X#undef wantdoor
  2199. X
  2200. Xvoid wantdoor(x, y, dummy)
  2201. Xint x, y; genericptr_t dummy; { return wantdoor_(x, y, dummy); }
  2202. X
  2203. X
  2204. X/* ### dokick.c ### */
  2205. X#undef dokick
  2206. X
  2207. Xint dokick() { return dokick_(); }
  2208. X
  2209. X
  2210. X/* ### dothrow.c ### */
  2211. X#undef dothrow
  2212. X
  2213. Xint dothrow() { return dothrow_(); }
  2214. X
  2215. X
  2216. X/* ### eat.c ### */
  2217. X#undef Hear_again
  2218. X#undef eatmdone
  2219. X#undef doeat
  2220. X#undef eatfood
  2221. X#undef opentin
  2222. X#undef unfaint
  2223. X
  2224. Xint Hear_again()  { return Hear_again_(); }
  2225. Xint eatmdone()    { return eatmdone_();   }
  2226. Xint doeat()       { return doeat_();      }
  2227. Xint eatfood()     { return eatfood_();    }
  2228. Xint opentin()     { return opentin_();    }
  2229. Xint unfaint()     { return unfaint_();    }
  2230. X
  2231. X
  2232. X/* ### end.c ### */
  2233. X#undef done1
  2234. X#undef done2
  2235. X#undef hangup
  2236. X#undef done_intr
  2237. X
  2238. X#if defined(UNIX) || defined(VMS)
  2239. X#undef done_hangup
  2240. X#endif /* UNIX || VMS */
  2241. X
  2242. Xint done1()     { return done1_();     }
  2243. Xint done2()     { return done2_();     }
  2244. Xint hangup()    { return hangup_();    }
  2245. Xint done_intr() { return done_intr_(); }
  2246. X
  2247. X#if defined(UNIX) || defined(VMS)
  2248. Xint done_hangup() { return done_hangup_(); }
  2249. X#endif /* UNIX || VMS */
  2250. X
  2251. X
  2252. X/* ### engrave.c ### */
  2253. X#undef doengrave
  2254. X
  2255. Xint doengrave() { return doengrave_(); }
  2256. X
  2257. X
  2258. X/* ### fountain.c ### */
  2259. X#undef gush
  2260. X
  2261. Xvoid gush(x, y, poolcnt)
  2262. Xint x, y; genericptr_t poolcnt; { return gush_(x, y, poolcnt); }
  2263. X
  2264. X
  2265. X/* ### hack.c ### */
  2266. X#undef dopickup
  2267. X#undef identify
  2268. X
  2269. Xint dopickup() { return dopickup_(); }
  2270. Xint identify(otmp) struct obj *otmp; { return identify_(otmp); }
  2271. X
  2272. X
  2273. X/* ### invent.c ### */
  2274. X#undef ckunpaid
  2275. X#undef ddoinv
  2276. X#undef dolook
  2277. X#undef dopramulet
  2278. X#undef doprarm
  2279. X#undef doprgold
  2280. X#undef doprring
  2281. X#undef doprtool
  2282. X#undef doprwep
  2283. X#undef dotypeinv
  2284. X#undef doorganize
  2285. X
  2286. Xint ckunpaid(obj) struct obj *obj; { return ckunpaid_(obj); }
  2287. Xint ddoinv()     { return ddoinv_();     }
  2288. Xint dolook()     { return dolook_();     }
  2289. Xint dopramulet() { return dopramulet_(); }
  2290. Xint doprarm()    { return doprarm_();    }
  2291. Xint doprgold()   { return doprgold_();   }
  2292. Xint doprring()   { return doprring_();   }
  2293. Xint doprtool()   { return doprtool_();   }
  2294. Xint doprwep()    { return doprwep_();    }
  2295. Xint dotypeinv()  { return dotypeinv_();  }
  2296. Xint doorganize() { return doorganize_(); }
  2297. X
  2298. X
  2299. X/* ### ioctl.c ### */
  2300. X#ifdef UNIX
  2301. X# ifdef SUSPEND
  2302. X#undef dosuspend
  2303. X
  2304. Xint dosuspend() { return dosuspend_(); }
  2305. X# endif /* SUSPEND */
  2306. X#endif /* UNIX */
  2307. X
  2308. X
  2309. X/* ### lock.c ### */
  2310. X#undef doclose
  2311. X#undef doforce
  2312. X#undef doopen
  2313. X#undef forcelock
  2314. X#undef picklock
  2315. X
  2316. Xint doclose()   { return doclose_();   }
  2317. Xint doforce()   { return doforce_();   }
  2318. Xint doopen()    { return doopen_();    }
  2319. Xint forcelock() { return forcelock_(); }
  2320. Xint picklock()  { return picklock_();  }
  2321. X
  2322. X
  2323. X/* ### mklev.c ### */
  2324. X#undef do_comp
  2325. X
  2326. Xint do_comp(vx, vy) genericptr_t vx, vy;  { return comp_(vx, vy); }
  2327. X
  2328. X
  2329. X/* ### mondata.c ### */
  2330. X/* canseemon() is only called by a macro e_boolean.  If e_boolean ever does
  2331. X   become a function, this may need to return. */
  2332. X
  2333. X/* #undef canseemon */
  2334. X
  2335. X/* boolean canseemon(x) struct monst *x; { return canseemon_(x); } */
  2336. X
  2337. X
  2338. X/* ### muse.c ### */
  2339. X#undef mbhitm
  2340. X
  2341. Xint mbhitm(mtmp, otmp) struct monst *mtmp; struct obj *otmp;
  2342. X    { return mbhitm_(mtmp, otmp); }
  2343. X
  2344. X
  2345. X/* ### o_init.c ### */
  2346. X#undef dodiscovered
  2347. X
  2348. Xint dodiscovered() { return dodiscovered_(); }
  2349. X
  2350. X
  2351. X/* ### objnam.c ### */
  2352. X#undef doname
  2353. X#undef xname
  2354. X
  2355. Xchar *doname(obj) struct obj *obj; { return doname_(obj); }
  2356. Xchar *xname(obj)  struct obj *obj; { return xname_(obj); }
  2357. X
  2358. X
  2359. X/* ### options.c ### */
  2360. X#undef doset
  2361. X#undef dotogglepickup
  2362. X
  2363. Xint doset()          { return doset_();         }
  2364. Xint dotogglepickup() { return dotogglepickup_(); }
  2365. X
  2366. X
  2367. X/* ### pager.c ### */
  2368. X#undef dohelp
  2369. X#undef dohistory
  2370. X#undef dowhatdoes
  2371. X#undef dowhatis
  2372. X#undef doquickwhatis
  2373. X
  2374. Xint dohelp()        { return dohelp_();        }
  2375. Xint dohistory()     { return dohistory_();     }
  2376. Xint dowhatdoes()    { return dowhatdoes_();    }
  2377. Xint dowhatis()      { return dowhatis_();      }
  2378. Xint doquickwhatis() { return doquickwhatis_(); }
  2379. X
  2380. X
  2381. X/* ### pcsys.c ### */
  2382. X#ifdef SHELL
  2383. X#undef dosh
  2384. X
  2385. Xint dosh()          { return dosh_();          }
  2386. X#endif /* SHELL */
  2387. X
  2388. X
  2389. X/* ### pickup.c ### */
  2390. X#undef ck_bag
  2391. X#undef doloot
  2392. X#undef in_container
  2393. X#undef out_container
  2394. X
  2395. Xint ck_bag(obj) struct obj *obj; { return ck_bag_(obj);  }
  2396. Xint doloot() { return doloot_(); }
  2397. Xint in_container(obj)  struct obj *obj; { return in_container_(obj); }
  2398. Xint out_container(obj) struct obj *obj; { return out_container_(obj); }
  2399. X
  2400. X
  2401. X/* ### potion.c ### */
  2402. X#undef dodrink
  2403. X#undef dodip
  2404. X
  2405. Xint dodrink() { return dodrink_(); }
  2406. Xint dodip()   { return dodip_();   }
  2407. X
  2408. X
  2409. X/* ### pray.c ### */
  2410. X#undef doturn
  2411. X#undef dopray
  2412. X#undef prayer_done
  2413. X#undef dosacrifice
  2414. X
  2415. Xint doturn()      { return doturn_();      }
  2416. Xint dopray()      { return dopray_();      }
  2417. Xint prayer_done() { return prayer_done_(); }
  2418. Xint dosacrifice() { return dosacrifice_(); }
  2419. X
  2420. X
  2421. X/* ### print.c ### */
  2422. X#undef doredraw
  2423. X
  2424. Xint doredraw()    { return doredraw_(); }
  2425. X
  2426. X
  2427. X/* ### read.c ### */
  2428. X#undef doread
  2429. X#undef set_lit
  2430. X
  2431. Xint doread()            { return doread_(); }
  2432. Xvoid set_lit(x, y, val)
  2433. Xint x, y; genericptr_t val; { return set_lit_(x, y, val); }
  2434. X
  2435. X
  2436. X/* ### save.c ### */
  2437. X#undef dosave
  2438. X
  2439. Xint dosave() { return dosave_(); }
  2440. X
  2441. X
  2442. X/* ### search.c ### */
  2443. X#undef findone
  2444. X#undef openone
  2445. X#undef doidtrap
  2446. X#undef dosearch
  2447. X
  2448. Xvoid findone(zx, zy, num)
  2449. Xint zx, zy; genericptr_t num; { return findone_(zx, zy, num); }
  2450. Xvoid openone(zx, zy, num)
  2451. Xint zx, zy; genericptr_t num; { return openone_(zx, zy, num); }
  2452. Xint doidtrap()              { return doidtrap_(); }
  2453. Xint dosearch()              { return dosearch_(); }
  2454. X
  2455. X
  2456. X/* ### shk.c ### */
  2457. X#undef dopay
  2458. X
  2459. Xint dopay() { return dopay_(); }
  2460. X
  2461. X
  2462. X/* ### sit.c ### */
  2463. X#undef dosit
  2464. X
  2465. Xint dosit() { return dosit_(); }
  2466. X
  2467. X
  2468. X/* ### sounds.c ### */
  2469. X#undef dotalk
  2470. X
  2471. Xint dotalk() { return dotalk_(); }
  2472. X
  2473. X
  2474. X/* ### spell.c ### */
  2475. X#undef learn
  2476. X#undef docast
  2477. X#undef dovspell
  2478. X
  2479. Xint learn() { return learn_(); }
  2480. Xint docast()   { return docast_();   }
  2481. Xint dovspell() { return dovspell_(); }
  2482. X
  2483. X
  2484. X/* ### steal.c ### */
  2485. X#undef stealarm
  2486. X
  2487. Xint stealarm() { return stealarm_(); }
  2488. X
  2489. X
  2490. X/* ### trap.c ### */
  2491. X#undef dotele
  2492. X#undef dountrap
  2493. X#undef float_down
  2494. X
  2495. Xint dotele()     { return dotele_();     }
  2496. Xint dountrap()   { return dountrap_();   }
  2497. Xint float_down() { return float_down_(); }
  2498. X
  2499. X
  2500. X/* ### version.c ### */
  2501. X#undef doversion
  2502. X#undef doextversion
  2503. X
  2504. Xint doversion()    { return doversion_();    }
  2505. Xint doextversion() { return doextversion_(); }
  2506. X
  2507. X
  2508. X/* ### wield.c ### */
  2509. X#undef dowield
  2510. X
  2511. Xint dowield() { return dowield_(); }
  2512. X
  2513. X
  2514. X/* ### zap.c ### */
  2515. X#undef bhitm
  2516. X#undef bhito
  2517. X#undef dozap
  2518. X
  2519. Xint bhitm(mtmp, otmp) struct monst *mtmp; struct obj *otmp;
  2520. X    { return bhitm_(mtmp, otmp); }
  2521. Xint bhito(obj, otmp) struct obj *obj, *otmp; { return bhito_(obj,  otmp); }
  2522. Xint dozap() { return dozap_(); }
  2523. X
  2524. X/* 
  2525. X * Window Implementation Specific Functions.
  2526. X */
  2527. X
  2528. X
  2529. X/* ### getline.c ### */
  2530. X#undef tty_getlin
  2531. X#ifdef COM_COMPL
  2532. X#undef tty_get_ext_cmd
  2533. X
  2534. Xvoid tty_get_ext_cmd(bufp)
  2535. X  char *bufp;            { tty_get_ext_cmd_(bufp);    }
  2536. X#endif /* COM_COMPL */
  2537. Xvoid tty_getlin(query,bufp)
  2538. X  const char *query; char *bufp;{ tty_getlin_(query,bufp);    }
  2539. X
  2540. X
  2541. X/* ### termcap.c ### */
  2542. X#undef tty_nhbell
  2543. X#undef tty_number_pad
  2544. X#undef tty_delay_output
  2545. X#undef tty_start_screen
  2546. X#undef tty_end_screen
  2547. X
  2548. Xvoid tty_nhbell()        { tty_nhbell_();         }
  2549. Xvoid tty_number_pad(state)
  2550. X  int state;            { tty_number_pad_(state);    }
  2551. Xvoid tty_delay_output()        { tty_delay_output_();         }
  2552. X/* other defs that really should go away (they're tty specific) */
  2553. Xvoid tty_start_screen()        { tty_start_screen_();         }
  2554. Xvoid tty_end_screen()        { tty_end_screen_();         }
  2555. X
  2556. X
  2557. X/* ### topl.c ### */
  2558. X#undef tty_doprev_message
  2559. X#undef tty_yn_function
  2560. X
  2561. Xint tty_doprev_message()    { tty_doprev_message_();     }
  2562. Xchar tty_yn_function(query,resp,def)
  2563. X  const char *query, *resp; char def;
  2564. X                { tty_yn_function_(query,resp,def); }
  2565. X
  2566. X
  2567. X/* ### wintty.c ### */
  2568. X#undef tty_init_nhwindows
  2569. X#undef tty_player_selection
  2570. X#undef tty_askname
  2571. X#undef tty_get_nh_event
  2572. X#undef tty_exit_nhwindows
  2573. X#undef tty_suspend_nhwindows
  2574. X#undef tty_resume_nhwindows
  2575. X#undef tty_create_nhwindow
  2576. X#undef tty_clear_nhwindow
  2577. X#undef tty_display_nhwindow
  2578. X#undef tty_destroy_nhwindow
  2579. X#undef tty_curs
  2580. X#undef tty_putstr
  2581. X#undef tty_display_file
  2582. X#undef tty_start_menu
  2583. X#undef tty_add_menu
  2584. X#undef tty_end_menu
  2585. X#undef tty_select_menu
  2586. X#undef tty_update_inventory
  2587. X#undef tty_mark_synch
  2588. X#undef tty_wait_synch
  2589. X#ifdef CLIPPING
  2590. X#undef tty_cliparound
  2591. X#endif
  2592. X#undef tty_print_glyph
  2593. X#undef tty_raw_print
  2594. X#undef tty_raw_print_bold
  2595. X#undef tty_nhgetch
  2596. X#undef tty_nh_poskey
  2597. X
  2598. Xvoid tty_init_nhwindows()    { tty_init_nhwindows_();    }
  2599. Xvoid tty_player_selection()    { tty_player_selection_();     }
  2600. Xvoid tty_askname()        { tty_askname_();         }
  2601. Xvoid tty_get_nh_event()        { tty_get_nh_event_();         }
  2602. Xvoid tty_exit_nhwindows(str)
  2603. X  const char *str;        { tty_exit_nhwindows_(str);    }
  2604. Xvoid tty_suspend_nhwindows(str)
  2605. X  const char *str;        { tty_suspend_nhwindows_(str);    }
  2606. Xvoid tty_resume_nhwindows()    { tty_resume_nhwindows_();     }
  2607. Xwinid tty_create_nhwindow(type)
  2608. X  int type;            { tty_create_nhwindow_(type);    }
  2609. Xvoid tty_clear_nhwindow(window)
  2610. X  winid window;            { tty_clear_nhwindow_(window);    }
  2611. Xvoid tty_display_nhwindow(window, blocking)
  2612. X  winid window; boolean blocking;
  2613. X                { tty_display_nhwindow_(window,blocking); }
  2614. Xvoid tty_destroy_nhwindow(window)
  2615. X  winid window;            { tty_destroy_nhwindow_(window); }
  2616. Xvoid tty_curs(window,x,y)
  2617. X  winid window; int x,y;    { tty_curs_(window,x,y);    }
  2618. Xvoid tty_putstr(window,attr,str)
  2619. X  winid window; int attr; const char *str;
  2620. X                { tty_putstr_(window,attr,str); }
  2621. Xvoid tty_display_file(fname, complain)
  2622. X  const char *fname; boolean complain;
  2623. X                { tty_display_file_(fname,complain); }
  2624. Xvoid tty_start_menu(window)
  2625. X  winid window;            { tty_start_menu_(window);    }
  2626. Xvoid tty_add_menu(window,ch,attr,str)
  2627. X  winid window; char ch; int attr; const char *str;
  2628. X                { tty_add_menu_(window,ch,attr,str); }
  2629. Xvoid tty_end_menu(window,ch,str,morestr)
  2630. X  winid window; char ch; const char *str, *morestr;
  2631. X                { tty_end_menu_(window,ch,str,morestr);    }
  2632. Xchar tty_select_menu(window)
  2633. X  winid window;            { tty_select_menu_(window);    }
  2634. Xvoid tty_update_inventory()    { tty_update_inventory_();     }
  2635. Xvoid tty_mark_synch()        { tty_mark_synch_();         }
  2636. Xvoid tty_wait_synch()        { tty_wait_synch_();         }
  2637. X#ifdef CLIPPING
  2638. Xvoid tty_cliparound(x,y)
  2639. X  int x,y;            { tty_cliparound_(x,y);        }
  2640. X#endif
  2641. Xvoid tty_print_glyph(window,x,y,glyph)
  2642. X  winid window; xchar x,y; int glyph;
  2643. X                { tty_print_glyph_(window,x,y,glyph); }
  2644. Xvoid tty_raw_print(str)
  2645. X  const char *str;        { tty_raw_print_(str);         }
  2646. Xvoid tty_raw_print_bold(str)
  2647. X  const char *str;        { tty_raw_print_bold_(str);     }
  2648. Xint tty_nhgetch()        { tty_nhgetch_();         }
  2649. Xint tty_nh_poskey(x,y,pos)
  2650. X  int *x,*y,*pos;        { tty_nh_poskey_(x,y,pos);    }
  2651. X
  2652. X#endif /* OVERLAY */
  2653. END_OF_FILE
  2654. if test 15116 -ne `wc -c <'sys/msdos/trampoli.c'`; then
  2655.     echo shar: \"'sys/msdos/trampoli.c'\" unpacked with wrong size!
  2656. fi
  2657. # end of 'sys/msdos/trampoli.c'
  2658. fi
  2659. echo shar: End of archive 38 \(of 108\).
  2660. cp /dev/null ark38isdone
  2661. MISSING=""
  2662. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  2663. 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
  2664. 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
  2665. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
  2666. 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 \
  2667. 101 102 103 104 105 106 107 108 ; do
  2668.     if test ! -f ark${I}isdone ; then
  2669.     MISSING="${MISSING} ${I}"
  2670.     fi
  2671. done
  2672. if test "${MISSING}" = "" ; then
  2673.     echo You have unpacked all 108 archives.
  2674.     echo "Now execute 'rebuild.sh'"
  2675.     rm -f ark10[0-8]isdone ark[1-9]isdone ark[1-9][0-9]isdone
  2676. else
  2677.     echo You still need to unpack the following archives:
  2678.     echo "        " ${MISSING}
  2679. fi
  2680. ##  End of shell archive.
  2681. exit 0
  2682.