Skip to main content

Dialogue texts (TEXT.DAT)

File formats · Field reference · Schema

In brief​

TEXT.DAT holds the longer texts of the game: what the illustrated dialogue screen shows during the scripted conversations, and the contents of the parchments that the party can read. Scripts and parchments name a text by its number; the short strings used as button labels and messages belong to each level's INF file instead. How many there are and who uses them is listed under texts.

From the file TEXT.DAT to the game. The file holds, in order: Offsets (16-bit, one per text); Texts (zero-terminated). The game: Read up to 32,000 bytes when a dialogue opens or a parchment is read. In memory: The text buffer. Used by: The dialogue screen, Parchments.
The game turns it into the text buffer.

Organization​

The file starts with a table of 16-bit offsets, one per text, followed by the texts themselves, each ended by a zero byte. Text n is the one whose offset is entry n − 1 of the table.

The texts contain a few control bytes, explained with the page layout of the dialogue screen: a page break, a colour change and a new line. The game wraps the lines itself.1

Reading the file​

The game reads at most 32,000 bytes of it into a shared buffer each time a dialogue opens or a parchment is read, then takes the text by its number; it never counts the entries and checks neither the number nor the offset.2 The same buffer holds the unpacked INF data while a level loads.

Example​

The first bytes of the reference file:

offset bytes meaning
0000 f4 00 text 1 starts at 0x00f4: the table is 244 bytes, 122 texts
0002 64 02 text 2 starts at 0x0264
...
00f4 20 20 20 20 22 4f 68 20 … text 1: four spaces of indentation, then "Oh …

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references (REF-MW-012). The file is identified in the file inventory.

Footnotes​

  1. Text output. ↩

  2. The TEXT.DAT loader, the text routine, the parchment reader and the shared buffer. ↩