summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorEnne Walker <ennewalker@users.sourceforge.net>2009-10-17 15:40:06 -0400
committerEnne Walker <ennewalker@users.sourceforge.net>2009-10-17 15:40:06 -0400
commitf75f1e6013d86d0bf35537a228ccda7ba7ce67f2 (patch)
tree0e224ab51e2a650183438f7b062fa10d178d77a2 /crawl-ref
parente14cd499af0993f559a980cb761cbbfe6eaf70fa (diff)
downloadcrawl-ref-f75f1e6013d86d0bf35537a228ccda7ba7ce67f2.tar.gz
crawl-ref-f75f1e6013d86d0bf35537a228ccda7ba7ce67f2.zip
Fixing off-by-one issues in the tiles build due to the off-by-one fix to crawl_view. (This was manifesting as weird artifacts or crashes.)
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/externs.h4
-rw-r--r--crawl-ref/source/tilepick.cc22
-rw-r--r--crawl-ref/source/view.cc21
3 files changed, 22 insertions, 25 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index bf8cf2df53..de5b3fb266 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1724,8 +1724,8 @@ public:
FixedArray<unsigned int, GXM, GYM> tile_bk_bg;
FixedArray<tile_flavour, GXM, GYM> tile_flv;
// indexed by (show-1) coords
- FixedArray<unsigned int,ENV_SHOW_DIAMETER-2,ENV_SHOW_DIAMETER-2> tile_fg;
- FixedArray<unsigned int,ENV_SHOW_DIAMETER-2,ENV_SHOW_DIAMETER-2> tile_bg;
+ FixedArray<unsigned int, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER> tile_fg;
+ FixedArray<unsigned int, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER> tile_bg;
tile_flavour tile_default;
#endif
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 2d0b435496..7fffae2f1d 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -4524,7 +4524,7 @@ void tile_draw_floor()
for (int cy = 0; cy < env.tile_fg.height(); cy++)
for (int cx = 0; cx < env.tile_fg.width(); cx++)
{
- const coord_def ep(cx+1, cy+1);
+ const coord_def ep(cx, cy);
const coord_def gc = show2grid(ep);
int bg = TILE_DNGN_UNSEEN | tile_unseen_flag(gc);
@@ -4543,8 +4543,8 @@ void tile_draw_floor()
}
// init tiles
- env.tile_bg[ep.x-1][ep.y-1] = bg;
- env.tile_fg[ep.x-1][ep.y-1] = 0;
+ env.tile_bg[ep.x][ep.y] = bg;
+ env.tile_fg[ep.x][ep.y] = 0;
}
}
@@ -4555,19 +4555,19 @@ void tile_place_item(int x, int y, int idx)
if (mitm[idx].link != NON_ITEM)
t |= TILE_FLAG_S_UNDER;
- env.tile_fg[x-1][y-1] = t;
+ env.tile_fg[x][y] = t;
if (item_needs_autopickup(mitm[idx]))
- env.tile_bg[x-1][y-1] |= TILE_FLAG_CURSOR3;
+ env.tile_bg[x][y] |= TILE_FLAG_CURSOR3;
}
// Called from item() in view.cc
void tile_place_item_marker(int x, int y, int idx)
{
- env.tile_fg[x-1][y-1] |= TILE_FLAG_S_UNDER;
+ env.tile_fg[x][y] |= TILE_FLAG_S_UNDER;
if (item_needs_autopickup(mitm[idx]))
- env.tile_bg[x-1][y-1] |= TILE_FLAG_CURSOR3;
+ env.tile_bg[x][y] |= TILE_FLAG_CURSOR3;
}
// Called from monster_grid() in view.cc
@@ -4602,7 +4602,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected)
if (item_needs_autopickup(item))
{
if (foreground)
- env.tile_bg[ep.x-1][ep.y-1] |= TILE_FLAG_CURSOR3;
+ env.tile_bg[ep.x][ep.y] |= TILE_FLAG_CURSOR3;
else
env.tile_bk_bg(gc) |= TILE_FLAG_CURSOR3;
}
@@ -4627,7 +4627,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected)
if (foreground)
{
- env.tile_fg[ep.x-1][ep.y-1] = t;
+ env.tile_fg[ep.x][ep.y] = t;
const monsters *mon = &menv[idx];
if (!player_monster_visible(mon)
@@ -4685,7 +4685,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected)
void tile_place_cloud(int x, int y, int type, int decay)
{
- env.tile_fg[x-1][y-1] = _tileidx_cloud(type, decay);
+ env.tile_fg[x][y] = _tileidx_cloud(type, decay);
}
unsigned int num_tile_rays = 0;
@@ -4714,7 +4714,7 @@ void tile_draw_rays(bool reset_count)
for (unsigned int i = 0; i < num_tile_rays; i++)
{
int flag = tile_ray_vec[i].in_range ? TILE_FLAG_RAY : TILE_FLAG_RAY_OOR;
- env.tile_bg[tile_ray_vec[i].ep.x-1][tile_ray_vec[i].ep.y-1] |= flag;
+ env.tile_bg[tile_ray_vec[i].ep.x][tile_ray_vec[i].ep.y] |= flag;
}
if (reset_count)
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 516f021132..2d15c06ab9 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -4122,9 +4122,6 @@ void viewwindow(bool draw_it, bool do_updates)
// in grid coords
const coord_def gc(view2grid(coord_def(count_x, count_y)));
const coord_def ep = view2show(grid2view(gc));
-#ifdef USE_TILE
- const coord_def sep = ep - coord_def(1,1);
-#endif
if (in_bounds(gc) && see_cell(gc))
maybe_remove_autoexclusion(gc);
@@ -4191,13 +4188,13 @@ void viewwindow(bool draw_it, bool do_updates)
#ifdef USE_TILE
if (map)
{
- env.tile_bk_bg(gc) = env.tile_bg(sep);
- env.tile_bk_fg(gc) = env.tile_fg(sep);
+ env.tile_bk_bg(gc) = env.tile_bg(ep);
+ env.tile_bk_fg(gc) = env.tile_fg(ep);
}
- tileb[bufcount] = env.tile_fg(sep) =
+ tileb[bufcount] = env.tile_fg(ep) =
tileidx_player(you.char_class);
- tileb[bufcount+1] = env.tile_bg(sep);
+ tileb[bufcount+1] = env.tile_bg(ep);
#endif
// Player overrides everything in cell.
@@ -4223,8 +4220,8 @@ void viewwindow(bool draw_it, bool do_updates)
buffy[bufcount] = ch;
buffy[bufcount + 1] = colour;
#ifdef USE_TILE
- tileb[bufcount] = env.tile_fg(sep);
- tileb[bufcount+1] = env.tile_bg(sep);
+ tileb[bufcount] = env.tile_fg(ep);
+ tileb[bufcount+1] = env.tile_bg(ep);
#endif
if (map)
@@ -4250,13 +4247,13 @@ void viewwindow(bool draw_it, bool do_updates)
if (Options.clean_map)
{
env.tile_bk_fg(gc) =
- get_clean_map_idx(env.tile_fg(sep));
+ get_clean_map_idx(env.tile_fg(ep));
}
else
{
- env.tile_bk_fg(gc) = env.tile_fg(sep);
+ env.tile_bk_fg(gc) = env.tile_fg(ep);
}
- env.tile_bk_bg(gc) = env.tile_bg(sep);
+ env.tile_bk_bg(gc) = env.tile_bg(ep);
#endif
}