summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tile1.cc
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-22 02:04:50 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-22 02:04:50 +0000
commit3b024456566a2d6835c0bdf6662e4c1bba6c1bde (patch)
tree413606b6a3aae1992c42896e06fec48510a35a42 /crawl-ref/source/tile1.cc
parentff747f947f3a34e9e53d76f1c915cd9b3ffd3974 (diff)
downloadcrawl-ref-3b024456566a2d6835c0bdf6662e4c1bba6c1bde.tar.gz
crawl-ref-3b024456566a2d6835c0bdf6662e4c1bba6c1bde.zip
Tile support for (horizontal) gates.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3456 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tile1.cc')
-rw-r--r--crawl-ref/source/tile1.cc37
1 files changed, 36 insertions, 1 deletions
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index 9f339ae0b2..3f3e3e5a61 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -2094,6 +2094,11 @@ void finalize_tile(unsigned int *tile, bool is_special,
// These types always have four flavors...
(*tile) = orig + (floor_flv % 4);
}
+ else if (orig == TILE_DNGN_CLOSED_DOOR || orig == TILE_DNGN_OPEN_DOOR)
+ {
+ ASSERT(special_flv >= 0 && special_flv <= 3);
+ (*tile) = orig + special_flv;
+ }
(*tile) |= flag;
}
@@ -3348,7 +3353,37 @@ void tile_init_flavor()
env.tile_flavor[x][y].floor = floor_flavor;
env.tile_flavor[x][y].wall = wall_flavor;
- if (bazaar && env.grid_colours[x][y] == baz_col &&
+ if (grd[x][y] == DNGN_CLOSED_DOOR || grd[x][y] == DNGN_OPEN_DOOR)
+ {
+ // Check for horizontal gates.
+
+ bool door_left = (x > 0 && grd[x-1][y] == grd[x][y]);
+ bool door_right = (x < GXM - 1 && grd[x+1][y] == grd[x][y]);
+ bool door_up = (y > 0 && grd[x][y-1] == grd[x][y]);
+ bool door_down = (y < GYM - 1 && grd[x][y+1] == grd[x][y]);
+
+ if ((door_left || door_right) && !door_up && !door_down)
+ {
+ int target;
+ if (door_left && door_right)
+ target = TILE_DNGN_GATE_CLOSED_MIDDLE;
+ else if (door_left)
+ target = TILE_DNGN_GATE_CLOSED_RIGHT;
+ else
+ target = TILE_DNGN_GATE_CLOSED_LEFT;
+
+ // NOTE: this requires that closed gates and open gates
+ // are positioned in the tile set relative to their
+ // door counterpart.
+ env.tile_flavor[x][y].special =
+ target - TILE_DNGN_CLOSED_DOOR;
+ }
+ else
+ {
+ env.tile_flavor[x][y].special = 0;
+ }
+ }
+ else if (bazaar && env.grid_colours[x][y] == baz_col &&
grd[x][y] == DNGN_FLOOR)
{
int left_grd = (x > 0) ? grd[x-1][y] : DNGN_ROCK_WALL;