From a848660a38b1a5a12c80febd140132346fb7331c Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 10 Jun 2015 04:13:13 -0400 Subject: [PATCH] more background tile work - newsym() should always show glyph even if foreground glyph has not changed - get_bk_glyph should operate on type of floor not on type of glyph. --- src/display.c | 52 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/src/display.c b/src/display.c index 7d85b1eae..d10dc3ce2 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.c $NHDT-Date: 1433899975 2015/06/10 01:32:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.61 $ */ +/* NetHack 3.6 display.c $NHDT-Date: 1433923987 2015/06/10 08:13:07 $ $NHDT-Branch: background_tiles $:$NHDT-Revision: 1.64 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1373,14 +1373,14 @@ int x, y, glyph; return; } - if (gbuf[y][x].glyph != glyph) { +/* if (gbuf[y][x].glyph != glyph) { */ gbuf[y][x].glyph = glyph; gbuf[y][x].new = 1; if (gbuf_start[y] > x) gbuf_start[y] = x; if (gbuf_stop[y] < x) gbuf_stop[y] = x; - } +/* } */ } /* @@ -1700,17 +1700,57 @@ xchar x, y; * squares and the plane of air etc. * * Until that is working correctly in the branch, however, for now - * we just return the standard lit room background. + * we just return NO_GLYPH as an indicator to ignore it. */ STATIC_OVL int get_bk_glyph(x,y) xchar x, y; { - int retglyph = NO_GLYPH; + int idx, bkglyph = NO_GLYPH; struct rm *lev = &levl[x][y]; - return cmap_to_glyph(S_room); + switch (lev->typ) { + case SCORR: + case STONE: + idx = level.flags.arboreal ? S_tree : S_stone; + break; + case ROOM: + idx = S_room; + break; + case CORR: + idx = (lev->waslit || flags.lit_corridor) ? S_litcorr : S_corr; + break; + case ICE: + idx = S_ice; + break; + case AIR: + idx = S_air; + break; + case CLOUD: + idx = S_cloud; + break; + case WATER: + idx = S_water; + break; + default: + idx = S_room; + break; + } + + if (!cansee(x, y) && (!lev->waslit || flags.dark_room)) { + /* Floor spaces are dark if unlit. Corridors are dark if unlit. */ + if (lev->typ == CORR && idx == S_litcorr) + idx = S_corr; + else if (idx == S_room) + idx = (flags.dark_room && iflags.use_color) ? + (DARKROOMSYM) : S_stone; + } + + if (idx != S_room) + bkglyph = cmap_to_glyph(idx); + + return bkglyph; } /* -------------------------------------------------------------------------