new featurette: '-' in inventory menu
Requested during beta testing last year, include a menu entry of
"- - your bare hands" (or "your gloved hands") for wielding,
"- - empty quiver" for readying quiver,
"- - your fingertip" for engraving, or
"- - your fingers" for applying grease
if the user responds with '?' or '*' at the
"What do you want to {wield|ready|write with|grease}? [- abc or ?*]"
getobj prompt. (First dash is inventory selector 'letter', second
dash is menu separator between the letter and its choice description.)
This commit is contained in:
@@ -222,6 +222,8 @@ allow showing coordinates when picking a position on the map and
|
|||||||
new status line conditions Stone Strngl Deaf Lev Fly Ride
|
new status line conditions Stone Strngl Deaf Lev Fly Ride
|
||||||
allow some extra color name aliases for menucolors and status hilites
|
allow some extra color name aliases for menucolors and status hilites
|
||||||
add extended command #kick
|
add extended command #kick
|
||||||
|
when choosing an inventory item and '-' for bare-hands/fingers/no-ammo is a
|
||||||
|
choice, include that in the inventory menu if player types '?' or '*'
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific New Features
|
Platform- and/or Interface-Specific New Features
|
||||||
|
|||||||
+3
-4
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 engrave.c $NHDT-Date: 1455491569 2016/02/14 23:12:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.60 $ */
|
/* NetHack 3.6 engrave.c $NHDT-Date: 1456304550 2016/02/24 09:02:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -535,7 +535,7 @@ doengrave()
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (otmp == &zeroobj) {
|
if (otmp == &zeroobj) {
|
||||||
Strcat(strcpy(fbuf, "your "), makeplural(body_part(FINGER)));
|
Strcat(strcpy(fbuf, "your "), body_part(FINGERTIP));
|
||||||
writer = fbuf;
|
writer = fbuf;
|
||||||
} else
|
} else
|
||||||
writer = yname(otmp);
|
writer = yname(otmp);
|
||||||
@@ -993,8 +993,7 @@ doengrave()
|
|||||||
if (otmp != &zeroobj)
|
if (otmp != &zeroobj)
|
||||||
You("%s the %s with %s.", everb, eloc, doname(otmp));
|
You("%s the %s with %s.", everb, eloc, doname(otmp));
|
||||||
else
|
else
|
||||||
You("%s the %s with your %s.", everb, eloc,
|
You("%s the %s with your %s.", everb, eloc, body_part(FINGERTIP));
|
||||||
makeplural(body_part(FINGER)));
|
|
||||||
|
|
||||||
/* Prompt for engraving! */
|
/* Prompt for engraving! */
|
||||||
Sprintf(qbuf, "What do you want to %s the %s here?", everb, eloc);
|
Sprintf(qbuf, "What do you want to %s the %s here?", everb, eloc);
|
||||||
|
|||||||
+74
-34
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 invent.c $NHDT-Date: 1454061993 2016/01/29 10:06:33 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.193 $ */
|
/* NetHack 3.6 invent.c $NHDT-Date: 1456304571 2016/02/24 09:02:51 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.194 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#define NOINVSYM '#'
|
#define NOINVSYM '#'
|
||||||
#define CONTAINED_SYM '>' /* designator for inside a container */
|
#define CONTAINED_SYM '>' /* designator for inside a container */
|
||||||
|
#define HANDS_SYM '-'
|
||||||
|
|
||||||
STATIC_DCL int FDECL(CFDECLSPEC sortloot_cmp, (struct obj *, struct obj *));
|
STATIC_DCL int FDECL(CFDECLSPEC sortloot_cmp, (struct obj *, struct obj *));
|
||||||
STATIC_DCL void NDECL(reorder_invent);
|
STATIC_DCL void NDECL(reorder_invent);
|
||||||
@@ -21,7 +22,8 @@ STATIC_PTR int FDECL(ckunpaid, (struct obj *));
|
|||||||
STATIC_PTR int FDECL(ckvalidcat, (struct obj *));
|
STATIC_PTR int FDECL(ckvalidcat, (struct obj *));
|
||||||
STATIC_PTR char *FDECL(safeq_xprname, (struct obj *));
|
STATIC_PTR char *FDECL(safeq_xprname, (struct obj *));
|
||||||
STATIC_PTR char *FDECL(safeq_shortxprname, (struct obj *));
|
STATIC_PTR char *FDECL(safeq_shortxprname, (struct obj *));
|
||||||
STATIC_DCL char FDECL(display_pickinv, (const char *, BOOLEAN_P, long *));
|
STATIC_DCL char FDECL(display_pickinv, (const char *, const char *,
|
||||||
|
BOOLEAN_P, long *));
|
||||||
STATIC_DCL char FDECL(display_used_invlets, (CHAR_P));
|
STATIC_DCL char FDECL(display_used_invlets, (CHAR_P));
|
||||||
STATIC_DCL void FDECL(tally_BUCX,
|
STATIC_DCL void FDECL(tally_BUCX,
|
||||||
(struct obj *, int *, int *, int *, int *, int *));
|
(struct obj *, int *, int *, int *, int *, int *));
|
||||||
@@ -1004,9 +1006,7 @@ register const char *let, *word;
|
|||||||
useboulder = TRUE;
|
useboulder = TRUE;
|
||||||
|
|
||||||
if (allownone)
|
if (allownone)
|
||||||
*bp++ = '-';
|
*bp++ = HANDS_SYM, *bp++ = ' '; /* '-' */
|
||||||
if (bp > buf && bp[-1] == '-')
|
|
||||||
*bp++ = ' ';
|
|
||||||
ap = altlets;
|
ap = altlets;
|
||||||
|
|
||||||
if (!flags.invlet_constant)
|
if (!flags.invlet_constant)
|
||||||
@@ -1184,6 +1184,7 @@ register const char *let, *word;
|
|||||||
ilet = yn_function(qbuf, (char *) 0, '\0');
|
ilet = yn_function(qbuf, (char *) 0, '\0');
|
||||||
if (digit(ilet)) {
|
if (digit(ilet)) {
|
||||||
long tmpcnt = 0;
|
long tmpcnt = 0;
|
||||||
|
|
||||||
if (!allowcnt) {
|
if (!allowcnt) {
|
||||||
pline("No count allowed with this command.");
|
pline("No count allowed with this command.");
|
||||||
continue;
|
continue;
|
||||||
@@ -1199,7 +1200,7 @@ register const char *let, *word;
|
|||||||
pline1(Never_mind);
|
pline1(Never_mind);
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
}
|
}
|
||||||
if (ilet == '-') {
|
if (ilet == HANDS_SYM) { /* '-' */
|
||||||
if (!allownone) {
|
if (!allownone) {
|
||||||
char *suf = (char *) 0;
|
char *suf = (char *) 0;
|
||||||
|
|
||||||
@@ -1225,21 +1226,34 @@ register const char *let, *word;
|
|||||||
char *allowed_choices = (ilet == '?') ? lets : (char *) 0;
|
char *allowed_choices = (ilet == '?') ? lets : (char *) 0;
|
||||||
long ctmp = 0;
|
long ctmp = 0;
|
||||||
|
|
||||||
|
qbuf[0] = '\0';
|
||||||
|
if (!strcmp(word, "grease"))
|
||||||
|
Sprintf(qbuf, "your %s", makeplural(body_part(FINGER)));
|
||||||
|
else if (!strcmp(word, "write with"))
|
||||||
|
Sprintf(qbuf, "your %s", body_part(FINGERTIP));
|
||||||
|
else if (!strcmp(word, "wield"))
|
||||||
|
Sprintf(qbuf, "your %s %s", uarmg ? "gloved" : "bare",
|
||||||
|
makeplural(body_part(HAND)));
|
||||||
|
else if (!strcmp(word, "ready"))
|
||||||
|
Strcpy(qbuf, "empty quiver");
|
||||||
|
|
||||||
if (ilet == '?' && !*lets && *altlets)
|
if (ilet == '?' && !*lets && *altlets)
|
||||||
allowed_choices = altlets;
|
allowed_choices = altlets;
|
||||||
ilet = display_pickinv(allowed_choices, TRUE,
|
ilet = display_pickinv(allowed_choices, *qbuf ? qbuf : (char *) 0,
|
||||||
allowcnt ? &ctmp : (long *) 0);
|
TRUE, allowcnt ? &ctmp : (long *) 0);
|
||||||
if (!ilet)
|
if (!ilet)
|
||||||
continue;
|
continue;
|
||||||
if (allowcnt && ctmp >= 0) {
|
if (ilet == HANDS_SYM)
|
||||||
cnt = ctmp;
|
return &zeroobj;
|
||||||
cntgiven = TRUE;
|
|
||||||
}
|
|
||||||
if (ilet == '\033') {
|
if (ilet == '\033') {
|
||||||
if (flags.verbose)
|
if (flags.verbose)
|
||||||
pline1(Never_mind);
|
pline1(Never_mind);
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
}
|
}
|
||||||
|
if (allowcnt && ctmp >= 0) {
|
||||||
|
cnt = ctmp;
|
||||||
|
cntgiven = TRUE;
|
||||||
|
}
|
||||||
/* they typed a letter (not a space) at the prompt */
|
/* they typed a letter (not a space) at the prompt */
|
||||||
}
|
}
|
||||||
/* find the item which was picked */
|
/* find the item which was picked */
|
||||||
@@ -1905,16 +1919,17 @@ long quan; /* if non-0, print this quantity, not obj->quan */
|
|||||||
#else
|
#else
|
||||||
static char li[BUFSZ];
|
static char li[BUFSZ];
|
||||||
#endif
|
#endif
|
||||||
boolean use_invlet = flags.invlet_constant && let != CONTAINED_SYM;
|
boolean use_invlet = (flags.invlet_constant
|
||||||
|
&& let != CONTAINED_SYM && let != HANDS_SYM);
|
||||||
long savequan = 0;
|
long savequan = 0;
|
||||||
|
|
||||||
if (quan && obj) {
|
if (quan && obj) {
|
||||||
savequan = obj->quan;
|
savequan = obj->quan;
|
||||||
obj->quan = quan;
|
obj->quan = quan;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If let is:
|
* If let is:
|
||||||
|
* - Then obj == null and 'txt' refers to hands or fingers.
|
||||||
* * Then obj == null and we are printing a total amount.
|
* * Then obj == null and we are printing a total amount.
|
||||||
* > Then the object is contained and doesn't have an inventory letter.
|
* > Then the object is contained and doesn't have an inventory letter.
|
||||||
*/
|
*/
|
||||||
@@ -1995,8 +2010,9 @@ free_pickinv_cache()
|
|||||||
* any count returned from the menu selection is placed here.
|
* any count returned from the menu selection is placed here.
|
||||||
*/
|
*/
|
||||||
STATIC_OVL char
|
STATIC_OVL char
|
||||||
display_pickinv(lets, want_reply, out_cnt)
|
display_pickinv(lets, xtra_choice, want_reply, out_cnt)
|
||||||
register const char *lets;
|
register const char *lets;
|
||||||
|
const char *xtra_choice; /* "fingers", pick hands rather than an object */
|
||||||
boolean want_reply;
|
boolean want_reply;
|
||||||
long *out_cnt;
|
long *out_cnt;
|
||||||
{
|
{
|
||||||
@@ -2009,7 +2025,7 @@ long *out_cnt;
|
|||||||
menu_item *selected;
|
menu_item *selected;
|
||||||
struct obj **oarray;
|
struct obj **oarray;
|
||||||
|
|
||||||
if (flags.perm_invent && lets && *lets) {
|
if (flags.perm_invent && ((lets && *lets) || xtra_choice)) {
|
||||||
/* partial inventory in perm_invent setting; don't operate on
|
/* partial inventory in perm_invent setting; don't operate on
|
||||||
full inventory window, use an alternate one instead; create
|
full inventory window, use an alternate one instead; create
|
||||||
the first time needed and keep it for re-use as needed later */
|
the first time needed and keep it for re-use as needed later */
|
||||||
@@ -2029,8 +2045,17 @@ long *out_cnt;
|
|||||||
* don't know at this level if its up or not. This may not be
|
* don't know at this level if its up or not. This may not be
|
||||||
* an issue if empty checks are done before hand and the call
|
* an issue if empty checks are done before hand and the call
|
||||||
* to here is short circuited away.
|
* to here is short circuited away.
|
||||||
|
*
|
||||||
|
* 2: our count here is only to distinguish between 0 and 1 and
|
||||||
|
* more than 1; for the last one, we don't need a precise number.
|
||||||
|
* For perm_invent update we force 'more than 1'.
|
||||||
*/
|
*/
|
||||||
if (!invent && !(flags.perm_invent && !lets && !want_reply)) {
|
n = (flags.perm_invent && !lets && !want_reply) ? 2
|
||||||
|
: lets ? (int) strlen(lets)
|
||||||
|
: !invent ? 0 : !invent->nobj ? 1 : 2;
|
||||||
|
if (xtra_choice || (iflags.override_ID && n == 1))
|
||||||
|
++n;
|
||||||
|
if (n == 0) {
|
||||||
pline("Not carrying anything.");
|
pline("Not carrying anything.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2039,31 +2064,37 @@ long *out_cnt;
|
|||||||
if (!flags.invlet_constant)
|
if (!flags.invlet_constant)
|
||||||
reassign();
|
reassign();
|
||||||
|
|
||||||
if (lets && strlen(lets) == 1 && !iflags.override_ID) {
|
if (n == 1 && (lets || xtra_choice)) {
|
||||||
/* when only one item of interest, use pline instead of menus;
|
/* when only one item of interest, use pline instead of menus;
|
||||||
we actually use a fake message-line menu in order to allow
|
we actually use a fake message-line menu in order to allow
|
||||||
the user to perform selection at the --More-- prompt for tty */
|
the user to perform selection at the --More-- prompt for tty */
|
||||||
ret = '\0';
|
ret = '\0';
|
||||||
for (otmp = invent; otmp; otmp = otmp->nobj) {
|
if (xtra_choice) {
|
||||||
if (otmp->invlet == lets[0]) {
|
/* xtra_choice is "bare hands" (wield), "fingertip" (Engrave),
|
||||||
ret = message_menu(
|
"nothing" (ready Quiver), or "fingers" (apply grease) */
|
||||||
lets[0], want_reply ? PICK_ONE : PICK_NONE,
|
ret = message_menu(HANDS_SYM, PICK_ONE,
|
||||||
xprname(otmp, (char *) 0, lets[0], TRUE, 0L, 0L));
|
xprname((struct obj *) 0, xtra_choice,
|
||||||
if (out_cnt)
|
HANDS_SYM, TRUE, 0L, 0L)); /* '-' */
|
||||||
*out_cnt = -1L; /* select all */
|
} else {
|
||||||
break;
|
for (otmp = invent; otmp; otmp = otmp->nobj)
|
||||||
}
|
if (!lets || otmp->invlet == lets[0])
|
||||||
|
break;
|
||||||
|
if (otmp)
|
||||||
|
ret = message_menu(otmp->invlet,
|
||||||
|
want_reply ? PICK_ONE : PICK_NONE,
|
||||||
|
xprname(otmp, (char *) 0, lets[0],
|
||||||
|
TRUE, 0L, 0L));
|
||||||
}
|
}
|
||||||
|
if (out_cnt)
|
||||||
|
*out_cnt = -1L; /* select all */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* count the number of items */
|
/* count the number of items (previous count of 0,1,more is obsolete) */
|
||||||
for (n = 0, otmp = invent; otmp; otmp = otmp->nobj)
|
for (n = 0, otmp = invent; otmp; otmp = otmp->nobj)
|
||||||
if (!lets || !*lets || index(lets, otmp->invlet))
|
if (!lets || !*lets || index(lets, otmp->invlet))
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
oarray = objarr_init(n);
|
oarray = objarr_init(n);
|
||||||
|
|
||||||
/* Add objects to the array */
|
/* Add objects to the array */
|
||||||
i = 0;
|
i = 0;
|
||||||
for (otmp = invent; otmp; otmp = otmp->nobj)
|
for (otmp = invent; otmp; otmp = otmp->nobj)
|
||||||
@@ -2074,14 +2105,23 @@ long *out_cnt;
|
|||||||
start_menu(win);
|
start_menu(win);
|
||||||
any = zeroany;
|
any = zeroany;
|
||||||
if (wizard && iflags.override_ID) {
|
if (wizard && iflags.override_ID) {
|
||||||
char prompt[BUFSZ];
|
char prompt[QBUFSZ];
|
||||||
|
|
||||||
any.a_char = -1;
|
any.a_char = -1;
|
||||||
/* wiz_identify stuffed the wiz_identify cmd character
|
/* wiz_identify stuffed the wiz_identify command character (^I)
|
||||||
into iflags.override_ID */
|
into iflags.override_ID for our use as an accelerator */
|
||||||
Sprintf(prompt, "Debug Identify (%s to permanently identify)",
|
Sprintf(prompt, "Debug Identify (%s to permanently identify)",
|
||||||
visctrl(iflags.override_ID));
|
visctrl(iflags.override_ID));
|
||||||
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
|
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
|
||||||
prompt, MENU_UNSELECTED);
|
prompt, MENU_UNSELECTED);
|
||||||
|
} else if (xtra_choice) {
|
||||||
|
/* wizard override ID and xtra_choice are mutually exclusive */
|
||||||
|
if (flags.sortpack)
|
||||||
|
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
|
||||||
|
"Miscellaneous", MENU_UNSELECTED);
|
||||||
|
any.a_char = HANDS_SYM; /* '-' */
|
||||||
|
add_menu(win, NO_GLYPH, &any, HANDS_SYM, 0, ATR_NONE,
|
||||||
|
xtra_choice, MENU_UNSELECTED);
|
||||||
}
|
}
|
||||||
nextclass:
|
nextclass:
|
||||||
classcount = 0;
|
classcount = 0;
|
||||||
@@ -2138,7 +2178,7 @@ display_inventory(lets, want_reply)
|
|||||||
const char *lets;
|
const char *lets;
|
||||||
boolean want_reply;
|
boolean want_reply;
|
||||||
{
|
{
|
||||||
return display_pickinv(lets, want_reply, (long *) 0);
|
return display_pickinv(lets, (char *) 0, want_reply, (long *) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user