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-14 18:30:25 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-14 18:30:25 +0000
commit8c58a5f6f1d5e3c7482153b5d188794108390ecb (patch)
tree20cb82177736a96ae2edb4af7e923b4d72f97722 /crawl-ref/source
parent998211ec147b43ad5a3879d060dba48c876c3efc (diff)
downloadcrawl-ref-8c58a5f6f1d5e3c7482153b5d188794108390ecb.tar.gz
crawl-ref-8c58a5f6f1d5e3c7482153b5d188794108390ecb.zip
Overlay tiles in menu with tiles for being equipped/cursed/melded, the
flavoured floor, and weapon brands. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9477 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/food.cc3
-rw-r--r--crawl-ref/source/invent.cc46
-rw-r--r--crawl-ref/source/menu.cc26
-rw-r--r--crawl-ref/source/tilereg.cc2
-rw-r--r--crawl-ref/source/tiles.h1
-rw-r--r--crawl-ref/source/tilesdl.cc74
6 files changed, 107 insertions, 45 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 13c0c3d4a7..6f9f464e0c 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -2407,7 +2407,8 @@ static int _player_likes_food_type(int type)
bool is_inedible(const item_def &item)
{
if (food_is_rotten(item)
- && !player_mutation_level(MUT_SAPROVOROUS))
+ && !player_mutation_level(MUT_SAPROVOROUS)
+ && !wearing_amulet(AMU_THE_GOURMAND))
{
return (true);
}
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 81bf34f5ed..616b348e5f 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -463,8 +463,42 @@ bool InvEntry::get_tiles(std::vector<tile_def>& tileset) const
if (!idx)
return (false);
- tileset.push_back(tile_def(TILE_ITEM_SLOT, TEX_DUNGEON));
- tileset.push_back(tile_def(idx, TEX_DEFAULT));
+ if (in_inventory(*item))
+ {
+ const bool equipped = item_is_equipped(*item);
+ if (equipped)
+ {
+ if (item_cursed(*item))
+ tileset.push_back(tile_def(TILE_ITEM_SLOT_EQUIP_CURSED, TEX_DEFAULT));
+ else
+ tileset.push_back(tile_def(TILE_ITEM_SLOT_EQUIP, TEX_DEFAULT));
+ }
+ else if (item_cursed(*item))
+ tileset.push_back(tile_def(TILE_ITEM_SLOT_CURSED, TEX_DEFAULT));
+
+ tileset.push_back(tile_def(TILE_ITEM_SLOT, TEX_DUNGEON));
+ tileset.push_back(tile_def(idx, TEX_DEFAULT));
+
+ // Is item melded?
+ if (equipped && !you_tran_can_wear(*item))
+ tileset.push_back(tile_def(TILE_MESH, TEX_DEFAULT));
+ }
+ else
+ {
+ // Do we want to display the floor type or is that too distracting?
+ const coord_def c = item->pos;
+ int ch = tileidx_feature(grd(c), c.x, c.y);
+ if (ch == TILE_FLOOR_NORMAL)
+ ch = env.tile_flv(c).floor;
+ else if (ch == TILE_WALL_NORMAL)
+ ch = env.tile_flv(c).wall;
+
+ tileset.push_back(tile_def(ch, TEX_DUNGEON));
+ tileset.push_back(tile_def(idx, TEX_DEFAULT));
+ }
+ int brand = tile_known_weapon_brand(*item);
+ if (brand)
+ tileset.push_back(tile_def(brand, TEX_DEFAULT));
return (true);
}
@@ -868,8 +902,11 @@ std::vector<SelItem> select_items( const std::vector<const item_def*> &items,
static bool _item_class_selected(const item_def &i, int selector)
{
const int itype = i.base_type;
- if (selector == OSEL_ANY || selector == itype && itype != OBJ_ARMOUR)
+ if (selector == OSEL_ANY || selector == itype
+ && itype != OBJ_FOOD && itype != OBJ_ARMOUR)
+ {
return (true);
+ }
switch (selector)
{
@@ -915,6 +952,9 @@ static bool _item_class_selected(const item_def &i, int selector)
case OSEL_ENCH_ARM:
return (is_enchantable_armour(i, true, true));
+ case OBJ_FOOD:
+ return (itype == OBJ_FOOD && !is_inedible(i));
+
case OSEL_VAMP_EAT:
return (itype == OBJ_CORPSES && i.sub_type == CORPSE_BODY
&& !food_is_rotten(i) && mons_has_blood(i.plus));
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index c891e715d3..23f9829fd2 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -15,6 +15,9 @@ REVISION("$Rev$");
#include "menu.h"
#include "macro.h"
#include "message.h"
+#ifdef USE_TILE
+ #include "mon-util.h"
+#endif
#include "player.h"
#include "tiles.h"
#include "tutorial.h"
@@ -694,10 +697,29 @@ bool MenuEntry::get_tiles(std::vector<tile_def>& tileset) const
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));
+ int ch = tileidx_feature(grd(c), c.x, c.y);
+ if (ch == TILE_FLOOR_NORMAL)
+ ch = env.tile_flv(c).floor;
+ else if (ch == TILE_WALL_NORMAL)
+ ch = env.tile_flv(c).wall;
+
+ tileset.push_back(tile_def(ch, TEX_DUNGEON));
tileset.push_back(tile_def(tileidx_monster_base(m), TEX_PLAYER));
+ if (!mons_flies(m))
+ {
+ if (ch == TILE_DNGN_LAVA)
+ tileset.push_back(tile_def(TILE_MASK_LAVA, TEX_DEFAULT));
+ else if (ch == TILE_DNGN_SHALLOW_WATER)
+ tileset.push_back(tile_def(TILE_MASK_SHALLOW_WATER, TEX_DEFAULT));
+ else if (ch == TILE_DNGN_DEEP_WATER)
+ tileset.push_back(tile_def(TILE_MASK_DEEP_WATER, TEX_DEFAULT));
+ else if (ch == TILE_DNGN_SHALLOW_WATER_MURKY)
+ tileset.push_back(tile_def(TILE_MASK_SHALLOW_WATER_MURKY, TEX_DEFAULT));
+ else if (ch == TILE_DNGN_DEEP_WATER_MURKY)
+ tileset.push_back(tile_def(TILE_MASK_DEEP_WATER_MURKY, TEX_DEFAULT));
+ }
+
return (true);
}
#endif
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 97eb62bf69..f4fc7ea097 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -480,9 +480,7 @@ void DungeonRegion::pack_foreground(unsigned int bg, unsigned int fg, int x, int
unsigned int bg_idx = bg & TILE_FLAG_MASK;
if (fg_idx && fg_idx <= TILE_MAIN_MAX)
- {
m_buf_main.add(fg_idx, x, y);
- }
if (fg_idx && !(fg & TILE_FLAG_FLYING))
{
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index a76d37f32c..66162a03b2 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -128,6 +128,7 @@ void TileNewLevel(bool first_time);
void TilePlayerEdit();
int item_unid_type(const item_def &item);
+int tile_known_weapon_brand(const item_def item);
void TileDrawTitle();
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index e4d56c6e99..35fd927957 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1259,6 +1259,42 @@ void TilesFramework::update_minimap_bounds()
m_region_map->update_bounds();
}
+int tile_known_weapon_brand(const item_def item)
+{
+ if (!item_type_known(item))
+ return 0;
+
+ if (item.base_type == OBJ_WEAPONS)
+ {
+ if (!is_fixed_artefact(item)
+ && get_weapon_brand(item) != SPWPN_NORMAL)
+ {
+ return (TILE_BRAND_FLAMING + get_weapon_brand(item) - 1);
+ }
+ }
+ else if (item.base_type == OBJ_MISSILES)
+ {
+ switch (get_ammo_brand(item))
+ {
+ case SPMSL_FLAME:
+ return TILE_BRAND_FLAME;
+ case SPMSL_FROST:
+ return TILE_BRAND_FROST;
+ case SPMSL_POISONED:
+ return TILE_BRAND_POISONED;
+ case SPMSL_CURARE:
+ return TILE_BRAND_CURARE;
+ case SPMSL_RETURNING:
+ return TILE_BRAND_RETURNING;
+ case SPMSL_CHAOS:
+ return TILE_BRAND_CHAOS;
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
static void _fill_item_info(InventoryTile &desc, const item_def &item)
{
desc.tile = tileidx_item(item);
@@ -1279,43 +1315,7 @@ static void _fill_item_info(InventoryTile &desc, const item_def &item)
else
desc.quantity = -1;
- if (item_type_known(item))
- {
- if (item.base_type == OBJ_WEAPONS)
- {
- if (!is_fixed_artefact(item)
- && get_weapon_brand(item) != SPWPN_NORMAL)
- {
- desc.special = TILE_BRAND_FLAMING + get_weapon_brand(item) - 1;
- }
- }
- else if (item.base_type == OBJ_MISSILES)
- {
- switch (get_ammo_brand(item))
- {
- case SPMSL_FLAME:
- desc.special = TILE_BRAND_FLAME;
- break;
- case SPMSL_FROST:
- desc.special = TILE_BRAND_FROST;
- break;
- case SPMSL_POISONED:
- desc.special = TILE_BRAND_POISONED;
- break;
- case SPMSL_CURARE:
- desc.special = TILE_BRAND_CURARE;
- break;
- case SPMSL_RETURNING:
- desc.special = TILE_BRAND_RETURNING;
- break;
- case SPMSL_CHAOS:
- desc.special = TILE_BRAND_CHAOS;
- break;
- default:
- break;
- }
- }
- }
+ desc.special = tile_known_weapon_brand(item);
desc.flag = 0;
if (item_cursed(item) && item_ident(item, ISFLAG_KNOW_CURSE))
desc.flag |= TILEI_FLAG_CURSE;