From 61ec8a7fa04194b79d14e8a552d4ecbad940d4dc Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sun, 28 Jun 2009 05:36:43 +0000 Subject: Now any noisy unrandart weapon can have its own set of messages, not just the Singing Sword. No new messages for the spear of the Botono or the Elemental Staff, though. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10066 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/art-data.txt | 5 ++++- crawl-ref/source/art-func.h | 3 --- crawl-ref/source/artefact.h | 4 ---- crawl-ref/source/dat/database/wpnnoise.txt | 6 ++++-- crawl-ref/source/it_use3.cc | 10 ++++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crawl-ref/source/art-data.txt b/crawl-ref/source/art-data.txt index 346b282dc6..8d49c1ad8c 100644 --- a/crawl-ref/source/art-data.txt +++ b/crawl-ref/source/art-data.txt @@ -81,7 +81,10 @@ # * lev: Lets wearer evoke levitation ability. # * life: Grants negative energy resistance. # * mapping: Lets wearer evoke magic mapping ability. -# * noises: Weapon makes noises. +# * noises: Weapon makes noises. Can be given its own set of noises by +# making an entry in dat/database/wpnnoise.txt, with the +# entry's key exactly the same as the weapon's name, but all +# lowercase. # * nospell: Prevents wearer from casting spells. # * notelep: Prevents wearer from teleporting or blinking. # * poison: Grants poison resistance. diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h index e5a54cf691..bcc19c9851 100644 --- a/crawl-ref/source/art-func.h +++ b/crawl-ref/source/art-func.h @@ -284,9 +284,6 @@ static void _SINGING_SWORD_equip(item_def *item, bool *show_msgs, bool unmeld) mpr("The Singing Sword hums in delight!", MSGCH_TALK); *show_msgs = false; - - // Make noisy_equipment() use a special speech database key. - item->props[ART_NOISE_KEY] = "Singing Sword"; } static void _SINGING_SWORD_unequip(const item_def *item, bool *show_msgs) diff --git a/crawl-ref/source/artefact.h b/crawl-ref/source/artefact.h index 0844c2fc4c..19f403d14e 100644 --- a/crawl-ref/source/artefact.h +++ b/crawl-ref/source/artefact.h @@ -12,10 +12,6 @@ #include "externs.h" -// Artefacts which make noise can use this key to use a different -// speech database key than the default. -#define ART_NOISE_KEY "art_noise_key" - // NOTE: NO_UNRANDARTS is automatically set by util/art-data.pl #define NO_UNRANDARTS 76 diff --git a/crawl-ref/source/dat/database/wpnnoise.txt b/crawl-ref/source/dat/database/wpnnoise.txt index 782ae722e6..d26029f086 100644 --- a/crawl-ref/source/dat/database/wpnnoise.txt +++ b/crawl-ref/source/dat/database/wpnnoise.txt @@ -4,8 +4,10 @@ # messages, and adding new ones really easy. # # wpnnoise.txt contains the messages of randart weapons with -# the noise property and of the Singing Sword, one of -# Crawl's fixed artefacts. +# the noise property and of the noisy unrandart weapons, +# like the Singing Sword. To make an entry for a noisy +# unrandart weapon, make the entry's key exactly the same as +# the weapon's name, but all lower case. # # For an explanation of how to read wpnnoise.txt and how to # add new messages, see monster_speech.txt in the docs diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 7101226165..6fb7225d66 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -61,10 +61,11 @@ void noisy_equipment() const item_def* weapon = you.weapon(); - if (weapon && weapon->props.exists(ART_NOISE_KEY)) + if (weapon && is_unrandom_artefact(*weapon)) { - const std::string key = weapon->props[ART_NOISE_KEY]; - msg = getSpeakString(key); + std::string name = weapon->name(DESC_PLAIN, false, true, false, false, + ISFLAG_IDENT_MASK); + msg = getSpeakString(name.c_str()); if (!msg.empty()) { // "Your Singing Sword" sounds disrespectful @@ -73,7 +74,8 @@ void noisy_equipment() msg = replace_all(msg, "@your_weapon@", "@the_weapon@"); } } - else + + if (msg.empty()) { msg = getSpeakString("noisy weapon"); if (!msg.empty()) -- cgit v1.2.3-54-g00ecf