extern struct obj *unchanger(void);
extern void reset_remarm(void);
extern int doddoremarm(void);
+extern int remarm_swapwep(void);
extern int destroy_arm(struct obj *);
extern void adj_abon(struct obj *, schar);
extern boolean inaccessible_equipment(struct obj *, const char *, boolean);
{ '\0', "clicklook", NULL, doclicklook, INTERNALCMD, NULL },
{ '\0', "altdip", NULL, dip_into, INTERNALCMD, NULL },
{ '\0', "altadjust", NULL, adjust_split, INTERNALCMD, NULL },
+ { '\0', "altunwield", NULL, remarm_swapwep, INTERNALCMD, NULL },
{ '\0', (char *) 0, (char *) 0, donull, 0, (char *) 0 } /* sentinel */
};
give feedback and discover it iff stealth state is changing */
static
void
-toggle_stealth(struct obj *obj,
- long oldprop, /* prop[].extrinsic, with obj->owornmask
- stripped by caller */
- boolean on)
+toggle_stealth(
+ struct obj *obj,
+ long oldprop, /* prop[].extrinsic, with obj->owornmask pre-stripped */
+ boolean on)
{
if (on ? g.initial_don : g.context.takeoff.cancelled_don)
return;
You("continue %s.", g.context.takeoff.disrobing);
set_occupation(take_off, g.context.takeoff.disrobing, 0);
return ECMD_OK;
- } else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf && !uleft
- && !uright && !wearing_armor()) {
+ } else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf
+ && !uleft && !uright && !wearing_armor()) {
You("are not wearing anything.");
return ECMD_OK;
}
return ECMD_OK;
}
+/* #altunwield - just unwield alternate weapon, item-action '-' when picking
+ uswapwep from context-sensitive inventory */
+int
+remarm_swapwep(void)
+{
+ struct _cmd_queue cq, *cmdq;
+ boolean oldbknown;
+
+ if ((cmdq = cmdq_pop()) != 0) {
+ /* '-' uswapwep item-action picked from context-sensitive invent */
+ cq = *cmdq;
+ free(cmdq);
+ } else {
+ cq.typ = CMDQ_KEY;
+ cq.key = '\0'; /* something other than '-' */
+ }
+ if (cq.typ != CMDQ_KEY || cq.key != '-' || !uswapwep)
+ return ECMD_FAIL;
+
+ oldbknown = uswapwep->bknown; /* when deciding whether this command
+ * has done something that takes time,
+ * behave as if a cursed secondary weapon
+ * can't be unwielded even though things
+ * don't work that way... */
+ reset_remarm();
+ g.context.takeoff.what = g.context.takeoff.mask = W_SWAPWEP;
+ (void) do_takeoff();
+ return (!uswapwep || uswapwep->bknown != oldbknown) ? ECMD_TIME : ECMD_OK;
+}
+
static int
menu_remarm(int retry)
{
/* -: unwield; picking current weapon offers an opportunity for 'w-'
to wield bare/gloved hands; likewise for 'Q-' with quivered item(s) */
- if (otmp == uwep || otmp == uquiver) {
+ if (otmp == uwep || otmp == uswapwep || otmp == uquiver) {
const char *verb = (otmp == uquiver) ? "Quiver" : "Wield",
*action = (otmp == uquiver) ? "un-ready" : "un-wield",
*which = is_plural(otmp) ? "these" : "this",
/*
* TODO: if uwep is ammo, tell player that to shoot instead of toss,
* the corresponding launcher must be wielded;
- * TODO too: if otmp is uswapwep, remove it from that slot (possibly
- * stopping dual-wielding in the process).
*/
Sprintf(buf, "%s '%c' to %s %s %s",
verb, HANDS_SYM, action, which,
break;
case IA_UNWIELD:
cmdq_add_ec((otmp == uwep) ? dowield
- : (otmp == uquiver) ? dowieldquiver
- : donull); /* can't happen */
+ : (otmp == uswapwep) ? remarm_swapwep
+ : (otmp == uquiver) ? dowieldquiver
+ : donull); /* can't happen */
cmdq_add_key('-');
break;
case IA_APPLY_OBJ: