summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilepick.cc
diff options
context:
space:
mode:
authorJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-15 19:09:37 +0100
committerJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-15 19:28:55 +0100
commitd3b316cb62dd1fbd27789ef36076c3ca83290422 (patch)
treeb54ad2dcef3a1e894da4e6a37ae3eb173e6f2e49 /crawl-ref/source/tilepick.cc
parente9a337536b2a0c74eea3835061fa292f4ede6069 (diff)
downloadcrawl-ref-d3b316cb62dd1fbd27789ef36076c3ca83290422.tar.gz
crawl-ref-d3b316cb62dd1fbd27789ef36076c3ca83290422.zip
Add new props value "tile_num" and use it for randomized monster tiles.
Monsters that have several variant tiles will now get a random value written into tile_num at creation, so when their tile gets drawn one of the set is picked, but always the same one. In practise, this is currently only used for slaves and toadstools. Other monsters that have variant tiles, such as ugly things, kraken tentacles, or slimes creatures, are handled specially. Generally, such differences should be small and flavourful. The greater the threat of a given monster the more important it is that the player will recognize it immediately. (Of course, this restriction does not hold if the tile actually transport information as is the case for ugly things' colours etc.)
Diffstat (limited to 'crawl-ref/source/tilepick.cc')
-rw-r--r--crawl-ref/source/tilepick.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index d516e20b73..d0ea280cf6 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -115,6 +115,16 @@ static int _bow_offset(const monsters *mon)
}
}
+static int _get_random_monster_tile(const monsters *mon, const int base_tile)
+{
+ if (!mon->props.exists("tile_num"))
+ return (base_tile);
+
+ const int variants = tile_player_count(base_tile);
+ return base_tile + (mon->props["tile_num"].get_short() % variants);
+}
+
+
int tileidx_monster_base(const monsters *mon, bool detected)
{
bool in_water = feat_is_water(grd(mon->pos()));
@@ -202,7 +212,7 @@ int tileidx_monster_base(const monsters *mon, bool detected)
return TILEP_MONS_BALLISTOMYCETE_ACTIVE;
return TILEP_MONS_BALLISTOMYCETE_INACTIVE;
case MONS_TOADSTOOL:
- return TILEP_MONS_TOADSTOOL;
+ return _get_random_monster_tile(mon, TILEP_MONS_TOADSTOOL);
case MONS_FUNGUS:
return TILEP_MONS_FUNGUS;
case MONS_WANDERING_MUSHROOM:
@@ -788,7 +798,7 @@ int tileidx_monster_base(const monsters *mon, bool detected)
case MONS_KILLER_KLOWN:
return TILEP_MONS_KILLER_KLOWN;
case MONS_SLAVE:
- return TILEP_MONS_SLAVE;
+ return _get_random_monster_tile(mon, TILEP_MONS_SLAVE);
// mimics
case MONS_GOLD_MIMIC:
@@ -1116,7 +1126,7 @@ int tileidx_monster_base(const monsters *mon, bool detected)
case MONS_KIRKE:
return TILEP_MONS_KIRKE;
case MONS_NIKOLA:
- return TILEP_MONS_NIKOLA; // TODO
+ return TILEP_MONS_NIKOLA;
case MONS_MAURICE:
return TILEP_MONS_MAURICE;