Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/tetris Provide an option to restore traditional black-...



details:   https://anonhg.NetBSD.org/src/rev/4feaebc418e6
branches:  trunk
changeset: 797303:4feaebc418e6
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jul 13 16:23:55 2014 +0000

description:
Provide an option to restore traditional black-and-white mode.

diffstat:

 games/tetris/screen.c |  4 +++-
 games/tetris/tetris.6 |  9 +++++++--
 games/tetris/tetris.c |  8 ++++++--
 games/tetris/tetris.h |  3 ++-
 4 files changed, 18 insertions(+), 6 deletions(-)

diffs (95 lines):

diff -r 127fcfe9d518 -r 4feaebc418e6 games/tetris/screen.c
--- a/games/tetris/screen.c     Sun Jul 13 16:00:32 2014 +0000
+++ b/games/tetris/screen.c     Sun Jul 13 16:23:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: screen.c,v 1.28 2014/06/11 16:47:39 christos Exp $     */
+/*     $NetBSD: screen.c,v 1.29 2014/07/13 16:23:55 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -98,6 +98,8 @@
 setcolor(int c)
 {
        char *buf;
+       if (nocolor == 1)
+               return;
        if (set_a_foreground == NULL)
                return;
 
diff -r 127fcfe9d518 -r 4feaebc418e6 games/tetris/tetris.6
--- a/games/tetris/tetris.6     Sun Jul 13 16:00:32 2014 +0000
+++ b/games/tetris/tetris.6     Sun Jul 13 16:23:55 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: tetris.6,v 1.11 2005/09/15 02:09:42 wiz Exp $
+.\"    $NetBSD: tetris.6,v 1.12 2014/07/13 16:23:55 pgoyette Exp $
 .\"
 .\" Copyright (c) 1992, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -40,7 +40,7 @@
 .Nd the game of tetris
 .Sh SYNOPSIS
 .Nm
-.Op Fl ps
+.Op Fl cps
 .Op Fl k Ar keys
 .Op Fl l Ar level
 .Sh DESCRIPTION
@@ -73,6 +73,11 @@
 .Pp
 The options are as follows:
 .Bl -tag -width indent
+.It Fl c
+By default, shapes are displayed colorfully if the user's CRT supports color.
+The
+.Fl c
+option can be used to restore the traditional black-and-white behavior.
 .It Fl k
 The default control keys can be changed using the
 .Fl k
diff -r 127fcfe9d518 -r 4feaebc418e6 games/tetris/tetris.c
--- a/games/tetris/tetris.c     Sun Jul 13 16:00:32 2014 +0000
+++ b/games/tetris/tetris.c     Sun Jul 13 16:23:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tetris.c,v 1.25 2014/06/11 16:47:39 christos Exp $     */
+/*     $NetBSD: tetris.c,v 1.26 2014/07/13 16:23:55 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -73,6 +73,7 @@
 
 char   key_msg[100];
 int    showpreview;
+int    nocolor;
 
 static void elide(void);
 static void setup_board(void);
@@ -144,8 +145,11 @@
 
        keys = "jkl pq";
 
-       while ((ch = getopt(argc, argv, "k:l:ps")) != -1)
+       while ((ch = getopt(argc, argv, "ck:l:ps")) != -1)
                switch(ch) {
+               case 'c':
+                       nocolor = 1;
+                       break;
                case 'k':
                        if (strlen(keys = optarg) != 6)
                                usage();
diff -r 127fcfe9d518 -r 4feaebc418e6 games/tetris/tetris.h
--- a/games/tetris/tetris.h     Sun Jul 13 16:00:32 2014 +0000
+++ b/games/tetris/tetris.h     Sun Jul 13 16:23:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tetris.h,v 1.13 2014/06/11 16:47:39 christos Exp $     */
+/*     $NetBSD: tetris.h,v 1.14 2014/07/13 16:23:55 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -168,6 +168,7 @@
 
 extern char    key_msg[100];
 extern int     showpreview;
+extern int     nocolor;
 
 int    fits_in(const struct shape *, int);
 void   place(const struct shape *, int, int);



Home | Main Index | Thread Index | Old Index