summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-18 20:29:53 +0000
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-10-04 22:43:03 +0530
commit0a9bc55e9cd63d2badb476ff24d5cb66d4a15950 (patch)
tree51a13210ccbb94f8b7989b679779d9ba5393ee3a
parent51bad159a467557a48c665cb12b46acdaa5153fb (diff)
downloadcrawl-ref-0a9bc55e9cd63d2badb476ff24d5cb66d4a15950.tar.gz
crawl-ref-0a9bc55e9cd63d2badb476ff24d5cb66d4a15950.zip
Change part of the z/Z handling:
* added option darken_beyond_range (defaults to true) * Z doesn't show the spell list anymore git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10278 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/options_guide.txt6
-rw-r--r--crawl-ref/settings/init.txt1
-rw-r--r--crawl-ref/source/directn.cc15
-rw-r--r--crawl-ref/source/initfile.cc6
-rw-r--r--crawl-ref/source/spl-cast.cc16
5 files changed, 28 insertions, 16 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index 41badf56e8..9b33332a3d 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -586,6 +586,12 @@ target_unshifted_dirs = false
If you use target_unshifted_dirs, default_target will be
automatically disabled.
+darken_beyond_range = true
+ If set to true, everything beyond range when targeting will be
+ coloured grey. Setting this to false will also suppress the brief
+ flash if there are no visible monsters within range, both for
+ ASCII and the Tiles version.
+
4-c Passive Sightings (detected or remembered entities).
-----------------------------------------------------------
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index d9062fe584..a28fb2d299 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -119,6 +119,7 @@ drop_filter = useless_item
# target_los_first = false
# default_target = false
# target_unshifted_dirs = true
+# darken_beyond_range = false
##### 4-c Passive Sightings #####################
#
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 68e1509272..29e53c4a53 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -888,13 +888,12 @@ crawl_exit_hook::~crawl_exit_hook()
range_view_annotator::range_view_annotator(int range)
{
- do_anything = (range >= 0);
-
- if (do_anything)
+ if (range >= 0)
{
- Options.target_range = range;
- // Repaint.
-// viewwindow(true, false);
+#ifndef USE_TILE
+ if (Options.target_range != -1)
+#endif
+ Options.target_range = range;
}
}
@@ -906,11 +905,7 @@ range_view_annotator::~range_view_annotator()
void range_view_annotator::restore_state()
{
- if (!do_anything)
- return;
-
Options.target_range = 0;
- do_anything = false;
}
bool _dist_ok(const dist& moves, int range, targ_mode_type mode,
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index d3dda61ca3..d38f411eb0 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -850,6 +850,7 @@ void game_options::reset_options()
target_oos = true;
target_los_first = true;
target_unshifted_dirs = false;
+ target_range = 0; // -1 -> grey out targets out of range
dump_kill_places = KDO_ONE_PLACE;
dump_message_count = 7;
@@ -3016,6 +3017,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
if (target_unshifted_dirs)
default_target = false;
}
+ else if (key == "darken_beyond_range")
+ {
+ if (!_read_bool(field, target_range != -1))
+ target_range = -1;
+ }
else if (key == "drop_mode")
{
if (field.find("multi") != std::string::npos)
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 61be1b39c5..ff54ef83dd 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -690,7 +690,7 @@ bool cast_a_spell(bool check_range)
const int minRange = _get_dist_to_nearest_monster();
- int keyin = (check_range ? 0 : '?');
+ int keyin = 0;
while (true)
{
@@ -753,13 +753,17 @@ bool cast_a_spell(bool check_range)
{
// Abort if there are no hostiles within range, but flash the range
// markers for about half a second.
- Options.target_range = _calc_spell_range(spell);
- viewwindow(true, false);
mpr("There are no visible monsters within range! (Use <w>Z</w> to "
"cast anyway.)");
- delay(500);
- Options.target_range = 0;
- viewwindow(true, false);
+
+ if (Options.target_range != -1)
+ {
+ Options.target_range = _calc_spell_range(spell);
+ viewwindow(true, false);
+ delay(500);
+ Options.target_range = 0;
+ viewwindow(true, false);
+ }
return (false);
}