diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-31 19:04:46 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-01 21:45:26 +0100 |
commit | f6cf2bbe461eb50243c279f5bc4b6efe1ab9c4da (patch) | |
tree | 61195c985d6265c87e6dd38ee2c368b1e041e036 /crawl-ref/source | |
parent | c8f4dd7a1f5e3c666bc84e81248df7fba78eefeb (diff) | |
download | crawl-ref-f6cf2bbe461eb50243c279f5bc4b6efe1ab9c4da.tar.gz crawl-ref-f6cf2bbe461eb50243c279f5bc4b6efe1ab9c4da.zip |
Change ray_def bouncing interface.
For one, rename ray_def::advance_and_bounce to ray_def::bounce.
Then, pass a grid of bools for adjacent cells which states which
cells are considered solid (reflecting).
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/beam.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/ray.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/ray.h | 5 |
3 files changed, 9 insertions, 3 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 3fa146fb4b..d8ab5d18c8 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1634,7 +1634,10 @@ void bolt::bounce() while (feat_is_solid(grd(ray.pos()))); bounce_pos = ray.pos(); - ray.advance_and_bounce(); + reflect_grid rg; + for (adjacent_iterator ai(ray.pos()); ai; ++ai) + rg(*ai) = feat_is_solid(grd(ray.pos())); + ray.bounce(rg); range_used += 2; } while (range_used < range && feat_is_solid(grd(ray.pos()))); diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc index 74d402c7ce..dff1d3e82a 100644 --- a/crawl-ref/source/ray.cc +++ b/crawl-ref/source/ray.cc @@ -66,7 +66,7 @@ bool ray_def::advance() } } -void ray_def::advance_and_bounce() +void ray_def::bounce(const reflect_grid &rg) { // XXX r.dir = -r.dir; diff --git a/crawl-ref/source/ray.h b/crawl-ref/source/ray.h index 671ca0fa8a..cc7688571d 100644 --- a/crawl-ref/source/ray.h +++ b/crawl-ref/source/ray.h @@ -6,8 +6,11 @@ #ifndef RAY_H #define RAY_H +#include "fixary.h" #include "geom2d.h" +typedef FixedArray<bool,3,3> reflect_grid; + struct ray_def { geom::ray r; @@ -20,7 +23,7 @@ struct ray_def coord_def pos() const; bool advance(); - void advance_and_bounce(); + void bounce(const reflect_grid &rg); void regress(); }; |