From 3970539e0caa99ad9b68d454cc46f713ac71bc73 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 25 Jun 2008 12:55:26 +0000 Subject: Improve targetting via monster list, add a new option to define the toggle's initial setting, and update/correct the documentation a bit. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6135 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/034_changes.txt | 2 + crawl-ref/docs/options_guide.txt | 56 ++++++++++++++--------- crawl-ref/settings/init.txt | 1 + crawl-ref/source/directn.cc | 95 ++++++++++++++++++++++++++++------------ crawl-ref/source/initfile.cc | 3 ++ crawl-ref/source/output.cc | 11 +++-- crawl-ref/source/output.h | 2 +- crawl-ref/source/spells1.cc | 2 +- 8 files changed, 117 insertions(+), 55 deletions(-) diff --git a/crawl-ref/docs/034_changes.txt b/crawl-ref/docs/034_changes.txt index 882d721a4e..04e26a2542 100644 --- a/crawl-ref/docs/034_changes.txt +++ b/crawl-ref/docs/034_changes.txt @@ -16,6 +16,8 @@ them: E show experience (was C) v evoke (was E) t tell/yell (was !) + Ctrl-V Tiles settings (was Ctrl-Q) + Ctrl-Q quit (was Q) There is a file called "keys.pdf" in the /docs directory. It should be printable and contains a reference sheet for all keys used in Crawl. diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt index 62e735f26a..0fcf3da3fa 100644 --- a/crawl-ref/docs/options_guide.txt +++ b/crawl-ref/docs/options_guide.txt @@ -66,7 +66,8 @@ The contents of this text are: status_caption_colour, delay_message_clear, message_colour, show_inventory_weights, show_gold_turns, show_beam, item_stack_summary_minimum, list_rotten, - mlist_min_height, msg_max_height, classic_hud, + mlist_min_height, msg_max_height, + mlist_allow_alternate_layout, mlist_targetting, classic_hud, menu_colour, menu_colour_prefix_id, menu_colour_prefix_class, message_colour, force_more_message, msg_condense_repeats @@ -302,7 +303,7 @@ sound = : Lua files are scripts which can provide existing commands with a new meaning or create new commands (to be used in macros). To use Lua files, Crawl needs to be compiled with support for user Lua scripts. -You can if your Crawl has Lua support by hitting V in-game. The list +You can if your Crawl has Lua support by hitting ?V in-game. The list of features Crawl displays should include "Lua user scripts". Lua files are included using the lua_file option (one file per line): @@ -1183,12 +1184,24 @@ mlist_min_height = 5 If there is extra space available for the message area and monster list, the monster list will expand to this height before letting the message area get more. + (Note that the monster list is only available for ASCII.) msg_max_height = 10 If there is extra space available after the monster list has expanded, the message area will expand up to this height. The monster list will get the rest. +mlist_allow_alternate_layout = false + Display the monster list wherever Crawl may find space on + your console display, usually to the left of the map, rather + than using the fixed position below the stat area. + +mlist_targetting = false + Using the monster list you can directly target monsters in + targetting mode. There's a toggle that allows you to turn this + feature on and off. This option controls the initial setting + at game start or reload. + classic_hud = false Remove the Health and Magic bars and the monster list, for a more 0.3-like HUD display. @@ -1231,7 +1244,9 @@ menu_colour = :: useless_item (This item is of no use to you.) evil_eating (Eating this item is punished by the good gods.) - inedible (You cannot eat this or get no nutrition from it.) + inedible (You cannot eat this, or get no nutrition from it.) + preferred (The food type your character prefers, for example + for herbivores/carnivores.) poisonous (Chunks/corpses that are poisonous) mutagenic (Chunks/corpses that are mutagenic) contaminated (Chunks/corpses that may cause sickness, but @@ -1244,7 +1259,7 @@ menu_colour = :: When looking for menu_colour matches, these prefixes are prepended to the actual item name, e.g. in the form of identified, evil_item wand of draining (4) - unidentified, equipped, artefact sparkling ring + unidentified, equipped, artefact sparkling ring (left hand) The same prefixes can also be used for highlighting prompts pertaining to items matching the description, or to define autopickup_exceptions. @@ -1270,7 +1285,7 @@ menu_colour = :: To quickly check what potions were trashed by a mummy curse, use menu_colour = inventory:lightred:potions? of (degeneration|decay) - If you'd like to see rotten chunks and corpses at a glance, use + If you'd like to see rotting chunks and corpses at a glance, use menu_colour = inventory:red: rotting menu_colour can also be applied to colour the in-game notes (to @@ -1305,7 +1320,7 @@ force_more_message = The syntax is identical to that of travel_stop_message (4-g). msg_condense_repeats = true - If the same message is repeated multiple times without repition, + If the same message is repeated multiple times without repetition, then the Show Previous Message command (Ctrl-P) will condense them into one line indicating how many times it was repeated. For example: @@ -1319,7 +1334,7 @@ fire_items_start = a Sets the first inventory item to consider when selecting missiles to fire. The default is a. -fire_order = inscribed, launcher, return +fire_order = launcher, return fire_order += javelin / dart / stone / rock / spear / net / handaxe / dagger fire_order += inscribed Controls the order of items autoselected for firing. Items @@ -1332,18 +1347,16 @@ fire_order += inscribed in your inventory that fits one of these will be picked for firing. - 'inscribed' refers to any item with the "+f" inscription. See - the "Inscriptions" section of the crawl manual for more information - about inscriptions. - - the "Inscriptions" - 'launcher' refers to firing the appropriate missile for the - wielded weapon (ie crossbow, bow, sling, blowgun). You'll almost + wielded weapon (i.e. crossbow, bow, sling, blowgun). You'll almost certainly want it first, as it'll be ignored when you're not wielding a ranged weapon. 'return' refers to (identified) weapons of returning. + 'inscribed' refers to any item with the "+f" inscription. See + the "Inscriptions" section of Crawl's manual for more information + about inscriptions. + (See also pickup_thrown in 4-a.) 4-l Message Channels. @@ -1375,12 +1388,12 @@ CHANNEL_NAME can currently be one of these: friend_enchant = as monster_enchant, but only for friendly monsters monster_damage = messages telling how damaged a monster is rotten_meat = messages about chunks/corpses becoming rotten - equipment = messages inidcating worn/wielded equipment + equipment = messages indicating worn/wielded equipment floor = messages when looking at or walking over a floor item multiturn = indicates long actions (wearing armour, dissecting etc.) - examine = messages from examine your surroundings + examine = messages from examining your surroundings examine_filter = boring messages from examining your surroundings diagnostics = debugging messages error = error messages @@ -1404,7 +1417,7 @@ to mute. Note that the template init.txt sets channel.multiturn = on in order to help new players. You may want to comment out this option, -if the messages are too verbose. +if you feel the messages are too verbose. 4-m Inscriptions. --------------------- @@ -1453,7 +1466,7 @@ In non-tile games the tile options are ignored. tile_show_items = This option controls the order and presence of items in the tiles - inventory. By default, its value is !?/%=([)X}+\_. The underscore + inventory. By default, its value is !?/%=([)x}+\_. The underscore represents empty slots, the dot items on the floor. title_screen = true @@ -1481,7 +1494,7 @@ tile_excluded_col = darkcyan tile_excl_centre_col = darkblue These options allow configuring the colours used for the minimap of -the dungeon level. +the dungeon level. tile_player_col - colour of player position, as well as of map centre during level map mode ('X') tile_monster_col - colour of hostile monsters @@ -1624,7 +1637,8 @@ rare_interesting = 9 noted. Increasing the number causes more common monsters to be noted, while decreasing it causes only the most rare of monsters to be noted; setting it to 0 will turn noting of rare - monsters off. + monsters off. Really wimpy monsters (such as rats or butterflies) + won't ever be noted. note_hp_percent = 5 If your HP falls below a certain note_hp_percentage of your max @@ -1715,7 +1729,7 @@ colour.OLDCOLOUR = NEWCOLOUR especially when used with the background option on a terminal with a non-black background. Format is colour.OLDCOLOUR = NEWCOLOUR, later rules take - preference and the NEWCOLOUR is always literal (ie. it won't + precedence and the NEWCOLOUR is always literal (ie. it won't re-evaluate to a different colour). The colours are: black, blue, green, cyan, red, magenta, brown, lightgrey, diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt index b6b35c008e..64e5c97bed 100644 --- a/crawl-ref/settings/init.txt +++ b/crawl-ref/settings/init.txt @@ -224,6 +224,7 @@ include = travel_stoppers.txt # mlist_min_height = 5 # msg_max_height = 10 # mlist_allow_alternate_layout = true +# mlist_targetting = true # show_gold_turns = true # delay_message_clear = true diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 69f547e24f..c0862fdda5 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -442,11 +442,13 @@ static void direction_again(dist& moves, targeting_type restricts, #ifndef USE_TILE // XXX: Hack - can't pass mlist entries into _find_mlist(). +bool mlist_full_info; std::vector mlist; -static void _fill_monster_list(void) +static void _fill_monster_list(bool full_info) { std::vector temp; get_monster_pane_info(temp); + mlist_full_info = full_info; // Get the unique entries. mlist.clear(); @@ -455,9 +457,13 @@ static void _fill_monster_list(void) { mlist.push_back(temp[start]); for (end = start + 1; end < (int) temp.size(); ++end) - if (monster_pane_info::less_than(temp[start], temp[end])) + { + if (monster_pane_info::less_than(temp[start], temp[end], + full_info)) + { break; - + } + } start = end; } } @@ -478,7 +484,8 @@ void direction(dist& moves, targeting_type restricts, if (!just_looking && Options.mlist_targetting == MLIST_TARGET_HIDDEN) { Options.mlist_targetting = MLIST_TARGET_ON; - _fill_monster_list(); + bool full_info = update_monster_pane(); + _fill_monster_list(full_info); } #endif @@ -721,16 +728,18 @@ void direction(dist& moves, targeting_type restricts, #ifndef USE_TILE case CMD_TARGET_TOGGLE_MLIST: + { if (Options.mlist_targetting == MLIST_TARGET_ON) Options.mlist_targetting = MLIST_TARGET_OFF; else Options.mlist_targetting = MLIST_TARGET_ON; - update_monster_pane(); + bool full_info = update_monster_pane(); if (Options.mlist_targetting == MLIST_TARGET_ON) - _fill_monster_list(); + _fill_monster_list(full_info); break; + } #endif #ifdef WIZARD @@ -1243,6 +1252,30 @@ bool in_los(int x, int y) return (in_vlos(grid2view(coord_def(x, y)))); } +static bool _mons_is_valid_target(monsters *mon, int mode, int range) +{ + // Unknown mimics don't count as monsters, either. + if (mons_is_mimic(mon->type) + && !(mon->flags & MF_KNOWN_MIMIC)) + { + return (false); + } + + // Don't usually target unseen monsters... + if (!player_monster_visible(mon)) + { + // ... unless it creates a "disturbance in the water". + // Since you can't see the monster, assume it's not a friend. + // Also don't target submerged monsters if there are other targets + // in sight. (This might be too restrictive.) + return (mode != TARG_FRIEND + && _mon_submerged_in_water(mon) + && i_feel_safe(false, false, true, range)); + } + + return (true); +} + #ifndef USE_TILE static bool _find_mlist( int x, int y, int idx, bool need_path, int range = -1) { @@ -1266,20 +1299,40 @@ static bool _find_mlist( int x, int y, int idx, bool need_path, int range = -1) } // While the monsters are identical, don't increase real_idx. - if (mlist[i].m_mon->type == mlist[i+1].m_mon->type - && mlist[i].m_attitude == mlist[i+1].m_attitude) - { + if (!monster_pane_info::less_than(mlist[i], mlist[i+1], mlist_full_info)) continue; - } + real_idx++; } monsters *mon = &menv[targ_mon]; + + if (!_mons_is_valid_target(mon, TARG_ANY, range)) + return (false); + const monsters *monl = mlist[real_idx].m_mon; extern mon_attitude_type mons_attitude(const monsters *m); - return (mons_attitude(mon) == mlist[idx].m_attitude - && mon->type == monl->type); + if (mons_attitude(mon) != mlist[idx].m_attitude) + return (false); + + if (mon->type != monl->type) + return (mons_is_mimic(mon->type) && mons_is_mimic(monl->type)); + + if (mlist_full_info) + { + if (mons_is_zombified(mon)) // Both monsters are zombies. + return (mon->base_monster == monl->base_monster); + + if (mon->has_hydra_multi_attack()) + return (mon->number == monl->number); + } + + if (mon->type == MONS_PLAYER_GHOST) + return (mon->name(DESC_PLAIN) == monl->name(DESC_PLAIN)); + + // Else the two monsters are identical. + return (true); } #endif @@ -1309,24 +1362,8 @@ static bool _find_monster( int x, int y, int mode, bool need_path, monsters *mon = &menv[targ_mon]; - // Unknown mimics don't count as monsters, either. - if (mons_is_mimic(mon->type) - && !(mon->flags & MF_KNOWN_MIMIC)) - { + if (!_mons_is_valid_target(mon, mode, range)) return (false); - } - - // Don't usually target unseen monsters... - if (!player_monster_visible(mon)) - { - // ... unless it creates a "disturbance in the water". - // Since you can't see the monster, assume it's not a friend. - // Also don't target submerged monsters if there are other targets - // in sight. (This might be too restrictive.) - return (mode != TARG_FRIEND - && _mon_submerged_in_water(mon) - && i_feel_safe(false, false, true, range)); - } // Now compare target modes. if (mode == TARG_ANY) diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index b69e653cf9..c16b6427f3 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -2199,6 +2199,9 @@ void game_options::read_option_line(const std::string &str, bool runscript) else INT_OPTION(mlist_min_height, 0, INT_MAX); else INT_OPTION(msg_max_height, 6, INT_MAX); else BOOL_OPTION(mlist_allow_alternate_layout); +#ifndef USE_TILE + else BOOL_OPTION(mlist_targetting); +#endif else BOOL_OPTION(classic_hud); else BOOL_OPTION(msg_condense_repeats); else BOOL_OPTION(view_lock_x); diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index b769206e7c..6074856306 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1450,13 +1450,13 @@ void get_monster_pane_info(std::vector& mons) } #define BOTTOM_JUSTIFY_MONSTER_LIST 0 -void update_monster_pane() +bool update_monster_pane() { const int max_print = crawl_view.mlistsz.y; textbackground(BLACK); if (max_print <= 0) - return; + return (false); std::vector mons; get_monster_pane_info(mons); @@ -1514,10 +1514,15 @@ void update_monster_pane() cgotoxy(crawl_view.mlistsz.x - 4, crawl_view.mlistsz.y, GOTO_MLIST); cprintf(" ... "); } + + return zombified; } #else // FIXME: Implement this for Tiles! -void update_monster_pane() {} +bool update_monster_pane() +{ + return (false); +} #endif const char* itosym1(int stat) diff --git a/crawl-ref/source/output.h b/crawl-ref/source/output.h index 073879a2a7..7d017f0ae8 100644 --- a/crawl-ref/source/output.h +++ b/crawl-ref/source/output.h @@ -53,7 +53,7 @@ void print_stats_level(void); void draw_border(void); std::string mpr_monster_list(bool past = false); void redraw_skill(const std::string &your_name, const std::string &class_name); -void update_monster_pane(); +bool update_monster_pane(); const char *equip_slot_to_name(int equip); diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 98607bb14c..3b0abac19b 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -140,7 +140,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) // Allow wizard blink to send player into walls, in case the // user wants to alter that grid to something else. - if (grid_is_solid(grd[beam.tx][beam.ty]) && wizard_blink) + if (wizard_blink && grid_is_solid(grd[beam.tx][beam.ty])) grd[beam.tx][beam.ty] = DNGN_FLOOR; if (grid_is_solid(grd[beam.tx][beam.ty]) -- cgit v1.2.3-54-g00ecf