diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-08 23:03:57 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-08 23:03:57 +0200 |
commit | 4d393402a8743c6d7f2455de39ec5259ddfecdba (patch) | |
tree | d07a70fb10cb0051de3583fb3884e248468ff473 /crawl-ref/source | |
parent | ac38661a15a4ac915e6b5b59dc4aabe5ae5da05c (diff) | |
download | crawl-ref-4d393402a8743c6d7f2455de39ec5259ddfecdba.tar.gz crawl-ref-4d393402a8743c6d7f2455de39ec5259ddfecdba.zip |
Move losight radius check into los_param.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/los.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/losparam.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/losparam.h | 9 |
3 files changed, 11 insertions, 11 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index 14dc1e3f6c..77b81d240c 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -745,10 +745,8 @@ void _losight_quadrant(env_show_grid& sh, const los_param& dat, int sx, int sy) for (int x = 0; x <= LOS_MAX_RANGE_X; ++x) for (int y = 0; y <= LOS_MAX_RANGE_Y; ++y, inptr += num_words) { - if (x == 0 && y == 0) - continue; coord_def p = coord_def(sx*x, sy*y); - if (!dat.map_bounds(p)) + if (!dat.los_bounds(p)) continue; // if this cell is opaque... @@ -788,7 +786,7 @@ void _losight_quadrant(env_show_grid& sh, const los_param& dat, int sx, int sy) const coord_def p = coord_def(sx * compressed_ray_x[rayidx], sy * compressed_ray_y[rayidx]); // update shadow map - if (dat.map_bounds(p) && p.abs() <= _los_radius_squared) + if (dat.los_bounds(p)) { sh(p+sh_o) = dat.appearance(p); } diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index cd746d0b58..c0a3ed0298 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -10,6 +10,7 @@ REVISION("$Rev$"); #include "cloud.h" #include "externs.h" +#include "los.h" #include "stuff.h" #include "terrain.h" @@ -23,12 +24,12 @@ los_param_trans::los_param_trans(const coord_def& c) coord_def los_param_trans::trans(const coord_def& p) const { - return p + center; + return (p + center); } -bool los_param_trans::map_bounds(const coord_def& p) const +bool los_param_trans::los_bounds(const coord_def& p) const { - return ::map_bounds(trans(p)); + return (map_bounds(trans(p)) && p.abs() <= get_los_radius_squared()); } diff --git a/crawl-ref/source/losparam.h b/crawl-ref/source/losparam.h index 1d6b579565..69e043e5fb 100644 --- a/crawl-ref/source/losparam.h +++ b/crawl-ref/source/losparam.h @@ -24,10 +24,11 @@ struct los_param { virtual ~los_param() {} - // Whether the translated coordinate lies in the map (including boundary) - virtual bool map_bounds(const coord_def& p) const = 0; + // Whether the translated coordinate lies within the map + // (including boundary) and within the LOS area + virtual bool los_bounds(const coord_def& p) const = 0; - // appearance(p) will be copied to show(p) for visible p. + // appearance(p) will be copied to show(sh_o+p) for visible p. virtual unsigned appearance(const coord_def& p) const = 0; virtual opacity_type opacity(const coord_def& p) const = 0; @@ -42,7 +43,7 @@ struct los_param_trans : los_param coord_def trans(const coord_def& p) const; - bool map_bounds(const coord_def& p) const; + bool los_bounds(const coord_def& p) const; }; // Everything is visible. |