summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/beam.cc4
-rw-r--r--crawl-ref/source/dungeon.cc18
-rw-r--r--crawl-ref/source/effects.cc191
-rw-r--r--crawl-ref/source/enum.h20
-rw-r--r--crawl-ref/source/externs.h4
-rw-r--r--crawl-ref/source/files.cc4
-rw-r--r--crawl-ref/source/maps.cc12
-rw-r--r--crawl-ref/source/misc.cc10
-rw-r--r--crawl-ref/source/religion.cc4
-rw-r--r--crawl-ref/source/spells3.cc33
-rw-r--r--crawl-ref/source/stuff.cc3
-rw-r--r--crawl-ref/source/tags.cc4
-rw-r--r--crawl-ref/source/terrain.cc7
-rw-r--r--crawl-ref/source/view.cc23
-rw-r--r--crawl-ref/source/view.h1
15 files changed, 197 insertions, 141 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index e593c5a32c..33e99076e4 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2930,7 +2930,7 @@ static int _affect_wall(bolt &beam, const coord_def& p)
// Blood does not transfer onto floor.
if (is_bloodcovered(p))
- env.map(p).property = FPROP_NONE;
+ env.map(p).property &= ~(FPROP_BLOODY);
if (!beam.msg_generated)
{
@@ -3009,7 +3009,7 @@ static int _affect_wall(bolt &beam, const coord_def& p)
// Blood does not transfer onto floor.
if (is_bloodcovered(p))
- env.map(p).property = FPROP_NONE;
+ env.map(p).property &= ~(FPROP_BLOODY);
if (!silenced(you.pos()))
{
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 298e999613..ab7b1fcf25 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -3923,6 +3923,8 @@ static bool _build_minivaults(int level_number, int force_vault,
bool building_level, bool clobber,
bool make_no_exits, const coord_def &where)
{
+ mpr("in _build_minivaults");
+
int altar_count = 0;
FixedVector < object_class_type, 7 > acq_item_class;
@@ -3968,6 +3970,7 @@ static bool _build_minivaults(int level_number, int force_vault,
int num_runes = 0;
std::vector<coord_def> &target_connections = place.exits;
+ bool vault_prop = false;
// Paint the minivault onto the grid.
for (rectangle_iterator ri(v1, v1 + place.size - 1); ri; ++ri)
{
@@ -3994,8 +3997,13 @@ static bool _build_minivaults(int level_number, int force_vault,
dungeon_terrain_changed(*ri, newgrid, true, true);
env.markers.remove_markers_at(*ri, MAT_ANY);
}
+ env.map(*ri).property |= FPROP_VAULT;
+ vault_prop = true;
}
+ if (vault_prop)
+ mpr("feature property set to vault");
+
place.map.map.apply_overlays(v1);
if (!make_no_exits)
@@ -4483,6 +4491,8 @@ static bool _build_secondary_vault(int level_number, int vault,
bool clobber, bool no_exits,
const coord_def &where)
{
+ mpr("in _build_secondary_vault()");
+
dgn_zones = _dgn_count_disconnected_zones(false);
if (_build_vaults(level_number, vault, rune_subst, true, true,
generating_level, clobber, no_exits, where))
@@ -4500,6 +4510,7 @@ static bool _build_vaults(int level_number, int force_vault, int rune_subst,
bool generating_level, bool clobber,
bool make_no_exits, const coord_def &where)
{
+ mpr("in _build_vaults");
int altar_count = 0;
FixedVector < char, 10 > stair_exist;
char stx, sty;
@@ -4533,6 +4544,7 @@ static bool _build_vaults(int level_number, int force_vault, int rune_subst,
int num_runes = 0;
+ bool vault_prop = false;
dgn_region this_vault(place.pos, place.size);
// NOTE: assumes *no* previous item (I think) or monster (definitely)
// placement.
@@ -4559,8 +4571,13 @@ static bool _build_vaults(int level_number, int force_vault, int rune_subst,
dungeon_terrain_changed(*ri, newgrid, true, true);
env.markers.remove_markers_at(*ri, MAT_ANY);
}
+ env.map(*ri).property |= FPROP_VAULT;
+ vault_prop = true;
}
+ if (vault_prop)
+ mpr("feature property set to vault");
+
place.map.map.apply_overlays(place.pos);
_register_place(place);
@@ -6707,6 +6724,7 @@ static void _change_walls_from_centre(const dgn_region &region,
static void _place_extra_lab_minivaults(int level_number)
{
+ mpr("in _place_extra_lab_minivaults()");
std::set<int> vaults_used;
while (true)
{
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index d0002e8f22..c4666583f4 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2409,47 +2409,46 @@ void change_labyrinth(bool msg)
int size = random_range(12, 24); // size of the shifted area (square)
coord_def c1, c2; // upper left, lower right corners of the shifted area
+ std::vector<coord_def> targets;
+
// Try 10 times for an area that is little mapped.
for (int tries = 10; tries > 0; tries--)
{
+ targets.clear();
+
int x = random_range(LABYRINTH_BORDER, GXM - LABYRINTH_BORDER - size);
int y = random_range(LABYRINTH_BORDER, GYM - LABYRINTH_BORDER - size);
c1 = coord_def(x,y);
c2 = coord_def(x + size, y + size);
int count_known = 0;
- for (int xi = c1.x; xi <= c2.x; xi++)
- for (int yi = c1.y; yi <= c2.y; yi++)
- {
- if (is_terrain_seen(xi, yi))
- count_known++;
- }
-
- if (count_known < size*size/6)
- break;
- }
+ for (rectangle_iterator ri(c1, c2); ri; ++ri)
+ if (is_terrain_seen(*ri))
+ count_known++;
- if (msg)
- {
- mprf(MSGCH_DIAGNOSTICS, "Changing labyrinth from (%d, %d) to (%d, %d)",
- c1.x, c1.y, c2.x, c2.y);
- }
+ if (tries > 1 && count_known > size*size/6)
+ continue;
- // Fill a vector with wall grids that are potential targets for swapping
- // against floor, i.e. are flanked by walls to two cardinal directions,
- // and by floor on the two remaining sides.
- std::vector<coord_def> targets;
- for (int xi = c1.x; xi <= c2.x; xi++)
- for (int yi = c1.y; yi <= c2.y; yi++)
+ // Fill a vector with wall grids that are potential targets for
+ // swapping against floor, i.e. are flanked by walls to two cardinal
+ // directions, and by floor on the two remaining sides.
+ for (rectangle_iterator ri(c1, c2); ri; ++ri)
{
- const coord_def c(xi, yi);
- if (is_terrain_seen(xi, yi) || !grid_is_wall(grd(c)))
+ if (is_terrain_seen(*ri) || !grid_is_wall(grd(*ri)))
continue;
- if (_grid_is_flanked_by_walls(c) && _deadend_check_floor(c))
- targets.push_back(c);
+ // Skip on grids inside vaults so as not to disrupt them.
+ if (testbits(env.map(*ri).property, FPROP_VAULT))
+ continue;
+
+ if (_grid_is_flanked_by_walls(*ri) && _deadend_check_floor(*ri))
+ targets.push_back(*ri);
}
+ if (targets.size() >= 8)
+ break;
+ }
+
if (targets.empty())
{
if (msg)
@@ -2459,6 +2458,12 @@ void change_labyrinth(bool msg)
if (msg)
{
+ mprf(MSGCH_DIAGNOSTICS, "Changing labyrinth from (%d, %d) to (%d, %d)",
+ c1.x, c1.y, c2.x, c2.y);
+ }
+
+ if (msg)
+ {
std::string path_str = "";
mpr("Here's the list of targets: ", MSGCH_DIAGNOSTICS);
for (unsigned int i = 0; i < targets.size(); i++)
@@ -2470,6 +2475,10 @@ void change_labyrinth(bool msg)
mprf(MSGCH_DIAGNOSTICS, "-> #targets = %d", targets.size());
}
+ for (rectangle_iterator ri(1); ri; ++ri)
+ env.map(*ri).property &= ~(FPROP_HIGHLIGHT);
+
+
// How many switches we'll be doing.
const int max_targets = random_range(std::min((int) targets.size(), 12),
std::min((int) targets.size(), 45));
@@ -2562,6 +2571,8 @@ void change_labyrinth(bool msg)
mprf(MSGCH_DIAGNOSTICS, "Switch %d (%d, %d) with %d (%d, %d).",
(int) old_grid, c.x, c.y, (int) grd(p), p.x, p.y);
}
+ env.map(c).property |= FPROP_HIGHLIGHT;
+ env.map(p).property |= FPROP_HIGHLIGHT;
// Rather than use old_grid directly, replace with the adjacent
// wall type.
@@ -2578,6 +2589,16 @@ void change_labyrinth(bool msg)
}
old_grid = DNGN_STONE_WALL;
}
+ else if (old_grid != DNGN_ROCK_WALL && old_grid != DNGN_STONE_WALL
+ && old_grid != DNGN_METAL_WALL)
+ {
+ old_grid = grd[p.x][p.y+1];
+ }
+ }
+ else if (old_grid != DNGN_ROCK_WALL && old_grid != DNGN_STONE_WALL
+ && old_grid != DNGN_METAL_WALL)
+ {
+ old_grid = grd[p.x+1][p.y];
}
grd(p) = old_grid;
}
@@ -2597,59 +2618,57 @@ void change_labyrinth(bool msg)
// Search the entire shifted area for stacks of items now stuck in walls
// and move them to a random adjacent non-wall grid.
- for (int xi = c1.x; xi <= c2.x; xi++)
- for (int yi = c1.y; yi <= c2.y; yi++)
+ for (rectangle_iterator ri(c1, c2); ri; ++ri)
+ {
+ if (!grid_is_wall(grd(*ri)) || igrd(*ri) == NON_ITEM)
+ continue;
+
+ if (msg)
+ {
+ mprf(MSGCH_DIAGNOSTICS,
+ "Need to move around some items at pos (%d, %d)...",
+ ri->x, ri->y);
+ }
+ // Search the eight possible directions in random order.
+ std::random_shuffle(dirs.begin(), dirs.end(), random2);
+ for (unsigned int i = 0; i < dirs.size(); i++)
{
- const coord_def c(xi, yi);
- if (!grid_is_wall(grd(c)) || igrd(c) == NON_ITEM)
+ const coord_def p = *ri + dirs[i];
+ if (!in_bounds(p))
continue;
- if (msg)
+ if (_is_floor(grd(p)))
{
- mprf(MSGCH_DIAGNOSTICS,
- "Need to move around some items at pos (%d, %d)...",
- xi, yi);
- }
- // Search the eight possible directions in random order.
- std::random_shuffle(dirs.begin(), dirs.end(), random2);
- for (unsigned int i = 0; i < dirs.size(); i++)
- {
- const coord_def p = c + dirs[i];
- if (!in_bounds(p))
- continue;
-
- if (_is_floor(grd(p)))
+ // Once a valid grid is found, move all items from the
+ // stack onto it.
+ int it = igrd(*ri);
+ while (it != NON_ITEM)
{
- // Once a valid grid is found, move all items from the
- // stack onto it.
- int it = igrd(c);
- while (it != NON_ITEM)
+ mitm[it].pos.x = p.x;
+ mitm[it].pos.y = p.y;
+ if (mitm[it].link == NON_ITEM)
{
- mitm[it].pos.x = p.x;
- mitm[it].pos.y = p.y;
- if (mitm[it].link == NON_ITEM)
- {
- // Link to the stack on the target grid p,
- // or NON_ITEM, if empty.
- mitm[it].link = igrd(p);
- break;
- }
- it = mitm[it].link;
+ // Link to the stack on the target grid p,
+ // or NON_ITEM, if empty.
+ mitm[it].link = igrd(p);
+ break;
}
+ it = mitm[it].link;
+ }
- // Move entire stack over to p.
- igrd(p) = igrd(c);
- igrd(c) = NON_ITEM;
+ // Move entire stack over to p.
+ igrd(p) = igrd(*ri);
+ igrd(*ri) = NON_ITEM;
- if (msg)
- {
- mprf(MSGCH_DIAGNOSTICS, "Moved items over to (%d, %d)",
- p.x, p.y);
- }
- break;
+ if (msg)
+ {
+ mprf(MSGCH_DIAGNOSTICS, "Moved items over to (%d, %d)",
+ p.x, p.y);
}
+ break;
}
}
+ }
// Recheck item coordinates, to make totally sure.
fix_item_coordinates();
@@ -3318,35 +3337,35 @@ void update_level(double elapsedTime)
static void _maybe_restart_fountain_flow(const coord_def& where,
const int tries)
{
- dungeon_feature_type grid = grd(where);
+ dungeon_feature_type grid = grd(where);
- if (grid < DNGN_DRY_FOUNTAIN_BLUE || grid > DNGN_DRY_FOUNTAIN_BLOOD)
- return;
+ if (grid < DNGN_DRY_FOUNTAIN_BLUE || grid > DNGN_DRY_FOUNTAIN_BLOOD)
+ return;
- for ( int i = 0; i < tries; ++i )
- {
- if (!one_chance_in(100))
- continue;
+ for (int i = 0; i < tries; ++i)
+ {
+ if (!one_chance_in(100))
+ continue;
- // Make it start flowing again.
- grd(where) = static_cast<dungeon_feature_type> (grid
+ // Make it start flowing again.
+ grd(where) = static_cast<dungeon_feature_type> (grid
- (DNGN_DRY_FOUNTAIN_BLUE - DNGN_FOUNTAIN_BLUE));
- if (is_terrain_seen(where))
- set_envmap_obj(where, grd(where));
+ if (is_terrain_seen(where))
+ set_envmap_obj(where, grd(where));
- // Clean bloody floor.
- if (is_bloodcovered(where))
- env.map(where).property = FPROP_NONE;
+ // Clean bloody floor.
+ if (is_bloodcovered(where))
+ env.map(where).property &= ~(FPROP_BLOODY);
- // Chance of cleaning adjacent squares.
- for ( adjacent_iterator ai(where); ai; ++ai )
- if (is_bloodcovered(*ai) && one_chance_in(5))
- env.map(*ai).property = FPROP_NONE;
+ // Chance of cleaning adjacent squares.
+ for (adjacent_iterator ai(where); ai; ++ai)
+ if (is_bloodcovered(*ai) && one_chance_in(5))
+ env.map(*ai).property &= ~(FPROP_BLOODY);
- break;
- }
+ break;
+ }
}
//---------------------------------------------------------------
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index a95fe77591..eae45831d2 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -786,6 +786,17 @@ enum level_flag_type
LFLAG_NO_MAGIC_MAP = (1 << 2) // Level can't be magic mapped.
};
+enum feature_property_type
+{
+ FPROP_NONE = 0,
+ FPROP_SANCTUARY_1 = (1 << 0),
+ FPROP_SANCTUARY_2 = (1 << 2),
+ FPROP_BLOODY = (1 << 3),
+ FPROP_VAULT = (1 << 4),
+ FPROP_HIGHLIGHT = (1 << 5)
+ // NOTE: Bloody floor and sanctuary are exclusive.
+};
+
// NOTE: The order of these is very important to their usage!
// [dshaligram] If adding/removing from this list, also update view.cc!
enum dungeon_char_type
@@ -1062,15 +1073,6 @@ enum dungeon_feature_type
DNGN_START_OF_MONSTERS = 297 // don't go past here! see view.cc
};
-enum floor_property_type
-{
- FPROP_NONE, // 0
- FPROP_SANCTUARY_1,
- FPROP_SANCTUARY_2,
- FPROP_BLOODY
- // Bloody floor and sanctuary are exclusive, so that's okay.
-};
-
enum duration_type
{
DUR_INVIS,
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 62dbc942ca..a295870f46 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1407,10 +1407,10 @@ struct map_cell
short object; // The object: monster, item, feature, or cloud.
unsigned short flags; // Flags describing the mappedness of this square.
unsigned short colour;
- unsigned short property;
+ unsigned long property; // Flags for blood, sanctuary, ...
map_cell() : object(0), flags(0), colour(0), property(0) { }
- void clear() { flags = object = colour = property = 0; }
+ void clear() { flags = object = colour = 0; }
unsigned glyph() const;
bool known() const;
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index e7285e8178..792f541063 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1133,6 +1133,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode,
tmp_file_pairs[you.your_level][you.where_are_you] = true;
}
+ _clear_env_map();
builder(you.your_level, you.level_type);
just_created_level = true;
@@ -1191,9 +1192,6 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode,
_close_level_gates();
}
- if (just_created_level)
- _clear_env_map();
-
// Here's the second cloud clearing, on load (see above).
if (make_changes)
{
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index 91e7cc29d6..30be71d78e 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -228,23 +228,29 @@ static bool apply_vault_grid(map_def &def, map_type map,
if (orient == MAP_SOUTH || orient == MAP_SOUTHEAST
|| orient == MAP_SOUTHWEST)
+ {
start.y = GYM - height;
-
+ }
if (orient == MAP_EAST || orient == MAP_NORTHEAST
|| orient == MAP_SOUTHEAST)
+ {
start.x = GXM - width;
+ }
// Handle maps aligned along cardinals that are smaller than
// the corresponding map dimension.
if ((orient == MAP_NORTH || orient == MAP_SOUTH
|| orient == MAP_ENCOMPASS)
&& width < GXM)
+ {
start.x = (GXM - width) / 2;
-
+ }
if ((orient == MAP_EAST || orient == MAP_WEST
|| orient == MAP_ENCOMPASS)
&& height < GYM)
+ {
start.y = (GYM - height) / 2;
+ }
// Floating maps can go anywhere, ask the map_def to suggest a place.
if (orient == MAP_FLOAT)
@@ -278,6 +284,8 @@ static bool apply_vault_grid(map_def &def, map_type map,
{
const std::string &s = lines[y - start.y];
strncpy(&map[y][start.x], s.c_str(), s.length());
+// for (unsigned int x = start.x; x < start.x + s.length(); x++)
+// env.map[x][y].property |= FPROP_VAULT;
}
place.pos = start;
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 4eecb216f0..1b950bc588 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1105,7 +1105,7 @@ static bool allow_bleeding_on_square(const coord_def& where)
{
// No bleeding onto sanctuary ground, please.
// Also not necessary if already covered in blood.
- if (env.map(where).property != FPROP_NONE)
+ if (is_bloodcovered(where) || is_sanctuary(where))
return (false);
// No spattering into lava or water.
@@ -1143,10 +1143,10 @@ static void maybe_bloodify_square(const coord_def& where, int amount,
where.x, where.y, amount);
#endif
if (allow_bleeding_on_square(where))
- env.map(where).property = FPROP_BLOODY;
+ env.map(where).property |= FPROP_BLOODY;
// If old or new blood on square, the smell reaches further.
- if (env.map(where).property == FPROP_BLOODY)
+ if (testbits(env.map(where).property, FPROP_BLOODY))
blood_smell(12, where);
else // Still allow a lingering smell.
blood_smell(7, where);
@@ -1191,7 +1191,7 @@ static void _spatter_neighbours(const coord_def& where, int chance)
if (one_chance_in(chance))
{
- env.map(*ai).property = FPROP_BLOODY;
+ env.map(*ai).property |= FPROP_BLOODY;
_spatter_neighbours(*ai, chance+1);
}
}
@@ -1232,7 +1232,7 @@ void generate_random_blood_spatter_on_level()
startprob = min_prob + random2(max_prob);
if (allow_bleeding_on_square(c))
- env.map(c).property = FPROP_BLOODY;
+ env.map(c).property |= FPROP_BLOODY;
_spatter_neighbours(c, startprob);
}
}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index c91946cd2f..5c2b30dfca 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -5452,9 +5452,9 @@ static bool _bless_weapon( god_type god, brand_type brand, int colour )
holy_word(100, HOLY_WORD_SHINING_ONE, you.pos(), true);
// Un-bloodify surrounding squares.
- for ( radius_iterator ri(you.pos(), 3, true, true); ri; ++ri )
+ for (radius_iterator ri(you.pos(), 3, true, true); ri; ++ri)
if (is_bloodcovered(*ri))
- env.map(*ri).property = FPROP_NONE;
+ env.map(*ri).property &= ~(FPROP_BLOODY);
}
delay(1000);
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
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index a910cb19d3..6dc6abc4d3 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -137,8 +137,9 @@ rectangle_iterator::rectangle_iterator( const coord_def& corner1,
rectangle_iterator::rectangle_iterator( int x_border_dist, int y_border_dist )
{
- if ( y_border_dist < 0 )
+ if (y_border_dist < 0)
y_border_dist = x_border_dist;
+
topleft.set( x_border_dist, y_border_dist );
bottomright.set( GXM - x_border_dist, GYM - y_border_dist );
current = topleft;
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index c66ad2f01e..1414019b59 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1636,7 +1636,7 @@ static void tag_construct_level(writer &th)
marshallShort(th, env.map[count_x][count_y].object);
marshallShort(th, env.map[count_x][count_y].colour);
marshallShort(th, env.map[count_x][count_y].flags);
- marshallShort(th, env.map[count_x][count_y].property);
+ marshallLong(th, env.map[count_x][count_y].property);
marshallShort(th, env.cgrid[count_x][count_y]);
}
@@ -1972,7 +1972,7 @@ static void tag_read_level( reader &th, char minorVersion )
env.map[i][j].object = unmarshallShort(th);
env.map[i][j].colour = unmarshallShort(th);
env.map[i][j].flags = unmarshallShort(th);
- env.map[i][j].property = unmarshallShort(th);
+ env.map[i][j].property = unmarshallLong(th);
mgrd[i][j] = NON_MONSTER;
env.cgrid[i][j] = (unsigned short) unmarshallShort(th);
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index 621403ff36..f1eef97a51 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -504,11 +504,12 @@ static void _dgn_check_terrain_monsters(const coord_def &pos)
}
+// Um, what does this do? (jpeg)
static void _dgn_check_terrain_blood(const coord_def &pos,
dungeon_feature_type old_feat,
dungeon_feature_type new_feat)
{
- if (env.map(pos).property != FPROP_BLOODY)
+ if (!testbits(env.map(pos).property, FPROP_BLOODY))
return;
if (new_feat == DNGN_UNSEEN)
@@ -516,7 +517,7 @@ static void _dgn_check_terrain_blood(const coord_def &pos,
// Caller has already changed the grid, and old_feat is actually
// the new feat.
if (old_feat != DNGN_FLOOR && !grid_is_solid(old_feat))
- env.map(pos).property = FPROP_NONE;
+ env.map(pos).property &= ~(FPROP_BLOODY);
}
else
{
@@ -524,7 +525,7 @@ static void _dgn_check_terrain_blood(const coord_def &pos,
|| grid_is_water(new_feat) || grid_destroys_items(new_feat)
|| is_critical_feature(new_feat))
{
- env.map(pos).property = FPROP_NONE;
+ env.map(pos).property &= ~(FPROP_BLOODY);
}
}
}
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 6bba265a5a..1197b70d53 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -198,20 +198,15 @@ void set_envmap_col( int x, int y, int colour )
env.map[x][y].colour = colour;
}
-void set_envmap_prop( int x, int y, int prop )
-{
- env.map[x][y].property = prop;
-}
-
bool is_sanctuary(const coord_def& p)
{
- return (env.map(p).property == FPROP_SANCTUARY_1
- || env.map(p).property == FPROP_SANCTUARY_2);
+ return (testbits(env.map(p).property, FPROP_SANCTUARY_1)
+ || testbits(env.map(p).property, FPROP_SANCTUARY_2));
}
bool is_bloodcovered(const coord_def& p)
{
- return (env.map(p).property == FPROP_BLOODY);
+ return (testbits(env.map(p).property, FPROP_BLOODY));
}
bool is_envmap_item(int x, int y)
@@ -447,9 +442,9 @@ static void _get_symbol( const coord_def& where,
else if (object < NUM_REAL_FEATURES && object >= DNGN_MINMOVE
&& is_sanctuary(where) )
{
- if (env.map(where).property == FPROP_SANCTUARY_1)
+ if (testbits(env.map(where).property, FPROP_SANCTUARY_1))
*colour = YELLOW | colmask;
- else if (env.map(where).property == FPROP_SANCTUARY_2)
+ else if (testbits(env.map(where).property, FPROP_SANCTUARY_2))
{
if (!one_chance_in(4))
*colour = WHITE | colmask; // 3/4
@@ -642,6 +637,11 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour,
if (!(map_flags & MAP_GRID_KNOWN))
return (BLACK);
+#ifdef WIZARD
+ if (travel_colour && testbits(env.map(p).property, FPROP_HIGHLIGHT))
+ return (LIGHTGREEN);
+#endif
+
const dungeon_feature_type grid_value = grd(p);
unsigned tc = travel_colour ? _get_travel_colour(p) : DARKGREY;
@@ -4993,9 +4993,8 @@ void viewwindow(bool draw_it, bool do_updates)
unsigned int bg = env.tile_bk_bg[gc.x][gc.y];
unsigned int fg = env.tile_bk_fg[gc.x][gc.y];
if (bg == 0 && fg == 0)
- {
tileidx_unseen(fg, bg, get_envmap_char(gc.x, gc.y), gc);
- }
+
tileb[bufcount] = fg;
tileb[bufcount + 1] = bg | tile_unseen_flag(gc);
#endif
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index 51e0a6c02d..502e987887 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -167,7 +167,6 @@ inline void set_envmap_detected_mons(const coord_def& c, bool detected = true) {
}
void set_envmap_col( int x, int y, int colour, int flags );
void set_envmap_col( int x, int y, int colour );
-void set_envmap_prop( int x, int y, int prop );
bool is_sanctuary( const coord_def& p );
bool is_bloodcovered( const coord_def& p );