summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/docs/develop/level_design.txt15
-rw-r--r--crawl-ref/source/dungeon.cc1
-rw-r--r--crawl-ref/source/mapdef.cc7
-rw-r--r--crawl-ref/source/mapdef.h3
-rw-r--r--crawl-ref/source/monplace.cc5
-rw-r--r--crawl-ref/source/monplace.h9
6 files changed, 37 insertions, 3 deletions
diff --git a/crawl-ref/docs/develop/level_design.txt b/crawl-ref/docs/develop/level_design.txt
index 0788a355f7..9731563da1 100644
--- a/crawl-ref/docs/develop/level_design.txt
+++ b/crawl-ref/docs/develop/level_design.txt
@@ -683,6 +683,21 @@ MONS: (list of monsters)
Items given to an orc or an elf will be made orcish or elven
unless the item's race type is explicitly set otherwise.
+ Individual monsters can be given names as follows:
+ MONS: kobold name:Durwent
+
+ This will cause the monster to appear as "Durwent the kobold".
+ Spaces can be placed in the name by substituting them with the _
+ symbol. It is worth noting that "the <race>" will be appended
+ to all names, which should be considered when coming up with them.
+
+ The name tag is also useable in KMONS. It should be used carefully
+ to avoid having multiple monsters named the same (ie, as above,
+ and then using the glyph '1' multiple times will result in multiple
+ "Durwent the Kobold"s).
+
+ Monster names should be used very, very, very sparingly.
+
Limitations: If an item in the item list has alternatives,
there's no way to force all monsters dervied from that monster
spec to choose the same alternative. If a monster is given
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 0f70733569..b5f3279e51 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -4730,6 +4730,7 @@ int dgn_place_monster(mons_spec &mspec,
mg.base_type = mspec.monbase;
mg.number = mspec.number;
mg.colour = mspec.colour;
+ mg.mname = mspec.monname;
coord_def place(where);
if (!force_pos && mgrd(place) != NON_MONSTER
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 0d2b5f6864..237e55808f 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -2268,6 +2268,13 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
}
}
+ std::string name = strip_tag_prefix(mon_str, "name:");
+ if (!name.empty())
+ {
+ name = replace_all_of(name, "_", " ");
+ mspec.monname = name;
+ }
+
trim_string(mon_str);
if (mon_str == "8")
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index a7b9bc4d9b..85c8484aef 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -432,6 +432,7 @@ class mons_spec
int colour;
item_list items;
+ std::string monname;
mons_spec(int id = RANDOM_MONSTER,
monster_type base = MONS_PROGRAM_BUG,
@@ -441,7 +442,7 @@ class mons_spec
: mid(id), place(), monbase(base), attitude(ATT_HOSTILE), number(num),
quantity(1), genweight(gw), mlevel(ml), fix_mons(_fixmons),
generate_awake(awaken), patrolling(false), band(false),
- colour(BLACK), items()
+ colour(BLACK), items(), monname("")
{
}
};
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index ac2e0e0ff5..e072d0980c 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -1124,6 +1124,11 @@ static int _place_monster_aux(const mgen_data &mg,
LIGHTBLUE, RED, LIGHTRED, MAGENTA, -1);
}
+ if (mg.mname != "")
+ {
+ menv[id].mname = mg.mname;
+ }
+
// The return of Boris is now handled in monster_die()...
// not setting this for Boris here allows for multiple Borises in
// the dungeon at the same time. -- bwr
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index 4d24ef1815..8d05ee2e21 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -180,6 +180,9 @@ struct mgen_data
// be available (vault metadata is not preserved across game saves).
unsigned map_mask;
+ // XXX: Rather hackish.
+ std::string mname;
+
mgen_data(monster_type mt = RANDOM_MONSTER,
beh_type beh = BEH_HOSTILE,
int abj = 0,
@@ -193,12 +196,14 @@ struct mgen_data
int moncolour = BLACK,
int monpower = you.your_level,
proximity_type prox = PROX_ANYWHERE,
- level_area_type ltype = you.level_type)
+ level_area_type ltype = you.level_type,
+ std::string monname = "")
: cls(mt), base_type(base), behaviour(beh),
abjuration_duration(abj), summon_type(st), pos(p), foe(mfoe),
flags(monflags), god(which_god), number(monnumber), colour(moncolour),
- power(monpower), proximity(prox), level_type(ltype), map_mask(0)
+ power(monpower), proximity(prox), level_type(ltype), map_mask(0),
+ mname(monname)
{
ASSERT(summon_type == 0 || (abj >= 1 && abj <= 6)
|| mt == MONS_BALL_LIGHTNING);