PALETTES.DAT

From UFOpaedia
Revision as of 12:43, 11 June 2007 by Bomb Bloke (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Back in the days of low video memory, storing each pixel as a multi-byte color value (such as in today's "High Color" and "True Color" modes common under MS Windows) was not practical. Instead, a common method for was to create a palette of 256 different colors (usually of 3 bytes each), and then use single byte values to index into that. The ability of a video card to use such a palette was known as "VGA compatibility".

This dramatically decreased the memory requirements of an given image, though it lowered the amount of colors that could be used at any given moment.

There are a total of five "complete" palettes in UFO, each for a different situation. Each is made up of the standard 256 colors, stored as three byte RGB records (A value for Red, a value for Green, and a value for Blue). This makes a total of 768 bytes per palette.

Each RGB value has a maximum intensity of 63/x3F (making a total of 262,144 shades available, which seems to be standard for VGA), as opposed to 255/xFF (which would have provided 16,777,216). Each palette has a six byte 'buffer' following it. While their meanings are unknown, they are:

Pal1: B7 13 FF 76 FE 50
Pal2: A1 E8 13 0B 06 E6
Pal3: 01 00 8B 46 FA 0B
Pal4: FF 76 10 FF 76 0E
Pal5: C8 1E 00 00 1E B8

Five palettes of 768 bytes each, plus five buffers of 6 bytes each, makes 3,870 bytes in Palettes.Dat.

Usage

Color 0 is not used in the game, it instead represents "transparency" (ie. Pixels which should not be drawn to the screen).

The final 16 colors of the Tactical palette do not seem to be used. They are instead replaced at run time with a light-to-dark selection of greyscale colors, which are presumably stored in the executable.

The UFOpedia either uses the second or fifth palette. Although it displays items used in the Battlescape, it does not use the final 16 colors displayed in that view. Because of this, there are two different sets of item images, each bearing the title "BigObs": Those used in the UFOpedia (stored in a collection of 57 PCK files in the UFOGRAPH folder), and those used in the Tactical display (stored in a PCK archive in the UNITS folder).

These primary palettes are frequently overwritten in parts with the mini-palettes stored in BACKPALS.DAT (in order to render background images under different color schemes).

Color Indexes

1. GeoScape Palette.
2. Unknown Usage. UFOpedia?
3. Graph Views.
4. Research Displays.
5. Tactical Palette.

See Also