Creating a party
Overlay 245 · image 0x3f860–0x42069 (10,250 bytes) · 25 stub entries
All overlays · ← 244 · Drawing the dungeon view · 246 · Setting up the new party →
In brief
Overlay 245 is the party creation screen reached from the start menu. It shows four boxes: an empty box creates a character — race, class and alignment menus, generated attributes, stats screen, portrait and name — and a named box shows that character and lets the player delete it. A created character's attributes and hit points can be modified within the creation limits. PLAY is accepted once all four boxes have a name; the party is then set up by overlay 246. The rules are described in creating the party.
The overlay also holds the screen's own display and input layer: it loads the creation images, builds and draws the screen's buttons, shows a character in the side panel, draws the names under the boxes, runs the portrait menu and animates the box being created.
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
Dashed boxes are outside this overlay.
Every screen above builds its buttons with 0x3fc54, reads
input through 0x3f910, draws in the side panel and,
while a character is being created, animates its box.
Tables
Read by the routines below; far tables outside the data segment are given as file offsets.
| Location | Contents |
|---|---|
file 0x27330 | 41 button definitions of 8 bytes: x (8-pixel columns), y, width, height, key code. 0–3 the boxes, 4 PLAY, 5 OK, 6 DELETE, 7 a button with key 0x32 at the OK position (the menus' back key), 8–20 menu lines, 21–22 portrait arrows, 23–26 portraits, 27–30 REROLL, MODIFY, FACES, KEEP, 31–37 modify fields, 38–40 +, −, OK. |
file 0x27480 | Button pictures in page 2: column, row, width (columns), height; each button has a normal and a pressed picture. |
file 0x274c0 | 17 button drawing records of 9 bytes: label position, size and offset in the button, picture number, screen column and row. |
DS:0x6d82 | 19 far pointers to the 0x3c-byte button records, built from the template DS:0x39b8. |
DS:0x752 | 17 far pointers to the button labels. |
DS:0xd0b2 | 67 far pointers to shapes, up to DS:0xd1bd: 0–43 the portraits, 50–59 (DS:0xd17a) the ten frames of the box animation; 44–49 and 60–66 are never set, and all 67 are freed when the party is complete. |
DS:0x79a | Portrait chosen for each box, 0xff until chosen. |
DS:0x6c72 | Sex of the character being created, set by the race menu. |
DS:0x742, DS:0x74a | Box positions: x 16 or 80, y 63 or 127. |
DS:0x732, DS:0x73a | Name fields under the boxes: x 2 or 66, y 107 or 171. |
Entry points
Stub entries whose target is resolved, from the stub bytes or another independent anchor, or through the portal reading.
| Encoded entry | Target | Role |
|---|---|---|
0x7a8:0x34 (entry 4) | 0x41d53 | Load the creation images; called by the prepared party |
0x7a8:0x4d (entry 9) | 0x41ecc | Party creation screen; called by the start menu |
The stub decodes all 25 entries; the other 23 are reached only by near calls
from inside the overlay, and entries 22 (0x4027a) and 23 (0x41838) have no caller found.
Routines at a glance
| Routine | Address | Stub entry |
|---|---|---|
| Party creation screen | 0x41ecc | 9 |
| Load the creation images | 0x41d53 | 4 |
| Party-screen instructions | 0x408d7 | 2 |
| PLAY when the party is complete | 0x3fd29 | 10 |
| View or delete a character | 0x40733 | 3 |
| Create a character | 0x41bef | 15 |
| Race, class and alignment menus | 0x4174d, 0x41867, 0x41a3d | 13, 21, 19 |
| Roll an attribute | 0x40962 | 14 |
| Creation limits | 0x41690 | 1 |
| Generate a character | 0x41466 | 6 |
| Stats screen | 0x40624 | 0 |
| Choose a portrait | 0x4028a | 7 |
| Next free portrait | 0x405a3 | 17 |
| Modify a character | 0x412ea, 0x40b4f | 16, 18 |
| Show a character in the side panel | 0x3fe84 | 5 |
| Draw a name under its box | 0x3fde1 | 8 |
| Redraw a box | 0x409ab | 24 |
| Animate the active box | 0x40a16 | 11 |
| Build a button list | 0x3fc54, 0x3fbd0 | 12, 20 |
| Draw a button | 0x3f943 | — |
| Press a button | 0x3fb95 | — |
| Read the input | 0x3f910 | — |
| Cut the button labels | 0x3f860 | — |
| Highlight the first portrait | 0x4027a | 22 |
| Find the n-th set bit | 0x41838 | 23 |
Party creation. In this overlay the current creation box is the word
DS:0xcb78, and the record it designates is
CharacterRuntime number 0–3.
Routines
Party creation screen
| Address | Range |
|---|---|
0x41ecc | 0x41ecc–0x42053 |
Entry 9 of the overlay, called by the start menu at
0x47113. Loops over the four boxes: a box with a name opens
view or delete, an empty box creates a character.
PLAY is accepted only when boxes 0–3 all have a name (0x4200c–0x42029);
the routine then calls party setup at 0x4203e.
Used by: Creating a party › Creating the party, The creation screen › Portraits, names and controls, Sound effects, Sound and music, Texts
View or delete a character
| Address | Range |
|---|---|
0x40733 | 0x40733–0x408c8 |
Shows a created character; deleting it clears the first byte of
its name (0x4082d), which empties the box.
Used by: Creating a party › Creating the party
Create a character
| Address | Range |
|---|---|
0x41bef | 0x41bef–0x41d52 |
Runs the race, class and alignment menus in turn,
stepping back when a menu returns 0x6e; then
generates the character, opens the stats screen
and asks for a name through the text input (arguments 24, 100, 10)
until the name is not empty. Each round redraws the box and the
side panel without buttons and prints "Name:" at (149, 100); the
entered name is then drawn under the box with the length the
input routine returns.
Comparative source: REF-SCUMM-017,
createPartyMember.
Used by: Character record › Initialization, Creating a party › Creating the party, The start menu, questions and text › Typing text
Race, class and alignment menus
| Address | Range |
|---|---|
0x4174d, 0x41867, 0x41a3d | 0x4174d–0x41837, 0x41867–0x41a3c, 0x41a3d–0x41bee |
0x4174d outlines the current box (rectangle outline, colour 12),
clears the side panel, prints its title, offers the twelve
race and sex names and returns the race_and_sex
value, keeping its sex (value mod 2) in DS:0x6c72 for the
portrait menu (0x4182f). 0x41867 offers the 15 classes
masked by the race's class mask (index race_and_sex / 2),
minus PALADIN (mask 0xfffb) when one of boxes 0–3 with a name has an
alignment of 6 or more (0x41891). 0x41a3d offers the nine
alignments masked by the class's alignment mask, minus
alignments 6–8 (mask 0xfe3f) when one of boxes 0–3 with a name has
class_index 2 (0x41a66). Both return 0x6e for the back button.
Comparative source: REF-SCUMM-017, classMenu
and alignmentMenu.
Used by: Creating a party › Race, class and alignment, Races, The start menu, questions and text › Line menus
Roll an attribute
| Address | Range |
|---|---|
0x40962 | 0x40962–0x409aa |
Rolls 1d6 four times and returns the sum minus the lowest die.
Comparative source: REF-SCUMM-017, rollDice.
Used by: Creating a party › Rolling the attributes
Creation limits
| Address | Range |
|---|---|
0x41690 | 0x41690–0x4174c |
For the current box, sets each attribute's minimum (DS:0xcc18) to the larger of the class and
race
minimums and its maximum (DS:0xcb64) to the race
maximum, from the creation tables; the strength maximum
becomes 18 when the class's strength-limit byte is not
zero (0x4173a). Entry 6 of both arrays, the hit points (DS:0xcc24,
DS:0xcb70), is not set here but by modify a character.
Used by: Creating a party › Rolling the attributes
Generate a character
| Address | Range |
|---|---|
0x41466 | 0x41466–0x4168f |
For one box: sets the three levels from the
starting-level table and all three experience totals to
69,000 divided by its last byte (0x414b0–0x414d5); calls the
creation limits; rolls each attribute with
0x40962, adds the race modifier, raises it to the minimum (0x41527), adds a percentage of 1d100 to a
strength of 18 (0x41547)
and lowers it to the maximum (0x41575); writes each value into both of
its bytes; sets defense to 10 plus the
dexterity modifier; and sums
hit points for a level once per starting level of
each class into hit_points and hit_points_max.
Comparative source: REF-SCUMM-017, generateStats.
Used by: Character record › Initialization, Creating a party › Rolling the attributes
Stats screen
| Address | Range |
|---|---|
0x40624 | 0x40624–0x40732 |
Opens the portrait menu first, then shows the character in the
side panel with REROLL, MODIFY, FACES and KEEP. Buttons 0x8001
reroll (0x41466, without limit), 0x8002
modify, 0x8003 choose another portrait (0x4028a) and 0x8004 or key 0x61 keep; each is
first
pressed on screen.
Used by: Creating a party › Creating the party
Modify a character
| Address | Range |
|---|---|
0x412ea, 0x40b4f | 0x412ea–0x41457, 0x40b4f–0x412e9 |
0x412ea steps through seven fields with a jump table at
0x41458: the six attributes (strength with its percentage) and
hit_points, edited through a byte copy (0x413dd–0x41411). 0x40b4f
edits one field within the creation limits; when it opens the
hit points, it writes the hit-point limits into slot 6
of the limits, computed at 0x40c70–0x40d19 (maximum DS:0xcb70 at 0x40cc3,
minimum DS:0xcc24 at 0x40d19). Strength above 18 moves into the percentage (0x40e11–0x40ea5), which is zeroed when the
maximum is below 19. A changed
constitution recomputes the limits and moves hit_points and
hit_points_max inside them (0x40fc5–0x41110); a changed dexterity
recomputes defense (0x4118e–0x411b9). Only the first byte of each
attribute is written.
Comparative source: REF-SCUMM-017, modifyStat.
Used by: Character record › Initialization, The creation screen › Modifying a character
Load the creation images
| Address | Range | Status |
|---|---|---|
0x41d53 | 0x41d53–0x41ecb | The allocation call is inferred |
Entry 4, called by the party creation screen at 0x41eea and by
the prepared party at 0x427af. It allocates the
19 button records of DS:0x6d82 (0x3c bytes each, resident 0x2d0eb);
loads CHARGENA into page 3 through the CPS image loader
and cuts its 44 portraits, ten per row of 32 × 32 pixels, through
driver slot 28 into DS:0xd0b2; loads
CHARGEN through 0x19338 and copies it to the
screen; loads CHARGENB, cuts its first ten 32 × 32 shapes into
DS:0xd17a (the box animation) and the
button labels, and copies the picture to page 2 (through page 4
in display modes 0 and 1). It finally saves the
screen's right-hand panel (144, 64, 160 × 128) at (0, 0) of page 2: the
clean panel that every side-panel drawing starts from.
Used by: How it fits together, Prepared party, Images, palettes and fonts, Decoration, door and monster images, Dungeon graphics, Scenes and sequence pictures
Party-screen instructions
| Address | Range |
|---|---|
0x408d7 | 0x408d7–0x40961 |
Called by the party creation screen on entry (0x41efe) and
after each visit to a box (0x42003). Restores the clean side panel, prints
the instruction text DS:0xa51, which asks for a box to create or view,
at (168, 16), shows the panel, then calls
0x3fd29.
Used by:
PLAY when the party is complete
| Address | Range |
|---|---|
0x3fd29 | 0x3fd29–0x3fde0 |
Counts the boxes 0–3 that have a name. With four, it prints DS:0x9c3
("Your party is complete…", which also names the P key) at (168, 61) in
the panel, copies that text to the screen and draws button 15,
PLAY; otherwise it draws button 14, the same area without PLAY. The PLAY
button definition stays active in both cases; the
party creation screen ignores it while a name is missing.
Used by: The creation screen › Portraits, names and controls
Choose a portrait
| Address | Range |
|---|---|
0x4028a | 0x4028a–0x4059a |
Called by the stats screen when it opens (0x4062c) and by its
FACES button (0x406c8). It builds buttons 21–26 (two arrows, four
portraits), shows the side panel without a portrait and draws
the arrow buttons 12 and 13. The first portrait offered is 0, or 26 when
the sex DS:0x6c72 is female, moved to the next free one; four
consecutive free portraits are drawn at x = 176, 208, 240, 272, y = 66.
| Input | Effect |
|---|---|
left arrow button (0x8001) or key 0x5c | Press button 12; in keyboard control, move the highlight left, otherwise (or from the first position) scroll back by one free portrait |
right arrow button (0x8002) or key 0x66 | Press button 13; in keyboard control, move the highlight right, otherwise (or from the last position) scroll forward by one free portrait |
a portrait (0x8003–0x8006, jump table 0x4059b) | Choose that portrait |
key 0x2b or 0x61 | Choose the highlighted portrait, the second one when the menu opens |
The key codes 0x5c, 0x66, 0x2b and 0x61 are keypad 4, keypad 6,
Enter and keypad 5; the grey Left and Right keys and keypad Enter give the
same numbers (keyboard handler).
The highlight is the box frame 10 + position, shown only in
keyboard control. The choice is stored in DS:0x79a for the box and in
portrait of the CharacterRuntime
(0x40547), and 0x578 bytes of the portrait shape are copied into the
character's face_image buffer through the far copy
(0x40581); the side panel is then redrawn with the stats buttons.
Comparative source: REF-SCUMM-017,
faceSelectMenu.
Used by: Stats screen, The creation screen › Portraits, names and controls
Next free portrait
| Address | Range |
|---|---|
0x405a3 | 0x405a3–0x40623 |
0x405a3(start, sex, step, chosen): from start (a negative value becomes
43), modulo 44, steps by step (±1) until it finds a portrait that no box
0–3 with a name has chosen and that suits the sex: portraits 0–28 for a
male, 26–43 for a female, so 26–28 are offered to both. Called four times by
the portrait menu.
Comparative source: REF-SCUMM-017,
getNextFreeFaceShape.
Used by: Choose a portrait, The creation screen › Portraits, names and controls
Show a character in the side panel
| Address | Range |
|---|---|
0x3fe84 | 0x3fe84–0x40279 |
0x3fe84(box, mode), entry 5, called from ten places. It restores the
clean side panel in page 2 and, except in mode 4, draws the character's
face_image at the top of the panel; it prints, centred in the panel by name
length, the name, the race and sex name and the
class name; the labels STR to CHA (DS:0x1ee6) with
the six attributes (strength as strength text),
then "AC", "HP" and "LVL" with defense, hit_points_max and the levels,
shown as one, two or three numbers depending on levels[1] and levels[2]
(formats DS:0xa27–0xa48, through the buffer). The
mode adds buttons: 1 REROLL, MODIFY, FACES and KEEP; 2 DELETE and OK; 3
+, − and OK; 0 and 4 none. The panel is then copied to the screen at (144, 64).
Comparative source: REF-SCUMM-017,
printStats.
Used by: The creation screen › Portraits, names and controls
Draw a name under its box
| Address | Range |
|---|---|
0x3fde1 | 0x3fde1–0x3fe83 |
0x3fde1(box, length, colour): with the font DS:0x9342
(installed for the call), blanks the box's name
field (ten spaces in colour 12) and prints the name centred in 60 pixels by length times the font's character
advance. Create a character
calls it with the value returned by the text input
and colour 2, which is −1 when the player ends the name with Escape
(0x41d1f–0x41d33; ANOMALY-125); deleting a character (0x40733) calls it with colour 12 after
emptying the name,
which only clears the field.
Comparative source: REF-SCUMM-017,
processNameInput.
Used by: The creation screen › Portraits, names and controls, Anomalies and bugs
Redraw a box
| Address | Range |
|---|---|
0x409ab | 0x409ab–0x40a15 |
0x409ab(selector) turns the box frame off, then draws button selector − 50 when selector is above 48,
or the current character's
face_image in its box otherwise. Deleting a character passes box + 50,
which draws the empty box. The name step of
create a character passes the hit-point minimum
DS:0xcc24 (0x41cbf), tested at 0x409c2; the
portrait is drawn whenever that minimum is 48 or less. That argument is the
proof of ANOMALY-96.
Comparative source: REF-SCUMM-017,
processFaceMenuSelection.
Used by: Create a character, View or delete a character, The creation screen, Anomalies and bugs
Animate the active box
| Address | Range |
|---|---|
0x40a16 | 0x40a16–0x40b4e |
Entry 11, called on every pass of the race, class and alignment menus, the
stats screen, the portrait menu and the modify editor. It cycles the ten
CHARGENB frames of DS:0xd17a in the current box:
when the free-running counter is past the time stored
in DS:0x6c6e, it takes the next frame (0 after 9) and sets the time two
ticks ahead, so a new frame appears at most every third tick. A change of
box restarts the timing. Each new frame is drawn over the box's clean
background from page 2 and copied into the box.
Comparative source: REF-SCUMM-017,
updateMagicShapes.
Used by: The creation screen › Portraits, names and controls
Build a button list
| Address | Range |
|---|---|
0x3fc54, 0x3fbd0 | 0x3fc54–0x3fd28, 0x3fbd0–0x3fc53 |
0x3fc54(first, count) (entry 12) fills button records 0 … count − 1 of
DS:0x6d82 from the button definitions first onwards through
0x3fbd0 (entry 20), links them in order with the
list append routine, sets
DS:0x6389, so that the next
button-list pass takes the list again although its
address has not changed, and returns the first record. 0x3fbd0(index, x, y, w, h, key)
copies the template DS:0x39b8 into the record and sets its number (index + 1), its key, its rectangle (x in columns,
multiplied by 8) and
the flags 0x1100. The screens use the lists (0, 5) party screen, (0, 7)
view or delete, (21, 6) portraits and (27, 4) stats. A click on the k-th button of a list, counted from 1, is returned
as 0x8000 + k
(from the uses).
Comparative source: REF-SCUMM-017,
initButtonsFromList and initButton.
Used by: How it fits together
Draw a button
| Address | Range |
|---|---|
0x3f943 | 0x3f943–0x3fb94 |
0x3f943(index, state, mode) draws button index (none for 17 or more,
unsigned test at 0x3f94e) from its drawing record: the normal (state
- or pressed (1) picture from page 2, then its label. In mode 0 the button
is put together at (160, 0) of page 2 and copied to its place on the
screen; in mode 2 it is drawn only into the side-panel copy of page 2, at
the place that the side panel later shows. The 14 call sites pass
only these two modes. Another value would be put together at the panel
position, as for mode 2, and then copy (160, 0) of page 2 to the screen
(
0x3fa8e–0x3fb8a).
Comparative source: REF-SCUMM-017,
drawButton.
Used by: How it fits together
Press a button
| Address | Range |
|---|---|
0x3fb95 | 0x3fb95–0x3fbcf |
Draws the button pressed, plays sound 76, waits
through the refresh wait (argument 5) and draws it released. Called from
14 places whenever a button or its key is used. While the INTRO sound file
is loaded, entry 76 is empty in both INTRO.ADL (255) and INTRO.SND (0), so
the request for sound 76 is not heard (ANOMALY-158).
Comparative source: REF-SCUMM-017,
processButtonClick.
Used by: How it fits together, Sound effects, Sound effects, Anomalies and bugs
Read the input
| Address | Range |
|---|---|
0x3f910 | 0x3f910–0x3f942 |
Returns the key reader's code for the given
button list. Before that, when the byte of the embedded music driver read by
the introduction's music waits (resident
0x10250) is 1, it clears it and plays sound 13, the sound the
party creation screen starts when it opens (0x41f15). With
the AdLib driver, sound 13 of INTRO.ADL is a tune of 69.3 seconds
(5,047 driver ticks) that never sets that byte: run on the driver's code
it stops and leaves the byte unchanged. The music is therefore restarted
at most once, and only when the introduction was skipped between its first
and second markers, which leaves the byte at 1; otherwise it plays once
and stops.
Comparative source: REF-SCUMM-017,
getInput.
Used by: How it fits together, Sound effects
Cut the button labels
| Address | Range |
|---|---|
0x3f860 | 0x3f860–0x3f90f |
Called once by 0x41d53 after CHARGENB is loaded. For each
of the 17 drawing records it clears DS:0x752 and, when the record has a
label, cuts it through driver slot 28. The labels are released by
overlay 246.
Used by: Load the creation images
Highlight the first portrait
| Address | Range | Status |
|---|---|---|
0x4027a | 0x4027a–0x40289 | No caller found |
Entry 22. Calls the resident box frame highlight with frame 10. 0x1e78e(frame) draws a
blinking frame from the rectangles at DS:0x545c, stepping through the
colours of DS:0x23cc once per tick; a new frame number erases the previous
frame and −1 removes it. Frames 6–9 are the four boxes and 10–13 the four
portraits of the portrait menu, so frame 10 is its first
portrait.
Used by: Choose a portrait
Find the n-th set bit
| Address | Range | Status |
|---|---|---|
0x41838 | 0x41838–0x41866 | No caller found |
Entry 23. 0x41838(mask, n, count) returns the position of the n-th
set bit (counting from 1) among the low count bits of the 16-bit mask,
or count when there is no such bit.
Used by: Routines at a glance
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.