summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-10 20:02:38 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-10 20:02:38 +0000
commitb2d325166ee05741620ee70de5b47104e256f0b4 (patch)
treee3146b6c6a5a4ccb6e0eb6c531842dc07d83b049
parentae2a0b91978d593736cfea9b5d4ab2a6afd8c537 (diff)
downloadcrawl-ref-b2d325166ee05741620ee70de5b47104e256f0b4.tar.gz
crawl-ref-b2d325166ee05741620ee70de5b47104e256f0b4.zip
Greatly improve 'V' command:
* Add toggle to travel to items. (FR 2180269) (Basically copied from StashSearchMenu, but I couldn't work out how to change the title after the toggle.) * Display monster tiles, yay! * Space allowing, display monsters' description along with 'x' information. (Ironically, though this was copied from Tiles, it only works for ASCII at the moment.) * Right-shift all entry types by 1 instead of just InvEntry, so it's more consistent and looks better on the 'V' screen. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9409 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/describe.h4
-rw-r--r--crawl-ref/source/directn.cc95
-rw-r--r--crawl-ref/source/invent.cc12
-rw-r--r--crawl-ref/source/invent.h4
-rw-r--r--crawl-ref/source/menu.cc66
-rw-r--r--crawl-ref/source/menu.h7
-rw-r--r--crawl-ref/source/spl-cast.cc2
-rw-r--r--crawl-ref/source/stash.cc4
-rw-r--r--crawl-ref/source/tilepick.cc43
-rw-r--r--crawl-ref/source/tilereg.cc19
-rw-r--r--crawl-ref/source/tiles.h3
-rw-r--r--crawl-ref/source/tilesdl.cc2
-rw-r--r--crawl-ref/source/tiletex.h7
13 files changed, 161 insertions, 107 deletions
diff --git a/crawl-ref/source/describe.h b/crawl-ref/source/describe.h
index 4a09ad0d81..3bcf2f1fb6 100644
--- a/crawl-ref/source/describe.h
+++ b/crawl-ref/source/describe.h
@@ -130,12 +130,12 @@ template<class T>
inline void process_description(T &proc, const describe_info &inf)
{
const unsigned int line_width = proc.width();
- const int height = proc.height();
+ const int height = proc.height();
std::string desc;
if (inf.title.empty())
- desc = inf.body.str();
+ desc = inf.body.str();
else
{
desc = inf.title + "$$";
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 4843493939..2e935ce2ba 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -20,7 +20,7 @@ REVISION("$Rev$");
#include <algorithm>
#ifdef DOS
-#include <conio.h>
+ #include <conio.h>
#endif
#include "externs.h"
@@ -50,6 +50,7 @@ REVISION("$Rev$");
#ifdef USE_TILE
#include "tiles.h"
#include "tilereg.h"
+ #include "tilesdl.h"
#endif
#include "terrain.h"
#include "traps.h"
@@ -440,6 +441,15 @@ static void _direction_again(dist& moves, targeting_type restricts,
moves.isTarget = true;
}
+class view_desc_proc
+{
+public:
+ int width() { return crawl_view.msgsz.x; }
+ int height() { return crawl_view.msgsz.y; }
+ void print(const std::string &str) { cprintf("%s", str.c_str()); }
+ void nextline() { cgotoxy(1, wherey() + 1); }
+};
+
static void _describe_monster(const monsters *mon);
// Lists all the monsters and items currently in view by the player.
@@ -502,20 +512,19 @@ void full_describe_view()
mprf("Neither monsters nor items are visible.");
return;
}
-/*
- InvMenu desc_menu(MF_SINGLESELECT | MF_ANYPRINTABLE |
- MF_ALLOW_FORMATTING,
- "description", false);
-*/
+
InvMenu desc_menu(MF_SINGLESELECT | MF_ANYPRINTABLE |
/*MF_ALWAYS_SHOW_MORE |*/ MF_ALLOW_FORMATTING);
desc_menu.set_highlighter(NULL);
+ // FIXME: Need different title for the opposite toggle:
+ // "Visible Monsters/Items (select for more detail, '!' to examine):"
desc_menu.set_title(
- new MenuEntry("Visible Monsters/Items (select for more detail):",
+ new MenuEntry("Visible Monsters/Items (select for more detail, '!' to view/travel):",
MEL_TITLE));
desc_menu.set_tag("description");
+ desc_menu.allow_toggle = true;
int menu_index = -1;
// Build menu entries for monsters.
@@ -535,14 +544,13 @@ void full_describe_view()
if (colour == BLACK)
colour = LIGHTGREY;
- std::string prefix = "(<";
- prefix += colour_to_str(colour);
- prefix += ">";
- prefix += stringize_glyph(mons_char( list_mons[i]->type) );
- prefix += "</";
- prefix += colour_to_str(colour);
- prefix += ">) ";
-
+ std::string prefix = "";
+#ifndef USE_TILE
+ const std::string col_string = colour_to_str(colour);
+ prefix = "(<" + col_string + ">"
+ + stringize_glyph(mons_char( list_mons[i]->type) )
+ + "</" + col_string + ">) ";
+#endif
// Get damage level.
std::string damage_desc;
@@ -597,7 +605,6 @@ void full_describe_view()
const item_def &item = list_items[i];
InvEntry *me = new InvEntry(item);
-
#ifndef USE_TILE
// Show glyphs only for ASCII.
me->set_show_glyph(true);
@@ -605,10 +612,17 @@ void full_describe_view()
me->tag = "i";
me->hotkeys[0] = letter;
me->quantity = 2; // Hack to make items selectable.
+
desc_menu.add_entry(me);
}
}
+ // Select an item to read its full description, or a monster to read its
+ // e'x'amine description. Toggle with '!' to travel to an item's position
+ // or read a monster's database entry.
+ // (Maybe that should be reversed in the case of monsters.)
+ // For ASCII, the 'x' information may include short database descriptions.
+
// Menu loop
while (true)
{
@@ -618,7 +632,6 @@ void full_describe_view()
if (sel.empty())
break;
- // Possibility to select a menu item to get full description
// HACK: quantity == 1: monsters, quantity == 2: items
const int quant = sel[0]->quantity;
if (quant == 1)
@@ -634,17 +647,41 @@ void full_describe_view()
tiles.clear_text_tags(TAG_TUTORIAL);
tiles.add_text_tag(TAG_TUTORIAL, desc, gc);
#endif
- mesclr();
- _describe_monster( m );
- if (getch() == 0)
- getch();
+ if (desc_menu.menu_action == InvMenu::ACT_EXAMINE)
+ {
+ describe_info inf;
+ get_square_desc(m->pos(), inf, true);
+#ifndef USE_TILE
+ // Hmpf. This was supposed to work for both ASCII *and* Tiles!
+ view_desc_proc proc;
+ process_description<view_desc_proc>(proc, inf);
+#else
+ mesclr();
+ _describe_monster(m);
+#endif
+ if (getch() == 0)
+ getch();
+ }
+ else // ACT_TRAVEL, here used to view database entry
+ {
+ describe_monsters(*m);
+ redraw_screen();
+ mesclr(true);
+ }
}
else if (quant == 2)
{
// Get selected item.
item_def* i = (item_def*)(sel[0]->data);
- describe_item( *i );
+ if (desc_menu.menu_action == InvMenu::ACT_EXAMINE)
+ describe_item( *i );
+ else // ACT_TRAVEL
+ {
+ const coord_def c = i->pos;
+ start_travel( c );
+ break;
+ }
}
}
@@ -747,7 +784,7 @@ range_view_annotator::range_view_annotator(int range)
// Save and replace grid colours. -1 means unchanged.
orig_colours.init(-1);
const coord_def offset(ENV_SHOW_OFFSET, ENV_SHOW_OFFSET);
- for ( radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri )
+ for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
{
if (grid_distance(you.pos(), *ri) > range)
{
@@ -767,9 +804,7 @@ range_view_annotator::range_view_annotator(int range)
menv[i].colour = DARKGREY;
}
else
- {
orig_mon_colours[i] = -1;
- }
}
// Repaint.
@@ -791,15 +826,13 @@ void range_view_annotator::restore_state()
// Restore grid colours.
coord_def c;
const coord_def offset(ENV_SHOW_OFFSET, ENV_SHOW_OFFSET);
- for ( c.x = 0; c.x < ENV_SHOW_DIAMETER; ++c.x )
- {
- for ( c.y = 0; c.y < ENV_SHOW_DIAMETER; ++c.y )
+ for (c.x = 0; c.x < ENV_SHOW_DIAMETER; ++c.x)
+ for (c.y = 0; c.y < ENV_SHOW_DIAMETER; ++c.y)
{
const int old_colour = orig_colours(c);
- if ( old_colour != -1 )
+ if (old_colour != -1)
env.grid_colours(you.pos() + c - offset) = old_colour;
}
- }
// Restore monster colours.
for (int i = 0; i < MAX_MONSTERS; ++i)
@@ -3131,7 +3164,7 @@ static void _describe_cell(const coord_def& where, bool in_range)
}
else
{
- if ( !in_range )
+ if (!in_range)
{
mprf(MSGCH_EXAMINE_FILTER, "%s is out of range.",
mon->pronoun(PRONOUN_CAP).c_str());
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 014054a747..cb0f5ececf 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -171,8 +171,9 @@ const int InvEntry::item_freshness() const
void InvEntry::select(int qty)
{
- if ( item && item->quantity < qty )
+ if (item && item->quantity < qty)
qty = item->quantity;
+
MenuEntry::select(qty);
}
@@ -298,7 +299,7 @@ void InvEntry::set_show_glyph(bool doshow)
InvMenu::InvMenu(int mflags)
: Menu(mflags, "inventory", false), type(MT_INVLIST), pre_select(NULL),
- title_annotate(NULL)
+ title_annotate(NULL), allow_toggle(false), menu_action(ACT_EXAMINE)
{
mdisplay->set_num_columns(2);
}
@@ -749,6 +750,13 @@ bool InvMenu::process_key( int key )
draw_select_count(0, true);
return (true);
}
+ else if (key == '!')
+ {
+ sel.clear();
+ menu_action = (action)((menu_action+1) % ACT_NUM);
+ update_title();
+ return (true);
+ }
return Menu::process_key( key );
}
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index c974027ed6..68679dc9f2 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -123,6 +123,10 @@ class InvMenu : public Menu
public:
InvMenu(int mflags = MF_MULTISELECT);
+ bool allow_toggle;
+ enum action { ACT_TRAVEL, ACT_EXAMINE, ACT_NUM } menu_action;
+
+public:
unsigned char getkey() const;
void set_preselect(const std::vector<SelItem> *pre);
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 7d3cfcacb4..f1e35ea4c0 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -221,11 +221,8 @@ void Menu::set_maxpagesize(int max)
void Menu::set_flags(int new_flags, bool use_options)
{
flags = new_flags;
- if (use_options)
- {
- if (Options.easy_exit_menu)
- flags |= MF_EASY_EXIT;
- }
+ if (use_options && Options.easy_exit_menu)
+ flags |= MF_EASY_EXIT;
}
void Menu::set_more(const formatted_string &fs)
@@ -359,7 +356,7 @@ bool Menu::process_key( int keyin )
repaint = page_down();
if (!repaint && !is_set(MF_EASY_EXIT) && !is_set(MF_NOWRAP))
{
- repaint = first_entry != 0;
+ repaint = (first_entry != 0);
first_entry = 0;
}
break;
@@ -377,7 +374,7 @@ bool Menu::process_key( int keyin )
break;
case CK_HOME:
nav = true;
- repaint = first_entry != 0;
+ repaint = (first_entry != 0);
first_entry = 0;
break;
case CK_END:
@@ -442,7 +439,7 @@ bool Menu::process_key( int keyin )
break;
default:
- keyin = post_process(keyin);
+ keyin = post_process(keyin);
lastch = keyin;
// If no selection at all is allowed, exit now.
@@ -616,15 +613,14 @@ bool Menu::is_hotkey(int i, int key)
int end = first_entry + pagesize;
if (end > static_cast<int>(items.size())) end = items.size();
- bool ishotkey = is_set(MF_SINGLESELECT)?
- items[i]->is_primary_hotkey(key)
- : items[i]->is_hotkey(key);
+ bool ishotkey = (is_set(MF_SINGLESELECT) ? items[i]->is_primary_hotkey(key)
+ : items[i]->is_hotkey(key));
- return !is_set(MF_SELECT_BY_PAGE)? ishotkey
- : ishotkey && i >= first_entry && i < end;
+ return !is_set(MF_SELECT_BY_PAGE) ? ishotkey
+ : ishotkey && i >= first_entry && i < end;
}
-void Menu::select_items( int key, int qty )
+void Menu::select_items(int key, int qty)
{
int x = wherex(), y = wherey();
@@ -681,6 +677,23 @@ void Menu::select_items( int key, int qty )
cgotoxy( x, y );
}
+#ifdef USE_TILE
+bool MenuEntry::get_tiles(std::vector<tile_def>& tileset) const
+{
+ // Is this a monster?
+ monsters *m = (monsters*)(data);
+ if (!m)
+ return (false);
+
+ const coord_def c = m->pos();
+ const dungeon_feature_type feat = grd(c);
+ tileset.push_back(tile_def(tileidx_feature(feat, c.x, c.y), TEX_DUNGEON));
+ tileset.push_back(tile_def(tileidx_monster_base(m), TEX_PLAYER));
+
+ return (true);
+}
+#endif
+
bool Menu::is_selectable(int item) const
{
if (select_filter.empty())
@@ -688,10 +701,9 @@ bool Menu::is_selectable(int item) const
std::string text = items[item]->get_filter_text();
for (int i = 0, count = select_filter.size(); i < count; ++i)
- {
if (select_filter[i].matches(text))
return (true);
- }
+
return (false);
}
@@ -809,7 +821,7 @@ void Menu::write_title()
{
textattr( item_colour(-1, title) );
cprintf("%s", title->get_text().c_str());
- if ( flags & MF_SHOW_PAGENUMBERS )
+ if (flags & MF_SHOW_PAGENUMBERS)
{
// The total number of pages is well defined, but the current
// page a bit less so. To make sense, we hack it so that your
@@ -817,7 +829,7 @@ void Menu::write_title()
// you're seeing the last item.
int numpages = items.empty() ? 1 : ((items.size()-1) / pagesize + 1);
int curpage = first_entry / pagesize + 1;
- if ( in_page(items.size() - 1) )
+ if (in_page(items.size() - 1))
curpage = numpages;
cprintf(" (page %d of %d)", curpage, numpages);
}
@@ -1417,7 +1429,7 @@ void formatted_scroller::add_item_formatted_string(const formatted_string& fs,
{
MenuEntry* me = new MenuEntry;
me->data = new formatted_string(fs);
- if ( hotkey )
+ if (hotkey)
{
me->add_hotkey(hotkey);
me->quantity = 1;
@@ -1428,14 +1440,14 @@ void formatted_scroller::add_item_formatted_string(const formatted_string& fs,
void formatted_scroller::add_item_string(const std::string& s, int hotkey)
{
MenuEntry* me = new MenuEntry(s);
- if ( hotkey )
+ if (hotkey)
me->add_hotkey(hotkey);
add_entry(me);
}
void formatted_scroller::draw_index_item(int index, const MenuEntry *me) const
{
- if ( me->data == NULL )
+ if (me->data == NULL)
Menu::draw_index_item(index, me);
else
static_cast<formatted_string*>(me->data)->display();
@@ -1443,10 +1455,10 @@ void formatted_scroller::draw_index_item(int index, const MenuEntry *me) const
formatted_scroller::~formatted_scroller()
{
- // very important: this destructor is called *before* the
+ // Very important: this destructor is called *before* the
// base (Menu) class destructor...which is at it should be.
- for ( unsigned i = 0; i < items.size(); ++i )
- if ( items[i]->data != NULL )
+ for (unsigned i = 0; i < items.size(); ++i)
+ if (items[i]->data != NULL)
delete static_cast<formatted_string*>(items[i]->data);
}
@@ -1725,7 +1737,7 @@ bool formatted_scroller::process_key( int keyin )
case CK_END:
{
const int breakpoint = (items.size() + 1) - pagesize;
- if ( first_entry < breakpoint )
+ if (first_entry < breakpoint)
repaint = jump_to(breakpoint);
break;
}
@@ -1753,8 +1765,8 @@ bool formatted_scroller::process_key( int keyin )
int ToggleableMenu::pre_process(int key)
{
- if ( std::find(toggle_keys.begin(), toggle_keys.end(), key) !=
- toggle_keys.end() )
+ if (std::find(toggle_keys.begin(), toggle_keys.end(), key) !=
+ toggle_keys.end())
{
// Toggle all menu entries
for (unsigned int i = 0; i < items.size(); ++i)
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index d4bd101a47..86c3b6e556 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -114,7 +114,7 @@ struct MenuEntry
{
char buf[300];
snprintf(buf, sizeof buf,
- "%c - %s", hotkeys[0], text.c_str());
+ " %c - %s", hotkeys[0], text.c_str());
return std::string(buf);
}
return text;
@@ -144,10 +144,7 @@ struct MenuEntry
}
#ifdef USE_TILE
- virtual bool get_tiles(std::vector<tile_def>& tileset) const
- {
- return (false);
- }
+ virtual bool get_tiles(std::vector<tile_def>& tileset) const;
#endif
};
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 935abf777c..68188b9f5c 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -238,7 +238,7 @@ int list_spells(bool toggle_with_I)
std::vector<MenuEntry*> sel = spell_menu.show();
redraw_screen();
- if ( sel.empty() )
+ if (sel.empty())
{
return 0;
}
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index f4f7d2e1ff..a6b03ceb81 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -556,8 +556,8 @@ bool Stash::show_menu(const std::string &prefix, bool can_travel) const
StashMenu menu;
MenuEntry *mtitle = new MenuEntry("Stash (" + prefix, MEL_TITLE);
- menu.can_travel = can_travel;
- mtitle->quantity = items.size();
+ menu.can_travel = can_travel;
+ mtitle->quantity = items.size();
menu.set_title(mtitle);
menu.load_items( InvMenu::xlat_itemvect(items), stash_menu_fixup);
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index c824b8c88c..1f7efcd22e 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -115,7 +115,7 @@ static int _bow_offset(const monsters *mon)
}
}
-static int _tileidx_monster_base(const monsters *mon, bool detected)
+int tileidx_monster_base(const monsters *mon, bool detected)
{
bool in_water = grid_is_water(grd(mon->pos()));
@@ -1008,12 +1008,12 @@ static int _tileidx_monster_base(const monsters *mon, bool detected)
return TILEP_MONS_ERESHKIGAL;
}
- return TILEP_ERROR;
+ return TILEP_MONS_PROGRAM_BUG;
}
int tileidx_monster(const monsters *mons, bool detected)
{
- int ch = _tileidx_monster_base(mons, detected);
+ int ch = tileidx_monster_base(mons, detected);
if (mons_flies(mons))
ch |= TILE_FLAG_FLYING;
@@ -1064,6 +1064,7 @@ int tileidx_monster(const monsters *mons, bool detected)
// no flag for okay.
break;
}
+
return ch;
}
@@ -1076,25 +1077,25 @@ static int _tileidx_monster(int mon_idx, bool detected)
static int _tileidx_fixed_artefact(int special)
{
- switch(special)
- {
- case SPWPN_SINGING_SWORD: return TILE_SPWPN_SINGING_SWORD;
- case SPWPN_WRATH_OF_TROG: return TILE_SPWPN_WRATH_OF_TROG;
- case SPWPN_SCYTHE_OF_CURSES: return TILE_SPWPN_SCYTHE_OF_CURSES;
- case SPWPN_MACE_OF_VARIABILITY: return TILE_SPWPN_MACE_OF_VARIABILITY;
- case SPWPN_GLAIVE_OF_PRUNE: return TILE_SPWPN_GLAIVE_OF_PRUNE;
- case SPWPN_SCEPTRE_OF_TORMENT: return TILE_SPWPN_SCEPTRE_OF_TORMENT;
- case SPWPN_SWORD_OF_ZONGULDROK: return TILE_SPWPN_SWORD_OF_ZONGULDROK;
- case SPWPN_SWORD_OF_CEREBOV: return TILE_SPWPN_SWORD_OF_CEREBOV;
- case SPWPN_STAFF_OF_DISPATER: return TILE_SPWPN_STAFF_OF_DISPATER;
- case SPWPN_SCEPTRE_OF_ASMODEUS: return TILE_SPWPN_SCEPTRE_OF_ASMODEUS;
- case SPWPN_SWORD_OF_POWER: return TILE_SPWPN_SWORD_OF_POWER;
- case SPWPN_STAFF_OF_OLGREB: return TILE_SPWPN_STAFF_OF_OLGREB;
- case SPWPN_VAMPIRES_TOOTH: return TILE_SPWPN_VAMPIRES_TOOTH;
- case SPWPN_STAFF_OF_WUCAD_MU: return TILE_SPWPN_STAFF_OF_WUCAD_MU;
- }
+ switch(special)
+ {
+ case SPWPN_SINGING_SWORD: return TILE_SPWPN_SINGING_SWORD;
+ case SPWPN_WRATH_OF_TROG: return TILE_SPWPN_WRATH_OF_TROG;
+ case SPWPN_SCYTHE_OF_CURSES: return TILE_SPWPN_SCYTHE_OF_CURSES;
+ case SPWPN_MACE_OF_VARIABILITY: return TILE_SPWPN_MACE_OF_VARIABILITY;
+ case SPWPN_GLAIVE_OF_PRUNE: return TILE_SPWPN_GLAIVE_OF_PRUNE;
+ case SPWPN_SCEPTRE_OF_TORMENT: return TILE_SPWPN_SCEPTRE_OF_TORMENT;
+ case SPWPN_SWORD_OF_ZONGULDROK: return TILE_SPWPN_SWORD_OF_ZONGULDROK;
+ case SPWPN_SWORD_OF_CEREBOV: return TILE_SPWPN_SWORD_OF_CEREBOV;
+ case SPWPN_STAFF_OF_DISPATER: return TILE_SPWPN_STAFF_OF_DISPATER;
+ case SPWPN_SCEPTRE_OF_ASMODEUS: return TILE_SPWPN_SCEPTRE_OF_ASMODEUS;
+ case SPWPN_SWORD_OF_POWER: return TILE_SPWPN_SWORD_OF_POWER;
+ case SPWPN_STAFF_OF_OLGREB: return TILE_SPWPN_STAFF_OF_OLGREB;
+ case SPWPN_VAMPIRES_TOOTH: return TILE_SPWPN_VAMPIRES_TOOTH;
+ case SPWPN_STAFF_OF_WUCAD_MU: return TILE_SPWPN_STAFF_OF_WUCAD_MU;
+ }
- return TILE_ERROR;
+ return TILE_ERROR;
}
static int _tileidx_unrand_artefact(int idx)
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index b099a360db..97eb62bf69 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -219,7 +219,7 @@ DungeonRegion::DungeonRegion(ImageManager* im, FTFont *tag_font,
m_cx_to_gx(0),
m_cy_to_gy(0),
m_buf_dngn(&im->m_textures[TEX_DUNGEON]),
- m_buf_doll(&im->m_textures[TEX_DOLL]),
+ m_buf_doll(&im->m_textures[TEX_PLAYER]),
m_buf_main(&im->m_textures[TEX_DEFAULT])
{
for (int i = 0; i < CURSOR_MAX; i++)
@@ -1616,7 +1616,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
// TODO enne - consider subclassing this class, rather than depending
// on "key" to determine if this is the crt inventory or the on screen one.
bool display_actions = (m_items[item_idx].key == 0
- && mouse_control::current_mode() == MOUSE_MODE_COMMAND);
+ && mouse_control::current_mode() == MOUSE_MODE_COMMAND);
// TODO enne - should the command keys here respect keymaps?
@@ -2792,9 +2792,10 @@ void MenuRegion::set_entry(int idx, const std::string &str, int colour,
e.text.clear();
e.text.textcolor(colour);
e.text += formatted_string::parse_string(str);
- e.heading = (me->level == MEL_TITLE || me->level == MEL_SUBTITLE);
+
+ e.heading = (me->level == MEL_TITLE || me->level == MEL_SUBTITLE);
e.selected = me->selected();
- e.key = me->hotkeys.size() > 0 ? me->hotkeys[0] : 0;
+ e.key = me->hotkeys.size() > 0 ? me->hotkeys[0] : 0;
e.sx = e.sy = e.ex = e.ey = 0;
e.tiles.clear();
me->get_tiles(e.tiles);
@@ -2817,7 +2818,7 @@ int MenuRegion::maxpagesize() const
int more_height = (lines + 1) * m_font_entry->char_height();
int pagesize = ((my - more_height) / 32) * m_max_columns;
- return pagesize;
+ return (pagesize);
}
void MenuRegion::set_offset(int lines)
@@ -2848,11 +2849,11 @@ bool ImageManager::load_textures()
if (!m_textures[TEX_DUNGEON].load_texture("dngn.png", mip))
return (false);
- if (!m_textures[TEX_DOLL].load_texture("player.png", mip))
+ if (!m_textures[TEX_PLAYER].load_texture("player.png", mip))
return (false);
m_textures[TEX_DUNGEON].set_info(TILE_DNGN_MAX, &tile_dngn_info);
- m_textures[TEX_DOLL].set_info(TILEP_PLAYER_MAX, &tile_player_info);
+ m_textures[TEX_PLAYER].set_info(TILEP_PLAYER_MAX, &tile_player_info);
return (true);
}
@@ -2944,7 +2945,7 @@ static bool _copy_under(unsigned char *pixels, int width,
int uofs_x = 0, int uofs_y = 0)
{
const tile_info &under = tile_main_info(idx_under);
- const tile_info &over = tile_main_info(idx_over);
+ const tile_info &over = tile_main_info(idx_over);
if (over.width != under.width || over.height != under.height)
return (false);
@@ -3043,7 +3044,5 @@ bool ImageManager::load_item_texture()
void ImageManager::unload_textures()
{
for (int i = 0; i < TEX_MAX; i++)
- {
m_textures[i].unload_texture();
- }
}
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index 9245dc272b..a76d37f32c 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -53,7 +53,8 @@ int tileidx_bolt(const bolt &bolt);
int tileidx_zap(int colour);
int tile_idx_unseen_terrain(int x, int y, int what);
int tile_unseen_flag(const coord_def& gc);
-int tileidx_monster(const monsters *mon, bool detected);
+int tileidx_monster_base(const monsters *mon, bool detected = false);
+int tileidx_monster(const monsters *mon, bool detected = false);
// Player tile related
void tilep_race_default(int race, int gender, int level, int *parts);
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index 87d41d59b5..45f4174e05 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1531,9 +1531,7 @@ void TilesFramework::add_text_tag(text_tag_type type, const monsters* mon)
tiles.add_text_tag(TAG_NAMED_MONSTER, mon->mname, gc);
}
else
- {
tiles.add_text_tag(TAG_NAMED_MONSTER, mon->name(DESC_PLAIN), gc);
- }
}
bool TilesFramework::initialise_items()
diff --git a/crawl-ref/source/tiletex.h b/crawl-ref/source/tiletex.h
index cc07a6326d..c9488019f3 100644
--- a/crawl-ref/source/tiletex.h
+++ b/crawl-ref/source/tiletex.h
@@ -9,11 +9,12 @@
#include "tiles.h"
+// The different texture types.
enum TextureID
{
- TEX_DUNGEON,
- TEX_DOLL,
- TEX_DEFAULT,
+ TEX_DUNGEON, // dngn.png
+ TEX_PLAYER, // player.png
+ TEX_DEFAULT, // main.png
TEX_MAX
};