Transfer: spells and items
The party · Transferring a party · ItemType
In brief
A transferred character keeps no spell slot. Its known mage spells, and the values of its scrolls, go through a conversion table that drops some spells. Each item is converted on its own: a filter by type drops keys, gems, quest items and other types, the value is adjusted for scrolls, potions and wands, and the item takes the names of a matching item of this game. Five anomalies of the conversion are recorded on this page.
Spells
The spell names are those of this game's mage and cleric spells; which spells the numbers denoted in the first game is not established here.
The transferred characters keep no spell slot: a caster must memorize or pray and rest before casting, and a cleric or paladin gets Turn undead only when the pray menu writes it. The known mage spells and the scrolls go through one table: a number of 0 means the spell is dropped, from the mask or with its scroll.1
for i in 0 .. 24:
if bit i of the old known-spell mask is set:
n = table[i + 1]
if n != 0: set bit n - 1 of known_mage_spells
| Number read | Known mage spell or mage scroll | Cleric scroll |
|---|---|---|
| 1 | Armor | Bless |
| 2 | Burning Hands | Cure Light Wnds |
| 3 | Detect Magic | Cause Light Wnds |
| 4 | Magic Missile | Detect Magic |
| 5 | dropped | Protect-Evil |
| 6 | Shield | Aid |
| 7 | Shocking Grasp | Flame Blade |
| 8 | Invisibility | Hold Person |
| 9 | dropped | Slow Poison |
| 10 | M's Acid Arrow | Create Food |
| 11 | dropped | Dispel Magic |
| 12 | Dispel Magic | Magical Vestment |
| 13 | Fireball | Prayer |
| 14 | dropped | Remove Paralysis |
| 15 | Haste | Cure Serious |
| 16 | Hold Person | Cause Serious |
| 17 | Invisibility 10' | Neutral-Poison |
| 18 | Lightning Bolt | Protect-Evil 10' |
| 19 | Vampiric Touch | dropped |
| 20 | Fear | Cure Critical |
| 21 | Ice Storm | Cause Critical |
| 22 | dropped | Flame Strike |
| 23 | dropped | Raise Dead |
| 24 | Cone of Cold | dropped |
| 25 | Hold Monster | dropped |
A mage scroll's value n reads entry n of the table, a cleric scroll's value n entry n + 25; the result is the scroll's new value, the definition number of the spell. The table has 64 entries and the index is not checked.
Items
The item table the conversion searches is the initial
ITEM.DAT, which the game loads before showing the
start menu.
Each item of the four characters is converted on its own; the quiver's items are converted one by one along the old chain and put back in the quiver. An item that is not converted leaves its slot empty:2
convert(old):
if old.type has 0 in the transfer filter: drop
new = copy of item 1 of the item table
new.flags = old.flags | ITEM_RUNTIME_IDENTIFIED
new.icon, new.type = old.icon, old.type
new.value = old.value, except:
ITEM_TYPE_MAGE_SCROLL: table[old.value] (0: drop)
ITEM_TYPE_CLERIC_SCROLL: table[old.value + 25] (0: drop)
ITEM_TYPE_POTION: old.value - 1
ITEM_TYPE_WAND: value 5: drop; else new.flags = (old.flags & 0x3f) + 3
ITEM_TYPE_ROCK: new.icon = 19
if the item kind is ITEM_KIND_MELEE, ITEM_KIND_THROWN or ITEM_KIND_LAUNCHER
and new.value != 0, or ITEM_KIND_SPELLBOOK, ITEM_KIND_HOLY_SYMBOL,
ITEM_KIND_MAGE_SCROLL, ITEM_KIND_CLERIC_SCROLL, ITEM_KIND_POTION,
ITEM_KIND_RING or ITEM_KIND_WAND:
new.flags |= ITEM_RUNTIME_MAGICAL
names = those of the first item 1-599 of the item table, except 60, 62,
63 and 83, of level 0 and not in a quiver, with the same type and
icon; else with the same type
if none: show "Item conversion matching failure" with the type, icon,
value and flags; drop
new is carried: level 0
The type number is kept and read with this game's item types. The filter keeps types 0, 1, 2, 4, 5, 7, 9 to 16, 18 to 22, 24, 25, 27 to 32, 34, 35, 39, 41 to 44, 47, 48 and 50: in this game's item table these are weapons and ammunition, armour, shields, helmets, bracers and boots, lock picks, spell books and holy symbols, rations, scrolls, potions, robes and cloaks, amulets and necklaces, rings and wands. Among the types it drops are those of keys, gems, stone items, quest items, parchments and tomes, bones, skulls and femurs, the horn, the trident, the two-handed sword and the spell sphere. The item's name in the first game is not read: the converted item takes the two names of a matching item of this game and, being marked identified, shows the second one. A potion of value 0 would become −1, which no potion has; nothing checks the converted values.
Khelben's Coin keeps its template value, 4. When no character has an empty backpack slot, the coin replaces the item in slot 2 of the first character; see the anomaly.
Anomalies of the transfer
ANOMALY-74 — A transferred wand is not identified. Every converted item
receives ITEM_RUNTIME_IDENTIFIED, but for a wand the conversion then
replaces the whole flag byte with the old charge count plus three, which
drops that bit (it keeps ITEM_RUNTIME_MAGICAL, added afterwards). The
wand therefore shows its unidentified name until it is identified in play.
The sum is not limited to six bits either: an old count of 61 to 63 sets
the identified bit and leaves 0 to 2 charges. A faithful reimplementation
writes (old flags & 0x3f) + 3, then the magical bit.2
ANOMALY-75 — The transfer filter keeps item type 4, but the item table
the conversion searches has no item of type 4. Such an item, if a
transferred inventory held one, would always fail both name searches: the
game would show its "Item conversion matching failure" message with the
item's numbers and delete it. A faithful reimplementation keeps the filter
and the message.2
ANOMALY-76 — When none of the four characters has an empty backpack
slot, the game empties slot 2 of the first character by writing 0 into it
and gives Khelben's Coin there. The item that was in that slot is not
dropped, deleted or freed: it leaves the party, and its entry of the item
table stays in use, carried by no one, whereas the
conversion frees the entry of every item it drops. A faithful reimplementation
loses that item and, to keep the same free entries, keeps its entry
reserved.3
ANOMALY-91 (bug) — The chooser has eight entries, the six characters,
CANCEL and OK, and every other rule wraps at eight, but keypad 2 on CANCEL
moves to a ninth entry that does not exist; keypad 4 or 6 then moves to a
tenth. Choosing either acts as OK. It first flashes a button box beyond the
right edge of the screen (x 540 or 808) and, with a mouse, asks for a button
label at x 6103 or 11030 whose text is data read past the two-label table.
Neither display driver draws any of this: the text routine returns at once
for an x of 320 or more, without reading the text, the box's fill is
cancelled and its lines lie wholly outside the line clipping rectangle. On
screen, with a mouse, the highlight only leaves the CANCEL label. A faithful
reimplementation keeps the two extra entries, both acting as OK, and draws
nothing for them; one that corrects the bug wraps keypad 2 at eight, as the
other rules do.4
ANOMALY-92 — Without a mouse, the transfer screen never shows which
character or button is selected, although the keypad moves the selection;
the save and load menus show it whatever the input. A faithful
reimplementation hides the selection when no mouse is present.4
Sources
Locations refer to the game executable reference;
comparative sources are listed in the technical references.
The figures are drawn by make_party_figures.py.