summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-10 16:07:30 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-10 16:07:30 +0000
commit9112dd81fb46fbeeec6f46fe40ecaf1bcae42da3 (patch)
tree42a9689b56051fccb17889328a4a542e6351cc64 /crawl-ref/source
parent4fdf65ba2dcb33d11e73742fe31ce4f85a27baf2 (diff)
downloadcrawl-ref-9112dd81fb46fbeeec6f46fe40ecaf1bcae42da3.tar.gz
crawl-ref-9112dd81fb46fbeeec6f46fe40ecaf1bcae42da3.zip
Fix 1920778: mons_open_door() not respecting gates
Also fixed several cases where secret doors would be described as rock walls regardless of their actual type, and gates are now described correctly as well. This means that viewing them also prints, e.g. "An open gate." or "A closed large door." without further information since there are no database entries for these specific cases. (Not the entries for simple doors are any more exhaustive.) Fix 1910729: Yredelmnul's Drain Life not waking monsters, using ncampion's solution. Also default greedy_explore to true. (FR 1911112) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3584 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc30
-rw-r--r--crawl-ref/source/direct.cc17
-rw-r--r--crawl-ref/source/initfile.cc2
-rw-r--r--crawl-ref/source/it_use2.cc6
-rw-r--r--crawl-ref/source/monstuff.cc37
-rw-r--r--crawl-ref/source/spells2.cc1
-rw-r--r--crawl-ref/source/terrain.cc26
-rw-r--r--crawl-ref/source/terrain.h3
-rw-r--r--crawl-ref/source/view.cc2
9 files changed, 85 insertions, 39 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 8a1942265a..12806c9024 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -3355,33 +3355,6 @@ keycode_type get_next_keycode()
return (keyin);
}
-// Find all connected cells containing ft, starting at d.
-static void _find_connected_identical(coord_def d, dungeon_feature_type ft,
- std::set<coord_def>& out)
-{
- if (grd[d.x][d.y] != ft) return;
- if (out.insert(d).second)
- {
- _find_connected_identical(coord_def(d.x+1, d.y), ft, out);
- _find_connected_identical(coord_def(d.x-1, d.y), ft, out);
- _find_connected_identical(coord_def(d.x, d.y+1), ft, out);
- _find_connected_identical(coord_def(d.x, d.y-1), ft, out);
- }
-}
-
-static std::string get_door_noun(int door_count)
-{
- switch (door_count)
- {
- case 0: return "buggy opening";
- case 1: return "door";
- case 2: return "large door";
- case 3: return "gate";
- default: return "huge gate";
- }
-}
-
-
/*
Opens doors and handles some aspects of untrapping. If either move_x or
move_y are non-zero, the pair carries a specific direction for the door
@@ -3522,7 +3495,8 @@ static void open_door(int move_x, int move_y, bool check_confused)
} // end open_door()
/*
- Similar to open_door. Can you spot the difference?
+ * Similar to open_door. Can you spot the difference?
+ * FIX ME: closing a gate should update all tiles involved!
*/
static void close_door(int door_x, int door_y)
{
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index d46ad84239..d59f2a2f9b 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -1429,6 +1429,9 @@ static void describe_feature(int mx, int my, bool oos)
return;
dungeon_feature_type grid = grd[mx][my];
+ if ( grid == DNGN_SECRET_DOOR )
+ grid = grid_secret_door_appearance(mx, my);
+
std::string desc = feature_description(grid);
if (desc.length())
{
@@ -1810,6 +1813,20 @@ std::string feature_description(int mx, int my, bool bloody,
if ( grid == DNGN_SECRET_DOOR )
grid = grid_secret_door_appearance(mx, my);
+ if ( grid == DNGN_OPEN_DOOR || grid == DNGN_CLOSED_DOOR )
+ {
+ std::string desc = (grid == DNGN_OPEN_DOOR) ? "open " : "closed ";
+
+ std::set<coord_def> all_door;
+ _find_connected_identical(coord_def(mx, my), grd[mx][my], all_door);
+ desc += get_door_noun(all_door.size()).c_str();
+
+ if (bloody)
+ desc += ", spattered with blood";
+
+ return feature_do_grammar(dtype, add_stop, false, desc);
+ }
+
switch (grid)
{
case DNGN_TRAP_MECHANICAL:
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 785acb35af..da5415202f 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -738,7 +738,7 @@ void game_options::reset_options()
explore_stop_prompt = ES_NONE;
explore_item_greed = 10;
- explore_greedy = false;
+ explore_greedy = true;
explore_improved = false;
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index 36a4b8caba..07d652883f 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -48,7 +48,6 @@ bool potion_effect( potion_type pot_eff, int pow )
{
bool effect = true; // current behaviour is all potions id on quaffing
bool was_known = item_type_known(OBJ_POTIONS, (int) pot_eff);
- int new_value = 0;
if (pow > 150)
pow = 150;
@@ -289,8 +288,9 @@ bool potion_effect( potion_type pot_eff, int pow )
break; // I'll let this slip past robe of archmagi
case POT_MAGIC:
+ {
mpr( "You feel magical!" );
- new_value = 5 + random2avg(19, 2);
+ int new_value = 5 + random2avg(19, 2);
// increase intrinsic MP points
if (you.magic_points + new_value > you.max_magic_points)
@@ -301,7 +301,7 @@ bool potion_effect( potion_type pot_eff, int pow )
inc_mp( new_value, true );
break;
-
+ }
case POT_RESTORE_ABILITIES:
{
bool nothing_happens = true;
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index b3bb6100cc..4e05e773a2 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5270,22 +5270,47 @@ static bool is_trap_safe(const monsters *monster, const int trap_x,
static void mons_open_door(monsters* monster, const coord_def &pos)
{
- bool was_secret = (grd(pos) == DNGN_SECRET_DOOR);
+ dungeon_feature_type grid = grd(pos);
+ std::string noun = "door";
+ bool was_secret = false;
- if (was_secret && !see_grid(pos))
- set_terrain_changed(pos);
- grd(pos) = DNGN_OPEN_DOOR;
+ if (grid == DNGN_SECRET_DOOR)
+ {
+ grid = grid_secret_door_appearance(pos.x, pos.y);
+ grd(pos) = DNGN_OPEN_DOOR; // just a simple door, no gates etc.
+
+ was_secret = true;
+ if (!see_grid(pos))
+ set_terrain_changed(pos);
+ }
+ else // maybe several connected doors -> gate
+ {
+ std::set<coord_def> all_door;
+ _find_connected_identical(pos, grd(pos), all_door);
+ noun = get_door_noun(all_door.size()).c_str();
+
+ for (std::set<coord_def>::iterator i = all_door.begin();
+ i != all_door.end(); ++i)
+ {
+ const coord_def& dc = *i;
+ grd[dc.x][dc.y] = DNGN_OPEN_DOOR;
+ }
+ }
if (see_grid(pos))
{
viewwindow(true, false);
if (was_secret)
- mpr("The rock wall was actually a secret door!");
+ {
+ mprf("%s was actually a secret door!",
+ feature_description(grid, NUM_TRAPS, false,
+ DESC_CAP_THE, false).c_str());
+ }
if (!you.can_see(monster))
{
- mpr("Something unseen opens the door.");
+ mprf("Something unseen opens the %s.", noun.c_str());
interrupt_activity(AI_FORCE_INTERRUPT);
}
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 296fe73e13..152f8e61ab 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1031,6 +1031,7 @@ void drain_life(int pow)
hurted = 3 + random2(7) + random2(pow);
hurt_monster(monster, hurted);
+ behaviour_event(monster, ME_WHACK, MHITYOU, you.x_pos, you.y_pos);
hp_gain += hurted;
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index 934e9e9b4f..4294d75d77 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -236,6 +236,32 @@ bool grid_is_branch_stairs( dungeon_feature_type grid )
|| (grid >= DNGN_ENTER_DIS && grid <= DNGN_ENTER_TARTARUS));
}
+// Find all connected cells containing ft, starting at d.
+void _find_connected_identical(coord_def d, dungeon_feature_type ft,
+ std::set<coord_def>& out)
+{
+ if (grd[d.x][d.y] != ft) return;
+ if (out.insert(d).second)
+ {
+ _find_connected_identical(coord_def(d.x+1, d.y), ft, out);
+ _find_connected_identical(coord_def(d.x-1, d.y), ft, out);
+ _find_connected_identical(coord_def(d.x, d.y+1), ft, out);
+ _find_connected_identical(coord_def(d.x, d.y-1), ft, out);
+ }
+}
+
+std::string get_door_noun(int door_count)
+{
+ switch (door_count)
+ {
+ case 0: return "buggy opening";
+ case 1: return "door";
+ case 2: return "large door";
+ case 3: return "gate";
+ default: return "huge gate";
+ }
+}
+
dungeon_feature_type grid_secret_door_appearance( int gx, int gy )
{
dungeon_feature_type ret = DNGN_FLOOR;
diff --git a/crawl-ref/source/terrain.h b/crawl-ref/source/terrain.h
index c4af306e4f..973c25413c 100644
--- a/crawl-ref/source/terrain.h
+++ b/crawl-ref/source/terrain.h
@@ -44,6 +44,9 @@ bool grid_is_watery(dungeon_feature_type grid);
god_type grid_altar_god( dungeon_feature_type grid );
dungeon_feature_type altar_for_god( god_type god );
bool grid_is_branch_stairs( dungeon_feature_type grid );
+void _find_connected_identical(coord_def d, dungeon_feature_type ft,
+ std::set<coord_def>& out);
+std::string get_door_noun(int door_count);
dungeon_feature_type grid_secret_door_appearance( int gx, int gy );
bool grid_destroys_items( dungeon_feature_type grid );
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 00a0fa8dd3..aead1830d9 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -4509,7 +4509,7 @@ void viewwindow(bool draw_it, bool do_updates)
&& crawl_view.in_grid_los(gc))
{
const int object = env.show(ep);
- if (object)
+ if (object && Options.tutorial_left)
{
if (grid_is_rock_stair(grd(gc)))
learned_something_new(