From 15914c94597d6c51c42ef22b7ee4f7f1970520eb Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 6 Feb 2007 17:54:25 +0000 Subject: Fixed unbrandability of friendly hellions. Moved beam cycling to ^C. We really need to make it a wizmode-only option. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@926 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/direct.cc | 23 +++++++++++++++++++++-- crawl-ref/source/enum.h | 1 + crawl-ref/source/view.cc | 11 +++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 0a164913cb..015ad7fcc9 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -104,11 +104,13 @@ static command_type read_direction_key() const int key = unmangle_direction_keys(getchm(KC_TARGETING),KC_TARGETING); switch ( key ) { - case ESCAPE: return CMD_TARGET_CANCEL; +#ifdef WIZARD + case 'F': return CMD_TARGET_WIZARD_MAKE_FRIENDLY; +#endif case 'v': return CMD_TARGET_DESCRIBE; case '?': return CMD_TARGET_HELP; - case ' ': return CMD_TARGET_CYCLE_BEAM; + case CONTROL('C'): return CMD_TARGET_CYCLE_BEAM; case ':': return CMD_TARGET_HIDE_BEAM; case '\r': return CMD_TARGET_SELECT; case '.': return CMD_TARGET_SELECT; @@ -497,6 +499,23 @@ void direction(struct dist& moves, targeting_type restricts, loop_done = true; moves.isCancel = true; break; + +#ifdef WIZARD + case CMD_TARGET_WIZARD_MAKE_FRIENDLY: + // 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) // can put in terrain description here + break; + + { + monsters &m = menv[mid]; + m.attitude = m.attitude == ATT_FRIENDLY? + ATT_HOSTILE : ATT_FRIENDLY; + } + break; +#endif case CMD_TARGET_DESCRIBE: // Maybe we can skip this check...but it can't hurt diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 4819753756..ccc8b70890 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -711,6 +711,7 @@ enum command_type CMD_TARGET_FIND_DOWNSTAIR, CMD_TARGET_FIND_YOU, CMD_TARGET_DESCRIBE, + CMD_TARGET_WIZARD_MAKE_FRIENDLY, CMD_TARGET_HELP, // [ds] Silently ignored, requests another round of input. diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index fef73784fc..cd5d9fcc56 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -259,13 +259,11 @@ static unsigned fix_colour(unsigned raw_colour) // This order is important - is_element_colour() doesn't want to see the // munged colours returned by dos_brand, so it should always be done // before applying DOS brands. -#if defined(WIN32CONSOLE) || defined(DOS) const int colflags = raw_colour & 0xFF00; -#endif // Evaluate any elemental colours to guarantee vanilla colour is returned if (is_element_colour( raw_colour )) - raw_colour = element_colour( raw_colour ); + raw_colour = colflags | element_colour( raw_colour ); #if defined(WIN32CONSOLE) || defined(DOS) if (colflags) @@ -1501,6 +1499,7 @@ static int cyclic_offset( unsigned int ui, int cycle_dir, int startpoint, // If cycle_dir is 0, find the first fitting ray. If it is 1 or -1, // assume that ray is appropriately filled in, and look for the next // ray in that cycle direction. + bool find_ray( int sourcex, int sourcey, int targetx, int targety, bool allow_fallback, ray_def& ray, int cycle_dir ) { @@ -1530,7 +1529,11 @@ bool find_ray( int sourcex, int sourcey, int targetx, int targety, bool blocked = false; for ( inray = 0; inray < cellray; ++inray ) { - if (grid_is_solid(grd[sourcex + signx * ray_coord_x[inray + cur_offset]][sourcey + signy * ray_coord_y[inray + cur_offset]])) + if (grid_is_solid( + grd[sourcex + + signx * ray_coord_x[inray + cur_offset]] + [sourcey + + signy * ray_coord_y[inray + cur_offset]])) { blocked = true; break; -- cgit v1.2.3-54-g00ecf