Item routines
Routines · Data · Address index
Holding, giving, throwing, dropping and using items, inventory slots, and the item chains of blocks. The routines page explains how the entries are written.
0x18c77, 0x1e5bc — Give the held item
- Ranges:
0x18c77–0x18d73;0x1e5bc–0x1e67b - Role:
0x1e5bcis the only writer of the mouse-held item. WithDS:0x6655at 0 it writes that word. Otherwise it asks the placement check whether the item fits the selected slot (DS:0x9317,DS:0xe5a4): if so it writes the inventory word without testing whether it is empty; if not it prints "You can't put that item there." and inserts the item in the party's block at one of the two front positions, chosen at random.0x18c77, which every other routine calls, stores the item through0x1e5bcand, when the item is nonzero, is now the held item and the active text window is 7, the message area, prints the item name and " taken." (DS:0x2fe6); it sets the mouse cursor to the item's icon, in other colours for a magical item while the party hasSPELL_EFFECT_DETECT_MAGIC. The pointer's hot spot is (8, 8) for the item icon and (0, 0) for icon 0 (0x18d3d–0x18d67); slot0x70holds the recoloured magical icon. - Used by: The inventory › Moving and equipping items, Lasting spell effects, How input works › The pointer and the item it carries, Create an item, Item state flags, Anomalies and bugs
0x1bb6d, 0x1bcc5, 0x1bcfe, 0x1bd22, 0x1befa, 0x1cd81, 0x1bbf9, 0x1bc3e — Inventory buttons
- Ranges:
0x1bb6d–0x1bbc6,0x1bcc5–0x1bcfd,0x1bcfe–0x1bd21,0x1bd22–0x1bd9b,0x1befa–0x1bf7a,0x1cd81–0x1cdb3 - Status: nothing calls
0x1cd81: no far call in any segment form, including the overlays' fixed-up segments, no near call and no far pointer in the file. - Role: Button handlers of the character panel, which set the
panel state. A portrait click opens the inventory page
of a present character (
0x1bb6d, which also stores the character inDS:0x9317when the button trigger is a mouse click);0x1bbf9and0x1bc3e, the previous and next buttons (helper0x1bbc7), select the previous or next present character, or with their key shortcuts a given one;0x1bcc5switches between the two pages;0x1bd22closes the panel and brings the keyboard slot back to a hand. A slot button (0x1bcfe) passes its slot to0x1d897. A portrait hand button (0x1befa) takes the hand from the mouse row and, for a present character, exchanges it with the held item (0x1d987) whenDS:0x6385&0x7fis 1, or uses the item otherwise.DS:0x6385is the state of the first mouse button, set by the button processing: 1 when the event is its press (0x41), 3 for its release (0x2f984–0x2f9e1);DS:0x6387is the same for the second button. A click with the first button therefore exchanges, and the second button or a key uses the item.0x1cd81is the keyboard equivalent on the selected slot.0x1bbf9(F1 and F2) selects characters 0 and 1 without testing that they are present;0x1bc3e(F3 to F6) restores the previous character when the target is absent. Key I on a face skips the presence test and keeps the selection. - Used by: The inventory › Moving and equipping items, The inventory › The selected character, The play screen › Click areas, The play screen › The character panel
0x1c289, 0x1e280 — Select a character
- Ranges:
0x1c289–0x1c2e0;0x1e280–0x1e2b4 - Role:
0x1c289is the callback of the six character boxes (63 × 50 at x 184 and 256, y 2, 54 and 106), the first buttons of the main button list after the front-block action. For a present character (mask 1) it calls0x1e280and returns 0, so that the button processing goes on to the name, face or hand button under the pointer; otherwise it returns 1. Its two other calls,0x1e2b5and0x1e2c6, return at once.0x1e280makes its argument the selected character and redraws the old and new portraits; the swap of two characters (0x1be55) and overlay 2470x428d0call it too. - Used by: The inventory › The selected character, The play screen › Click areas
0x1bf7b — Throw the held item
- Role: Callback of the two throw buttons of the upper
view. With an item held, launches it from the party's block at
the launch position of the button's zone (0 left, 1
right), in the party's direction, with the
selected character as thrower and the item's type as
weapon type; on success the held item is cleared, otherwise it stays held.
It tests no condition of the thrower (no call to the
eligibility test in
0x1bf7b–0x1bfdf). - Used by: On the floor and in the air › Throwing and launching items, On the floor and in the air, The play screen › Click areas, Anomalies and bugs
0x1c135 — Drop or pick up an item on the floor
- Role: Drops or picks up an item in the party's block or the block in
front, through the four floor buttons. Zones 0 and 1,
the lower half of the view, select the party's block, zones 2 and 3 the
block ahead, which is used only if its face towards the party has any of
WALL_RUNTIME_PASSAGE,WALL_RUNTIME_SMALL_PROJECTILE_PASSAGEandWALL_RUNTIME_DOOR. The floor position table turns the zone and the party's direction into a position in the block. With no held item it unlinks the first item of the chain at that position, makes it the held item (0x18c77) and dispatches block event 8; otherwise it inserts the held item there, clears the held item and dispatches block event 4. It never exchanges. - Used by: Block events › Who sends each event, The engine › How the systems connect, Events that start scripts, Blocks, directions and positions › Floor positions, Wall properties › Where each bit is tested, On the floor and in the air › Items on the floor, The play screen › Click areas, Level 1: reference tables › The spider quarter
0x1c58f, 0x1c6d9 — Keyboard drop, throw and take
- Ranges:
0x1c58f–0x1c6d8;0x1c6d9–0x1c8dd - Anomaly: the anomalies are in
0x1c6d9–0x1c8dd, which never reads the wall properties, and at0x1c840–0x1c886. - Role:
0x1c58f(argument 0 drop, key D; 1 throw, key T) takes the top quiver item when slot 16 is selected, otherwise the held item, and does nothing for an item withITEM_RUNTIME_CURSED(0x1c5bf). It drops it in the party's block, or launches it, at the keyboard position of the character's side; a quiver item whose launch fails goes back into the quiver (0x1c6bf).0x1c6d9(key G) cycles over the four floor zones (zone blocks, positions) and takes the top item of the first non-empty one into the selected slot when the placement check accepts it, appending the previously held item, or the refused one, at the same position (block events 8 and 4). The taken item is given to the slot (0x1c801) before the removal event is sent (0x1c87e), so a script reacting to it sees it as the held item. It reads the block ahead without testing the face in between, and an arrow taken into the quiver (0x1c840–0x1c86a) skips the removal event. Neither routine tests the condition of the selected character, the thrower. - Used by: Block events › Who sends each event, On the floor and in the air › Items on the floor, Anomalies and bugs, The inventory › Moving and equipping items, Item state flags
0x1cbe5, 0x1cc3a — Lose an item to a monster
- Range:
0x1cbe5–0x1cce0; the item-type test is at0x1cc3a(file offset0xfe3a) - Role: Argument: a character. Called by the
monster attack for a type with
MONSTER_CAP_ITEM_LOSS. From inventory slot 1d27 − 1, scans the 27 slots circularly for the first item whose item type has bit0x80ofproperties_raw(DS:0x947c+ 16 × type, tested at0x1cc3a). It clears that inventory word (0x1cc51) without changing the item's entry, prints "%s has lost her " or "%s has lost his " (DS:0x3796,DS:0x37a7, by bit 0 ofrace_and_sex), the item name and ".", and redraws the portrait. Neither this routine nor its caller recomputes the defense, and the item's entry keeps location 0 and is never freed. - Comparative source: REF-SCUMM-021,
monsterCloseAttack(_ripItemStrings). - Used by: Item type entry › How the game uses it, Melee attacks › The attack sequence, Monster capabilities › Where it is used, Where an item is, Races, Level data (INF), Anomalies and bugs
0x1cce1 — Remove the selected inventory item
- Range:
0x1cce1–0x1cd80 - Anomaly:
ANOMALY-149:0x1cd1awrites −1 tolocation_rawof whatever index the holder holds, item 0 when nothing is held, unlike the chain insertion, which returns for item 0 (0x1cdc5). - Role: Arguments: a character and a slot, or −1 for the
held item. Writes
0xffffinto the item'slocation_raw(0x1cd1a), freeing the entry, empties the slot (or sets the held item to 0 through0x18c77) and redraws the inventory slot or the portrait. Returns the item's value as a signed byte. The entry is freed before the holder is cleared (0x1cd28); in keyboard control that clear goes through the placement check, which refuses a cursed weapon in a hand (0x1d7c9–0x1d843), so the hand keeps the freed item (ANOMALY-132). - Used by: Delete items › Behavior, Item entry › Block chains, Item removal targets, Scripted movement, monsters and items › Items, Where an item is › Locations and levels, Delete items, Anomalies and bugs
0x1cdb4, 0x1ce9f — Insert into and unlink from an item chain
- Ranges:
0x1cdb4–0x1ce9e;0x1ce9f–0x1cf66 - Role: The insertion links an item between the chain's last item and
its head and makes it the new head, so a chain is a pile with the newest
item first; it checks no count. It sets
position_rawandlocation_raw, andlevel_rawto the current level, or 255 for a negative location. The unlinking walks from the head and removes the first item matching an index, or, with index −1, the first whoseposition_rawequals a given position exactly; it writes 0 into the item's location, level and both links. Overlay code reaches the insertion through a fixed-up far call. - Used by: Delete items › Behavior, Initial items (ITEM.DAT) › What it becomes in memory, Item entry › In brief, When a monster dies › In what order, Move an inventory item to a block › Behavior, Move the party, monsters or items › Moving items, Scripted movement, monsters and items › Moving the party, monsters and items, On the floor and in the air › Items on the floor, Identify items › Behavior, Create an item › Behavior, Values passed on to other routines › The routines, Transfer: spells and items, Where an item is
0x1cee7, 0x1d3ee — Update neighboring item links
- Addresses:
0x1cee7,0x1d3ee(file offsets0x100e7,0x105ee) - Role: Update the links at offsets
0x08and0x0aof the neighboring items in a chain. - Used by: Initial items (ITEM.DAT) › What it becomes in memory, Item entry › In brief
0x1cf67 — Search or count a block's items
- Range:
0x1cf67–0x1d00c - Role: Searches or counts the items of a block chain by index or by type.
Its fifth argument decides whether flying items count: when it is zero, an
item whose
position_rawis 4 to 7 is skipped (0x1cfc7–0x1cfdc). Script expression token0xf2passes zero;0xf5passes its flag operand. - Used by: Condition expression tokens › Operand layouts, Item entry › In brief, Move the party, monsters or items › Moving items, Test a condition › Behavior, How a script runs › What the conditions test, Values passed on to other routines › The routines
0x1d00d — Identify a chain of items
- Role: Marks every item of a chain as identified.
- Used by: Identify items › Behavior, Item state flags, Level block › Layout, Scripted movement, monsters and items › Items, Values passed on to other routines › The routines
0x1d586, 0x1d73b — Draw an inventory slot
- Ranges:
0x1d586–0x1d73a;0x1d73b–0x1d76f - Role:
0x1d586(slot, frame, page)draws one inventory slot of the selected character at its position (DS:0x2127,DS:0x215d). With frame set it first draws the box: 16 pixels square, 8 for the two rings. On the quiver it also prints how many items the slot holds, at x = 233 below 10 and x = 227 from then on, and in keyboard control it outlines the selected hand. It then draws the item's icon, except on the quiver, 4 pixels up and left on a ring.0x1d73b(restore)can put the saved panel background back (0x1d75b), then redraws the selected character. - Used by:
0x1d054 — Append an item to a block chain
- Range:
0x1d054–0x1d0a5; the old anchorr-1d058, inside the routine, is kept for links. - Role: Inserts the item in the block's chain, then gives the head back to the previous first item, so the item ends last. Used by the keyboard take and the niche to put an item back.
- Used by: On the floor and in the air › Items on the floor, Item entry
0x1d0a6 — Delete a block's items by type
- Role: Deletes the items of a given type from a block, freeing their
entries (
0x1d100), and rebuilds its chain: the head is emptied and every surviving item is inserted again in walking order, so the survivors end in reverse order. It does not consult the flying-object table (0x1d0a6–0x1d1b0): an item in flight is freed while its flight continues, and the flight step links it into the next block (0x27c6c,0x27c89;ANOMALY-133). - Used by: Delete items › Behavior, Item entry › Block chains, Item removal targets, Scripted movement, monsters and items › Items, Values passed on to other routines › The routines, Anomalies and bugs
0x1d1b1 — Print an item's name
- Range:
0x1d1b1–0x1d423(file offsets0x103b1–0x10623); jump table on the kind at0x1d424(19 words); the ring case is0x1d315–0x1d336. The old anchorr-1d1f4, where the kind is read, is kept for links. - Role: Prints the first name of an item without
ITEM_RUNTIME_IDENTIFIEDand the second name of an identified one. An identified item whose second name is empty is named by its kind: kinds 0 to 3 with a nonzero value as "+ n name" or "n Cursed name"; kinds 9 and 10 as "Mage Scroll" or "Cleric Scroll" "of" the full name of the spell definition its value designates; kinds 16, 14 and 18 as "Ring", "Potion" or "Wand" "of" the string of the name lists numbered by the value, read through the nth-string routine without a bound; a wand of value 5 keeps its first name. - Used by: Initial items (ITEM.DAT) › Who uses it, Item entry › Layout, Item state flags, Item type entry › How the game uses it, Item types (ITEMTYPE.DAT) › Who uses it, Items › Item names, Item kinds, Spell definition, Anomalies and bugs
0x1d50b — Duplicate an item
- Role: Returns 0 when the template's
location_rawis −1. Otherwise copies the template's 14 bytes, location, level and links included, into the first item from 1 to 599 whoselocation_rawis −1 and returns its index, or 0 when none is free. Callers: the monster ranged action (thrown weapons), the monster death (drops),SCRIPT_LAUNCH_OBJECT, the create-item handler, give an item, overlay 252 (0x4adb4,0x4af0c) and overlay 254 (0x4c515). - Comparative source: REF-SCUMM-003,
oeob_createItem_v2. - Used by: Create an item › Behavior, When a monster dies › In what order, Resting: special cases › Insal leaves, Where an item is › Locations and levels, Run a sequence › Without a level change, Values passed on to other routines › The routines, Transfer: spells and items, Delete items, Launch an object, Item entry
0x1d770 — Check an item placement
- Range:
0x1d770–0x1d896(file offsets0x10970–0x10a96); the mask test is at0x1d847(file offset0x10a47), whose anchorr-1d847is kept for links - Role: Arguments: an item (0 for none), a character and a slot.
Refuses body armour (slot 17) that the class check rejects,
with "%s can't wear that type of armor."; refuses taking out or replacing
an item with
ITEM_RUNTIME_CURSEDin slot 0 or 1, with "%s cannot release the weapon! It is cursed!" only for item kinds 1 to 3, the test being skipped for slots from 2 up (cmp di,2andjge 0x1d847at0x1d7c9); then tests the item type'sinventory_slot_maskagainst the slot's mask, no item counting as all bits, and refuses with "You can't put that item there." (messages). Returns 1 when the item may go there. - Used by: Item type entry › How the game uses it, Item types (ITEMTYPE.DAT) › Who uses it, The inventory › Moving and equipping items, Inventory slot masks, Delete items, Item kinds, Item state flags
0x1d897 — Click an inventory slot
- Range:
0x1d897–0x1d986 - Role: Argument: a slot of the character shown on the inventory page (
DS:0x9317). After the placement check of the held item: for the quiver, slot 16, takes the first item of the slot's chain into the hand when the hand is empty, or inserts the held item at the head of the chain with location −2 (0x1d962), without recomputing the defense; for any other slot, exchanges the slot's item and the held item and recomputes the defense. Called by the slot buttons and the keyboard command0x1cd81(inventory buttons). - Used by: The inventory › Moving and equipping items, The play screen › The character panel, Item entry
0x1d987 — Swap the held item with a portrait hand
- Range:
0x1d987–0x1da2e - Role: Arguments: a character and a hand. Does nothing when the hand's
item has
ITEM_RUNTIME_CURSED; otherwise, when the low byte of the held item type'sinventory_slot_mask(all bits for no item) shares a bit with the hand's slot mask, exchanges the two items, without a message on failure and without a class check. Always recomputes the defense. - Used by: The inventory › Moving and equipping items, Inventory slot masks, Item state flags
0x1da2f — Drink a potion
- Range:
0x1da2f–0x1dc51; jump table0x1dc52–0x1dc61 - Role: Arguments: a character and a slot. Removes the
potion, whose value v selects the effect, and plays sound 10; for v 0
to 7 (unsigned test) it animates the portrait and: 0 sets
strengthto 22 andexceptional_strengthto 0 with a timer of 546 × (1d4 + 4) ticks, event 7; 1 heals 2d4 + 2; 2 heals 3d8 + 3; 3 poisons (saving-throw category 0, one unit, event 8, no refresh) and clearsSPELL_EFFECT_SLOW_POISON(0x1db35); 4 setsfoodto 100; 5 setsSPELL_EFFECT_HASTE(0x1db7c) with a timer of 546 × (1d4 + 4) ticks, event 12; 6 setsSPELL_EFFECT_INVISIBILITY(0x1dbda) without a timer; 7 neutralizes poison. Prints "%s feels %s!" (DS:0x3880) with string v of the potion messages, read without a bound, except for v 3 when the character is poisoned afterwards (0x1dc06–0x1dc13). - Used by: Potions, scrolls and wands › Potions, Lasting spell effects, Sound effects, Saving-throw categories, Anomalies and bugs
0x1dc62, 0x1dccc — Use a wand, blow a horn
- Ranges:
0x1dc62–0x1dccb;0x1dccc–0x1dd1f - Role:
0x1dc62(character, slot): value 0 prints "The wand has no apparent magical effect" (DS:0x388e); value 5 casts definition 64; any other value casts the definition read in the wand spell table, without a bound; no charge is tested before the cast.0x1dccc(character, slot) prints horn message value − 1 and plays the horn sound value − 1; neither index is checked. - Used by: Potions, scrolls and wands, Using items › Food and other uses, Using items, Sound effects, Anomalies and bugs
0x1dd20 — Use an inventory item
- Range:
0x1dd20–0x1df64; jump table on the item kind at0x1df65–0x1df8e(21 words,CS:0x1385of segment0x1cbe) - Role: Arguments: a character and a slot. Returns at once unless the
character passes the eligibility test with mask
0x0d(present, conscious, neither paralyzed nor petrified;0x1dd3b–0x1dd4c). For a hand slot,0x1eaeemust accept the hand and its bit ofdisabled_slotsmust be clear unless the panel state is nonzero (0x1dd84–0x1dda5); these refusals are silent. A failed class check prints the name and " can not use this item." (DS:0x3951); for a hand,0x1eaeehas already made the same check, and both known callers pass a hand. Then dispatches on the item kind (properties_raw&0x7f): kinds 0 and 16 printDS:0x396a; 1 to 3 use a weapon; 4, 8, 12, 13 and 15 printDS:0x3993; 5 and 6 open a spell book; 7 eats only whenDS:0x6655is nonzero; 9 and 10 cast the item's spell; 11 runs overlay 2520x4b569; 14 drinks; 18 uses a wand; 19 blows a horn; 20 deals 200 points of damage (0x209fc) for value 1 and casts definition 55 otherwise, then removes the item; 17 and kinds above 20 have no handler. Kinds 1 to 3, 5, 6, 9, 10 and 18 do nothing while the panel state is nonzero. Finally, except for kind 1 used from party slot 2 or above, records the item in use aroundBLOCK_EVENT_ITEM_USEDdispatched to the block in front of the party (0x1df2d–0x1df5e). Callers: the portrait hand button0x1befaand the keyboard command dispatch at0x1c954, both with a hand slot. No path testsITEM_RUNTIME_IDENTIFIED. - Comparative source: REF-SCUMM-018,
gui_processWeaponSlotClickRight. - Used by: Block events › Who sends each event, The engine › How the systems connect, Item properties in conditions › Which item is tested, Events that start scripts, Conditions › Conditions, Character eligibility tests › Masks used by character actions, Using items › What each kind does, Item kinds, Items, Item types (ITEMTYPE.DAT), Level 9: reference tables › The will-o'-wisp guards
0x1df8f — Class restriction check
- Range:
0x1df8f–0x1dfd7(file offset0x1118f); the old anchorr-1df90is kept for links - Role: Returns 1 for item 0, the empty hand; otherwise ANDs the character's class bit from the class mask table with byte 5 of the item type.
- Used by: Character class masks, Item type entry › How the game uses it, Item types (ITEMTYPE.DAT) › Who uses it
0x1dfd8, 0x1eaee — Hand checks
- Ranges:
0x1dfd8–0x1dfed;0x1eaee–0x1ebca - Role:
0x1dfd8returns a slot number when it is a hand (0 or 1), otherwise −1.0x1eaee(character, hand) accepts hand 0 when it is empty or its item passes the class check. It refuses hand 1 when hand 0 holds an item whose type hashand_requirement_raw2 (0x1eb7a), or when hand 1 holds a weapon of kind 1 to 3 whose type has a nonzerohand_requirement_raw(0x1ebb5); otherwise an empty hand 1 is accepted and an item in it must pass the class check. Read by the use routine, the defense recomputation and the drawing of the portrait hands. - Used by: The inventory › Two hands, Item kinds, Using items, Item types (ITEMTYPE.DAT), Item type entry
0x1ebcb — Check for a holy symbol in a hand
- Range:
0x1ebcb–0x1ec1e; the comparison is at0x1ec07 - Status: no reference was found in the executable (resident near and far calls, overlay calls through the segment table, stored far or near pointers); it is never called (inferred).
- Role: Argument: a character record. Returns 1 when inventory slot 0 or
1 holds an item whose type's whole
properties_rawword equals 6, that isITEM_KIND_HOLY_SYMBOLwith no other bit, and 0 otherwise. It is the only read of that word that does not mask the kind with0x7f. - Used by: Item kinds › Anomaly, Item types (ITEMTYPE.DAT), Anomalies and bugs
0x1e388 — Search the inventory
- Address:
0x1e388(file offset0x11588) - Range:
0x1e388–0x1e3fd - Role: Arguments: a character, an item type and a value. Walks the 27
inventory words of the character in slot order, skips empty ones and
returns the first slot whose item has that
type_rawandvalue_raw, both compared as signed bytes, −1 matching any type or any value; otherwise −1. Slot 16 holds the head of the quiver chain, so only the first item of a quiver is compared; the held item is not examined. - Used by: Character record › In brief, Condition expression tokens › Operand layouts, Item entry › Layout, Item types › Where it is used, Learning and memorizing spells › Learning from scrolls, Resting › A step of rest, Resting: special cases › Anomalies while resting, Run a sequence › Joining a full party, How a script runs › What the conditions test, Test a condition, Initial items (ITEM.DAT)
0x1e3fe — Look for a worn ring
- Range:
0x1e3fe–0x1e451 - Role: Arguments: a character record and a value. Returns 1 when
inventory slot 25 or 26 holds an item of type
0x2f(ITEM_TYPE_RING) of that value, otherwise 0. Value 1 is looked for by the memorize menu, 2 by the food timer and the rest, 3 by the damage calculation for script damage. - Used by: Damage flags › Effects, Damage flags, Item types › Where it is used, Resting: special cases › Anomalies while resting, Resting › Every hour and every eight hours, Resting › When the rest ends, Timed updates › Food, Timed updates › The table of timed updates, What worn items change › Defense and rings, The inventory
0x1e452 — Delete inventory items by type and value
- Role: Deletes the items matching a type and value, freeing their
entries (
0x1e49b,0x1e581), from the inventories of every present character (eligibility mask 1,0x1e464), dead ones included, and from the hand in mouse control. After each deletion it redraws, unless a dialogue screen is open (0x1e4bb), the portrait hand for a hand slot of characters 0 to 4 only (0x1e4cf, while the character loop runs to 5 at0x1e525;ANOMALY-129), or the inventory slot of the selected character (0x1e4ff). - Used by: Where an item is, Item types › Where it is used, Recruiting and dismissing characters › Recruiting and dismissing characters, Run a sequence › Joining a full party, Run a special event › Recruit a character (event 4), Run a special event › Remove two quest items (event 5), Values passed on to other routines › The routines, Anomalies and bugs
0x1e592 — Held item
- Role: Returns the item held with the mouse (DS:
0x6dd6) or, in keyboard control, the item in the selected character's selected slot. - Used by: Delete items › Behavior, Item properties in conditions › Which item is tested, Scripted movement, monsters and items › Items, How input works › Mouse control and keyboard control, Level 1: reference tables › The spider quarter, Level 9: reference tables › The four keys, Level 10: reference tables › The treasure room
0x1ee39 — Remove items from the party
- Range:
0x1ee39–0x1ef58 - Role: Takes up to a given number of items of one type from the present characters, in slot order, from every inventory slot but 16: the value must be at most (mode −1), equal to (0) or at least (1) a given value. A taken item leaves the inventory and its location word becomes −1. Passes repeat while items are still wanted and the last pass found one; returns the number taken.
- Comparative source: REF-SCUMM-019,
stripPartyItemsandrestParty_npc. - Used by: Item types › Where it is used, Resting: special cases › Insal leaves
0x1f6e2 — Item damage dice
- Address:
0x1f6e2(file offset0x128e2) - Role: Weapon damage: the strength damage modifier when asked,
plus the item type's second dice (
+0x0a,+0x0b) against a monster type with capability0x0001(0x1f724–0x1f73c) and the first dice (+0x07,+0x08) otherwise, always with bonus+0x09, rolled, plus the item's value; 1d2 without an item; at least 0. - Comparative source: REF-SCUMM-013,
calcDamageModifers. - Used by: Damage to a monster › Weapon damage, Item type entry › Damage profiles, Item types (ITEMTYPE.DAT) › Who uses it, Damage flags, Level data (INF), Anomalies and bugs
0x2105d — Reserve a conjured-weapon type
- Range:
0x2105d–0x210e4(file offsets0x1425d–0x142e4) - Role: Looks for a free entry among item types 51 to 56 of the
item-type table — one whose
defense_adjustment_rawis −30 (0xe2) — fills it from its arguments and returns its index, or −1 when all six are in use.0x210e5gives the entry back. The save writer stores these six types with the game. Its only callers are Shocking Grasp (0x23cd6), Vampiric Touch (0x23ff6) and Flame Blade (0x2488c). Their failure branches (0x23cfb–0x23d17,0x2401b–0x24037,0x248b0–0x248cc) do not free the type when no item is found; the item search0x21125examines items 11 to 16, of which the original data has only 11 to 15 free (ANOMALY-130). - Comparative source: REF-SCUMM-013,
createMagicWeaponType. - Used by: Item type entry › Changes during play, Saving and restoring › What a saved game holds, The inventory › Moving and equipping items, Item types (ITEMTYPE.DAT), Anomalies and bugs
0x210e5, 0x21125 — Free and reserve a conjured-weapon item
- Range:
0x210e5–0x21124; the type write is at0x21100(file offset0x14300).0x21125follows it. - Callers: the spell routines of Shocking Grasp, Vampiric
Touch and Flame Blade call
0x21125with flags0x10,0x18and 0; the end routine0x23d54calls0x210e5. - Role:
0x210e5frees one item: it writes −30 (0xe2) todefense_adjustment_rawof the item's type, sets the item'slocation_rawto0xfffeand itslevel_rawto0xff.0x21125searches items 11 to 16 for one whoselocation_rawis0xfffeand returns −1 when there is none. Otherwise it fills that item, setting its flags to its first argument plus0x20; it also writes 0 toDS:0x71cf, byte+0x05of item 0. - Comparative source: REF-SCUMM-013,
removeMagicWeaponItemandcreateMagicWeaponItem. - Used by: Item type entry › Changes during play, Item entry, Anomalies and bugs