From: Martin Read Date: Tue, 18 Feb 2014 22:42:46 +0000 (+0000) Subject: New visibility check functions X-Git-Tag: stretchy-levels~10 X-Git-Url: http://git.blackswordsonics.com/?a=commitdiff_plain;h=247cadf2a693f09018e7939ca8fe0866a43d7269;p=victrix-abyssi New visibility check functions * fov.cc,fov.hh: Added tile_visible() and occupant_visible() functions which directly inspect the visibility of a given Coord. --- diff --git a/fov.cc b/fov.cc index dfc8aad..d542265 100644 --- a/fov.cc +++ b/fov.cc @@ -428,5 +428,17 @@ void compute_fov(void) resolve_radiance(&player_fov); } +bool tile_visible(Coord c) +{ + Offset delta = c.delta(u.pos); + return (delta.len_cheb() <= MAX_FOV_RADIUS) ? player_fov.affected[MAX_FOV_RADIUS + delta.y][MAX_FOV_RADIUS + delta.x] & (Visflag_central | Visflag_partial) : false; +} + +bool occupant_visible(Coord c) +{ + Offset delta = c.delta(u.pos); + return (delta.len_cheb() <= MAX_FOV_RADIUS) ? player_fov.affected[MAX_FOV_RADIUS + delta.y][MAX_FOV_RADIUS + delta.x] & Visflag_central : false; +} + /* fov.c */ // vim:cindent diff --git a/fov.hh b/fov.hh index 8c344e8..15f40ad 100644 --- a/fov.hh +++ b/fov.hh @@ -78,6 +78,8 @@ extern void clear_radiance(Radiance *rad); extern void compute_radiance(Radiance *rad); extern void resolve_radiance(Radiance *rad); extern void compute_fov(void); +extern bool tile_visible(Coord c); +extern bool occupant_visible(Coord c); extern Radiance player_fov; #endif