Skip to main content

Fading tables (FADING.DAT)

File formats · Field reference · Schema

In brief​

FADING.DAT holds seven colour tables that the introduction uses in the VGA display mode to draw pictures fading in or out. A table gives, for each colour number, the colour number drawn instead.

From the file FADING.DAT to the game. The file holds, in order: Seven tables (256 bytes each). The game: Read when the introduction starts; When missing, build the tables and write the file. In memory: The display driver’s colour table, one table at a time. Used by: Fades of the introduction, VGA mode.
The game turns it into the display driver’s colour table, one table at a time.

Organization​

BytesContents
0–255Table 0: the colour drawn for each colour 0 to 255.
256–511Table 1.
……
1536–1791Table 6.

Reading the file​

The introduction reads the file, in the VGA display mode only, and does not check how many bytes it got. The game does not need the file: when it is missing, the introduction builds the tables and writes the file, then reads it at the next start.1

When it builds the tables, table k takes each colour of the current palette part of the way, weight 36 × (k + 1) out of 256, towards colour 18, and keeps the nearest colour of the palette; entry 0 is 0.2

The tables of the original file are not those that this rule gives with the introduction's palettes. Running the display driver's own table builder on PALETTE1.PAL, the palette the introduction has set at that moment in the VGA mode, gives tables that agree with the file on 129 to 146 of the 256 entries of tables 0 to 5 and on all of table 6. Neither another weight with PALETTE0 or PALETTE1, nor another palette file of the game with the game's weights, gives the file's tables.3 Which palette they were built from is unknown. Deleting the file therefore changes the fades of the introduction slightly: the game then builds its own tables and writes them in place of the original ones. A reimplementation that keeps the file uses its tables as they are.

What it becomes in memory​

To draw a shape at fade level n from 1 to 7, the introduction installs table n − 1 as the display driver's colour table and draws the shape through it; level 0 restores the background instead.4

Example​

The start of table 0:

0000 00 5f 56 c0 ff 91 74 a0 … colours 0, 1, 2, 3 … are drawn as 0, 95, 86, 192 …

Sources​

Locations refer to the game executable reference; the file is identified in the file inventory.

Footnotes​

  1. Load or build the fading tables. ↩

  2. The VGA driver's build a colour table. ↩

  3. Run in a processor emulator on the table builder of MGA.OVL (driver slot 12) with the arguments the introduction passes, colour 18 and weight 36 × (k + 1); then with every even weight for PALETTE0 and PALETTE1, and with the game's weights for every palette file. ↩

  4. The introduction's animation commands and the VGA driver's install a colour table. ↩