summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-10-31 08:56:30 -0500
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-10-31 09:00:43 -0500
commitebd817b97aee46e383185f99d022fb9c559033d9 (patch)
tree68957d69448760dc6b55a5b9286f3b6283ce6bbe /crawl-ref
parenta6fe99646bdf76151337e2217a26f6b9839510fc (diff)
downloadcrawl-ref-ebd817b97aee46e383185f99d022fb9c559033d9.tar.gz
crawl-ref-ebd817b97aee46e383185f99d022fb9c559033d9.zip
Implement [2889948]: In the console version, make (very) ugly thing
corpses randomly cycle through all their available colors instead of always being (light)red.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/colour.cc17
-rw-r--r--crawl-ref/source/colour.h4
-rw-r--r--crawl-ref/source/ghost.cc11
-rw-r--r--crawl-ref/source/ghost.h1
-rw-r--r--crawl-ref/source/mon-data.h4
-rw-r--r--crawl-ref/source/mon-util.cc10
-rw-r--r--crawl-ref/source/mon-util.h1
7 files changed, 31 insertions, 17 deletions
diff --git a/crawl-ref/source/colour.cc b/crawl-ref/source/colour.cc
index 6a27c04b6a..cbdd536886 100644
--- a/crawl-ref/source/colour.cc
+++ b/crawl-ref/source/colour.cc
@@ -3,6 +3,7 @@
#include "colour.h"
#include "env.h"
+#include "mon-util.h"
#include "player.h"
#include "random.h"
@@ -65,7 +66,10 @@ int element_colour( int element, bool no_random )
// which might want a consistent result.
int tmp_rand = (no_random ? 0 : random2(120));
- switch (element & 0x007f) // strip COLFLAGs just in case
+ // Strip COLFLAGs just in case.
+ element &= 0x007f;
+
+ switch (element)
{
case ETC_FIRE:
ret = (tmp_rand < 40) ? RED :
@@ -251,6 +255,13 @@ int element_colour( int element, bool no_random )
ret = (tmp_rand < 90) ? WHITE : LIGHTGREY;
break;
+ case ETC_UGLY:
+ case ETC_VERY_UGLY:
+ ret = ugly_thing_random_colour();
+ if (element == ETC_VERY_UGLY)
+ ret = make_high_colour(ret);
+ break;
+
case ETC_RANDOM:
ret = 1 + random2(15); // always random
break;
@@ -261,7 +272,7 @@ int element_colour( int element, bool no_random )
break;
}
- ASSERT( !is_element_colour( ret ) );
+ ASSERT(!is_element_colour(ret));
return ((ret == BLACK) ? GREEN : ret);
}
@@ -330,7 +341,7 @@ int str_to_colour( const std::string &str, int default_colour,
"beogh", "crystal", "blood", "smoke", "slime", "jewel",
"elven", "dwarven", "orcish", "gila", "floor", "rock",
"stone", "mist", "shimmer_blue", "decay", "silver", "gold",
- "iron", "bone", "random"
+ "iron", "bone", "ugly", "very_ugly", "random"
};
ASSERT(ARRAYSZ(element_cols) == (ETC_RANDOM - ETC_FIRE) + 1);
diff --git a/crawl-ref/source/colour.h b/crawl-ref/source/colour.h
index 1d8acfe9a4..4a6e092279 100644
--- a/crawl-ref/source/colour.h
+++ b/crawl-ref/source/colour.h
@@ -38,12 +38,14 @@ enum element_type
ETC_ROCK, // colour of the area's rock
ETC_STONE, // colour of the area's stone
ETC_MIST, // colour of mist
- ETC_SHIMMER_BLUE, // shimmering colours of blue.
+ ETC_SHIMMER_BLUE, // shimmering colours of blue
ETC_DECAY, // colour of decay/swamp
ETC_SILVER, // colour of silver
ETC_GOLD, // colour of gold
ETC_IRON, // colour of iron
ETC_BONE, // colour of bone
+ ETC_UGLY, // random ugly thing colour
+ ETC_VERY_UGLY, // random very ugly thing colour
ETC_RANDOM // any colour (except BLACK)
};
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 72f9d8733e..5735eb9134 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -18,6 +18,7 @@
#include "ng-input.h"
#include "random.h"
#include "skills2.h"
+#include "mon-util.h"
#include "mtransit.h"
#include "place.h"
#include "player.h"
@@ -399,16 +400,6 @@ void ghost_demon::init_player_ghost()
add_spells();
}
-unsigned char ugly_thing_random_colour()
-{
- const unsigned char colours[] =
- {
- RED, BROWN, GREEN, CYAN, MAGENTA, LIGHTGREY
- };
-
- return (RANDOM_ELEMENT(colours));
-}
-
static unsigned char _ugly_thing_assign_colour(unsigned char force_colour,
unsigned char force_not_colour)
{
diff --git a/crawl-ref/source/ghost.h b/crawl-ref/source/ghost.h
index 29bb6d6c97..a2ca84a600 100644
--- a/crawl-ref/source/ghost.h
+++ b/crawl-ref/source/ghost.h
@@ -64,7 +64,6 @@ private:
mon_attack_flavour u_att_flav);
};
-unsigned char ugly_thing_random_colour();
bool debug_check_ghosts();
extern std::vector<ghost_demon> ghosts;
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index 9231b0efca..89f2bd35a9 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -1366,7 +1366,7 @@ static monsterentry mondata[] = {
// ugly things ('u')
{
- MONS_UGLY_THING, 'u', RED, "ugly thing",
+ MONS_UGLY_THING, 'u', ETC_UGLY, "ugly thing",
M_WARM_BLOOD | M_GLOWS,
MR_NO_FLAGS,
600, 10, MONS_UGLY_THING, MONS_UGLY_THING, MH_NATURAL, -3,
@@ -1377,7 +1377,7 @@ static monsterentry mondata[] = {
},
{
- MONS_VERY_UGLY_THING, 'u', LIGHTRED, "very ugly thing",
+ MONS_VERY_UGLY_THING, 'u', ETC_VERY_UGLY, "very ugly thing",
M_WARM_BLOOD | M_GLOWS,
MR_NO_FLAGS,
750, 10, MONS_UGLY_THING, MONS_VERY_UGLY_THING, MH_NATURAL, -3,
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 67c6e4fca6..e1fb6099f0 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1984,6 +1984,16 @@ void define_monster(monsters &mons)
mons.ench_countdown = 0;
}
+unsigned char ugly_thing_random_colour()
+{
+ const unsigned char colours[] =
+ {
+ RED, BROWN, GREEN, CYAN, MAGENTA, LIGHTGREY
+ };
+
+ return (RANDOM_ELEMENT(colours));
+}
+
static const char *ugly_colour_names[] = {
"red", "brown", "green", "cyan", "purple", "white"
};
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 02ff85115b..b06517207c 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -853,6 +853,7 @@ bool mons_cannot_move(const monsters *m);
bool monster_senior(const monsters *first, const monsters *second,
bool fleeing = false);
monster_type draco_subspecies(const monsters *mon);
+unsigned char ugly_thing_random_colour();
int ugly_thing_colour_offset(const monsters *mon);
monster_type draconian_colour_by_name(const std::string &colour);