Skip to main content

Inventory slot masks

InventorySlotMask · 16-bit word, inventory_slot_mask of ItemTypeRuntime and the game's mask of each inventory slot

Items · CharacterRuntime · The engine in ten minutes

Each of a character's 27 inventory slots has a mask in the executable, and each item type a mask in ITEMTYPE.DAT. An item can go into a slot when the two masks share a bit.1

/* Where an item may be placed; one bit per kind of inventory slot. */
typedef enum InventorySlotMask {
INVENTORY_SLOT_QUIVER = 0x0001, /* Slot 16; only arrows carry it in the original data. */
INVENTORY_SLOT_BODY_ARMOUR = 0x0002, /* Slot 17: armour, robes and cloaks. */
INVENTORY_SLOT_BRACERS = 0x0004, /* Slot 18. */
INVENTORY_SLOT_HAND = 0x0008, /* Slots 0 and 1; every placeable item type of the original data has it. */
INVENTORY_SLOT_BOOTS = 0x0010, /* Slot 21. */
INVENTORY_SLOT_HELMET = 0x0020, /* Slot 19. */
INVENTORY_SLOT_NECK = 0x0040, /* Slot 20: amulets and necklaces. */
INVENTORY_SLOT_BELT = 0x0080, /* Slots 23 and 24: small items. */
INVENTORY_SLOT_RING = 0x0100 /* Slots 25 and 26. */
} InventorySlotMask;

The backpack slots 2 to 15 and the belt slot 22 have all sixteen bits set (0xffff): they accept any item whose type has at least one bit. The six item types reserved for conjured weapons have mask 0 and fit no slot. The other seven bits are not used by any slot.

Mask of each slot​

SlotsMask
0, 1INVENTORY_SLOT_HAND
2–150xffff
16INVENTORY_SLOT_QUIVER
17INVENTORY_SLOT_BODY_ARMOUR
18INVENTORY_SLOT_BRACERS
19INVENTORY_SLOT_HELMET
20INVENTORY_SLOT_NECK
21INVENTORY_SLOT_BOOTS
220xffff; see the anomaly
23, 24INVENTORY_SLOT_BELT
25, 26INVENTORY_SLOT_RING

Mask of each item type​

The masks of the 64 types of the original ITEMTYPE.DAT are in the item catalogue, and grouped by mask on the same page. A type with a nonzero mask also fits the backpack and belt slot 22, whose masks have all bits.

Where it is used​

  • Putting an item into a slot, from the inventory page or with the keyboard; an item that does not fit gives "You can't put that item there."; see moving and equipping items.1
  • Exchanging the held item with a hand on a portrait, which compares only the low byte of the item type's mask with the hand's mask.2

Sources​

Locations refer to the game executable reference.

Footnotes​

  1. The inventory-slot masks, tested by the placement check. ↩ ↩2

  2. Swap the held item with a portrait hand. ↩