summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--crawl-ref/docs/tiles_creation.txt102
-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
8 files changed, 170 insertions, 37 deletions
diff --git a/crawl-ref/docs/tiles_creation.txt b/crawl-ref/docs/tiles_creation.txt
new file mode 100644
index 0000000000..72df10035c
--- /dev/null
+++ b/crawl-ref/docs/tiles_creation.txt
@@ -0,0 +1,102 @@
+A short guide to Tiles creation
+===============================
+
+This is a short guide to creating tiles. We assume that you've got some kind of
+image editing software (such as Photoshop or the GIMP) as well as some basic
+knowledge of how to use it. While the fancier functions can occasionally come
+in useful, simply drawing and erasing of pixels will usually suffice.
+
+You may want to download the latest source or even the trunk version. The
+source/rltiles/ directory contains all tiles used in the game, and some more
+that are currently unused. While you can create new tiles without having access
+to existing ones, it can be useful to have them around for comparison. Also,
+you'll probably want to compile them into the game to test your creations.
+(You don't have to, though.) For compiling the game, see INSTALL.txt.
+
+Crawl's tiles are png files in a format of 32x32 pixels. Larger tiles such
+as for the pandemonium demons are possible, but require additional coding and
+should be used sparingly. The tile background should be transparent, but if
+your image software doesn't support png files with transparent background you
+can also submit a png or bmp with the background coloured differently from the
+rest of the tile, so we can easily remove it later.
+
+
+1.) Before setting out to draw a new tile, you may want to check out the
+ UNUSED/ directory in case there's already a tile that could be used for
+ this purpose.
+
+2.) When creating new tiles you often don't need to start from zero. A lot of
+ the time existing tiles can be repurposed to other uses. If you tweak them
+ enough no-one will even notice you cheated.
+ For example, the spell tile deaths_door.png is basically a modified version
+ of the reaper, with the hour glass copied over from the slowing potion's
+ i-slowing.png that was then changed significantly.
+
+3.) For items and monsters don't forget to add a shadow. You can use standard
+ black for this.
+
+4.) New randart weapons and armour items need not only a tile for the item
+ itself but also a smaller variant for the player doll to wield or wear.
+ To define the new artefact tiles, you'll need to modify two files:
+ source/art-data.txt, and rltiles/dc-player.txt, with the details nicely
+ described in art-data.txt.
+ If you have perl installed, run "perl art-data.pl" from source/util. If you
+ made any mistakes in modifying the two files the script will complain.
+
+ If an artefact doesn't get a special equipment tile the base type's tile
+ will be used instead.
+
+5.) Otherwise, add the tile to the relevant dc-xxxx.txt file and use the same
+ (uppercase) definition in the matching tileidx_xxxx() function in
+ tilepick.cc. Note that the latter is not necessary if you are adding tiles
+ for the player doll.
+
+ Tiles are assumed to have been placed within the rltiles/ directory
+ structure. You can use a relative path for the tile definition, or you can
+ use the %sdir command to change the current default relative path.
+
+ Use the %rim property to control whether Crawl needs to draw a black
+ outline around your tile or whether it already has one. To change the rim
+ property for your tile, use e.g.:
+ %rim 1
+ new_tile NEW_TILE
+ %rim 0
+
+6.) For humanoid monsters' tiles you may want to add a line in
+ get_weapon_offset() in tilemcache.cc to allow it to be drawn with a wielded
+ weapon.
+
+7.) New monsters may also need a unique corpse tile. In that case you'll also
+ need to modify dc-corpse.txt and add a tile in _tileidx_corpse() of
+ tilepick.cc.
+
+
+When compiling the game you may need to delete or rename the relevant tile
+section's png file, i.e. main.png (for items), player.png (for player, doll
+equipment, and monsters), dngn.png (for dungeon features) or gui.png (for
+spells), to make the changes take effect. The first step during the compilation
+will be to rebuild this file, so you can check right away whether your new tile
+was added correctly. Changes in dc-xxxx.txt automatically cause the relevant
+image files to be recreated.
+
+
+In case you'd like to draw some tiles but have run out of ideas, here's an
+incomplete (and possibly outdated) list of suggestions:
+
+* tiles of the various runes
+* zombie/skeleton tiles taking into account the monster type
+* tiles for abilities
+* alternative tiles for dungeon features to allow for "animations"
+* equipment tiles for the player doll
+* improvement of existing tiles
+etc.
+
+You can also check the SourceForge Feature Requests for tracker items
+containing the "\o/" emblem in the title. At least one of them will be a call
+for more tiles.
+
+Please submit your new tiles as a new item on our feature request or patches
+tracker, or send one of the tiles developers (ennewalker, evktalo, j-p-e-g) an
+email containing your tiles.
+
+Thanks a lot for your support!
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
{