summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/direct.cc5
-rw-r--r--crawl-ref/source/direct.h3
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/item_use.cc2
-rw-r--r--crawl-ref/source/spells1.cc4
-rw-r--r--crawl-ref/source/spl-cast.cc21
-rw-r--r--crawl-ref/source/spl-util.cc4
-rw-r--r--crawl-ref/source/spl-util.h1
8 files changed, 30 insertions, 12 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index ae23bd7c8e..917e7e313a 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -251,7 +251,8 @@ static void draw_ray_glyph(const coord_def &pos, int colour,
//---------------------------------------------------------------
void direction(dist& moves, targeting_type restricts,
targ_mode_type mode, bool just_looking,
- const char *prompt, targeting_behaviour *beh)
+ bool needs_path, const char *prompt,
+ targeting_behaviour *beh)
{
static targeting_behaviour stock_behaviour;
if (!beh)
@@ -271,7 +272,7 @@ void direction(dist& moves, targeting_type restricts,
cursor_control con(!Options.use_fake_cursor);
int dir = 0;
- bool show_beam = Options.show_beam;
+ bool show_beam = Options.show_beam && !just_looking && needs_path;
ray_def ray;
FixedVector < char, 2 > objfind_pos;
diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h
index 183a7582eb..b3d2fa3482 100644
--- a/crawl-ref/source/direct.h
+++ b/crawl-ref/source/direct.h
@@ -42,7 +42,8 @@ public:
void direction( dist &moves, targeting_type restricts = DIR_NONE,
targ_mode_type mode = TARG_ANY, bool just_looking = false,
- const char *prompt = NULL, targeting_behaviour *mod = NULL );
+ bool needs_path = true, const char *prompt = NULL,
+ targeting_behaviour *mod = NULL );
bool in_los_bounds(int x, int y);
bool in_viewport_bounds(int x, int y);
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 52d45c9caf..8194a74128 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1555,7 +1555,7 @@ void yell(void)
}
mpr("Gang up on whom?", MSGCH_PROMPT);
- direction( targ, DIR_TARGET, TARG_ENEMY );
+ direction( targ, DIR_TARGET, TARG_ENEMY, false, false );
if (targ.isCancel)
{
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index c3174898fb..9ab722f446 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1340,7 +1340,7 @@ static bool choose_fire_target(dist &target, int &item)
message_current_target();
fire_target_behaviour beh(item);
- direction( target, DIR_NONE, TARG_ENEMY, false, NULL, &beh );
+ direction( target, DIR_NONE, TARG_ENEMY, false, true, NULL, &beh );
if (!target.isValid)
{
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 13ef6487af..11db9b44d8 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -81,7 +81,7 @@ int blink(int pow, bool high_level_controlled_blink)
// query for location {dlb}:
for (;;)
{
- direction(beam, DIR_TARGET, TARG_ANY, false, "Blink to where?");
+ direction(beam, DIR_TARGET, TARG_ANY, false, false, "Blink to where?");
if (!beam.isValid || coord_def(beam.tx, beam.ty) == you.pos())
{
@@ -452,7 +452,7 @@ bool conjure_flame(int pow)
done_first_message = true;
}
- direction( spelld, DIR_TARGET, TARG_ENEMY );
+ direction( spelld, DIR_TARGET, TARG_ENEMY, false, false );
if (!spelld.isValid)
{
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index dbbc362fae..1a5f611d69 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -31,6 +31,7 @@
#include "format.h"
#include "initfile.h"
#include "it_use2.h"
+#include "item_use.h"
#include "itemname.h"
#include "itemprop.h"
#include "macro.h"
@@ -859,10 +860,24 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
testbits( flags, SPFLAG_DIR ) ? DIR_DIR : DIR_NONE);
const char *prompt = get_spell_target_prompt(spell);
- if (dir == DIR_DIR)
+ if (spell == SPELL_PORTALED_PROJECTILE)
+ {
+ const int idx = get_fire_item_index();
+ if ( idx == ENDOFPACK )
+ {
+ mpr("No suitable missiles.");
+ return (SPRET_ABORT);
+ }
+ mprf(MSGCH_PROMPT, "Where do you want to aim %s?",
+ you.inv[idx].name(DESC_NOCAP_YOUR).c_str());
+ }
+ else if (dir == DIR_DIR)
mpr(prompt? prompt : "Which direction? ", MSGCH_PROMPT);
-
- if ( !spell_direction( spd, beam, dir, targ, prompt ) )
+
+ bool needs_path =
+ !(testbits(flags, SPFLAG_GRID) || testbits(flags, SPFLAG_TARGET));
+
+ if ( !spell_direction( spd, beam, dir, targ, needs_path, prompt ) )
return (SPRET_ABORT);
if (testbits( flags, SPFLAG_NOT_SELF ) && spd.isMe)
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 6cd0a5cad2..236ea1f35f 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -678,12 +678,12 @@ void apply_area_cloud( int (*func) (int, int, int, cloud_type, kill_category),
// Return false if the user canceled, true otherwise.
bool spell_direction( dist &spelld, bolt &pbolt,
targeting_type restrict, targ_mode_type mode,
- const char *prompt )
+ bool needs_path, const char *prompt )
{
if (restrict != DIR_DIR)
message_current_target();
- direction( spelld, restrict, mode, false, prompt );
+ direction( spelld, restrict, mode, false, needs_path, prompt );
if (!spelld.isValid)
{
diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h
index e64095654a..0b3b1d35ae 100644
--- a/crawl-ref/source/spl-util.h
+++ b/crawl-ref/source/spl-util.h
@@ -98,6 +98,7 @@ int apply_area_within_radius(int (*func) (int, int, int, int),
bool spell_direction( dist &spelld, bolt &pbolt,
targeting_type restrict = DIR_NONE,
targ_mode_type mode = TARG_ENEMY,
+ bool needs_path = true,
const char *prompt = NULL );
void apply_area_cloud(int (*func) (int, int, int, cloud_type, kill_category),