summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/skills2.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-20 19:00:52 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-20 19:00:52 +0000
commit8ad4f44fa747a32e0d476971beeaf2c0550f16e5 (patch)
tree4cb0fa4b6f7cfc3fd7068ebee1564e1ade6bb2a6 /crawl-ref/source/skills2.cc
parent2d4c05e46de7f35c454f1dfbf3892ad589038a58 (diff)
downloadcrawl-ref-8ad4f44fa747a32e0d476971beeaf2c0550f16e5.tar.gz
crawl-ref-8ad4f44fa747a32e0d476971beeaf2c0550f16e5.zip
Experimental mouse support for ncurses (enable with mouse_input=yes in
.crawlrc). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1610 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/skills2.cc')
-rw-r--r--crawl-ref/source/skills2.cc99
1 files changed, 47 insertions, 52 deletions
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index 1e2d3dd43f..2c29dcea27 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -1818,20 +1818,11 @@ static const skill_type skill_display_order[] =
static const int ndisplayed_skills =
sizeof(skill_display_order) / sizeof(*skill_display_order);
-void show_skills()
+static void display_skill_table(bool show_aptitudes)
{
- int i;
- int x;
- menu_letter lcount;
- bool show_aptitudes = false;
-
+ menu_letter lcount = 'a';
const int num_lines = get_number_of_lines();
- clrscr();
-
- reprint_stuff:
- lcount = 'a';
-
gotoxy(1, 1);
textcolor(LIGHTGREY);
@@ -1848,11 +1839,11 @@ void show_skills()
#endif
int scrln = 3, scrcol = 1;
-
+ int x;
// Don't want the help line to appear too far down a big window.
const int bottom_line = ((num_lines > 30) ? 30 : num_lines);
- for (i = 0; i < ndisplayed_skills; ++i)
+ for (int i = 0; i < ndisplayed_skills; ++i)
{
x = skill_display_order[i];
@@ -1939,76 +1930,80 @@ void show_skills()
if (Options.tutorial_left)
{
- textcolor(MAGENTA);
- gotoxy(1, bottom_line-5);
- formatted_string::parse_block(
- "This screen shows the skill set of your character. You can pick up new" EOL
- "skills by performing the corresponding actions. The number next to the" EOL
- "skill is your current level, the higher the better. The blue percent " EOL
- "value shows your progress towards the next skill level. You can toggle" EOL
- "which skills to train by pressing their slot letters. A <darkgrey>greyish<magenta> skill " EOL
- "will increase at a decidedly slower rate and ease training of others. ",
- false).display();
+ textcolor(MAGENTA);
+ gotoxy(1, bottom_line-5);
+ formatted_string::parse_block(
+ "This screen shows the skill set of your character. You can pick up new" EOL
+ "skills by performing the corresponding actions. The number next to the" EOL
+ "skill is your current level, the higher the better. The blue percent " EOL
+ "value shows your progress towards the next skill level. You can toggle" EOL
+ "which skills to train by pressing their slot letters. A <darkgrey>greyish<magenta> skill " EOL
+ "will increase at a decidedly slower rate and ease training of others. ",
+ false).display();
}
else
{
- // if any more skills added, must adapt letters to go into caps
- gotoxy(1, bottom_line-1);
- textcolor(LIGHTGREY);
- cprintf("Press the letter of a skill to choose whether you want to practise it.");
- if (!player_genus(GENPC_DRACONIAN) || you.max_level >= 7)
- {
- gotoxy(1, bottom_line);
- formatted_string::parse_string("Press '!' to toggle between "
- "<blue>progress</blue> and "
- "<red>aptitude</red> "
- "display.").display();
- }
+ // if any more skills added, must adapt letters to go into caps
+ gotoxy(1, bottom_line-1);
+ textcolor(LIGHTGREY);
+ cprintf("Press the letter of a skill to choose "
+ "whether you want to practise it.");
+ if (!player_genus(GENPC_DRACONIAN) || you.max_level >= 7)
+ {
+ gotoxy(1, bottom_line);
+ formatted_string::parse_string("Press '!' to toggle between "
+ "<blue>progress</blue> and "
+ "<red>aptitude</red> "
+ "display.").display();
+ }
}
+}
- int get_thing = getch();
-
- if (get_thing == 0)
- getch();
- else
+void show_skills()
+{
+ bool show_aptitudes = false;
+ clrscr();
+ while (true)
{
+ display_skill_table(show_aptitudes);
+
+ const int get_thing = getch();
if (get_thing == '!' && (!player_genus(GENPC_DRACONIAN) ||
- you.max_level >= 7))
+ you.max_level >= 7))
{
show_aptitudes = !show_aptitudes;
- goto reprint_stuff;
+ continue;
}
+
if ((get_thing >= 'a' && get_thing <= 'z')
|| (get_thing >= 'A' && get_thing <= 'Z'))
{
- lcount = 'a'; // toggle skill practise
+ menu_letter lcount = 'a'; // toggle skill practise
- for (i = 0; i < ndisplayed_skills; i++)
+ int x;
+ for (int i = 0; i < ndisplayed_skills; i++)
{
x = skill_display_order[i];
if (x == SK_BLANK_LINE || x == SK_COLUMN_BREAK)
continue;
-
+
if (you.skills[x] == 0)
continue;
-
+
if (get_thing == lcount)
{
you.practise_skill[x] = !you.practise_skill[x];
break;
}
-
+
++lcount;
}
-
- goto reprint_stuff;
+ continue;
}
+ break;
}
-
- return;
}
-
const char *skill_name(int which_skill)
{
return (skills[which_skill][0]);