Context sensitive item usage from inventory

Allow selecting an item from inventory and show a menu of actions
applicable for that particular item. Some of the entries might
be slightly spoilerish (eg. it'll reveal that you can read T-shirts),
but the improved usability for new players is more than worth it.

Generally known as "item actions", this was first implemented
in AceHack by Alex Smith.
This commit is contained in:
Pasi Kallinen
2022-04-09 15:19:52 +03:00
parent dde1ae2e9b
commit e53a4c0abd
4 changed files with 370 additions and 5 deletions

View File

@@ -4514,6 +4514,7 @@ enum menucmd {
MCMD_ATTACK_NEXT2U,
MCMD_UNTRAP_HERE,
MCMD_OFFER,
MCMD_INVENTORY,
MCMD_THROW_OBJ,
MCMD_TRAVEL,
@@ -4596,9 +4597,11 @@ there_cmd_menu_self(winid win, int x, int y, int *act UNUSED)
}
}
if (g.invent)
mcmd_addmenu(win, MCMD_DROP, "Drop items"), ++K;
if (g.invent) {
mcmd_addmenu(win, MCMD_INVENTORY, "Inventory"), ++K;
mcmd_addmenu(win, MCMD_DROP, "Drop items"), ++K;
}
mcmd_addmenu(win, MCMD_REST, "Rest one turn"), ++K;
mcmd_addmenu(win, MCMD_SEARCH, "Search around you"), ++K;
mcmd_addmenu(win, MCMD_LOOK_HERE, "Look at what is here"), ++K;
@@ -4899,6 +4902,9 @@ there_cmd_menu(int x, int y, int mod)
case MCMD_DROP:
cmdq_add_ec(dodrop);
break;
case MCMD_INVENTORY:
cmdq_add_ec(ddoinv);
break;
case MCMD_REST:
cmdq_add_ec(donull);
break;