From 81392eb43b111bc23b2a7950c240494b9cf3d15d Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Fri, 30 Oct 2009 13:00:00 +0100 Subject: 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. --- crawl-ref/source/ray.cc | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) (limited to 'crawl-ref/source/ray.cc') 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(); -- cgit v1.2.3-54-g00ecf