From 99578a522dbdc7ae3b19a6ec06c61193bcd08e65 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 7 Nov 2008 23:25:16 +0000 Subject: Change floor_property (blood, sanctuary) to flags, and add two new settings: vault and highlight. Vault means a grid is part of a vault (set in dungeon.cc), and currently used to exempt vault grids when shifting labyrinths. Highlight is a meta flag currently only used to highlight labyrinth changes on the 'X' map in wizard mode, but I can think of a couple of other uses, mostly for debugging purposes. Also replace a few for loops in the lab shift function with rectangle_iterators. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7414 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells3.cc | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'crawl-ref/source/spells3.cc') diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 01fa548890..3a8dd37bf3 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1415,12 +1415,15 @@ void you_teleport_now( bool allow_control, bool new_abyss_area ) // teleported to escape from all the monsters chasing him/her, // since in that case the new dangerous area is almost certainly // *less* dangerous than the old dangerous area. - // Teleporting in a labyrinth is also funny, but only for non-minotaurs. + // Teleporting in a labyrinth is also funny, more so for non-minotaurs. if (randtele - && (you.level_type == LEVEL_LABYRINTH && you.species != SP_MINOTAUR + && (you.level_type == LEVEL_LABYRINTH || you.level_type != LEVEL_ABYSS && player_in_a_dangerous_place())) { - xom_is_stimulated(255); + if (you.level_type == LEVEL_LABYRINTH && you.species == SP_MINOTAUR) + xom_is_stimulated(128); + else + xom_is_stimulated(255); } } @@ -1532,6 +1535,11 @@ static int _inside_circle(const coord_def& where, int radius) return (dist); } +static void _remove_sanctuary_property(coord_def where) +{ + env.map(where).property &= ~(FPROP_SANCTUARY_1 | FPROP_SANCTUARY_2); +} + bool remove_sanctuary(bool did_attack) { if (env.sanctuary_time) @@ -1546,14 +1554,14 @@ bool remove_sanctuary(bool did_attack) { if (is_sanctuary(*ri)) { - env.map(*ri).property = FPROP_NONE; + _remove_sanctuary_property(*ri); if (see_grid(*ri)) seen_change = true; } } -// do not reset so as to allow monsters to see if their fleeing source -// used to be the centre of a sanctuary +// Do not reset so as to allow monsters to see if their fleeing source +// used to be the centre of a sanctuary. (jpeg) // env.sanctuary_pos.x = env.sanctuary_pos.y = -1; if (did_attack) @@ -1603,13 +1611,14 @@ void decrease_sanctuary_radius() // If necessary overwrite sanctuary property. if (dist > size*size) - env.map[posx][posy].property = FPROP_NONE; + _remove_sanctuary_property(coord_def(posx, posy)); } // Special case for time-out of sanctuary. if (!size) { - env.map[env.sanctuary_pos.x][env.sanctuary_pos.y].property = FPROP_NONE; + _remove_sanctuary_property(coord_def(env.sanctuary_pos.x, + env.sanctuary_pos.y)); if (see_grid(coord_def(env.sanctuary_pos.x,env.sanctuary_pos.y))) mpr("The sanctuary disappears.", MSGCH_DURATION); } @@ -1659,7 +1668,7 @@ bool cast_sanctuary(const int power) continue; const coord_def pos = *ri; - if (env.map(pos).property == FPROP_BLOODY && see_grid(pos)) + if (testbits(env.map(pos).property, FPROP_BLOODY) && see_grid(pos)) blood_count++; if (trap_def* ptrap = find_trap(pos)) @@ -1684,10 +1693,12 @@ bool cast_sanctuary(const int power) || pattern == 3 // cross-like && (abs(x)+abs(y) < 5 && x != y && x != -y)) { - env.map(pos).property = FPROP_SANCTUARY_1; // yellow + env.map(pos).property |= FPROP_SANCTUARY_1; // yellow } else - env.map(pos).property = FPROP_SANCTUARY_2; // white + env.map(pos).property |= FPROP_SANCTUARY_2; // white + + env.map(pos).property &= ~(FPROP_BLOODY); // scare all attacking monsters inside sanctuary, and make // all friendly monsters inside sanctuary stop attacking and -- cgit v1.2.3-54-g00ecf