.PIC -- Static UI Pictures & Menus

1. Architectural Role & Engine Purpose

The PIC (Picture File) format stores uncompressed and run-length encoded fullscreen graphics, including mission loading screens, main menu background artwork, tactical satellite reconnaissance photos, and weapon selection interface cards in Project I.G.I. 1.

PIC files are optimized for rapid DirectDraw surface blitting, bypassing 3D texture pipeline constraints to provide crisp 640x480 or 800x600 16-bit and 24-bit background visuals with zero GPU filtering artifacts.

2. Binary File Layout & Memory Map Diagram

A PIC file begins with a 16-byte header defining dimensions and color format, followed by scanline offsets and contiguous pixel bytes:

PIC PICTURE — FULLSCREEN ARTWORK BINARY LAYOUT 0x00: Header (16 Bytes) 16 BYTES Magic "PIC " | Width (640/800) | Height (480/600) | BitsPerPixel (16/24) | Compression (0=Raw, 1=RLE) magic[4], width, height, bpp, compression, data_size Optional Palette or Scanline Index Table INDEX Present if 8-bit paletted or RLE compressed scanline offset index Scanline pointers for random-access row decompression Pixel Scanlines Buffer (RGB 5:6:5 / 24-bit BGR) FULLSCREEN VRAM Contiguous full-screen artwork buffer for mission loading and menu backgrounds Width * Height * 2 Bytes (614,400 bytes for 640x480x16bpp)

3. DirectDraw UI Blitting Pipeline Diagram

The menu and loading subsystem locks the backbuffer DirectDraw surface and performs direct linear scanline blits:

PIC ARTWORK — DIRECTDRAW SCANLINE BLITTING PIPELINE 1. UI LOAD REQUEST • Read SCREENS/LOAD01.PIC • Verify Dimensions • Allocate Frame Staging 2. DDRAW SURFACE LOCK • IDirectDrawSurface7::Lock • Acquire Backbuffer Ptr • Read Pitch / Stride 3. MEMCPY SCANLINES • Fast 32-bit DWORD Copy • RGB 555 ↔ 565 Swizzle • Bypass 3D Texture Unit 4. PRESENT DISPLAY • Unlock Backbuffer • DirectDraw Flip() • Instant Presentation

4. Architectural Mechanics & Engine Implementation Details

Innerloop designed PIC to avoid Direct3D texture size limitations of early 3D accelerators (which often capped textures at 256x256):

  • Direct VRAM Blits: By utilizing DirectDraw hardware blits, loading screens were rendered at full 640x480 or 800x600 resolution without splitting images into multi-texture tiles.
  • Pixel Format Swizzling: If the primary display buffer ran in 16-bit RGB 5:5:5 and the file was encoded in RGB 5:6:5, the loader executed a bitwise green-channel shift during decompression.

5. C++ Struct Definitions

#pragma pack(push, 1)
struct PicHeader {
    char     magic[4];       // "PIC " or FourCC
    uint16_t width;          // Image width (e.g., 640)
    uint16_t height;         // Image height (e.g., 480)
    uint16_t bpp;            // Bits per pixel (16 or 24)
    uint16_t compression;    // 0=Raw, 1=RLE
    uint32_t data_size;      // Size of pixel payload
};
static_assert(sizeof(PicHeader) == 16, "PicHeader must be 16 bytes");
#pragma pack(pop)