summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 20:34:09 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 20:34:09 +0000
commite89ce29b918844011b3ea96d71b8ed1bb982a7a0 (patch)
treefde03e613a48e6cb8c44b4eeb7bcb4060fb49c9b /crawl-ref/source
parentd733df05e5309444cb83c028c0515467c87ae4c6 (diff)
downloadcrawl-ref-e89ce29b918844011b3ea96d71b8ed1bb982a7a0.tar.gz
crawl-ref-e89ce29b918844011b3ea96d71b8ed1bb982a7a0.zip
Add trap_item_brand that behaves like stair_item_brand.
Defaults to 'none'. (FR 1793669) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2083 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/defines.h3
-rw-r--r--crawl-ref/source/externs.h1
-rw-r--r--crawl-ref/source/initfile.cc7
-rw-r--r--crawl-ref/source/libunix.cc1
-rw-r--r--crawl-ref/source/view.cc11
5 files changed, 20 insertions, 3 deletions
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index 8db899855e..65d11999cf 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -252,7 +252,8 @@
#define COLFLAG_WILLSTAB 0x0400
#define COLFLAG_MAYSTAB 0x0800
#define COLFLAG_STAIR_ITEM 0x1000
- #define COLFLAG_REVERSE 0x2000
+ #define COLFLAG_TRAP_ITEM 0x2000
+ #define COLFLAG_REVERSE 0x4000
#define COLFLAG_MASK 0xFF00
enum CHAR_ATTRIBUTES
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 33b92cd3c1..7e64f69916 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1763,6 +1763,7 @@ public:
unsigned stab_brand; // Highlight monsters that are stabbable
unsigned may_stab_brand; // Highlight potential stab candidates
unsigned stair_item_brand; // Highlight stairs covered by items.
+ unsigned trap_item_brand; // Highlight traps covered by items.
// What is the minimum number of items in a stack for which
// you show summary (one-line) information
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 7aee2eaa4c..8c49fd5a9c 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -719,7 +719,8 @@ void game_options::reset_options()
stab_brand = CHATTR_NORMAL;
may_stab_brand = CHATTR_NORMAL;
stair_item_brand = CHATTR_REVERSE;
-
+ trap_item_brand = CHATTR_NORMAL;
+
no_dark_brand = true;
#ifdef WIZARD
@@ -1791,6 +1792,10 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
stair_item_brand = curses_attribute(field);
}
+ else if (key == "trap_item_brand")
+ {
+ trap_item_brand = curses_attribute(field);
+ }
else if (key == "no_dark_brand")
{
// This is useful for terms where dark grey does
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc
index 8e6ea6fce9..372f10380c 100644
--- a/crawl-ref/source/libunix.cc
+++ b/crawl-ref/source/libunix.cc
@@ -666,6 +666,7 @@ inline unsigned get_brand(int col)
(col & COLFLAG_WILLSTAB)? Options.stab_brand :
(col & COLFLAG_MAYSTAB)? Options.may_stab_brand :
(col & COLFLAG_STAIR_ITEM)? Options.stair_item_brand :
+ (col & COLFLAG_TRAP_ITEM)? Options.trap_item_brand :
(col & COLFLAG_REVERSE)? CHATTR_REVERSE :
CHATTR_NORMAL;
}
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 62d5fea95f..13dd0d5ffb 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -258,6 +258,8 @@ static unsigned colflag2brand(int colflag)
return (Options.may_stab_brand);
case COLFLAG_STAIR_ITEM:
return (Options.stair_item_brand);
+ case COLFLAG_TRAP_ITEM:
+ return (Options.trap_item_brand);
default:
return (CHATTR_NORMAL);
}
@@ -552,7 +554,12 @@ screen_buffer_t colour_code_map( int x, int y, bool item_colour,
{
tc |= COLFLAG_STAIR_ITEM;
}
-
+ else if (Options.trap_item_brand
+ && grid_is_trap(grid_value) && igrd[x][y] != NON_ITEM)
+ {
+ tc |= COLFLAG_TRAP_ITEM;
+ }
+
return real_colour(tc);
}
@@ -1190,6 +1197,8 @@ inline static void update_item_grid(const coord_def &gp, const coord_def &ep)
const dungeon_feature_type grid = grd(gp);
if (Options.stair_item_brand && is_stair(grid))
ecol |= COLFLAG_STAIR_ITEM;
+ else if (Options.trap_item_brand && grid_is_trap(grid))
+ ecol |= COLFLAG_TRAP_ITEM;
else
{
ecol = (grid == DNGN_SHALLOW_WATER)? CYAN : eitem.colour;