Catacomb Tileset Format

From ModdingWiki
(Redirected from XGAChars Format)
Jump to navigation Jump to search
Catacomb Tileset Format
There is no image of a tileset in this format — upload one!
Format typeTileset
HardwareCGA, EGA
Max tile countUnlimited
PaletteDefault CGA/EGA
Tile names?No
Minimum tile size (pixels)8×8
Maximum tile size (pixels)8×8
Plane count4
Plane arrangementLinear CGA, Graphic-planar EGA
Transparent pixels?No
Hitmap pixels?No
Metadata?None
Supports sub-tilesets?No
Compressed tiles?No
Hidden data?No
Games

The Catacomb Tileset Format is used in both Catacomb and Catacomb II to store 8×8 pixel tiles used for drawing the game levels. The format can be used to store both CGA and EGA data, with each type stored in separate files named CGACHARS.xxx and EGACHARS.xxx. This format is similar to the font data in the xGAPICS files, which obsoleted the xGACHARS format in later games.

Catacomb II appears to use the font tiles from xGAPICS.CA2 to draw the menu windows and text onto the screen, not the ones from xGACHARS.CA2. This can be deduced from the fact that the menu "cursor" is displayed as a red circle, which is not present in xGACHARS.CA2.

File format

The file contains raw graphics data and has no header, so you'll need to calculate the number of tiles yourself.

For the CGA, one byte stores the color information for four pixels. Since the tile has 64 pixels (8×8), each tile takes up 16 bytes.

For the EGA, one byte can only store two pixels (regardless of the plane's order), so you need 32 bytes per tile. This gives you the following two formulae to calculate the tile count:

num_ega_tiles = filesize / 32
num_cga_tiles = filesize / 16

For the CGA version, reading the CHARS is exactly the same (2bpp linear) as reading the font tiles from the CGAPICS file.

The EGA version is a bit different. In EGAPICS, you have one huge data block for each EGA plane (planar EGA data), where each block/plane contains data for all images. In the EGACHARS file, each tile has its own four planes, self contained within the 32 bytes for each tile (graphic-planar EGA data). This means you can read one single tile without having to scan through the whole file to get to the start of each plane.

Notes

This file format was reverse engineered by K1n9_Duk3. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)