From 0e761c3e30e6575b91aa11eb86b5bb01b30c6081 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 18 Mar 2023 21:47:34 -0700 Subject: [PATCH] talking artifact inconsistency To get the Magic Mirror of Merlin to speak, you could apply it in any direction (or wield it). To get the Master Key of Thievery to speak, you had to apply it toward an adjacent doorway or down while on a container (or wield it). Make the key behave like the mirror. --- include/extern.h | 2 +- src/apply.c | 5 +++-- src/artifact.c | 8 ++++---- src/wield.c | 4 +++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/extern.h b/include/extern.h index 938adcb21..be1554b2e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -92,7 +92,7 @@ extern boolean artifact_hit(struct monst *, struct monst *, struct obj *, int *, int); extern int doinvoke(void); extern boolean finesse_ahriman(struct obj *); -extern void arti_speak(struct obj *); +extern int arti_speak(struct obj *); extern boolean artifact_light(struct obj *); extern long spec_m2(struct obj *); extern boolean artifact_has_invprop(struct obj *, uchar); diff --git a/src/apply.c b/src/apply.c index b1378b860..1501ebf0f 100644 --- a/src/apply.c +++ b/src/apply.c @@ -4181,8 +4181,9 @@ doapply(void) pline("Sorry, I don't know how to use that."); return ECMD_FAIL; } - if ((res & ECMD_TIME) && obj && obj->oartifact) - arti_speak(obj); + if (obj && obj->oartifact) { + res |= arti_speak(obj); /* sets ECMD_TIME bit if artifact speaks */ + } return res; } diff --git a/src/artifact.c b/src/artifact.c index 5f56d9ecf..7a90b4119 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1986,16 +1986,16 @@ artifact_light(struct obj *obj) } /* KMH -- Talking artifacts are finally implemented */ -void +int arti_speak(struct obj *obj) { - register const struct artifact *oart = get_artifact(obj); + const struct artifact *oart = get_artifact(obj); const char *line; char buf[BUFSZ]; /* Is this a speaking artifact? */ if (!oart || !(oart->spfx & SPFX_SPEAK)) - return; + return ECMD_OK; /* nothing happened */ line = getrumor(bcsign(obj), buf, TRUE); if (!*line) @@ -2003,7 +2003,7 @@ arti_speak(struct obj *obj) pline("%s:", Tobjnam(obj, "whisper")); SetVoice((struct monst *) 0, 0, 80, voice_talking_artifact); verbalize1(line); - return; + return ECMD_TIME; } boolean diff --git a/src/wield.c b/src/wield.c index c9b9ef89a..456911adc 100644 --- a/src/wield.c +++ b/src/wield.c @@ -230,7 +230,9 @@ ready_weapon(struct obj *wep) } /* KMH -- Talking artifacts are finally implemented */ - arti_speak(wep); + if (wep && wep->oartifact) { + res |= arti_speak(wep); /* sets ECMD_TIME bit if artifact speaks */ + } if (artifact_light(wep) && !wep->lamplit) { begin_burn(wep, FALSE);