The inventory
Items · What worn items change · InventorySlotMask
In brief
Each character has 27 inventory slots: two hands, a backpack of fourteen slots, a quiver, five slots of worn equipment, three belt slots and two rings. A slot accepts an item when the masks of the slot and of the item's type share a bit. The player carries one item at a time on the pointer, or moves it with the keyboard; a cursed item cannot leave a hand. Some items need the first hand or both hands, which can make the second hand unusable.
Inventory slots
Each character has 27 inventory slots. A slot accepts the item types whose
InventorySlotMask shares a bit with the
slot's own mask:1
| Slots | Holds | Mask |
|---|---|---|
| 0, 1 | The two hands | INVENTORY_SLOT_HAND |
| 2–15 | The backpack: any item | all bits |
| 16 | The quiver: a pile of arrows | INVENTORY_SLOT_QUIVER |
| 17 | Body armour, robe or cloak | INVENTORY_SLOT_BODY_ARMOUR |
| 18 | Bracers | INVENTORY_SLOT_BRACERS |
| 19 | Helmet | INVENTORY_SLOT_HELMET |
| 20 | Amulet or necklace | INVENTORY_SLOT_NECK |
| 21 | Boots | INVENTORY_SLOT_BOOTS |
| 22 | Belt: any item (see below) | all bits |
| 23, 24 | Belt: small items | INVENTORY_SLOT_BELT |
| 25, 26 | Rings | INVENTORY_SLOT_RING |
In the original data, every item that fits some slot can also be held in a hand, and the weapons conjured by spells fit no slot at all; the item catalogue gives the mask of each item type. The quiver is not a single item: slot 16 holds the first arrow of a pile, the other arrows are chained to it, and the inventory page shows how many there are.
The top belt slot, 22, accepts any item, like the backpack, while the two belt slots below it accept only small items. Armour, a shield or a two-handed weapon can be stored there. A faithful reimplementation keeps the mask of slot 22 as it is.
ANOMALY-154 — Horns fit the two ring slots: the mask of ITEM_TYPE_HORN has
INVENTORY_SLOT_RING, which only the two ring types otherwise have. No rule
reads a horn there: the search for a worn ring needs an ITEM_TYPE_RING and
the defense an ITEM_KIND_WORN item, so the only effect in play is one more
place to store a horn (inferred). A faithful reimplementation keeps the bit
in the horn's mask.2
Moving and equipping items
With a mouse, the player carries one item at a time on the pointer. On the inventory page of a character, clicking a slot exchanges the carried item with the slot's item; clicking the quiver takes its top arrow when the pointer is empty, or adds the carried arrow to the pile. Clicking a hand on a portrait with the left button exchanges the carried item with that hand; the other button uses the item (inferred from the button code tested). With the keyboard, the selected hand or slot plays the role of the pointer: an item given to it that it cannot take falls on the floor of the party's block, in one of the two front quarters chosen at random.3
When an item reaches the pointer, or the selected slot in keyboard control, the message area at the bottom of the screen shows "name taken.". The message appears only while that message area is the active text window, that is during ordinary play and on the inventory page, not in the camp menus, dialogues or character creation, and not for an item the selected slot refused.4
The game refuses a move:
- when the item does not fit the slot: "You can't put that item there.";
- when a character's class may not wear the body armour: "name can't wear that type of armor.";
- when a hand holds a cursed item (
ITEM_RUNTIME_CURSED), which cannot be taken out or replaced: a cursed weapon gives "name cannot release the weapon! It is cursed!", any other cursed item in a hand stays without a message.
On a portrait, refused exchanges give no message; that exchange compares only the hand bits of the masks and applies no class rule. No class rule applies to slots other than the body armour, and no rule on two-handed weapons applies when an item is moved: those rules decide what the item does once in place. Every exchange made by the player, on the inventory page or on a portrait, computes the character's defense again.
The curse binds only the two hands. A cursed item in any other slot moves like any other item: the amulet of resurrection, a cursed item of level 12, can be put on the neck and taken off again. Only the keyboard's drop and throw refuse a cursed item wherever it is (see items on the floor). A conjured weapon is cursed and its type has mask 0: it can neither be released from its hand nor placed in any slot.5
The selected character
The game keeps one selected character. In keyboard control it is the character whose hand or slot the keys move between, and a frame marks the selected hand. With the mouse, it is the last present character whose portrait box the player clicked, anywhere in the box, since the box's own button is tested before the name, face and hand buttons and lets the click through to them; the inventory page's previous and next buttons also change it. After two characters swap places, the selection is the place clicked second, which then holds the character clicked first. It is character 0 at the start of a game and after a character is removed. In mouse play nothing on the screen appears to mark it outside the inventory page; this is inferred from the drawing code, which shows the selection only on that page and in keyboard control. The selected character is the one whose inventory page is shown, and the thrower of an item thrown from the pointer; using a hand item does not depend on it.6
Two hands
Each item type says how many hands it needs (hand_requirement_raw); the
item catalogue gives it for each type:7
| Needs | Effect on the second hand |
|---|---|
| any hand | can be used from the second hand |
| first hand | a weapon that needs it cannot be used from the second hand |
| both hands | in the first hand, makes the second hand unusable |
The second hand cannot be used while the first holds an item needing both hands, even when the second is empty, nor while it holds a weapon that needs the first hand. A hand also cannot be used with an item the character's class may not use. The portrait draws a hand that cannot be used, or that is recovering from its last use, as unavailable.
Sources
Locations refer to the game executable reference.