Skip to main content

Setting up the new party

Overlay 246 · image 0x42210–0x428a6 (1,687 bytes) · 8 stub entries

All overlays · ← 245 · Creating a party · 247 · Camp menu and spells →

In brief​

Overlay 246 turns the four created characters into a party ready to play: it gives them their starting status, items and spells and prepares their attributes, while "Entering game. Please wait." is shown, then releases the images and buttons of the creation screen. It also holds the routine that gives an item to a character, used elsewhere, and a prepared-party routine that no code is known to call.

Addresses

Every address on this page is a file offset in START.EXE; calls into resident code are given as analysis addresses. See how addresses are written.

How it fits together​

The order in which party setup calls its steps. Dashed boxes are outside this overlay.

Entry points​

Stub entries whose target is resolved, from the stub bytes or another independent anchor, or through the portal reading.

Encoded entryTargetRole
0x7b0:0x20, 0x7b0:0x3e0x42297, 0x4278a—

The stub decodes all eight entries: 0 0x42297, 1 0x42690, 2 0x4235a, 3 0x4273f, 4 0x42210, 5 0x427a8, 6 0x4278a and 7 0x4262e. Entry 4 is code: the image starts with the routine that prints the message, whose text is in the data segment at DS:0xb58.

Routines at a glance​

RoutineAddress
Party setup0x4278a
Show the entering message0x42210
Starting status and items0x4235a
Give an item to a character0x42297
Starting spells0x4262e
Copy attributes to their second bytes0x42690
Prepared party0x427a8
Release the creation images0x4273f
Release the button labels0x426f6

Routines​

Party setup​

AddressRange
0x4278a0x4278a–0x427a7

Entry 6 of the overlay, called by the party creation screen and by the prepared party. Shows "Entering game. Please wait.", then calls starting status and items, starting spells, copy to the second bytes and release the creation images.

Used by: Character record › Initialization, Entering the game › Entering the game

Starting status and items​

AddressRange
0x4235a0x4235a–0x4262d

For characters 0–3: status_flags = 1, food = 100, byte 0 = the character's number (0x4237e–0x4238b); one random record of the class's starting armour list; a weapon chosen by the class mask, a 1d2 roll and, for dwarves, the race (0x42403–0x424b7); then template items 10, 10 and 24 (value 2, in slot 2: 0x424fd–0x4250d) for everyone, 7 and 21 (values 4 and 13) for a mage component, 8 or 27 (class 2) and 20 (value 49) for a cleric or paladin component, 6 for a thief component and 93 for character 0, each through give an item; and finally the defense recomputation.

Comparative source: REF-SCUMM-017, finish.

Used by: Entering the game › Entering the game, Character record › Unused bytes, Races, Character conditions, Potions, wands, rings and amulets, Scrolls and parchments, Weapons, armour and food, Tools

Give an item to a character​

AddressRange
0x422970x42297–0x42359

Arguments: a character, a template item index of ITEM.DAT, a value and a preferred inventory slot. Duplicates the item, sets ITEM_RUNTIME_IDENTIFIED, stores the value unless it is −1, sets ITEM_RUNTIME_MAGICAL when the value is not zero and the low seven bits of the item type's first word are below 4, and places the item in the slot, or in the first empty one of slots 2–15. Also called by the party transfer at 0x4d1a7.

Comparative source: REF-SCUMM-017, createInventoryItem.

Used by: Entering the game › Entering the game, Transferring a party from Eye of the Beholder I › Transferring a party from Eye of the Beholder I, Transfer: spells and items

Starting spells​

AddressRange
0x4262e0x4262e–0x4268f

For characters 0–3: with a mage bit in the class mask, sets known_mage_spells to 0x00081cb6 (0x42656); with a cleric or paladin bit, writes 29 to offset 0x89, entry 0 of cleric_spell_slots (0x42682), the entry the slot writer also sets.

Comparative source: REF-SCUMM-017, finish.

Used by: Entering the game › Entering the game, Character record › Spell slots

Copy attributes to their second bytes​

AddressRange
0x426900x42690–0x426f5

For the first four characters, copies each attribute byte (+0x0d, +0x0f, +0x11, +0x13, +0x15, +0x17, +0x19 of CharacterRuntime) into the byte that follows it, and hit_points into hit_points_max. Called at 0x4279a when a party is set up. Only the strength bytes are read back, by remove all effects (0x239cc) and the end of giant strength in the character timer handler (0x285e8); nothing compares an attribute with its second byte.

Used by: Attributes and classes › Attributes, Entering the game › Entering the game, Character record › Attributes

Prepared party​

AddressRange
0x427a80x427a8–0x428a6

No call to it and no stored reference to its entry exist in the executable (entry 5, portal 0x7b0:0x39, stub paragraph 0x2acd; whole-file byte search). No code can build a pointer to it from those values either: apart from the segment table (0x2dcd0) and the relocation table (0x305a), the two words occur only as the segments of the far calls at 0x42041 and 0x4d1aa, to other entries, and inside two unrelated instructions.

Fills characters 0–5 from the prepared-party tables (attributes 18, hit_points 30, defense 6, experience[0] 69,000), then calls party setup. The loop runs six times (cmp si,6 at 0x42896) over tables of four entries: characters 4 and 5 read the following table.

Used by: Entering the game › A prepared party, Characters of the game, Anomalies and bugs

Show the entering message​

AddressRange
0x422100x42210–0x42296

Entry 4, the first routine of the image, called first by party setup (0x4278e). It restores the clean side panel that overlay 245 saved in page 2, prints the text at DS:0xb58, "Entering game. Please wait.", at (168, 32) in colour 15, and copies the panel to (144, 64) on the screen. The message stays while the starting items and spells are prepared.

Comparative source: REF-SCUMM-017, finish.

Used by:

Release the creation images​

AddressRangeStatus
0x4273f0x4273f–0x42789Reading resident 0x17ff2 as releasing memory is inferred

Entry 3, called last by party setup (0x4279e). It passes to 0x17ff2 the 67 far pointers from DS:0xd0b2 (cmp si,0x43 at 0x4275e), then calls release the button labels, then passes the 19 button records of DS:0x6d82. Overlay 245 stores only 54 of the 67 pointers — the 44 portraits (0–43) and the ten box-animation frames (50–59); the others are zero, and 0x17ff2 does nothing for a null pointer. The pointers are not cleared. A character keeps its portrait through the copy made in its own face_image buffer by the portrait menu.

Used by: Party setup

Release the button labels​

AddressRange
0x426f60x426f6–0x4273e

Called only by 0x4273f (0x42764). For each of the 17 button labels of DS:0x752, cut by overlay 245, passes a non-null pointer to resident 0x17ff2 and clears it.

Used by: Release the creation images

Sources​

The executable is identified in the file inventory; the overlay layout is described on the overlays page. Comparative sources are listed in the technical references.