summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-11 20:49:29 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-11 20:49:29 +0000
commitec5b80d6bf96936a3f803e89c7128effa703ebe7 (patch)
treef92d236e8e9bd3a74b87c23453a91be0a8ccbb70 /crawl-ref/source
parent4c540e1c4e99150305b9c5297928ed1794cec13c (diff)
downloadcrawl-ref-ec5b80d6bf96936a3f803e89c7128effa703ebe7.tar.gz
crawl-ref-ec5b80d6bf96936a3f803e89c7128effa703ebe7.zip
* Add description toggle (only '?' this time) into spellcasting menu and
make I use a loop as well, so that z?? and I are now functionally identical. (Which of course brings up the question of whether you really need an additional key to do this. :p) * Simplify a bit. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9413 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc10
-rw-r--r--crawl-ref/source/abl-show.h3
-rw-r--r--crawl-ref/source/directn.cc1
-rw-r--r--crawl-ref/source/spl-cast.cc64
-rw-r--r--crawl-ref/source/spl-cast.h4
5 files changed, 38 insertions, 44 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 0e5b696c34..5aca3410a4 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -867,7 +867,7 @@ bool activate_ability()
int selected = -1;
while (selected < 0)
{
- msg::streams(MSGCH_PROMPT) << "Use which ability? (? or * to list)"
+ msg::streams(MSGCH_PROMPT) << "Use which ability? (? or * to list) "
<< std::endl;
const int keyin = get_ch();
@@ -1939,7 +1939,7 @@ static void _pay_ability_costs(const ability_def& abil)
lose_piety( piety_cost );
}
-int choose_ability_menu(const std::vector<talent>& talents, bool describe)
+int choose_ability_menu(const std::vector<talent>& talents)
{
Menu abil_menu(MF_SINGLESELECT | MF_ANYPRINTABLE, "ability");
@@ -1957,12 +1957,6 @@ int choose_ability_menu(const std::vector<talent>& talents, bool describe)
// of abilities during the tutorial.
abil_menu.set_more(tut_abilities_info());
}
- else if (describe)
- {
- abil_menu.set_more(formatted_string::parse_string(
- "Choose any ability to read its description, "
- "or exit the menu with Escape."));
- }
else
{
abil_menu.set_more(formatted_string::parse_string(
diff --git a/crawl-ref/source/abl-show.h b/crawl-ref/source/abl-show.h
index e3d2610e4a..65d3ec1d66 100644
--- a/crawl-ref/source/abl-show.h
+++ b/crawl-ref/source/abl-show.h
@@ -66,8 +66,7 @@ const struct ability_def & get_ability_def( ability_type abil );
const char* ability_name(ability_type ability);
const std::string make_cost_description(ability_type ability);
std::vector<const char*> get_ability_names();
-int choose_ability_menu(const std::vector<talent>& talents,
- bool describe = false);
+int choose_ability_menu(const std::vector<talent>& talents);
// last updated 12may2000 {dlb}
/* ***********************************************************************
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index ffac5ff9c2..26c6a58f6b 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -50,7 +50,6 @@ REVISION("$Rev$");
#ifdef USE_TILE
#include "tiles.h"
#include "tilereg.h"
-// #include "tilesdl.h"
#endif
#include "terrain.h"
#include "traps.h"
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 68188b9f5c..559c3daaff 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -180,7 +180,7 @@ static std::string _spell_extra_description(spell_type spell)
return desc.str();
}
-int list_spells(bool toggle_with_I)
+int list_spells(bool toggle_with_I, bool viewing)
{
ToggleableMenu spell_menu(MF_SINGLESELECT | MF_ANYPRINTABLE |
MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING);
@@ -189,9 +189,9 @@ int list_spells(bool toggle_with_I)
// [enne] - Hack. Make title an item so that it's aligned.
ToggleableMenuEntry* me =
new ToggleableMenuEntry(
- " Your Spells Type "
+ " Your Spells Type "
" Success Level",
- " Your Spells Power "
+ " Your Spells Power "
"Range Hunger Level",
MEL_ITEM);
me->colour = BLUE;
@@ -200,27 +200,31 @@ int list_spells(bool toggle_with_I)
#else
spell_menu.set_title(
new ToggleableMenuEntry(
- " Your Spells Type "
+ " Your Spells Type "
" Success Level",
- " Your Spells Power "
+ " Your Spells Power "
"Range Hunger Level",
MEL_TITLE));
#endif
spell_menu.set_highlighter(NULL);
+ spell_menu.set_tag("spell");
spell_menu.add_toggle_key('!');
+
+ std::string more_str = "Press '!' ";
if (toggle_with_I)
{
- spell_menu.set_more(
- formatted_string("Press '!' or 'I' to toggle spell view. Press spell slot for description."));
spell_menu.add_toggle_key('I');
+ more_str += "or 'I' ";
}
- else
+ more_str += "to toggle spell view.";
+ if (!viewing)
{
- spell_menu.set_more(
- formatted_string("Press '!' to toggle spell view."));
+ spell_menu.allow_toggle = true;
+ spell_menu.menu_action = Menu::ACT_EXECUTE;
+ more_str += " Press ''?' to toggle between spell selection"
+ " and description.";
}
-
- spell_menu.set_tag("spell");
+ spell_menu.set_more(formatted_string(more_str));
for (int i = 0; i < 52; ++i)
{
@@ -236,17 +240,22 @@ int list_spells(bool toggle_with_I)
}
}
- std::vector<MenuEntry*> sel = spell_menu.show();
- redraw_screen();
- if (sel.empty())
- {
- return 0;
- }
- else
+ while (true)
{
+ std::vector<MenuEntry*> sel = spell_menu.show();
+ redraw_screen();
+ if (sel.empty())
+ return 0;
+
ASSERT(sel.size() == 1);
ASSERT(sel[0]->hotkeys.size() == 1);
- return sel[0]->hotkeys[0];
+ if (spell_menu.menu_action == Menu::ACT_EXAMINE)
+ {
+ describe_spell(get_spell_by_letter(sel[0]->hotkeys[0]));
+ redraw_screen();
+ }
+ else
+ return sel[0]->hotkeys[0];
}
}
@@ -543,15 +552,10 @@ void inspect_spells()
// Maybe we should honour auto_list here, but if you want the
// description, you probably want the listing, too.
- int keyin = list_spells();
- if ( isalpha(keyin) )
- {
- describe_spell(get_spell_by_letter(keyin));
- redraw_screen();
- }
+ list_spells(true, true);
}
-// returns false if spell failed, and true otherwise
+// Returns false if spell failed, and true otherwise.
bool cast_a_spell()
{
if (!you.spell_no)
@@ -579,7 +583,7 @@ bool cast_a_spell()
while (true)
{
- mpr( "Cast which spell ([?*] list)? ", MSGCH_PROMPT );
+ mpr("Cast which spell? (? or * to list) ", MSGCH_PROMPT);
keyin = get_ch();
@@ -591,15 +595,13 @@ bool cast_a_spell()
redraw_screen();
- if ( isalpha(keyin) || keyin == ESCAPE )
+ if (isalpha(keyin) || keyin == ESCAPE)
break;
else
mesclr();
}
else
- {
break;
- }
}
if (keyin == ESCAPE)
diff --git a/crawl-ref/source/spl-cast.h b/crawl-ref/source/spl-cast.h
index ce18606e1b..681c3aa958 100644
--- a/crawl-ref/source/spl-cast.h
+++ b/crawl-ref/source/spl-cast.h
@@ -46,10 +46,10 @@ enum spret_type
SPRET_SUCCESS
};
-int list_spells(bool toggle_with_I = true);
+int list_spells(bool toggle_with_I = true, bool viewing = false);
int spell_fail( spell_type spell );
int calc_spell_power(spell_type spell, bool apply_intel,
- bool fail_rate_chk = false );
+ bool fail_rate_chk = false);
int spell_enhancement( unsigned int typeflags );
// last updaetd 12may2000 {dlb}