home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / 3b1 / volume02 / klndike2 / part02 < prev    next >
Encoding:
Internet Message Format  |  1992-06-27  |  42.7 KB

  1. Path: comp-sources-3b1
  2. From: vern@zebra.alphacdc.com (vern)
  3. Subject:  v02i010:  Klondike, version 2, Part02/06
  4. Newsgroups: comp.sources.3b1
  5. Approved: dave@galaxia.network23.com
  6. X-Checksum-Snefru: 1f225e0a b4781641 023709aa 7718a40d
  7.  
  8. Submitted-by: vern@zebra.alphacdc.com (vern)
  9. Posting-number: Volume 2, Issue 10
  10. Archive-name: klondike2/part02
  11.  
  12. This part 2 of 6 parts to the 'klondike' gane for the 7300/3b1.
  13.  
  14. Place this in directory with the other parts and 'unshar'.
  15.  
  16. vern
  17.  
  18. Vernon C. Hoxie                            {ncar,boulder}!scicom!zebra!vern
  19. 3975 W. 29th Ave.                                       voice: 303-477-1780
  20. Denver, Colo., 80212                                     uucp: 303-455-2670
  21.  
  22. --------------------------------- cut here --------------------------------
  23. #! /bin/sh
  24. # This is a shell archive.  Remove anything before this line, then unpack
  25. # it by saving it into a file and typing "sh file".  To overwrite existing
  26. # files, type "sh file -c".  You can also feed this as standard input via
  27. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  28. # will see the following message at the end:
  29. #        "End of archive 2 (of 6)."
  30. # Contents:  check.c klondike.c other.c
  31. # Wrapped by vern@zebra on Tue Jun 23 07:22:42 1992
  32. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  33. if test -f check.c -a "${1}" != "-c" ; then 
  34.   echo shar: Will not over-write existing file \"check.c\"
  35. else
  36. echo shar: Extracting \"check.c\" \(10196 characters\)
  37. sed "s/^X//" >check.c <<'END_OF_check.c'
  38. X#include "klondike.h"
  39. X#include <errno.h>
  40. X#include <errno.h>
  41. X#include <fcntl.h>
  42. X#include <status.h>
  43. X#include <stdio.h>
  44. X#include <sys/window.h>
  45. X#include <pwd.h>
  46. X#include <sys/param.h>
  47. X
  48. Xextern int over;
  49. Xextern int indeck;
  50. Xextern int deck[];
  51. Xextern int vegas_style;
  52. Xextern int score_now;
  53. Xextern int score_tot;
  54. Xextern int score_sum;
  55. X
  56. X/* Check to see if player has overlooked a move.
  57. X * Return TRUE if there is a move. */
  58. X
  59. X#ifdef CHEAT
  60. Xstatic char *suit_name[] = {
  61. X    "Spades",
  62. X    "Hearts",
  63. X    "Clubs",
  64. X    "Diamonds"
  65. X};
  66. X
  67. Xstatic char *color_name[] = {
  68. X    "Black",
  69. X    "Red"
  70. X};
  71. Xstatic char *card_num[] = {
  72. X    "Blank",
  73. X    "Ace",
  74. X    "2",
  75. X    "3",
  76. X    "4",
  77. X    "5",
  78. X    "6",
  79. X    "7",
  80. X    "8",
  81. X    "9",
  82. X    "10",
  83. X    "Jack",
  84. X    "Queen",
  85. X    "King"
  86. X};
  87. X
  88. Xint
  89. Xany_moves()
  90. X{
  91. X    int i, j;
  92. X    int card1, card2;
  93. X
  94. X                /* Move a card to outdeck? */
  95. X    for ( i = 0; i < 8; i++ ) {
  96. X        if ( i == 7 ) {
  97. X            if ( !over ) break;
  98. X            card1 = deck[indeck - over];
  99. X        }
  100. X        else card1 = up[i][numup[i] - 1];
  101. X        card2 = card1 - 1;
  102. X        if ( outcard[SUIT(card1)] == 0 ) card2 = 100;
  103. X            /* If card1 one greater than outdeck, move */
  104. X        if ( outcard[SUIT(card1)] == VALUE(card1) - 1 ) goto quit;
  105. X    }
  106. X                /* Move from one column to another? */
  107. X    for ( i = 0; i < 8; i++ ) {
  108. X        if ( i == 7 ) {
  109. X            if ( !over ) break;
  110. X            card1 = deck[indeck - over];
  111. X        }
  112. X        else card1 = up[i][0];
  113. X        for ( j = 0; j < 7; j++ ) {
  114. X            if ( j == i ) continue;
  115. X                    /* Test for moving from one column to another */
  116. X                    /* If test card is King, move to empty column */
  117. X            if (VALUE(card1) == 13) {
  118. X                card2 = 100;
  119. X                if ( numdown[j] == 0 && numup[j] == 0 &&
  120. X                    ( numdown[i] > 0 && numup[i] > 0 || i == 7 )) goto quit;
  121. X            }
  122. X            card2 = up[j][numup[j] - 1];
  123. X            if ( VALUE(card2) == VALUE(card1) + 1 &&
  124. X                COLOR(card2) != COLOR(card1) ) goto quit;
  125. X        }
  126. X    }
  127. X    clear_clue();
  128. X    return(0);
  129. Xquit:
  130. X    wgoto(wn, 21, 2 );
  131. X    if ( card2 == 100 )
  132. X        wprintf( wn, "Move %s of %s to Blank.                   ",
  133. X            card_num[VALUE(card1)], suit_name[SUIT(card1)]);
  134. X    else
  135. X        wprintf( wn, "Move %s of %s to %s of %s.                ",
  136. X            card_num[VALUE(card1)], suit_name[SUIT(card1)],
  137. X            card_num[VALUE(card2)], suit_name[SUIT(card2)]);
  138. X    return(1);
  139. X}
  140. X
  141. X        /* Clear the line of move clue */
  142. Xclear_clue()
  143. X{
  144. X    wgoto(wn, 21, 2 );
  145. X    wprintf( wn, "                                                   " );
  146. X}
  147. X
  148. X#endif    /* CHEAT */
  149. X
  150. X#ifdef SCORES
  151. X/* Get the history score from disk. */
  152. Xchar fname[50];
  153. X
  154. Xread_file()
  155. X{
  156. X    struct passwd *getpwnam(), *pwd;
  157. X    int seek_score();
  158. X    char user[10];
  159. X    int uid, gid;
  160. X
  161. X    strcpy( user, getenv("LOGNAME"));
  162. X     if (( pwd = getpwnam( user )) == NULL ) {
  163. X            /* owner 2 = bin, group 2 = bin */
  164. X        uid = 2;
  165. X        gid = 2;
  166. X    }
  167. X    else {
  168. X        uid = pwd->pw_uid;
  169. X        gid = pwd->pw_gid;
  170. X    }
  171. X    
  172. X    strcat( strcpy( fname, SFILE ), user );
  173. X    if ( access( fname, 0 ) == -1 ) {
  174. X        if ( errno == ENOENT ) {
  175. X            umask( 0 );
  176. X            creat( fname, 0666 );
  177. X            chown( fname, uid, gid );
  178. X        }
  179. X        else {
  180. X            eprintf( ST_SYS, ST_DISPLAY, NULL,
  181. X                    "Can't access %s.", fname );
  182. X            exit( 1 );
  183. X        }
  184. X    }
  185. X    score_sum = seek_score();
  186. X    score_tot = 0;
  187. X}
  188. X
  189. X/* Find the users entry in SFILE and return the
  190. X * value of historic scores. */
  191. X
  192. Xint
  193. Xseek_score()
  194. X{
  195. X    char *pname;
  196. X    int num, fs;
  197. X    str_score ps;
  198. X
  199. X    if (( fs = open( fname, O_RDONLY )) == 0 ) {
  200. X        eprintf( ST_SYS, ST_DISPLAY, NULL,
  201. X                "Can't open %s for reading.", fname );
  202. X        exit( 1 );
  203. X    }
  204. X    pname = (char *)getlogin();
  205. X    while (( num = read( fs, &ps, sizeof(ps)))
  206. X            == sizeof(ps)) {
  207. X        if ( strncmp( pname, ps.name, sizeof(ps.name)) == 0) break;
  208. X    }
  209. X    close( fs );
  210. X    if ( num < sizeof( ps )) return 0;
  211. X    return ( ps.score );
  212. X}
  213. X
  214. X/* Find the users entry in SFILE and save the sum of
  215. X * score_now, score_tot, and score_sum. */
  216. X
  217. Xvoid
  218. Xsave_score( zap )
  219. Xint zap;
  220. X{
  221. X    char *pname;
  222. X    int num, fs;
  223. X    long sum;
  224. X    str_score ps;
  225. X
  226. X    if (( fs = open( fname, O_RDWR )) == 0 ) {
  227. X        eprintf( ST_SYS, ST_DISPLAY, NULL,
  228. X                "Can't open %s for writing.", fname );
  229. X        return;
  230. X    }
  231. X    pname = (char *)getlogin();
  232. X    sum = 0;
  233. X    while (( num = read( fs, &ps, sizeof(ps))) == sizeof(ps)) {
  234. X        if ( strncmp( pname, ps.name, sizeof(ps.name)) == 0) break;
  235. X        sum += (long)num;
  236. X    }
  237. X    if ( num == 0 ) {
  238. X        strncpy( ps.name, pname, sizeof(ps.name) - 1);
  239. X        ps.name[sizeof(ps.name) - 1] = '\0';
  240. X    }
  241. X    if ( zap ) {
  242. X        ps.score = 0;
  243. X        score_tot = 0;
  244. X        score_sum = 0;
  245. X    }
  246. X    else {
  247. X#ifdef CHEAT
  248. X            /* include score of last game only if finished */
  249. X        if ( ! any_moves() ) score_tot += score_now;
  250. X#else
  251. X        score_tot += score_now;
  252. X#endif
  253. X        ps.score = score_tot + score_sum;
  254. X    }
  255. X    lseek( fs, sum, 0 );
  256. X    if ( write( fs, &ps, sizeof(ps)) < sizeof(ps)) {
  257. X        eprintf( ST_SYS, ST_DISPLAY, NULL, "Can't write to %s.", fname );
  258. X    }
  259. X    close( fs );
  260. X}
  261. X
  262. X/*
  263. X * Display the ongoing scores at bottom of playing area.
  264. X */
  265. X
  266. Xvoid
  267. Xshow_score()
  268. X{
  269. X    register int i;
  270. X
  271. X    if (vegas_style) {
  272. X        for ( score_now = -52, i = 0; i < 4; i++ ) {
  273. X            if ( outcard[i] > 1 ) score_now += 5 * outcard[i];
  274. X        }
  275. X        wgoto( wn, 22, 2 );
  276. X        wprintf( wn, "This game: %d, Today %d, Since forever %d.        ",
  277. X            score_now, score_tot, score_sum );
  278. X        if ( score_now < 208 ) wcmd(wn, "");
  279. X    }
  280. X    else score_now = 0;
  281. X}
  282. X#endif    /* SCORES */
  283. X
  284. X#ifdef UNDO
  285. X
  286. Xint fu;                    /* undo file descriptor */
  287. Xint rec_num;            /* number of records in file */
  288. X
  289. Xopen_undo()
  290. X{
  291. X    if (( fu = open( UFILE, O_RDWR | O_CREAT, 0666 )) < 0 ) {
  292. X        eprintf( ST_SYS, ST_DISPLAY, NULL,
  293. X                "Can't open %s for writing.", UFILE );
  294. X    }
  295. X    rec_num = 0;
  296. X    return;
  297. X}
  298. X
  299. Xadd_undo()
  300. X{
  301. X    record undo;
  302. X    register int i, j;
  303. X    int f_pntr;
  304. X
  305. X    f_pntr = rec_num++ * sizeof( undo );
  306. X    lseek( fu, f_pntr, 0 );
  307. X    undo.rec_indeck = indeck;
  308. X    undo.rec_over = over;
  309. X    for ( i = 0; i < 52; i++ ) undo.rec_deck[i] = deck[i];
  310. X    for ( i = 0; i < 4; i++ ) undo.rec_outcard[i] = outcard[i];
  311. X    for ( i = 0; i < 7; i++ ) {
  312. X        for ( j = 0; j < 7; j++ ) undo.rec_down[i][j] = down[i][j];
  313. X    }
  314. X    for ( i = 0; i < 7; i++ ) undo.rec_numdown[i] = numdown[i];
  315. X    for ( i = 0; i < 7; i++ ) {
  316. X        for ( j = 0; j < 13; j++ ) undo.rec_up[i][j] = up[i][j];
  317. X    }
  318. X    for ( i = 0; i < 7; i++ ) undo.rec_numup[i] = numup[i];
  319. X    write( fu, &undo, sizeof( undo ));
  320. X}
  321. X
  322. Xdo_undo()
  323. X{
  324. X    record undo;
  325. X    register int i, j;
  326. X    int f_pntr;
  327. X    unsigned short x_pos, y_pos;
  328. X
  329. X#ifdef RUN
  330. X    extern int run_deck;
  331. X
  332. X    if ( run_deck ) {
  333. X        run_deck = 0;
  334. X        do_slk( );
  335. X    }
  336. X#endif
  337. X    if ( --rec_num < 0 ) {
  338. X        rec_num = 0;
  339. X        wgoto(wn, 20, 2 );
  340. X        wprintf( wn, "Undo file depleted." );
  341. X        return;
  342. X    } else {
  343. X        wgoto(wn, 20, 2 );
  344. X        wprintf( wn, "                     " );
  345. X    }
  346. X    f_pntr = rec_num * sizeof( undo );
  347. X    lseek( fu, f_pntr, 0 );
  348. X    read( fu, &undo, sizeof( undo ));
  349. X
  350. X                /* Redo the stock area. */
  351. X    if ( over != undo.rec_over || indeck != undo.rec_indeck ) {
  352. X        over = undo.rec_over;
  353. X        indeck = undo.rec_indeck;
  354. X        for ( i = 0; i < 52; i++ ) deck[i] = undo.rec_deck[i];
  355. X        if ( over == 0 ) {
  356. X            wrastop(wn, blank[0], 10,
  357. X                (unsigned short *)0, 0, 0, 0,
  358. X                DECK, TOP + (CARD_H/2),
  359. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  360. X                (unsigned short *)0);
  361. X        }
  362. X        else {
  363. X            wrastop(wn, images[deck[indeck-over]], 10,
  364. X                (unsigned short *)0, 0, 0, 0,
  365. X                DECK, TOP + (CARD_H/2),
  366. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  367. X                (unsigned short *)0);
  368. X        }
  369. X        if ( indeck-over == 0 ) {
  370. X            wrastop(wn, blank[0], 10,
  371. X                (unsigned short *)0, 0, 0, 0,
  372. X                DECK, TOP + (CARD_H/2) + CARD_H + FACE_SEP,
  373. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  374. X                (unsigned short *)0);
  375. X        }
  376. X        else {
  377. X            wrastop(wn, back[0], 10,
  378. X                (unsigned short *)0, 0, 0, 0,
  379. X                DECK,TOP + (CARD_H/2) + CARD_H + FACE_SEP,
  380. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  381. X                (unsigned short *)0);
  382. X        }
  383. X    }
  384. X    for ( i = 0; i < 4; i++ ) {
  385. X        if ( outcard[i] != undo.rec_outcard[i] ) {
  386. X            outcard[i] = undo.rec_outcard[i];
  387. X            if ( outcard[i] == 0 ) {
  388. X                wrastop(wn, blank[0], 10,
  389. X                    (unsigned short *)0, 0, 0, 0,
  390. X                    LEFT+((CARD_W+ROW_SEP)*(i*2)), TOP,
  391. X                    CARD_W, CARD_H, SRCSRC, DSTSRC,
  392. X                    (unsigned short *)0);
  393. X            } else {
  394. X                wrastop(wn, images[i*13+outcard[i]-1], 10,
  395. X                    (unsigned short *)0, 0, 0, 0,
  396. X                     LEFT+((CARD_W+ROW_SEP)*(i*2)), TOP,
  397. X                    CARD_W, CARD_H, SRCSRC, DSTSRC,
  398. X                    (unsigned short *)0);
  399. X            }
  400. X        }
  401. X    }
  402. X    for ( i = 0; i < 7; i++ ) {
  403. X        if ( numdown[i] != undo.rec_numdown[i]
  404. X                ||    numup[i] != undo.rec_numup[i] ) {
  405. X            x_pos = LEFT+((CARD_W+ROW_SEP)*i);
  406. X            y_pos = TOP + CARD_H + SUIT_SEP;
  407. X            wrastop(wn, (unsigned short *)0, 0,
  408. X                (unsigned short *)0, 0, 0, 0,
  409. X                x_pos, y_pos,
  410. X                CARD_W,
  411. X                CARD_H + BACK_SEP*numdown[i] + FACE_SEP*(numup[i]-1),
  412. X                SRCPAT, DSTSRC,
  413. X                patblack);
  414. X            numdown[i] = undo.rec_numdown[i];
  415. X            numup[i] = undo.rec_numup[i];
  416. X            for ( j = 0; j < 7; j++ ) {
  417. X                down[i][j] = undo.rec_down[i][j];
  418. X                if ( down[i][j] == -1 ) break;
  419. X
  420. X                wrastop(wn, back[0], 10,
  421. X                    (unsigned short *)0, 0, 0, 0,
  422. X                    x_pos, y_pos,
  423. X                    CARD_W, CARD_H, SRCSRC, DSTSRC,
  424. X                    (unsigned short *)0);
  425. X                y_pos += BACK_SEP;
  426. X            }
  427. X            for ( j = 0; j < 13; j++ ) {
  428. X                up[i][j] = undo.rec_up[i][j];
  429. X                if ( up[i][j] == -1 ) break;
  430. X                wrastop(wn, images[up[i][j]], 10,
  431. X                    (unsigned short *)0, 0, 0, 0,
  432. X                    x_pos, y_pos,
  433. X                    CARD_W, CARD_H, SRCSRC, DSTSRC,
  434. X                    (unsigned short *)0);
  435. X                y_pos += FACE_SEP;
  436. X            }
  437. X        }
  438. X    }
  439. X    lseek( fu, f_pntr, 0 );
  440. X}
  441. X
  442. X#endif
  443. X
  444. X#ifdef MARKS
  445. X
  446. Xstatic int num_marks;
  447. Xstatic int marks[60];
  448. X
  449. X#endif
  450. X
  451. X#ifdef MARKS
  452. X
  453. Xsay_marks( num )
  454. Xint num;
  455. X{
  456. X    wgoto( wn, 16, 1 );
  457. X    if ( num == 0 )       wprintf( wn, "          ");
  458. X    else if ( num < 0 )   wprintf( wn, "No Marks  ");
  459. X    else if ( num == 60 ) wprintf( wn, "Too Many  ");
  460. X    else if ( num == 61 ) wprintf( wn, "You Goofed");
  461. X    else                     wprintf( wn, "%2d Marks  ", num);
  462. X}
  463. X
  464. X#endif    /* MARKS */
  465. X
  466. X#ifdef RUN
  467. X
  468. X#define CLOCK_TICK 1000/HZ        /* HZ = 60 for unix-pc */
  469. X
  470. X/* This routine "borrowed" from kermit.  Its a handy little routine */
  471. X/* and if you are building your own library of pets, consider this  */
  472. X/* for inclusion - vch.  m = msec of delay                */
  473. X
  474. Xint mpause( m )
  475. Xint m;
  476. X
  477. X{
  478. X    extern long times( );
  479. X    long t1, t2, tarray[4];
  480. X    int t3;
  481. X
  482. X    if ( m <= 0 ) return( 0 );
  483. X     if (( t1 = times( tarray )) < 0) return( -1 );
  484. X    while (1)
  485. X    {
  486. X        if (( t2 = times( tarray )) < 0) return( -1 );
  487. X        t3 = (( int )( t2 - t1 )) * CLOCK_TICK;
  488. X        if ( t3 > m ) return( t3 );
  489. X    }
  490. X}                    /* mpause() */
  491. X
  492. X/*
  493. X * Move all exposed cards to the outcard stacks when all
  494. X * the down cards have been turned over.
  495. X */
  496. X
  497. Xvoid
  498. Xdo_run()
  499. X{
  500. X    register int i, j;
  501. X
  502. X    for ( i = 1; i <= 13; i++ ) {
  503. X        for ( j = 0; j < 7; j++ ) {
  504. X            if ( VALUE(up[j][numup[j]-1]) == i ) {
  505. X                playcard(j+1);
  506. X                mpause( 250 );        /* short delay for effect */
  507. X            }
  508. X        }
  509. X    }
  510. X}
  511. X#endif
  512. END_OF_check.c
  513. if test 10196 -ne `wc -c <check.c`; then
  514.     echo shar: \"check.c\" unpacked with wrong size!
  515. fi
  516. # end of overwriting check
  517. fi
  518. if test -f klondike.c -a "${1}" != "-c" ; then 
  519.   echo shar: Will not over-write existing file \"klondike.c\"
  520. else
  521. echo shar: Extracting \"klondike.c\" \(21642 characters\)
  522. sed "s/^X//" >klondike.c <<'END_OF_klondike.c'
  523. X/*
  524. X *    Copyright 1990, Thomas E. Tkacik
  525. X *            tkacik@kyzyl.mi.org
  526. X *
  527. X *    Acknowledgments to Kent Quander allowing me to
  528. X *     use and distribute his wonderfully drawn playing cards.
  529. X *
  530. X *    Permission is given to copy and distribute for non-profit purposes.
  531. X *
  532. X */
  533. X
  534. X#include "klondike.h"
  535. X#include <kcodes.h>
  536. X#include <stdio.h>
  537. X#include <sys/mouse.h>
  538. X#include <sys/window.h>
  539. X
  540. Xdouble drand48();
  541. Xlong   lrand48();
  542. Xvoid   srand48();
  543. Xlong   time();
  544. Xlong   atol();
  545. Xint    getpid();
  546. Xvoid   exit();
  547. X
  548. X/* number used to generate the current board */
  549. Xlong board;
  550. X
  551. X/* number of card remaining in the deck */
  552. Xint indeck;
  553. X
  554. X/* number of cards in the deck that have been turned over */
  555. Xint over;
  556. X
  557. X/* card stack selected by the player */
  558. Xint src_stack;
  559. X
  560. X/* card selected by the player */
  561. Xint ucard;
  562. X
  563. X/* 1 if dragging cards around with the mouse */
  564. Xint dragging = 0;
  565. X
  566. X/* 1 if vegas style of play -- turn one card at a time, */
  567. X/* go through deck once */
  568. Xint vegas_style = VEGAS;
  569. X
  570. X/* one or more cards that will get dragged by the mouse */
  571. Xunsigned short cards[12*FACE_SEP+CARD_H][5];
  572. X
  573. X/* size of cards to be dragged, in pixels */
  574. Xint h_cards, w_cards;
  575. X
  576. X#ifdef SCORES
  577. X/* scores */
  578. Xint score_now, score_tot, score_sum;
  579. Xextern void show_score();
  580. Xextern void save_score();
  581. Xextern void read_file();
  582. X#endif
  583. X
  584. X#ifdef CHEAT
  585. X/* Check for more moves */
  586. Xstatic int first_pass = 1;
  587. Xextern void do_slk();
  588. Xint cheat;
  589. X#endif
  590. X
  591. X#ifdef UNDO
  592. Xextern void open_undo();
  593. Xextern void add_undo();
  594. Xextern void do_undo();
  595. X#endif
  596. X
  597. X#ifdef MARKS
  598. Xstatic int num_marks;
  599. Xstatic int marks[60];
  600. X#endif
  601. X
  602. X#ifdef RUN
  603. Xint run_deck;
  604. Xvoid do_deck();
  605. X#endif
  606. X
  607. Xmain(argc, argv)
  608. Xint argc;
  609. Xchar *argv[];
  610. X{
  611. X    int c, errflg = 0;
  612. X    extern int optind;
  613. X    extern char *optarg;
  614. X
  615. X     /* initialize random number generator */
  616. X
  617. X    srand48(getpid()+time((long *)0));
  618. X
  619. X     /* let board be the first number in the random sequence */
  620. X     /*  this will vary more than (getpid+time) does */
  621. X
  622. X    board = lrand48()>>8;  /* use only high 24 bits */
  623. X    srand48(board);
  624. X
  625. X
  626. X     /* parse arguments */
  627. X
  628. X    while((c = getopt(argc, argv, "vn:")) != EOF) {
  629. X        switch(c) {
  630. X            case 'n':
  631. X                board = atol(optarg);
  632. X                srand48(board);
  633. X                break;
  634. X            case 'v':
  635. X                vegas_style = 1;
  636. X                break;
  637. X            default:
  638. X                errflg = 1;
  639. X        }
  640. X    }
  641. X    if(errflg == 1) {
  642. X        fprintf(stderr, "Usage: %s [-v] [-n #]\n", argv[0]);
  643. X        exit(1);
  644. X    }
  645. X
  646. X#ifdef SCORES
  647. X    read_file();
  648. X#endif
  649. X#ifdef UNDO
  650. X    open_undo();
  651. X#endif
  652. X#ifdef CHEAT
  653. X    cheat = 1;                        /* Set default to CHEAT on */
  654. X#endif
  655. X    initwindow();
  656. X
  657. X    set_up();
  658. X
  659. X    play();
  660. X
  661. X    leave();
  662. X
  663. X    return(0);
  664. X}
  665. X
  666. X/*
  667. X * play another game
  668. X */
  669. X
  670. Xnew_game()
  671. X{
  672. X     /* use only the high 24 significant bits of board */
  673. X
  674. X    board = lrand48()>>8;
  675. X
  676. X    set_up();
  677. X}
  678. X
  679. X/*
  680. X * set up the board for a new game
  681. X */
  682. X
  683. Xset_up()
  684. X{
  685. X    char prompt[40];
  686. X
  687. X     /* clear the playing area */
  688. X
  689. X    wrastop(wn, (unsigned short *)0, 0, (unsigned short *)0, 0,
  690. X        0, 0, SIDEBORDER, TOPBORDER, WIND_W-(2*SIDEBORDER),
  691. X        WIND_H-(2*TOPBORDER), SRCPAT, DSTSRC, patblack);
  692. X
  693. X    sprintf(prompt, "Hand: %ld        ", board);
  694. X    wprompt(wn, prompt);
  695. X
  696. X    srand48(board);
  697. X    shuffle();
  698. X    setup();
  699. X    dragging = 0;
  700. X#ifdef CHEAT
  701. X    first_pass = 1;
  702. X#endif
  703. X#ifdef UNDO
  704. X    rec_num = 0;
  705. X#endif
  706. X#ifdef MARKS
  707. X    num_marks = 0;
  708. X    say_marks( 0 );
  709. X#endif
  710. X#ifdef [BRUN
  711. X    run_deck = 0;
  712. X#endif
  713. X}
  714. X
  715. X/*
  716. X * take user input and play the game
  717. X */
  718. X
  719. Xplay()
  720. X{
  721. X    int c;
  722. X
  723. X    for(;;) {
  724. X#ifdef RUN
  725. X        int down_cards;
  726. X
  727. X        down_cards = 0;
  728. X        for ( c = 0; c < 7; c++ ) down_cards += numdown[c];
  729. X        if ( run_deck && ( indeck || over || down_cards )) {
  730. X            run_deck = 0;
  731. X            do_slk( );
  732. X        }
  733. X        else if ( ! run_deck && ! ( indeck || over || down_cards )) {
  734. X            run_deck = 1;
  735. X            do_slk( );
  736. X        }
  737. X#endif
  738. X        c = wgetc(wn);
  739. X        switch(c) {
  740. X            case F1:
  741. X                vegas_style = 1;
  742. X                new_game();
  743. X                break;
  744. X            case F2:
  745. X                vegas_style = 0;
  746. X                new_game();
  747. X                break;
  748. X            case F3:
  749. X                set_up();
  750. X                break;
  751. X#ifdef CHEAT
  752. X            case F4:
  753. X                cheat = !cheat;
  754. X                do_slk( );
  755. X                break;
  756. X#endif
  757. X#ifdef UNDO
  758. X            case Undo:
  759. X            case F5:
  760. X                do_undo();                /* was first attempted */
  761. X                show_score();
  762. X                break;
  763. X#endif
  764. X#ifdef RUN
  765. X            case F6:
  766. X                add_undo();
  767. X                if ( run_deck ) do_run();
  768. X                break;
  769. X#endif
  770. X#ifdef SCORES
  771. X            case F7:
  772. X                score_now = 0;
  773. X                save_score(1);
  774. X                show_score();
  775. X                break;
  776. X#endif
  777. X            case F8:
  778. X            case Exit:
  779. X                quit();
  780. X                return;
  781. X                break;
  782. X            case Mouse:
  783. X                domouse();
  784. X                break;
  785. X#ifdef MARKS
  786. X            case Mark:
  787. X                if ( num_marks >= 59 ) {
  788. X                    say_marks(60);
  789. X                    num_marks = 59;
  790. X                }
  791. X                else {
  792. X                    if ( num_marks > rec_num ) say_marks( 61 );
  793. X                    else {
  794. X                        marks[num_marks++] = rec_num + 1;
  795. X                        say_marks( num_marks );
  796. X                    }
  797. X                }
  798. X                break;
  799. X            case Slect:
  800. X                if ( --num_marks < 0 ) {
  801. X                    say_marks( -1 );
  802. X                    num_marks = 0;
  803. X                } else {
  804. X                    if ( marks[num_marks] > rec_num ) say_marks( 61 );
  805. X                    else {
  806. X                        rec_num = marks[num_marks];
  807. X                        do_undo();
  808. X                        say_marks( num_marks );
  809. X                    }
  810. X                }
  811. X                show_score();
  812. X                break;
  813. X#endif
  814. X            default:
  815. X                 /* ignore all other input */
  816. X                break;
  817. X        }
  818. X    }
  819. X}
  820. X
  821. X/*
  822. X * when the quit button is pushed
  823. X */
  824. X
  825. Xquit()
  826. X{
  827. X#ifdef SCORES
  828. X    void save_score();
  829. X
  830. X    save_score(0);
  831. X#endif
  832. X#ifdef UNDO
  833. X    close(fu);
  834. X    unlink( UFILE );
  835. X#endif
  836. X    wcmd(wn, "quit");
  837. X    wprompt(wn, "");
  838. X}
  839. X
  840. X/*
  841. X * shuffle the cards in the deck (in place)
  842. X * 
  843. X * while there are unshuffled cards,
  844. X *   select a random unshuffled card
  845. X *   remove it from the unshuffled and put it in the shuffled part
  846. X */
  847. X
  848. Xshuffle()
  849. X{
  850. X    int i;
  851. X
  852. X     /* put the cards in the deck unshuffled */
  853. X
  854. X    for(i=0; i<52; i++) {
  855. X        deck[i] = i;
  856. X    }
  857. X
  858. X     /* shuffle them */
  859. X
  860. X    for(i=51; i>=1; --i) {
  861. X        int x, temp;
  862. X
  863. X         /* pick a card, any card */
  864. X
  865. X        x = drand48()*(i+1);
  866. X
  867. X         /* remove it from the unshuffled deck and put it */
  868. X         /* into the shuffled deck by */
  869. X         /* swapping card i with card x */
  870. X
  871. X        temp = deck[i];
  872. X        deck[i] = deck[x];
  873. X        deck[x] = temp;
  874. X    }
  875. X}
  876. X
  877. X/*
  878. X * deal the cards and show the initial card setup
  879. X */
  880. X
  881. Xsetup()
  882. X{
  883. X    int i, j;
  884. X
  885. X    int x_pos, y_pos;
  886. X
  887. X    indeck = 52;    /* cards still in the deck */
  888. X    over = 0;    /* cards turned over */
  889. X
  890. X     /* initialize the columns of the tableau */
  891. X
  892. X    for(i = 0; i < 7; i++) {
  893. X        for(j = 0; j < 7; j++) {
  894. X            down[i][j] = -1;
  895. X        }
  896. X        for(j = 0; j < 13; j++) {
  897. X            up[i][j] = -1;
  898. X        }
  899. X    }
  900. X
  901. X     /* there are no outcards initially */
  902. X
  903. X    for(i = 0; i < 4; i++) {
  904. X        outcard[i] = 0;
  905. X    }
  906. X
  907. X     /* deal the cards */
  908. X
  909. X    for(i = 0; i < 7; i++) {
  910. X
  911. X        numdown[i] = i;
  912. X        numup[i] = 1;
  913. X
  914. X         /* deal up card */
  915. X
  916. X        indeck -= 1;
  917. X
  918. X        up[i][0] = deck[indeck];
  919. X        deck[indeck] = -1;
  920. X
  921. X         /* display up card */
  922. X
  923. X        x_pos = LEFT+((CARD_W+ROW_SEP)*i);
  924. X        y_pos = TOP + CARD_H + SUIT_SEP + (BACK_SEP*numdown[i]);
  925. X
  926. X        wrastop(wn, images[up[i][0]], 10, (unsigned short *)0, 0,
  927. X                0, 0, x_pos, y_pos,
  928. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  929. X                (unsigned short *)0);
  930. X
  931. X         /* deal down cards */
  932. X
  933. X        for(j = i + 1; j < 7; j++) {
  934. X
  935. X            indeck -= 1;
  936. X
  937. X            down[j][i] = deck[indeck];
  938. X            deck[indeck] = -1;
  939. X
  940. X             /* display back of card */
  941. X
  942. X            x_pos = LEFT+((CARD_W+ROW_SEP)*j);
  943. X            y_pos = TOP + CARD_H + SUIT_SEP + (BACK_SEP*i);
  944. X
  945. X            wrastop(wn, back[0], 10, (unsigned short *)0, 0,
  946. X                0, 0, x_pos, y_pos,
  947. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  948. X                (unsigned short *)0);
  949. X        }
  950. X        
  951. X
  952. X    }
  953. X
  954. X     /* turn over the remainder of the deck */
  955. X
  956. X    wrastop(wn, back[0], 10, (unsigned short *)0, 0, 0, 0,
  957. X        DECK, TOP + (CARD_H/2) + CARD_H + FACE_SEP,
  958. X        CARD_W, CARD_H, SRCSRC, DSTSRC, (unsigned short *)0);
  959. X
  960. X     /* there are no cards showing yet */
  961. X
  962. X    wrastop(wn, blank[0], 10, (unsigned short *)0, 0, 0, 0, 
  963. X        DECK, TOP + (CARD_H/2),
  964. X        CARD_W, CARD_H, SRCSRC, DSTSRC, (unsigned short *)0);
  965. X
  966. X     /* blanks showing where to play the cards */
  967. X
  968. X    for(i=0; i<7; i+=2) {
  969. X        wrastop(wn, blank[0], 10, (unsigned short *)0, 0, 0, 0,
  970. X            LEFT+((CARD_W+ROW_SEP)*i), TOP,
  971. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  972. X            (unsigned short *)0);
  973. X    }
  974. X
  975. X     /* accept input from the mouse */
  976. X
  977. X    resetmouse(0, 0, MSDOWN);
  978. X
  979. X    dragging = 0;
  980. X    wcmd(wn, " ");
  981. X
  982. X#ifdef SCORES
  983. X        /* Scoring code added by vch */
  984. X    if ( vegas_style ) {
  985. X        score_tot += score_now;
  986. X        show_score();
  987. X    }
  988. X#endif
  989. X}
  990. X
  991. X/*
  992. X * when one of the mouse buttons is pushed
  993. X */
  994. X
  995. Xdomouse()
  996. X{
  997. X    int x, y, buttons, reason;
  998. X#ifdef BADMOUSE
  999. X    static old_buttons = 0;
  1000. X#endif
  1001. X
  1002. X     /* read the mouse info */
  1003. X
  1004. X    wreadmouse(wn, &x, &y, &buttons, &reason);
  1005. X
  1006. X     /* only interested in button pushes, not releases */
  1007. X
  1008. X#ifdef BADMOUSE
  1009. X    if((~old_buttons & buttons) || (reason & MSDOWN)) {/* } vch */
  1010. X#else
  1011. X    if(reason & MSDOWN) {
  1012. X#endif
  1013. X        if(buttons & MBUTL) {    /* left button down */
  1014. X
  1015. X             /* if not dragging a card, start */
  1016. X
  1017. X            if(!dragging) {
  1018. X              /* what stack of cards did the player select */
  1019. X
  1020. X                src_stack = stack(x, y);
  1021. X
  1022. X                 /* was a visible card selected? */
  1023. X
  1024. X                if(src_stack >= 0){
  1025. X                     /* start dragging the card */
  1026. X
  1027. X                    dragging = 1;
  1028. X                    get_drag_region(src_stack);
  1029. X                    start_dragging(x,y);
  1030. X                    resetmouse(x, y, MSDOWN|MSOUT);
  1031. X                } else {
  1032. X                 /* maybe we should show the next card? */
  1033. X
  1034. X                    if(src_stack == -1) {
  1035. X                        turn_deck();
  1036. X                    } else {
  1037. X                        beep();
  1038. X                    }
  1039. X                    resetmouse(0, 0, MSDOWN);
  1040. X                }
  1041. X            } else {
  1042. X                 /* player has made a move */
  1043. X                 /* stop dragging card */
  1044. X                dragging = 0;
  1045. X                stop_dragging();
  1046. X                if(place(x, y) < 0) {
  1047. X                    put_drag_region(src_stack);
  1048. X                    beep();
  1049. X                }
  1050. X                
  1051. X#ifdef CHEAT
  1052. X                resetmouse(0, 0, MSDOWN | 0100);
  1053. X#else
  1054. X                resetmouse(0, 0, MSDOWN);
  1055. X#endif
  1056. X            }
  1057. X        } else if(buttons & MBUTM) {    /* middle button down */
  1058. X             /* unselect the selected card */
  1059. X
  1060. X            if(dragging) {
  1061. X                dragging = 0;
  1062. X                stop_dragging();
  1063. X                put_drag_region(src_stack);
  1064. X#ifdef CHEAT
  1065. X                resetmouse(0, 0, MSDOWN | 0100 );
  1066. X#else
  1067. X                resetmouse(0, 0, MSDOWN);
  1068. X#endif
  1069. X            }
  1070. X
  1071. X        } else if(buttons & MBUTR) {    /* right button down */
  1072. X
  1073. X            if(!dragging) {
  1074. X             /* what stack of cards did the player select */
  1075. X
  1076. X                src_stack = stack(x, y);
  1077. X
  1078. X                 /* was a card selected that can be moved */
  1079. X                 /* to the outstack? */
  1080. X
  1081. X                if((src_stack >= 0) &&
  1082. X                    (match(src_stack, 8))) {
  1083. X                    playcard(src_stack);
  1084. X                } else {
  1085. X                    beep();
  1086. X                }
  1087. X#ifdef CHEAT
  1088. X                resetmouse(0, 0, MSDOWN|MSOUT|0100);
  1089. X            } else {
  1090. X                beep();
  1091. X                resetmouse(x, y, MSDOWN|MSOUT|0100);
  1092. X            }
  1093. X            clear_clue();
  1094. X#else
  1095. X                resetmouse(0, 0, MSDOWN|MSOUT);
  1096. X            } else {
  1097. X                beep();
  1098. X                resetmouse(x, y, MSDOWN|MSOUT);
  1099. X            }
  1100. X#endif
  1101. X        }
  1102. X    }
  1103. X
  1104. X     /* or if the the mouse moved */
  1105. X
  1106. X    else if(reason & MSOUT) {
  1107. X
  1108. X        if(dragging) {
  1109. X             /* drag card with mouse pointer */
  1110. X
  1111. X            keep_dragging(x,y);
  1112. X            resetmouse(x, y, MSDOWN|MSOUT);
  1113. X        }
  1114. X    }
  1115. X
  1116. X#ifdef BADMOUSE
  1117. X    old_buttons = buttons;
  1118. X#endif
  1119. X}
  1120. X
  1121. X/*
  1122. X * what stack of cards was selected
  1123. X * -2 is error
  1124. X * -1 is unturned deck
  1125. X * 0 is the visible deck
  1126. X * 1-7 is a column
  1127. X */
  1128. X
  1129. Xint
  1130. Xstack(x, y)
  1131. Xint x, y;
  1132. X{
  1133. X     /* is it the unturned deck? */
  1134. X
  1135. X    if((x > DECK) && (x < (DECK + CARD_W)) &&
  1136. X       (y > TOP + (CARD_H/2) + CARD_H + FACE_SEP) &&
  1137. X       (y < TOP + (CARD_H/2) + CARD_H + CARD_H + FACE_SEP)) {
  1138. X        return(-1);
  1139. X
  1140. X     /* maybe the visible deck? */
  1141. X
  1142. X    } else if((x > DECK) && (x < (DECK + CARD_W)) &&
  1143. X             (y > TOP + (CARD_H/2)) && (y < TOP + (CARD_H/2) + CARD_H)) {
  1144. X
  1145. X         /* if no cards from the deck are showing then its an error */
  1146. X
  1147. X        if(over > 0) {
  1148. X            ucard = deck[indeck-over];
  1149. X            return(0);
  1150. X        } else {
  1151. X            return(-2);
  1152. X        }
  1153. X
  1154. X     /* perhaps a column of the tableau? */
  1155. X
  1156. X    } else if((x > LEFT) && (y > TOP+CARD_H+SUIT_SEP)) {
  1157. X        int i;
  1158. X         /* which column of cards? */
  1159. X
  1160. X        x -= LEFT;
  1161. X        i = (x / (CARD_W+ROW_SEP)) + 1;
  1162. X        x =       x % (CARD_W+ROW_SEP);
  1163. X        if((x > CARD_W) || (i > 7) || (numup[i-1]==0)) {
  1164. X            return(-2);
  1165. X        } else {
  1166. X            ucard = up[i-1][numup[i-1]-1];
  1167. X            return(i);
  1168. X        }
  1169. X    }
  1170. X
  1171. X     /* oops, it's none of the above */
  1172. X      
  1173. X    return(-2);
  1174. X}
  1175. X
  1176. X/*
  1177. X * get the cards from the selected column
  1178. X */
  1179. X
  1180. Xget_drag_region(col)
  1181. Xint col;
  1182. X{
  1183. X     /* a card from the stock */
  1184. X
  1185. X    if(col == 0) {
  1186. X
  1187. X         /* size of the drag region */
  1188. X
  1189. X        h_cards = CARD_H;
  1190. X        w_cards = CARD_W;
  1191. X
  1192. X         /* grab the card */
  1193. X
  1194. X        wrastop(wn, (unsigned short *)0, 0, cards[0], 10,
  1195. X            DECK, TOP + (CARD_H/2), 0, 0,
  1196. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1197. X            (unsigned short *)0);
  1198. X
  1199. X         /* show the card below it, if there is one */
  1200. X
  1201. X        if(over > 1) {
  1202. X            wrastop(wn, images[deck[indeck-(over-1)]], 10,
  1203. X                (unsigned short *)0, 0,
  1204. X                0, 0, DECK, TOP + (CARD_H/2),
  1205. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  1206. X                (unsigned short *)0);
  1207. X        }
  1208. X        else {
  1209. X            wrastop(wn, blank[0], 10, (unsigned short *)0,
  1210. X                0, 0, 0, DECK, TOP + (CARD_H/2),
  1211. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  1212. X                (unsigned short *)0);
  1213. X
  1214. X        }
  1215. X    }
  1216. X
  1217. X     /* or from one of the columns */
  1218. X
  1219. X    else {
  1220. X
  1221. X         /* the column arrays all begin at 0, not 1 */
  1222. X
  1223. X        col -= 1;
  1224. X
  1225. X         /* size of the drag region */
  1226. X
  1227. X        h_cards = CARD_H + (numup[col]-1)*FACE_SEP;
  1228. X        w_cards = CARD_W;
  1229. X
  1230. X         /* grab the up cards in this column */
  1231. X
  1232. X        wrastop(wn, (unsigned short *)0, 0, cards[0], 10,
  1233. X            LEFT + ((CARD_W + ROW_SEP)*col),
  1234. X            TOP + CARD_H + SUIT_SEP + (BACK_SEP*numdown[col]),
  1235. X            0, 0, w_cards, h_cards,
  1236. X            SRCSRC, DSTSRC, (unsigned short *)0);
  1237. X
  1238. X         /* black out where the cards where */
  1239. X
  1240. X        wrastop(wn, (unsigned short *)0, 0,
  1241. X            (unsigned short *)0, 0,
  1242. X            0, 0, LEFT + ((CARD_W + ROW_SEP)*col),
  1243. X            TOP + CARD_H + SUIT_SEP + (BACK_SEP*numdown[col]),
  1244. X            w_cards, h_cards,
  1245. X            SRCPAT, DSTSRC, patblack);
  1246. X
  1247. X         /* redraw the top down card, if there is one */
  1248. X
  1249. X        if(numdown[col] > 0) {
  1250. X            wrastop(wn, back[0], 10, (unsigned short *)0, 0,
  1251. X                0, 0, LEFT + ((CARD_W + ROW_SEP)*col),
  1252. X                TOP + CARD_H + SUIT_SEP +
  1253. X                    (BACK_SEP*(numdown[col] - 1)),
  1254. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  1255. X                (unsigned short *)0);
  1256. X        }
  1257. X    }
  1258. X
  1259. X}
  1260. X
  1261. X/*
  1262. X * put the selected cards back where they came from
  1263. X */
  1264. X
  1265. Xput_drag_region(col)
  1266. Xint col;
  1267. X{
  1268. X     /* a card from the stock */
  1269. X
  1270. X    if(col == 0) {
  1271. X        wrastop(wn, cards[0], 10, (unsigned short *)0, 0, 0, 0,
  1272. X            DECK, TOP + (CARD_H/2),
  1273. X            w_cards, h_cards, SRCSRC, DSTSRC,
  1274. X            (unsigned short *)0);
  1275. X    }
  1276. X
  1277. X     /* or from one of the columns */
  1278. X
  1279. X    else {
  1280. X
  1281. X         /* the column arrays all begin at 0, not 1 */
  1282. X
  1283. X        col -= 1;
  1284. X
  1285. X         /* put back the up cards in this column */
  1286. X
  1287. X        wrastop(wn, cards[0], 10, (unsigned short *)0, 0, 0, 0,
  1288. X            LEFT + ((CARD_W + ROW_SEP)*col),
  1289. X            TOP + CARD_H + SUIT_SEP + (BACK_SEP*numdown[col]),
  1290. X            w_cards, h_cards, SRCSRC, DSTSRC,
  1291. X            (unsigned short *)0);
  1292. X    }
  1293. X}
  1294. X
  1295. X/*
  1296. X * turn up the next cards from the stock
  1297. X */
  1298. X
  1299. Xturn_deck()
  1300. X{
  1301. X    int turn = (vegas_style ? 1 : 3);
  1302. X
  1303. X#ifdef CHEAT
  1304. X    extern int any_moves();
  1305. X
  1306. X        /* Check if user has over looked a move.
  1307. X         * Checking code added by vch. */
  1308. X    if ( first_pass && cheat && any_moves() ) {
  1309. X        beep();
  1310. X        first_pass = 0;
  1311. X        return;
  1312. X    }
  1313. X    first_pass = 1;
  1314. X#endif
  1315. X     /* are there any more to turn over? */
  1316. X
  1317. X#ifdef UNDO
  1318. X    add_undo();
  1319. X#endif
  1320. X    if((indeck == 0) || (vegas_style && (over == indeck))) {
  1321. X#ifdef UNDO
  1322. X        rec_num--;
  1323. X#endif
  1324. X        beep();
  1325. X
  1326. X     /* are all cards showing? hide them all */
  1327. X
  1328. X    } else if(!vegas_style && (over == indeck)) {
  1329. X         /* hide all of the cards */
  1330. X
  1331. X        over = 0;
  1332. X        wrastop(wn, blank[0], 10, (unsigned short *)0, 0, 0, 0,
  1333. X            DECK, TOP + (CARD_H/2),
  1334. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1335. X            (unsigned short *)0);
  1336. X        wrastop(wn, back[0], 10, (unsigned short *)0, 0, 0, 0,
  1337. X            DECK, TOP + (CARD_H/2) + CARD_H + FACE_SEP,
  1338. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1339. X            (unsigned short *)0);
  1340. X
  1341. X     /* fewer than three showing, turn them all up */
  1342. X
  1343. X    } else if(over + turn >= indeck) {
  1344. X        over = indeck;
  1345. X        wrastop(wn, images[deck[0]], 10,
  1346. X            (unsigned short *)0, 0, 0, 0,
  1347. X            DECK, TOP + (CARD_H/2),
  1348. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1349. X            (unsigned short *)0);
  1350. X        wrastop(wn, blank[0], 10, (unsigned short *)0, 0, 0, 0,
  1351. X            DECK, TOP + (CARD_H/2) + CARD_H + FACE_SEP,
  1352. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1353. X            (unsigned short *)0);
  1354. X
  1355. X     /* turn up the next cards */
  1356. X
  1357. X    } else {
  1358. X        over += turn;
  1359. X        wrastop(wn, images[deck[indeck-over]], 10,
  1360. X            (unsigned short *)0, 0, 0, 0,
  1361. X            DECK, TOP + (CARD_H/2),
  1362. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1363. X            (unsigned short *)0);
  1364. X        wrastop(wn, back[0], 10, (unsigned short *)0, 0, 0, 0,
  1365. X            DECK,TOP + (CARD_H/2) + CARD_H + FACE_SEP,
  1366. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1367. X            (unsigned short *)0);
  1368. X    }
  1369. X}
  1370. X
  1371. X/*
  1372. X * determine destination column, and move the cards there
  1373. X * if the cards do not match, return -1
  1374. X */
  1375. X
  1376. Xplace(x,y)
  1377. Xint x, y;
  1378. X{
  1379. X    int dst_column;
  1380. X
  1381. X    if((x > LEFT) && (y > TOP+CARD_H+SUIT_SEP)) {
  1382. X         /* which column of cards? */
  1383. X
  1384. X        x -= LEFT;
  1385. X        dst_column = (x / (CARD_W+ROW_SEP)) + 1;
  1386. X        x =      x % (CARD_W+ROW_SEP);
  1387. X
  1388. X         /* is it a legal column, and do the cards match */
  1389. X
  1390. X        if(((x < CARD_W)&&(dst_column <= 7))&&
  1391. X                (match(src_stack, dst_column))) {
  1392. X             /* yes, move them */
  1393. X
  1394. X            movecard(src_stack, dst_column);
  1395. X
  1396. X            return(0);
  1397. X        } else {
  1398. X            return(-1);
  1399. X        }
  1400. X    } else {
  1401. X        return(-1);
  1402. X    }    
  1403. X}
  1404. X
  1405. X/*
  1406. X * does the card on the bottom of column x match that on top of column y
  1407. X * 0 is the deck
  1408. X * 8 is the outcard stack
  1409. X */
  1410. X
  1411. Xmatch(x,y)
  1412. Xint x,y;
  1413. X{
  1414. X    int color1, color2;
  1415. X    int value1, value2;
  1416. X    int suit1,  suit2;
  1417. X    int card1;
  1418. X
  1419. X    int ok;
  1420. X
  1421. X     /* what is the bottom card of the selected stack */
  1422. X     /* 0 <= x <= 7 --- cannot be from the outcard stack */
  1423. X     /* 1 <= y <= 8 --- cannot be put on the deck */
  1424. X    
  1425. X    if(x == 0) {
  1426. X        card1  = deck[indeck-over];
  1427. X    } else if(y == 8) {
  1428. X        card1 = up[x-1][numup[x-1]-1];
  1429. X    } else {
  1430. X        card1  = up[x-1][0];
  1431. X    }
  1432. X    color1 = COLOR(card1);
  1433. X    value1 = VALUE(card1);
  1434. X    suit1  =  SUIT(card1);
  1435. X
  1436. X     /* what is the top card of the destination stack */
  1437. X
  1438. X    if(y == 8) {
  1439. X         /* move to the output stack */
  1440. X
  1441. X        color2 = color1;
  1442. X        suit2  = suit1;
  1443. X        value2 = outcard[suit2];
  1444. X
  1445. X         /* outcard must be 1 less than played card */
  1446. X
  1447. X        ok = (value1 == (value2+1))?1:0;
  1448. X    } else {
  1449. X         /* move to one of the columns */
  1450. X
  1451. X        if(numup[y-1] > 0) {
  1452. X            color2 = COLOR(up[y-1][numup[y-1]-1]);
  1453. X            value2 = VALUE(up[y-1][numup[y-1]-1]);
  1454. X            suit2  =  SUIT(up[y-1][numup[y-1]-1]);
  1455. X
  1456. X         /*they must be different colors and must differ by one*/
  1457. X
  1458. X            ok = ((color1 != color2) && ((value1 + 1) == value2)) ? 1 : 0;
  1459. X        } else {
  1460. X             /* the column is empty */
  1461. X             /* new card must be a king */
  1462. X
  1463. X            ok = (value1 == 13) ? 1 : 0;
  1464. X        }
  1465. X    }
  1466. X#ifdef UNDO
  1467. X     if ( ok ) add_undo();
  1468. X#endif
  1469. X    return(ok);
  1470. X}
  1471. X
  1472. X/*
  1473. X * move cards from column x to column y
  1474. X */
  1475. X
  1476. X
  1477. Xmovecard(x, y)
  1478. Xint  x, y;
  1479. X{
  1480. X    y -= 1;
  1481. X
  1482. X     /* place the card images in the proper column */
  1483. X
  1484. X    wrastop(wn, cards[0], 10, (unsigned short *)0, 0, 0, 0,
  1485. X        LEFT+((CARD_W+ROW_SEP)*y),
  1486. X        TOP + CARD_H + SUIT_SEP + (BACK_SEP*numdown[y])
  1487. X                + (FACE_SEP*numup[y]),
  1488. X        w_cards, h_cards, SRCSRC, DSTSRC, (unsigned short *)0);
  1489. X
  1490. X     /* card came from the stock */
  1491. X
  1492. X    if(x == 0) {
  1493. X        int i;
  1494. X
  1495. X         /* add to column */
  1496. X
  1497. X        up[y][numup[y]] = deck[indeck-over];
  1498. X        numup[y] += 1;
  1499. X
  1500. X         /* remove card from deck */
  1501. X
  1502. X        for(i = indeck - over; i < indeck - 1; i++) {
  1503. X            deck[i] = deck[i+1];
  1504. X        }
  1505. X        deck[indeck] = -1;
  1506. X        indeck -= 1;
  1507. X        over -= 1;
  1508. X
  1509. X     /* cards came from a column of the tableau */
  1510. X
  1511. X    } else {
  1512. X        int i;
  1513. X
  1514. X         /* move all up cards from x to y */
  1515. X
  1516. X        x -= 1;
  1517. X
  1518. X        for(i=0; i<numup[x]; i++) {
  1519. X            up[y][numup[y]] = up[x][i];
  1520. X            up[x][i] = -1;
  1521. X            numup[y] += 1;
  1522. X        }
  1523. X        numup[x] = 0;
  1524. X        update_column(x);
  1525. X    }
  1526. X#ifdef CHEAT
  1527. X    clear_clue();
  1528. X#endif
  1529. X}
  1530. X
  1531. X/*
  1532. X * move card from column x to outcard area
  1533. X */
  1534. X
  1535. Xplaycard(x)
  1536. Xint x;
  1537. X{
  1538. X    int card, value, suit;
  1539. X    int i;
  1540. X
  1541. X     /* card is from the stock */
  1542. X
  1543. X    if(x == 0) {
  1544. X        card  = deck[indeck-over];
  1545. X
  1546. X     /* card is from the tableau */
  1547. X
  1548. X    } else {
  1549. X        card  = up[x-1][numup[x-1]-1];
  1550. X    }
  1551. X    value = VALUE(card);
  1552. X    suit  =  SUIT(card);
  1553. X
  1554. X
  1555. X     /* place outcard */
  1556. X
  1557. X    outcard[suit] = value;
  1558. X    wrastop(wn, images[card], 10, (unsigned short *)0, 0, 0, 0,
  1559. X        LEFT+((CARD_W+ROW_SEP)*suit*2),
  1560. X        TOP, CARD_W, CARD_H, SRCSRC, DSTSRC, (unsigned short *)0);
  1561. X
  1562. X     /* remove card from stock */
  1563. X
  1564. X    if(x == 0) {
  1565. X        for(i=indeck-over; i<indeck-1; i++) {
  1566. X            deck[i] = deck[i+1];
  1567. X        }
  1568. X        deck[indeck] = -1;
  1569. X        indeck -= 1;
  1570. X        over -= 1;
  1571. X    
  1572. X         /* show next card in the stock */
  1573. X
  1574. X        if(over > 0) {
  1575. X            wrastop(wn, images[deck[indeck-over]], 10,
  1576. X                (unsigned short *)0, 0, 0, 0,
  1577. X                DECK, TOP + (CARD_H/2),
  1578. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  1579. X                (unsigned short *)0);
  1580. X        } else {
  1581. X            wrastop(wn, blank[0], 10,
  1582. X                (unsigned short *)0, 0, 0, 0,
  1583. X                DECK, TOP + (CARD_H/2),
  1584. X                CARD_W, CARD_H, SRCSRC, DSTSRC,
  1585. X                (unsigned short *)0);
  1586. X        }
  1587. X
  1588. X     /* remove card from playing area */
  1589. X
  1590. X    } else {
  1591. X        up[x-1][numup[x-1]-1] = -1;
  1592. X        numup[x-1] -= 1;
  1593. X        update_column(x-1);
  1594. X    }
  1595. X
  1596. X     /* if there are no cards left, player wins */
  1597. X    
  1598. X    card = indeck;
  1599. X    for(i = 0; i <= 6; i += 1) {
  1600. X        card += numup[i];
  1601. X    }
  1602. X
  1603. X    if(card == 0) {
  1604. X        if(vegas_style == 1) 
  1605. X       wcmd(wn, "You broke the bank!  Bet you can't do it again?");
  1606. X        else
  1607. X       wcmd(wn, "You win this hand!  Think you can do it again?");
  1608. X    }
  1609. X
  1610. X#ifdef SCORES
  1611. X    if (vegas_style) show_score();
  1612. X#endif
  1613. X}
  1614. X
  1615. X/*
  1616. X * turn over the next card, if there is one
  1617. X * and redraw the column
  1618. X */
  1619. X
  1620. Xupdate_column(col)
  1621. Xint col;
  1622. X{
  1623. X
  1624. X /* remove the top face up card, we may be moving it to the foundation */
  1625. X
  1626. X    wrastop(wn, (unsigned short *)0, 0,
  1627. X        (unsigned short *)0, 0, 0, 0,
  1628. X        LEFT+((CARD_W+ROW_SEP)*col),
  1629. X        TOP + CARD_H + SUIT_SEP + (BACK_SEP*numdown[col]) +
  1630. X            (FACE_SEP*numup[col]),
  1631. X        CARD_W, CARD_H, SRCPAT, DSTSRC, patblack);
  1632. X
  1633. X     /* do we need to turn one over */
  1634. X
  1635. X    if((numup[col]==0)&&(numdown[col]>0)) {
  1636. X         /* turn over another card */
  1637. X
  1638. X        up[col][0] = down[col][numdown[col]-1];
  1639. X        numup[col] = 1;
  1640. X        down[col][numdown[col]-1] = -1;
  1641. X        numdown[col] -= 1;
  1642. X    }
  1643. X
  1644. X     /* redraw the column */
  1645. X
  1646. X    if(numup[col] > 0) {
  1647. X        wrastop(wn, images[up[col][numup[col]-1]], 10,
  1648. X            (unsigned short *)0, 0, 0, 0,
  1649. X            LEFT+((CARD_W+ROW_SEP)*col),
  1650. X            TOP + CARD_H + SUIT_SEP + (BACK_SEP*numdown[col])
  1651. X                + (FACE_SEP*(numup[col]-1)),
  1652. X            CARD_W, CARD_H, SRCSRC, DSTSRC,
  1653. X            (unsigned short *)0);
  1654. X    }
  1655. X}
  1656. X
  1657. X/*
  1658. X * reset the mouse report flags
  1659. X */
  1660. X
  1661. Xresetmouse(x, y, flags)
  1662. Xint x, y;    /* current mouse position */
  1663. Xint flags;
  1664. X{
  1665. X    struct umdata um;
  1666. X#ifdef CHEAT
  1667. X            /* 0100 flag added to provide selective cheating */
  1668. X            /* Reset the flag to check for more moves */
  1669. X     if ( flags & 0100 ) first_pass = 1;
  1670. X    um.um_flags = flags & ~0100;
  1671. X#else
  1672. X    um.um_flags = flags;
  1673. X#endif
  1674. X    um.um_x = x;
  1675. X    um.um_y = y;
  1676. X    um.um_w = 1;
  1677. X    um.um_h = 1;
  1678. X    wsetmouse (wn, &um);
  1679. X}
  1680. END_OF_klondike.c
  1681. if test 21642 -ne `wc -c <klondike.c`; then
  1682.     echo shar: \"klondike.c\" unpacked with wrong size!
  1683. fi
  1684. # end of overwriting check
  1685. fi
  1686. if test -f other.c -a "${1}" != "-c" ; then 
  1687.   echo shar: Will not over-write existing file \"other.c\"
  1688. else
  1689. echo shar: Extracting \"other.c\" \(7015 characters\)
  1690. sed "s/^X//" >other.c <<'END_OF_other.c'
  1691. X/*
  1692. X *    Copyright 1990, Thomas E. Tkacik
  1693. X *            tkacik@kyzyl.mi.org
  1694. X *
  1695. X *    Acknowledgments to Kent Quander allowing me to
  1696. X *     use and distribute his wonderfully drawn playing cards.
  1697. X *
  1698. X *    Permission is given to copy and distribute for non-profit purposes.
  1699. X *
  1700. X */
  1701. X
  1702. X/*
  1703. XObject Name: joker
  1704. X  Pels Wide: 71
  1705. X  Pels High: 65
  1706. X       Srcx: 416
  1707. X       Srcy: 92
  1708. X*/
  1709. X
  1710. Xunsigned short joker[65][5] ={
  1711. X    {0x0,0x0,0x0,0x0,0x0},
  1712. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1713. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1714. X    {0xfe7e,0xffff,0xffff,0xffff,0x3f},
  1715. X    {0xfe7e,0xffff,0xffff,0xffff,0x3f},
  1716. X    {0xfe7e,0xffff,0xffff,0xffff,0x3f},
  1717. X    {0x1e4e,0x0,0x0,0xfc00,0x3f},
  1718. X    {0xde4e,0xffff,0xffff,0xfdff,0x3f},
  1719. X    {0xdf1e,0xc1ff,0xfff,0xfde0,0x3f},
  1720. X    {0xdffe,0xd581,0x57c0,0xfdd5,0x3f},
  1721. X    {0xdf1e,0x491c,0x2b9c,0xfda8,0x3f},
  1722. X    {0xde4e,0x553e,0xd5be,0xfd57,0x3f},
  1723. X    {0xde4e,0x2a36,0xc9b6,0xfd27,0x3f},
  1724. X    {0xde4e,0x1479,0x15cf,0xfd50,0x3f},
  1725. X    {0xdf1e,0xaaff,0xa9ff,0xfd2a,0x3f},
  1726. X    {0xdffe,0x3f,0x95fe,0xfd52,0x3f},
  1727. X    {0xde4e,0x7f0f,0xa9f8,0xfd2a,0x3f},
  1728. X    {0xde4e,0x4967,0x95f3,0xfd52,0x3f},
  1729. X    {0xdf0e,0x7773,0xabe7,0xfdaa,0x3f},
  1730. X    {0xde4e,0x6f7f,0x97ff,0xfdd2,0x3f},
  1731. X    {0xde4e,0x677f,0x8fff,0xfde2,0x3f},
  1732. X    {0xdffe,0x5d7f,0xbfff,0xfdfa,0x3f},
  1733. X    {0xde0e,0x6377,0xb87f,0xfdfa,0x3f},
  1734. X    {0xdfce,0xbee3,0xbb7f,0xfdfa,0x3f},
  1735. X    {0xdf0e,0xc1c1,0xa007,0xfdfa,0x3f},
  1736. X    {0xdfce,0xff80,0xaff7,0xfdfa,0x3f},
  1737. X    {0xde0e,0xfb94,0x2ff7,0xfdd9,0x3f},
  1738. X    {0xdffe,0xf1f7,0xa037,0xfd67,0x3f},
  1739. X    {0xde0e,0xe4e3,0x7b00,0xfdaf,0x3f},
  1740. X    {0xde4e,0xca7f,0x7bfe,0xfdde,0x3f},
  1741. X    {0xdf0e,0xe4ff,0xbbfe,0xfdbd,0x3f},
  1742. X    {0xde4e,0xf1ff,0xf806,0xfdb9,0x3f},
  1743. X    {0xde4e,0xfbb1,0xffb6,0x3dc6,0x39},
  1744. X    {0xdffe,0xfce,0x88b0,0x3dff,0x39},
  1745. X    {0xdffe,0xeede,0xa2bf,0x7dff,0x38},
  1746. X    {0xdffe,0xef3c,0x94bf,0x3de3,0x39},
  1747. X    {0x5ffe,0x6f7b,0xc980,0x3de3,0x38},
  1748. X    {0xdffe,0x2f3,0xe3f6,0xfd94,0x3f},
  1749. X    {0xdffe,0xfa4d,0x77f7,0x3d00,0x38},
  1750. X    {0xdffe,0xfaaf,0xfff7,0xfd94,0x39},
  1751. X    {0xdffe,0x2af,0xc1f0,0x7df7,0x38},
  1752. X    {0xdffe,0x6eaf,0xbeff,0xfde3,0x39},
  1753. X    {0xdffe,0xeaf,0x637f,0x3dff,0x38},
  1754. X    {0xdffe,0xfeaf,0x5d7f,0xfdff,0x3f},
  1755. X    {0xdffe,0xf8a3,0x737f,0x3dff,0x39},
  1756. X    {0xdffe,0xf4a5,0x7b7f,0x3dff,0x39},
  1757. X    {0xdffe,0xeaaa,0x7773,0x7de7,0x38},
  1758. X    {0x5ffe,0xd4a5,0x4967,0x3df3,0x39},
  1759. X    {0x5ffe,0xcaaa,0x7f0f,0x3df8,0x39},
  1760. X    {0x5ffe,0xd4a5,0x3f,0xfdfe,0x3f},
  1761. X    {0x5ffe,0xcaaa,0xaaff,0x7dff,0x3c},
  1762. X    {0x5ffe,0xd405,0x1479,0x3dcf,0x39},
  1763. X    {0x5ffe,0xc9f2,0x2a36,0x3db6,0x39},
  1764. X    {0x5ffe,0xd5f5,0x553e,0x3dbe,0x39},
  1765. X    {0xdffe,0xea0a,0x491e,0x7dbc,0x3c},
  1766. X    {0xdffe,0xf555,0xd581,0xfdc0,0x3f},
  1767. X    {0xdffe,0xf803,0xc1ff,0x7dff,0x3c},
  1768. X    {0xdffe,0xffff,0xffff,0x3dff,0x39},
  1769. X    {0x1ffe,0x0,0x0,0x3c00,0x39},
  1770. X    {0xfffe,0xffff,0xffff,0x3fff,0x3f},
  1771. X    {0xfffe,0xffff,0xffff,0x3fff,0x3f},
  1772. X    {0xfffe,0xffff,0xffff,0x3fff,0x3f},
  1773. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1774. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1775. X    {0x0,0x0,0x0,0x0,0x0}
  1776. X};
  1777. X/*
  1778. XObject Name: back
  1779. X  Pels Wide: 71
  1780. X  Pels High: 65
  1781. X       Srcx: 340
  1782. X       Srcy: 160
  1783. X*/
  1784. X
  1785. Xunsigned short back[65][5] ={
  1786. X    {0x0,0x0,0x0,0x0,0x0},
  1787. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1788. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1789. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1790. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1791. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1792. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1793. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1794. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1795. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1796. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1797. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1798. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1799. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1800. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1801. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1802. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1803. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1804. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1805. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1806. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1807. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1808. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1809. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1810. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1811. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1812. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1813. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1814. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1815. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1816. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1817. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1818. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1819. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1820. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1821. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1822. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1823. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1824. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1825. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1826. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1827. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1828. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1829. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1830. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1831. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1832. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1833. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1834. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1835. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1836. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1837. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1838. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1839. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1840. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1841. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1842. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1843. X    {0x637e,0x6363,0x6363,0x6363,0x3f},
  1844. X    {0x555e,0x5555,0x5555,0x5555,0x3d},
  1845. X    {0x363e,0x3636,0x3636,0x3636,0x3e},
  1846. X    {0x889e,0x8888,0x8888,0x8888,0x3c},
  1847. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1848. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1849. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1850. X    {0x0,0x0,0x0,0x0,0x0}
  1851. X};
  1852. X/*
  1853. XObject Name: blank
  1854. X  Pels Wide: 71
  1855. X  Pels High: 65
  1856. X       Srcx: 188
  1857. X       Srcy: 160
  1858. X*/
  1859. X
  1860. Xunsigned short blank[65][5] ={
  1861. X    {0x0,0x0,0x0,0x0,0x0},
  1862. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1863. X    {0x2,0x0,0x0,0x0,0x20},
  1864. X    {0x2,0x0,0x0,0x0,0x20},
  1865. X    {0x2,0x0,0x0,0x0,0x20},
  1866. X    {0x2,0x0,0x0,0x0,0x20},
  1867. X    {0x2,0x0,0x0,0x0,0x20},
  1868. X    {0x2,0x0,0x0,0x0,0x20},
  1869. X    {0x2,0x0,0x0,0x0,0x20},
  1870. X    {0x2,0x0,0x0,0x0,0x20},
  1871. X    {0x2,0x0,0x0,0x0,0x20},
  1872. X    {0x2,0x0,0x0,0x0,0x20},
  1873. X    {0x2,0x0,0x0,0x0,0x20},
  1874. X    {0x2,0x0,0x0,0x0,0x20},
  1875. X    {0x2,0x0,0x0,0x0,0x20},
  1876. X    {0x2,0x0,0x0,0x0,0x20},
  1877. X    {0x2,0x0,0x0,0x0,0x20},
  1878. X    {0x2,0x0,0x0,0x0,0x20},
  1879. X    {0x2,0x0,0x0,0x0,0x20},
  1880. X    {0x2,0x0,0x0,0x0,0x20},
  1881. X    {0x2,0x0,0x0,0x0,0x20},
  1882. X    {0x2,0x0,0x0,0x0,0x20},
  1883. X    {0x2,0x0,0x0,0x0,0x20},
  1884. X    {0x2,0x0,0x0,0x0,0x20},
  1885. X    {0x2,0x0,0x0,0x0,0x20},
  1886. X    {0x2,0x0,0x0,0x0,0x20},
  1887. X    {0x2,0x0,0x0,0x0,0x20},
  1888. X    {0x2,0x0,0x0,0x0,0x20},
  1889. X    {0x2,0x0,0x0,0x0,0x20},
  1890. X    {0x2,0x0,0x0,0x0,0x20},
  1891. X    {0x2,0x0,0x0,0x0,0x20},
  1892. X    {0x2,0x0,0x0,0x0,0x20},
  1893. X    {0x2,0x0,0x0,0x0,0x20},
  1894. X    {0x2,0x0,0x0,0x0,0x20},
  1895. X    {0x2,0x0,0x0,0x0,0x20},
  1896. X    {0x2,0x0,0x0,0x0,0x20},
  1897. X    {0x2,0x0,0x0,0x0,0x20},
  1898. X    {0x2,0x0,0x0,0x0,0x20},
  1899. X    {0x2,0x0,0x0,0x0,0x20},
  1900. X    {0x2,0x0,0x0,0x0,0x20},
  1901. X    {0x2,0x0,0x0,0x0,0x20},
  1902. X    {0x2,0x0,0x0,0x0,0x20},
  1903. X    {0x2,0x0,0x0,0x0,0x20},
  1904. X    {0x2,0x0,0x0,0x0,0x20},
  1905. X    {0x2,0x0,0x0,0x0,0x20},
  1906. X    {0x2,0x0,0x0,0x0,0x20},
  1907. X    {0x2,0x0,0x0,0x0,0x20},
  1908. X    {0x2,0x0,0x0,0x0,0x20},
  1909. X    {0x2,0x0,0x0,0x0,0x20},
  1910. X    {0x2,0x0,0x0,0x0,0x20},
  1911. X    {0x2,0x0,0x0,0x0,0x20},
  1912. X    {0x2,0x0,0x0,0x0,0x20},
  1913. X    {0x2,0x0,0x0,0x0,0x20},
  1914. X    {0x2,0x0,0x0,0x0,0x20},
  1915. X    {0x2,0x0,0x0,0x0,0x20},
  1916. X    {0x2,0x0,0x0,0x0,0x20},
  1917. X    {0x2,0x0,0x0,0x0,0x20},
  1918. X    {0x2,0x0,0x0,0x0,0x20},
  1919. X    {0x2,0x0,0x0,0x0,0x20},
  1920. X    {0x2,0x0,0x0,0x0,0x20},
  1921. X    {0x2,0x0,0x0,0x0,0x20},
  1922. X    {0x2,0x0,0x0,0x0,0x20},
  1923. X    {0x2,0x0,0x0,0x0,0x20},
  1924. X    {0xfffe,0xffff,0xffff,0xffff,0x3f},
  1925. X    {0x0,0x0,0x0,0x0,0x0}
  1926. X};
  1927. END_OF_other.c
  1928. if test 7015 -ne `wc -c <other.c`; then
  1929.     echo shar: \"other.c\" unpacked with wrong size!
  1930. fi
  1931. # end of overwriting check
  1932. fi
  1933. echo shar: End of archive 2 \(of 6\).
  1934. cp /dev/null ark2isdone
  1935. MISSING=""
  1936. for I in 1 2 3 4 5 6 ; do
  1937.     if test ! -f ark${I}isdone ; then
  1938.     MISSING="${MISSING} ${I}"
  1939.     fi
  1940. done
  1941. if test "${MISSING}" = "" ; then
  1942.     echo You have unpacked all 6 archives.
  1943.     rm -f ark[1-9]isdone
  1944. else
  1945.     echo You still need to unpack the following archives:
  1946.     echo "        " ${MISSING}
  1947. fi
  1948. ##  End of shell archive.
  1949. exit 0
  1950. -- 
  1951. David H. Brierley
  1952. Home: dave@galaxia.network23.com; Work: dhb@quahog.ssd.ray.com
  1953. Send comp.sources.3b1 submissions to comp-sources-3b1@galaxia.network23.com
  1954. %% Can I be excused, my brain is full. **
  1955.