From 685985f831e2d385aac7b4c68b10f994b1c49b2c Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 24 Jul 2009 22:54:44 +0000 Subject: Port r10393 (magic mapping fixes for tiles) to trunk. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10394 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells2.cc | 2 +- crawl-ref/source/tilepick.cc | 28 +++++++++++++++++++++------- crawl-ref/source/view.cc | 10 +++++++--- crawl-ref/source/view.h | 1 + 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 878c17a84c..1a875dee08 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -99,7 +99,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 0fc0ce24e8..20b113957f 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -92,9 +92,7 @@ int tile_unseen_flag(const coord_def& gc) return TILE_FLAG_MM_UNSEEN; } else - { return TILE_FLAG_UNSEEN; - } } // Special case for *taurs which have a different tile @@ -2662,6 +2660,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; @@ -2670,10 +2669,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 @@ -4321,8 +4320,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)) @@ -4330,7 +4329,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) @@ -4352,7 +4351,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) @@ -4405,6 +4404,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 9715f16a11..3fb2de043f 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); @@ -3933,8 +3938,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 a7214b43aa..fd32f00931 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -163,6 +163,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