]> granicus.if.org Git - nethack/commitdiff
fix use_inverse (aka wc_inverse) for curses
authorPatR <rankin@nethack.org>
Mon, 14 Oct 2019 09:28:27 +0000 (02:28 -0700)
committerPatR <rankin@nethack.org>
Mon, 14 Oct 2019 09:28:27 +0000 (02:28 -0700)
Highlighting for monsters shown due to extended monster detection and
for lava shown in black and white didn't work because that keys off
of 'iflags.use_inverse' (actually a macro for 'iflags.wc_inverse') and
curses wasn't enabling that window-capability option.  To be fair, it
was probably unconditional at the time the curses interface was first
developed.  It checked for whether a monster was supposed to be drawn
with inverse highlighting but wouldn't draw it that way because the
flag was always false.  Inverse b&w lava is relatively new and curses
hadn't been taught about it.

Various other things such as pets (if hilite_pet is on) and object
piles (if hilite_pile is on) get highlighted with inverse video when
use_color is off, regardless of whether use_inverse is on or off.
That's probably a bug.

doc/fixes36.3
src/options.c
win/curses/cursinit.c
win/curses/cursmain.c

index ee3964155573d56e493721d463a73351d7a9bcb5..2cc6a5b6e0ce8b1fa782901075eda33d183cd51f 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.132 $ $NHDT-Date: 1570872701 2019/10/12 09:31:41 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.137 $ $NHDT-Date: 1571045295 2019/10/14 09:28:15 $
 
 This fixes36.3 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -276,6 +276,10 @@ curses: disable the attempt to support Ctrl+Left_click as an alternate way
        OSX 10.11) documentation and things didn't work as intended
 curses: menu coloring required that both 'menucolors' and 'guicolor' be On;
        for menus, override guicolor with more-specific menucolors
+curses: support symset:DECgraphics for map display
+curses: enable the 'use_inverse' boolean option (via wincap WC_INVERSE flag)
+       for extended monster detection and black&white lava; forced to True
+       to override default of False (for tty's benefit)
 curses+'perm_invent': entries were wrapping without any control; usually not
        noticeable because next entry overwrote, but visible for final entry
        when whole inventory fit within the available height; looked ok with
index 2e494948a4be6484e00e46ff0d09e88fb662f96e..cc39f585be4b7895a85969cc6b52a59e845958e8 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 options.c       $NHDT-Date: 1567240693 2019/08/31 08:38:13 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.369 $ */
+/* NetHack 3.6 options.c       $NHDT-Date: 1571045295 2019/10/14 09:28:15 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.376 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Michael Allison, 2008. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -826,8 +826,9 @@ initoptions_init()
 
     iflags.wc_align_message = ALIGN_TOP;
     iflags.wc_align_status = ALIGN_BOTTOM;
-    /* these are currently only used by curses */
+    /* used by tty and curses */
     iflags.wc2_statuslines = 2;
+    /* only used by curses */
     iflags.wc2_windowborders = 2; /* 'Auto' */
 
     /* since this is done before init_objects(), do partial init here */
index 2555e71de5faff36a07f960288bd8cd6ca72b877..7c5ac185b015c8e86edc0c5bfb81bfee0c84f1eb 100644 (file)
@@ -810,6 +810,9 @@ curses_init_options()
 */
 #endif /* PDCURSES */
 
+    /* FIXME: this overrides explicit OPTIONS=!use_inverse */
+    iflags.wc_inverse = TRUE; /* aka iflags.use_inverse; default is False */
+
     /* fix up pet highlighting */
     if (iflags.wc2_petattr == -1) /* shouldn't happen */
         iflags.wc2_petattr = A_NORMAL;
index 91a5ffac1a5ad4737eff6c79880063607c157678..d252b5b6dbf2c6460743f6604033f5b99e4b0bf8 100644 (file)
@@ -29,7 +29,8 @@ extern long curs_mesg_suppress_turn; /* from cursmesg.c */
 /* Interface definition, for windows.c */
 struct window_procs curses_procs = {
     "curses",
-    (WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_HILITE_PET
+    (WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_INVERSE
+     | WC_HILITE_PET
 #ifdef NCURSES_MOUSE_VERSION /* (this macro name works for PDCURSES too) */
      | WC_MOUSE_SUPPORT
 #endif
@@ -675,6 +676,11 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
             else
                 attr = A_REVERSE;
         }
+        /* water and lava look the same except for color; when color is off,
+           render lava in inverse video so that they look different */
+        if ((special & MG_BW_LAVA) && iflags.use_inverse) {
+            attr = A_REVERSE; /* mapglyph() only sets this if color is off */
+        }
     }
 
     curses_putch(wid, x, y, ch, color, attr);