| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
This was eventually causing not _valid() asserts in the smoky arena
(BR 2898267).
|
| |
|
| |
|
| |
|
|
|
|
| |
Player now sees everything in the arena.
|
|
|
|
|
|
| |
12:00 < Napkin> los.cc: In constructor `los_ray::los_ray(geom::ray)':
12:00 < Napkin> los.cc:154: warning: converting of negative value `-0x000000001' to
`unsigned int'
|
| |
|
|
|
|
|
| |
This is not required anymore since we just store bools in
los_grid.
|
|
|
|
|
| |
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 difference between no_trans and solid is whether granite statues are
considered opaque.
Granite statues are somewhat weird in that they behave completely differently
from other statues: You can't shoot missiles at or past them, no items can be
in their cell, etc.
|
|
|
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
env.show is now a class show_def that stores tagged
unions of type show_type. For the moment, there's also
env.show_los for use in LOS determination, but that
should become an array of boolean at some point.
This breaks save compatibility.
Tiles and console version build and appear to work
fine, but this kind of change is likely to have
some side-effects.
|
|
|
|
|
|
| |
The issue is blink referencing player posistion, which is invalid.
Better random_near_space fix will come.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
* Adapt los_ray.
* Register rays using geom::ray.
* Change cellray comparison functions (remove slope_diff which
I didn't understand, add first_diag which prefers rays that
start on diagonals for easier meph cloud targetting)
The rays that are actually being cast may need changing. For now,
rays that hit diamond corners are simply discarded.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This was causing a crash through monsters::mon_see_cell.
Also special case monster position there.
|
| |
|
|
|
|
| |
New: colour.cc, coord.cc, coordit.cc, random.cc, rng.cc.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
|
| |
|
|
|
|
|
|
|
| |
Fixes BR 2881139.
Arena mode doesn't result in a call to losight() anymore, which
was doing the precalculations before.
|
|
|
|
| |
This was causing see_cell to fail for cells at the edge of LOS.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
For this, add new opacity_func that disregards half-opaque things.
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From an earlier email about this bug:
It bombed on the min_it++, which was odd.
Looking at the loop, I suspect what happens is this:
- Erases the last item in the 'min' list, setting min_it to min.end(),
- Attempts to increment min_it (which isn't valid on the end iterator)
The patch at the bottom of this mail avoids the crash, but DOES NOT
fix the root bug. The root bug is a bit more insidous (imagine that,
MSVC helped us catch a real bug!). Consider the following test case:
-- BEGIN --
#include <iostream>
#include <list>
int main()
{
std::list<int> ilist;
for (int i = 1; i < 10; i++)
{
ilist.push_back(i);
}
for (std::list<int>::iterator l_it = ilist.begin();
l_it != ilist.end();
l_it++)
{
std::cout << *l_it << " ";
if (*l_it == 4)
l_it = ilist.erase(l_it);
}
std::cout << std::endl;
return 0;
}
-- EOF --
Here's the output:
$ ./test
1 2 3 4 6 7 8 9
Note that it skipped over '5'. The reason is because the iterator ends
up being incremented _twice_ (the erase() moves the iterator one
forward of the previous position). So the obvious solution might be to
decrement the iterator immediately after erase(), right? Wrong. If you
erased the last element in the list, your iterator will be ==
list.end(), which is an iterator you should NEVER use ++ or -- on.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Existence of a valid ray is now tracked with a separate boolean
have_beam. fallback_ray has been removed almost completely. The
change appears fine in console crawl; tiles untested at the
moment.
find_ray now correctly returns false for rays with
source == target.
Also rename CMD_TARGET_HIDE_BEAM to CMD_TARGET_TOGGLE_BEAM.
|