Skip to main content

Resting

Overlay 248 · image 0x450e0–0x465cc (5,357 bytes) · 11 stub entries

All overlays · ← 247 · Camp menu and spells · 249 · Start-up and start menu →

In brief​

Overlay 248 runs a rest, started from the camp menu. Before resting it checks whether rest is refused, lets nearby monsters act, may play a dream on level 3 and asks about poison and healing. Each step then recovers spells and heals; every hour and every eight hours bring their own effects (poison, Lay on Hands, food and hunger). The overlay also holds the rest messages, Insal's departure and the DRANX sequence. The rules are described in resting.

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 phases of a rest. 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
0x7c0:0x4d, 0x2ad7:0x390x450e0, 0x4649eRest; DRANX sequence

Routines at a glance​

RoutineAddress
Rest0x450e0
Recover a spell0x45301, 0x453c7
Most injured character0x459fd
Rest messages0x45a6e, 0x45bf0, 0x45e53, 0x45f7a
Monster rounds while resting0x45c59
Spells left to recover0x45d3f
Insal leaves0x460f7
DRANX sequence0x4646a, 0x4649e
Has a cure spell0x46573
About this overlay

The rest command and its helpers. The stub has eleven entries; only the rest routine (entry 9, 0x7c0:0x4d) and the DRANX sequence (entry 5) have far-call sites.

Routines​

Rest​

AddressRange
0x450e00x450e0–0x459fc

The rest routine, called by the game menu of overlay 247 at 0x44884. Before the loop: the rest refusal flag (0x450ff), the monster rounds (0x4511b), level 3 and the dream sequence (0x45128), the poison question (0x4516b–0x451b0) and the healer question (0x451bb–0x45258). A step starts at 0x4528a: spell recovery (0x4528d–0x4544e, see recover a spell) and healing (0x45451–0x45673; no eligibility test of the healer in this range); the hour mark (0x45676–0x456e2) adds 32,760 to the shared counter and deals 10 damage to poisoned characters; the eight-hour mark (0x456e4–0x4591b) restores Lay on Hands, adds 1 hit point, consumes food and deals hunger damage. Food is consumed only when the ring search, which returns 0 or 1, gives a negative value: jl at 0x45841. End tests at 0x45923–0x459a9; the end message and Insal at 0x459ac–0x459f4. Returns 1 when a monster near or the party status check ended the rest, or when it did not start for a reason other than the poison question.

Anomaly: ANOMALY-146: at the eight-hour mark, the third search looks for a zero among the ten cleric entries at +0x89 (0x45798–0x457b0) and writes 28 through the result with no null test (0x457b3–0x457ba). The first two searches test theirs (0x45737, 0x4576a).

Comparative source: REF-SCUMM-019, restParty.

Used by: Anomalies and bugs, Character eligibility tests › Masks used by resting, Character record › Spell slots, Flag operation targets › Forbidding rest, Item types › Where it is used, Resting › A step of rest, Resting: special cases › Anomalies while resting, Resting › Every hour and every eight hours, Resting › Resting, Resting › When the rest ends, Resting › Whether the party can rest, Scripted characters, flags and messages › Flags and resting, Resting: special cases, The start menu, questions and text

Recover a spell​

AddressRange
0x45301, 0x453c70x452ea–0x45374 (cleric slots) and 0x453b0–0x4543a (mage slots), in the rest routine

Turn the first used (negative) slot of a character back to positive when its group is within reach of the character's counter, set the counter to 48 and print "%s gained %s." or "%s memorized %s." with the spell's name (formatted at 0x4531a and 0x453e0). The group is the slot index divided by 10 for cleric slots (0x452ec) and by 6 for mage slots (0x453b2).

Comparative source: REF-SCUMM-019, restParty.

Used by: Character record › Spell slots, Magic › How the game stores spells, Resting › A step of rest, Resting: special cases › Anomalies while resting, Mage and cleric spells › Special entries, Spell definition › In brief, Anomalies and bugs

Most injured character​

AddressRange
0x459fd0x459fd–0x45a6d

Returns 1 + the slot with the fewest hit points among the characters passing eligibility mask 3 and below their maximum, the first on a tie; 0 when there is none.

Comparative source: REF-SCUMM-019, restParty_getCharacterWithLowestHp.

Used by: Character eligibility tests › Masks used by resting, Resting › A step of rest, Resting: special cases › Anomalies while resting

Rest messages​

AddressRange
0x45a6e, 0x45bf0, 0x45e53, 0x45f7a—

0x45a6e draws the rest box with "Resting party." and prints "Hours rested: %-4d"; 0x45bf0 prints a message in the text window; 0x45e53 shows a text of the string list in a box until a key or 120 delays; 0x45f7a draws a labelled button and waits for a click on it or a key.

Comparative source: REF-SCUMM-019, restParty_updateRestTime and restParty_displayWarning.

Used by: —

Monster rounds while resting​

AddressRange
0x45c590x45c59–0x45d3e

With the sounds option (DS:0x65fa) cleared and the resting flag set, runs five times the monster update of groups 0 and 1 and moves the flying objects; after each round, returns 1 with "You can't rest here, monsters are near." when a monster slot whose mode is not 8 is at a distance below 2 from the party's block. The test at 0x45ce7 ignores only mode 8 (MONSTER_MODE_PEACEFUL); a monster turned to stone (MONSTER_RUNTIME_TURNED_TO_STONE), which the monster update skips, or held still (MONSTER_MODE_PARALYZED) counts.

Comparative source: REF-SCUMM-019, restParty_updateMonsters.

Used by: Modes and provocation › What a monster's state changes, Resting: special cases › Anomalies while resting, Resting › Resting, Resting › When the rest ends, Resting › Whether the party can rest, Anomalies and bugs

Spells left to recover​

AddressRange
0x45d3f0x45d3f–0x45e52

Returns 1 when a character passing mask 0x43 has a used cleric slot, with a cleric or paladin class component and an item of type 30, or a used mage slot, with a mage component and an item of type 29.

Comparative source: REF-SCUMM-019, restParty_checkSpellsToLearn.

Used by: Character eligibility tests › Masks used by resting, Item types › Where it is used, Resting › A step of rest, Resting: special cases › Anomalies while resting, Resting › When the rest ends

Insal leaves​

AddressRange
0x460f70x460f7–0x46469

When at least five characters are present and one passing masks 1 and 2 has portrait −1, removes it, moves slot 5 or 4 into its slot when it was among the first four (swap), clears bits 1 and 2 of the global flags (0x461b6; the only scripts that use these bits are level 2's, see ANOMALY-120), removes items of types 1 or 2, 31, 39 and 47, places a copy of item 28 with value 26 (written at 0x46246) in the party's block (through 0x4af02 of overlay 252) and shows texts 63 and 64. That value makes the parchment show text 27 of TEXT.DAT through read a parchment.

Comparative source: REF-SCUMM-019, DarkMoonEngine::restParty_npc.

Used by: Character eligibility tests › Masks used by resting, Global script flags, Item types › Where it is used, Resting: special cases › Insal leaves, Anomalies and bugs, Level 2: reference tables › Shorn

DRANX sequence​

AddressRange
0x4646a, 0x4649e0x4646a–0x4649d, 0x4649e–0x46572

0x4649e (entry 5, 0x2ad7:0x39) shows the DRANX pictures with sound effect 0x38, waiting between them with 0x4646a, which waits until the free-running counter has advanced by its argument. Called by the kill a monster path at 0x1abd7 when a monster turns into the next type.

Used by: When a monster dies › In what order, Sound effects, Images, palettes and fonts, Texts, Decoration, door and monster images, Dungeon graphics, Scenes and sequence pictures, Level 16: reference tables › The final fight and the end of the game

Has a cure spell​

AddressRange
0x465730x46573–0x465cc

Returns 1 when a cleric slot of the character holds 3, 16 or 20, used or not.

Comparative source: REF-SCUMM-019, restParty_checkHealSpells.

Used by: Resting › A step of rest, Resting: special cases › Anomalies while resting

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.