From 0cb9011c4d8b1075d0459007641cb2cd7fa94907 Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 15 May 2007 03:54:11 +0000 Subject: 1718585: 'f' and 't' behaviour changed, as follows: If cursor is on you, 'f' and 't' act like 'p' (fire at previous target.) Otherwise they act like '.' (fire at current target.) 'p' is still unconditional fire-at-previous-target. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1473 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/direct.cc | 11 ++++++++++- crawl-ref/source/enum.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index c43c89ab6b..d851b4d504 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -133,7 +133,8 @@ static command_type read_direction_key(bool just_looking = false) case '>': return CMD_TARGET_FIND_DOWNSTAIR; case CONTROL('F'): return CMD_TARGET_CYCLE_TARGET_MODE; - case 'p': case 'f': case 't': return CMD_TARGET_PREV_TARGET; + case 'p': return CMD_TARGET_PREV_TARGET; + case 'f': case 't': return CMD_TARGET_MAYBE_PREV_TARGET; case '-': return CMD_TARGET_CYCLE_BACK; case '+': case '=': return CMD_TARGET_CYCLE_FORWARD; @@ -386,6 +387,14 @@ void direction(struct dist& moves, targeting_type restricts, target_unshifted = false; } + if ( key_command == CMD_TARGET_MAYBE_PREV_TARGET ) + { + if ( moves.tx == you.x_pos && moves.ty == you.y_pos ) + key_command = CMD_TARGET_PREV_TARGET; + else + key_command = CMD_TARGET_SELECT; + } + bool need_beam_redraw = false; bool force_redraw = false; bool loop_done = false; diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index ac9353569c..7b0caa19c0 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -727,6 +727,7 @@ enum command_type CMD_TARGET_CYCLE_TARGET_MODE, CMD_TARGET_PREV_TARGET, + CMD_TARGET_MAYBE_PREV_TARGET, CMD_TARGET_SELECT, CMD_TARGET_SELECT_ENDPOINT, CMD_TARGET_OBJ_CYCLE_BACK, -- cgit v1.2.3-54-g00ecf