black and white ice

Like lava when that looks the same as water with color Off, render ice
in inverse video if it looks the same as the floor of a room.  (I tried
bold first but the result didn't look very good.)

Done for tty and curses; others may want to follow suit.
This commit is contained in:
PatR
2020-01-28 15:01:41 -08:00
parent 2f0676c1b8
commit c9166bc00c
5 changed files with 38 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ $NHDT-Date: 1580244571 2020/01/28 20:49:31 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.79 $ $NHDT-Date: 1580252492 2020/01/28 23:01:32 $
General Fixes and Modified Features
-----------------------------------
@@ -123,6 +123,8 @@ wearing a wet towel confers "half damage from poison gas" attribute
for end of game disclosure and dumplog, show 'achievements' (previously only
available as an encoded value in xlogfile) along with 'conduct'
more grades of self-appearance than beautiful or handsome vs ugly
when 'color' if Off and 'use_inverse' is On, draw ice on the map in inverse
video if it uses the same character as room floor or as dark floor
Platform- and/or Interface-Specific New Features

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 hack.h $NHDT-Date: 1559227823 2019/05/30 14:50:23 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.105 $ */
/* NetHack 3.6 hack.h $NHDT-Date: 1580252122 2020/01/28 22:55:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.127 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2017. */
/* NetHack may be freely redistributed. See license for details. */
@@ -83,15 +83,16 @@ enum dismount_types {
#define MG_FLAG_NOOVERRIDE 0x01
/* Special returns from mapglyph() */
#define MG_CORPSE 0x01
#define MG_INVIS 0x02
#define MG_DETECT 0x04
#define MG_PET 0x08
#define MG_RIDDEN 0x10
#define MG_STATUE 0x20
#define MG_OBJPILE 0x40 /* more than one stack of objects */
#define MG_BW_LAVA 0x80 /* 'black & white lava': highlight lava if it
can't be distringuished from water by color */
#define MG_CORPSE 0x0001
#define MG_INVIS 0x0002
#define MG_DETECT 0x0004
#define MG_PET 0x0008
#define MG_RIDDEN 0x0010
#define MG_STATUE 0x0020
#define MG_OBJPILE 0x0040 /* more than one stack of objects */
#define MG_BW_LAVA 0x0080 /* 'black & white lava': highlight lava if it
can't be distringuished from water by color */
#define MG_BW_ICE 0x0100 /* similar for ice vs floor */
/* sellobj_state() states */
#define SELL_NORMAL (0)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mapglyph.c $NHDT-Date: 1575830186 2019/12/08 18:36:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.60 $ */
/* NetHack 3.6 mapglyph.c $NHDT-Date: 1580252137 2020/01/28 22:55:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.62 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -162,6 +162,12 @@ unsigned mgflags;
|| g.showsyms[idx]
== g.showsyms[S_water + SYM_OFF_P])) {
special |= MG_BW_LAVA;
/* similar for floor [what about empty doorway?] and ice */
} else if (!iflags.use_color && offset == S_ice
&& (g.showsyms[idx] == g.showsyms[S_room + SYM_OFF_P]
|| g.showsyms[idx]
== g.showsyms[S_darkroom + SYM_OFF_P])) {
special |= MG_BW_ICE;
} else if (offset == S_altar && iflags.use_color) {
int amsk = altarmask_at(x, y); /* might be a mimic */

View File

@@ -688,12 +688,12 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
if ((special & MG_OBJPILE) && iflags.hilite_pile) {
if (iflags.wc_color)
color = 16 + (color * 2) + 1;
else
else /* if (iflags.use_inverse) */
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) {
if ((special & (MG_BW_LAVA | MG_BW_ICE)) != 0 && iflags.use_inverse) {
attr = A_REVERSE; /* mapglyph() only sets this if color is off */
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.c $NHDT-Date: 1578947635 2020/01/13 20:33:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.244 $ */
/* NetHack 3.6 wintty.c $NHDT-Date: 1580252140 2020/01/28 22:55:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -3391,7 +3391,7 @@ int glyph;
int bkglyph UNUSED;
{
int ch;
boolean reverse_on = FALSE;
boolean inverse_on = FALSE;
int color;
unsigned special;
@@ -3429,13 +3429,16 @@ int bkglyph UNUSED;
}
#endif /* TEXTCOLOR */
/* must be after color check; term_end_color may turn off inverse too */
if (((special & MG_PET) && iflags.hilite_pet)
|| ((special & MG_OBJPILE) && iflags.hilite_pile)
|| ((special & MG_DETECT) && iflags.use_inverse)
|| ((special & MG_BW_LAVA) && iflags.use_inverse)) {
/* must be after color check; term_end_color may turn off inverse too;
BW_LAVA and BW_ICE won't ever be set when color is on;
(tried bold for ice but it didn't look very good; inverse is easier
to see although the Valkyrie quest ends up being hard on the eyes) */
if (((special & MG_PET) != 0 && iflags.hilite_pet)
|| ((special & MG_OBJPILE) != 0 && iflags.hilite_pile)
|| ((special & (MG_DETECT | MG_BW_LAVA | MG_BW_ICE)) != 0
&& iflags.use_inverse)) {
term_start_attr(ATR_INVERSE);
reverse_on = TRUE;
inverse_on = TRUE;
}
#if defined(USE_TILES) && defined(MSDOS)
@@ -3445,10 +3448,12 @@ int bkglyph UNUSED;
#endif
g_putch(ch); /* print the character */
if (reverse_on) {
if (inverse_on) {
term_end_attr(ATR_INVERSE);
#ifdef TEXTCOLOR
/* turn off color as well, ATR_INVERSE may have done this already */
/* turn off color as well, turning off ATR_INVERSE may have done
this already and if so, we won't know the current state unless
we do it explicitly */
if (ttyDisplay->color != NO_COLOR) {
term_end_color();
ttyDisplay->color = NO_COLOR;