diff options
author | hubertf <hubertf@NetBSD.org> | 1999-01-03 17:13:51 +0000 |
---|---|---|
committer | hubertf <hubertf@NetBSD.org> | 1999-01-03 17:13:51 +0000 |
commit | f8df8c0281a2b93b58f947c4bc167c998f05e804 (patch) | |
tree | eea579958c7b97230bca854b4bc469209318c125 /tetris | |
parent | 69a9330f3a35ba66a49fad4835b5188fe59f2bbf (diff) | |
download | bsdgames-darwin-f8df8c0281a2b93b58f947c4bc167c998f05e804.tar.gz bsdgames-darwin-f8df8c0281a2b93b58f947c4bc167c998f05e804.tar.zst bsdgames-darwin-f8df8c0281a2b93b58f947c4bc167c998f05e804.zip |
only show preview if the -p option is given
Diffstat (limited to 'tetris')
-rw-r--r-- | tetris/screen.c | 6 | ||||
-rw-r--r-- | tetris/tetris.6 | 6 | ||||
-rw-r--r-- | tetris/tetris.c | 13 | ||||
-rw-r--r-- | tetris/tetris.h | 7 |
4 files changed, 16 insertions, 16 deletions
diff --git a/tetris/screen.c b/tetris/screen.c index c4a4ff87..f96f85b3 100644 --- a/tetris/screen.c +++ b/tetris/screen.c @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.8 1999/01/03 02:00:18 hubertf Exp $ */ +/* $NetBSD: screen.c,v 1.9 1999/01/03 17:13:51 hubertf Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -394,9 +394,8 @@ scr_update() curscore = score; } -#ifndef NO_PREVIEW /* draw preview of nextpattern */ - if (nextshape != lastshape) { + if (showpreview && (nextshape != lastshape)) { int i; static int r=5, c=2; int tr, tc, t; @@ -429,7 +428,6 @@ scr_update() } putpad(SEstr); } -#endif bp = &board[D_FIRST * B_COLS]; sp = &curscreen[D_FIRST * B_COLS]; diff --git a/tetris/tetris.6 b/tetris/tetris.6 index 49fc76e3..3a4c99d3 100644 --- a/tetris/tetris.6 +++ b/tetris/tetris.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: tetris.6,v 1.5 1999/01/03 02:00:18 hubertf Exp $ +.\" $NetBSD: tetris.6,v 1.6 1999/01/03 17:13:51 hubertf Exp $ .\" .\" Copyright (c) 1992, 1993 .\" The Regents of the University of California. All rights reserved. @@ -44,7 +44,7 @@ .Nd the game of tetris .Sh SYNOPSIS .Nm -.Op Fl s +.Op Fl ps .Op Fl k Ar keys .Op Fl l Ar level .Sh DESCRIPTION @@ -97,6 +97,8 @@ during play. Select a level of play. .It Fl s Display the top scores. +.It Fl p +Switch on previewing of the shape that will appear next. .El .Pp .Sh PLAY diff --git a/tetris/tetris.c b/tetris/tetris.c index c5569c9b..f00fb7d7 100644 --- a/tetris/tetris.c +++ b/tetris/tetris.c @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.c,v 1.6 1999/01/03 02:00:18 hubertf Exp $ */ +/* $NetBSD: tetris.c,v 1.7 1999/01/03 17:13:51 hubertf Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -67,10 +67,6 @@ static void setup_board __P((void)); void onintr __P((int)) __attribute__((__noreturn__)); void usage __P((void)) __attribute__((__noreturn__)); -struct shape *curshape; -struct shape *nextshape; - - /* * Set up the initial board. The bottom display row is completely set, * along with another (hidden) row underneath that. Also, the left and @@ -132,7 +128,7 @@ main(argc, argv) keys = "jkl pq"; - while ((ch = getopt(argc, argv, "k:l:s")) != -1) + while ((ch = getopt(argc, argv, "k:l:ps")) != -1) switch(ch) { case 'k': if (strlen(keys = optarg) != 6) @@ -147,6 +143,9 @@ main(argc, argv) exit(1); } break; + case 'p': + showpreview = 1; + break; case 's': showscores(0); exit(0); @@ -319,6 +318,6 @@ onintr(signo) void usage() { - (void)fprintf(stderr, "usage: tetris [-s] [-l level] [-keys]\n"); + (void)fprintf(stderr, "usage: tetris [-ps] [-l level] [-keys]\n"); exit(1); } diff --git a/tetris/tetris.h b/tetris/tetris.h index 13d4b40b..d3aebd2c 100644 --- a/tetris/tetris.h +++ b/tetris/tetris.h @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.h,v 1.4 1999/01/03 02:00:18 hubertf Exp $ */ +/* $NetBSD: tetris.h,v 1.5 1999/01/03 17:13:51 hubertf Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -132,8 +132,8 @@ struct shape { extern struct shape shapes[]; #define randshape() (&shapes[random() % 7]) -extern struct shape *curshape; -extern struct shape *nextshape; +struct shape *curshape; +struct shape *nextshape; /* * Shapes fall at a rate faster than once per second. @@ -168,6 +168,7 @@ long fallrate; /* less than 1 million; smaller => faster */ int score; /* the obvious thing */ char key_msg[100]; +int showpreview; int fits_in __P((struct shape *, int)); void place __P((struct shape *, int, int)); |