summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/docs/develop/levels/syntax.txt10
-rw-r--r--crawl-ref/source/dungeon.cc3
-rw-r--r--crawl-ref/source/mapdef.cc17
-rw-r--r--crawl-ref/source/tilepick.cc3
4 files changed, 33 insertions, 0 deletions
diff --git a/crawl-ref/docs/develop/levels/syntax.txt b/crawl-ref/docs/develop/levels/syntax.txt
index 1598f04719..642e7f5564 100644
--- a/crawl-ref/docs/develop/levels/syntax.txt
+++ b/crawl-ref/docs/develop/levels/syntax.txt
@@ -557,6 +557,16 @@ MONS: (list of monsters)
The colour "any" can be given, in which case a random colour
will be chosen when the monster is placed.
+ You can override the displayed monster tile using the "tile:"
+ specifier as follows:
+ MONS: rat tile:giant_bat
+
+ In tiles version, this would create a monster that uses the
+ 'giant_bat' tile, but is otherwise identical to a rat. Obviously, this
+ substition of one monster onto another should never be used, but it
+ can be useful for customised vault monsters if an alternate tile
+ exists. In ASCII mode, this will do nothing.
+
Note that 8, 9, 0 also place monsters (see the table).
If you want to place a random monster suitable for the level
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 652d9370f0..1da42f3958 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -4970,6 +4970,7 @@ int dgn_place_monster(mons_spec &mspec,
mg.mname = mspec.monname;
mg.hd = mspec.hd;
mg.hp = mspec.hp;
+ mg.props = mspec.props;
// Marking monsters as summoned
mg.abjuration_duration = mspec.abjuration_duration;
@@ -5016,6 +5017,8 @@ int dgn_place_monster(mons_spec &mspec,
_dgn_give_mon_spec_items(mspec, mindex, mid, monster_level);
if (mspec.explicit_spells)
mons.spells = mspec.spells;
+ if (mspec.props.exists("monster_tile"))
+ mons.props["monster_tile"] = mspec.props["monster_tile"].get_short();
// These are applied earlier to prevent issues with renamed monsters
// and "<monster> comes into view" (see delay.cc:_monster_warning).
//mons.flags |= mspec.extra_monster_flags;
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 4a9162cadd..76dc38c452 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -3160,6 +3160,23 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
}
}
+ std::string tile = strip_tag_prefix(mon_str, "tile:");
+#ifdef USE_TILE
+ if (!tile.empty())
+ {
+ // Modify the string to prevent them from using non-mons tiles.
+ if (tile.find("mons_") == std::string::npos)
+ tile = std::string("mons_" + tile);
+ unsigned int index;
+ if (!tile_player_index(tile.c_str(), index))
+ {
+ error = make_stringf("bad tile name: \"%s\".", tile.c_str());
+ return (slot);
+ }
+ mspec.props["monster_tile"] = short(index);
+ }
+#endif
+
std::string name = strip_tag_prefix(mon_str, "name:");
if (!name.empty())
{
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index f7f8c104c2..4af9a4e880 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -126,6 +126,9 @@ int tileidx_monster_base(const monsters *mon, bool detected)
if (detected)
type = mons_detected_base(mon->type);
+ if (mon->props.exists("monster_tile"))
+ return int(mon->props["monster_tile"].get_short());
+
switch (type)
{
// program bug