summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-15 20:32:51 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-15 20:32:51 +0000
commit89162833bce0a3fc8d4b75dd3300dc6db24e4666 (patch)
treeca071c4a8690e06699305f91aa1853448af82150 /crawl-ref
parent5991be809a9b206d7450cdf455157e40d98d40e2 (diff)
downloadcrawl-ref-89162833bce0a3fc8d4b75dd3300dc6db24e4666.tar.gz
crawl-ref-89162833bce0a3fc8d4b75dd3300dc6db24e4666.zip
Applied Enne's fix to 1795522: "show_beam shouldn't work
when just looking..." While I was at it, I also added another parameter needs_path that is set to false for spells that can be applied directly to a target (SPFLAG_GRID, SPFLAG_TARGET) such as Smiting, Conjure Flame or Freezing Cloud, so for these the initial beam path doesn't show, even if the option should be set to true. Note "initial beam path" - you can still toggle it to show the path anyway. For cases such as this we might enforce not drawing the path but there would have to be some kind of feedback, so the player doesn't go crazy trying to toggle the option. ;) I'll probably do it later, once I've found a way to give the information. Or would that be too spoily, in any case? git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2091 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-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),