]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - tetris/tetris.c
#netbsd - where monks recite their internal dialogue while debugging.
[bsdgames-darwin.git] / tetris / tetris.c
index f1f096a80d32b3bcc336f1aafd6bc7c67d946115..058335e6d994caf8c19448fd6cb3ce81be778280 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: tetris.c,v 1.12 1999/09/12 09:02:24 jsm Exp $  */
+/*     $NetBSD: tetris.c,v 1.14 2000/01/21 02:10:57 jsm Exp $  */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -50,6 +50,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
 
 #include <sys/time.h>
 
+#include <err.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <stdio.h>
@@ -62,8 +63,21 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
 #include "screen.h"
 #include "tetris.h"
 
+cell   board[B_SIZE];          /* 1 => occupied, 0 => empty */
+
+int    Rows, Cols;             /* current screen size */
+
+const struct shape *curshape;
+const struct shape *nextshape;
+
+long   fallrate;               /* less than 1 million; smaller => faster */
+
+int    score;                  /* the obvious thing */
 gid_t  gid, egid;
 
+char   key_msg[100];
+int    showpreview;
+
 static void    elide __P((void));
 static void    setup_board __P((void));
        int     main __P((int, char **));
@@ -146,10 +160,8 @@ main(argc, argv)
                case 'l':
                        level = atoi(optarg);
                        if (level < MINLEVEL || level > MAXLEVEL) {
-                               (void)fprintf(stderr,
-                                   "tetris: level must be from %d to %d\n",
-                                   MINLEVEL, MAXLEVEL);
-                               exit(1);
+                               errx(1, "level must be from %d to %d",
+                                    MINLEVEL, MAXLEVEL);
                        }
                        break;
                case 'p':
@@ -174,10 +186,7 @@ main(argc, argv)
        for (i = 0; i <= 5; i++) {
                for (j = i+1; j <= 5; j++) {
                        if (keys[i] == keys[j]) {
-                               (void)fprintf(stderr,
-                                   "%s: duplicate command keys specified.\n",
-                                   argv[0]);
-                               exit (1);
+                               errx(1, "duplicate command keys specified.");
                        }
                }
                if (keys[i] == ' ')