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 ++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 45 deletions(-) (limited to 'crawl-ref/source/direct.cc') 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; -- cgit v1.2.3-54-g00ecf