summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-17 14:50:31 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-17 16:45:17 +0200
commit2f62da4f8d850459676d780980dbabb7f25a1488 (patch)
tree10e56266cb996fff15f0afe504e4d49df814faa6 /crawl-ref
parente6d4aa80db70499cf1f0dd1b1d6a61c539ba8399 (diff)
downloadcrawl-ref-2f62da4f8d850459676d780980dbabb7f25a1488.tar.gz
crawl-ref-2f62da4f8d850459676d780980dbabb7f25a1488.zip
Remove chain-lightning specific LOS test from beam.cc.
There's now a spell-specific _lightning_los which may require some fine-tuning -- I'm not quite sure of the intention of the original check.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/beam.cc23
-rw-r--r--crawl-ref/source/beam.h1
-rw-r--r--crawl-ref/source/losparam.h1
-rw-r--r--crawl-ref/source/spells1.cc11
4 files changed, 10 insertions, 26 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 83736773da..59b839ccf3 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2832,29 +2832,6 @@ void fire_tracer(const monsters *monster, bolt &pbolt, bool explode_only)
pbolt.is_tracer = false;
}
-/**
- * Checks whether target is in sight of source.
- *
- * Only used from cast_chain_lightning currently.
- * XXX: Move to los.cc; integrate with other LOS code.
- */
-bool check_line_of_sight(const coord_def& source, const coord_def& target)
-{
- const int dist = grid_distance(source, target);
-
- // Can always see one square away.
- if (dist <= 1)
- return (true);
-
- // Currently we limit the range to 8.
- if (dist > MONSTER_LOS_RANGE)
- return (false);
-
- // Note that we are guaranteed to be within the player LOS range,
- // so fallback is unnecessary.
- return exists_ray(source, target);
-}
-
// When a mimic is hit by a ranged attack, it teleports away (the slow
// way) and changes its appearance - the appearance change is in
// monster_teleport() in mstuff2.cc.
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index 56908cc023..41f410c8ac 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -291,7 +291,6 @@ bool napalm_monster(monsters *monster, kill_category who, int levels = 1,
bool verbose = true);
void fire_tracer( const monsters *monster, struct bolt &pbolt,
bool explode_only = false );
-bool check_line_of_sight( const coord_def& source, const coord_def& target );
void mimic_alert( monsters *mimic );
bool zapping(zap_type ztype, int power, bolt &pbolt,
bool needs_tracer = false, const char* msg = NULL);
diff --git a/crawl-ref/source/losparam.h b/crawl-ref/source/losparam.h
index 4d5bc141e1..82dee24519 100644
--- a/crawl-ref/source/losparam.h
+++ b/crawl-ref/source/losparam.h
@@ -60,6 +60,7 @@ struct bounds_radius_sq : bounds_func
: radius_sq(r_sq) {}
bool operator()(const coord_def& p) const;
};
+static bounds_radius_sq bds_maxlos(LOS_RADIUS);
// LOS bounded by current global LOS radius.
struct bounds_los_radius : bounds_func
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 0e71583ffb..e49807379a 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -297,6 +297,13 @@ void cast_fire_storm(int pow, bolt &beam)
viewwindow(true, false);
}
+bool _lightning_los(const coord_def& source, const coord_def& target)
+{
+ // XXX: currently bounded by circular LOS radius;
+ // XXX: adapt opacity -- allow passing clouds.
+ return (exists_ray(source, target, opc_solid, bds_maxlos));
+}
+
void cast_chain_lightning(int pow)
{
bolt beam;
@@ -350,7 +357,7 @@ void cast_chain_lightning(int pow)
if (dist > min_dist)
continue;
- if (!check_line_of_sight(source, monster->pos()))
+ if (_lightning_los(source, monster->pos()))
continue;
count++;
@@ -387,7 +394,7 @@ void cast_chain_lightning(int pow)
if ((target.x == -1
|| dist < min_dist
|| (dist == min_dist && one_chance_in(count + 1)))
- && check_line_of_sight(source, you.pos()))
+ && _lightning_los(source, you.pos()))
{
target = you.pos();
}