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-09-14 12:32:31 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-14 12:32:31 +0000
commit3f413ab79f31be4a7ae0de336ce11329505e7eed (patch)
tree16baa418a4975137cb09df1c51ff34c00179a8ac /crawl-ref/source
parent72d421a98654a1d73704397dfd9a4be3177289d0 (diff)
downloadcrawl-ref-3f413ab79f31be4a7ae0de336ce11329505e7eed.tar.gz
crawl-ref-3f413ab79f31be4a7ae0de336ce11329505e7eed.zip
* Show item type shortcuts in inventory. I think it's too intrusive for
ASCII even though it works well in tiles. * Always display memorise button because it's less confusing that way. I still can't work out why the error messages disappear right away. *sighs* * Add a short document on tiles creation. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10673 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/dat/database/FAQ.txt4
-rw-r--r--crawl-ref/source/invent.cc17
-rw-r--r--crawl-ref/source/spl-book.cc7
-rw-r--r--crawl-ref/source/spl-book.h2
-rw-r--r--crawl-ref/source/tilereg.cc37
-rw-r--r--crawl-ref/source/tilesdl.cc26
-rw-r--r--crawl-ref/source/tilesdl.h12
7 files changed, 68 insertions, 37 deletions
diff --git a/crawl-ref/source/dat/database/FAQ.txt b/crawl-ref/source/dat/database/FAQ.txt
index 7863d0d637..25f9ceaa46 100644
--- a/crawl-ref/source/dat/database/FAQ.txt
+++ b/crawl-ref/source/dat/database/FAQ.txt
@@ -363,7 +363,7 @@ much appreciated. These are:
* the maps/vaults (see dat/ folder, docs/level_design.txt)
* monster speech (see dat/database/, docs/monster_speech.txt)
* monster/item/spell descriptions (see dat/descript/)
-* tiles (For this you'll need the source code, check the rltiles/ folder.)
+* tiles (see source/rltiles/, docs/tiles_creation.txt)
Also, if you'd like to write a patch but don't know how to go about it, read
patch_guide.txt in the docs/ folder.
@@ -486,6 +486,8 @@ like to share you might want to send them over the mailing list or submit
them as a SourceForge item. It's easiest for us if they are already in
32x32 png format, preferrably zipped if there are several.
+See docs/tiles_creation.txt for a slightly more detailed explanation.
+
Thanks in advance!
%%%%
Q:tiles options
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index ee7ca7dae4..f11ff8b202 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -770,8 +770,8 @@ void InvMenu::load_items(const std::vector<const item_def*> &mitems,
continue;
std::string subtitle = item_class_name(i);
-#ifdef USE_TILE
- // For Tiles, mention the class selection shortcuts.
+
+ // Mention the class selection shortcuts.
if (is_set(MF_MULTISELECT) && inv_class[i] > 1)
{
std::vector<char> glyphs;
@@ -781,13 +781,20 @@ void InvMenu::load_items(const std::vector<const item_def*> &mitems,
const std::string str = "Magical Staves and Rods"; // longest string
subtitle += std::string(str.length()
- subtitle.length() + 1, ' ');
- subtitle += "(select all with <w>";
+ subtitle += "(select all with ";
+#ifdef USE_TILE
+ // For some reason, this is only formatted correctly in the
+ // Tiles version.
+ subtitle += "<w>";
+#endif
for (unsigned int k = 0; k < glyphs.size(); ++k)
subtitle += glyphs[k];
- subtitle += "</w><blue>)";
+#ifdef USE_TILE
+ subtitle += "</w><blue>";
+#endif
+ subtitle += ")";
}
}
-#endif
add_entry( new MenuEntry( subtitle, MEL_SUBTITLE ) );
items_in_class.clear();
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 6023dece43..ebcb7f6421 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1475,14 +1475,15 @@ static bool _get_mem_list(spell_list &mem_spells,
return (false);
}
-bool has_spells_to_memorise()
+bool has_spells_to_memorise(bool silent)
{
spell_list mem_spells;
spells_to_books book_hash;
unsigned int num_unreadable;
unsigned int num_race;
- return _get_mem_list(mem_spells, book_hash, num_unreadable, num_race, true);
+ return _get_mem_list(mem_spells, book_hash, num_unreadable, num_race,
+ silent);
}
static bool _sort_mem_spells(spell_type a, spell_type b)
@@ -1739,8 +1740,6 @@ static bool _learn_spell_checks(spell_type specspell)
return (true);
}
-
-
bool learn_spell(spell_type specspell, const item_def *book,
bool is_safest_book)
{
diff --git a/crawl-ref/source/spl-book.h b/crawl-ref/source/spl-book.h
index a3adf58dd1..c9fea05191 100644
--- a/crawl-ref/source/spl-book.h
+++ b/crawl-ref/source/spl-book.h
@@ -64,7 +64,7 @@ int staff_spell( int zap_device_2 );
bool is_memorised(spell_type spell);
bool you_cannot_memorise(spell_type spell);
-bool has_spells_to_memorise();
+bool has_spells_to_memorise(bool silent = true);
std::vector<spell_type> get_mem_spell_list();
int spellbook_contents( item_def &book, read_book_action_type action,
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index cbe24ec1b6..608f174b13 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1838,8 +1838,17 @@ static int _handle_spells_mouse(MouseEvent &event, int idx, int item_idx)
{
if (spell == NUM_SPELLS)
{
- Options.tile_display = TDSP_MEMORISE;
- tiles.update_inventory();
+ if (can_learn_spell() && has_spells_to_memorise(false))
+ {
+ Options.tile_display = TDSP_MEMORISE;
+ tiles.update_inventory();
+ }
+ else
+ {
+ // FIXME: Doesn't work. The message still disappears instantly!
+ you.last_clicked_item = item_idx;
+ tiles.set_need_redraw();
+ }
return CK_MOUSE_CMD;
}
if (Options.tile_display == TDSP_SPELLS)
@@ -1916,6 +1925,7 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
if (event.button == MouseEvent::LEFT)
{
you.last_clicked_item = item_idx;
+ tiles.set_need_redraw();
if (on_floor)
{
if (event.mod & MOD_SHIFT)
@@ -1937,13 +1947,13 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
}
else if (event.button == MouseEvent::RIGHT)
{
- you.last_clicked_item = item_idx;
if (on_floor)
{
if (event.mod & MOD_SHIFT)
{
- tile_item_eat_floor(idx);
you.last_clicked_item = item_idx;
+ tiles.set_need_redraw();
+ tile_item_eat_floor(idx);
}
else
{
@@ -2017,6 +2027,8 @@ void _update_spell_tip_text(std::string& tip, int flag)
tip = "You cannot cast this spell right now.";
else
tip = "[L-Click] Cast (z)";
+
+ tip += "\n[R-Click] Describe (I)";
}
else if (Options.tile_display == TDSP_MEMORISE)
{
@@ -2024,9 +2036,9 @@ void _update_spell_tip_text(std::string& tip, int flag)
tip = "You don't have enough slots for this spell right now.";
else
tip = "[L-Click] Memorise (M)";
- }
- tip += "\n[R-Click] Describe (I)";
+ tip += "\n[R-Click] Describe";
+ }
}
bool InventoryRegion::update_tip_text(std::string& tip)
@@ -2048,7 +2060,12 @@ bool InventoryRegion::update_tip_text(std::string& tip)
if (display_actions && Options.tile_display != TDSP_INVENT)
{
if (m_items[item_idx].idx == NUM_SPELLS)
- tip = "Memorise spells (M)";
+ {
+ if (m_items[item_idx].flag & TILEI_FLAG_MELDED)
+ tip = "You cannot learn any spells right now.";
+ else
+ tip = "Memorise spells (M)";
+ }
else
_update_spell_tip_text(tip, m_items[item_idx].flag);
return (true);
@@ -2356,7 +2373,7 @@ void MapRegion::on_resize()
delete[] m_buf;
int size = mx * my;
- m_buf = new unsigned char[size];
+ m_buf = new unsigned char[size];
memset(m_buf, 0, sizeof(unsigned char) * size);
}
@@ -3986,8 +4003,8 @@ static void _copy_into(unsigned char *dest, unsigned char *pixels,
int total_ofs_x = inf.offset_x + ofs_x;
int total_ofs_y = inf.offset_y + ofs_y;
- int src_height = inf.ey - inf.sy;
- int src_width = inf.ex - inf.sx;
+ int src_height = inf.ey - inf.sy;
+ int src_width = inf.ex - inf.sx;
if (total_ofs_x < 0)
{
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index 5a71cb750a..0eaedbee79 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1439,8 +1439,13 @@ void TilesFramework::update_spells()
if (Options.tile_display == TDSP_MEMORISE)
{
+ const int mx = m_region_inv->mx;
+ const int my = m_region_inv->my;
+ const unsigned int max_spells = mx * my;
+
std::vector<spell_type> spells = get_mem_spell_list();
- for (unsigned int i = 0; i < spells.size(); ++i)
+ for (unsigned int i = 0; inv.size() < max_spells && i < spells.size();
+ ++i)
{
const spell_type spell = spells[i];
@@ -1495,15 +1500,16 @@ void TilesFramework::update_spells()
inv.push_back(desc);
}
- if (can_learn_spell(true) && has_spells_to_memorise())
- {
- // FIXME: Add NUM_SPELLS to list of spells as placeholder for
- // memorisation tile. (Hack!)
- InventoryTile desc;
- desc.tile = tileidx_spell(NUM_SPELLS);
- desc.idx = NUM_SPELLS;
- inv.push_back(desc);
- }
+ // FIXME: Add NUM_SPELLS to list of spells as placeholder for
+ // memorisation tile. (Hack!)
+ InventoryTile desc;
+ desc.tile = tileidx_spell(NUM_SPELLS);
+ desc.idx = NUM_SPELLS;
+
+ if (!can_learn_spell(true) || !has_spells_to_memorise())
+ desc.flag |= TILEI_FLAG_MELDED;
+
+ inv.push_back(desc);
m_region_inv->update(inv.size(), &inv[0]);
}
diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h
index e122525cbb..69ead08b0d 100644
--- a/crawl-ref/source/tilesdl.h
+++ b/crawl-ref/source/tilesdl.h
@@ -164,15 +164,15 @@ protected:
LayerID m_active_layer;
// Normal layer
- DungeonRegion *m_region_tile;
- StatRegion *m_region_stat;
- MessageRegion *m_region_msg;
- MapRegion *m_region_map;
+ DungeonRegion *m_region_tile;
+ StatRegion *m_region_stat;
+ MessageRegion *m_region_msg;
+ MapRegion *m_region_map;
InventoryRegion *m_region_inv;
// Full-screen CRT layer
- CRTRegion *m_region_crt;
- MenuRegion *m_region_menu;
+ CRTRegion *m_region_crt;
+ MenuRegion *m_region_menu;
struct font_info
{