]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - tetris/tetris.c
Avoid common symbols. Use __dead.
[bsdgames-darwin.git] / tetris / tetris.c
index fb1aa84d042da0f93a4d2aabe26247c3195b3147..286e7c4550190f88c4097eb59018f8c0a4346295 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: tetris.c,v 1.29 2015/06/13 04:15:51 dholland Exp $     */
+/*     $NetBSD: tetris.c,v 1.33 2020/07/21 02:42:05 nia Exp $  */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -62,6 +62,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\
 cell   board[B_SIZE];          /* 1 => occupied, 0 => empty */
 
 int    Rows, Cols;             /* current screen size */
+int    Offset;                 /* used to center board & shapes */
 
 static const struct shape *curshape;
 const struct shape *nextshape;
@@ -116,6 +117,8 @@ elide(void)
                                tsleep();
                                while (--base != 0)
                                        board[base + B_COLS] = board[base];
+                               /* don't forget to clear 0th row */
+                               memset(&board[1], 0, B_COLS - 2);
                                scr_update();
                                tsleep();
                                break;
@@ -204,7 +207,6 @@ main(int argc, char *argv[])
        scr_init();
        setup_board();
 
-       srandom(getpid());
        scr_set();
 
        pos = A_FIRST*B_COLS + (B_COLS/2)-1;
@@ -341,7 +343,7 @@ onintr(int signo __unused)
 static void
 usage(void)
 {
-       (void)fprintf(stderr, "usage: %s [-ps] [-k keys] [-l level]\n",
+       (void)fprintf(stderr, "usage: %s [-bps] [-k keys] [-l level]\n",
            getprogname());
        exit(1);
 }