home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!news.tek.com!master!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v15i046: gtetris3 - Generic Tetris for X11, V2.0.1, Patch1
- Message-ID: <4212@master.CNA.TEK.COM>
- Date: 15 Jan 93 23:29:02 GMT
- Sender: news@master.CNA.TEK.COM
- Lines: 993
- Approved: billr@saab.CNA.TEK.COM
- Xref: uunet comp.sources.games:1545
-
- Submitted-by: "Qiang Alex Zhao" <azhao@cs.arizona.edu>
- Posting-number: Volume 15, Issue 46
- Archive-name: gtetris3/Patch1
- Patch-To: gtetris3: Volume 15, Issue 44-45
- Environment: X11R4/5, Xlib
-
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: patches01
- # Wrapped by billr@saab on Fri Jan 15 15:24:23 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patches01' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patches01'\"
- else
- echo shar: Extracting \"'patches01'\" \(25665 characters\)
- sed "s/^X//" >'patches01' <<'END_OF_FILE'
- Xdiff -c tetris.2.0/README tetris.2.1/README
- X*** tetris.2.0/README Fri Jan 15 13:04:29 1993
- X--- tetris.2.1/README Fri Jan 15 15:59:59 1993
- X***************
- X*** 1,5
- X GENERIC TETRIS
- X! ============== Yet Another Tetris Game on X, V2.0.1
- X
- X
- X WHY ANOTHER?
- X
- X--- 1,5 -----
- X GENERIC TETRIS
- X! ============== Yet Another Tetris Game on X, V2.1.0
- X
- X
- X WHY ANOTHER?
- X***************
- X*** 81,86
- X
- X Since the days of V1.8, I have got many responses over the net.
- X Thanks go to people who helped me in improving the program.
- X
- X [Jan 12, 93] V2.0.1: added arrow keys. Changed error handling method
- X in locking score file, suggested by Hellmut Golde
- X
- X--- 81,93 -----
- X
- X Since the days of V1.8, I have got many responses over the net.
- X Thanks go to people who helped me in improving the program.
- X+
- X+ [Jan 15, 93] V2.1.0: Fixed a resource look-up bug found by Kiyotaka
- X+ Sakai <ksakai@mtl.t.u-tokyo.ac.jp>. Added "-u" option.
- X+ New feature: when a row is deleted, remaining blocks
- X+ remains rounded -- suggested by Elwood C. Downey
- X+ <ecdowney@hwking.cca.cr.rockwell.com> and Bill Leue
- X+ <leue@crd.ge.com>.
- X
- X [Jan 12, 93] V2.0.1: added arrow keys. Changed error handling method
- X in locking score file, suggested by Hellmut Golde
- XCommon subdirectories: tetris.2.0/X11 and tetris.2.1/X11
- XCommon subdirectories: tetris.2.0/bitmaps and tetris.2.1/bitmaps
- Xdiff -c tetris.2.0/playing.c tetris.2.1/playing.c
- X*** tetris.2.0/playing.c Fri Jan 15 13:04:31 1993
- X--- tetris.2.1/playing.c Fri Jan 15 15:46:35 1993
- X***************
- X*** 27,32
- X #include "tetris.h"
- X
- X static Bool paused = False;
- X
- X static int speeds[NUM_LEVELS] = {
- X 100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
- X
- X--- 27,33 -----
- X #include "tetris.h"
- X
- X static Bool paused = False;
- X+ static Bool firstFall = False;
- X
- X static int speeds[NUM_LEVELS] = {
- X 100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
- X***************
- X*** 29,35
- X static Bool paused = False;
- X
- X static int speeds[NUM_LEVELS] = {
- X! 100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
- X static int thresh[NUM_LEVELS] = {
- X 10, 20, 30, 40, 50, 60, 70, 80, 90,
- X 100, 110, 120, 130, 140, 150, 160, 170, 180};
- X
- X--- 30,36 -----
- X static Bool firstFall = False;
- X
- X static int speeds[NUM_LEVELS] = {
- X! 100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
- X static int thresh[NUM_LEVELS] = {
- X 10, 20, 30, 40, 50, 60, 70, 80, 90,
- X 100, 110, 120, 130, 140, 150, 160, 170, 180};
- X***************
- X*** 32,38
- X 100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
- X static int thresh[NUM_LEVELS] = {
- X 10, 20, 30, 40, 50, 60, 70, 80, 90,
- X! 100, 110, 120, 130, 140, 150, 160, 170, 180};
- X
- X static struct timeval nextFall, now, delay;
- X static struct timezone tzone = {0, 0};
- X
- X--- 33,39 -----
- X 100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
- X static int thresh[NUM_LEVELS] = {
- X 10, 20, 30, 40, 50, 60, 70, 80, 90,
- X! 100, 110, 120, 130, 140, 150, 160, 170, 180};
- X
- X static struct timeval nextFall, now, delay;
- X static struct timezone tzone = {0, 0};
- X***************
- X*** 43,48
- X playing()
- X {
- X Bool resetTime = True;
- X
- X score = prefilled * level * 10;
- X while (True) {
- X
- X--- 44,50 -----
- X playing()
- X {
- X Bool resetTime = True;
- X+ int conNum = ConnectionNumber(display);
- X
- X score = prefilled * level * 10;
- X while (True) {
- X***************
- X*** 52,58
- X realTime(&nextFall);
- X } else {
- X int writefd = 0, exceptfd = 0;
- X! int readfd = 1 << ConnectionNumber(display);
- X
- X (void) gettimeofday(&now, &tzone);
- X delay.tv_sec = nextFall.tv_sec - now.tv_sec;
- X
- X--- 54,60 -----
- X realTime(&nextFall);
- X } else {
- X int writefd = 0, exceptfd = 0;
- X! int readfd = 1 << conNum;
- X
- X (void) gettimeofday(&now, &tzone);
- X delay.tv_sec = nextFall.tv_sec - now.tv_sec;
- X***************
- X*** 58,65
- X delay.tv_sec = nextFall.tv_sec - now.tv_sec;
- X delay.tv_usec = nextFall.tv_usec - now.tv_usec;
- X realTime(&delay);
- X! if (delay.tv_sec >= 0) { /* sleep */
- X! (void) select(sizeof(int) * 8, (fd_set *) &readfd,
- X (fd_set *) & writefd, (fd_set *) & exceptfd, &delay);
- X }
- X }
- X
- X--- 60,69 -----
- X delay.tv_sec = nextFall.tv_sec - now.tv_sec;
- X delay.tv_usec = nextFall.tv_usec - now.tv_usec;
- X realTime(&delay);
- X! if ((delay.tv_sec > 0) ||
- X! ((delay.tv_sec == 0) && (delay.tv_usec > 0))) {
- X! /* sleep */
- X! (void) select(conNum + 1, (fd_set *) & readfd,
- X (fd_set *) & writefd, (fd_set *) & exceptfd, &delay);
- X }
- X }
- X***************
- X*** 66,72
- X (void) gettimeofday(&now, &tzone);
- X if ((now.tv_sec > nextFall.tv_sec) ||
- X ((now.tv_sec == nextFall.tv_sec) &&
- X! (now.tv_usec > nextFall.tv_usec))) {
- X (void) evGotNewThing(True);
- X resetTime = True;
- X } else {
- X
- X--- 70,76 -----
- X (void) gettimeofday(&now, &tzone);
- X if ((now.tv_sec > nextFall.tv_sec) ||
- X ((now.tv_sec == nextFall.tv_sec) &&
- X! (now.tv_usec > nextFall.tv_usec))) {
- X (void) evGotNewThing(True);
- X resetTime = True;
- X firstFall = True;
- X***************
- X*** 69,74
- X (now.tv_usec > nextFall.tv_usec))) {
- X (void) evGotNewThing(True);
- X resetTime = True;
- X } else {
- X resetTime = evGotNewThing(False);
- X }
- X
- X--- 73,79 -----
- X (now.tv_usec > nextFall.tv_usec))) {
- X (void) evGotNewThing(True);
- X resetTime = True;
- X+ firstFall = True;
- X } else {
- X resetTime = evGotNewThing(False);
- X }
- X***************
- X*** 72,77
- X } else {
- X resetTime = evGotNewThing(False);
- X }
- X }
- X /* never come to here */
- X }
- X
- X--- 77,84 -----
- X } else {
- X resetTime = evGotNewThing(False);
- X }
- X+ if (paused)
- X+ resetTime = True;
- X }
- X /* never come to here */
- X }
- X***************
- X*** 203,210
- X break;
- X
- X case FocusOut:
- X! paused = True;
- X! banner(MSG_PAUSED);
- X break;
- X
- X case Expose:
- X
- X--- 210,219 -----
- X break;
- X
- X case FocusOut:
- X! if (firstFall) {
- X! paused = True;
- X! banner(MSG_PAUSED);
- X! }
- X break;
- X
- X case Expose:
- X***************
- X*** 260,266
- X score += (showNext ? 3 : 5) * level * level * lines * lines;
- X rows += lines;
- X if (rows > thresh[level])
- X! level ++;
- X drawStatus();
- X newThing();
- X if (showNext) {
- X
- X--- 269,275 -----
- X score += (showNext ? 3 : 5) * level * level * lines * lines;
- X rows += lines;
- X if (rows > thresh[level])
- X! level++;
- X drawStatus();
- X newThing();
- X if (showNext) {
- X***************
- X*** 267,275
- X clearNext();
- X drawNext();
- X }
- X! XSync(display, False);
- X! while (XPending(display))
- X! XNextEvent(display, &ev);
- X if (overlapping())
- X gameOver();
- X drawThing();
- X
- X--- 276,282 -----
- X clearNext();
- X drawNext();
- X }
- X! XSync(display, True); /* discard all events */
- X if (overlapping())
- X gameOver();
- X drawThing();
- X***************
- X*** 277,283
- X } else {
- X tryMove(move);
- X if (rows > thresh[level]) {
- X! level ++;
- X drawStatus();
- X }
- X return False;
- X
- X--- 284,290 -----
- X } else {
- X tryMove(move);
- X if (rows > thresh[level]) {
- X! level++;
- X drawStatus();
- X }
- X return False;
- X***************
- X*** 311,317
- X (void) fprintf(stderr, "Cannot write the score-file!\n");
- X return;
- X }
- X-
- X /* lock */
- X (void) strcpy(lockfile, SCOREFILE);
- X (void) strcat(lockfile, ".lock");
- X
- X--- 318,323 -----
- X (void) fprintf(stderr, "Cannot write the score-file!\n");
- X return;
- X }
- X /* lock */
- X (void) strcpy(lockfile, SCOREFILE);
- X (void) strcat(lockfile, ".lock");
- X***************
- X*** 316,322
- X (void) strcpy(lockfile, SCOREFILE);
- X (void) strcat(lockfile, ".lock");
- X while (((lfd = open(lockfile, O_CREAT | O_EXCL, 0644)) < 0) &&
- X! errno == EEXIST)
- X sleep(1);
- X
- X if (lfd < 0) {
- X
- X--- 322,328 -----
- X (void) strcpy(lockfile, SCOREFILE);
- X (void) strcat(lockfile, ".lock");
- X while (((lfd = open(lockfile, O_CREAT | O_EXCL, 0644)) < 0) &&
- X! errno == EEXIST)
- X sleep(1);
- X
- X if (lfd < 0) {
- X***************
- X*** 324,330
- X (void) fprintf(stderr, "Score not recorded - sorry.\n");
- X return;
- X }
- X-
- X tmp = 0;
- X ptmp = 1;
- X bcopy((char *) &myscore, buff[1], SCORESIZE);
- X
- X--- 330,335 -----
- X (void) fprintf(stderr, "Score not recorded - sorry.\n");
- X return;
- X }
- X tmp = 0;
- X ptmp = 1;
- X bcopy((char *) &myscore, buff[1], SCORESIZE);
- X***************
- X*** 330,336
- X bcopy((char *) &myscore, buff[1], SCORESIZE);
- X
- X while (read(fd, buff[tmp], SCORESIZE) == SCORESIZE) {
- X! sscanf(((score_t *)buff[tmp])->score, " %d", &s1);
- X if (!saved && (s1 <= score)) {
- X trickle = True;
- X saved = True;
- X
- X--- 335,341 -----
- X bcopy((char *) &myscore, buff[1], SCORESIZE);
- X
- X while (read(fd, buff[tmp], SCORESIZE) == SCORESIZE) {
- X! sscanf(((score_t *) buff[tmp])->score, " %d", &s1);
- X if (!saved && (s1 <= score)) {
- X trickle = True;
- X saved = True;
- X***************
- X*** 337,343
- X mycount++;
- X }
- X if (!strncmp(myscore.myname, ((score_t *) buff[tmp])->myname,
- X! NAMELEN)) {
- X mycount++;
- X }
- X /* Then check if we should trickle the score */
- X
- X--- 342,348 -----
- X mycount++;
- X }
- X if (!strncmp(myscore.myname, ((score_t *) buff[tmp])->myname,
- X! NAMELEN)) {
- X mycount++;
- X }
- X /* Then check if we should trickle the score */
- X***************
- X*** 342,348
- X }
- X /* Then check if we should trickle the score */
- X if (trickle) {
- X! lseek(fd, (off_t) -SCORESIZE, SEEK_CUR);
- X write(fd, buff[ptmp], SCORESIZE);
- X ptmp = tmp;
- X tmp = (tmp + 1) % 2;
- X
- X--- 347,353 -----
- X }
- X /* Then check if we should trickle the score */
- X if (trickle) {
- X! lseek(fd, (off_t) - SCORESIZE, SEEK_CUR);
- X write(fd, buff[ptmp], SCORESIZE);
- X ptmp = tmp;
- X tmp = (tmp + 1) % 2;
- X***************
- X*** 347,352
- X ptmp = tmp;
- X tmp = (tmp + 1) % 2;
- X }
- X /*
- X * As we trickle, we add up records owned by me. Once we hit max,
- X * we throw it away, and stop trickling.
- X
- X--- 352,358 -----
- X ptmp = tmp;
- X tmp = (tmp + 1) % 2;
- X }
- X+
- X /*
- X * As we trickle, we add up records owned by me. Once we hit max, we
- X * throw it away, and stop trickling.
- X***************
- X*** 348,355
- X tmp = (tmp + 1) % 2;
- X }
- X /*
- X! * As we trickle, we add up records owned by me. Once we hit max,
- X! * we throw it away, and stop trickling.
- X */
- X if ((mycount > MAXSCORES) || ((mycount == MAXSCORES) && !trickle)) {
- X trickle = False;
- X
- X--- 354,361 -----
- X }
- X
- X /*
- X! * As we trickle, we add up records owned by me. Once we hit max, we
- X! * throw it away, and stop trickling.
- X */
- X if ((mycount > MAXSCORES) || ((mycount == MAXSCORES) && !trickle)) {
- X trickle = False;
- X***************
- X*** 355,361
- X trickle = False;
- X break;
- X }
- X! } /* while */
- X
- X if (trickle) {
- X write(fd, buff[ptmp], SCORESIZE);
- X
- X--- 361,367 -----
- X trickle = False;
- X break;
- X }
- X! } /* while */
- X
- X if (trickle) {
- X write(fd, buff[ptmp], SCORESIZE);
- X***************
- X*** 363,369
- X if (!saved && (mycount < MAXSCORES)) {
- X write(fd, (char *) &myscore, SCORESIZE);
- X }
- X-
- X /* unlock */
- X close(lfd);
- X (void) unlink(lockfile);
- X
- X--- 369,374 -----
- X if (!saved && (mycount < MAXSCORES)) {
- X write(fd, (char *) &myscore, SCORESIZE);
- X }
- X /* unlock */
- X close(lfd);
- X (void) unlink(lockfile);
- X***************
- X*** 397,403
- X
- X (void) fprintf(stderr, " GENERIC TETRIS HALL OF FAME\n\n");
- X (void) fprintf(stderr,
- X! " # USER SCORE L R HOST DATE\n");
- X
- X while (read(fd, (char *) &curs, SCORESIZE) == SCORESIZE) {
- X i++;
- X
- X--- 402,408 -----
- X
- X (void) fprintf(stderr, " GENERIC TETRIS HALL OF FAME\n\n");
- X (void) fprintf(stderr,
- X! " # USER SCORE L R HOST DATE\n");
- X
- X while (read(fd, (char *) &curs, SCORESIZE) == SCORESIZE) {
- X i++;
- X***************
- X*** 403,410
- X i++;
- X if ((num == 0) || (i <= num))
- X (void) fprintf(stderr, "%4d %-12s%9s %3s %4s %-12s %-s",
- X! i, curs.myname, curs.score, curs.level, curs.rows,
- X! curs.myhost, curs.mydate);
- X }
- X close(fd);
- X (void) fprintf(stderr, "There are %d scores to date.\n", i);
- X
- X--- 408,415 -----
- X i++;
- X if ((num == 0) || (i <= num))
- X (void) fprintf(stderr, "%4d %-12s%9s %3s %4s %-12s %-s",
- X! i, curs.myname, curs.score, curs.level, curs.rows,
- X! curs.myhost, curs.mydate);
- X }
- X close(fd);
- X (void) fprintf(stderr, "There are %d scores to date.\n", i);
- Xdiff -c tetris.2.0/tetris.c tetris.2.1/tetris.c
- X*** tetris.2.0/tetris.c Fri Jan 15 13:04:29 1993
- X--- tetris.2.1/tetris.c Fri Jan 15 15:12:51 1993
- X***************
- X*** 72,78
- X Bool showNext = False, beep = False;
- X score_t myscore;
- X
- X! static int opTableEntries = 15;
- X static XrmOptionDescRec opTable[] = {
- X {"-s", ".scoresOnly", XrmoptionIsArg, (caddr_t) NULL},
- X {"-l", "*startLevel", XrmoptionSepArg, (caddr_t) NULL},
- X
- X--- 72,78 -----
- X Bool showNext = False, beep = False;
- X score_t myscore;
- X
- X! static int opTableEntries = 16;
- X static XrmOptionDescRec opTable[] = {
- X {"-s", ".scoresOnly", XrmoptionIsArg, (caddr_t) NULL},
- X {"-l", "*startLevel", XrmoptionSepArg, (caddr_t) NULL},
- X***************
- X*** 88,93
- X {"-fg", "*foreground", XrmoptionSepArg, (caddr_t) NULL},
- X {"-bigFont", "*bigFont", XrmoptionSepArg, (caddr_t) NULL},
- X {"-tinyFont", "*tinyFont", XrmoptionSepArg, (caddr_t) NULL},
- X {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL}
- X };
- X static XrmDatabase cmmDB = (XrmDatabase) NULL, rDB = (XrmDatabase) NULL;
- X
- X--- 88,94 -----
- X {"-fg", "*foreground", XrmoptionSepArg, (caddr_t) NULL},
- X {"-bigFont", "*bigFont", XrmoptionSepArg, (caddr_t) NULL},
- X {"-tinyFont", "*tinyFont", XrmoptionSepArg, (caddr_t) NULL},
- X+ {"-u", "*playerName", XrmoptionSepArg, (caddr_t) NULL},
- X {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL}
- X };
- X static XrmDatabase cmmDB = (XrmDatabase) NULL, rDB = (XrmDatabase) NULL;
- X***************
- X*** 104,110
- X char *argv[];
- X {
- X (void) fprintf(stderr,
- X! " GENERIC TETRIS V2.0.1\n");
- X (void) fprintf(stderr,
- X "Copyright (C) 1992-93 Q. Alex Zhao, azhao@cs.arizona.edu\n");
- X (void) fprintf(stderr,
- X
- X--- 105,111 -----
- X char *argv[];
- X {
- X (void) fprintf(stderr,
- X! " GENERIC TETRIS V2.1.0\n");
- X (void) fprintf(stderr,
- X "Copyright (C) 1992-93 Q. Alex Zhao, azhao@cs.arizona.edu\n");
- X (void) fprintf(stderr,
- X***************
- X*** 136,142
- X
- X myDisplayName[0] = '\0';
- X
- X! XrmParseCommand(&cmmDB, opTable, opTableEntries, argv[0], argc, argv);
- X
- X /* check for any arguments left */
- X if (*argc != 1) {
- X
- X--- 137,143 -----
- X
- X myDisplayName[0] = '\0';
- X
- X! XrmParseCommand(&cmmDB, opTable, opTableEntries, "tetris", argc, argv);
- X
- X /* check for any arguments left */
- X if (*argc != 1) {
- X***************
- X*** 151,157
- X /* get display now */
- X if (XrmGetResource(cmmDB, "tetris.display", "Tetris.Display",
- X str_type, &value) == True)
- X! (void) strncpy(myDisplayName, value.addr, (int) value.size);
- X
- X if (!(display = XOpenDisplay(myDisplayName))) {
- X (void) fprintf(stderr, "%s: Can't open display '%s'\n",
- X
- X--- 152,159 -----
- X /* get display now */
- X if (XrmGetResource(cmmDB, "tetris.display", "Tetris.Display",
- X str_type, &value) == True)
- X! (void) strncpy(myDisplayName, value.addr, ZLIM(value.size, 255));
- X! myDisplayName[255] = '\0';
- X
- X if (!(display = XOpenDisplay(myDisplayName))) {
- X (void) fprintf(stderr, "%s: Can't open display '%s'\n",
- X***************
- X*** 205,211
- X (void) fprintf(stderr,
- X " [-bigFont <font>] [-tinyFont <font>] [-showNext] [-beep]\n");
- X (void) fprintf(stderr,
- X! " [-xrm <resource specifications>]\n");
- X
- X exit(1);
- X }
- X
- X--- 207,213 -----
- X (void) fprintf(stderr,
- X " [-bigFont <font>] [-tinyFont <font>] [-showNext] [-beep]\n");
- X (void) fprintf(stderr,
- X! " [-u <name>] [-xrm <resource specifications>]\n");
- X
- X exit(1);
- X }
- X***************
- X*** 296,302
- X
- X if (XrmGetResource(rDB, "tetris.foreground", "Tetris.Foreground",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, (int) value.size);
- X fg = getColor(name);
- X } else
- X fg = BlackPixel(display, screen_num);
- X
- X--- 298,305 -----
- X
- X if (XrmGetResource(rDB, "tetris.foreground", "Tetris.Foreground",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, ZLIM(value.size, 255));
- X! name[254] = '\0';
- X fg = getColor(name);
- X } else
- X fg = BlackPixel(display, screen_num);
- X***************
- X*** 303,309
- X
- X if (XrmGetResource(rDB, "tetris.background", "Tetris.Background",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, (int) value.size);
- X bg = getColor(name);
- X } else
- X bg = WhitePixel(display, screen_num);
- X
- X--- 306,313 -----
- X
- X if (XrmGetResource(rDB, "tetris.background", "Tetris.Background",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, ZLIM(value.size, 255));
- X! name[254] = '\0';
- X bg = getColor(name);
- X } else
- X bg = WhitePixel(display, screen_num);
- X***************
- X*** 317,323
- X
- X if (XrmGetResource(rDB, "tetris.geometry", "Tetris.Geometry",
- X str_type, &value) == True) {
- X! (void) strncpy(geoStr, value.addr, (int) value.size);
- X } else {
- X geoStr[0] = '\0';
- X }
- X
- X--- 321,328 -----
- X
- X if (XrmGetResource(rDB, "tetris.geometry", "Tetris.Geometry",
- X str_type, &value) == True) {
- X! (void) strncpy(geoStr, value.addr, ZLIM(value.size, 20));
- X! geoStr[19] = '\0';
- X } else {
- X geoStr[0] = '\0';
- X }
- X***************
- X*** 341,347
- X
- X if (XrmGetResource(rDB, "tetris.iconGeometry", "Tetris.IconGeometry",
- X str_type, &value) == True) {
- X! (void) strncpy(icongeoStr, value.addr, (int) value.size);
- X } else {
- X icongeoStr[0] = '\0';
- X }
- X
- X--- 346,353 -----
- X
- X if (XrmGetResource(rDB, "tetris.iconGeometry", "Tetris.IconGeometry",
- X str_type, &value) == True) {
- X! (void) strncpy(icongeoStr, value.addr, ZLIM(value.size, 20));
- X! icongeoStr[19] = '\0';
- X } else {
- X icongeoStr[0] = '\0';
- X }
- X***************
- X*** 367,373
- X
- X /*** get fonts ***/
- X
- X! if (XrmGetResource(rDB, "tetris.bigFont", "tetris.BigFont",
- X str_type, &value) == True) {
- X (void) strncpy(name, value.addr, (int) value.size);
- X } else {
- X
- X--- 373,379 -----
- X
- X /*** get fonts ***/
- X
- X! if (XrmGetResource(rDB, "tetris.bigFont", "Tetris.BigFont",
- X str_type, &value) == True) {
- X (void) strncpy(name, value.addr, ZLIM(value.size, 255));
- X name[254] = '\0';
- X***************
- X*** 369,375
- X
- X if (XrmGetResource(rDB, "tetris.bigFont", "tetris.BigFont",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, (int) value.size);
- X } else {
- X (void) strcpy(name, BIGFONT);
- X }
- X
- X--- 375,382 -----
- X
- X if (XrmGetResource(rDB, "tetris.bigFont", "Tetris.BigFont",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, ZLIM(value.size, 255));
- X! name[254] = '\0';
- X } else {
- X (void) strcpy(name, BIGFONT);
- X }
- X***************
- X*** 377,383
- X (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
- X exit(1);
- X }
- X! if (XrmGetResource(rDB, "tetris.tinyFont", "tetris.TinyFont",
- X str_type, &value) == True) {
- X (void) strncpy(name, value.addr, (int) value.size);
- X } else {
- X
- X--- 384,390 -----
- X (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
- X exit(1);
- X }
- X! if (XrmGetResource(rDB, "tetris.tinyFont", "Tetris.TinyFont",
- X str_type, &value) == True) {
- X (void) strncpy(name, value.addr, ZLIM(value.size, 255));
- X name[254] = '\0';
- X***************
- X*** 379,385
- X }
- X if (XrmGetResource(rDB, "tetris.tinyFont", "tetris.TinyFont",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, (int) value.size);
- X } else {
- X (void) strcpy(name, TINYFONT);
- X }
- X
- X--- 386,393 -----
- X }
- X if (XrmGetResource(rDB, "tetris.tinyFont", "Tetris.TinyFont",
- X str_type, &value) == True) {
- X! (void) strncpy(name, value.addr, ZLIM(value.size, 255));
- X! name[254] = '\0';
- X } else {
- X (void) strcpy(name, TINYFONT);
- X }
- X***************
- X*** 386,391
- X if ((tinyFont = XLoadQueryFont(display, name)) == NULL) {
- X (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
- X exit(1);
- X }
- X
- X /*
- X
- X--- 394,407 -----
- X if ((tinyFont = XLoadQueryFont(display, name)) == NULL) {
- X (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
- X exit(1);
- X+ }
- X+
- X+ /* player name */
- X+
- X+ if (XrmGetResource(rDB, "tetris.playerName", "Tetris.PlayerName",
- X+ str_type, &value) == True) {
- X+ (void) strncpy(myscore.myname, value.addr, ZLIM(value.size, 20));
- X+ myscore.myname[19] = '\0';
- X }
- X
- X /*
- Xdiff -c tetris.2.0/tetris.h tetris.2.1/tetris.h
- X*** tetris.2.0/tetris.h Fri Jan 15 13:04:29 1993
- X--- tetris.2.1/tetris.h Fri Jan 15 15:14:58 1993
- X***************
- X*** 111,116
- X #endif
- X #endif
- X
- X /*** constants ***/
- X
- X #ifndef SCOREFILE
- X
- X--- 111,120 -----
- X #endif
- X #endif
- X
- X+ /*** macros ***/
- X+
- X+ #define ZLIM(X, Y) (((int) X) < (Y) ? ((int) X) : (Y))
- X+
- X /*** constants ***/
- X
- X #ifndef SCOREFILE
- Xdiff -c tetris.2.0/tetris.man tetris.2.1/tetris.man
- X*** tetris.2.0/tetris.man Fri Jan 15 13:04:29 1993
- X--- tetris.2.1/tetris.man Fri Jan 15 14:09:27 1993
- X***************
- X*** 1,4
- X! .TH TETRIS 6 "11 Jan 1993, V2.0.1" "Univ of Arizona"
- X .SH NAME
- X GENERIC TETRIS \- Yet Another Tetris Game on X
- X .SH SYNOPSIS
- X
- X--- 1,4 -----
- X! .TH TETRIS 6 "15 Jan 1993, V2.1.0" "Univ of Arizona"
- X .SH NAME
- X GENERIC TETRIS \- Yet Another Tetris Game on X
- X .SH SYNOPSIS
- X***************
- X*** 6,12
- X [-s] [-l <start level>] [-p <prefilled lines>] [-showNext] [-beep]
- X [-display <display>] [-geometry <geometry>] [-iconGeometry <geometry>]
- X [-{background | bg} <color>] [-{foreground | fg} <color>] [-bigFont
- X! <font>] [-tinyFont <font>] [-xrm <resource specification>]
- X .SH DESCRIPTION
- X .LP
- X One of the motivations of this tetris program is simplicity. It does
- X
- X--- 6,12 -----
- X [-s] [-l <start level>] [-p <prefilled lines>] [-showNext] [-beep]
- X [-display <display>] [-geometry <geometry>] [-iconGeometry <geometry>]
- X [-{background | bg} <color>] [-{foreground | fg} <color>] [-bigFont
- X! <font>] [-tinyFont <font>] [-u <name>] [-xrm <resource specification>]
- X .SH DESCRIPTION
- X .LP
- X One of the motivations of this tetris program is simplicity. It does
- X***************
- X*** 40,45
- X .TP 8
- X .B \-s
- X This option lets the program only list all the recorded scores then exit.
- X .TP 8
- X .B \-l \fIlevel\fP
- X This option starts the program at the specified level (resource name
- X
- X--- 40,48 -----
- X .TP 8
- X .B \-s
- X This option lets the program only list all the recorded scores then exit.
- X+ .TP 8
- X+ .B \-u \fIname\fP
- X+ This option sets alternative player name.
- X .TP 8
- X .B \-l \fIlevel\fP
- X This option starts the program at the specified level (resource name
- Xdiff -c tetris.2.0/utils.c tetris.2.1/utils.c
- X*** tetris.2.0/utils.c Fri Jan 15 13:04:30 1993
- X--- tetris.2.1/utils.c Fri Jan 15 15:42:16 1993
- X***************
- X*** 116,121
- X }
- X };
- X
- X static char *thingFGs[NUM_THINGS] = {
- X "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Black", "Brown"
- X };
- X
- X--- 116,128 -----
- X }
- X };
- X
- X+ static int checkUp[NUM_BITMAPS] = {
- X+ 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6
- X+ };
- X+ static int checkDown[NUM_BITMAPS] = {
- X+ 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9, 12, 13, 12
- X+ };
- X+
- X static char *thingFGs[NUM_THINGS] = {
- X "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Brown", "Black"
- X };
- X***************
- X*** 117,123
- X };
- X
- X static char *thingFGs[NUM_THINGS] = {
- X! "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Black", "Brown"
- X };
- X
- X static Pixmap pms[NUM_BITMAPS];
- X
- X--- 124,130 -----
- X };
- X
- X static char *thingFGs[NUM_THINGS] = {
- X! "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Brown", "Black"
- X };
- X
- X static Pixmap pms[NUM_BITMAPS];
- X***************
- X*** 619,625
- X for (i = j; i > 0; i--)
- X lSet[i] = lSet[i-1];
- X lSet[0] = 0;
- X!
- X j++;
- X XFlush(display);
- X }
- X
- X--- 626,642 -----
- X for (i = j; i > 0; i--)
- X lSet[i] = lSet[i-1];
- X lSet[0] = 0;
- X!
- X! if (j > 0)
- X! for (i = 0; i < COLS; i++) {
- X! int tmp = field[j][i].pm_num;
- X! if ((tmp >= 0) && (tmp != checkDown[tmp])) {
- X! field[j][i].pm_num = checkDown[tmp];
- X! drawBox(blockWin, field[j][i].pm_num,
- X! field[j][i].cid, i * BOXSIZE, j * BOXSIZE);
- X! }
- X! }
- X!
- X j++;
- X
- X if (j < ROWS)
- X***************
- X*** 621,626
- X lSet[0] = 0;
- X
- X j++;
- X XFlush(display);
- X }
- X }
- X
- X--- 638,654 -----
- X }
- X
- X j++;
- X+
- X+ if (j < ROWS)
- X+ for (i = 0; i < COLS; i++) {
- X+ int tmp = field[j][i].pm_num;
- X+ if ((tmp >= 0) && (tmp != checkUp[tmp])) {
- X+ field[j][i].pm_num = checkUp[tmp];
- X+ drawBox(blockWin, field[j][i].pm_num,
- X+ field[j][i].cid, i * BOXSIZE, j * BOXSIZE);
- X+ }
- X+ }
- X+
- X XFlush(display);
- X }
- X }
- X
- END_OF_FILE
- if test 25665 -ne `wc -c <'patches01'`; then
- echo shar: \"'patches01'\" unpacked with wrong size!
- fi
- # end of 'patches01'
- fi
- echo shar: End of shell archive.
- exit 0
-