diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-30 13:00:00 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-01 21:45:23 +0100 |
commit | 81392eb43b111bc23b2a7950c240494b9cf3d15d (patch) | |
tree | 214e14f3af5fb41943f1171f857c4dda2d4cd5be /crawl-ref/source/ray.cc | |
parent | 972124395af10024e5abc17878f92fde999e4c64 (diff) | |
download | crawl-ref-81392eb43b111bc23b2a7950c240494b9cf3d15d.tar.gz crawl-ref-81392eb43b111bc23b2a7950c240494b9cf3d15d.zip |
Remove ray antialiasing.
Previously, rays were always cut short at corners: If a ray really
went like
.....
@**..
..***
.....
it was cut short (for find_ray/targetting/shooting purposes) to
.....
@*...
..***
.....
Note that a wall at the removed cell would still block the given
ray!
This makes ray footprint length matter, so rays are sorted to
prefer those that pass through fewer cells.
However, this gives quite a few ugly beams, in particular around
corners.
Diffstat (limited to 'crawl-ref/source/ray.cc')
-rw-r--r-- | crawl-ref/source/ray.cc | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc index fc88b57712..5635aaf161 100644 --- a/crawl-ref/source/ray.cc +++ b/crawl-ref/source/ray.cc @@ -84,7 +84,7 @@ void ray_def::advance_and_bounce() { int oldx = x(), oldy = y(); const double oldaccx = accx, oldaccy = accy; - adv_type rc = advance(false); + adv_type rc = advance(); int newx = x(), newy = y(); ASSERT(feat_is_solid(grd[newx][newy])); @@ -161,45 +161,10 @@ void ray_def::set_degrees(double deg) void ray_def::regress() { quadx = -quadx; quady= -quady; - advance(false); + advance(); quadx = -quadx; quady= -quady; } -adv_type ray_def::advance_through(const coord_def &target) -{ - return (advance(true, &target)); -} - -adv_type ray_def::advance(bool shortest_possible, const coord_def *target) -{ - if (!shortest_possible) - return (raw_advance()); - - // If we want to minimise the number of moves on the ray, look one - // step ahead and see if we can get a diagonal. - - const coord_def old = pos(); - const adv_type ret = raw_advance(); - - if (ret == ADV_XY || (target && pos() == *target)) - return (ret); - - const double maccx = accx, maccy = accy; - if (raw_advance() != ADV_XY) - { - const coord_def second = pos(); - // If we can convert to a diagonal, do so. - if ((second - old).abs() == 2) - return (ADV_XY); - } - - // No diagonal, so roll back. - accx = maccx; - accy = maccy; - - return (ret); -} - // Advance a ray in the positive quadrant. // note that slope must be nonnegative! // returns 0 if the advance was in x, 1 if it was in y, 2 if it was @@ -276,7 +241,7 @@ void ray_def::flip() accy = 0.5 + quady * (accy - 0.5); } -adv_type ray_def::raw_advance() +adv_type ray_def::advance() { adv_type rc; flip(); |