| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
It's also called los_grid, and is a SquareArray of boolean since it
doesn't need to store "objects" any more.
|
|
|
|
| |
Also collect actor/player LOS code in actor-los.cc.
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Also remove an obsoleted variant of grid_appearance.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
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.
|