From f080c133494f6430dd9078c438c90f9939e01b85 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 25 Mar 2008 19:36:08 +0000 Subject: Fixed tile compile. (I was being a bit overzealous in my cleanup.) Fix 1922815: blood potion assert. Implement 1828037: prompt before entering harmful clouds And tidy up fountain handling, dried non-magic fountains may now also start flowing again. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3878 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/init.txt | 4 +-- crawl-ref/source/direct.cc | 2 ++ crawl-ref/source/effects.cc | 72 ++++++++++++++++++++++++++------------------- crawl-ref/source/misc.cc | 10 +++---- crawl-ref/source/misc.h | 2 +- crawl-ref/source/player.cc | 29 +++++++++++++++--- crawl-ref/source/tile1.cc | 4 +++ crawl-ref/source/travel.cc | 2 +- 8 files changed, 81 insertions(+), 44 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt index 2417ea9c4e..d0b9f62b7a 100644 --- a/crawl-ref/init.txt +++ b/crawl-ref/init.txt @@ -271,8 +271,8 @@ message_colour = yellow:fails to return ##### 4-t Tile related Options ################## -show_items = !?/%=([)X}+\_. -# title_screen = false +tile_show_items = !?/%=([)X}+\_. +# tile_title_screen = false # tile_player_col = white # tile_monster_col = red diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 512bca6d62..9792b7ae0b 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1775,7 +1775,9 @@ std::string raw_feature_description(dungeon_feature_type grid, return ("fountain of sparkling water"); case DNGN_DRY_FOUNTAIN_I: case DNGN_DRY_FOUNTAIN_II: + case DNGN_DRY_FOUNTAIN_III: case DNGN_DRY_FOUNTAIN_IV: + case DNGN_DRY_FOUNTAIN_V: case DNGN_DRY_FOUNTAIN_VI: case DNGN_DRY_FOUNTAIN_VIII: case DNGN_PERMADRY_FOUNTAIN: diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 257e58e237..a0962fd34f 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -2844,6 +2844,35 @@ void update_level( double elapsedTime ) delete_cloud( i ); } +static void _maybe_restart_fountain_flow(const int x, const int y, int tries) +{ + while (0 < tries--) + { + if (!one_chance_in(100)) + continue; + + if (grd[x][y] > DNGN_SPARKLING_FOUNTAIN) + grd[x][y] = static_cast(grd[x][y] - 1); + else // grid == DNGN_DRY_FOUNTAIN_I + grd[x][y] = DNGN_BLUE_FOUNTAIN; + + // clean bloody floor + if (is_bloodcovered(x,y)) + env.map[x][y].property = FPROP_NONE; + + // chance of cleaning adjacent squares + for (int i = -1; i <= 1; i++) + for (int j =-1; j <= 1; j++) + { + if (is_bloodcovered(x+i,y+j) + && one_chance_in(5)) + { + env.map[x+i][y+j].property = FPROP_NONE; + } + } + } +} + //--------------------------------------------------------------- // // update_corpses @@ -2892,7 +2921,12 @@ void update_corpses(double elapsedTime) } else { - ASSERT(rot_time < 256); + // potions of blood have a longer rot time + if (it.base_type == OBJ_POTIONS) + ASSERT(rot_time < 1500); + else + ASSERT(rot_time < 256); + it.special -= rot_time; } } @@ -2904,39 +2938,15 @@ void update_corpses(double elapsedTime) // dry fountains may start flowing again if (fountain_checks > 0) { - for (cx=0; cx DNGN_SPARKLING_FOUNTAIN - && grd[cx][cy] < DNGN_PERMADRY_FOUNTAIN) + if (grd[cx][cy] == DNGN_DRY_FOUNTAIN_I + || grd[cx][cy] > DNGN_SPARKLING_FOUNTAIN + && grd[cx][cy] < DNGN_PERMADRY_FOUNTAIN) { - for (int i=0; i DNGN_SPARKLING_FOUNTAIN) - grd[cx][cy] = - static_cast( - grd[cx][cy] - 1); - - // clean bloody floor - if (is_bloodcovered(cx,cy)) - env.map[cx][cy].property = FPROP_NONE; - // chance of cleaning adjacent squares - for (int k=-1; k<=1; k++) - { - for (int l=-1; l<=1; l++) - if (is_bloodcovered(cx+k,cy+l) - && one_chance_in(5)) - { - env.map[cx+k][cy+l].property = FPROP_NONE; - } - } - } - } + _maybe_restart_fountain_flow(cx, cy, fountain_checks); } } - } } } diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index c162843083..25dd385c0e 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1714,7 +1714,7 @@ bool go_berserk(bool intentional) return true; } // end go_berserk() -bool is_damaging_cloud(cloud_type type) +bool is_damaging_cloud(cloud_type type, bool temp) { switch (type) { @@ -1727,11 +1727,11 @@ bool is_damaging_cloud(cloud_type type) // also expect to be the case a few turns later (ignores spells). case CLOUD_STINK: case CLOUD_POISON: - return (!player_res_poison(false, false)); + return (!player_res_poison(false, temp)); case CLOUD_STEAM: - return (player_res_steam(false, false) <= 0); + return (player_res_steam(false, temp) <= 0); case CLOUD_MIASMA: - return (player_prot_life(false, false) <= 2); + return (player_prot_life(false, temp) <= 2); // smoke, never harmful default: return (false); @@ -1838,7 +1838,7 @@ bool i_feel_safe(bool announce, bool want_move) { const cloud_type type = env.cloud[ env.cgrid[you.x_pos][you.y_pos] ].type; - if (is_damaging_cloud(type)) + if (is_damaging_cloud(type, false)) { if (announce) mprf(MSGCH_WARN, "You're standing in a cloud of %s!", diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h index 04b6713bb8..0c48aafa2f 100644 --- a/crawl-ref/source/misc.h +++ b/crawl-ref/source/misc.h @@ -99,7 +99,7 @@ std::string weird_writing(); std::string cloud_name(cloud_type type); -bool is_damaging_cloud(cloud_type type); +bool is_damaging_cloud(cloud_type type, bool temp = false); void curare_hits_player(int agent, int degree); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 3a4d4b7da4..80057f0d37 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -123,6 +123,28 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, ASSERT( mgrd[x][y] == NON_MONSTER || mons_is_submerged( &menv[ mgrd[x][y] ] )); + const int cloud = env.cgrid[x][y]; + if (cloud != EMPTY_CLOUD) + { + const cloud_type ctype = env.cloud[ cloud ].type; + // don't prompt if already in a cloud of the same type + if (is_damaging_cloud(ctype, false) + && (env.cgrid[you.x_pos][you.y_pos] == EMPTY_CLOUD + || ctype != env.cloud[ env.cgrid[you.x_pos][you.y_pos] ].type)) + { + std::string prompt = make_stringf( + "Really step into that cloud of %s?", + cloud_name(ctype).c_str()); + + if (!yesno(prompt.c_str(), false, 'n')) + { + canned_msg(MSG_OK); + you.turn_is_over = false; + return (false); + } + } + } + // if we're walking along, give a chance to avoid trap if (stepped && !force && !you.confused()) { @@ -161,17 +183,16 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, const trap_type type = trap_type_at_xy(x,y); if (type == TRAP_ZOT) { - if (! yes_or_no("Do you really want to step into the %s", - "Zot trap")) + if (!yes_or_no("Do you really want to step into the Zot trap")) { canned_msg(MSG_OK); you.turn_is_over = false; return (false); } } - else if (type == TRAP_SHAFT && you.airborne()) + else if (new_grid != DNGN_TRAP_MAGICAL && you.airborne()) { - // No prompt + // No prompt (shaft and mechanical traps ineffective, if flying) } else #ifdef CLUA_BINDINGS diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc index fff4b55c03..db27bf9663 100644 --- a/crawl-ref/source/tile1.cc +++ b/crawl-ref/source/tile1.cc @@ -4351,6 +4351,10 @@ void tile_draw_inv(int flag) } int n = 0; + + // item.base_type <-> char conversion table + const static char *obj_syms = ")([/%#?=!#+\\0}x"; + for (int i = 0; i < (int)strlen(item_chars); i++) { int top = n; diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index fe0ad46cca..0507ce4c14 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -491,7 +491,7 @@ static bool is_safe_move(int x, int y) // We can also safely run through smoke. const cloud_type ctype = env.cloud[ cloud ].type; - return (!is_damaging_cloud(ctype)); + return (!is_damaging_cloud(ctype, true)); } static void set_pass_feature(unsigned char grid, signed char pass) -- cgit v1.2.3-54-g00ecf