From b33c3381e64fd5aa4bfdcec6fdda03b681bdff66 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 16 Jun 2015 06:23:28 -0400 Subject: [PATCH] update master's version of display.c Incorporate a few pieces of in-progress code into master so that it isn't left in an odd state, thus prompting patches. --- include/flag.h | 7 ++++--- src/display.c | 54 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/include/flag.h b/include/flag.h index b86dcad4a..bc405ba58 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 flag.h $NHDT-Date: 1433983706 2015/06/11 00:48:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.86 $ */ +/* NetHack 3.6 flag.h $NHDT-Date: 1434450203 2015/06/16 10:23:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.87 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -207,8 +207,9 @@ struct instance_flags { boolean rlecomp; /* run-length comp of levels when writing savefile */ uchar num_pad_mode; boolean echo; /* 1 to echo characters */ - boolean use_menu_color; /* use color in menus; only if wc_color */ - boolean use_status_hilites; /* use color in status */ + boolean use_menu_color; /* use color in menus; only if wc_color */ + boolean use_status_hilites; /* use color in status line */ + boolean use_background_glyph; /* use background glyph when appropriate */ #if 0 boolean DECgraphics; /* use DEC VT-xxx extended character set */ boolean IBMgraphics; /* use IBM extended character set */ diff --git a/src/display.c b/src/display.c index 8a5489538..b1d7277d7 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.c $NHDT-Date: 1434447701 2015/06/16 09:41:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */ +/* NetHack 3.6 display.c $NHDT-Date: 1434450195 2015/06/16 10:23:15 $ $NHDT-Branch: master $:$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,7 +1373,7 @@ int x, y, glyph; return; } - if (gbuf[y][x].glyph != glyph) { + if (gbuf[y][x].glyph != glyph || iflags.use_background_glyph) { gbuf[y][x].glyph = glyph; gbuf[y][x].new = 1; if (gbuf_start[y] > x) @@ -1707,15 +1707,51 @@ STATIC_OVL int get_bk_glyph(x,y) xchar x, y; { -#if 1 - int retglyph = NO_GLYPH; - nhUse(x); - nhUse(y); -#else + int idx, bkglyph = NO_GLYPH; struct rm *lev = &levl[x][y]; -#endif - return retglyph; + if (iflags.use_background_glyph) { + 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; } /* ------------------------------------------------------------------------- -- 2.40.0