summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/los.h
Commit message (Collapse)AuthorAgeFilesLines
* 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.