home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.tek.com!master!gnarly!billr
- From: billr@gnarly.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v15i055: gtetris3 - Generic Tetris for X11, V2.0.1, Patch3
- Message-ID: <4240@master.CNA.TEK.COM>
- Date: 22 Jan 93 05:03:58 GMT
- Sender: news@master.CNA.TEK.COM
- Lines: 538
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted-by: "Qiang Alex Zhao" <azhao@cs.arizona.edu>
- Posting-number: Volume 15, Issue 55
- Archive-name: gtetris3/Patch3
- Patch-To: gtetris3: Volume 15, Issue 44-45
- Environment: X11R4/5, Xlib
-
- [This includes both the diffs for V2.1.1 to V2.1.2 and from
- V2.1.2 to V2.1.3 in one patch file. -br]
-
- #! /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: patches03
- # Wrapped by billr@gnarly on Thu Jan 21 21:01:46 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patches03' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patches03'\"
- else
- echo shar: Extracting \"'patches03'\" \(12112 characters\)
- sed "s/^X//" >'patches03' <<'END_OF_FILE'
- X*** tetris.2.1.old/README Thu Jan 21 20:57:48 1993
- X--- tetris.2.1/README Thu Jan 21 20:54:36 1993
- X***************
- X*** 1,5 ****
- X GENERIC TETRIS
- X! ============== Yet Another Tetris Game on X, V2.1.1
- X
- X
- X WHY ANOTHER?
- X--- 1,5 ----
- X GENERIC TETRIS
- X! ============== Yet Another Tetris Game on X, V2.1.3
- X
- X
- X WHY ANOTHER?
- X***************
- X*** 9,17 ****
- X Xlib -- no "toolkit" kind of thing. People have tested it on the
- X following platforms:
- X
- X DEC 5000 Ultrix 4.2A X11R4
- X Iris 4D IRIX 4.0.1 Motif
- X! Sun4, SPARCstation SunOS 4.1.1 X11R4, X11R5
- X Sequent S81 DYNIX 3.2.0 X11R5
- X
- X If your's is not in this list, please let me know -- thanks. The
- X--- 9,22 ----
- X Xlib -- no "toolkit" kind of thing. People have tested it on the
- X following platforms:
- X
- X+ Bull DPX/2 System V ?
- X DEC 5000 Ultrix 4.2A X11R4
- X+ DEC Alpha AXP DEC OSF/1 V1.2 ?
- X+ HP 700 HP-UX 8.07 X11R5
- X Iris 4D IRIX 4.0.1 Motif
- X! Sun4, SPARC SunOS 4.1.x X11R4, X11R5
- X! Sun SPARC Solaris 2.1
- X! add to link: -L/usr/ucblib -lucb -lelf -R/usr/ucblib
- X Sequent S81 DYNIX 3.2.0 X11R5
- X
- X If your's is not in this list, please let me know -- thanks. The
- X***************
- X*** 56,61 ****
- X--- 61,71 ----
- X ;o) When the tetris window loses its focus, it also goes to
- X "paused" mode except it doesn't iconify itself.
- X
- X+ In previous versions, all number keys on the keypad work. Since I'm
- X+ going to let the user fully configure things like key bindings,
- X+ I'll only let a few of them work for now, and do not include a key
- X+ for "rotate counter-clockwise" (sorry :o).
- X+
- X Refer to the man page for detailed command line options.
- X
- X
- X***************
- X*** 76,84 ****
- X HISTORY -- Oh no, not again: I failed my history course!
- X Well ... ACKNOWLEDGEMENTS
- 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 18, 93] V2.1.1: Fixed a resource look-up bug found by Peter
- X Kabal <kabal@inrs-telecom.uquebec.ca>, and Imakefile
- X problem found by Tong Zhou <tzhou@cse.ogi.edu>.
- X--- 86,100 ----
- X HISTORY -- Oh no, not again: I failed my history course!
- X Well ... ACKNOWLEDGEMENTS
- X
- X! [Jan 21, 93] V2.1.3: Two bugs in finding user environment:
- X! "endpwent()" by Jari Tavi <jpt@rixrax.enet.dec.com>;
- X! "gethostname()" by Johan Vromans <jv@mh.nl>. Added two
- X! more arrow keys.
- X
- X+ [Jan 19, 93] V2.1.2: Improved "paused" mode - so it won't take too
- X+ much CPU time - suggested by Philip JENNINGS
- X+ <P.Jennings@frcl.bull.fr>.
- X+
- X [Jan 18, 93] V2.1.1: Fixed a resource look-up bug found by Peter
- X Kabal <kabal@inrs-telecom.uquebec.ca>, and Imakefile
- X problem found by Tong Zhou <tzhou@cse.ogi.edu>.
- X***************
- X*** 101,106 ****
- X--- 117,125 ----
- X in case some system doesn't have them. Fixed block
- X clearing bug found by Benjamin Kroop
- X <bkroop@sunlab.cit.cornell.edu>.
- 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 [Nov 13, 92] Black Friday -- V1.8.1: numerious minor changes. Made
- X score listing built in.
- X*** tetris.2.1.old/playing.c Thu Jan 21 20:57:30 1993
- X--- tetris.2.1/playing.c Thu Jan 21 20:54:48 1993
- 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--- 77,82 ----
- X***************
- X*** 90,96 ****
- X Bool falldown;
- X {
- X XEvent ev;
- X! Bool gotNew = False;
- X char buf[4];
- X
- X if (!paused && falldown)
- X--- 88,94 ----
- X Bool falldown;
- X {
- X XEvent ev;
- X! Bool gotNew = False, flag;
- X char buf[4];
- X
- X if (!paused && falldown)
- X***************
- X*** 98,237 ****
- X
- X while (XPending(display)) {
- X XNextEvent(display, &ev);
- X! switch (ev.type) {
- X! case KeyPress:
- X! if (!XLookupString(&ev.xkey, buf, 4, NULL, NULL))
- X! break;
- X
- X! switch (buf[0]) {
- X! case 'j':
- X! case 's':
- X! if (!paused)
- X! gotNew = moveOne(LEFT) || gotNew;
- X! break;
- X
- X! case 'k':
- X! case 'd':
- X! if (!paused)
- X! gotNew = moveOne(ROTATE) || gotNew;
- X! break;
- X
- X! case 'l':
- X! case 'f':
- X! if (!paused)
- X! gotNew = moveOne(RIGHT) || gotNew;
- X! break;
- X
- X! case ' ':
- X! case '\n':
- X! if (!paused)
- X! gotNew = moveOne(DROP) || gotNew;
- X! break;
- X
- X! case 'q':
- X! case 'Q':
- X! gameOver();
- X! break;
- X
- X! case '+':
- X! case '=':
- X! if (!paused)
- X! if (level < NUM_LEVELS - 1) {
- X! level++;
- X! drawStatus();
- X }
- X! break;
- X
- X! case '-':
- X! case '_':
- X! if (!paused)
- X! if (level > 0) {
- X! level--;
- X! drawStatus();
- X }
- X break;
- X
- X! case 'b':
- X! case 'B':
- X! beep = !beep;
- X! if (beep)
- X! XBell(display, BVOLUME);
- X break;
- X
- X! case 'p':
- X! case 'P':
- X! if (beep)
- X! XBell(display, BVOLUME);
- X! paused = !paused;
- X! if (paused) {
- X! /* "... Hi boss, I'm working hard as usual ..." */
- X banner(MSG_PAUSED);
- X- (void) XIconifyWindow(display, mainWin, screen_num);
- X- } else {
- X- clearNext();
- X- if (showNext)
- X- drawNext();
- X }
- X- XSync(display, False);
- X break;
- X
- X! case '\014':
- X! XClearWindow(display, mainWin);
- X! XClearWindow(display, blockWin);
- X! redrawAll();
- X! if (paused)
- X! banner(MSG_PAUSED);
- X! XSync(display, False);
- X break;
- X
- X! case 'n':
- X! case 'N':
- X! if (!paused) {
- X! showNext = !showNext;
- X! if (showNext) {
- X! drawNext();
- X! } else {
- X! clearNext();
- X! }
- X! XSync(display, False);
- X! }
- X break;
- X
- X! default:
- X! XBell(display, 0);
- X! XSync(display, False);
- X break;
- X }
- X!
- X! break;
- X!
- X! case UnmapNotify:
- X! paused = True;
- X! break;
- X!
- X! case FocusOut:
- X! if (firstFall) {
- X! paused = True;
- X! banner(MSG_PAUSED);
- X! }
- X! break;
- X!
- X! case Expose:
- X! if (ev.xexpose.count == 0) {
- X! redrawAll();
- X! if (paused)
- X! banner(MSG_PAUSED);
- X! }
- X! break;
- X!
- X! case ClientMessage:
- X! if ((Atom) ev.xclient.data.l[0] == delw)
- X! gameOver();
- X! break;
- X!
- X! case DestroyNotify:
- X! exit(0);
- X! break;
- X }
- X }
- X
- X--- 96,244 ----
- X
- X while (XPending(display)) {
- X XNextEvent(display, &ev);
- X! flag = True;
- X! while (flag) {
- X! switch (ev.type) {
- X! case KeyPress:
- X! if (!XLookupString(&ev.xkey, buf, 4, NULL, NULL))
- X! break;
- X
- X! switch (buf[0]) {
- X! case 'j':
- X! case 's':
- X! if (!paused)
- X! gotNew = moveOne(LEFT) || gotNew;
- X! break;
- X
- X! case 'k':
- X! case 'd':
- X! if (!paused)
- X! gotNew = moveOne(ROTATE) || gotNew;
- X! break;
- X
- X! case 'l':
- X! case 'f':
- X! if (!paused)
- X! gotNew = moveOne(RIGHT) || gotNew;
- X! break;
- X
- X! case ' ':
- X! case '\n':
- X! if (!paused)
- X! gotNew = moveOne(DROP) || gotNew;
- X! break;
- X
- X! case 'q':
- X! case 'Q':
- X! gameOver();
- X! break;
- X
- X! case '+':
- X! case '=':
- X! if (!paused)
- X! if (level < NUM_LEVELS - 1) {
- X! level++;
- X! drawStatus();
- X! }
- X! break;
- X!
- X! case '-':
- X! case '_':
- X! if (!paused)
- X! if (level > 0) {
- X! level--;
- X! drawStatus();
- X! }
- X! break;
- X!
- X! case 'b':
- X! case 'B':
- X! beep = !beep;
- X! if (beep)
- X! XBell(display, BVOLUME);
- X! break;
- X!
- X! case 'p':
- X! case 'P':
- X! if (beep)
- X! XBell(display, BVOLUME);
- X! paused = !paused;
- X! if (paused) {
- X! /* "... Hi boss, I'm working hard as usual ..." */
- X! banner(MSG_PAUSED);
- X! (void) XIconifyWindow(display, mainWin, screen_num);
- X! } else {
- X! clearNext();
- X! if (showNext)
- X! drawNext();
- X }
- X! XSync(display, False);
- X! break;
- X
- X! case '\014':
- X! XClearWindow(display, mainWin);
- X! XClearWindow(display, blockWin);
- X! redrawAll();
- X! if (paused)
- X! banner(MSG_PAUSED);
- X! XSync(display, False);
- X! break;
- X!
- X! case 'n':
- X! case 'N':
- X! if (!paused) {
- X! showNext = !showNext;
- X! if (showNext) {
- X! drawNext();
- X! } else {
- X! clearNext();
- X! }
- X! XSync(display, False);
- X }
- X+ break;
- X+
- X+ default:
- X+ XBell(display, 0);
- X+ XSync(display, False);
- X+ break;
- X+ }
- X+
- X break;
- X
- X! case UnmapNotify:
- X! paused = True;
- X break;
- X
- X! case FocusOut:
- X! if (firstFall) {
- X! paused = True;
- X banner(MSG_PAUSED);
- X }
- X break;
- X
- X! case Expose:
- X! if (ev.xexpose.count == 0) {
- X! redrawAll();
- X! if (paused)
- X! banner(MSG_PAUSED);
- X! }
- X break;
- X
- X! case ClientMessage:
- X! if ((Atom) ev.xclient.data.l[0] == delw)
- X! gameOver();
- X break;
- X
- X! case DestroyNotify:
- X! exit(0);
- X break;
- X }
- X! if (paused) {
- X! XNextEvent(display, &ev);
- X! flag = True;
- X! gotNew = True; /* for reseting time */
- X! } else
- X! flag = False;
- X }
- X }
- X
- X*** tetris.2.1.old/tetris.c Thu Jan 21 20:57:48 1993
- X--- tetris.2.1/tetris.c Thu Jan 21 20:54:49 1993
- X***************
- X*** 105,111 ****
- X char *argv[];
- X {
- X (void) fprintf(stderr,
- X! " GENERIC TETRIS V2.1.1\n");
- X (void) fprintf(stderr,
- X "Copyright (C) 1992-93 Q. Alex Zhao, azhao@cs.arizona.edu\n");
- X (void) fprintf(stderr,
- X--- 105,111 ----
- X char *argv[];
- X {
- X (void) fprintf(stderr,
- X! " GENERIC TETRIS V2.1.3\n");
- X (void) fprintf(stderr,
- X "Copyright (C) 1992-93 Q. Alex Zhao, azhao@cs.arizona.edu\n");
- X (void) fprintf(stderr,
- X***************
- X*** 177,183 ****
- X (void) gethostname(myscore.myhost, NAMELEN);
- X setpwent();
- X pw = getpwuid(getuid());
- X- endpwent();
- X if (pw == NULL) { /* impossible? */
- X (void) sprintf(myscore.myname, "%d", getuid());
- X myHome[0] = '.';
- X--- 177,182 ----
- X***************
- X*** 187,192 ****
- X--- 186,192 ----
- X (void) strncpy(myscore.myname, pw->pw_name, NAMELEN);
- X (void) strncpy(myHome, pw->pw_dir, FILENAMELEN);
- X }
- X+ endpwent();
- X myscore.myname[NAMELEN - 1] = '\0';
- X myscore.myhost[NAMELEN - 1] = '\0';
- X myHome[FILENAMELEN - 1] = '\0';
- X***************
- X*** 251,256 ****
- X--- 251,257 ----
- X env = &filenamebuf[0];
- X (void) strcpy(env, myHome);
- X len = strlen(env);
- X+ env[len++] = '/';
- X (void) gethostname(env + len, FILENAMELEN - len);
- X }
- X homeDB = XrmGetFileDatabase(env);
- X*** tetris.2.1.old/tetris.man Thu Jan 21 20:57:48 1993
- X--- tetris.2.1/tetris.man Thu Jan 21 20:54:43 1993
- X***************
- X*** 1,4 ****
- X! .TH TETRIS 6 "18 Jan 1993, V2.1.1" "Univ of Arizona"
- X .SH NAME
- X GENERIC TETRIS \- Yet Another Tetris Game on X
- X .SH SYNOPSIS
- X--- 1,4 ----
- X! .TH TETRIS 6 "19 Jan 1993, V2.1" "Univ of Arizona"
- X .SH NAME
- X GENERIC TETRIS \- Yet Another Tetris Game on X
- X .SH SYNOPSIS
- X*** tetris.2.1.old/utils.c Thu Jan 21 20:57:31 1993
- X--- tetris.2.1/utils.c Thu Jan 21 20:54:49 1993
- X***************
- X*** 232,237 ****
- X--- 232,241 ----
- X (unsigned char *) "j", sizeof(unsigned char));
- X XRebindKeysym(display, XK_Left, NULL, 0,
- X (unsigned char *) "j", sizeof(unsigned char));
- X+ XRebindKeysym(display, XK_R8, NULL, 0,
- X+ (unsigned char *) "k", sizeof(unsigned char));
- X+ XRebindKeysym(display, XK_Up, NULL, 0,
- X+ (unsigned char *) "k", sizeof(unsigned char));
- X XRebindKeysym(display, XK_R11, NULL, 0,
- X (unsigned char *) "k", sizeof(unsigned char));
- X XRebindKeysym(display, XK_R12, NULL, 0,
- X***************
- X*** 238,243 ****
- X--- 242,251 ----
- X (unsigned char *) "l", sizeof(unsigned char));
- X XRebindKeysym(display, XK_Right, NULL, 0,
- X (unsigned char *) "l", sizeof(unsigned char));
- X+ XRebindKeysym(display, XK_Down, NULL, 0,
- X+ (unsigned char *) " ", sizeof(unsigned char));
- X+ XRebindKeysym(display, XK_R14, NULL, 0,
- X+ (unsigned char *) " ", sizeof(unsigned char));
- X
- X /* create windows */
- X attvm = CWBackPixel | CWEventMask | CWDontPropagate | CWCursor;
- END_OF_FILE
- if test 12112 -ne `wc -c <'patches03'`; then
- echo shar: \"'patches03'\" unpacked with wrong size!
- fi
- # end of 'patches03'
- fi
- echo shar: End of shell archive.
- exit 0
-