diff options
Diffstat (limited to 'crawl-ref/source/mon-place.cc')
-rw-r--r-- | crawl-ref/source/mon-place.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index 331071bfcc..36be19cdeb 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -1059,6 +1059,22 @@ monsters* get_free_monster() return (NULL); } +#ifdef USE_TILE +// For some tiles, always use the fixed same variant out of a set +// of tiles. (Where this is not handled by number or colour already.) +static void _maybe_init_tilenum_props(monsters *mon) +{ + // Not necessary. + if (mon->props.exists("monster_tile") || mon->props.exists("tile_num")) + return; + + // Only add the property for tiles that have several variants. + const int base_tile = tileidx_monster_base(mon); + if (tile_player_count(base_tile) > 1) + mon->props["tile_num"] = short(random2(256)); +} +#endif + static int _place_monster_aux(const mgen_data &mg, bool first_band_member, bool force_pos) { @@ -1132,13 +1148,8 @@ static int _place_monster_aux(const mgen_data &mg, else if (mon->type == MONS_MERGED_SLIME_CREATURE) // shouldn't ever happen mon->type = MONS_SLIME_CREATURE; #ifdef USE_TILE - else if (mon->type == MONS_SLAVE && !mon->props.exists("monster_tile") - && coinflip()) - { - // When placing the slave monster, there's a 50% chance the - // default tile is replaced with an alternative one. - mon->props["monster_tile"] = short(TILEP_MONS_SLAVE_SMALL); - } + else + _maybe_init_tilenum_props(mon); #endif // Generate a brand shiny new monster, or zombie. |