From 700ca72344804d0a20d7913c537e57c375bbb36d Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 21 Mar 2008 01:03:15 +0000 Subject: Add a neutral monster brand (defaulting to darkgrey). Of course we still need something like this for Tiles! Make Ctrl+Dir call close_door() if the square in question is a closed door. I've tested it, and found this change (suggested by dpeg) extremely convenient. Also fixed the information leak about an invisible monster blocking a doorway without time passing. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3778 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/crawl_options.txt | 10 +++++++++- crawl-ref/init.txt | 1 + crawl-ref/source/acr.cc | 19 +++++++++++++++---- crawl-ref/source/defines.h | 9 +++++---- crawl-ref/source/externs.h | 1 + crawl-ref/source/initfile.cc | 5 +++++ crawl-ref/source/libunix.cc | 13 +++++++------ crawl-ref/source/view.cc | 6 ++++++ 8 files changed, 49 insertions(+), 15 deletions(-) diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt index bab4930b2b..be5f086b58 100644 --- a/crawl-ref/docs/crawl_options.txt +++ b/crawl-ref/docs/crawl_options.txt @@ -32,7 +32,7 @@ The contents of this text are: detected_monster_colour, detected_item_colour, remembered_monster_colour, colour_map, clean_map 4-d Branding (Item and Monster Highlighting). - friend_brand, stab_brand, may_stab_brand, + friend_brand, neutral_brand, stab_brand, may_stab_brand, heap_brand, feature_item_brand, trap_item_brand 4-e Level Map Functions. level_map_cursor_step, level_map_title, item_colour @@ -512,6 +512,14 @@ friend_brand = none shows friends with a green background. If the friend is itself green, it'll show up as black on green. +neutral_brand = none + Brand neutral monsters in some way. Useful both to get out of + a neutral monster's path, and to avoid accidentally killing it. + E.g. + neutral_brand = hi:darkgrey + shows neutrals with a dark grey background. Since there are + no darkgrey monster glyphs anymore, this works fine. + stab_brand = none Some deities object to you stabbing monsters. Certain classes specialise in stabbing monsters. Still other characters are diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt index 3045d4385e..2b0d72683f 100644 --- a/crawl-ref/init.txt +++ b/crawl-ref/init.txt @@ -117,6 +117,7 @@ autopickup_no_burden = true ##### 4-d Branding ############################## # friend_brand = hi:green +neutral_brand = hi:darkgrey stab_brand = hi:blue # may_stab_brand = hi:yellow heap_brand = reverse diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 9161f1a06c..35e4c60300 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3451,7 +3451,8 @@ static void open_door(int move_x, int move_y, bool check_confused) case DNGN_OPEN_DOOR: mpr("It's already open!"); break; default: - mpr("There isn't anything that you can open there!"); break; + mpr("There isn't anything that you can open there!"); + break; } // Don't lose a turn. return; @@ -3505,13 +3506,15 @@ static void open_door(int move_x, int move_y, bool check_confused) } you.turn_is_over = true; } + else if (grd[dx][dy] == DNGN_OPEN_DOOR) + close_door(move_x, move_y); // for convenience else { mpr("You swing at nothing."); make_hungry(3, true); you.turn_is_over = true; } -} // end open_door() +} /* * Similar to open_door. Can you spot the difference? @@ -3545,6 +3548,7 @@ static void close_door(int door_x, int door_y) const dungeon_feature_type feat = in_bounds(dx, dy) ? grd[dx][dy] : DNGN_UNSEEN; + if (feat == DNGN_OPEN_DOOR) { std::set all_door; @@ -3561,7 +3565,14 @@ static void close_door(int door_x, int door_y) { // Need to make sure that turn_is_over is set if creature is // invisible - mprf("There's a creature in the %sway!", noun); + if (!player_monster_visible(&menv[mgrd[dc.x][dc.y]])) + { + mprf("Something is blocking the %sway!", noun); + you.turn_is_over = true; + } + else + mprf("There's a creature in the %sway!", noun); + door_move.dx = 0; door_move.dy = 0; return; @@ -3631,7 +3642,7 @@ static void close_door(int door_x, int door_y) mpr("There isn't anything that you can close there!"); break; } } -} // end open_door() +} // initialise whole lot of stuff... // returns true if a new character diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h index acdaab337a..d171254ade 100644 --- a/crawl-ref/source/defines.h +++ b/crawl-ref/source/defines.h @@ -258,12 +258,13 @@ const int LABYRINTH_BORDER = 4; //#ifdef USE_COLOUR_OPTS #define COLFLAG_FRIENDLY_MONSTER 0x0100 - #define COLFLAG_ITEM_HEAP 0x0200 + #define COLFLAG_NEUTRAL_MONSTER 0x0200 #define COLFLAG_WILLSTAB 0x0400 #define COLFLAG_MAYSTAB 0x0800 - #define COLFLAG_STAIR_ITEM 0x1000 - #define COLFLAG_TRAP_ITEM 0x2000 - #define COLFLAG_REVERSE 0x4000 + #define COLFLAG_ITEM_HEAP 0x1000 + #define COLFLAG_STAIR_ITEM 0x2000 + #define COLFLAG_TRAP_ITEM 0x4000 + #define COLFLAG_REVERSE 0x8000 #define COLFLAG_MASK 0xFF00 enum CHAR_ATTRIBUTES diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 7f5afc5e55..a6c10bb785 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1605,6 +1605,7 @@ public: char cls; // preselected class bool delay_message_clear; // avoid clearing messages each turn unsigned friend_brand; // Attribute for branding friendly monsters + unsigned neutral_brand; // Attribute for branding neutral monsters bool no_dark_brand; // Attribute for branding friendly monsters bool macro_meta_entry;// Allow user to use numeric sequences when // creating macros diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 08d7c4a55c..8109534c03 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -786,6 +786,7 @@ void game_options::reset_options() sc_format = -1; friend_brand = CHATTR_NORMAL; + neutral_brand = CHATTR_NORMAL; stab_brand = CHATTR_NORMAL; may_stab_brand = CHATTR_NORMAL; heap_brand = CHATTR_REVERSE; @@ -1903,6 +1904,10 @@ void game_options::read_option_line(const std::string &str, bool runscript) // As a suggestion, try "rxvt -rv -fn 10x20" under Un*xes friend_brand = curses_attribute(field); } + else if (key == "neutral_brand") + { + neutral_brand = curses_attribute(field); + } else if (key == "stab_brand") { stab_brand = curses_attribute(field); diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc index d90347dbf9..60e24b6128 100644 --- a/crawl-ref/source/libunix.cc +++ b/crawl-ref/source/libunix.cc @@ -744,12 +744,13 @@ bool is_cursor_enabled() inline unsigned get_brand(int col) { return (col & COLFLAG_FRIENDLY_MONSTER)? Options.friend_brand : - (col & COLFLAG_ITEM_HEAP)? Options.heap_brand : - (col & COLFLAG_WILLSTAB)? Options.stab_brand : - (col & COLFLAG_MAYSTAB)? Options.may_stab_brand : - (col & COLFLAG_STAIR_ITEM)? Options.feature_item_brand : - (col & COLFLAG_TRAP_ITEM)? Options.trap_item_brand : - (col & COLFLAG_REVERSE)? CHATTR_REVERSE : + (col & COLFLAG_NEUTRAL_MONSTER)? Options.neutral_brand : + (col & COLFLAG_ITEM_HEAP)? Options.heap_brand : + (col & COLFLAG_WILLSTAB)? Options.stab_brand : + (col & COLFLAG_MAYSTAB)? Options.may_stab_brand : + (col & COLFLAG_STAIR_ITEM)? Options.feature_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 4c87480c78..8edb59cb73 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -301,6 +301,8 @@ static unsigned colflag2brand(int colflag) return (Options.heap_brand); case COLFLAG_FRIENDLY_MONSTER: return (Options.friend_brand); + case COLFLAG_NEUTRAL_MONSTER: + return (Options.neutral_brand); case COLFLAG_WILLSTAB: return (Options.stab_brand); case COLFLAG_MAYSTAB: @@ -701,6 +703,10 @@ int get_mons_colour(const monsters *mons) { col |= COLFLAG_FRIENDLY_MONSTER; } + else if (mons_neutral(mons)) + { + col |= COLFLAG_NEUTRAL_MONSTER; + } else if (Options.stab_brand != CHATTR_NORMAL && mons_looks_stabbable(mons)) { -- cgit v1.2.3-54-g00ecf