Palettes (PAL, EGA, COL)
File formats · Field reference · Schema
In brief
The palettes give the 256 colours of the screen. Each file is 768 bytes: the red, green and blue intensities of colours 0 to 255, from 0 to 63, with no header. The game reads a palette into its working palette and has the display driver set all 256 colours.1
Organization
| Bytes | Contents |
|---|---|
| 0–2 | Colour 0: red, green, blue. |
| 3–5 | Colour 1. |
| … | … |
| 765–767 | Colour 255. |
The same layout is used by 28 files. Pictures in CPS containers may carry their own palette in the same layout.
Reading the file
In the VGA display mode, the level loader
reads the palette named in the level's INF record,
or the one of its graphics name when the record names none.2 In the EGA
display mode, a .EGA file is read instead of the .PAL file or of the picture's
own palette.3 The introduction and the
ending have their own files, and one file is read once at
start-up, before the start menu.4
Each file and what uses it.
What it becomes in memory
The game reads a palette into its working palette, then has the display
driver set the 256 colours.1 The intensities are those of the VGA palette registers, 0 to 63; every
value in the 28 files lies in that range. In the VGA display mode they are
set as they are. The EGA driver cannot show 256 free colours: it maps each
colour of the palette to the nearest of its pairs of EGA colours, and the
.EGA files use many colours made only of the intensities 0, 21, 42 and 63,
those of the EGA colours.3 The level's palette also
serves to build the colour tables that darken items and monsters with
distance; see darkening.2
Example
The start of FOREST.PAL:
0000 00 00 00 colour 0: black
0003 2a 00 2a colour 1: red 42, green 0, blue 42
0006 00 2a 2a colour 2: red 0, green 42, blue 42
Sources
Locations refer to the game executable reference;
the files are identified in the file inventory; comparative
source: REF-MW-013.