Source-Changes-HG archive

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

[src/netbsd-7]: src/games/tetris Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/fffe7be8bcc5
branches:  netbsd-7
changeset: 799480:fffe7be8bcc5
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Jul 17 03:39:35 2015 +0000

description:
Pull up following revision(s) (requested by nat in ticket #873):
        games/tetris/screen.c: revision 1.30
Fixes color scheme white on black and black on white.
This commit was approved by christos@

diffstat:

 games/tetris/screen.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r b69dc4e8e5ec -r fffe7be8bcc5 games/tetris/screen.c
--- a/games/tetris/screen.c     Fri Jul 17 03:37:40 2015 +0000
+++ b/games/tetris/screen.c     Fri Jul 17 03:39:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: screen.c,v 1.29 2014/07/13 16:23:55 pgoyette Exp $     */
+/*     $NetBSD: screen.c,v 1.29.2.1 2015/07/17 03:39:35 snj Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -98,12 +98,16 @@
 setcolor(int c)
 {
        char *buf;
+       char monochrome[] = "\033[0m";
        if (nocolor == 1)
                return;
        if (set_a_foreground == NULL)
                return;
 
-       buf = tiparm(set_a_foreground, c == 7 ? 0 : c);
+       if (c == 0 || c == 7)
+               buf = monochrome;
+       else
+               buf = tiparm(set_a_foreground, c);
        if (buf != NULL)
                putpad(buf);
 }
@@ -303,6 +307,7 @@
                        putpad(cursor_home);
                else
                        moveto(0, 0);
+               setcolor(0);
                (void) printf("Score: %d", score);
                curscore = score;
        }
@@ -359,12 +364,12 @@
                        }
                        if (enter_standout_mode) {
                                if (so != cur_so) {
+                                       setcolor(so);
                                        putpad(so ?
                                            enter_standout_mode :
                                            exit_standout_mode);
                                        cur_so = so;
                                }
-                               setcolor(so);
 #ifdef DEBUG
                                char buf[3];
                                snprintf(buf, sizeof(buf), "%d%d", so, so);



Home | Main Index | Thread Index | Old Index