From 1826273cc56b745d81621bb8b44ba0efd0d95c15 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 2 Jan 2007 17:31:31 +0000 Subject: Fixed Abyss banishment crash. Don't show -more- after the "cast into the Abyss" so that players on public servers are not tempted to kill the tty to escape the banishment. It's still possible that there are enough messages in view that the game puts in a -more- unasked for, but I'll live with that. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@769 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 19 +++++++++++++++++-- crawl-ref/source/beam.cc | 4 +--- crawl-ref/source/decks.cc | 3 +++ crawl-ref/source/effects.cc | 13 +++++-------- crawl-ref/source/effects.h | 2 +- crawl-ref/source/externs.h | 3 +++ crawl-ref/source/fight.cc | 4 +--- crawl-ref/source/misc.cc | 19 ++++++++++--------- crawl-ref/source/misc.h | 2 +- crawl-ref/source/monstuff.cc | 4 ++++ crawl-ref/source/player.cc | 1 + crawl-ref/source/spells3.cc | 3 +-- crawl-ref/source/spl-cast.cc | 1 - 13 files changed, 48 insertions(+), 30 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 412bf124ef..ec6f786083 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -495,8 +495,7 @@ static void handle_wizard_command( void ) banished( DNGN_ENTER_ABYSS ); else { - grd[you.x_pos][you.y_pos] = DNGN_EXIT_ABYSS; - down_stairs(true, you.your_level, true); + down_stairs(true, you.your_level, DNGN_EXIT_ABYSS); untag_followers(); } break; @@ -2066,6 +2065,20 @@ static void decrement_durations() } } +static void check_banished() +{ + if (you.banished) + { + you.banished = false; + + if (you.level_type != LEVEL_ABYSS) + { + mpr("You are cast into the Abyss!"); + banished(DNGN_ENTER_ABYSS); + } + } +} + /* Perhaps we should write functions like: update_repel_undead(), update_liquid_flames(), and so on. Even better, we could have a vector of callback functions (or objects) which get installed @@ -2082,6 +2095,7 @@ static void world_reacts() you.num_turns++; update_turn_count(); } + check_banished(); run_environment_effects(); @@ -2162,6 +2176,7 @@ static void world_reacts() viewwindow(1, true); handle_monsters(); + check_banished(); ASSERT(you.time_taken >= 0); // make sure we don't overflow diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 734e424bf8..5c2146f964 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3185,9 +3185,7 @@ static int affect_player( struct bolt &beam ) mpr("You feel trapped."); break; } - mpr("You are cast into the Abyss!"); - more(); - banished(DNGN_ENTER_ABYSS); + you.banished = true; beam.obvious_effect = true; break; // banishment to the abyss diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 06f05e9027..a76835a0f4 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -519,7 +519,10 @@ static void cards(unsigned char which_card) else if (you.level_type == LEVEL_LABYRINTH) canned_msg(MSG_NOTHING_HAPPENS); else + { + mpr("You are cast into the Abyss!"); banished(DNGN_ENTER_ABYSS); + } break; case CARD_STATUE: diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 3123e073a8..ea4230b60a 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -128,17 +128,14 @@ void torment(int caster, int tx, int ty) apply_area_within_radius(torment_monsters, tx, ty, 0, 8, caster); } // end torment() -void banished(unsigned char gate_type) +void banished(int gate_type) { - you_teleport2( false ); - - // this is to ensure that you're standing on a suitable space (67) - grd[you.x_pos][you.y_pos] = gate_type; - - if ( gate_type == DNGN_ENTER_ABYSS ) + if (gate_type == DNGN_ENTER_ABYSS) + { take_note(Note(NOTE_USER_NOTE, 0, 0, "Cast into the Abyss"), true); + } - down_stairs(true, you.your_level, true); // heh heh + down_stairs(true, you.your_level, gate_type); // heh heh untag_followers(); // safety } // end banished() diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h index 5544eab617..59f663154b 100644 --- a/crawl-ref/source/effects.h +++ b/crawl-ref/source/effects.h @@ -22,7 +22,7 @@ /* *********************************************************************** * called from: ability - acr - beam - decks - fight - religion - spells * *********************************************************************** */ -void banished(unsigned char gate_type); +void banished(int gate_type); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 5d91734a35..3f74fdee97 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -373,6 +373,9 @@ struct player { bool turn_is_over; // flag signaling that player has performed a timed action + bool banished; // flag signaling that the player is due a visit to the + // Abyss. + unsigned char prev_targ; char your_name[kNameLen]; diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 0b5238313d..7e27f8c1f8 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -3002,8 +3002,6 @@ commented out for now case SPWPN_DISTORTION: - //if ( !one_chance_in(3) ) break; - if (one_chance_in(3)) { mpr("Your body is twisted painfully."); @@ -3038,7 +3036,7 @@ commented out for now if (coinflip() && you.level_type != LEVEL_ABYSS) { - banished(DNGN_ENTER_ABYSS); + you.banished = true; break; } break; diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 8c74a2efd8..58d48b64a5 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -729,14 +729,14 @@ void up_stairs(void) } } // end up_stairs() -void down_stairs( bool remove_stairs, int old_level, bool force ) +void down_stairs( bool remove_stairs, int old_level, int force_stair ) { int i; char old_level_type = you.level_type; bool was_a_labyrinth = false; - const unsigned char stair_find = grd[you.x_pos][you.y_pos]; + const int stair_find = + force_stair? force_stair : grd[you.x_pos][you.y_pos]; - //int old_level = you.your_level; bool leave_abyss_pan = false; char old_where = you.where_are_you; @@ -777,7 +777,7 @@ void down_stairs( bool remove_stairs, int old_level, bool force ) return; } - if (!force && player_is_levitating() + if (!force_stair && player_is_levitating() && !wearing_amulet(AMU_CONTROLLED_FLIGHT)) { mpr("You're floating high up above the floor!"); @@ -841,7 +841,8 @@ void down_stairs( bool remove_stairs, int old_level, bool force ) you.level_type = LEVEL_DUNGEON; } - mpr("Entering..."); + if (!force_stair) + mpr("Entering..."); you.prev_targ = MHITNOT; you.pet_target = MHITNOT; @@ -854,7 +855,7 @@ void down_stairs( bool remove_stairs, int old_level, bool force ) mpr("Please enjoy your stay."); // Kill -more- prompt if we're traveling. - if (!you.running) + if (!you.running && !force_stair) more(); you.your_level = 26; @@ -902,8 +903,7 @@ void down_stairs( bool remove_stairs, int old_level, bool force ) true, false ); #if DEBUG_DIAGNOSTICS snprintf( info, INFO_SIZE, "Deleting: %s", lname.c_str() ); - mpr( info, MSGCH_DIAGNOSTICS ); - more(); + mpr( info, MSGCH_DIAGNOSTICS ); #endif unlink(lname.c_str()); } @@ -950,7 +950,8 @@ void down_stairs( bool remove_stairs, int old_level, bool force ) break; case LEVEL_ABYSS: - mpr("You enter the Abyss!"); + if (!force_stair) + mpr("You enter the Abyss!"); mpr("To return, you must find a gate leading back."); break; diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h index 997219a216..475c577dcf 100644 --- a/crawl-ref/source/misc.h +++ b/crawl-ref/source/misc.h @@ -43,7 +43,7 @@ void disarm_trap(struct dist &disa); /* *********************************************************************** * called from: acr - effects - spells3 * *********************************************************************** */ -void down_stairs(bool remove_stairs, int old_level, bool force = false); +void down_stairs(bool remove_stairs, int old_level, int force_stair = 0); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 66ebef55e0..6f50356071 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -3915,6 +3915,10 @@ void handle_monsters(void) if (!invalid_monster(monster) && (monster->x != mx || monster->y != my)) immobile_monster[i] = true; + + // If the player got banished, discard pending monster actions. + if (you.banished) + break; } // end of for loop // Clear any summoning flags so that lower indiced diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index b857172017..b7dc9e30a1 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4391,6 +4391,7 @@ void player::init() your_name[0] = 0; + banished = false; berserk_penalty = 0; berserker = 0; conf = 0; diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 67caf85995..483c0b87ef 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1083,9 +1083,8 @@ int portal(void) more(); you.your_level = target_level - 1; - grd[you.x_pos][you.y_pos] = DNGN_STONE_STAIRS_DOWN_I; - down_stairs( true, old_level, true ); + down_stairs( true, old_level, DNGN_STONE_STAIRS_DOWN_I ); untag_followers(); } diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 2a42308c32..2ab5141c45 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1973,7 +1973,6 @@ static bool send_abyss() if (you.level_type != LEVEL_ABYSS) { mpr("You are cast into the Abyss!"); - more(); banished(DNGN_ENTER_ABYSS); // sends you to the abyss return (true); } -- cgit v1.2.3-54-g00ecf