summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-07 23:25:16 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-07 23:25:16 +0000
commit99578a522dbdc7ae3b19a6ec06c61193bcd08e65 (patch)
tree5fe01979ad2537458dd1ce059275747be311ee60 /crawl-ref/source/spells3.cc
parente8a014fe9b602a577e9497ab1b3ef1dd4f50a600 (diff)
downloadcrawl-ref-99578a522dbdc7ae3b19a6ec06c61193bcd08e65.tar.gz
crawl-ref-99578a522dbdc7ae3b19a6ec06c61193bcd08e65.zip
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
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc33
1 files changed, 22 insertions, 11 deletions
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