diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-16 17:03:06 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-16 20:17:48 +0200 |
commit | 564dac43f50543729d004dc1dfe905e81321837d (patch) | |
tree | 2615c2205a951f823f9d2dd4dd5a56763fe70517 /crawl-ref/source/losparam.cc | |
parent | 6c3f2bb24979f61b40a3a666d17059e0e874e92f (diff) | |
download | crawl-ref-564dac43f50543729d004dc1dfe905e81321837d.tar.gz crawl-ref-564dac43f50543729d004dc1dfe905e81321837d.zip |
On the way to a simplified losight interface.
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.
Diffstat (limited to 'crawl-ref/source/losparam.cc')
-rw-r--r-- | crawl-ref/source/losparam.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index 833ee04003..47c995f5bd 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -14,6 +14,26 @@ REVISION("$Rev$"); #include "stuff.h" #include "terrain.h" +opacity_type opc_default(const coord_def& p) +{ + int m; + dungeon_feature_type f = env.grid(p); + if (grid_is_opaque(f)) + return OPC_OPAQUE; + else if (is_opaque_cloud(env.cgrid(p))) + return OPC_HALF; + else if (f == DNGN_TREES) + return OPC_HALF; + else if ((m = mgrd(p)) != NON_MONSTER && menv[m].type == MONS_BUSH) + return OPC_HALF; + else + return OPC_CLEAR; +} + +bool bounds_los_radius(const coord_def& p) +{ + return (p.abs() <= get_los_radius_squared()); +} /* los_param_trans */ |