summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-03-07 19:40:23 +0100
committerAdam Borowski <kilobyte@angband.pl>2011-03-07 19:40:23 +0100
commit15537459ded4cf1a6e5dc2818800d59f6af1dc48 (patch)
treee21acbadd6750e19a8d56214cf442501d3bfdc28 /crawl-ref/source/directn.h
parent4c1aef9351d8625110220b7d5746a76f01f75565 (diff)
downloadcrawl-ref-15537459ded4cf1a6e5dc2818800d59f6af1dc48.tar.gz
crawl-ref-15537459ded4cf1a6e5dc2818800d59f6af1dc48.zip
New targetting code; for now for reaching and Fire Storm.
directn.cc tried to assume everything is a beam, this make it impossible to properly visualise spells/effects with different rules, like reaching, clouds, IOOD, shotgun-targetted spells, cones, etc. This interface lets every spell come with an object that answers the question: if I aim at X, will location Y be affected? There are three levels of aiming effect now: * tracer only * might be affected * will be affected unless you miss This means we can show spells that have randomized area: Freezing Cloud, Fire Storm's radius, etc. TODO: display in tiles. The old targetter has a great number of special cases, I did not replace it yet since it would be a large amount of work. The new code allows for showing explosions and bounces, but I'd start with clouds and such first. Fire Storm is a good sample. Also, this commit fixes the targetter not allowing you to reach sqrt(8) via 'f' or '.'; you had to use '!' to do that. A number of places in the code assumed that, with a special distinction for two modes of reaching.
Diffstat (limited to 'crawl-ref/source/directn.h')
-rw-r--r--crawl-ref/source/directn.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h
index faea2c1fc1..344edb7c91 100644
--- a/crawl-ref/source/directn.h
+++ b/crawl-ref/source/directn.h
@@ -13,6 +13,7 @@
#include "enum.h"
#include "ray.h"
#include "state.h"
+#include "target.h"
class range_view_annotator
{
@@ -69,6 +70,7 @@ public:
struct direction_chooser_args
{
+ targetter *hitfunc;
targeting_type restricts;
targ_mode_type mode;
int range;
@@ -83,6 +85,7 @@ struct direction_chooser_args
bool show_floor_desc;
direction_chooser_args() :
+ hitfunc(NULL),
restricts(DIR_NONE),
mode(TARG_ANY),
range(-1),
@@ -232,6 +235,7 @@ private:
targeting_behaviour *behaviour; // Can be NULL for default
bool cancel_at_self; // Disallow self-targeting?
bool show_floor_desc; // Describe the floor of the current target
+ targetter *hitfunc; // Determine what would be hit.
// Internal data.
ray_def beam; // The (possibly invalid) beam.