summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ray.cc
Commit message (Collapse)AuthorAgeFilesLines
* Remove some newly-dead geometry code.Neil Moore2014-01-091-15/+0
| | | | | | | The {get,set}_degrees methods of ray_def were only used by the chaos bouncing code, removed in 0.14-a0-1819-g38ea213. The functions geom::degrees and geom::degree_to_vector were only used by those ray_def methods.
* Refactor ASSERT(a && b) againBrendan Hickey2013-11-151-1/+2
| | | | | | This commit converts ASSERT(a && b) to ASSERT(a); ASSERT(b); Assertions of the form !(a && b) are left intact, since there isn't an obvious readability gain over (!a || !b).
* More formatting fixes for return (...);Neil Moore2013-11-151-9/+9
|
* Drop unnecessary parentheses from return statements.Adam Borowski2013-11-151-1/+1
|
* Improve a comment.Neil Moore2013-09-241-2/+2
|
* Fix a chaos bounce crash (#5892).Neil Moore2013-09-061-8/+20
| | | | | | | | It wasn't safe to change the angle of a ray that was on a corner of the 45-degree diamond grid: if the new angle pointed inside the cell, we would violate the _valid() checks. Have set_degrees (only called for chaos bouncing currently) nudge the ray inside the diamond to avoid this problem.
* Use std namespace.Raphael Langella2012-08-261-1/+1
| | | | | | | | | | | | | I had to rename distance() (in coord.h) to distance2() because it conflicts with the STL function to compare 2 iterators. Not a bad change given how it returns the square of the distance anyway. I also had to rename the message global variable (in message.cc) to buffer. I tried to fix and improve the coding style has much as I could, but I probably missed a few given how huge and tedious it is. I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool and util/levcomp.*, because I have no clue about those.
* Some more return deparenthesization.Adam Borowski2012-07-051-2/+2
|
* Remove parentheses around return (simple_function_call).Adam Borowski2012-07-051-6/+6
| | | | For way too paranoid and underinclusive values of "simple".
* Drop parentheses around scalar values in "return".Adam Borowski2012-07-051-14/+14
|
* Drop pointless braces after if/for/while everywhere.Adam Borowski2012-04-201-2/+0
|
* Whitespace fixes.Adam Borowski2011-12-111-1/+1
|
* Make file headers doxygen-friendly, drop useless fields.Adam Borowski2011-03-281-4/+4
| | | | | | | "File:" is shown in your editor's status bar. "Written by:" was used only for the first person who changed a file. We got git for that now, and pre-DCSS history is so woefully inaccurate it doesn't really matter.
* For functions with names starting with _, actually declare them static.Adam Borowski2010-07-061-8/+8
|
* "make ASSERTS=y" to force assertion checks even in non-debug builds.Adam Borowski2010-03-301-1/+1
|
* Fix newlines at end of file.Adam Borowski2010-01-211-1/+0
|
* Add formatting fixes.David Lawrence Ramsey2009-11-211-2/+2
| | | | This mostly puts && and || on the proper lines, per the style guide.
* Convert reflect_grid to SquareArray.Robert Vollmert2009-11-081-12/+12
|
* Put DJGPP's round() into a #define so other builds don't suffer.Adam Borowski2009-11-061-2/+2
|
* Standard <cmath> has no round().Adam Borowski2009-11-061-2/+2
|
* A variety of changes to make the reflection code more robust.Robert Vollmert2009-11-051-20/+76
| | | | | In particular, round things to grid or corner when they're regarded as on the grid or corner, and normalize direction vectors.
* Add get_degrees and set_degrees to ray_def; reenable chaos bolt munging.Robert Vollmert2009-11-031-0/+11
|
* Split up ray_def::bounce and implement better corner handling.Robert Vollmert2009-11-031-58/+144
| | | | | | | | | | | | | | | | Rays shot directly at diagonal walls should now reflect appropriately. For this, diagonal walls are assumed to be flat. Example: ...### @***## ...*.# ...*.. It's different from before, but I think it's probably a nice change without huge impact.
* Improve reflections when starting in a corner.Robert Vollmert2009-11-031-8/+8
|
* Move regress next to advance.Robert Vollmert2009-11-031-9/+9
|
* Also assert validity in ray_def::pos().Robert Vollmert2009-11-031-0/+1
|
* Fix a bug with corner rays.Robert Vollmert2009-11-031-7/+28
| | | | | Rays that reflected on corners could go too far. Now passes the bounce test.
* Add function to fudge corner ray into a non-solid cell.Robert Vollmert2009-11-031-0/+22
|
* Split _mirror into point and direction parts.Robert Vollmert2009-11-031-10/+22
|
* Add round_vec.Robert Vollmert2009-11-031-3/+8
|
* Bug fixes.Robert Vollmert2009-11-031-1/+1
|
* ray_def::bounce now guarantees it leaves the ray in a clear tile.Robert Vollmert2009-11-031-12/+7
|
* Add pre- and post-asserts to ray_def::regress.Robert Vollmert2009-11-031-0/+2
|
* Fix bugs in diagonal corridor reflections.Robert Vollmert2009-11-031-2/+2
|
* Move reflection line choice into separate function.Robert Vollmert2009-11-031-45/+52
|
* Implement diagonal corridor reflections.Robert Vollmert2009-11-031-3/+13
|
* Possibly fix diagonal corridor asserts.Robert Vollmert2009-11-031-1/+2
|
* Fix diagonal corner case leaving the ray on the boundary.Robert Vollmert2009-11-031-0/+1
|
* Refine ray_def assertions.Robert Vollmert2009-11-031-3/+22
| | | | | ray_def::advance() and ray_def::bounce() now check pre- and post- conditions on validity.
* Make ray.cc ASSERTs a little safer.Robert Vollmert2009-11-021-10/+32
| | | | | | | Not sure if this helps with the chain lightning problems, but the assertions should be less likely to trigger wrongly now. Also deal with "on_corner" in bounce().
* Some changes to the reflection details.Robert Vollmert2009-11-011-15/+25
| | | | | | | | | | | | | | | | | In particular, don't flatten outer corners, so air elementalists aren't hurt too badly. Also, start special casing rays that pass through corners, though they don't currently work the way I want for diagonals. Should now be usable including reflections. TODO - Diagonal wall reflections, both for corner rays and diagonal corridors. - Reenable chaos beam munging. - Fix test/los_maps.lua. It would be easy to make the test pass, but I should really work out what the result should be first. - Generally clean up reflections code -- it's a mess.
* Permit rays to go from diamond directly to diamond.Robert Vollmert2009-11-011-1/+1
| | | | | | | Also recenter the cardinal direction rays. Before, we didn't have centered rays going straight north/south or east/west, which was awkward for shift-firing.
* Implement reflection (except for the diagonal corridor case).Robert Vollmert2009-11-011-12/+145
| | | | | | | | | Reflection is modelled on diamond-shaped features, with gaps filled in as far as they don't affect LOS. Working on a case by case analysis: After normalization, a ray leaves cell * through the south-east diamond face. Then determine the line of reflection in each case.
* Simplify geom2d ray advance code.Robert Vollmert2009-11-011-5/+6
|
* Add a bunch of ASSERTs to ray.cc.Robert Vollmert2009-11-011-1/+43
|
* Change ray_def bouncing interface.Robert Vollmert2009-11-011-1/+1
| | | | | | | 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).
* Some geom2d changes.Robert Vollmert2009-11-011-3/+3
| | | | | 1. Add function to reflect vector at a line. 2. Implement scalar multiplication as external operator.
* Make nextcell and movehalfcell methods of geom::ray.Robert Vollmert2009-11-011-4/+4
| | | | | Seems sensible given they modify the ray, even if it's not really something intrinsic to a ray.
* ray_def introductory comment.Robert Vollmert2009-11-011-2/+10
|
* Change corner handling.Robert Vollmert2009-11-011-3/+29
| | | | | | | | ray_def should now deal with hitting corners gracefully, though the raycasting will still discard such rays. If a ray hits a corner between two diamonds, it will stay there, and calling ray_def::pos will arbitrarily give one of the squares -- this is not optimal, but these rays shouldn't usually show up anyway.