Improved the help browser somewhat and added some hotkeys. The 'm' screen now lets you see your aptitudes with '!' (if you're allowed to know them, that is.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@798 c06c8d41-db1a-0410-9941-cceddc491573
NXVPOFYKJFWQWKVPQUMWH2Y2KJEZX44BUOBFJ4JD4KFGPEGYHG4QC
LAMIVDKY7LO5ONX5Z273ZCCEA5UBENOJD5VWNE4AK2EXGFED6BFQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
5ASC3STDYCNLZFEBN6UTMUCGDETHBR2OCBZCF5VIAZ5RRWLOTDYQC
43ZTEB57FU7KE5EVMYWZONNVJBZCGF3JEAJZIY25LC4LGE65PG5QC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
2GV6OW7P54FXZ5OD2NUMX7MLXH424LYAFMOAUQ2UGSOLKLYDBJGAC
JJH7VX2LLBZPDKG24SQREWQLX6I6RYNWFECHRZVK7PT5KPQ4MAMAC
VNSBAPL2FZNOR2R2NIJQITPHLQCMUE53U54GAENUSIN4526NHCPAC
if ( !Options.increasing_skill_progress )
cprintf( " (%d)", (100 - percent_done) / 10 );
if ( !show_aptitudes )
{
if ( !Options.increasing_skill_progress )
cprintf( " (%d)", (100 - percent_done) / 10 );
else
cprintf( " (%2d%%)", (percent_done / 5) * 5 );
}
virtual void add_item_formatted_string(const formatted_string& s);
virtual void add_item_string(const std::string& s);
virtual void add_item_formatted_string(const formatted_string& s,
int hotkey = 0);
virtual void add_item_string(const std::string& s, int hotkey = 0);
struct help_file
{
const char* name;
int hotkey;
bool auto_hotkey;
};
help_file help_files[] = {
{ "crawl_manual.txt", '*', true },
{ "tables.txt", '%', false },
{ "readme.txt", '^', false },
{ NULL, 0, false }
};
static int keyhelp_keyfilter(int ch)
{
switch (ch)
{
case ':':
display_notes();
return -1;
default:
return ch;
}
}
cmd_help.set_more( formatted_string::parse_string(
"<cyan>[ + : Page down. - : Page up."
" ? or letter for manual. Esc exits.]"));
else
cmd_help.set_more( formatted_string::parse_string(
"<cyan>[ + : Page down. - : Page up."
" Esc exits.]"));
{
cmd_help.f_keyfilter = keyhelp_keyfilter;
column_composer cols(1);
cols.add_formatted(
0,
"<h>Dungeon Crawl Help\n"
"\n"
"Press one of the following keys to obtain more information on a certain\n"
"aspect of Dungeon Crawl.\n"
"<w>?</w>: Key Help Screens\n"
"<w>*</w>: Read the manual\n"
"<w>^</w>: Quickstart Guide\n"
"<w>:</w>: Browse Notes\n"
"<w>%</w>: Table of Aptitudes\n",
true, true, cmdhelp_textfilter);
std::vector<formatted_string> blines = cols.formatted_lines();
unsigned i;
for (i = 0; i < blines.size(); ++i )
cmd_help.add_item_formatted_string(blines[i]);
while ( static_cast<int>(++i) < get_number_of_lines() )
cmd_help.add_item_string("");
}
#ifdef DATA_DIR_PATH
fp = fopen(DATA_DIR_PATH "/tables.txt", "r");
#else
fp = fopen("../docs/tables.txt", "r");
if ( !fp )
fp = fopen("./docs/tables.txt", "r");
#endif
if ( fp )
{
// put in a separator
for ( int i = 0; i < get_number_of_lines() - 5; ++i )
cmd_help.add_item_string("");
MenuEntry* me = new MenuEntry("Tables");
me->level = MEL_TITLE;
me->colour = WHITE;
me->add_hotkey('s');
cmd_help.add_entry(me);
add_file_to_scroller(fp, cmd_help, 0, false);
// and the file itself
add_file_to_scroller(fp, cmd_help, help_files[i].hotkey,
help_files[i].auto_hotkey);
// done with this file