summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-20 02:31:58 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-20 02:31:58 +0000
commite1f1dbd2ba852c17344b86e9fc131936b4258606 (patch)
tree4bee0b362273c8335b50befd105974a28b498ede /crawl-ref/source
parented05654d265fc1892910a9c6958880837d67560a (diff)
downloadcrawl-ref-e1f1dbd2ba852c17344b86e9fc131936b4258606.tar.gz
crawl-ref-e1f1dbd2ba852c17344b86e9fc131936b4258606.zip
[1940992] Fixed minimap travel/view issues. This fixes both the "off by three squares" as well as an unmentioned "off by two pixels" issue.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4401 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/guic-win.cc1
-rw-r--r--crawl-ref/source/guic-x11.cc2
-rw-r--r--crawl-ref/source/guic.cc7
-rw-r--r--crawl-ref/source/guic.h3
-rw-r--r--crawl-ref/source/libgui.cc6
5 files changed, 9 insertions, 10 deletions
diff --git a/crawl-ref/source/guic-win.cc b/crawl-ref/source/guic-win.cc
index 7d1894dffc..432f14d8c8 100644
--- a/crawl-ref/source/guic-win.cc
+++ b/crawl-ref/source/guic-win.cc
@@ -602,7 +602,6 @@ void MapRegionClass::draw_data(unsigned char *buf)
inc_y0 = - dx * inc_x0 + BUF_IDX(0, 0, 0, 1);
// erase old markers
- const int marker_length = 2;
for (int j = 0; j < dy * marker_length; j++)
*(pDibBit0 + BUF_IDX(px, 0, dx/2 + x_margin, j)) = MAP_BLACK;
diff --git a/crawl-ref/source/guic-x11.cc b/crawl-ref/source/guic-x11.cc
index 54027f0353..402b8680d8 100644
--- a/crawl-ref/source/guic-x11.cc
+++ b/crawl-ref/source/guic-x11.cc
@@ -326,8 +326,6 @@ void MapRegionClass::draw_data(unsigned char *buf)
if (!flag)
return;
- const int marker_length = 2;
-
for (int yy = 0; yy < dy * marker_length; yy++)
XPutPixel(backbuf, px*dx+dx/2 + x_margin, yy, map_pix[MAP_BLACK]);
diff --git a/crawl-ref/source/guic.cc b/crawl-ref/source/guic.cc
index 9e3eb26505..daa9266150 100644
--- a/crawl-ref/source/guic.cc
+++ b/crawl-ref/source/guic.cc
@@ -299,7 +299,7 @@ void TileRegionClass::resize(int mx0, int my0, int dx0, int dy0)
if (dy0 != 0) dy = dy0;
}
-MapRegionClass::MapRegionClass(int x, int y, int o_x, int o_y, bool iso)
+MapRegionClass::MapRegionClass(int x, int y, int o_x, int o_y, int marker_len)
{
int i;
@@ -315,6 +315,7 @@ MapRegionClass::MapRegionClass(int x, int y, int o_x, int o_y, bool iso)
x_margin = o_x;
y_margin = o_y;
+ marker_length = marker_len;
force_redraw = false;
SysInit(x, y, o_x, o_y);
@@ -469,8 +470,8 @@ bool RegionClass::mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy)
bool MapRegionClass::mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy)
{
- int x = mouse_x - ox;
- int y = mouse_y - oy;
+ int x = mouse_x - ox - x_margin;
+ int y = mouse_y - oy - y_margin;
if ( x < 0 || y < 0 ) return false;
x /= dx;
y /= dy;
diff --git a/crawl-ref/source/guic.h b/crawl-ref/source/guic.h
index 0c13d20130..b49c2b4d5f 100644
--- a/crawl-ref/source/guic.h
+++ b/crawl-ref/source/guic.h
@@ -359,6 +359,7 @@ class MapRegionClass :public RegionClass
int my2;
int x_margin;
int y_margin;
+ int marker_length;
unsigned char *mbuf;
bool force_redraw;
bool mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy);
@@ -375,7 +376,7 @@ class MapRegionClass :public RegionClass
void set_col(int col, int x, int y);
int get_col(int x, int y);
- MapRegionClass(int x, int y, int o_x, int o_y, bool iso);
+ MapRegionClass(int x, int y, int o_x, int o_y, int marker_length);
void SysInit(int x, int y, int o_x, int o_y);
void SysDeinit();
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 4ade6d9bb3..a63497d717 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -596,7 +596,7 @@ void libgui_init()
new MapRegionClass(MAP_XMAX+map_margin,
MAP_YMAX+map_margin,
map_margin, map_margin,
- false);
+ 2);
region_map->id = REGION_MAP;
region_map->dx = map_px;
region_map->dy = map_px;
@@ -1153,8 +1153,8 @@ int convert_cursor_pos(int mx, int my, int *cx, int *cy)
if (id == REGION_MAP)
{
- x -= gmap_ox + region_map->x_margin + 1;
- y -= gmap_oy + region_map->y_margin + 1;
+ x -= gmap_ox - region_map->marker_length + 1;
+ y -= gmap_oy - region_map->marker_length + 1;
}
if (id == REGION_INV1 || id == REGION_INV2)