summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/cloud.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-04 10:04:17 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-04 16:50:18 +0100
commit6f10cd2574eeb8a1417eff84718edd309287ac0d (patch)
tree69a45fe0e35cb559a3285b08697c96c230fc0c0f /crawl-ref/source/cloud.cc
parent9ad85435681ad82c7ef07d2083e40e525e2b0f55 (diff)
downloadcrawl-ref-6f10cd2574eeb8a1417eff84718edd309287ac0d.tar.gz
crawl-ref-6f10cd2574eeb8a1417eff84718edd309287ac0d.zip
Get rid of multiple-meaning "int object" in env.show.
env.show is now a class show_def that stores tagged unions of type show_type. For the moment, there's also env.show_los for use in LOS determination, but that should become an array of boolean at some point. This breaks save compatibility. Tiles and console version build and appear to work fine, but this kind of change is likely to have some side-effects.
Diffstat (limited to 'crawl-ref/source/cloud.cc')
-rw-r--r--crawl-ref/source/cloud.cc75
1 files changed, 75 insertions, 0 deletions
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 1916914ed1..04736fc968 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -14,6 +14,7 @@
#include "branch.h"
#include "cloud.h"
+#include "colour.h"
#include "coord.h"
#include "mapmark.h"
#include "ouch.h"
@@ -959,6 +960,80 @@ void cloud_struct::set_killer(killer_type _killer)
break;
}
}
+
+int get_cloud_colour(int cloudno)
+{
+ int which_colour = LIGHTGREY;
+ switch (env.cloud[cloudno].type)
+ {
+ case CLOUD_FIRE:
+ case CLOUD_FOREST_FIRE:
+ if (env.cloud[cloudno].decay <= 20)
+ which_colour = RED;
+ else if (env.cloud[cloudno].decay <= 40)
+ which_colour = LIGHTRED;
+ else if (one_chance_in(4))
+ which_colour = RED;
+ else if (one_chance_in(4))
+ which_colour = LIGHTRED;
+ else
+ which_colour = YELLOW;
+ break;
+
+ case CLOUD_STINK:
+ which_colour = GREEN;
+ break;
+
+ case CLOUD_COLD:
+ if (env.cloud[cloudno].decay <= 20)
+ which_colour = BLUE;
+ else if (env.cloud[cloudno].decay <= 40)
+ which_colour = LIGHTBLUE;
+ else if (one_chance_in(4))
+ which_colour = BLUE;
+ else if (one_chance_in(4))
+ which_colour = LIGHTBLUE;
+ else
+ which_colour = WHITE;
+ break;
+
+ case CLOUD_POISON:
+ which_colour = (one_chance_in(3) ? LIGHTGREEN : GREEN);
+ break;
+
+ case CLOUD_BLUE_SMOKE:
+ which_colour = LIGHTBLUE;
+ break;
+
+ case CLOUD_PURP_SMOKE:
+ which_colour = MAGENTA;
+ break;
+
+ case CLOUD_MIASMA:
+ case CLOUD_BLACK_SMOKE:
+ which_colour = DARKGREY;
+ break;
+
+ case CLOUD_RAIN:
+ case CLOUD_MIST:
+ which_colour = ETC_MIST;
+ break;
+
+ case CLOUD_CHAOS:
+ which_colour = ETC_RANDOM;
+ break;
+
+ case CLOUD_MUTAGENIC:
+ which_colour = ETC_MUTAGENIC;
+ break;
+
+ default:
+ which_colour = LIGHTGREY;
+ break;
+ }
+ return (which_colour);
+}
+
//////////////////////////////////////////////////////////////////////////
// Fog machine stuff