summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-09 15:42:10 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-09 15:42:10 +0000
commitf83cdd076f9f2642fb8a044af7d6b316d89056a0 (patch)
tree1016a97ad7bae3ce9df31a4c0a91372d47e37e5c /crawl-ref
parentd336eb95ef08c61c2448c0bf73d40a0f464f358f (diff)
downloadcrawl-ref-f83cdd076f9f2642fb8a044af7d6b316d89056a0.tar.gz
crawl-ref-f83cdd076f9f2642fb8a044af7d6b316d89056a0.zip
Added help for interlevel travel prompts.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1440 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/command.cc134
-rw-r--r--crawl-ref/source/command.h2
-rw-r--r--crawl-ref/source/travel.cc76
3 files changed, 128 insertions, 84 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 8b17d088bd..429790f7cd 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -516,54 +516,73 @@ static bool cmdhelp_textfilter(const std::string &tag)
}
static const char *level_map_help =
- "<h>Level Map ('<w>X</w><h>' in main screen):\n"
- "<w>Esc</w> : leave level map (also Space)\n"
- "<w>Dir.</w>: move cursor\n"
- "<w>/ Dir.</w>, <w>Shift-Dir.</w>: move cursor far\n"
- "<w>-</w>/<w>+</w> : scroll level map up/down\n"
- "<w>.</w> : travel (also <w>Enter</w> and <w>,</w> and <w>;</w>)\n"
- " (moves cursor to last travel\n"
- " destination if still on @)\n"
- "<w><<</w>/<w>></w> : cycle through up/down stairs\n"
- "<w>^</w> : cycle through traps\n"
- "<w>Tab</w> : cycle through shops and portals\n"
- "<w>X</w> : cycle through travel eXclusions\n"
- "<w>W</w> : cycle through waypoints\n"
- "<w>*</w> : cycle forward through stashes\n"
- "<w>/</w> : cycle backward through stashes\n"
- "<w>_</w> : cycle through altars\n"
- "<w>Ctrl-X</w> : set travel eXclusion\n"
- "<w>Ctrl-E</w> : Erase all travel exclusions\n"
- "<w>Ctrl-W</w> : set Waypoint\n"
- "<w>Ctrl-C</w> : Clear level and main maps\n"
- " \n"
- " \n"
- " \n";
+ "<h>Level Map ('<w>X</w><h>' in main screen):\n"
+ "<w>Esc</w> : leave level map (also Space)\n"
+ "<w>Dir.</w>: move cursor\n"
+ "<w>/ Dir.</w>, <w>Shift-Dir.</w>: move cursor far\n"
+ "<w>-</w>/<w>+</w> : scroll level map up/down\n"
+ "<w>.</w> : travel (also <w>Enter</w> and <w>,</w> and <w>;</w>)\n"
+ " (moves cursor to last travel\n"
+ " destination if still on @)\n"
+ "<w><<</w>/<w>></w> : cycle through up/down stairs\n"
+ "<w>^</w> : cycle through traps\n"
+ "<w>Tab</w> : cycle through shops and portals\n"
+ "<w>X</w> : cycle through travel eXclusions\n"
+ "<w>W</w> : cycle through waypoints\n"
+ "<w>*</w> : cycle forward through stashes\n"
+ "<w>/</w> : cycle backward through stashes\n"
+ "<w>_</w> : cycle through altars\n"
+ "<w>Ctrl-X</w> : set travel eXclusion\n"
+ "<w>Ctrl-E</w> : Erase all travel exclusions\n"
+ "<w>Ctrl-W</w> : set Waypoint\n"
+ "<w>Ctrl-C</w> : Clear level and main maps\n"
+ " \n"
+ " \n"
+ " \n";
static const char *targeting_help =
- "<h>Examine surroundings ('<w>x</w><h> in main):\n"
- "<w>Esc</w> : cancel (also <w>Space</w>)\n"
- "<w>Dir.</w>: move cursor in that direction\n"
- "<w>.</w> : move to cursor (also <w>Enter</w>, <w>Del</w>)\n"
- "<w>v</w> : describe monster under cursor\n"
- "<w>+</w> : cycle monsters forward (also <w>=</w>)\n"
- "<w>-</w> : cycle monsters backward\n"
- "<w>*</w> : cycle objects forward\n"
- "<w>/</w> : cycle objects backward (also <w>;</w>)\n"
- "<w>^</w> : cycle through traps\n"
- "<w>_</w> : cycle through altars\n"
- "<w><<</w>/<w>></w> : cycle through up/down stairs\n"
- "<w>Tab</w> : cycle through shops and portals\n"
- "<w>Ctrl-F</w> : cycle monster cycle mode\n"
- " \n"
- "<h>Targeting (like zapping wands/spells):\n"
- "The keys from examining surroundings\n"
- "work here, too. Additional keys are\n"
- "<w>.</w> : fire at target (<w>Enter</w>, <w>Del</w>, <w>Space</w>)\n"
- "<w>!</w> : fire at target and stop there\n"
- "<w>p</w> : fire at Previous target (also <w>t</w>, <w>f</w>)\n"
- "<w>:</w> : hide beam\n"
- "<w>Shift-Dir</w> : shoot straight-line beam\n";
+ "<h>Examine surroundings ('<w>x</w><h> in main):\n"
+ "<w>Esc</w> : cancel (also <w>Space</w>)\n"
+ "<w>Dir.</w>: move cursor in that direction\n"
+ "<w>.</w> : move to cursor (also <w>Enter</w>, <w>Del</w>)\n"
+ "<w>v</w> : describe monster under cursor\n"
+ "<w>+</w> : cycle monsters forward (also <w>=</w>)\n"
+ "<w>-</w> : cycle monsters backward\n"
+ "<w>*</w> : cycle objects forward\n"
+ "<w>/</w> : cycle objects backward (also <w>;</w>)\n"
+ "<w>^</w> : cycle through traps\n"
+ "<w>_</w> : cycle through altars\n"
+ "<w><<</w>/<w>></w> : cycle through up/down stairs\n"
+ "<w>Tab</w> : cycle through shops and portals\n"
+ "<w>Ctrl-F</w> : cycle monster cycle mode\n"
+ " \n"
+ "<h>Targeting (like zapping wands/spells):\n"
+ "The keys from examining surroundings\n"
+ "work here, too. Additional keys are\n"
+ "<w>.</w> : fire at target (<w>Enter</w>, <w>Del</w>, <w>Space</w>)\n"
+ "<w>!</w> : fire at target and stop there\n"
+ "<w>p</w> : fire at Previous target (also <w>t</w>, <w>f</w>)\n"
+ "<w>:</w> : hide beam\n"
+ "<w>Shift-Dir</w> : shoot straight-line beam\n";
+
+static const char *interlevel_travel_branch_help =
+ "<h>Interlevel Travel (choose a branch):\n"
+ " Use the shortcut letter for a branch to select the branch for travel.\n"
+ " <w>Enter</w> : Repeat last interlevel travel.\n"
+ " <w>.</w> : Travel to a level in the current branch.\n"
+ " <w><<</w> : Go up the nearest stairs.\n"
+ " <w>></w> : Go down the nearest stairs.\n"
+ " <w>Ctrl-P</w> : Travel to a level in the branch above this one.\n"
+ " <w>*</w> : Show available waypoints (if any are set).\n"
+ " <w>0</w>-<w>9</w> : Go to the numbered waypoint.\n";
+
+static const char *interlevel_travel_depth_help =
+ "<h>Interlevel Travel (go to a specific level in the selected branch)\n"
+ " Type in the level number you want to go to and hit Enter, or use:\n"
+ " <w>Enter</w> : Go to the default level.\n"
+ " <w><<</w> : Change the default to one level above the current.\n"
+ " <w>></w> : Change default to one level below the current.\n"
+ " <w>-</w>/<w>p</w> : Change default to the branch above this one.\n";
// Add the contents of the file fp to the scroller menu m.
// If first_hotkey is nonzero, that will be the hotkey for the
@@ -647,12 +666,16 @@ static int keyhelp_keyfilter(int ch)
}
static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
- bool with_manual, int hotkey = 0)
+ bool with_manual, bool easy_exit = false,
+ int hotkey = 0)
{
formatted_scroller cmd_help;
- // Set flags, and don't use easy exit.
- cmd_help.set_flags(MF_NOSELECT | MF_ALWAYS_SHOW_MORE | MF_NOWRAP, false);
+ // Set flags, and use easy exit if necessary.
+ int flags = MF_NOSELECT | MF_ALWAYS_SHOW_MORE | MF_NOWRAP;
+ if (easy_exit)
+ flags |= MF_EASY_EXIT;
+ cmd_help.set_flags(flags, false);
// FIXME: Allow for hiding Page down when at the end of the listing, ditto
// for page up at start of listing.
@@ -758,7 +781,7 @@ void show_specific_help( const char* help )
formatted_lines.push_back(
formatted_string::parse_string(
lines[i], true, cmdhelp_textfilter));
- show_keyhelp_menu(formatted_lines, false);
+ show_keyhelp_menu(formatted_lines, false, true);
}
void show_levelmap_help()
@@ -771,6 +794,15 @@ void show_targeting_help()
show_specific_help( targeting_help );
}
+void show_interlevel_travel_branch_help()
+{
+ show_specific_help( interlevel_travel_branch_help );
+}
+
+void show_interlevel_travel_depth_help()
+{
+ show_specific_help( interlevel_travel_depth_help );
+}
void list_commands(bool wizard, int hotkey)
{
@@ -994,7 +1026,7 @@ void list_commands(bool wizard, int hotkey)
"stashes, and <w>Ctrl-E</w> to erase them.\n",
true, true, cmdhelp_textfilter);
- show_keyhelp_menu(cols.formatted_lines(), true, hotkey);
+ show_keyhelp_menu(cols.formatted_lines(), true, false, hotkey);
}
void list_tutorial_help()
diff --git a/crawl-ref/source/command.h b/crawl-ref/source/command.h
index d1155b7f4f..338ef6489c 100644
--- a/crawl-ref/source/command.h
+++ b/crawl-ref/source/command.h
@@ -61,6 +61,8 @@ void swap_inv_slots(int slot1, int slot2, bool verbose);
void show_levelmap_help();
void show_targeting_help();
+void show_interlevel_travel_branch_help();
+void show_interlevel_travel_depth_help();
void list_commands(bool wizard, int hotkey = 0);
void list_tutorial_help(void);
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index cb620c2460..f8f4cc5336 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -13,6 +13,7 @@
#include "files.h"
#include "FixAry.h"
#include "branch.h"
+#include "command.h"
#include "clua.h"
#include "delay.h"
#include "describe.h"
@@ -1852,33 +1853,38 @@ static int prompt_travel_branch(int prompt_flags)
mpr(line.c_str());
}
- std::string shortcuts;
- if ((*trans_travel_dest && remember_targ)
- || (allow_waypoints && (waycount || waypoint_list)))
+ std::string shortcuts = "(";
{
- shortcuts = "(";
- if (waypoint_list)
- shortcuts += "[*] lists branches";
- else if (waycount)
- shortcuts += "[*] lists waypoints";
+ std::vector<std::string> segs;
+ if (allow_waypoints)
+ {
+ if (waypoint_list)
+ segs.push_back("[*] lists branches");
+ else if (waycount)
+ segs.push_back("[*] lists waypoints");
+ }
if (*trans_travel_dest && remember_targ)
- {
- if (waypoint_list || waycount)
- shortcuts += ", ";
+ segs.push_back(
+ make_stringf("[Enter] for %s", trans_travel_dest) );
- shortcuts += make_stringf("[Enter] for %s",
- trans_travel_dest);
- }
+ segs.push_back("[?] for help");
+
+ shortcuts += comma_separated_line(segs.begin(), segs.end(),
+ ", ", ", ");
shortcuts += ") ";
}
- mprf(MSGCH_PROMPT, "Where do you want to go? %s", shortcuts.c_str());
+ mprf(MSGCH_PROMPT, "Where to? %s", shortcuts.c_str());
int keyin = get_ch();
switch (keyin)
{
case ESCAPE:
return (ID_CANCEL);
+ case '?':
+ show_interlevel_travel_branch_help();
+ redraw_screen();
+ break;
case '\n': case '\r':
return (ID_REPEAT);
case '<':
@@ -1910,21 +1916,6 @@ static int prompt_travel_branch(int prompt_flags)
}
}
-static int travel_depth_keyfilter(int &c)
-{
- switch (c)
- {
- case '<': case '>':
- return (-1);
- case '-':
- case CONTROL('P'): case 'p':
- c = '-'; // Make uniform.
- return (-1);
- default:
- return (1);
- }
-}
-
static bool is_easy_exiting_branch(int branch)
{
return branches[branch].any_upstair_exits;
@@ -1976,11 +1967,30 @@ static level_id find_down_level()
return (find_down_level(level_id::current()));
}
+static int travel_depth_keyfilter(int &c)
+{
+ switch (c)
+ {
+ case '<': case '>': case '?':
+ return (-1);
+ case '-':
+ case CONTROL('P'): case 'p':
+ c = '-'; // Make uniform.
+ return (-1);
+ default:
+ return (1);
+ }
+}
+
static void travel_depth_munge(int munge_method, branch_type *br, int *depth)
{
level_id lid(*br, *depth);
switch (munge_method)
{
+ case '?':
+ show_interlevel_travel_depth_help();
+ redraw_screen();
+ return;
case '<':
lid = find_up_level(lid);
break;
@@ -2009,7 +2019,7 @@ static level_id prompt_travel_depth(const level_id &id)
{
mesclr(true);
mprf(MSGCH_PROMPT, "What level of %s? "
- "(default %d) ", branches[branch].longname, depth);
+ "(default %d, [?] for help) ", branches[branch].longname, depth);
char buf[100];
const int response =
@@ -2046,7 +2056,7 @@ level_pos prompt_translevel_target(int prompt_flags)
if (branch == ID_UP)
{
target = find_up_level();
- if (target.id.depth > -1 && remember_targ)
+ if (target.id.depth > 0 && remember_targ)
set_trans_travel_dest(trans_travel_dest, sizeof trans_travel_dest,
target);
return (target);
@@ -2055,7 +2065,7 @@ level_pos prompt_translevel_target(int prompt_flags)
if (branch == ID_DOWN)
{
target = find_down_level();
- if (target.id.depth > -1 && remember_targ)
+ if (target.id.depth > 0 && remember_targ)
set_trans_travel_dest(trans_travel_dest, sizeof trans_travel_dest,
target);
return (target);