summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/direct.cc521
-rw-r--r--crawl-ref/source/direct.h2
-rw-r--r--crawl-ref/source/enum.h16
-rw-r--r--crawl-ref/source/it_use3.cc2
-rw-r--r--crawl-ref/source/spells1.cc14
-rw-r--r--crawl-ref/source/spells2.cc6
-rw-r--r--crawl-ref/source/spells3.cc4
-rw-r--r--crawl-ref/source/spells4.cc6
-rw-r--r--crawl-ref/source/spl-util.cc4
-rw-r--r--crawl-ref/source/stuff.cc9
-rw-r--r--crawl-ref/source/stuff.h2
11 files changed, 370 insertions, 216 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index 9d703cfa76..fb42388bcc 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -78,7 +78,7 @@ static const char ycomp[9] = { 1, 1, 1, 0, 0, 0, -1, -1, -1 };
// [dshaligram] Removed . and 5 from dirchars so it's easier to
// special case them.
static const char dirchars[19] = { "b1j2n3h4bbl6y7k8u9" };
-static const char *aim_prompt = "Aim (move cursor or -/+/=, change mode with CTRL-F, select with . or >)";
+static const char *aim_prompt = "Aim (move cursor or -/+, change mode with CTRL-F, select with . or >)";
static void describe_feature(int mx, int my, bool oos);
static void describe_cell(int mx, int my);
@@ -86,31 +86,76 @@ static void describe_cell(int mx, int my);
static bool find_object( int x, int y, int mode );
static bool find_monster( int x, int y, int mode );
static bool find_feature( int x, int y, int mode );
+
+static char find_square_wrapper( int tx, int ty,
+ FixedVector<char, 2> &mfp, char direction,
+ bool (*targ)(int, int, int),
+ int mode = TARG_ANY,
+ bool wrap = false,
+ int los = LOS_ANY);
+
static char find_square( unsigned char xps, unsigned char yps,
- FixedVector<char, 2> &mfp, char direction,
- bool (*targ)(int, int, int),
- int mode = TARG_ANY,
- bool wrap = false,
- int los = LOS_ANY);
+ FixedVector<char, 2> &mfp, char direction,
+ bool (*targ)(int, int, int),
+ int mode = TARG_ANY,
+ bool wrap = false,
+ int los = LOS_ANY);
+
+static int targeting_cmd_to_compass( command_type command );
static bool is_mapped(int x, int y)
{
return (is_player_mapped(x, y));
}
-static int read_direction_key()
+static command_type read_direction_key()
{
- return unmangle_direction_keys(getchm(KC_TARGETING), KC_TARGETING);
+ flush_input_buffer( FLUSH_BEFORE_COMMAND );
+ const int key = unmangle_direction_keys(getchm(KC_TARGETING),KC_TARGETING);
+ switch ( key )
+ {
+
+ case ESCAPE: return CMD_TARGET_CANCEL;
+ case '?': return CMD_TARGET_DESCRIBE;
+ case ' ': case '.': return CMD_TARGET_SELECT;
+
+ case CONTROL('F'): return CMD_TARGET_CYCLE_TARGET_MODE;
+ case 'p': case 'f': case 't': return CMD_TARGET_PREV_TARGET;
+
+ case '-': return CMD_TARGET_CYCLE_BACK;
+ case '+': return CMD_TARGET_CYCLE_FORWARD;
+ case ';': return CMD_TARGET_OBJ_CYCLE_BACK;
+ case '/': return CMD_TARGET_OBJ_CYCLE_FORWARD;
+
+ case 'b': return CMD_TARGET_DOWN_LEFT;
+ case 'h': return CMD_TARGET_LEFT;
+ case 'j': return CMD_TARGET_DOWN;
+ case 'k': return CMD_TARGET_UP;
+ case 'l': return CMD_TARGET_RIGHT;
+ case 'n': return CMD_TARGET_DOWN_RIGHT;
+ case 'u': return CMD_TARGET_UP_RIGHT;
+ case 'y': return CMD_TARGET_UP_LEFT;
+
+ case 'B': return CMD_TARGET_DIR_DOWN_LEFT;
+ case 'H': return CMD_TARGET_DIR_LEFT;
+ case 'J': return CMD_TARGET_DIR_DOWN;
+ case 'K': return CMD_TARGET_DIR_UP;
+ case 'L': return CMD_TARGET_DIR_RIGHT;
+ case 'N': return CMD_TARGET_DIR_DOWN_RIGHT;
+ case 'U': return CMD_TARGET_DIR_UP_RIGHT;
+ case 'Y': return CMD_TARGET_DIR_UP_LEFT;
+
+ default: return CMD_NO_CMD;
+ }
}
//---------------------------------------------------------------
//
// direction
//
-// input: restricts : DIR_NONE accepts keypad dir or targetting
-// DIR_TARGET must use targetting.
-// DIR_DIR must use keypad direction
-//
+// use restrict == DIR_DIR to allow only a compass direction;
+// == DIR_TARGET to allow only choosing a square;
+// == DIR_NONE to allow either.
//
// outputs: dist structure:
//
@@ -134,216 +179,302 @@ static int read_direction_key()
// targetting mode is handled by look_around()
//---------------------------------------------------------------
-void direction2( struct dist &moves, int restrict, int mode )
+void direction_choose_compass( struct dist& moves )
{
- bool dir_chosen = false;
- bool targ_chosen = false;
+ moves.isValid = true;
+ moves.isTarget = false;
+ moves.isMe = false;
+ moves.isCancel = false;
+ moves.dx = moves.dy = 0;
+
+ do {
+ const command_type key_command = read_direction_key();
+ const int i = targeting_cmd_to_compass(key_command);
+ if ( i != -1 )
+ {
+ moves.dx = Compass[i].x;
+ moves.dy = Compass[i].y;
+ }
+ else if ( key_command == CMD_TARGET_CANCEL )
+ {
+ moves.isCancel = true;
+ moves.isValid = false;
+ }
+ } while ( !moves.isCancel && moves.dx == 0 && moves.dy == 0 );
+
+ return;
+}
+
+static int targeting_cmd_to_compass( command_type command )
+{
+ switch ( command )
+ {
+ case CMD_TARGET_UP: case CMD_TARGET_DIR_UP:
+ return 0;
+ case CMD_TARGET_UP_RIGHT: case CMD_TARGET_DIR_UP_RIGHT:
+ return 1;
+ case CMD_TARGET_RIGHT: case CMD_TARGET_DIR_RIGHT:
+ return 2;
+ case CMD_TARGET_DOWN_RIGHT: case CMD_TARGET_DIR_DOWN_RIGHT:
+ return 3;
+ case CMD_TARGET_DOWN: case CMD_TARGET_DIR_DOWN:
+ return 4;
+ case CMD_TARGET_DOWN_LEFT: case CMD_TARGET_DIR_DOWN_LEFT:
+ return 5;
+ case CMD_TARGET_LEFT: case CMD_TARGET_DIR_LEFT:
+ return 6;
+ case CMD_TARGET_UP_LEFT: case CMD_TARGET_DIR_UP_LEFT:
+ return 7;
+ default:
+ return -1;
+ }
+}
+
+void direction( struct dist &moves, int restricts, int mode )
+{
+ if ( restricts == DIR_DIR )
+ {
+ direction_choose_compass( moves );
+ return;
+ }
+
int dir = 0;
+ FixedVector < char, 2 > objfind_pos;
+ FixedVector < char, 2 > monsfind_pos;
+
// init
moves.isValid = false;
moves.isTarget = false;
moves.isMe = false;
moves.isCancel = false;
moves.dx = moves.dy = 0;
- moves.tx = moves.ty = 0;
+
+ // XXX change this for default target
+ moves.tx = you.x_pos;
+ moves.ty = you.y_pos;
+
+ // XXX Add: ability to cycle between appropriate rays!
// XXX. this is ALWAYS in relation to the player. But a bit of a hack
// nonetheless! --GDL
- gotoxy( VIEW_CX + 1, VIEW_CY );
- int keyin = read_direction_key();
+ mpr(aim_prompt);
- if (keyin == 0)
- return;
-
- if (strchr( dirchars, keyin ) != NULL)
- {
- dir_chosen = true;
- dir = (int)(strchr(dirchars, keyin) - dirchars) / 2;
- }
- else if (strchr( dirchars, tolower(keyin) ) != NULL)
- {
- dir_chosen = true;
- dir = (int)(strchr(dirchars, keyin) - dirchars) / 2;
- }
- else
+ while (1)
{
- switch (keyin)
+ // I'm sure there's a perfectly good reason for the +1.
+ gotoxy( grid2viewX(moves.tx) + 1, grid2viewY(moves.ty) );
+
+ command_type key_command = read_direction_key();
+
+ bool need_redraw = true;
+ bool loop_done = false;
+
+ const int old_tx = moves.tx;
+ const int old_ty = moves.ty;
+
+ int i, mid;
+
+ switch ( key_command )
{
- case CONTROL('F'):
- mode = (mode + 1) % TARG_NUM_MODES;
- snprintf( info, INFO_SIZE, "Targeting mode is now: %s",
- (mode == TARG_ANY) ? "any" :
- (mode == TARG_ENEMY) ? "enemies"
- : "friends" );
- mpr( info );
- targ_chosen = true;
- dir = 0;
+ // standard movement
+ case CMD_TARGET_DOWN_LEFT:
+ case CMD_TARGET_DOWN:
+ case CMD_TARGET_DOWN_RIGHT:
+ case CMD_TARGET_LEFT:
+ case CMD_TARGET_RIGHT:
+ case CMD_TARGET_UP_LEFT:
+ case CMD_TARGET_UP:
+ case CMD_TARGET_UP_RIGHT:
+ i = targeting_cmd_to_compass(key_command);
+ moves.tx += Compass[i].x;
+ moves.ty += Compass[i].y;
break;
-
- case '-':
- targ_chosen = true;
- dir = -1;
+
+ case CMD_TARGET_DIR_DOWN_LEFT:
+ case CMD_TARGET_DIR_DOWN:
+ case CMD_TARGET_DIR_DOWN_RIGHT:
+ case CMD_TARGET_DIR_LEFT:
+ case CMD_TARGET_DIR_RIGHT:
+ case CMD_TARGET_DIR_UP_LEFT:
+ case CMD_TARGET_DIR_UP:
+ case CMD_TARGET_DIR_UP_RIGHT:
+ i = targeting_cmd_to_compass(key_command);
+
+ if ( restricts != DIR_TARGET )
+ {
+ // A direction is allowed, and we've selected it.
+ moves.dx = Compass[i].x;
+ moves.dy = Compass[i].y;
+ // Needed for now...eventually shouldn't be necessary
+ moves.tx = you.x_pos + moves.dx;
+ moves.ty = you.y_pos + moves.dy;
+ moves.isValid = true;
+ moves.isTarget = false;
+ loop_done = true;
+ }
+ else
+ {
+ // Direction not allowed, so just move in that direction.
+ // Maybe make this a bigger jump?
+ moves.tx += Compass[i].x;
+ moves.ty += Compass[i].y;
+ }
break;
-
- case '*':
- targ_chosen = true;
- dir = 0;
+
+ case CMD_TARGET_CYCLE_TARGET_MODE:
+ mode = (mode + 1) % TARG_NUM_MODES;
+ mprf( "Targeting mode is now: %s",
+ (mode == TARG_ANY) ? "any" :
+ (mode == TARG_ENEMY) ? "enemies" :
+ "friends" );
+ need_redraw = false;
break;
- case ';':
- targ_chosen = true;
- dir = -3;
- break;
+ case CMD_TARGET_PREV_TARGET:
+ // Do we have a previous target?
+ if (you.prev_targ == MHITNOT || you.prev_targ == MHITYOU)
+ {
+ mpr("You haven't got a previous target.");
+ need_redraw = false;
+ break;
+ }
- case '\'':
- targ_chosen = true;
- dir = -2;
- break;
-
- case '+':
- case '=':
- targ_chosen = true;
- dir = 1;
- break;
+ // we have a valid previous target (maybe)
+ {
+ const monsters *montarget = &menv[you.prev_targ];
+
+ if (!mons_near(montarget) ||
+ !player_monster_visible( montarget ))
+ {
+ mpr("You can't see that creature any more.");
+ need_redraw = false;
+ }
+ else
+ {
+ // We have all the information we need
+ moves.isValid = true;
+ moves.isTarget = true;
+ moves.tx = montarget->x;
+ moves.ty = montarget->y;
+ loop_done = true;
+ }
+ break;
+ }
- case 't':
- case 'p':
- case 'f':
- targ_chosen = true;
- dir = 2;
+ case CMD_TARGET_SELECT: // finalize current choice
+ moves.isValid = true;
+ moves.isTarget = true;
+ loop_done = true;
+ mid = mgrd[moves.tx][moves.ty];
+ if ( mid != NON_MONSTER )
+ you.prev_targ = mid;
break;
-
- case '.':
- case '5':
- dir_chosen = true;
- dir = 4;
+
+ case CMD_TARGET_OBJ_CYCLE_BACK:
+ case CMD_TARGET_OBJ_CYCLE_FORWARD:
+ dir = (key_command == CMD_TARGET_OBJ_CYCLE_BACK) ? -1 : 1;
+ if (find_square_wrapper( moves.tx, moves.ty, objfind_pos, dir,
+ find_object, 0, true,
+ Options.target_los_first
+ ? (dir == 1? LOS_FLIPVH : LOS_FLIPHV)
+ : LOS_ANY))
+ {
+ moves.tx = objfind_pos[0];
+ moves.ty = objfind_pos[1];
+ }
+ else
+ {
+ flush_input_buffer(FLUSH_ON_FAILURE);
+ need_redraw = false;
+ }
+ break;
+
+ case CMD_TARGET_CYCLE_FORWARD:
+ case CMD_TARGET_CYCLE_BACK:
+ dir = (key_command == CMD_TARGET_CYCLE_BACK) ? -1 : 1;
+ if (find_square_wrapper( moves.tx, moves.ty, monsfind_pos, dir,
+ find_monster, mode, Options.target_wrap ))
+ {
+ moves.tx = monsfind_pos[0];
+ moves.ty = monsfind_pos[1];
+ }
+ else
+ {
+ flush_input_buffer(FLUSH_ON_FAILURE);
+ need_redraw = false;
+ }
break;
- case ESCAPE:
+ case CMD_TARGET_CANCEL:
+ loop_done = true;
moves.isCancel = true;
- return;
-
+ break;
+
+ case CMD_TARGET_DESCRIBE:
+ // Maybe we can skip this check...but it can't hurt
+ if (!in_bounds(moves.tx, moves.ty))
+ break;
+ mid = mgrd[moves.tx][moves.ty];
+ if (mid == NON_MONSTER)
+ {
+ // XXX we can put in code for describing terrain here
+ need_redraw = false;
+ break;
+ }
+
+#if (!DEBUG_DIAGNOSTICS)
+ if (!player_monster_visible( &menv[mid] ))
+ {
+ need_redraw = false;
+ break;
+ }
+#endif
+ describe_monsters(menv[mid].type, mid);
+ redraw_screen();
+ mesclr(true);
+ break;
default:
+ need_redraw = false;
break;
}
- }
-
- // at this point, we know exactly the input - validate
- if (!(targ_chosen || dir_chosen) || (targ_chosen && restrict == DIR_DIR))
- {
- mpr("What an unusual direction.");
- return;
- }
-
- // special case: they typed a dir key, but they're in target-only mode
- if (dir_chosen && restrict == DIR_TARGET)
- {
- mpr(aim_prompt);
- look_around( moves, false, keyin, mode );
- return;
- }
-
- if (targ_chosen)
- {
- if (dir < 2)
- {
- mpr(aim_prompt);
- moves.prev_target = dir;
- look_around( moves, false, -1, mode );
- if (moves.prev_target != -1) // -1 means they pressed 'p'
- return;
- }
-
- // chose to aim at previous target. do we have one?
- if (you.prev_targ == MHITNOT || you.prev_targ == MHITYOU)
+
+ if ( loop_done == true )
{
- mpr("You haven't got a target.");
- return;
+ if ( moves.isTarget && !see_grid(moves.tx, moves.ty) )
+ {
+ mpr("Sorry, you can't target what you can't see.");
+ need_redraw = false;
+ }
+ // Ask for confirmation if we're quitting for some odd reason
+ else if ( moves.isValid || moves.isCancel ||
+ yesno("Are you sure you want to fizzle?") )
+ {
+ break;
+ }
}
- // we have a valid previous target (maybe)
- struct monsters *montarget = &menv[you.prev_targ];
-
- if (!mons_near(montarget) || !player_monster_visible( montarget ))
+ // Tried to step out of bounds
+ if ( !in_bounds(moves.tx, moves.ty) )
{
- mpr("You can't see that creature any more.");
- return;
+ moves.tx = old_tx;
+ moves.ty = old_ty;
+ need_redraw = true; // not sure this is necessary
}
- else
+
+ if ( need_redraw )
{
- moves.isValid = true;
- moves.isTarget = true;
- moves.tx = montarget->x;
- moves.ty = montarget->y;
+ // XXX : put in beam redrawing code here
+ mesclr(true);
+ describe_cell(moves.tx, moves.ty);
}
- return;
}
- // at this point, we have a direction, and direction is allowed.
- moves.isValid = true;
- moves.isTarget = false;
- moves.dx = xcomp[dir];
- moves.dy = ycomp[dir];
- if (xcomp[dir] == 0 && ycomp[dir] == 0)
- moves.isMe = true;
-
- // now the tricky bit - extend the target x,y out to map edge.
- int mx, my;
- mx = my = 0;
-
- if (moves.dx > 0)
- mx = (GXM - 1) - you.x_pos;
- if (moves.dx < 0)
- mx = you.x_pos;
-
- if (moves.dy > 0)
- my = (GYM - 1) - you.y_pos;
- if (moves.dy < 0)
- my = you.y_pos;
-
- if (!(mx == 0 || my == 0))
- {
- if (mx < my)
- my = mx;
- else
- mx = my;
- }
- moves.tx = you.x_pos + moves.dx * mx;
- moves.ty = you.y_pos + moves.dy * my;
-}
+ moves.isMe = (moves.tx == you.x_pos && moves.ty == you.y_pos);
-/* safe version of direction */
-void direction( struct dist &moves, int restrict, int mode,
- bool confirm_fizzle )
-{
- while ( 1 )
- {
- direction2( moves, restrict, mode );
- if ( moves.isMe && Options.confirm_self_target == true &&
- mode != TARG_FRIEND )
- {
- if ( yesno("Really target yourself? ", false, 'n') )
- return;
- else
- mpr("Choose a better target.", MSGCH_PROMPT);
- }
- else if ( confirm_fizzle && !moves.isValid && Options.fizzlecheck_on )
- {
- if ( yesno("Really fizzle? ", false, 'n') )
- return;
- else
- mpr("Try again.", MSGCH_PROMPT);
- }
- else
- {
- return;
- }
- }
}
-
// Attempts to describe a square that's not in line-of-sight. If
// there's a stash on the square, announces the top item and number
// of items, otherwise, if there's a stair that's in the travel
@@ -870,10 +1001,13 @@ bool in_los_bounds(int x, int y)
//
//---------------------------------------------------------------
static char find_square( unsigned char xps, unsigned char yps,
- FixedVector<char, 2> &mfp, char direction,
- bool (*find_targ)( int x, int y, int mode ),
- int mode, bool wrap, int los )
+ FixedVector<char, 2> &mfp, char direction,
+ bool (*find_targ)( int x, int y, int mode ),
+ int mode, bool wrap, int los )
{
+ // the day will come when [unsigned] chars will be consigned to
+ // the fires of Gehenna. Not quite yet, though.
+
int temp_xps = xps;
int temp_yps = yps;
char x_change = 0;
@@ -892,8 +1026,8 @@ static char find_square( unsigned char xps, unsigned char yps,
{
// We've been told to flip between visible/hidden, so we
// need to find what we're currently on.
- bool vis = (env.show[xps - 8][yps]
- || (xps == VIEW_CX && yps == VIEW_CY));
+ const bool vis = (env.show[xps - 8][yps]
+ || (xps == VIEW_CX && yps == VIEW_CY));
if (wrap && (vis != (los == LOS_FLIPVH)) == (direction == 1))
{
@@ -1074,6 +1208,19 @@ static char find_square( unsigned char xps, unsigned char yps,
next_los(direction, los, wrap)));
}
+// XXX Unbelievably hacky. And to think that my goal was to clean up the code.
+static char find_square_wrapper( int tx, int ty,
+ FixedVector<char, 2> &mfp, char direction,
+ bool (*find_targ)( int x, int y, int mode ),
+ int mode, bool wrap, int los )
+{
+ unsigned char r = find_square(grid2viewX(tx), grid2viewY(ty),
+ mfp, direction, find_targ, mode, wrap, los);
+ mfp[0] = view2gridX(mfp[0]);
+ mfp[1] = view2gridY(mfp[1]);
+ return r;
+}
+
static void describe_feature(int mx, int my, bool oos)
{
if (oos && !is_terrain_seen(mx, my))
@@ -1088,6 +1235,8 @@ static void describe_feature(int mx, int my, bool oos)
}
}
+
+
// Returns a vector of features matching the given pattern.
std::vector<dungeon_feature_type> features_by_desc(const text_pattern &pattern)
{
diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h
index cb31de043d..27f8d16343 100644
--- a/crawl-ref/source/direct.h
+++ b/crawl-ref/source/direct.h
@@ -30,7 +30,7 @@
#define DIR_DIR 2
void direction( struct dist &moves, int restricts = DIR_NONE,
- int mode = TARG_ANY, bool confirm_fizzle = false );
+ int mode = TARG_ANY );
// last updated 12may2000 {dlb}
/* ***********************************************************************
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index fc89fe9381..3b925ee6ac 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -491,11 +491,7 @@ enum canned_message_type // canned_msg() - unsigned char
MSG_UNTHINKING_ACT,
MSG_SPELL_FIZZLES,
MSG_HUH,
- MSG_EMPTY_HANDED,
- MSG_NOT_IN_PRESENT_FORM,
- MSG_TOO_CONFUSED,
- MSG_DISORIENTED,
- MSG_CANT_REACH
+ MSG_EMPTY_HANDED
};
enum char_set_type
@@ -686,6 +682,16 @@ enum command_type
CMD_TARGET_UP_LEFT,
CMD_TARGET_UP,
CMD_TARGET_UP_RIGHT,
+
+ CMD_TARGET_DIR_DOWN_LEFT,
+ CMD_TARGET_DIR_DOWN,
+ CMD_TARGET_DIR_DOWN_RIGHT,
+ CMD_TARGET_DIR_LEFT,
+ CMD_TARGET_DIR_RIGHT,
+ CMD_TARGET_DIR_UP_LEFT,
+ CMD_TARGET_DIR_UP,
+ CMD_TARGET_DIR_UP_RIGHT,
+
CMD_TARGET_CYCLE_TARGET_MODE,
CMD_TARGET_PREV_TARGET,
CMD_TARGET_SELECT,
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 1835726131..d2b4d5d733 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -253,7 +253,7 @@ static void reaching_weapon_attack(void)
mpr("Attack whom?", MSGCH_PROMPT);
- direction( beam, DIR_TARGET, TARG_ENEMY, true );
+ direction(beam, DIR_TARGET, TARG_ENEMY);
if (!beam.isValid)
return;
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 5885526f29..1abdce77b1 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -68,7 +68,7 @@ int blink(void)
{
mpr("Blink to where?", MSGCH_PROMPT);
- direction( beam, DIR_TARGET, TARG_ANY, true );
+ direction(beam, DIR_TARGET, TARG_ANY);
if (!beam.isValid)
{
@@ -180,7 +180,7 @@ int fireball(int power)
message_current_target();
- direction( fire_ball, DIR_NONE, TARG_ENEMY, true );
+ direction( fire_ball, DIR_NONE, TARG_ENEMY );
if (!fire_ball.isValid)
{
@@ -208,7 +208,7 @@ int cast_fire_storm(int powc)
mpr("Where?");
- direction( targ, DIR_TARGET, TARG_ENEMY, true );
+ direction( targ, DIR_TARGET, TARG_ENEMY );
beam.set_target(targ);
@@ -452,7 +452,7 @@ int conjure_flame(int pow)
done_first_message = true;
}
- direction( spelld, DIR_TARGET, TARG_ENEMY, true );
+ direction( spelld, DIR_TARGET, TARG_ENEMY );
if (!spelld.isValid)
{
@@ -495,7 +495,7 @@ int stinking_cloud( int pow )
message_current_target();
- direction( spelld, DIR_NONE, TARG_ENEMY, true );
+ direction( spelld, DIR_NONE, TARG_ENEMY );
if (!spelld.isValid)
{
@@ -533,7 +533,7 @@ int cast_big_c(int pow, char cty)
struct dist cdis;
mpr("Where do you want to put it?", MSGCH_PROMPT);
- direction( cdis, DIR_TARGET, TARG_ENEMY, true );
+ direction( cdis, DIR_TARGET, TARG_ENEMY );
if (!cdis.isValid)
{
@@ -557,7 +557,7 @@ static int healing_spell( int healed )
struct dist bmove;
mpr("Which direction?", MSGCH_PROMPT);
- direction( bmove, DIR_DIR, TARG_FRIEND, true );
+ direction( bmove, DIR_DIR, TARG_FRIEND );
if (!bmove.isValid)
{
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 40b8ea0445..99a41d4eee 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1003,7 +1003,7 @@ int vampiric_drain(int pow)
dirc:
mpr("Which direction?", MSGCH_PROMPT);
- direction( vmove, DIR_DIR, TARG_ENEMY, true );
+ direction( vmove, DIR_DIR, TARG_ENEMY );
if (!vmove.isValid)
{
@@ -1087,7 +1087,7 @@ char burn_freeze(int pow, char flavour)
while (mgr == NON_MONSTER)
{
mpr("Which direction?", MSGCH_PROMPT);
- direction( bmove, DIR_DIR, TARG_ENEMY, true );
+ direction( bmove, DIR_DIR, TARG_ENEMY );
if (!bmove.isValid)
{
@@ -1202,7 +1202,7 @@ int summon_elemental(int pow, int restricted_type,
{
mpr("Summon from material in which direction?", MSGCH_PROMPT);
- direction( smove, DIR_DIR, TARG_ANY, true );
+ direction( smove, DIR_DIR, TARG_ANY );
if (!smove.isValid)
{
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 483c0b87ef..82905972ff 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -195,7 +195,7 @@ int cast_smiting(int power)
mpr("Smite whom?", MSGCH_PROMPT);
- direction( beam, DIR_TARGET, TARG_ENEMY, true );
+ direction( beam, DIR_TARGET, TARG_ENEMY );
if (!beam.isValid)
{
@@ -239,7 +239,7 @@ int airstrike(int power)
mpr("Strike whom?", MSGCH_PROMPT);
- direction( beam, DIR_TARGET, TARG_ENEMY, true );
+ direction( beam, DIR_TARGET, TARG_ENEMY );
if (!beam.isValid)
{
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index d476c3d55c..d2c5f72c5d 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1927,7 +1927,7 @@ void cast_evaporate(int pow)
message_current_target();
- direction( spelld, DIR_NONE, TARG_ENEMY, true );
+ direction( spelld, DIR_NONE, TARG_ENEMY );
if (!spelld.isValid)
{
@@ -2373,7 +2373,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike
const char *what = NULL;
mpr("Fragment what (e.g. a wall)?", MSGCH_PROMPT);
- direction( beam, DIR_TARGET, TARG_ENEMY, true );
+ direction( beam, DIR_TARGET, TARG_ENEMY );
if (!beam.isValid)
{
@@ -2901,7 +2901,7 @@ int cast_apportation(int pow)
mpr("Pull items from where?");
- direction( beam, DIR_TARGET, TARG_ANY, true );
+ direction( beam, DIR_TARGET, TARG_ANY );
if (!beam.isValid)
{
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 020e5fa0c2..dbb2e5711f 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -467,7 +467,7 @@ int apply_one_neighbouring_square(int (*func) (int, int, int, int), int power)
struct dist bmove;
mpr("Which direction? [ESC to cancel]", MSGCH_PROMPT);
- direction( bmove, DIR_DIR, TARG_ENEMY, true );
+ direction( bmove, DIR_DIR, TARG_ENEMY );
if (!bmove.isValid)
{
@@ -684,7 +684,7 @@ char spell_direction( struct dist &spelld, struct bolt &pbolt,
message_current_target();
- direction( spelld, restrict, mode, true );
+ direction( spelld, restrict, mode );
if (!spelld.isValid)
{
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 9f65c6e961..75364a312d 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -688,15 +688,14 @@ void modify_all_stats(int STmod, int IQmod, int DXmod)
return;
} // end modify_stat()
-void canned_msg(unsigned char which_message)
+void canned_msg(canned_message_type which_message)
{
switch (which_message)
{
case MSG_SOMETHING_APPEARS:
- snprintf(info, INFO_SIZE, "Something appears %s!",
- (you.species == SP_NAGA || you.species == SP_CENTAUR)
- ? "before you" : "at your feet");
- mpr(info);
+ mprf("Something appears %s!",
+ (you.species == SP_NAGA || you.species == SP_CENTAUR)
+ ? "before you" : "at your feet");
break;
case MSG_NOTHING_HAPPENS:
diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h
index 1b1bffcbeb..c0bb7ab30c 100644
--- a/crawl-ref/source/stuff.h
+++ b/crawl-ref/source/stuff.h
@@ -60,7 +60,7 @@ void modify_all_stats(int STmod, int IQmod, int DXmod);
void redraw_screen(void);
-void canned_msg(unsigned char which_message);
+void canned_msg(canned_message_type which_message);
bool yesno( const char * str, bool safe = true, int safeanswer = 0,
bool clear_after = true, bool interrupt_delays = true,