summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/los.h
Commit message (Collapse)AuthorAgeFilesLines
* Round more vigorously in ray code.Neil Moore2014-06-151-1/+1
| | | | | | | | | | | | | | | Aiming cloud cone from (40,41) or (66,23) would crash because of rounding errors. See for example: http://dobrazupa.org/morgue/Rikonman/crash-Rikonman-20140425-000700.txt Now consider numbers as large as 5e-5 to be zero, rather than requiring 1e-7 (for geom2d code) or 1e-5 (ray_def code). This means rays will be snapped to the diamond grid more frequently, helping to avoid inconsistencies among different ways of deciding what part of the cell a ray falls on. Someone with numerical analysis experience should really look at this code.
* Use a scalar range for find_ray() and friends instead of a circle_def object.Adam Borowski2013-12-031-5/+2
|
* Get rid of a strange accessor.Adam Borowski2013-11-051-1/+1
|
* Make some functions static/gone.Adam Borowski2012-06-021-2/+0
|
* Fix mimic opacity for different LOS models.Adam Borowski2011-12-111-1/+1
|
* Disambiguate the LOS_SOLID confusion.Adam Borowski2011-12-111-2/+2
| | | | | | | | | | | Its name suggests it's about line of effect, while in fact it's both effect and sight. Thus, I've split its uses into LOS_SOLID and LOS_SOLID_SEE -- the former is what LOS_SOLID was usually understood to mean, the latter is what it actually was (being targettable with an arrow/beam). The difference is: LOS_SOLID_SEE obeys clouds. The name of the latter is abysmal -- if you have a better idea, please sed.
* Merge all the feature mimics into a single monster type.Raphael Langella2011-09-051-0/+1
| | | | It's now possible to create any kind of feature mimic using &M.
* Straighten the two cell_see_cell() confusion.Adam Borowski2011-09-051-1/+1
| | | | | | | | | | | | There were two functions: one used no cache and ignored clouds, another one has a cache and accepts different LOS models. I added a new cached model: LOS_SOLID (using opc_solid). All but one uses of opc_fullyopaque (two-argument cell_see_cell()) were bugs to me, so they were moved to a different model. This makes Refrigeration not work through glass walls anymore (it still works though clouds).
* 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.
* Rename class "monsters" to "monster".Robert Vollmert2010-09-051-1/+1
|
* Make find_ray/exists_ray not track reduced LOS by default. (#1219)Robert Vollmert2010-06-241-2/+5
| | | | | After all, bolt ranges don't reduce when LOS range is reduced, and that's what find_ray/exists_ray are mainly used for.
* Add los_changed() to signal a global LOS changed.Robert Vollmert2010-03-301-0/+1
| | | | | | | This is instead of calling invalidate_los() directly, and includes a call to invalidate_agrid(), so we don't need to call both invalidate_los() and invalidate_agrid() when loading a new level, etc.
* Invalidate global LOS where appropriate.Robert Vollmert2010-03-221-1/+2
| | | | Also move the call to areas_actor_moved to actor::set_position.
* Try to track change to global LOS.Robert Vollmert2010-03-211-0/+3
| | | | | | | This should allow invalidating cached data structures in case they depend on global LOS. Right now, this is to make sure the area cache is recalculated, but might also be used to reduce actor LOS calculations at some point.
* Replace calc_show_los by you.update_los.Robert Vollmert2009-11-131-2/+0
|
* Move trans_wall_blocking into player.Robert Vollmert2009-11-131-1/+0
|
* Replace observe_cell by you.see_cell.Robert Vollmert2009-11-131-1/+0
|
* Remove obsolete losight_permissive.Robert Vollmert2009-11-081-1/+1
|
* env_show_grid is now only used inside the LOS code.Robert Vollmert2009-11-081-5/+4
| | | | | It's also called los_grid, and is a SquareArray of boolean since it doesn't need to store "objects" any more.
* Move see_cell_no_trans into player.Robert Vollmert2009-11-081-1/+0
| | | | Also collect actor/player LOS code in actor-los.cc.
* Replace bounds_func with circle_def.Robert Vollmert2009-11-081-5/+9
| | | | | | | The various LOS objects and functions now accept a circle_def instead of a bounds_func. This is a little less generic, but should eventually help with iterating over coordinates in any los_def.
* Remove an unnecessary header env.h include.Robert Vollmert2009-11-081-1/+0
|
* Split out los_def into separate header file.Robert Vollmert2009-11-071-26/+1
|
* Replace global see_cell by observe_cell and disambiguate old uses.Robert Vollmert2009-11-061-16/+1
| | | | | | | Calls to plain see_cell(pos) were replaced with either observe_cell(pos) or you.see_cell(pos). observe_cell where related to drawing the interface and messaging, you.see_cell for game mechanics, and one or the other in less clear cases (targetting, say).
* Rewrite los_def to handle function parameters sensibly.Robert Vollmert2009-10-261-5/+12
| | | | | | | | | | | | | Previously, it was holding on to pointers to objects it didn't own, causing various bugs. los_def now copies the opacity_func and bounds_func parameters. Making them copyable required introducing opacity_func::clone(). Also implement los_def copy constructor and copy assignment operator. Finally, update travel exclusions and monster patrolling to these changes.
* Wrap losight() in class los_def together with env_show_grid.Robert Vollmert2009-10-221-1/+20
|
* Split actors and env from externs.h.Robert Vollmert2009-10-211-1/+1
|
* Make default LOS configurable.Robert Vollmert2009-10-171-2/+2
| | | | | | Setting LOS_RADIUS in defines.h now works. Fixed a couple of things to allow this, including an apparent off-by-one error in crawl_view -- not quite sure this doesn't break anything.
* Clean up LOS precalculation settings.Robert Vollmert2009-10-171-1/+0
| | | | | | The maximal boundary within which losight/find_ray will work is now clearly defined at the start of los.cc. By default, it's the circle with radius LOS_MAX_RADIUS == LOS_RADIUS.
* Globally replace see_grid by see_cell.Robert Vollmert2009-10-171-9/+9
|
* Some find_ray related cleanup.Robert Vollmert2009-10-161-3/+6
| | | | | Introduce a function exists_ray when the ray is not actually needed. Also factor out part of _blocked_ray from directn.cc to ray_blocker.
* Generalize find_ray to accept opacity_func and bounds_func parameters.Robert Vollmert2009-10-161-1/+4
|
* Get rid of los_param outside of los.cc/losparam.cc.Robert Vollmert2009-10-161-2/+2
| | | | | | | | | | | The nicer interface to losight is now void losight(env_show_grid& sh, const coord_def& center, const opacity_func &opc = opc_default, const bounds_func &bds = bds_default); bounds_func provides the LOS boundary (usually just a circle with radius the current LOS radius). opacity_func is a mapping of grid coordinates to opacity values.
* On the way to a simplified losight interface.Robert Vollmert2009-10-161-1/+4
| | | | | | | | | | Added a function void losight(env_show_grid& sh, const coord_def& center, opacity_func opc, bounds_func bounds) with sensible defaults for opc and bounds. It's not necessary to abstract away the geometry as I initially did with los_param.
* Rewrite find_ray to use precomputed cellrays.Robert Vollmert2009-10-161-2/+1
| | | | | | | | | | | | | | | | | | | | | During precomputation, we store the minimal cellrays by target and sort them according to niceness. find_ray now simply picks the first non-blocked ray to a target, which means looping through the 10 or so minimal cellrays with that target -- this should be a lot more efficient. (An extended findray test went from 150s to 40s (debug) and 40s to 26s (profile)). The interface to find_ray has changed: cycle_dir=-1,0,1 was changed to cyle=false/true since we never cycle in the other direction anyway. find_shortest was removed: all rays to a target had the same length all along, but now we also return the straightest one automatically. The change also eliminates the duplicate corner-cutting code between ray_def::advance and find_ray as imbalance calculation now relies on ray_def::advance.
* Remove fallback calculation from find_ray.Robert Vollmert2009-10-151-3/+5
| | | | | | | | | | There is now a separate fallback_ray() that needs to be called explicitly. I've manually converted uses of find_ray with allow_fallback == true. find_ray with allow_fallback set always returned true, yet there were a number of places that used the return value, in particular in directn.cc. I'll check these later.
* Move can_go_straight from los.cc to monstuff.cc.Robert Vollmert2009-10-081-2/+0
|
* Split and correct grid_see_grid.Robert Vollmert2009-10-081-2/+3
| | | | | | | | | | | | | | | There's now cell_see_cell which tests for visibility correctly, albeit slowly. That's only used for placing features in the abyss currently, but needs to be improved if it gets used more. The second function used in monster movement was left as is, but renamed to can_go_straight. This remains unreliable but probably serves its purpose. The grid_see_grid test is adapted to cell_see_cell; the grid_see_grid lua binding is now actually useful. Also reduce the number of tests in los_csc and los_symm.
* Remove legacy losight() function.Robert Vollmert2009-10-081-3/+0
| | | | Also remove an obsoleted variant of grid_appearance.
* A rewrite of losight() to allow future generalization.Robert Vollmert2009-10-081-0/+2
| | | | | | | | | | | | | Parameters relevant to the LOS calculation are now passed as an object los_param that takes care of coordinate translation, bounds checking, opacity of cells and what is written to the output array. A check for in_bounds was changed to map_bounds for simlicity; this should not have any effect. Special casing for arena was removed from losight; instead calc_show_los now calls the new losight_permissive.
* Split LOS code from view.cc.Robert Vollmert2009-10-081-0/+60
los.cc: basic raycasting algorithm; losight(), see_grid() etc. ray.cc: ray_def implementation. mon-los.cc: monster_los This includes adding a bunch of #includes; there's probably some obsolete includes of view.h now.