summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-25 08:42:38 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-25 08:42:38 +0000
commitc5ab08484a85c0f7f25bd8199d0e1c688e08eba3 (patch)
tree9d6b6f646cfaf83418aad472c2787709a9ec19e1 /crawl-ref/source
parenta24ec8490ffcc7348f567b96577c4cf841d1411f (diff)
downloadcrawl-ref-c5ab08484a85c0f7f25bd8199d0e1c688e08eba3.tar.gz
crawl-ref-c5ab08484a85c0f7f25bd8199d0e1c688e08eba3.zip
[1861488] Fixed passwall bugs.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3330 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/delay.cc14
-rw-r--r--crawl-ref/source/externs.h14
-rw-r--r--crawl-ref/source/mon-util.cc12
-rw-r--r--crawl-ref/source/monstuff.cc2
-rw-r--r--crawl-ref/source/ouch.cc8
-rw-r--r--crawl-ref/source/player.cc24
-rw-r--r--crawl-ref/source/spells2.cc2
-rw-r--r--crawl-ref/source/spells4.cc17
8 files changed, 33 insertions, 60 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 7cac0e227a..50380cf0b2 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -777,23 +777,15 @@ static void finish_delay(const delay_queue_item &delay)
switch (grd[ pass_x ][ pass_y ])
{
- case DNGN_ROCK_WALL:
- case DNGN_STONE_WALL:
- case DNGN_CLEAR_ROCK_WALL:
- case DNGN_CLEAR_STONE_WALL:
- case DNGN_METAL_WALL:
- case DNGN_GREEN_CRYSTAL_WALL:
- case DNGN_WAX_WALL:
- ouch(1 + you.hp, 0, KILLED_BY_PETRIFICATION);
+ default:
+ if (!you.can_pass_through_feat(grd[pass_x][pass_y]))
+ ouch(1 + you.hp, 0, KILLED_BY_PETRIFICATION);
break;
case DNGN_SECRET_DOOR: // oughtn't happen
case DNGN_CLOSED_DOOR: // open the door
grd[ pass_x ][ pass_y ] = DNGN_OPEN_DOOR;
break;
-
- default:
- break;
}
// move any monsters out of the way:
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index d4a8776cc2..97e8c51527 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -95,9 +95,9 @@ public:
virtual int get_experience_level() const = 0;
- virtual bool can_pass_through(const dungeon_feature_type grid) const = 0;
- virtual bool can_pass_through(const int x, const int y) const = 0;
- virtual bool can_pass_through(const coord_def &c) const = 0;
+ virtual bool can_pass_through_feat(dungeon_feature_type grid) const = 0;
+ virtual bool can_pass_through(int x, int y) const;
+ virtual bool can_pass_through(const coord_def &c) const;
virtual size_type body_size(int psize = PSIZE_TORSO,
bool base = false) const = 0;
@@ -807,9 +807,7 @@ public:
bool swimming() const;
bool submerged() const;
bool floundering() const;
- bool can_pass_through(const dungeon_feature_type grid) const;
- bool can_pass_through(const int x, const int y) const;
- bool can_pass_through(const coord_def &c) const;
+ bool can_pass_through_feat(dungeon_feature_type grid) const;
size_type body_size(int psize = PSIZE_TORSO, bool base = false) const;
int body_weight() const;
int total_weight() const;
@@ -1096,9 +1094,7 @@ public:
bool submerged() const;
bool can_drown() const;
bool floundering() const;
- bool can_pass_through(const dungeon_feature_type grid) const;
- bool can_pass_through(const int x, const int y) const;
- bool can_pass_through(const coord_def &c) const;
+ bool can_pass_through_feat(dungeon_feature_type grid) const;
size_type body_size(int psize = PSIZE_TORSO, bool base = false) const;
int body_weight() const;
int total_weight() const;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 5d7a21c285..9bf5b9cb22 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2450,21 +2450,11 @@ bool mons_class_can_pass(const int mclass, const dungeon_feature_type grid)
return !grid_is_solid(grid);
}
-bool monsters::can_pass_through(const dungeon_feature_type grid) const
+bool monsters::can_pass_through_feat(dungeon_feature_type grid) const
{
return mons_class_can_pass(type, grid);
}
-bool monsters::can_pass_through(const int _x, const int _y) const
-{
- return can_pass_through(grd[_x][_y]);
-}
-
-bool monsters::can_pass_through(const coord_def &c) const
-{
- return can_pass_through(grd(c));
-}
-
bool monsters::can_drown() const
{
// Mummies can fall apart in water; ghouls and demons can drown in
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 295de92c83..6d7030559f 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5288,7 +5288,7 @@ bool mon_can_move_to_pos(const monsters *monster, const int count_x,
return false;
}
}
- else if (!monster->can_pass_through(target_grid)
+ else if (!monster->can_pass_through_feat(target_grid)
|| (no_water && target_grid >= DNGN_DEEP_WATER
&& target_grid <= DNGN_WATER_STUCK))
{
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index ebe78389ad..e57f43ccc0 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -771,14 +771,6 @@ void ouch( int dam, int death_source, kill_method_type death_type,
return;
}
- // assumed bug for high damage amounts
- if (dam > 300)
- {
- mprf(MSGCH_DANGER,
- "Potential bug: Unexpectedly high damage = %d", dam );
- return;
- }
-
if (dam > -9000) // that is, a "death" caused by hp loss {dlb}
{
if (dam >= you.hp && god_protects_from_harm(you.religion))
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 31d1755bd6..5b598a1c24 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -116,7 +116,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
const dungeon_feature_type new_grid = grd[x][y];
// really must be clear
- ASSERT( you.can_pass_through( new_grid ) );
+ ASSERT( you.can_pass_through_feat( new_grid ) );
// if (grid_is_solid( new_grid ))
// return (false);
@@ -5175,6 +5175,16 @@ bool actor::airborne() const
return (is_levitating() || (flight_mode() == FL_FLY && !paralysed()));
}
+bool actor::can_pass_through(int x, int y) const
+{
+ return can_pass_through_feat(grd[x][y]);
+}
+
+bool actor::can_pass_through(const coord_def &c) const
+{
+ return can_pass_through_feat(grd(c));
+}
+
//////////////////////////////////////////////////////////////////////////////
// player
@@ -5455,21 +5465,11 @@ bool player::floundering() const
return in_water() && !can_swim();
}
-bool player::can_pass_through(const dungeon_feature_type grid) const
+bool player::can_pass_through_feat(dungeon_feature_type grid) const
{
return !grid_is_solid(grid);
}
-bool player::can_pass_through(const int _x, const int _y) const
-{
- return can_pass_through(grd[_x][_y]);
-}
-
-bool player::can_pass_through(const coord_def &c) const
-{
- return can_pass_through(grd(c));
-}
-
size_type player::body_size(int psize, bool base) const
{
size_type ret = (base) ? SIZE_CHARACTER : transform_size( psize );
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 32bd2cc2b2..09c8ecf973 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -171,7 +171,7 @@ static bool mark_detected_creature(int gridx, int gridy, const monsters *mon,
gy = gridy + random2(fuzz_diam) - fuzz_radius;
if (map_bounds(gx, gy)
- && mon->can_pass_through(grd[gx][gy]))
+ && mon->can_pass_through_feat(grd[gx][gy]))
{
found_good = true;
break;
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index c2832fc7c5..238435739f 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1402,10 +1402,11 @@ static int passwall(int x, int y, int pow, int garbage)
{
UNUSED( garbage );
- char dx, dy, nx = x, ny = y;
+ int dx, dy, nx = x, ny = y;
int howdeep = 0;
bool done = false;
int shallow = 1 + (you.skills[SK_EARTH_MAGIC] / 8);
+ bool non_rock_barriers = false;
// allow statues as entry points?
if (grd[x][y] != DNGN_ROCK_WALL && grd[x][y] != DNGN_CLEAR_ROCK_WALL)
@@ -1423,9 +1424,7 @@ static int passwall(int x, int y, int pow, int garbage)
while (!done)
{
- // I'm trying to figure proper borders out {dlb}
- // FIXME: dungeon border?
- if (nx > (GXM - 1) || ny > (GYM - 1) || nx < 2 || ny < 2)
+ if (!in_bounds(nx, ny))
{
mpr("You sense an overwhelming volume of rock.");
return 0;
@@ -1434,8 +1433,11 @@ static int passwall(int x, int y, int pow, int garbage)
switch (grd[nx][ny])
{
default:
+ if (grid_is_solid(grd[nx][ny]))
+ non_rock_barriers = true;
done = true;
break;
+
case DNGN_ROCK_WALL:
case DNGN_CLEAR_ROCK_WALL:
case DNGN_ORCISH_IDOL:
@@ -1450,13 +1452,14 @@ static int passwall(int x, int y, int pow, int garbage)
int range = shallow + random2(pow) / 25;
- if (howdeep > shallow)
+ if (howdeep > shallow || non_rock_barriers)
{
- mpr("This rock feels deep.");
+ mprf("This rock feels %sdeep.",
+ non_rock_barriers || (howdeep > range)? "extremely " : "");
if (yesno("Try anyway?"))
{
- if (howdeep > range)
+ if (howdeep > range || non_rock_barriers)
{
ouch(1 + you.hp, 0, KILLED_BY_PETRIFICATION);
//jmf: not return; if wizard, successful transport is option