From 85e80f1e3e867c758793b7bb9d01493995a82862 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 8 Jun 2015 20:10:43 -0400 Subject: [PATCH] provide bkglyphs Changes to be committed: modified: src/display.c --- src/display.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/display.c b/src/display.c index ae1dc0b2f..22a84d258 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.c $NHDT-Date: 1433806584 2015/06/08 23:36:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */ +/* NetHack 3.6 display.c $NHDT-Date: 1433808638 2015/06/09 00:10:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -124,6 +124,7 @@ STATIC_DCL int FDECL(swallow_to_glyph, (int, int)); STATIC_DCL void FDECL(display_warning, (struct monst *)); STATIC_DCL int FDECL(check_pos, (int, int, int)); +STATIC_DCL int FDECL(get_bk_glyph, (XCHAR_P, XCHAR_P)); /*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */ #ifdef WA_VERBOSE @@ -1426,7 +1427,7 @@ int start, stop, y; for (x = start; x <= stop; x++) if (gbuf[y][x].glyph != cmap_to_glyph(S_stone)) - print_glyph(WIN_MAP, x, y, gbuf[y][x].glyph, NO_GLYPH); + print_glyph(WIN_MAP, x, y, gbuf[y][x].glyph, get_bk_glyph(x,y)); } void @@ -1475,7 +1476,7 @@ int cursor_on_u; register gbuf_entry *gptr = &gbuf[y][x = gbuf_start[y]]; for (; x <= gbuf_stop[y]; gptr++, x++) if (gptr->new) { - print_glyph(WIN_MAP, x, y, gptr->glyph, NO_GLYPH); + print_glyph(WIN_MAP, x, y, gptr->glyph, get_bk_glyph(x, y)); gptr->new = 0; } } @@ -1692,6 +1693,31 @@ xchar x, y; return gbuf[y][x].glyph; } +/* + * This is used to get the glyph for background to merge into + * tile ports to improve the appearance of stuff on dark room + * squares and the plane of air there. + */ +STATIC_OVL int +get_bk_glyph(x,y) +xchar x, y; +{ + int retglyph = NO_GLYPH; + struct rm *lev = &levl[x][y]; + + retglyph = back_to_glyph(x, y); /* assumes hero can see x,y */ + if (!cansee(x, y) && !lev->waslit) { + /* Floor spaces are dark if unlit. Corridors are dark if unlit. */ + if (lev->typ == ROOM && retglyph == cmap_to_glyph(S_room)) + retglyph = cmap_to_glyph((flags.dark_room && iflags.use_color) + ? (DARKROOMSYM) + : S_stone); + else if (lev->typ == CORR && retglyph == cmap_to_glyph(S_litcorr)) + retglyph = cmap_to_glyph(S_corr); + } + return retglyph; +} + /* ------------------------------------------------------------------------- */ /* Wall Angle --------------------------------------------------------------