summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/direct.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 13:24:53 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 13:24:53 +0000
commit370f12250ba294042472a110a006769e42f1bff4 (patch)
tree7efb66d450cdf38ff81a0a7e1e6ba3583c1f18ba /crawl-ref/source/direct.cc
parent12213fbee2d290bf594b9219ae6720075166ca79 (diff)
downloadcrawl-ref-370f12250ba294042472a110a006769e42f1bff4.tar.gz
crawl-ref-370f12250ba294042472a110a006769e42f1bff4.zip
Added target_unshifted_dirs option to activate old (0.1.x) targeting keymap.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1015 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/direct.cc')
-rw-r--r--crawl-ref/source/direct.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index eeb58d7532..0aebaf1a28 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -98,10 +98,19 @@ static bool is_mapped(int x, int y)
return (is_player_mapped(x, y));
}
-static command_type read_direction_key(bool just_looking = false)
+static command_type read_direction_key(
+ bool just_looking = false,
+ bool target_unshifted = false,
+ coord_def where = coord_def())
{
+ const bool unshifted_dir = target_unshifted && where == you.pos();
+
flush_input_buffer( FLUSH_BEFORE_COMMAND );
- const int key = unmangle_direction_keys(getchm(KC_TARGETING),KC_TARGETING);
+
+ int key = unmangle_direction_keys(getchm(KC_TARGETING),KC_TARGETING);
+ if (unshifted_dir && strchr("hjklyubn", key))
+ key = toupper(key);
+
switch ( key )
{
case ESCAPE: return CMD_TARGET_CANCEL;
@@ -278,6 +287,7 @@ void direction(struct dist& moves, targeting_type restricts,
bool skip_iter = false;
bool found_autotarget = false;
+ bool target_unshifted = Options.target_unshifted_dirs;
// Find a default target
if ( Options.default_target && mode == TARG_ENEMY )
@@ -325,7 +335,18 @@ void direction(struct dist& moves, targeting_type restricts,
key_command = CMD_TARGET_CYCLE_FORWARD; // find closest enemy
}
else
- key_command = read_direction_key(just_looking);
+ key_command = read_direction_key(just_looking,
+ target_unshifted,
+ coord_def(moves.tx, moves.ty));
+
+ if (target_unshifted &&
+ (key_command == CMD_TARGET_CYCLE_FORWARD
+ || key_command == CMD_TARGET_CYCLE_BACK
+ || key_command == CMD_TARGET_OBJ_CYCLE_FORWARD
+ || key_command == CMD_TARGET_OBJ_CYCLE_BACK))
+ {
+ target_unshifted = false;
+ }
bool need_beam_redraw = false;
bool force_redraw = false;