.SPR in IGI 2 -- Alpha-Blended Sprites

1. Architectural Role & Engine Purpose

The SPR (Covert Strike Animated Sprite) format drives the tactical HUD, thermal-vision overlays, night-vision scanlines, dynamic sniper rifle reticles, and particle explosions in I.G.I. 2: Covert Strike.

In IGI 2, sprites support multi-channel alpha blending, dynamic color tinting, and sub-pixel rotation, enabling smooth analog compass needles, thermal heat-gradient crosshairs, and realistic weapon muzzle smoke.

2. Binary File Layout & Memory Map Diagram

An IGI 2 SPR file packs multiple sprite frames with per-frame UV boundaries and rotation pivots:

IGI 2 SPR SPRITE — TACTICAL HUD & THERMAL RETICLE LAYOUT 0x00: Header (24 Bytes) 24 BYTES Magic "SPR2" | Version | Frame Count | Blend Mode (0=Alpha, 1=Additive, 2=Thermal) | Atlas Dimensions magic[4], version, frame_count, blend_mode, sheet_w, sheet_h, flags Frame Descriptor Array (20 Bytes per Frame) FRAME DESCRIPTORS Pivot Center X/Y (float[2]) | Sub-Pixel UV Rect: U0, V0, U1, V1 (float[4]) | Frame Duration ms (float) Supports sub-pixel rotating sniper reticles and dynamic compass needles Packed Shared Texture Sheet (DXT3 / 32-Bit ARGB) SHARED SHEET All animation frames share a single texture atlas, eliminating runtime texture state swaps Thermal heat masks and night-vision green phosphor overlays

3. Tactical HUD & Thermal Vision Rendering Pipeline Diagram

Sprites integrate directly with the post-processing and tactical overlay renderer:

IGI 2 SPR — TACTICAL HUD & THERMAL VISION PIPELINE 1. THERMAL TOGGLE • Thermal Goggles Active • Heat Gradient Render • Blue to White Palettes 2. RETICLE ATLAS • Fetch SPR2 Definition • Bind Shared Texture • Read Frame UV Coordinates 3. PIVOT & JITTER • Apply Weapon Recoil Jitter • Rotate Compass Needle • Sub-Pixel Quad Vertices 4. ADDITIVE BLIT • D3D8 Alpha Blend • Additive Overlay • Tactical OSD Display

4. Architectural Mechanics & Engine Implementation Details

The IGI 2 sprite format modernized 2D rendering:

  • Single Atlas Architecture: Unlike IGI 1 which stored discrete pixel buffers per frame, IGI 2 consolidates all frames into a single DXT3/ARGB texture sheet. Animation frames simply update UV coordinates, eliminating GPU texture switches.
  • Sub-Pixel Rotation: Sniper reticles and compass indicators compute 2D rotation matrices in screen-space, enabling smooth 360-degree needle rotation.

5. C++ Struct Definitions

#pragma pack(push, 1)
struct SprHeaderIgi2 {
    char     magic[4];       // "SPR2"
    uint16_t version;        // 2
    uint16_t frame_count;    // Total animation frames
    uint16_t blend_mode;     // 0=Alpha, 1=Additive, 2=Thermal
    uint16_t sheet_width;    // Texture atlas width
    uint16_t sheet_height;   // Texture atlas height
    uint32_t flags;          // Post-process mask flags
    uint32_t reserved;
};

struct SprFrameIgi2 {
    float    pivot_x;        // Pivot center X
    float    pivot_y;        // Pivot center Y
    float    uv_min[2];      // Top-left UV coordinates
    float    uv_max[2];      // Bottom-right UV coordinates
    float    duration;       // Milliseconds to display frame
};
static_assert(sizeof(SprHeaderIgi2) == 24, "SprHeaderIgi2 must be 24 bytes");
#pragma pack(pop)