From 4bbe9c5b6bd9f2d9706148b9e62b2d69e4e9ee0f Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Sun, 17 Jan 2010 10:36:37 +0530 Subject: Burning trees in Swamp produces shallow water. Fire clouds adjacent to watery squares now produce steam. --- crawl-ref/source/beam.cc | 2 +- crawl-ref/source/cloud.cc | 30 ++++++++++++++++++++++++++---- crawl-ref/source/dungeon.cc | 7 +++++++ crawl-ref/source/dungeon.h | 2 ++ 4 files changed, 36 insertions(+), 5 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index fdf6d05f96..0fa0b16462 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1849,7 +1849,7 @@ void bolt::fire_wall_effect() if (is_superhot()) { // Destroy the wall. - grd(pos()) = DNGN_FLOOR; + grd(pos()) = dgn_tree_base_feature_at(pos()); if (you.see_cell(pos())) emit_message(MSGCH_PLAIN, "The tree burns like a torch!"); else if (you.can_smell()) diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 2e9a5a282e..c7a01066db 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -112,8 +112,9 @@ static void _new_cloud( int cloud, cloud_type type, const coord_def& p, static void _place_new_cloud(cloud_type cltype, const coord_def& p, int decay, kill_category whose, killer_type killer, - int spread_rate, int colour, std::string name, - std::string tile) + int spread_rate = -1, int colour = -1, + std::string name = "", + std::string tile = "") { if (env.cloud_no >= MAX_CLOUDS) return; @@ -185,7 +186,7 @@ static void _spread_fire(const cloud_struct &cloud) { if (you.see_cell(*ai)) mpr("The forest fire spreads!"); - grd(*ai) = DNGN_FLOOR; + grd(*ai) = dgn_tree_base_feature_at(*ai); _place_new_cloud( cloud.type, *ai, random2(30)+25, cloud.whose, cloud.killer, cloud.spread_rate, cloud.colour, cloud.name, cloud.tile ); @@ -194,6 +195,25 @@ static void _spread_fire(const cloud_struct &cloud) } } +static void _cloud_fire_interacts_with_terrain(const cloud_struct &cloud) +{ + for (adjacent_iterator ai(cloud.pos); ai; ++ai) + { + const coord_def p(*ai); + if (feat_is_watery(grd(p)) && env.cgrid(p) == EMPTY_CLOUD) + { + _place_new_cloud(CLOUD_STEAM, p, cloud.decay / 2 + 1, + cloud.whose, cloud.killer); + } + } +} + +void cloud_interacts_with_terrain(const cloud_struct &cloud) +{ + if (cloud.type == CLOUD_FIRE || cloud.type == CLOUD_FOREST_FIRE) + _cloud_fire_interacts_with_terrain(cloud); +} + static void _dissipate_cloud(int cloudidx, int dissipate) { cloud_struct &cloud = env.cloud[cloudidx]; @@ -228,7 +248,8 @@ void manage_clouds() // rain and cold clouds dissipate faster over lava. if (cloud.type == CLOUD_FIRE && grd(cloud.pos) == DNGN_DEEP_WATER) dissipate *= 4; - else if ((cloud.type == CLOUD_COLD || cloud.type == CLOUD_RAIN) && grd(cloud.pos) == DNGN_LAVA) + else if ((cloud.type == CLOUD_COLD || cloud.type == CLOUD_RAIN) + && grd(cloud.pos) == DNGN_LAVA) dissipate *= 4; else if (cloud.type == CLOUD_GLOOM) { @@ -247,6 +268,7 @@ void manage_clouds() dissipate /= 20; } + cloud_interacts_with_terrain(cloud); expose_items_to_element(cloud2beam(cloud.type), cloud.pos, 2); _dissipate_cloud(i, dissipate); diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 94850d8bb8..8c8c1e1ecd 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -8151,6 +8151,13 @@ void dgn_set_lt_callback(std::string level_type_tag, level_type_post_callbacks[level_type_tag] = callback_name; } +dungeon_feature_type dgn_tree_base_feature_at(coord_def c) +{ + return (player_in_branch(BRANCH_SWAMP)? + DNGN_SHALLOW_WATER : + DNGN_FLOOR); +} + //////////////////////////////////////////////////////////////////// // dgn_region diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h index 29217fba51..165515de3f 100644 --- a/crawl-ref/source/dungeon.h +++ b/crawl-ref/source/dungeon.h @@ -226,6 +226,8 @@ int dgn_place_monster(mons_spec &mspec, bool force_pos = false, bool generate_awake = false, bool patrolling = false); +dungeon_feature_type dgn_tree_base_feature_at(coord_def c); + class item_list; void dgn_place_multiple_items(item_list &list, const coord_def& where, -- cgit v1.2.3