summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-11 00:41:28 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-11 00:41:28 +0000
commita84ce421489674dd1078dcf642011c8ef82b8cf3 (patch)
tree84a0f048e43b159f55761d447b70d32dd8bd3d93 /crawl-ref/source
parentaece73f4451a17501468cae9df21daa6548432e1 (diff)
downloadcrawl-ref-a84ce421489674dd1078dcf642011c8ef82b8cf3.tar.gz
crawl-ref-a84ce421489674dd1078dcf642011c8ef82b8cf3.zip
Turning back on minimap for labyrinths, but fixing it so that it recenters during map rot, as if the forgotten squares were never seen. (Sorry, jpeg. If you can see it using 'X', I think you should be able to also see it on the minimap.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8404 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/player.cc4
-rw-r--r--crawl-ref/source/tile2.cc7
-rw-r--r--crawl-ref/source/tilepick.cc10
-rw-r--r--crawl-ref/source/tilereg.cc37
-rw-r--r--crawl-ref/source/tilereg.h3
-rw-r--r--crawl-ref/source/tiles.h2
-rw-r--r--crawl-ref/source/tilesdl.cc7
-rw-r--r--crawl-ref/source/tilesdl.h1
8 files changed, 51 insertions, 20 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e4f94a9a71..d35261d001 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2926,6 +2926,10 @@ void forget_map(unsigned char chance_forgotten, bool force)
#endif
}
}
+
+#ifdef USE_TILE
+ tiles.update_minimap_bounds();
+#endif
}
void gain_exp( unsigned int exp_gained, unsigned int* actual_gain,
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index a4f5386eff..dc6eb07898 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -29,13 +29,6 @@ REVISION("$Rev$");
#include "tiles.h"
#include "transfor.h"
-// In a labyrinth, don't display the minimap.
-bool player_in_mini_mappable_area()
-{
- return (player_in_mappable_area()
- && you.level_type != LEVEL_LABYRINTH);
-}
-
void tile_default_flv(level_area_type lev, branch_type br, tile_flavour &flv)
{
flv.wall = TILE_WALL_NORMAL;
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index a6366496c0..29613058ba 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -44,12 +44,10 @@ void TileNewLevel(bool first_time)
{
tiles.clear_minimap();
- if (player_in_mini_mappable_area())
- {
- for (int y = 0; y < GYM; y++)
- for (int x = 0; x < GXM; x++)
- tiles.update_minimap(x, y);
- }
+ for (int y = 0; y < GYM; y++)
+ for (int x = 0; x < GXM; x++)
+ tiles.update_minimap(x, y);
+
if (first_time)
tile_init_flavour();
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 9193ea8749..700f1caeed 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1783,7 +1783,7 @@ void MapRegion::render()
m_buf_lines.draw();
}
-void MapRegion::update_offsets()
+void MapRegion::recenter()
{
// adjust offsets to center map
ox = (wx - dx * (m_max_gx - m_min_gx)) / 2;
@@ -1805,7 +1805,38 @@ void MapRegion::set(int gx, int gy, map_feature f)
m_min_gy = std::min(m_min_gy, gy);
m_max_gy = std::max(m_max_gy, gy);
- update_offsets();
+ recenter();
+}
+
+void MapRegion::update_bounds()
+{
+ int min_gx = m_min_gx;
+ int max_gx = m_max_gx;
+ int min_gy = m_min_gy;
+ int max_gy = m_max_gy;
+
+ m_min_gx = GXM;
+ m_max_gx = 0;
+ m_min_gy = GYM;
+ m_max_gy = 0;
+
+ for (int x = min_gx; x <= max_gx; x++)
+ {
+ for (int y = min_gy; y <= max_gy; y++)
+ {
+ map_feature f = (map_feature)m_buf[x + y * mx];
+ if (f == MF_UNSEEN)
+ continue;
+
+ m_min_gx = std::min(m_min_gx, x);
+ m_max_gx = std::max(m_max_gx, x);
+ m_min_gy = std::min(m_min_gy, y);
+ m_max_gy = std::max(m_max_gy, y);
+ }
+ }
+
+ recenter();
+ m_dirty = true;
}
void MapRegion::set_window(const coord_def &start, const coord_def &end)
@@ -1828,7 +1859,7 @@ void MapRegion::clear()
m_win_end.x = -1;
m_win_end.y = -1;
- update_offsets();
+ recenter();
if (m_buf)
memset(m_buf, 0, sizeof(*m_buf) * mx * my);
diff --git a/crawl-ref/source/tilereg.h b/crawl-ref/source/tilereg.h
index 293896f31e..7bee88c983 100644
--- a/crawl-ref/source/tilereg.h
+++ b/crawl-ref/source/tilereg.h
@@ -398,10 +398,11 @@ public:
void init_colours();
void set(int gx, int gy, map_feature f);
void set_window(const coord_def &start, const coord_def &end);
+ void update_bounds();
protected:
virtual void on_resize();
- void update_offsets();
+ void recenter();
void pack_buffers();
map_colour m_colours[MF_MAX];
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index 2c6460d819..54e513ae79 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -39,8 +39,6 @@ struct demon_data
int wings;
};
-bool player_in_mini_mappable_area();
-
//*tile1.cc: get data from core part and drives tile drawing codes
//**convert in-game data to tile index
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index a00edd2de6..c1db3c8064 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1089,7 +1089,7 @@ void TilesFramework::redraw()
void TilesFramework::update_minimap(int gx, int gy)
{
- if (!player_in_mini_mappable_area())
+ if (!player_in_mappable_area())
return;
int object = env.map[gx][gy].object;
@@ -1150,6 +1150,11 @@ void TilesFramework::clear_minimap()
m_region_map->clear();
}
+void TilesFramework::update_minimap_bounds()
+{
+ m_region_map->update_bounds();
+}
+
static void _fill_item_info(InventoryTile &desc, const item_def &item)
{
desc.tile = tileidx_item(item);
diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h
index 0720e48663..d9d3380b84 100644
--- a/crawl-ref/source/tilesdl.h
+++ b/crawl-ref/source/tilesdl.h
@@ -104,6 +104,7 @@ public:
void update_minimap(int gx, int gy);
void update_minimap(int gx, int gy, map_feature f);
void clear_minimap();
+ void update_minimap_bounds();
void update_inventory();
void set_need_redraw();