item-action refinements for name/call and read
Switch the verb from "name" to "call" for type-naming. Format menu
choices for name or call of unique items more carefully.
Read actions got some extra details so move them out of the main
item-action routine to avoid cluttering it up.
Avoid "r - Study the spellbook" for novels. It's changed for known
Book of the Dead too, but I'm not sure "r - Examine the tome" conveys
"read" sufficiently. ("Read" and "peruse" seem too mundane for it;
perhaps it should revert to "study" even though the hero isn't
attempting to learn a spell from it.)
Change "r - cast the spell on this scroll" to "r - read this scroll
to activate its magic". Leave off the last phrase if it's a known
scroll of blank paper or scroll of mail.
This commit is contained in:
+57
-17
@@ -36,6 +36,7 @@ static int adjust_ok(struct obj *);
|
|||||||
static int adjust_gold_ok(struct obj *);
|
static int adjust_gold_ok(struct obj *);
|
||||||
static char obj_to_let(struct obj *);
|
static char obj_to_let(struct obj *);
|
||||||
static boolean item_naming_classification(struct obj *, char *, char *);
|
static boolean item_naming_classification(struct obj *, char *, char *);
|
||||||
|
static int item_reading_classification(struct obj *, char *);
|
||||||
static void mime_action(const char *);
|
static void mime_action(const char *);
|
||||||
|
|
||||||
/* wizards can wish for venom, which will become an invisible inventory
|
/* wizards can wish for venom, which will become an invisible inventory
|
||||||
@@ -2537,28 +2538,78 @@ enum item_action_actions {
|
|||||||
static boolean
|
static boolean
|
||||||
item_naming_classification(struct obj *obj, char *onamebuf, char *ocallbuf)
|
item_naming_classification(struct obj *obj, char *onamebuf, char *ocallbuf)
|
||||||
{
|
{
|
||||||
static const char Name[] = "Name", Rename[] = "Rename or unname";
|
static const char Name[] = "Name", Rename[] = "Rename or un-name",
|
||||||
|
/* "re-call" seems a bit weird, but "recall" and
|
||||||
|
"rename" don't fit for changing a type name */
|
||||||
|
Call[] = "Call", Recall[] = "Re-call or un-call";
|
||||||
|
|
||||||
onamebuf[0] = ocallbuf[0] = '\0';
|
onamebuf[0] = ocallbuf[0] = '\0';
|
||||||
if (name_ok(obj) == GETOBJ_SUGGEST) {
|
if (name_ok(obj) == GETOBJ_SUGGEST) {
|
||||||
Sprintf(onamebuf, "%s %s %s",
|
Sprintf(onamebuf, "%s %s %s",
|
||||||
(!has_oname(obj) || !*ONAME(obj)) ? Name : Rename,
|
(!has_oname(obj) || !*ONAME(obj)) ? Name : Rename,
|
||||||
!is_plural(obj) ? "this" : "these",
|
the_unique_obj(obj) ? "the"
|
||||||
|
: !is_plural(obj) ? "this"
|
||||||
|
: "these",
|
||||||
simpleonames(obj));
|
simpleonames(obj));
|
||||||
}
|
}
|
||||||
if (call_ok(obj) == GETOBJ_SUGGEST) {
|
if (call_ok(obj) == GETOBJ_SUGGEST) {
|
||||||
char *callname = simpleonames(obj);
|
char *callname = simpleonames(obj);
|
||||||
|
|
||||||
if (!is_plural(obj)) /* when not already plural, force plural */
|
/* prefix known unique item with "the", make all other types plural */
|
||||||
|
if (the_unique_obj(obj)) /* treats unID'd fake amulets as if real */
|
||||||
|
callname = the(callname);
|
||||||
|
else if (!is_plural(obj))
|
||||||
callname = makeplural(callname);
|
callname = makeplural(callname);
|
||||||
Sprintf(ocallbuf, "%s the type for %s",
|
Sprintf(ocallbuf, "%s the type for %s",
|
||||||
(!objects[obj->otyp].oc_uname
|
(!objects[obj->otyp].oc_uname
|
||||||
|| !*objects[obj->otyp].oc_uname) ? Name : Rename,
|
|| !*objects[obj->otyp].oc_uname) ? Call : Recall,
|
||||||
callname);
|
callname);
|
||||||
}
|
}
|
||||||
return (*onamebuf || *ocallbuf) ? TRUE : FALSE;
|
return (*onamebuf || *ocallbuf) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* construct text for the menu entries for IA_READ_OBJ */
|
||||||
|
static int
|
||||||
|
item_reading_classification(struct obj *obj, char *outbuf)
|
||||||
|
{
|
||||||
|
int otyp = obj->otyp, res = IA_READ_OBJ;
|
||||||
|
|
||||||
|
*outbuf = '\0';
|
||||||
|
if (otyp == FORTUNE_COOKIE) {
|
||||||
|
Strcpy(outbuf, "Read the message inside this cookie");
|
||||||
|
} else if (otyp == T_SHIRT) {
|
||||||
|
Strcpy(outbuf, "Read the slogan on the shirt");
|
||||||
|
} else if (otyp == ALCHEMY_SMOCK) {
|
||||||
|
Strcpy(outbuf, "Read the slogan on the apron");
|
||||||
|
} else if (otyp == HAWAIIAN_SHIRT) {
|
||||||
|
Strcpy(outbuf, "Look at the pattern on the shirt");
|
||||||
|
} else if (obj->oclass == SCROLL_CLASS) {
|
||||||
|
const char *magic = ((obj->dknown
|
||||||
|
#ifdef MAIL_STRUCTURES
|
||||||
|
&& otyp != SCR_MAIL
|
||||||
|
#endif
|
||||||
|
&& (otyp != SCR_BLANK_PAPER
|
||||||
|
|| !objects[otyp].oc_name_known))
|
||||||
|
? " to activate its magic" : "");
|
||||||
|
|
||||||
|
Sprintf(outbuf, "Read this scroll%s", magic);
|
||||||
|
} else if (obj->oclass == SPBOOK_CLASS) {
|
||||||
|
boolean novel = (otyp == SPE_NOVEL),
|
||||||
|
blank = (otyp == SPE_BLANK_PAPER
|
||||||
|
&& objects[otyp].oc_name_known),
|
||||||
|
tome = (otyp == SPE_BOOK_OF_THE_DEAD
|
||||||
|
&& objects[otyp].oc_name_known);
|
||||||
|
|
||||||
|
Sprintf(outbuf, "%s this %s",
|
||||||
|
(novel || blank) ? "Read" : tome ? "Examine" : "Study",
|
||||||
|
novel ? simpleonames(obj) /* "novel" or "paperback book" */
|
||||||
|
: tome ? "tome" : "spellbook");
|
||||||
|
} else {
|
||||||
|
res = IA_NONE;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ia_addmenu(winid win, int act, char let, const char *txt)
|
ia_addmenu(winid win, int act, char let, const char *txt)
|
||||||
{
|
{
|
||||||
@@ -2754,19 +2805,8 @@ itemactions(struct obj *otmp)
|
|||||||
"Quiver this item for easy throwing");
|
"Quiver this item for easy throwing");
|
||||||
|
|
||||||
/* r: read item */
|
/* r: read item */
|
||||||
if (otmp->otyp == FORTUNE_COOKIE)
|
if (item_reading_classification(otmp, buf) == IA_READ_OBJ)
|
||||||
ia_addmenu(win, IA_READ_OBJ, 'r',
|
ia_addmenu(win, IA_READ_OBJ, 'r', buf);
|
||||||
"Read the message inside this cookie");
|
|
||||||
else if (otmp->otyp == T_SHIRT)
|
|
||||||
ia_addmenu(win, IA_READ_OBJ, 'r', "Read the slogan on the shirt");
|
|
||||||
else if (otmp->otyp == ALCHEMY_SMOCK)
|
|
||||||
ia_addmenu(win, IA_READ_OBJ, 'r', "Read the slogan on the apron");
|
|
||||||
else if (otmp->otyp == HAWAIIAN_SHIRT)
|
|
||||||
ia_addmenu(win, IA_READ_OBJ, 'r', "Look at the pattern on the shirt");
|
|
||||||
else if (otmp->oclass == SCROLL_CLASS)
|
|
||||||
ia_addmenu(win, IA_READ_OBJ, 'r', "Cast the spell on this scroll");
|
|
||||||
else if (otmp->oclass == SPBOOK_CLASS)
|
|
||||||
ia_addmenu(win, IA_READ_OBJ, 'r', "Study this spellbook");
|
|
||||||
|
|
||||||
/* R: remove accessory or rub item */
|
/* R: remove accessory or rub item */
|
||||||
if (otmp->owornmask & W_ACCESSORY)
|
if (otmp->owornmask & W_ACCESSORY)
|
||||||
|
|||||||
Reference in New Issue
Block a user