PALETTES.DAT

From UFOpaedia
Revision as of 03:42, 12 June 2007 by Bomb Bloke (talk | contribs)
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 a given image, though it lowered the amount of colors that could be used in any single 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 UFOpedia uses the first, second, fourth or fifth palettes, depending on the requirements of the entry being displayed.

The final 16 colors of each palette are reserved. These are replaced in-game by the colors from the appropriate BACKPALS.DAT palette, and used to draw the backgrounds of the bordered windows; where there are no background images they are unused.

5 BattleScapePal2.Png

The exception to this is the Tactical palette, where the final 16 colors are replaced by a greyscale set stored in neither of the palette files (pictured right; presumably, they are hard coded into the executable instead). These colors can be used by objects or terrain, etc, but are not loaded for the UFOpedia display.

Because of this there are two different sets of item images, each bearing the title "BigObs": Those used in the UFOpedia (a collection of 57 PCK files in the UFOGRAPH folder), and those used in Tactical mode (a single PCK archive in the UNITS folder).

Color Indexes

1. GeoScape World View.
2. Base Palette.
3. Graph Views.
4. Research Displays.
5. Tactical Palette.

See Also