diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-10-05 03:15:39 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-10-05 03:15:39 +0000 |
commit | a4216190921d3a0912924df441f7cad3752de02a (patch) | |
tree | 9c2ab43e3aef4c80ab57ef7501afa7204f416989 /crawl-ref/source/tilepick.cc | |
parent | 34e3ce6b9b4514f567a10429ffb83bc32547fd17 (diff) | |
download | crawl-ref-a4216190921d3a0912924df441f7cad3752de02a.tar.gz crawl-ref-a4216190921d3a0912924df441f7cad3752de02a.zip |
Graphical support for range restrictions of spells in tiles mode. Clicking past the max range will now fire as far as it can, rather than just giving an error.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7135 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilepick.cc')
-rw-r--r-- | crawl-ref/source/tilepick.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index a0b54c8bfd..997ba83d5d 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -4140,28 +4140,37 @@ void tile_place_cloud(int x, int y, int type, int decay) env.tile_fg[x-1][y-1] = _tileidx_cloud(type, decay); } -unsigned int tileRayCount = 0; -FixedVector<coord_def, 30> tileRays; +unsigned int num_tile_rays = 0; +struct tile_ray +{ + coord_def ep; + bool in_range; +}; +FixedVector<tile_ray, 30> tile_ray_vec; -void tile_place_ray(const coord_def& gc) +void tile_place_ray(const coord_def& gc, bool in_range) { // Record rays for later. The curses version just applies // rays directly to the screen. The tiles version doesn't have // (nor want) such direct access. So, it batches up all of the // rays and applies them in viewwindow(...). - if (tileRayCount < tileRays.size() - 1) + if (num_tile_rays < tile_ray_vec.size() - 1) { - tileRays[tileRayCount++] = view2show(grid2view(gc)); + tile_ray_vec[num_tile_rays].in_range = in_range; + tile_ray_vec[num_tile_rays++].ep = view2show(grid2view(gc)); } } -void tile_draw_rays(bool resetCount) +void tile_draw_rays(bool reset_count) { - for (unsigned int i = 0; i < tileRayCount; i++) - env.tile_bg[tileRays[i].x-1][tileRays[i].y-1] |= TILE_FLAG_RAY; + 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; + } - if (resetCount) - tileRayCount = 0; + if (reset_count) + num_tile_rays = 0; } void tile_finish_dngn(unsigned int *tileb, int cx, int cy) |