With this section I want to prevent that anyone tries to completely analyze my resource file...

 +0   2 BYTEs   Signature "RZ"
 +2     DWORD   File offset of resource directory
 +6     WORD    Number of entries in file

Resource Directory

The RD contains a record for each entry of the file:
 +0     WORD    Id Number
 +2     DWORD   Location of entry in resource file
 +6     DWORD   Size of entry in bytes

It is allowed to have multiple directory entry pointing to the same data, and there is no requirement that the entries be sorted in any way.

The entries

The entries in the file are identified by their Id number and are copies of other files that can have many different formats:
- pictures
- fonts (see .FNT)
- help texts
- and the default specification files
- some other files, intentionally undocumented, change without notice

There are (almost) no type tags. When PCC finds a wrong type somewhere, it will likely crash. Some entries are compressed, some not.

Compression

PCC uses a simple RLE compression. Each compressed file starts with a DWORD specifying the length of the decompressed data. Then, the compressed file follows, split into chunks of the following format:

         +0     WORD    Uncompressed length of the following chunk
         +2     BYTE    Value used as prefix code in this chunk
         +3   n BYTEs   Compressed data. Either single bytes, or runs
                        encoded as `pp nn dd', where `pp' is the prefix
                        byte: this means, `repeat byte `dd' `nn' times'.

The prefix byte may differ from chunk to chunk, however, most files only have one chunk. After the last chunk, a WORD with the value 0 must (!) follow.

Pictures

Pictures are stored in 3 formats; some are compressed using the above RLE scheme, some aren't. Here the description of the decompressed files. PCC will crash if it gets a compressed picture where it expects an uncompressed one, or vice versa, or a picture in the wrong format.

RGB values range from 0 to 63. Not all pictures are allowed to use their private colors (for example, the three structures which are shown simultaneously on the Build screen must share one palette).

Format 1 (16 colors, always compressed):
 +0   2 BYTEs   Signature "CC"
 +2     WORD    Width
 +4     WORD    Height
 +6  15 BYTEs   Palette. 5 RGB triplets for color slots 10 to 14. Colors
                1 to 9 and 15 are fixed, see CHARTx.CC.
+21   n BYTEs   Bitmap data, from top to bottom, left to right. Two pixels
                per byte, the left pixel is in the lower nibble. If the
                width is odd, one half byte is wasted per line.

Interesting pictures of this type are

                 Id             | Meaning
                ================|================================
                  201 .. 211    | Race persons
                 1001 .. 1153   | Starships, corresponding to
                                | RESOURCE.PLN entries 1 to 149,
                                | plus alchemy ships
                 4001 .. 4011   | Fighters
                 4601 .. 4610   | Torpedo blueprints
                 4701 .. 4710   | Torpedo launcher blueprints
                 4801 .. 4810   | Beam weapon blueprints
Format 2 (256 colors, always compressed):
 +0   2 BYTEs   Signature "CD"
 +2     WORD    Width
 +4     WORD    Height
 +6 192 BYTEs   Palette. 96 RGB triplets for color slots 192 to 255.
+198  n BYTEs   Bitmap data, from top to bottom, left to right.

A 256-color picture Id (X) is automatically used as a replacement for 16-color picture (X - 20000).

Format 3 (sometimes compressed):
 +0     WORD    0800h (Signature)
 +2     WORD    Width
 +4     WORD    Height
 +6   n BYTEs   Bitmap data, from top to bottom, left to right. Usually,
                the value 255 means a transparent pixel.

Help Texts

Help texts can be found at Ids 10000 to 19999 (help page Ids). They are normal ASCII texts with special control characters:

          1     (Ctrl-A) Followed by 2 ASCII characters: anchor (supported
                by PCC 1.0.6.1 and later)
          2     (Ctrl-B) At beginning of line, underlines (use only for
                page headings);
          3     (Ctrl-C) At beginning of line, centers the line;
          5     (Ctrl-E) Hide everything till end of line in graphics
                mode, print it in text mode (used for ASCII replacement
                of graphics in MAKEGLOS.EXE);
          7     (Ctrl-G) Followed by 6 ASCII digits. Graphics: the first
                digit specifies the segment of the image, the following
                five specify the image Id;
         10     (Ctrl-J) Linefeed;
         11     (Ctrl-K) Quote next character. Prevents special meanings
                of next character, in particular, prevent that a name
                in brackets is turned into a key-cap;
         16     (Ctrl-P) End of hyperlink;
         17     (Ctrl-Q) Begin of hyperlink. Followed by 5 ASCII digits
                (reference target). Hyperlinks can't contain linefeeds.
                PCC 1.0.6.1 and later supports an additional format where
                two ASCII characters and a colon precede the 5 ASCII
                digits, which automatically jumps to the named anchor
                (^Qab:10000Main^P = jump to anchor "ab" on page 10000);
         20     (Ctrl-T) Followed by an ASCII digit. Tabulator: ^T0
                moves to 40 pixels from the left, ^T1 to 80 pixels, and
                so on;

Some printing characters give different symbols in PCC than on a standard codepage 437 text screen, see the .FNT font file format.