From dd8ec1b5c6c68c08b40171dcc9bbba8b49cf2345 Mon Sep 17 00:00:00 2001 From: Johanna Ploog Date: Sat, 16 Jan 2010 14:12:55 +0100 Subject: Also use key bindings in the tutorial help screen. --- crawl-ref/source/command.cc | 126 ++++++++++++++++++++++++++++---------------- 1 file changed, 81 insertions(+), 45 deletions(-) diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 5260e89e19..3d039ecb03 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -2147,7 +2147,6 @@ static void _add_command(column_composer &cols, const int column, static void _insert_commands(std::string &desc, std::vector cmds) { - desc = replace_all(desc, "%%", "percent_sign"); for (unsigned int i = 0; i < cmds.size(); ++i) { const std::string::size_type found = desc.find("%"); @@ -2161,7 +2160,7 @@ static void _insert_commands(std::string &desc, std::vector cmds) desc.replace(found, 1, command_name); } desc += "\n"; - desc = replace_all(desc, "percent_sign", "%"); + desc = replace_all(desc, "percent", "%"); } static void _insert_commands(std::string &desc, const int first, ...) @@ -2324,7 +2323,7 @@ static void _add_formatted_keyhelp(column_composer &cols) CMD_CYCLE_QUIVER_BACKWARD, 0); _insert_commands(cols, 0, "[ : armour (%ear and %ake off)", CMD_WEAR_ARMOUR, CMD_REMOVE_ARMOUR, 0); - _insert_commands(cols, 0, "%% : corpses and food (%hop up and %at)", + _insert_commands(cols, 0, "percent : corpses and food (%hop up and %at)", CMD_BUTCHER, CMD_EAT, 0); _insert_commands(cols, 0, "? : scrolls (%ead)", CMD_READ, 0); @@ -2529,58 +2528,95 @@ static void _add_formatted_keyhelp(column_composer &cols) static void _add_formatted_tutorial_help(column_composer &cols) { - std::ostringstream text; - text << - "Item types (and common commands)\n" - ") : hand weapons (wield)\n" - "( : missiles (Quiver, fire, () to cycle ammo)\n" - "[ : armour (Wear and Take off)\n" - "% : corpses and food (chop up and eat)\n" - "? : scrolls (read)\n" - "! : potions (quaff)\n" - "= : rings (Put on and Remove)\n" - "\" : amulets (Put on and Remove)\n" - "/ : wands (eVoke)\n" - ""; - text << static_cast(get_item_symbol(SHOW_ITEM_BOOK)); - text << " : books (read, Memorise and " - "zap)\n" - ""; - text << static_cast(get_item_symbol(SHOW_ITEM_STAVE)); - text << " : staves, rods (wield and evoke)\n" - "\n" + cols.add_formatted( + 0, "Item types (and common commands)\n", + true, true, _cmdhelp_textfilter); + + _insert_commands(cols, 0, ") : hand weapons (%ield)", + CMD_WIELD_WEAPON, 0); + _insert_commands(cols, 0, "( : missiles (%uiver, " + "%ire, %/% cycle)", + CMD_QUIVER_ITEM, CMD_FIRE, CMD_CYCLE_QUIVER_FORWARD, + CMD_CYCLE_QUIVER_BACKWARD, 0); + _insert_commands(cols, 0, "[ : armour (%ear and %ake off)", + CMD_WEAR_ARMOUR, CMD_REMOVE_ARMOUR, 0); + _insert_commands(cols, 0, "percent : corpses and food (%hop up and %at)", + CMD_BUTCHER, CMD_EAT, 0); + _insert_commands(cols, 0, "? : scrolls (%ead)", + CMD_READ, 0); + _insert_commands(cols, 0, "! : potions (%uaff)", + CMD_QUAFF, 0); + _insert_commands(cols, 0, "= : rings (%ut on and %emove)", + CMD_WEAR_JEWELLERY, CMD_REMOVE_JEWELLERY, 0); + _insert_commands(cols, 0, "\" : amulets (%ut on and %emove)", + CMD_WEAR_JEWELLERY, CMD_REMOVE_JEWELLERY, 0); + _insert_commands(cols, 0, "/ : wands (e%oke)", + CMD_EVOKE, 0); + + std::string item_types = ""; + item_types += static_cast(get_item_symbol(SHOW_ITEM_BOOK)); + item_types += + " : books (%ead, %emorise, %ap, %ap)"; + _insert_commands(cols, 0, item_types, + CMD_READ, CMD_MEMORISE_SPELL, CMD_CAST_SPELL, + CMD_FORCE_CAST_SPELL, 0); + + item_types = ""; + item_types += static_cast(get_item_symbol(SHOW_ITEM_STAVE)); + item_types += + " : staves and rods (%ield and e%oke)"; + _insert_commands(cols, 0, item_types, + CMD_WIELD_WEAPON, CMD_EVOKE_WIELDED, 0); + + cols.add_formatted( + 0, "Movement and attacking\n" "Use the numpad for movement (try both\n" - "Numlock on and off). You can also use\n" - " hjkl : left, down, up, right and\n" - " yubn : diagonal movement.\n" + "Numlock on and off). You can also use\n", + true, true, _cmdhelp_textfilter); + + _insert_commands(cols, 0, " %%%% : left, down, up, right and", + CMD_MOVE_LEFT, CMD_MOVE_DOWN, CMD_MOVE_UP, + CMD_MOVE_RIGHT, 0); + _insert_commands(cols, 0, " %%%% : diagonal movement.", + CMD_MOVE_UP_LEFT, CMD_MOVE_UP_RIGHT, CMD_MOVE_DOWN_LEFT, + CMD_MOVE_DOWN_RIGHT, 0); + + cols.add_formatted( + 0, "Walking into a monster will attack it\n" "with the wielded weapon or barehanded.\n" - "For ranged attacks use either\n" - "f to launch missiles (like arrows)\n" - "z/Z to cast spells (z? lists spells).\n", + "For ranged attacks use either\n", + false, true, _cmdhelp_textfilter); + + _insert_commands(cols, 0, "% to launch missiles (like arrows)", + CMD_FIRE, 0); + _insert_commands(cols, 0, "%/% to cast spells " + "(%? lists spells).", + CMD_CAST_SPELL, CMD_FORCE_CAST_SPELL, CMD_CAST_SPELL, 0); cols.add_formatted( - 0, text.str(), + 1, + "Additional important commands\n", true, true, _cmdhelp_textfilter); + _add_command(cols, 1, CMD_SAVE_GAME_NOW, "Save the game and exit", 2); + cols.add_formatted(1, " ", false, true, _cmdhelp_textfilter); + _add_command(cols, 1, CMD_SEARCH, "search for one turn (also . and Del)", 2); + _add_command(cols, 1, CMD_REST, "rest full/search longer (Shift-Num 5)", 2); + _add_command(cols, 1, CMD_DISPLAY_INVENTORY, "list inventory (select item to view it)", 2); + _add_command(cols, 1, CMD_PICKUP, "pick up item from ground (also g)", 2); + _add_command(cols, 1, CMD_DROP, "drop item", 2); + _insert_commands(cols, 0, "% or % : ascend/descend the stairs", + CMD_GO_UPSTAIRS, CMD_GO_DOWNSTAIRS, 0); + cols.add_formatted(1, " ", false, true, _cmdhelp_textfilter); + _add_command(cols, 1, CMD_REPLAY_MESSAGES, "show previous messages", 2); + _add_command(cols, 1, CMD_DISPLAY_MAP, "show map of the whole level", 2); + _add_command(cols, 1, CMD_FULL_VIEW, "list monsters, items, features in sight", 2); + cols.add_formatted( 1, - "Additional important commands\n" - "S : Save the game and exit\n" - "\n" - "s : search for one turn (also . and Del)\n" - "5 : rest full/search longer (Shift-Num 5)\n" - "x : examine surroundings\n" - "i : list inventory (select item to view it)\n" - "g : pick up item from ground (also ,)\n" - "d : drop item\n" - "<< or > : ascend/descend the stairs\n" - "Ctrl-P : show previous messages\n" - "X : show map of the whole level\n" - "Ctrl-X : list monsters, items, features in sight\n" - "\n" - "targetting (for spells and missiles)\n" + "Targetting (for spells and missiles)\n" "Use + (or =) and - to cycle between\n" "hostile monsters. Enter or . or Del\n" "all fire at the selected target.\n" -- cgit v1.2.3