#ifndef LOS_H
#define LOS_H
#include "env.h"
#include "losparam.h"
#define EPSILON_VALUE 0.00001
bool double_is_zero(const double x);
void set_los_radius(int r);
int get_los_radius_sq();
struct ray_def;
bool find_ray(const coord_def& source, const coord_def& target,
ray_def& ray, const opacity_func &opc = opc_solid,
const bounds_func &bds = bds_default, bool cycle = false);
bool exists_ray(const coord_def& source, const coord_def& target,
const opacity_func &opc = opc_solid,
const bounds_func &bds = bds_default);
dungeon_feature_type ray_blocker(const coord_def& source, const coord_def& target);
void fallback_ray(const coord_def& source, const coord_def& target,
ray_def& ray);
int num_feats_between(const coord_def& source, const coord_def& target,
dungeon_feature_type min_feat,
dungeon_feature_type max_feat,
bool exclude_endpoints = true,
bool just_check = false);
bool cell_see_cell(const coord_def& p1, const coord_def& p2);
void clear_rays_on_exit();
void losight(env_show_grid& sh, const coord_def& center,
const opacity_func &opc = opc_default,
const bounds_func &bds = bds_default);
void losight(env_show_grid& sh, const los_param& param);
class los_def
{
env_show_grid show;
coord_def center;
opacity_func const * opc;
bounds_func const * bds;
public:
los_def();
los_def(const coord_def& c, const opacity_func &o = opc_default,
const bounds_func &b = bds_default);
los_def(const los_def& l);
~los_def();
los_def& operator=(const los_def& l);
void init(const coord_def& center, const opacity_func& o,
const bounds_func& b);
void set_center(const coord_def& center);
void set_opacity(const opacity_func& o);
void set_bounds(const bounds_func& b);
void update();
bool in_bounds(const coord_def& p) const;
bool see_cell(const coord_def& p) const;
};
void calc_show_los();
bool see_cell(const env_show_grid &show,
const coord_def &c,
const coord_def &pos );
bool see_cell(const coord_def &p);
bool see_cell_no_trans( const coord_def &p );
bool trans_wall_blocking( const coord_def &p );
inline bool see_cell(int grx, int gry)
{
return see_cell(coord_def(grx, gry));
}
inline bool see_cell_no_trans(int x, int y)
{
return see_cell_no_trans(coord_def(x, y));
}
inline bool trans_wall_blocking(int x, int y)
{
return trans_wall_blocking(coord_def(x, y));
}
#endif