Level data (INF)
File formats · Field reference · Schema
In brief
An INF file holds everything a level needs besides its wall plan: which map
and graphics to use, its doors, its kinds of monsters and where the monsters
start, what each wall number means, its timed events, its script program, and
which cells trigger which scripts. There are 16 of them, LEVEL1.INF to
LEVEL16.INF, each compressed in a CPS container that must be
unpacked first.
An INF file links the other files of a level by name:
In the reference files, the graphics names match the five dungeon styles (dung, forest, mezz,
silver, crimson)
with their .VCN, .VMP
and .PAL files; the sound names match .ADL and .SND files such as
CATACOMB.ADL; and names such as guard1, wolf or door1 match .CPS
images. The INF number need not match the map number: LEVEL6.INF uses
level5.maz.
Organization
Offsets inside an INF file count from the start of the unpacked data.
| Part | Contents |
|---|---|
| Header word | Where the level-state section starts. |
| Sublevel records | One or two linked records. Each names a map and its resources and lists doors, the step-script limit, monster images, monster types, wall mappings and decorations, and timed scripts. |
| Level-state section | Where the cell bindings start; the initial monster block (absent from LEVEL10.INF); the script data: the offset of its strings, the script code, then the level's zero-terminated strings. |
| Cell bindings | A counted list attaching event flags and a script entry point to cells. |
Two features make the file hard to read by hand. Names are stored in fixed 13-byte slots, and the bytes after the terminating zero are not always zero. Many parts start with a marker byte that decides whether the part is present; a door record has a second marker, which also lets small projectiles through its doors. Each marker is compared with a single value, or two for a door record: one outcome reads the part and the other skips it, so every value has a defined effect. The marker of a sublevel record covers only the map, graphics and palette names: the game reads the sound name and every later part whatever its value.1
The script data holds nothing but the level's script code and its strings: its first word gives where the strings start, the code fills the bytes before them, and the strings run to the cell bindings. Script offsets, in the cell bindings and in jumps and calls, count from the start of this data; see the script virtual machine.2
Reading the file
The game reads a level's INF file each time it loads the level: when a game starts, when a saved game is loaded, and when a script changes level; see when the game loads a level. It unpacks the file, follows the link to the selected sublevel record, loads the map and resources it names, then reads the monsters, copies the script data and applies the cell bindings to the level's blocks.3 The record is selected by its index, the sublevel given by the script that changes level or kept in the saved game. Six levels — 1, 3, 7, 8, 11 and 16 — have a second record naming the same map and resources but other monsters, doors, wall mappings and timers; their scripts select it for part of the level. All records share the level-state section and the cell bindings. See sublevels for when each one is used and what a change keeps.
What it becomes in memory
Each part of a sublevel record is read by its own
routine: wall mappings and decorations,4 timed scripts,5 the
step-script limit6 and the two door records.7 A door record names
the image of one of the level's two door graphics, its
DoorKind, whether it shows a switch, and the
rectangles of its door and switch shapes; see
doors. The initial monster slots are turned into
MonsterRuntime slots;8 the
cell bindings set the event flags and the script reference of
LevelBlockRuntime blocks.2
These tables are what the monsters, the walls and doors, the scripts and the dungeon view work on; what each part of the files becomes follows every part to its run-time use.
Malformed values
The game trusts the file. The loader checks no offset, count or index: offsets are followed as given, counts are compared as signed numbers, so a count with its high bit set reads nothing, and indices — cell, monster slot, monster type, timer and wall numbers — are used without a range check. An index past its table writes into whatever data follows it, and the script data is copied into an area of fixed size whatever its length. The original files stay within every table; the schema gives, for each field, what an out-of-range value reaches.9
Example
The first 32 bytes of LEVEL1.INF once unpacked:
offset bytes meaning
0000 0d 04 level-state section at 0x040d
0002 e5 02 next sublevel record at 2 + 0x02e5
0004 ec marker: this record names its resources
0005 6c 65 76 65 6c 31 2e 6d 61 7a 00 00 00 map: "level1.maz"
0012 64 75 6e 67 00 31 2e 6d 61 7a 00 00 00 graphics: "dung", then leftover bytes "1.maz"
001f ff palette: same name as the graphics
Related pages
- Scripts and scripts by level: what the script data and cell bindings do.
- Monsters and
MonsterMode: how the initial monsters behave. - The game clock: timed scripts and the step counter.
- Level maps (MAZ), wall decorations (DEC).
- What the files name, level by level: level maps, dungeon graphics, sound and music, and texts for the level's strings.
Sources
Locations refer to the game executable reference;
comparative sources are listed in the technical references
(REF-MW-003, REF-SCUMM-003,
REF-SCUMM-004, REF-SCUMM-006,
REF-SCUMM-007, REF-SCUMM-013,
REF-SCUMM-020). The values quoted in the
schema were read from the 16 INF files of the
file inventory.