summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/los.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-08 14:24:43 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-08 15:49:27 +0200
commit5fc4ef91a5a82981c3becf54509a2ae64b2b4ec1 (patch)
treeea1c44511b8a14e1c07d7d8b78f0365f42381544 /crawl-ref/source/los.h
parent22982415537d288bc2429b225dceafc64a79db95 (diff)
downloadcrawl-ref-5fc4ef91a5a82981c3becf54509a2ae64b2b4ec1.tar.gz
crawl-ref-5fc4ef91a5a82981c3becf54509a2ae64b2b4ec1.zip
Split LOS code from view.cc.
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.
Diffstat (limited to 'crawl-ref/source/los.h')
-rw-r--r--crawl-ref/source/los.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/crawl-ref/source/los.h b/crawl-ref/source/los.h
new file mode 100644
index 0000000000..301806b8c6
--- /dev/null
+++ b/crawl-ref/source/los.h
@@ -0,0 +1,60 @@
+/*
+ * File: los.h
+ * Summary: Line-of-sight algorithm.
+ */
+
+#ifndef LOS_H
+#define LOS_H
+
+#include "externs.h"
+
+#define EPSILON_VALUE 0.00001
+
+bool double_is_zero(const double x);
+
+
+void setLOSRadius(int newLR);
+int get_los_radius_squared(); // XXX
+
+struct ray_def;
+bool find_ray( const coord_def& source, const coord_def& target,
+ bool allow_fallback, ray_def& ray, int cycle_dir = 0,
+ bool find_shortest = false, bool ignore_solid = false );
+
+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 grid_see_grid(const coord_def& p1, const coord_def& p2,
+ dungeon_feature_type allowed = DNGN_UNSEEN);
+
+void clear_rays_on_exit();
+void losight(env_show_grid &sh, feature_grid &gr,
+ const coord_def& center, bool clear_walls_block = false,
+ bool ignore_clouds = false);
+void calc_show_los();
+
+bool see_grid( const env_show_grid &show,
+ const coord_def &c,
+ const coord_def &pos );
+bool see_grid(const coord_def &p);
+bool see_grid_no_trans( const coord_def &p );
+bool trans_wall_blocking( const coord_def &p );
+
+inline bool see_grid( int grx, int gry )
+{
+ return see_grid(coord_def(grx, gry));
+}
+
+inline bool see_grid_no_trans(int x, int y)
+{
+ return see_grid_no_trans(coord_def(x, y));
+}
+
+inline bool trans_wall_blocking(int x, int y)
+{
+ return trans_wall_blocking(coord_def(x, y));
+}
+
+#endif