summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-14 20:47:04 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-14 20:47:04 +0000
commitb6c69a86519c6bb8a69ca7074350cdc496968ac6 (patch)
treef4b2b9bd70c0691c9b37bb8235d6ff2987439f3f /crawl-ref/source
parentf03320c66fd006bd233cdca9490adfa9179339d3 (diff)
downloadcrawl-ref-b6c69a86519c6bb8a69ca7074350cdc496968ac6.tar.gz
crawl-ref-b6c69a86519c6bb8a69ca7074350cdc496968ac6.zip
Consolidate beam and cloud handling routines a bit, and allow clouds to
destroy items on the floor where applicable. Also allow grey smoke as a random potion effect from Evaporate. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5040 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/beam.cc36
-rw-r--r--crawl-ref/source/cloud.cc8
-rw-r--r--crawl-ref/source/enum.h3
-rw-r--r--crawl-ref/source/misc.cc69
-rw-r--r--crawl-ref/source/misc.h3
5 files changed, 89 insertions, 30 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index ba1c34c536..dcd1664677 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2413,6 +2413,7 @@ static void _beam_explodes(bolt &beam, int x, int y)
break;
case BEAM_POTION_STEAM:
+ case BEAM_POTION_GREY_SMOKE:
beam.colour = LIGHTGREY;
break;
@@ -2920,52 +2921,33 @@ static void _affect_place_explosion_clouds(bolt &beam, int x, int y)
switch (beam.flavour)
{
case BEAM_POTION_STINKING_CLOUD:
- cl_type = CLOUD_STINK;
- break;
-
case BEAM_POTION_POISON:
- cl_type = CLOUD_POISON;
- break;
-
case BEAM_POTION_MIASMA:
- cl_type = CLOUD_MIASMA;
- break;
-
- case BEAM_POTION_BLACK_SMOKE:
- cl_type = CLOUD_BLACK_SMOKE;
- break;
-
+ case BEAM_POTION_STEAM:
case BEAM_POTION_FIRE:
- cl_type = CLOUD_FIRE;
- break;
-
case BEAM_POTION_COLD:
- cl_type = CLOUD_COLD;
- break;
-
+ case BEAM_POTION_BLACK_SMOKE:
+ case BEAM_POTION_GREY_SMOKE:
case BEAM_POTION_BLUE_SMOKE:
- cl_type = CLOUD_BLUE_SMOKE;
- break;
-
case BEAM_POTION_PURP_SMOKE:
- cl_type = CLOUD_PURP_SMOKE;
+ cl_type = beam2cloud(beam.flavour);
break;
case BEAM_POTION_RANDOM:
- switch (random2(10))
+ switch (random2(11))
{
case 0: cl_type = CLOUD_FIRE; break;
case 1: cl_type = CLOUD_STINK; break;
case 2: cl_type = CLOUD_COLD; break;
case 3: cl_type = CLOUD_POISON; break;
case 4: cl_type = CLOUD_BLACK_SMOKE; break;
- case 5: cl_type = CLOUD_BLUE_SMOKE; break;
- case 6: cl_type = CLOUD_PURP_SMOKE; break;
+ case 5: cl_type = CLOUD_GREY_SMOKE; break;
+ case 6: cl_type = CLOUD_BLUE_SMOKE; break;
+ case 7: cl_type = CLOUD_PURP_SMOKE; break;
default: cl_type = CLOUD_STEAM; break;
}
break;
- case BEAM_POTION_STEAM:
default:
cl_type = CLOUD_STEAM;
break;
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 182ce92ae1..885f9aaeae 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -22,6 +22,7 @@
#include "cloud.h"
#include "mapmark.h"
#include "misc.h"
+#include "ouch.h"
#include "place.h"
#include "stuff.h"
#include "terrain.h"
@@ -152,7 +153,10 @@ void manage_clouds(void)
dissipate *= 4;
}
- dissipate_cloud( cc, env.cloud[cc], dissipate );
+ expose_items_to_element(cloud2beam(env.cloud[cc].type),
+ env.cloud[cc].x, env.cloud[cc].y);
+
+ dissipate_cloud(cc, env.cloud[cc], dissipate);
}
return;
@@ -516,5 +520,5 @@ fog_machine_data fogs_lab_type(int level_number)
killer_type cloud_struct::beam_thrower() const
{
- return (whose == KC_YOU? KILL_YOU_MISSILE : KILL_MON_MISSILE);
+ return (whose == KC_YOU ? KILL_YOU_MISSILE : KILL_MON_MISSILE);
}
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 00bde3dfc4..48453c10e3 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -251,6 +251,7 @@ enum beam_type // beam[].flavour
BEAM_POTION_FIRE,
BEAM_POTION_COLD,
BEAM_POTION_BLACK_SMOKE,
+ BEAM_POTION_GREY_SMOKE,
BEAM_POTION_BLUE_SMOKE,
BEAM_POTION_PURP_SMOKE,
BEAM_POTION_RANDOM,
@@ -388,12 +389,12 @@ enum cloud_type
CLOUD_STINK,
CLOUD_COLD,
CLOUD_POISON,
+ CLOUD_BLACK_SMOKE,
CLOUD_GREY_SMOKE,
CLOUD_BLUE_SMOKE,
CLOUD_PURP_SMOKE,
CLOUD_STEAM,
CLOUD_MIASMA,
- CLOUD_BLACK_SMOKE,
CLOUD_MIST,
CLOUD_RANDOM = 98,
CLOUD_DEBUGGING = 99 // 99: used once as 'nonexistent cloud' {dlb}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 6c2ecfa7cd..df7954876d 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1211,6 +1211,75 @@ void search_around( bool only_adjacent )
return;
} // end search_around()
+cloud_type beam2cloud(beam_type flavour)
+{
+ switch (flavour)
+ {
+ default:
+ case BEAM_NONE:
+ return CLOUD_NONE;
+ case BEAM_FIRE:
+ case BEAM_POTION_FIRE:
+ return CLOUD_FIRE;
+ case BEAM_POTION_STINKING_CLOUD:
+ return CLOUD_STINK;
+ case BEAM_COLD:
+ case BEAM_POTION_COLD:
+ return CLOUD_COLD;
+ case BEAM_POISON:
+ case BEAM_POTION_POISON:
+ return CLOUD_POISON;
+ case BEAM_POTION_BLACK_SMOKE:
+ return CLOUD_BLACK_SMOKE;
+ case BEAM_POTION_GREY_SMOKE:
+ return CLOUD_GREY_SMOKE;
+ case BEAM_POTION_BLUE_SMOKE:
+ return CLOUD_BLUE_SMOKE;
+ case BEAM_POTION_PURP_SMOKE:
+ return CLOUD_PURP_SMOKE;
+ case BEAM_STEAM:
+ case BEAM_POTION_STEAM:
+ return CLOUD_STEAM;
+ case BEAM_MIASMA:
+ case BEAM_POTION_MIASMA:
+ return CLOUD_MIASMA;
+ case BEAM_RANDOM:
+ return CLOUD_RANDOM;
+ }
+}
+
+beam_type cloud2beam(cloud_type flavour)
+{
+ switch (flavour)
+ {
+ default:
+ case CLOUD_NONE:
+ return BEAM_NONE;
+ case CLOUD_FIRE:
+ return BEAM_FIRE;
+ case CLOUD_STINK:
+ return BEAM_POTION_STINKING_CLOUD;
+ case CLOUD_COLD:
+ return BEAM_COLD;
+ case CLOUD_POISON:
+ return BEAM_POISON;
+ case CLOUD_BLACK_SMOKE:
+ return BEAM_POTION_BLACK_SMOKE;
+ case CLOUD_GREY_SMOKE:
+ return BEAM_POTION_GREY_SMOKE;
+ case CLOUD_BLUE_SMOKE:
+ return BEAM_POTION_BLUE_SMOKE;
+ case CLOUD_PURP_SMOKE:
+ return BEAM_POTION_PURP_SMOKE;
+ case CLOUD_STEAM:
+ return BEAM_STEAM;
+ case CLOUD_MIASMA:
+ return BEAM_MIASMA;
+ case CLOUD_RANDOM:
+ return BEAM_RANDOM;
+ }
+}
+
void in_a_cloud()
{
int cl = env.cgrid[you.x_pos][you.y_pos];
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index 0ee8d4e5bc..21df0331f5 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -40,6 +40,9 @@ void down_stairs(int old_level,
dungeon_feature_type force_stair = DNGN_UNSEEN,
entry_cause_type entry_cause = EC_UNKNOWN);
+cloud_type beam2cloud(beam_type flavour);
+beam_type cloud2beam(cloud_type flavour);
+
// last updated 12may2000 {dlb}
/* ***********************************************************************
* called from: acr