summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/itemname.cc55
-rw-r--r--crawl-ref/source/itemname.h5
-rw-r--r--crawl-ref/source/mon-util.cc41
-rw-r--r--crawl-ref/source/mon-util.h3
-rw-r--r--crawl-ref/source/monstuff.cc9
-rw-r--r--crawl-ref/source/religion.cc4
-rw-r--r--crawl-ref/source/spells3.cc4
7 files changed, 99 insertions, 22 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 6d9d551378..ee55efb22b 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -124,6 +124,29 @@ std::string item_def::name(description_level_type descrip,
if (terse && descrip != DESC_DBNAME)
descrip = DESC_PLAIN;
+ if (base_type == OBJ_CORPSES && is_named_corpse(*this)
+ && !starts_with(get_corpse_name(*this), "shaped "))
+ {
+ switch (descrip)
+ {
+ case DESC_CAP_A:
+ case DESC_CAP_YOUR:
+ descrip = DESC_CAP_THE;
+ break;
+
+ case DESC_NOCAP_A:
+ case DESC_NOCAP_YOUR:
+ case DESC_NOCAP_ITS:
+ case DESC_INVENTORY_EQUIP:
+ case DESC_INVENTORY:
+ descrip = DESC_NOCAP_THE;
+ break;
+
+ default:
+ break;
+ }
+ }
+
if (this->base_type == OBJ_ORBS
|| (ident || item_type_known( *this ))
&& (this->base_type == OBJ_MISCELLANY
@@ -1566,19 +1589,32 @@ std::string item_def::name_aux( description_level_type desc,
break;
case OBJ_CORPSES:
+ {
if (food_is_rotten(*this) && !dbname)
buff << "rotting ";
- if (!dbname)
+ const std::string _name = get_corpse_name(*this);
+ const bool shaped = starts_with(_name, "shaped ");
+
+ if (!dbname && !starts_with(_name, "the "))
+ {
buff << mons_type_name(it_plus, DESC_PLAIN) << ' ';
+ if (!_name.empty() && shaped)
+ buff << _name << ' ';
+ }
+
if (item_typ == CORPSE_BODY)
buff << "corpse";
else if (item_typ == CORPSE_SKELETON)
buff << "skeleton";
else
buff << "corpse bug";
+
+ if (!_name.empty() && !shaped)
+ buff << " of " << _name;
break;
+ }
default:
buff << "!";
@@ -2867,3 +2903,20 @@ std::vector<std::string> item_name_list_for_glyph(unsigned glyph)
std::vector<std::string> empty;
return empty;
}
+
+bool is_named_corpse(const item_def &corpse)
+{
+ ASSERT(corpse.base_type == OBJ_CORPSES);
+
+ return (corpse.props.exists(CORPSE_NAME_KEY));
+}
+
+std::string get_corpse_name(const item_def &corpse)
+{
+ ASSERT(corpse.base_type == OBJ_CORPSES);
+
+ if (!corpse.props.exists(CORPSE_NAME_KEY))
+ return ("");
+
+ return (corpse.props[CORPSE_NAME_KEY].get_string());
+}
diff --git a/crawl-ref/source/itemname.h b/crawl-ref/source/itemname.h
index d735708246..b98715bcfd 100644
--- a/crawl-ref/source/itemname.h
+++ b/crawl-ref/source/itemname.h
@@ -12,6 +12,8 @@
#include "externs.h"
+#define CORPSE_NAME_KEY "corpse_name_key"
+
struct item_types_pair
{
object_class_type base_type;
@@ -146,4 +148,7 @@ std::vector<std::string> item_name_list_for_glyph(unsigned glyph);
* *********************************************************************** */
const char* wand_type_name(int wandtype);
+bool is_named_corpse(const item_def &corpse);
+std::string get_corpse_name(const item_def &corpse);
+
#endif
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 348e1598b1..8161cd0c9b 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -977,24 +977,37 @@ bool mons_enslaved_soul(const monsters *mon)
|| mons_enslaved_intact_soul(mon));
}
-bool name_zombified_unique(monsters *mon, int mc, const std::string mon_name)
+bool name_zombie(monsters *mon, int mc, const std::string mon_name)
{
- if (mons_is_unique(mc))
- {
- mon->mname = mon_name;
+ mon->mname = mon_name;
- // Special case for Blork the orc: shorten his name to "Blork"
- // to avoid mentions of e.g "Blork the orc the orc zombie".
- if (mc == MONS_BLORK_THE_ORC)
- mon->mname = "Blork";
- // Also for the Lernaean hydra.
- else if (mc == MONS_LERNAEAN_HYDRA)
- mon->mname = "Lernaean hydra";
+ // Special case for Blork the orc: shorten his name to "Blork"
+ // to avoid mentions of e.g "Blork the orc the orc zombie".
+ if (mc == MONS_BLORK_THE_ORC)
+ mon->mname = "Blork";
+ // Also for the Lernaean hydra.
+ else if (mc == MONS_LERNAEAN_HYDRA)
+ mon->mname = "Lernaean hydra";
- return (true);
- }
+ if (starts_with(mon->mname, "shaped "))
+ mon->flags |= MF_NAME_SUFFIX;
- return (false);
+ return (true);
+}
+
+bool name_zombie(monsters *mon, const monsters* orig)
+{
+ if (!mons_is_unique(orig->type) && orig->mname.empty())
+ return (false);
+
+ std::string name;
+
+ if (!orig->mname.empty())
+ name = orig->mname;
+ else
+ name = mons_type_name(orig->type, DESC_PLAIN);
+
+ return name_zombie(mon, orig->type, name);
}
int downscale_zombie_damage(int damage)
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 34a6f79b87..ac0a28e529 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -644,7 +644,8 @@ bool mons_enslaved_body_and_soul(const monsters *mon);
bool mons_enslaved_twisted_soul(const monsters *mon);
bool mons_enslaved_intact_soul(const monsters *mon);
bool mons_enslaved_soul(const monsters *mon);
-bool name_zombified_unique(monsters *mon, int mc, const std::string mon_name);
+bool name_zombie(monsters *mon, int mc, const std::string mon_name);
+bool name_zombie(monsters *mon, const monsters* orig);
// last updated 12may2000 {dlb}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 6cfae15e46..4f5133e899 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -360,6 +360,12 @@ int fill_out_corpse(const monsters* monster, item_def& corpse,
if (corpse.colour == BLACK)
corpse.colour = monster->colour;
+ if (!monster->mname.empty())
+ corpse.props[CORPSE_NAME_KEY] = monster->mname;
+ else if (mons_is_unique(monster->type))
+ corpse.props[CORPSE_NAME_KEY] = mons_type_name(monster->type,
+ DESC_PLAIN);
+
return (corpse_class);
}
@@ -1327,8 +1333,7 @@ void monster_die(monsters *monster, killer_type killer,
if (death_message)
mpr("A glowing mist starts to gather...");
- name_zombified_unique(&menv[spectre], monster->type,
- monster->name(DESC_PLAIN));
+ name_zombie(&menv[spectre], monster);
}
}
}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index a2d3b02012..15198e1095 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -5553,7 +5553,6 @@ void yred_make_enslaved_soul(monsters *mon, bool force_hostile,
const std::string whose =
player_monster_visible(mon) ? apostrophise(mon->name(DESC_CAP_THE))
: "Its";
- const std::string name = mon->name(DESC_PLAIN);
int corps = -1;
bool twisted = allow_fail && coinflip();
@@ -5585,6 +5584,7 @@ void yred_make_enslaved_soul(monsters *mon, bool force_hostile,
// Drop the monster's equipment.
monster_drop_ething(mon);
+ const monsters orig = *mon;
define_monster(*mon);
mon->colour = EC_UNHOLY;
@@ -5604,7 +5604,7 @@ void yred_make_enslaved_soul(monsters *mon, bool force_hostile,
destroy_item(corps);
}
- name_zombified_unique(mon, type, name);
+ name_zombie(mon, &orig);
mon->attitude = !force_hostile ? ATT_FRIENDLY : ATT_HOSTILE;
behaviour_event(mon, ME_ALERT, !force_hostile ? MHITNOT : MHITYOU);
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 93cee741c4..9d07e15a2c 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -865,8 +865,8 @@ static bool _raise_remains(const coord_def &a, int corps, beh_type beha,
{
const int monnum = item.orig_monnum - 1;
- name_zombified_unique(&menv[monster], monnum,
- origin_monster_name(item));
+ if (is_named_corpse(item))
+ name_zombie(&menv[monster], monnum, get_corpse_name(item));
equip_undead(a, corps, monster, monnum);