4x4 Off-Road Racing Sprite Format

From ModdingWiki
Jump to navigation Jump to search
4x4 Off-Road Racing Sprite Format
4x4 Off-Road Racing Sprite Format.png
Format typeImage
HardwareCGA, EGA
Colour depth2-bit (CGA), 4-bit (EGA)
Minimum size (pixels)2
Maximum size (pixels)No limit
PaletteDefault CGA, EGA
Plane count2
Transparent pixels?Yes
Hitmap pixels?No
Games

This format is used by 4x4 Off-Road Racing to store sprite graphics. The extension is *.pck, however the game has different graphic formats that use the same extension. *.pck files with an SPR or OBS suffix are sprite files as is the TRUCKS.PCK file. Each file has multiple images in it, each image has a transparency mask.

Image

The format has no header. The size of the image and color palette are stored in the EXE, so modification is limited. The format is encoded with a basic run-length encoding. Since the format only supports 2-bit color, each byte of graphic data accounts for 4 pixels. Unlike the 4x4 Off-Road Racing Full Screen Graphic Format, the background graphic format is not interlaced so you can read directly from top to bottom.

When decoding the graphic, read from the beginning of the file, load one byte for pixel data, and another for the length of the run. Each pixel byte is 4 pixels of data, 2-bits per pixel. Since the sprites have different widths you must know the width of each sprite and mask prior to reading it.

Data type Name Description
BYTE pixels Binary representation of 4 pixels (2 bits per pixel)
UINT8 length Number of times to repeat this pixel pattern.

Source Code

The viewer program in the 4x4 Off-Road Racing Full Screen Graphic Format page can also view sprite graphics, however it currently doesn't have an accurate width look up table, so not all the sprites can be viewed properly.

Credits

This graphic format was reverse engineered by TheAlmightyGuru. 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!)