summaryrefslogtreecommitdiff
path: root/games/tetris/tetris.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-07-26 20:19:23 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-07-26 20:19:23 +0000
commit5a61fdd6c9ff9872e4e0c3a1c449a08935034729 (patch)
treecc9ccd5a653a952a7c156c098bd59ce29ab53ad7 /games/tetris/tetris.c
parent14be15feb70887ab60a3599332eae67d4c35fead (diff)
add classic mode, closer to the way tetris felt a couple decades ago; pjanzen@ ok
Diffstat (limited to 'games/tetris/tetris.c')
-rw-r--r--games/tetris/tetris.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/games/tetris/tetris.c b/games/tetris/tetris.c
index 232b2ee778d..356588ace83 100644
--- a/games/tetris/tetris.c
+++ b/games/tetris/tetris.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tetris.c,v 1.12 2002/05/31 04:21:30 pjanzen Exp $ */
+/* $OpenBSD: tetris.c,v 1.13 2002/07/26 20:19:22 mickey Exp $ */
/* $NetBSD: tetris.c,v 1.2 1995/04/22 07:42:47 cgd Exp $ */
/*-
@@ -73,7 +73,7 @@ long fallrate;
int score;
gid_t gid, egid;
char key_msg[100];
-int showpreview;
+int showpreview, classic;
static void elide(void);
static void setup_board(void);
@@ -134,7 +134,7 @@ randshape()
tmp = &shapes[random() % 7];
j = random() % 4;
for (i = 0; i < j; i++)
- tmp = &shapes[tmp->rot];
+ tmp = &shapes[classic? tmp->rotc : tmp->rot];
return (tmp);
}
@@ -156,9 +156,17 @@ main(argc, argv)
egid = getegid();
setegid(gid);
- showpreview = 0;
- while ((ch = getopt(argc, argv, "hk:l:ps")) != -1)
+ classic = showpreview = 0;
+ while ((ch = getopt(argc, argv, "chk:l:ps")) != -1)
switch(ch) {
+ case 'c':
+ /*
+ * this means:
+ * - rotate the other way;
+ * - no reverse video.
+ */
+ classic = 1;
+ break;
case 'k':
if (strlen(keys = optarg) != 6)
usage();
@@ -285,7 +293,8 @@ main(argc, argv)
}
if (c == keys[1]) {
/* turn */
- struct shape *new = &shapes[curshape->rot];
+ struct shape *new = &shapes[
+ classic? curshape->rotc : curshape->rot];
if (fits_in(new, pos))
curshape = new;