summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/abl-show.cc12
-rw-r--r--crawl-ref/source/format.cc19
-rw-r--r--crawl-ref/source/format.h1
-rw-r--r--crawl-ref/source/items.cc4
-rw-r--r--crawl-ref/source/menu.cc12
-rw-r--r--crawl-ref/source/menu.h4
-rw-r--r--crawl-ref/source/tutorial.cc30
-rw-r--r--crawl-ref/source/tutorial.h2
8 files changed, 52 insertions, 32 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 492d5cf247..70f215b7e2 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -62,6 +62,7 @@
#include "spells4.h"
#include "stuff.h"
#include "transfor.h"
+#include "tutorial.h"
#include "view.h"
@@ -1724,8 +1725,15 @@ int choose_ability_menu(const std::vector<talent>& talents)
}
}
- bool tutorial = (Options.tutorial_left > 0);
- std::vector<MenuEntry*> sel = abil_menu.show(false, tutorial);
+ if ( Options.tutorial_left )
+ {
+ // XXX This could be buggy if manage to pick up lots and lots
+ // of abilities during the tutorial.
+ abil_menu.set_more(tut_abilities_info());
+ abil_menu.set_flags(MF_SINGLESELECT | MF_ANYPRINTABLE |
+ MF_ALWAYS_SHOW_MORE);
+ }
+ std::vector<MenuEntry*> sel = abil_menu.show(false);
redraw_screen();
if ( sel.empty() )
{
diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc
index 390133f3d5..9eb82cb8d3 100644
--- a/crawl-ref/source/format.cc
+++ b/crawl-ref/source/format.cc
@@ -314,3 +314,22 @@ void formatted_string::fs_op::display() const
break;
}
}
+
+int count_linebreaks(const formatted_string& fs)
+{
+ std::string::size_type where = 0;
+ const std::string s = fs;
+ int count = 0;
+ while ( 1 )
+ {
+ where = s.find(EOL, where);
+ if ( where == std::string::npos )
+ break;
+ else
+ {
+ ++count;
+ ++where;
+ }
+ }
+ return count;
+}
diff --git a/crawl-ref/source/format.h b/crawl-ref/source/format.h
index 3360aa34d5..af0231e23b 100644
--- a/crawl-ref/source/format.h
+++ b/crawl-ref/source/format.h
@@ -89,5 +89,6 @@ public:
std::vector<fs_op> ops;
};
+int count_linebreaks(const formatted_string& fs);
#endif
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 80d9edbc56..ac28060190 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -617,10 +617,6 @@ static int item_name_specialness(const item_def& item)
return 0;
}
-/*
- * Takes keyin as an argument because it will only display a long list of items
- * if ; is pressed.
- */
void item_check(bool verbose)
{
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index e4a3ea7904..85f596b1db 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -97,7 +97,7 @@ void Menu::reset()
first_entry = 0;
}
-std::vector<MenuEntry *> Menu::show(bool reuse_selections, bool tut_abil)
+std::vector<MenuEntry *> Menu::show(bool reuse_selections)
{
cursor_control cs(false);
@@ -111,18 +111,14 @@ std::vector<MenuEntry *> Menu::show(bool reuse_selections, bool tut_abil)
if (max_pagesize > 0 && pagesize > max_pagesize)
pagesize = max_pagesize;
- do_menu(tut_abil);
+ do_menu();
return (sel);
}
-void Menu::do_menu(bool tut_abil)
+void Menu::do_menu()
{
draw_menu();
- if (tut_abil)
- {
- tut_describe_abilities();
- }
alive = true;
while (alive)
@@ -477,7 +473,7 @@ void Menu::draw_menu()
}
if (end < (int) items.size() || is_set(MF_ALWAYS_SHOW_MORE))
{
- gotoxy( 1, y_offset + pagesize );
+ gotoxy( 1, y_offset + pagesize - count_linebreaks(more) );
more.display();
}
}
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index 2607a02702..cfe710efd5 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -198,7 +198,7 @@ public:
unsigned char getkey() const { return lastch; }
void reset();
- std::vector<MenuEntry *> show(bool reuse_selections = false, bool tut_abil = false);
+ std::vector<MenuEntry *> show(bool reuse_selections = false);
std::vector<MenuEntry *> selected_entries() const;
size_t item_count() const { return items.size(); }
@@ -235,7 +235,7 @@ protected:
bool alive;
protected:
- void do_menu(bool tut_abil = false);
+ void do_menu();
virtual void draw_select_count(int count, bool force = false);
virtual void draw_item( int index ) const;
virtual void draw_index_item(int index, const MenuEntry *me) const;
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index f221e2eec8..10ac59b00c 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -1321,20 +1321,20 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y)
Options.tutorial_left--;
}
-void tut_describe_abilities()
+formatted_string tut_abilities_info()
{
- const int bottom_line = (get_number_of_lines() > 30) ? 30 : get_number_of_lines();
- textcolor(MAGENTA);
- gotoxy(1, bottom_line-5);
- std::string text =
- "This screen shows your character's set of talents. You can gain new " EOL
- "abilities via certain items, through religion or by way of mutations. " EOL
- "Activation of an ability usually comes at a cost, e.g. nutrition or " EOL
- "Magic power. ";
- if (you.religion == GOD_TROG) text +=
- "<w>Renounce Religion<magenta> will make your character leave your god" EOL
- "(and usually anger said god), while <w>Berserk<magenta> temporarily increases your" EOL
- "damage output in melee fights.";
-
- formatted_string::parse_block(text, false).display();
+ std::string text = "<magenta>"
+ "This screen shows your character's set of talents. You can gain new " EOL
+ "abilities via certain items, through religion or by way of mutations. " EOL
+ "Activation of an ability usually comes at a cost, e.g. nutrition or " EOL
+ "Magic power. ";
+
+ if (you.religion == GOD_TROG)
+ {
+ text +=
+ "<w>Renounce Religion<magenta> will make your character leave your god" EOL
+ "(and usually anger said god), while <w>Berserk<magenta> temporarily increases your" EOL
+ "damage output in melee fights.";
+ }
+ return formatted_string::parse_string(text, false);
}
diff --git a/crawl-ref/source/tutorial.h b/crawl-ref/source/tutorial.h
index 33fc630129..e3d0d84f7a 100644
--- a/crawl-ref/source/tutorial.h
+++ b/crawl-ref/source/tutorial.h
@@ -36,6 +36,6 @@ void taken_new_item(unsigned char item_type);
void tutorial_first_monster(const monsters& mon);
void tutorial_first_item(const item_def& item);
void learned_something_new(tutorial_event_type seen_what, int x=0, int y=0);
-void tut_describe_abilities(void);
+formatted_string tut_abilities_info();
#endif