]> granicus.if.org Git - nethack/commitdiff
water vs lava
authorPatR <rankin@nethack.org>
Fri, 13 May 2016 14:22:08 +0000 (07:22 -0700)
committerPatR <rankin@nethack.org>
Fri, 13 May 2016 14:22:08 +0000 (07:22 -0700)
When underwater, map adjacent lava as lava rather than as "not water".
The Valkyrie quest has lava adjacent to water and the hero ought to
be able recognize it while immersed so she doesn't try to climb out
of water directly into lava.

When the color option is disabled and lava uses the same symbol as
pool or as water (which is the case for default ascii, DECgraphics,
and IBMgraphics), apply the detected-monster display effect to lava.
For tty, this will draw it in inverse video if the use_inverse
option is enabled.  (Assumes non-tty will nearly always be using
color so not care.)  Creating a separate mapglyph special attribute
for B&W lava instead of overloading MG_DETECT ought to be done but
I didn't want to modify any interface code.

doc/fixes36.1
src/display.c
src/mapglyph.c

index a71fd3756daf0bb97f5ba702911591d272d5922f..2e2bdd83665a0f2463ae64c0842c8244f4998a39 100644 (file)
@@ -242,6 +242,7 @@ after using detection magic or #terrain while underwater, then leaving water
        and saving while on land, save would flag you as underwater again and
        then restore would limit the map display accordingly; next move would
        notice, retify things, and report "you are on solid land again"
+can see or feel adjacent lava when underwater
 
 
 Fixes to Post-3.6.0 Problems that Were Exposed Via git Respository
@@ -271,6 +272,8 @@ tty: rename struct variable 'filter' (role.c) and function 'winch()' (wintty.c)
        to avoid conflicts with <curses.h>
 tty: skip selector letter and selection indicator (-,+,#) during menu coloring
 tty: '>' no longer closes a menu window
+tty: if color is disabled and use_inverse is enabled, display lava in inverse
+       video so that it is visually distinguishable from water
 unix/X11: in top level Makefile, some commented out definitions of VARDATND
        misspelled pilemark.xbm (as pilemark.xpm)
 unix: options file with CR+LF line ends and an invalid option line resulted in
index e804aaf587d7c7bec18dc5aedf5822b379f20138..600f3fc9e35577aefebd8c645dcdb23e46ac6ff2 100644 (file)
@@ -540,7 +540,7 @@ xchar x, y;
         return;
 
     /* The hero can't feel non pool locations while under water. */
-    if (Underwater && !Is_waterlevel(&u.uz) && !is_pool(x, y))
+    if (Underwater && !Is_waterlevel(&u.uz) && !is_pool_or_lava(x, y))
         return;
 
     /* Set the seen vector as if the hero had seen it.
@@ -701,18 +701,9 @@ register int x, y;
         return;
     }
     if (Underwater && !Is_waterlevel(&u.uz)) {
-        /* don't do anything unless (x,y) is an adjacent underwater position
-         */
-        int dx, dy;
-        if (!is_pool(x, y))
-            return;
-        dx = x - u.ux;
-        if (dx < 0)
-            dx = -dx;
-        dy = y - u.uy;
-        if (dy < 0)
-            dy = -dy;
-        if (dx > 1 || dy > 1)
+        /* when underwater, don't do anything unless <x,y> is an
+           adjacent underwater or lava position */
+        if (!is_pool_or_lava(x, y) || distu(x, y) > 2)
             return;
     }
 
@@ -1103,9 +1094,13 @@ int mode;
                     show_glyph(x, y, cmap_to_glyph(S_stone));
     }
 
+    /*
+     * TODO?  Should this honor Xray radius rather than force radius 1?
+     */
+
     for (x = u.ux - 1; x <= u.ux + 1; x++)
         for (y = u.uy - 1; y <= u.uy + 1; y++)
-            if (isok(x, y) && is_pool(x, y)) {
+            if (isok(x, y) && is_pool_or_lava(x, y)) {
                 if (Blind && !(x == u.ux && y == u.uy))
                     show_glyph(x, y, cmap_to_glyph(S_stone));
                 else
index a8f56386744780408e7338a8fa498a1a024ac54b..c0c64016477b4a223154e61cefa2b91fc4456e88 100644 (file)
@@ -124,11 +124,19 @@ unsigned *ospecial;
                 color = NO_COLOR;
 #ifdef TEXTCOLOR
         /* provide a visible difference if normal and lit corridor
-         * use the same symbol */
+           use the same symbol */
         } else if (iflags.use_color && offset == S_litcorr
                    && showsyms[idx] == showsyms[S_corr + SYM_OFF_P]) {
             color = CLR_WHITE;
 #endif
+        /* try to provide a visible difference between water and lava
+           if they use the same symbol and color is disabled */
+        } else if (!iflags.use_color && offset == S_lava
+                   && (showsyms[idx] == showsyms[S_pool + SYM_OFF_P]
+                       || showsyms[idx] == showsyms[S_water + SYM_OFF_P])) {
+            /* temporary? hack; makes tty use inverse video if the
+               corresponding boolean option is enabled */
+            special |= MG_DETECT;
         } else {
             cmap_color(offset);
         }