summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-21 22:00:23 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-21 22:22:54 -0800
commit98e00e2ae1ef6c5980d753a12c209e9c68dcca17 (patch)
treef14e85f780e6991657fcb152cd501a43f7e85dc6 /crawl-ref/source
parentb232c1bc260f956250c7f75f9b9fe4516410a97c (diff)
downloadcrawl-ref-98e00e2ae1ef6c5980d753a12c209e9c68dcca17.tar.gz
crawl-ref-98e00e2ae1ef6c5980d753a12c209e9c68dcca17.zip
tiles: show spell tile for lookup and memorization
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/command.cc19
-rw-r--r--crawl-ref/source/spl-book.cc14
2 files changed, 29 insertions, 4 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 46f54fbefb..eb6b429e5e 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -1520,6 +1520,7 @@ static bool _find_description(bool &again, std::string& error_inout)
bool doing_gods = false;
bool doing_branches = false;
bool doing_features = false;
+ bool doing_spells = false;
switch (ch)
{
@@ -1532,8 +1533,9 @@ static bool _find_description(bool &again, std::string& error_inout)
doing_mons = true;
break;
case 'S':
- type = "spell";
- filter = _spell_filter;
+ type = "spell";
+ filter = _spell_filter;
+ doing_spells = true;
break;
case 'K':
type = "skill";
@@ -1702,7 +1704,7 @@ static bool _find_description(bool &again, std::string& error_inout)
// For tiles builds use a tiles menu to display monsters.
const bool text_only =
#ifdef USE_TILE
- !(doing_mons || doing_features);
+ !(doing_mons || doing_features || doing_spells);
#else
true;
#endif
@@ -1765,6 +1767,17 @@ static bool _find_description(bool &again, std::string& error_inout)
me = new MenuEntry(uppercase_first(key_list[i]), MEL_ITEM, 1,
letter);
+#ifdef USE_TILE
+ if (doing_spells)
+ {
+ spell_type spell = spell_by_name(str);
+ if (spell != SPELL_NO_SPELL)
+ me->add_tile(tile_def(tileidx_spell(spell), TEX_GUI));
+ }
+#else
+ UNUSED(doing_spells);
+#endif
+
me->data = (void*) &key_list[i];
}
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index bed2cf7b3c..c69bdce331 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1529,8 +1529,15 @@ static spell_type _choose_mem_spell(spell_list &spells,
{
std::sort(spells.begin(), spells.end(), _sort_mem_spells);
+#ifdef USE_TILE
+ const bool text_only = false;
+#else
+ const bool text_only = true;
+#endif
+
Menu spell_menu(MF_SINGLESELECT | MF_ANYPRINTABLE
- | MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING);
+ | MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING,
+ "", text_only);
#ifdef USE_TILE
{
// [enne] - Hack. Make title an item so that it's aligned.
@@ -1609,6 +1616,11 @@ static spell_type _choose_mem_spell(spell_list &spells,
MenuEntry* me = new MenuEntry(desc.str(), MEL_ITEM, 1,
index_to_letter(i % 52));
+
+#ifdef USE_TILE
+ me->add_tile(tile_def(tileidx_spell(spell), TEX_GUI));
+#endif
+
me->data = &spells[i];
spell_menu.add_entry(me);
}