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