From 5511b48771d9a12e3e622e375220091cf94023dd Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 3 Oct 2008 16:17:52 +0000 Subject: * Make movement restrictions when beheld also apply to blinking and controlled teleport. * Highlight restricted grids when beheld (ASCII only): - main screen: restricted grids in LOS are darkgrey - X screen: unrestricted grids in view around the mermaid(s) are lightgrey * switch xx command back to leaving examine mode git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7105 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/crawl_manual.txt | 5 ++-- crawl-ref/source/acr.cc | 3 +- crawl-ref/source/cmd-keys.h | 2 +- crawl-ref/source/command.cc | 2 +- crawl-ref/source/directn.cc | 10 +++---- crawl-ref/source/spells1.cc | 23 +++++++++++++++ crawl-ref/source/spells3.cc | 38 ++++++++++++++++++++---- crawl-ref/source/view.cc | 64 +++++++++++++++++++++++++++++++++++++---- 8 files changed, 124 insertions(+), 23 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/docs/crawl_manual.txt b/crawl-ref/docs/crawl_manual.txt index 431155db68..b71091f38f 100644 --- a/crawl-ref/docs/crawl_manual.txt +++ b/crawl-ref/docs/crawl_manual.txt @@ -2302,6 +2302,7 @@ Character information: ] Shows a restricted inventory, only containing worn and wielded items. I Show list of memorised spells. + V Lists all monsters and items in sight. % Show resistances and general character overview, including health, experience, gear, status, mutations, abilities (the latter three more @@ -2366,7 +2367,6 @@ Other game-playing commands: p Pray (or renew an existing prayer). z Cast a spell. I List spells. - V Prints a short list of monsters in sight. t Tell commands to allies, or shout (the latter with tt). Ctrl-A Toggle autopickup. Note that encounters with @@ -2465,8 +2465,7 @@ When roaming the dungeon, the surroundings mode is activated by 'x'. It lets you have a look at items or monsters in line of sight. You may also examine stashed items outside current view using the option target_oos = true (if using this, check the option target_los_first). - Esc, Space Return to playing mode. - x List all monsters and items in view. + Esc, Space, x Return to playing mode. ? Special help screen. * or ' Cycle objects forward. / or ; Cycle objects backward. diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 2a4b67a373..0ebc0bec8e 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2137,8 +2137,7 @@ void process_command( command_type cmd ) case CMD_LOOK_AROUND: { mpr("Move the cursor around to observe a square " - "(x - list visible monsters and items, v - describe square, " - "? - help)", MSGCH_PROMPT); + "(v - describe square, ? - help)", MSGCH_PROMPT); struct dist lmove; // Will be initialized by direction(). direction(lmove, DIR_TARGET, TARG_ANY, -1, true); diff --git a/crawl-ref/source/cmd-keys.h b/crawl-ref/source/cmd-keys.h index ca2db8e120..5fe8909a75 100644 --- a/crawl-ref/source/cmd-keys.h +++ b/crawl-ref/source/cmd-keys.h @@ -130,6 +130,7 @@ {CONTROL('X'), CMD_SAVE_GAME_NOW}, {CONTROL('Z'), CMD_SUSPEND_GAME}, {ESCAPE, CMD_TARGET_CANCEL}, +{'x', CMD_TARGET_CANCEL}, #ifdef WIZARD {'F', CMD_TARGET_WIZARD_MAKE_FRIENDLY}, {'P', CMD_TARGET_WIZARD_BLESS_MONSTER}, @@ -141,7 +142,6 @@ {'M', CMD_TARGET_WIZARD_MISCAST}, #endif {'v', CMD_TARGET_DESCRIBE}, -{'x', CMD_TARGET_ALL_DESCRIBE}, {'?', CMD_TARGET_HELP}, {' ', CMD_TARGET_SELECT}, // XXX hack: can also be CMD_TARGET_CANCEL {CONTROL('P'), CMD_TARGET_SHOW_PROMPT}, diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 1884ae2303..7dd58662ba 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -725,7 +725,7 @@ static bool _cmdhelp_textfilter(const std::string &tag) static const char *targeting_help_1 = "Examine surroundings ('x' in main):\n" - "Esc : cancel (also Space)\n" + "Esc : cancel (also Space, x)\n" "Dir.: move cursor in that direction\n" ". : move to cursor (also Enter, Del)\n" "v : describe monster under cursor\n" diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 6b84395f45..5f582fc35a 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -532,8 +532,11 @@ void full_describe_view() std::vector fss; std::string str = get_monster_desc(list_mons[i], true, DESC_CAP_A, true); + if (player_beheld_by(list_mons[i])) + str += ", beholding you"; + if (dam_level != MDAM_OKAY) - str = str + ", " + wound_str; + str += ", " + wound_str; // Wraparound if the description is longer than allowed. linebreak_string2(str, get_number_of_cols() - 8); @@ -631,11 +634,6 @@ void full_describe_view() describe_item( *i ); } } - - // Repeat the prompt to show where we are. - mpr("Move the cursor around to observe a square " - "(x - list visible monsters and items, v - describe square, " - "? - help)", MSGCH_PROMPT); } diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 0ebd200152..65a83236b9 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -111,6 +111,29 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) return (-1); // early return {dlb} } + if (!wizard_blink && you.duration[DUR_BEHELD]) + { + bool blocked_movement = false; + for (unsigned int i = 0; i < you.beheld_by.size(); i++) + { + monsters& mon = menv[you.beheld_by[i]]; + const int olddist = grid_distance(you.pos(), mon.pos()); + const int newdist = grid_distance(beam.target, mon.pos()); + + if (olddist < newdist) + { + mprf("You cannot blink away from %s!", + mon.name(DESC_NOCAP_THE, true).c_str()); + + blocked_movement = true; + break; + } + } + + if (blocked_movement) + continue; + } + // Wizard blink can move past translucent walls. if (see_grid_no_trans(beam.target)) break; diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 8d1f5d8410..3a00fd310d 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1204,7 +1204,7 @@ bool cast_death_channel(int pow, god_type god) bool allow_control_teleport(bool quiet) { bool retval = !(testbits(env.level_flags, LFLAG_NO_TELE_CONTROL) - || testbits(get_branch_flags(), BFLAG_NO_TELE_CONTROL)); + || testbits(get_branch_flags(), BFLAG_NO_TELE_CONTROL)); // Tell the player why if they have teleport control. if (!quiet && !retval && player_control_teleport()) @@ -1281,14 +1281,42 @@ static bool _teleport_player( bool allow_control, bool new_abyss_area ) mpr("Expect minor deviation."); more(); - show_map(pos, false); - - redraw_screen(); + while (true) + { + show_map(pos, false); + redraw_screen(); #if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "Target square (%d,%d)", pos.x, pos.y ); + mprf(MSGCH_DIAGNOSTICS, "Target square (%d,%d)", pos.x, pos.y ); #endif + if (you.duration[DUR_BEHELD]) + { + bool blocked_movement = false; + for (unsigned int i = 0; i < you.beheld_by.size(); i++) + { + monsters& mon = menv[you.beheld_by[i]]; + const int olddist = grid_distance(you.pos(), mon.pos()); + const int newdist = grid_distance(pos, mon.pos()); + + if (olddist < newdist) + { + mprf("You cannot teleport away from %s!", + mon.name(DESC_NOCAP_THE, true).c_str()); + mpr("Choose another destination (press '.' or delete to select)."); + more(); + + blocked_movement = true; + break; + } + } + + if (blocked_movement) + continue; + } + break; + } + pos.x += random2(3) - 1; pos.y += random2(3) - 1; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index dad9622ccb..9cc0467557 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -377,7 +377,9 @@ static int _view_emphasised_colour(const coord_def& where, { if ((you.your_level || grid_stair_direction(feat) == CMD_GO_DOWNSTAIRS) && you.where_are_you != BRANCH_VESTIBULE_OF_HELL) + { return (newcolour); + } } return (oldcolour); } @@ -411,8 +413,32 @@ static void _get_symbol( const coord_def& where, { const int colmask = *colour & COLFLAG_MASK; - if (object < NUM_REAL_FEATURES && object >= DNGN_MINMOVE - && is_sanctuary(where) ) + bool blocked_movement = false; + if (object < NUM_FEATURES && object >= DNGN_MINMOVE + && you.duration[DUR_BEHELD]) + { + // Colour grids that cannot be reached due to beholders + // dark grey. + for (unsigned int i = 0; i < you.beheld_by.size(); i++) + { + monsters& mon = menv[you.beheld_by[i]]; + const int olddist = grid_distance(you.pos(), mon.pos()); + const int newdist = grid_distance(where, mon.pos()); + + if (olddist < newdist) + { + blocked_movement = true; + break; + } + } + } + + if (blocked_movement) + { + *colour = DARKGREY | colmask; + } + else if (object < NUM_REAL_FEATURES && object >= DNGN_MINMOVE + && is_sanctuary(where) ) { if (env.map(where).property == FPROP_SANCTUARY_1) *colour = YELLOW | colmask; @@ -442,10 +468,12 @@ static void _get_symbol( const coord_def& where, *colour = fdef.colour | colmask; if (fdef.em_colour != fdef.colour && fdef.em_colour) + { *colour = _view_emphasised_colour( where, static_cast(object), *colour, fdef.em_colour | colmask); + } } if (object < NUM_REAL_FEATURES && inside_halo(where) @@ -457,9 +485,11 @@ static void _get_symbol( const coord_def& where, } // Note anything we see that's notable - if ((!where.origin()) && fdef.is_notable()) + if (!where.origin() && fdef.is_notable()) + { seen_notable_thing( static_cast(object), where ); + } } else { @@ -642,6 +672,30 @@ screen_buffer_t colour_code_map( int x, int y, bool item_colour, if (feature_colour != DARKGREY) tc = feature_colour; + else if (you.duration[DUR_BEHELD]) + { + // If beheld, colour the few grids that can be reached anyway + // lightgrey. + coord_def pos = coord_def(x,y); + if (grd(pos) >= DNGN_MINMOVE && mgrd(pos) == NON_MONSTER) + { + bool blocked_movement = false; + for (unsigned int i = 0; i < you.beheld_by.size(); i++) + { + monsters& mon = menv[you.beheld_by[i]]; + const int olddist = grid_distance(you.pos(), mon.pos()); + const int newdist = grid_distance(pos, mon.pos()); + + if (olddist < newdist || !see_grid(env.show, pos, mon.pos())) + { + blocked_movement = true; + break; + } + } + if (!blocked_movement) + tc = LIGHTGREY; + } + } if (Options.feature_item_brand && is_critical_feature(grid_value) @@ -3020,11 +3074,11 @@ static void _draw_level_map(int start_x, int start_y, bool travel_mode) screen_buffer_t buffer2[GYM * GXM * 2]; int num_lines = _get_number_of_lines_levelmap(); - if ( num_lines > GYM ) + if (num_lines > GYM) num_lines = GYM; int num_cols = get_number_of_cols(); - if ( num_cols > GXM ) + if (num_cols > GXM) num_cols = GXM; cursor_control cs(false); -- cgit v1.2.3-54-g00ecf