Back

Developer Network
  File Specs
  Source codes
  Tables
  Mailing lists
  Knowledge Base

Other Games

 

 

Descent Developer Network
Descent 1/2

*.256 specs

Introduction

256 files contain the palette to a specific PIG file in Descent 2. For example GROUPA.256 belongs to GROUPA.PIG. While the PIG files are stored in the main Descent 2 directory, the 256 files are inside the DESCENT2.HOG. You can make new PIG files with their own 256 files. Just copy the PIG file then to the Descent 2 directory and store the 256 file into your HOG.

This document was written by Bryan Aamot and Anthony "Nirvana" Galica.

eMail author: Anthony "Nirvana" Galica
256ED - An editor for *.256 files, written by Nirvana

 

Format

The *.256 file contains:

typedef struct tagFILE256 {
 BYTE palette[768]; // rgb values, see below
 BYTE colorTables[34][256]; // color tables, see below
} FILE256, *LPFILE256;

The rgb values are stored first in the .256 file. They go in order of index 0 red-green-blue (first 3 bytes), index 1 red-green-blue (next 3 bytes) and so on. These values are stored as 1/4 of the true values. For example, if an RGB is "4-6-22" in the 256 file, it is "16-24-88" in a "real" palette.

Important indeces:

  • Index 254 is always SOLID alone, and always TRANSPARENT through a texture1.
  • Index 255 is always TRANSPARENT alone, and TRANSPARENT as a texture2, but not through the texture1. The texture1 image is applied through the transparent area.

The 34 color tables are used to determine the index to use into the palette depending on the brightness of the pixel being rendered. The first table is all zeros which means black. The last table is ordered 0 to 255 which means use a 1 to 1 mapping. The 32 tables in between pick the closest color for a n/32 brightness of the pixel.

If you're not interested in shading, then just use the 256 RGB colors at the beginning of the file. Otherwise, if you need to output into an 8-bit bitmap, then the remaining color tables are useful. Both D2 and DMB2 work this way.

UINT8 light_intensity;
UINT8 light_tables[33][256]; // read from *.pig file
UINT32 u,v; // texture mapping coordinates (calculated by renderer)
UINT8 bitmap[64][64]; // 64x64 texture bitmap, 8-bit color palette index values
UINT8 texture_color; // target color w/o lighting
UINT8 palette_index; // palette index value

texture_color = bitmap[v & 63][u & 63]; // u and v are tiled, so only use lower 6 bits
light_intensity = ... // set value from 0 to 33 (0% to 100% intensity)
palette_index = light_tables[light_intensity][texture_color]

 

 

All pages (C) 1996-2000 Descent Network Team
Everything taken from the Descent, FreeSpace, Red Faction and Summoner series games are
Copyright Interplay Productions , THQ Inc. , Parallax Software , Volition Inc. and/or Outrage Entertainment