From e89ce29b918844011b3ea96d71b8ed1bb982a7a0 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 13 Sep 2007 20:34:09 +0000 Subject: 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 --- crawl-ref/docs/crawl_options.txt | 6 +++++- crawl-ref/init.txt | 1 + crawl-ref/source/defines.h | 3 ++- crawl-ref/source/externs.h | 1 + crawl-ref/source/initfile.cc | 7 ++++++- crawl-ref/source/libunix.cc | 1 + crawl-ref/source/view.cc | 11 ++++++++++- 7 files changed, 26 insertions(+), 4 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt index 24bafe145b..7d280d0de4 100644 --- a/crawl-ref/docs/crawl_options.txt +++ b/crawl-ref/docs/crawl_options.txt @@ -31,7 +31,7 @@ The contents of this text are: remembered_monster_colour, colour_map, clean_map 4-d Branding (Item and Monster Highlighting). heap_brand, friend_brand, stab_brand, may_stab_brand, - stair_item_brand + stair_item_brand, trap_item_brand 4-e Level Map Functions. level_map_cursor_step, level_map_title, item_colour 4-f Viewport Display Options. @@ -497,6 +497,10 @@ stair_item_brand = reverse use this brand, the items on the square are hidden by the stair symbol (<, >, or portal) and the stair symbol is branded. +trap_item_brand = none + Brands traps that would otherwise be hidden by items. If you + use this brand, the items on the square are hidden by the trap + symbol (^) and the trap symbol is branded. 4-e Level Map Functions. ---------------------------- diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt index c1664cde39..e18217fc73 100644 --- a/crawl-ref/init.txt +++ b/crawl-ref/init.txt @@ -104,6 +104,7 @@ friend_brand = hi:green stab_brand = hi:blue # may_stab_brand = hi:yellow # stair_item_brand = reverse +# trap_item_brand = reverse ##### 4-e Level Map Functions ################### # 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; -- cgit v1.2.3-54-g00ecf