Back

Developer Network
  File Specs
  Source codes
  Tables
  Mailing lists
  Knowledge Base

Other Games

 

 

Descent Developer Network
Descent 1/2

*.PIG, *.POG specs

Introduction

*.PIG files store mainly textures, in Descent 1 they also store sound effects (no music) and model data.

*.POG files are new to Descent 2 V1.2. A POG file can replace certain textures in a level with custom ones to bring new effects.

This document was written by Heiko Herrmann, with help from Bryan Aamot.

PIG/POG specs for all versions of Descent 1/2
DTX/DTX2 - Tools to view and replace textures, sounds and more
DMB2 - Descent Mission Builder 2 to create levels, incl. texture and robot attribute editor
256ED - Palette file editor

 

Index

 

Definitions

First of some definitions, valid for all Descent versions:

#define BM_FLAG_TRANSPARENT 1
#define BM_FLAG_SUPER_TRANSPARENT 2
#define BM_FLAG_NO_LIGHTING 4
#define BM_FLAG_RLE 8
#define BM_FLAG_PAGED_OUT 16
#define BM_FLAG_RLE_BIG 32

typedef struct
{
 char name[8];
 UINT8 frame; //bits 0-5 anim frame num, bit 6 abm flag
 UINT8 xsize; //low 8 bits here, 4 more bits in size2
 UINT8 ysize; //low 8 bits here, 4 more bits in size2
 UINT8 flag; //see BM_FLAG_XXX
 UINT8 ave_color; //palette index of average color
 UINT32 offset; //relative to end of directory
} D1_PIG_TEXTURE;

typedef struct
{
 char name[8];
 int length; //size in bytes
 int data_length; //actually the same as above
 int offset; //relative to end of directory
} D1_PIG_SOUND;

typedef struct
{
 char name[8];
 UINT8 frame; //bits 0-5 anim frame num, bit 6 abm flag
 UINT8 xsize; //low 8 bits here, 4 more bits in size2
 UINT8 ysize; //low 8 bits here, 4 more bits in size2
 UINT8 size2; //bits 0-3 upper xsize, bits 4-7 upper ysize (new in D2)
 UINT8 flag; //see BM_FLAG_XXX
 UINT8 ave_color;// palette index of average color
 UINT32 offset; // relative to begining of 1st D2_PIG_TEXTURE
} D2_PIG_TEXTURE;

 

Bitmap data

The actual textures are saved in one of three formats. Check the flag in the PIG_TEXTURE array which compression is used for which one.

Uncompressed textures are saved as raw data:

UINT8 data[data_size];

Compressed textures with BM_FLAG_RLE set are saved as below:

UINT32 total_size; //including this long word and everything below
UINT8 line_sizes[texture_ysize]; //size of each line (in bytes)
UINT8 data[total_size-5]; //RLE data (see below)

Compressed textures with BM_FLAG_RLE_BIG set are saved as below:

UINT32 total_size; //including this long word and everything below
UINT16 line_sizes[texture_ysize]; //size of each line (in bytes)
UINT8 data[total_size-5]; //RLE data (see below)

Note that the only difference between BM_FLAG_RLE and BM_FLAG_RLE_BIG encoded textures is that the line_sizes is 1 byte in RLE and 2 bytes in RLE_BIG.

RLE-decoding: The compressed data is run-line encoded. This method uses one byte to determine the number of times to repeat the next byte. If the upper 3 bits are set, then the lower 5 bits of the determine the number of times to repeat the next byte. The last byte of the data must be set to 0xE0, which means 0 bytes to follow.

 

PIG file format - Descent 1 Full Version V1.0

Descent 1 has only one PIG file, so only one texture-set can be defined. This is fixed, so you also can't use POG texture replacement files for your missions. The only way to have custom textures in D1 is to edit the major DESCENT.PIG file itself, which will however affect ALL missions you play from then on. DTX provides a way to patch DESCENT.PIG and also uninstall the patch, which both must be done manually before and after you play the specific mission you intend the custom textures for. See DTX's help file for more details (link to the tool at the bottom of the page).

INT32 num_textures;
INT16 num_sounds;
D1_PIG_TEXTURE texture[num_textures];
D1_PIG_SOUND sound[num_sounds];
<Texture bitmap data>
<Sound data>

 

PIG file format - Descent 1 Full Version V1.4, V1.4a, V1.5

Parallax Software changed the PIG format in V1.4 by moving all model data from the *.POF data (which were in DESCENT.HOG) to the DESCENT.PIG file. This data was put in front of the texture/sound data. So to read the texture/sound data in V1.4+, you have to skip the model data, which is pretty easy:

INT32 offset;

So the first four bytes in the PIG file point to an offset, from which the V1.0 PIG file format begins. So directly at the file offset "offset" you get the num_textures, num_sounds and then both directories, etc.

 

PIG file format - Descent 2 Interactive Demo and Descent 2 Full Version

Descent 2 Full Version can hold multiple PIG files in the Descent 2 directory, each defining an own texture set. With the game 6 texture sets are delivered: GROUPA, WATER, FIRE, ICE, ALIEN1 and ALIEN2. Which of these is used for a level is defined in the RL2 file itself. You can make new PIG files (e.g. with the DTX2 tool, see below) for your levels, however don't forget that additionally to the *.PIG file you also need a *.256 palette file, which can be done with the 256ED tool (see below).

Descent 2 Interactive Demo can of course only hold one texture set called D2DEMO.PIG, however that one has the same format as a full version's PIG file.

INT32 signature; //"PPIG"
INT32 version; //version 2
INT32 num_textures;
D2_PIG_TEXTURE texture[num_textures];
<Texture bitmap data>

 

POG file format - Descent 2 Full Version V1.2

Descent 2 Full Version 1.2 adds a new feature: levels can replace multiple textures without needing an own full PIG. POG files contain a set of textures with an index which texture of the original PIG (as specified in the RL2 file) will be replaced. POG files are saved in the HOG together with the RL2 file and have the same name as the RL2 file (e.g. ABC.RL2 and ABC.POG), so each level in the HOG can have its own POG. To create them you can either use DMB2 or DTX2 (see below).

POG files are only read by D2 V1.2. Earlier versions will ignore the POG file and display the original texture instead.

INT32 signature; //"DPOG" - 0x474f5044L
INT32 version;
INT32 num_textures;
UINT16 texture_index[num_textures]; //which are replaced
D2_PIG_TEXTURE texture[num_textures]; //texture data
<Texture bitmap data>

Note: The texture_index in the POG file refers to the PIG texture index, not the texture index stored in the RL2 file. In other words, the first texture in the PIG file has an index of 0, the next has an index of 1, and so on. When replacing a texture using the POG file, you *must* make sure to use the same dimensions as defined in the PIG file. In fact, the only thing that needs to be modified in the D2_PIG_TEXTURE structure is the flags for transparent and super transparent depending on in color 255 or 254 (respectivly) are used. You can also change the average color index if you want to define the solid color which shows up for low detail settings.

 

 

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