diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 10:16:26 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 10:16:26 +0000 |
commit | 56e74bf761ad5b73de543c2a331c26f1b40c0b12 (patch) | |
tree | d25f36e35a64cbe082009ac952cbd44bc98ef727 /crawl-ref/source/misc.cc | |
parent | 0ed1d5f2217c5cee43cb9fe38ceff0234d9c617a (diff) | |
download | crawl-ref-56e74bf761ad5b73de543c2a331c26f1b40c0b12.tar.gz crawl-ref-56e74bf761ad5b73de543c2a331c26f1b40c0b12.zip |
Create random blood spatter in the Abyss and Pandemonium (FR 1986241).
How it works:
* Pick 12 random grids on the map and make them bloody.
* Recursively and with decreasing chances, allow their neighbours to get
spattered as well.
I think the effect is rather nice but the numbers might need to be
tweaked anyway.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5533 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r-- | crawl-ref/source/misc.cc | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 4224889d69..d024069bb8 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1149,14 +1149,14 @@ static void maybe_bloodify_square(int x, int y, int amount, bool spatter = false for (int i = -1; i <= 1; i++) for (int j = -1; j <= 1; j++) { - if (i == 0 && j == 0) // current square - continue; + if (i == 0 && j == 0) // current square + continue; - // Spattering onto walls etc. less likely. - if (grd[x+i][y+j] < DNGN_MINMOVE && !one_chance_in(3)) - continue; + // Spattering onto walls etc. less likely. + if (grd[x+i][y+j] < DNGN_MINMOVE && !one_chance_in(3)) + continue; - maybe_bloodify_square(x+i, y+j, amount/15); + maybe_bloodify_square(x+i, y+j, amount/15); } } } @@ -1174,6 +1174,48 @@ void bleed_onto_floor(int x, int y, int montype, int damage, bool spatter) maybe_bloodify_square(x, y, damage, spatter); } +static void _spatter_neighbours(int cx, int cy, int chance) +{ + int posx, posy; + for (int x = -1; x <= 1; x++) + for (int y = -1; y <= 1; y++) + { + posx = cx + x; + posy = cy + y; + if (!in_bounds(posx, posy)) + continue; + + if (!allow_bleeding_on_square(posx, posy)) + continue; + + if (grd[posx][posy] < DNGN_MINMOVE && !one_chance_in(3)) + continue; + + if (one_chance_in(chance)) + { + env.map[posx][posy].property = FPROP_BLOODY; + _spatter_neighbours(posx, posy, chance+1); + } + } +} + +void generate_random_blood_spatter_on_level() +{ + int cx, cy; + int startprob; + int max_cluster = 7 + random2(9); + for (int i = 0; i < max_cluster; i++) + { + cx = 10 + random2(GXM - 10); + cy = 10 + random2(GYM - 10); + startprob = 1 + random2(4); + + if (allow_bleeding_on_square(cx, cy)) + env.map[cx][cy].property = FPROP_BLOODY; + _spatter_neighbours(cx, cy, startprob); + } +} + void search_around( bool only_adjacent ) { int i; @@ -2265,6 +2307,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, break; PlaceInfo &place_info = you.get_place_info(); + generate_random_blood_spatter_on_level(); // Entering voluntarily only stimulates Xom if you've never // been there before |