From af13176b28721a63037bc82e75778121f34a8ae1 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 24 Jul 2009 22:49:03 +0000 Subject: * Another patch by zebez: Display fountain tiles for magic mapping. * Fix 2826781: Black background for Detect Items/Creatures tiles after magic mapping. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@10393 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells2.cc | 2 +- crawl-ref/source/tilepick.cc | 26 +++++++++++++++++++++----- crawl-ref/source/view.cc | 10 +++++++--- crawl-ref/source/view.h | 1 + 4 files changed, 30 insertions(+), 9 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 1183c25e44..9df7dca1ca 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -98,7 +98,7 @@ int detect_items(int pow) set_envmap_detected_item(*ri); #ifdef USE_TILE // Don't replace previously seen items with an unseen one. - if (!is_terrain_seen(*ri)) + if (!is_terrain_seen(*ri) && !is_terrain_mapped(*ri)) env.tile_bk_fg[ri->x][ri->y] = TILE_UNSEEN_ITEM; #endif } diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index e1c3d34efb..e9f17e482b 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -2645,6 +2645,7 @@ void tileidx_unseen(unsigned int &fg, unsigned int &bg, int ch, case '<': bg = TILE_DNGN_STONE_STAIRS_UP; break; case '=': fg = TILE_RING_NORMAL_OFFSET + 1; break; case '>': bg = TILE_DNGN_STONE_STAIRS_DOWN; break; + case '~': case '?': fg = TILE_UNSEEN_ITEM; break; case '[': case ']': fg = TILE_UNSEEN_ARMOUR; break; @@ -2653,10 +2654,10 @@ void tileidx_unseen(unsigned int &fg, unsigned int &bg, int ch, case '_': case 220: case 131: fg = TILE_UNSEEN_ALTAR; break; - case '~': fg = TILE_UNSEEN_ITEM; break; case '{': case 247: case 135: bg = TILE_DNGN_DEEP_WATER; break; + case 244: case 133: bg = TILE_DNGN_BLUE_FOUNTAIN; break; case '}': fg = TILE_MISC_CRYSTAL_BALL_OF_SEEING; break; case 128: //old @@ -4397,8 +4398,8 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected) const coord_def gc(gx, gy); const coord_def ep = view2show(grid2view(gc)); - int t = _tileidx_monster(idx, detected); - int t0 = t & TILE_FLAG_MASK; + int t = _tileidx_monster(idx, detected); + int t0 = t & TILE_FLAG_MASK; int flag = t & (~TILE_FLAG_MASK); if (mons_is_mimic(menv[idx].type)) @@ -4406,7 +4407,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected) const monsters *mon = &menv[idx]; if (!mons_is_known_mimic(mon)) { - // if necessary add item brand + // If necessary add item brand. if (igrd(gc) != NON_ITEM) { if (foreground) @@ -4428,7 +4429,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected) } else if (menv[idx].holiness() == MH_PLANT) { - // if necessary add item brand + // If necessary add item brand. if (igrd(gc) != NON_ITEM) { if (foreground) @@ -4481,6 +4482,21 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected) } else { + // Retain the magic mapped terrain, but don't give away the real + // features either. + if (is_terrain_mapped(gc)) + { + unsigned int feature = grd(gc); + + unsigned int grid_symbol; + unsigned short grid_color; + get_item_symbol(feature, &grid_symbol, &grid_color); + + unsigned int fg; + unsigned int bg; + tileidx_unseen(fg, bg, grid_symbol, gc); + env.tile_bk_bg(gc) = bg; + } env.tile_bk_fg(gc) = t0; } } diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 93d6111ec6..69be6e93d3 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -255,6 +255,11 @@ bool is_terrain_changed( int x, int y ) return (env.map[x][y].flags & MAP_CHANGED_FLAG); } +bool is_terrain_mapped(const coord_def &p) +{ + return (env.map(p).flags & MAP_MAGIC_MAPPED_FLAG); +} + // Used to mark dug out areas, unset when terrain is seen or mapped again. void set_terrain_changed( int x, int y ) { @@ -821,7 +826,7 @@ void clear_map(bool clear_detected_items, bool clear_detected_monsters) if (!clear_detected_monsters && is_envmap_detected_mons(p)) continue; - if (env.map(p).flags & MAP_MAGIC_MAPPED_FLAG) + if (is_terrain_mapped(p)) continue; set_envmap_obj(p, is_terrain_known(p)? grd(p) : DNGN_UNSEEN); @@ -3904,8 +3909,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg, clear_envmap_grid(*ri); #ifdef USE_TILE - if (!wizard_map && is_terrain_known(*ri) - && !(env.map(*ri).flags & MAP_MAGIC_MAPPED_FLAG)) + if (!wizard_map && is_terrain_known(*ri) && !is_terrain_mapped(*ri)) { // Can't use set_envmap_obj because that would // overwrite the gmap. diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index 8c39c23757..233add429d 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -162,6 +162,7 @@ inline bool is_terrain_changed( const coord_def& c ) { return is_terrain_changed(c.x,c.y); } bool is_terrain_known(const coord_def &p); +bool is_terrain_mapped(const coord_def &p); bool is_notable_terrain(dungeon_feature_type ftype); inline bool is_terrain_seen(const coord_def &c) -- cgit v1.2.3-54-g00ecf