00001
00002
00003
00004
00005
00006 #ifndef LOS_H
00007 #define LOS_H
00008
00009 #include "coord-circle.h"
00010 #include "losparam.h"
00011
00012 class circle_def;
00013 struct ray_def;
00014
00015 #define EPSILON_VALUE 0.00001
00016
00017 bool double_is_zero(const double x);
00018
00019 void set_los_radius(int r);
00020 int get_los_radius_sq();
00021
00022
00023 #define BDS_DEFAULT (circle_def())
00024
00025 #define BDS_CONSTANT (circle_def(LOS_MAX_RANGE, C_ROUND))
00026
00027 bool find_ray(const coord_def& source, const coord_def& target,
00028 ray_def& ray, const opacity_func &opc = opc_solid,
00029 const circle_def &bds = BDS_CONSTANT, bool cycle = false);
00030 bool exists_ray(const coord_def& source, const coord_def& target,
00031 const opacity_func &opc = opc_solid,
00032 const circle_def &bds = BDS_CONSTANT);
00033 dungeon_feature_type ray_blocker(const coord_def& source, const coord_def& target);
00034
00035 void fallback_ray(const coord_def& source, const coord_def& target,
00036 ray_def& ray);
00037
00038 int num_feats_between(const coord_def& source, const coord_def& target,
00039 dungeon_feature_type min_feat,
00040 dungeon_feature_type max_feat,
00041 bool exclude_endpoints = true,
00042 bool just_check = false);
00043 bool cell_see_cell(const coord_def& p1, const coord_def& p2);
00044
00045 typedef SquareArray<bool, LOS_MAX_RANGE> los_grid;
00046
00047 void clear_rays_on_exit();
00048 void losight(los_grid& sh, const coord_def& center,
00049 const opacity_func &opc = opc_default,
00050 const circle_def &bds = BDS_DEFAULT);
00051 void losight(los_grid& sh, const los_param& param);
00052
00053 void los_actor_moved(const actor* act, const coord_def& oldpos);
00054 void los_monster_died(const monster* mon);
00055 void los_terrain_changed(const coord_def& p);
00056 void los_cloud_changed(const coord_def& p);
00057 void los_changed();
00058 #endif