From e1ea97bd197688a9242bffb24f766d85a88ff678 Mon Sep 17 00:00:00 2001 From: haranp Date: Fri, 26 Jan 2007 12:36:44 +0000 Subject: Minor direction cleanups (mainly messaging.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@888 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/direct.cc | 69 +++++++++++++++----------------------------- crawl-ref/source/direct.h | 2 -- crawl-ref/source/item_use.cc | 3 -- crawl-ref/source/spells1.cc | 6 ---- crawl-ref/source/spells4.cc | 3 -- crawl-ref/source/spl-util.cc | 5 ---- 6 files changed, 24 insertions(+), 64 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index cc74e83c57..bcc7a34cef 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -68,15 +68,7 @@ enum LOSSelect LOS_NONE = 0xFFFF }; -// x and y offsets in the following order: -// SW, S, SE, W, E, NW, N, NE -static const char xcomp[9] = { -1, 0, 1, -1, 0, 1, -1, 0, 1 }; -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); @@ -155,35 +147,6 @@ static command_type read_direction_key() } } -//--------------------------------------------------------------- -// -// 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: -// -// isValid a valid target or direction was chosen -// isCancel player hit 'escape' -// isTarget targetting was used -// tx,ty target x,y or logical beam extension to -// edge of map if keypad direction used. -// dx,dy direction delta if keypad used {-1,0,1} -// -// SYNOPSIS: -// -// gets a direction, or any of the follwing: -// -// * go to targetting mode -// +,= go to targetting mode, next monster -// - " , prev monster -// t,p,f auto-select previous target -// -// -//--------------------------------------------------------------- - void direction_choose_compass( struct dist& moves ) { moves.isValid = true; @@ -254,12 +217,29 @@ static int targeting_cmd_to_feature( command_type command ) } } +//--------------------------------------------------------------- +// +// 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: +// +// isValid a valid target or direction was chosen +// isCancel player hit 'escape' +// isTarget targetting was used +// isEndpoint player wants the ray to stop on the dime +// tx,ty target x,y +// dx,dy direction delta for DIR_DIR +// +//--------------------------------------------------------------- void direction(struct dist& moves, targeting_type restricts, int mode, bool just_looking) { // NOTE: Even if just_looking is set, moves is still interesting, // because we can travel there! - if ( restricts == DIR_DIR ) { direction_choose_compass( moves ); @@ -285,10 +265,7 @@ void direction(struct dist& moves, targeting_type restricts, // 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 - - mpr(aim_prompt); + mpr(aim_prompt, MSGCH_PROMPT); while (1) { @@ -889,13 +866,15 @@ static char find_square( unsigned char xps, unsigned char yps, } // XXX Unbelievably hacky. And to think that my goal was to clean up the code. +// Identical to find_square, except that input (tx, ty) and output +// (mfp) are in grid coordinates rather than view coordinates. static char find_square_wrapper( int tx, int ty, FixedVector &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); + const 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; diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h index eb0bd2c9e9..015654bcac 100644 --- a/crawl-ref/source/direct.h +++ b/crawl-ref/source/direct.h @@ -17,8 +17,6 @@ #include "externs.h" #include "enum.h" -#define STD_DIRECTION_PROMPT "Which direction ([*+-] to target)? " - // last updated 12may2000 {dlb} /* *********************************************************************** * called from: acr - debug - effects - it_use3 - item_use - spells1 - diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index f39bb6a0e2..4fbf0e7ce5 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1316,7 +1316,6 @@ bool throw_it(struct bolt &pbolt, int throw_2, monsters *dummy_target) } else { - mpr( STD_DIRECTION_PROMPT, MSGCH_PROMPT ); message_current_target(); direction( thr, DIR_NONE, TARG_ENEMY ); } @@ -2521,9 +2520,7 @@ void zap_wand(void) } } - mpr( STD_DIRECTION_PROMPT, MSGCH_PROMPT ); message_current_target(); - direction( zap_wand, DIR_NONE, targ_mode ); if (!zap_wand.isValid) diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 1abdce77b1..2f99be2980 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -176,10 +176,7 @@ int fireball(int power) { struct dist fire_ball; - mpr( STD_DIRECTION_PROMPT, MSGCH_PROMPT ); - message_current_target(); - direction( fire_ball, DIR_NONE, TARG_ENEMY ); if (!fire_ball.isValid) @@ -491,10 +488,7 @@ int stinking_cloud( int pow ) struct dist spelld; struct bolt beem; - mpr( STD_DIRECTION_PROMPT, MSGCH_PROMPT ); - message_current_target(); - direction( spelld, DIR_NONE, TARG_ENEMY ); if (!spelld.isValid) diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index d2c5f72c5d..a3443587ff 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1923,10 +1923,7 @@ void cast_evaporate(int pow) return; } - mpr( STD_DIRECTION_PROMPT, MSGCH_PROMPT ); - message_current_target(); - direction( spelld, DIR_NONE, TARG_ENEMY ); if (!spelld.isValid) diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index f586b96fb5..cdec44268a 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -677,11 +677,6 @@ void apply_area_cloud( int (*func) (int, int, int, int), int x, int y, char spell_direction( struct dist &spelld, struct bolt &pbolt, targeting_type restrict, int mode ) { - if (restrict == DIR_TARGET) - mpr( "Choose a target (+/- for next/prev monster)", MSGCH_PROMPT ); - else - mpr( STD_DIRECTION_PROMPT, MSGCH_PROMPT ); - message_current_target(); direction( spelld, restrict, mode ); -- cgit v1.2.3-54-g00ecf