From f116902db8e7f917df91a3a1e775cc43cf7dd47a Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 30 Mar 2008 20:43:15 +0000 Subject: Fix 1921769: Exclusion squares on the tiles minimap sometimes not being updated. Also add yet another minimap colour option for the centre of an exclusion (defaults to darkblue). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3958 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/externs.h | 1 + crawl-ref/source/initfile.cc | 6 ++++++ crawl-ref/source/libgui.cc | 17 ++++++++--------- crawl-ref/source/misc.cc | 29 +++++++++++++++++------------ crawl-ref/source/player.cc | 22 ++++++++++++++-------- crawl-ref/source/travel.cc | 5 +++-- 6 files changed, 49 insertions(+), 31 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index ff31e69961..7bebed1085 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1784,6 +1784,7 @@ public: char tile_water_col; char tile_lava_col; char tile_excluded_col; + char tile_excl_centre_col; #endif #ifdef WIN32TILES bool use_dos_char; diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index fa50bf5ab3..35582ac183 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -825,6 +825,7 @@ void game_options::reset_options() tile_water_col = MAP_MDGREY; tile_lava_col = MAP_MDGREY; tile_excluded_col = MAP_DKCYAN; + tile_excl_centre_col = MAP_DKBLUE; #endif #ifdef WIN32TILES @@ -2834,6 +2835,11 @@ void game_options::read_option_line(const std::string &str, bool runscript) tile_excluded_col = _str_to_tile_colour(field); } + else if (key == "tile_excl_centre_col" || key == "tile_excl_center_col") + { + tile_excl_centre_col = + _str_to_tile_colour(field); + } #endif #ifdef WIN32TILES diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index 7bb0cfa5d4..311a4a22d4 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -311,7 +311,7 @@ InvAction inv_action = INV_NUMACTIONS; static void _gui_set_mouse_inv(int idx, InvAction act) { - inv_idx = idx; + inv_idx = idx; inv_action = act; } @@ -377,8 +377,13 @@ void GmapUpdate(int x, int y, int what, bool upd_tile) } } - if (c == Options.tile_floor_col && is_excluded( coord_def(x,y) )) - c = Options.tile_excluded_col; + if (c == Options.tile_floor_col || c == Options.tile_item_col) + { + if (is_exclude_root( coord_def(x,y) )) + c = Options.tile_excl_centre_col; + else if (c == Options.tile_floor_col && is_excluded(coord_def(x,y))) + c = Options.tile_excluded_col; + } } int oldc = gmap_data[x][y]; @@ -430,12 +435,8 @@ void GmapInit(bool upd_tile) gmap_min_y = gmap_max_y = you.y_pos - 1; for (y = 0; y < GYM; y++) - { for (x = 0; x < GXM; x++) - { GmapUpdate(x, y, env.map[x][y].glyph(), upd_tile); - } - } } void GmapDisplay(int linex, int liney) @@ -445,9 +446,7 @@ void GmapDisplay(int linex, int liney) int ox, oy; for (int x = 0; x < GXM*GYM; x++) - { buf2[x] = 0; - } ox = ( gmap_min_x + (GXM - 1 - gmap_max_x) ) / 2; oy = ( gmap_min_y + (GYM - 1 - gmap_max_y) ) / 2; diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 1b4a9c1cc1..90f3d53e9e 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -911,8 +911,10 @@ void up_stairs(dungeon_feature_type force_stair, exit_stair_message(stair_find, true); if (old_where != you.where_are_you && you.level_type == LEVEL_DUNGEON) + { mprf("Welcome back to %s!", branches[you.where_are_you].longname); + } #ifdef USE_TILE const bool newlevel = @@ -925,10 +927,6 @@ void up_stairs(dungeon_feature_type force_stair, you.turn_is_over = true; -#ifdef USE_TILE - TileNewLevel(newlevel); -#endif // USE_TILE - save_game_state(); new_level(); @@ -956,6 +954,10 @@ void up_stairs(dungeon_feature_type force_stair, // Tell stash-tracker and travel that we've changed levels. trackers_init_new_level(true); +#ifdef USE_TILE + TileNewLevel(newlevel); +#endif // USE_TILE + if (collect_travel_data) { // Update stair information for the stairs we just ascended, and the @@ -986,8 +988,8 @@ void up_stairs(dungeon_feature_type force_stair, // to Hell as shortcuts between dungeon levels, which won't work, // and will confuse the dickens out of the player (well, it confused // the dickens out of me when it happened). - if (new_level_id.branch == BRANCH_MAIN_DUNGEON && - old_level_id.branch == BRANCH_VESTIBULE_OF_HELL) + if (new_level_id.branch == BRANCH_MAIN_DUNGEON + && old_level_id.branch == BRANCH_VESTIBULE_OF_HELL) { lp.id.depth = -1; lp.pos.x = lp.pos.y = -1; @@ -1019,7 +1021,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, entry_cause_type entry_cause ) { int i; - const level_area_type old_level_type = you.level_type; + const level_area_type old_level_type = you.level_type; const dungeon_feature_type stair_find = force_stair? force_stair : grd[you.x_pos][you.y_pos]; @@ -1425,7 +1427,9 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, you.your_level++; else if (level_type_exits_down(you.level_type) && !level_type_exits_down(old_level_type)) + { you.your_level--; + } switch (you.level_type) @@ -1469,10 +1473,6 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, break; } -#ifdef USE_TILE - TileNewLevel(newlevel); -#endif - you.turn_is_over = true; save_game_state(); @@ -1492,6 +1492,11 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, mpr( "You sense a powerful magical force warping space.", MSGCH_WARN ); trackers_init_new_level(true); + +#ifdef USE_TILE + TileNewLevel(newlevel); +#endif // USE_TILE + if (collect_travel_data) { // Update stair information for the stairs we just descended, and the @@ -1506,7 +1511,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, // First we update the old level's stair. level_pos lp; - lp.id = new_level_id; + lp.id = new_level_id; lp.pos.x = you.x_pos; lp.pos.y = you.y_pos; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index a23525e898..bdc7ba2615 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2762,7 +2762,6 @@ void forget_map(unsigned char chance_forgotten, bool force) return; for (unsigned char xcount = 0; xcount < GXM; xcount++) - { for (unsigned char ycount = 0; ycount < GYM; ycount++) { if (!see_grid(xcount, ycount) && @@ -2771,7 +2770,7 @@ void forget_map(unsigned char chance_forgotten, bool force) env.map[xcount][ycount].clear(); } } - } + #ifdef USE_TILE GmapInit(false); tile_clear_buf(); @@ -5120,9 +5119,12 @@ int count_worn_ego( int which_ego ) { int result = 0; for ( int slot = EQ_CLOAK; slot <= EQ_BODY_ARMOUR; ++slot ) - if (you.equip[slot] != -1 && - get_armour_ego_type(you.inv[you.equip[slot]]) == which_ego) + if (you.equip[slot] != -1 + && get_armour_ego_type(you.inv[you.equip[slot]]) == which_ego) + { result++; + } + return result; } @@ -6643,17 +6645,21 @@ std::vector player::get_all_place_info(bool visited_only, for (int i = 0; i < NUM_BRANCHES; i++) { - if ((visited_only && branch_info[i].num_visits == 0) || - (dungeon_only && branch_info[i].level_type != LEVEL_DUNGEON)) + if (visited_only && branch_info[i].num_visits == 0 + || dungeon_only && branch_info[i].level_type != LEVEL_DUNGEON) + { continue; + } list.push_back(branch_info[i]); } for (int i = 0; i < (NUM_LEVEL_AREA_TYPES - 1); i++) { - if ((visited_only && non_branch_info[i].num_visits == 0) || - (dungeon_only && non_branch_info[i].level_type != LEVEL_DUNGEON)) + if (visited_only && non_branch_info[i].num_visits == 0 + || dungeon_only && non_branch_info[i].level_type != LEVEL_DUNGEON) + { continue; + } list.push_back(non_branch_info[i]); } diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 1a1363d7ea..d3315077c2 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -251,13 +251,14 @@ bool is_exclude_root(const coord_def &p) // update Gmap for squares surrounding exclude centre static void tile_exclude_gmap_update(const coord_def p) { - for (int x = -8; x < 8; x++) - for (int y = -8; y < 8; y++) + for (int x = -8; x <= 8; x++) + for (int y = -8; y <= 8; y++) { int px = p.x+x, py = p.y+y; if (in_bounds(coord_def(px,py))) GmapUpdate(px, py, env.map[px][py].glyph(), true); } + GmapDisplay(p.x,p.y); } #endif -- cgit v1.2.3-54-g00ecf