Rendering System

The rendering system is built around the CPixmap class, which wraps DirectDraw surface management. On non-Windows platforms, Free Direct provides SDL3-based implementations of the DirectDraw API.

CPixmap Overview

Header: include/pixmap.hpp
Source: src/pixmap.cpp (~1,922 lines)

CPixmap is the image surface manager. It allocates and manages 15 DirectDraw surfaces (one per channel), handles sprite blitting, and manages the display pipeline.

Resolution

The game renders at a fixed 640×480 pixel resolution:

ConstantValueDescription
LXIMAGE640Game window width (pixels)
LYIMAGE480Game window height (pixels)
POSDRAWX0Draw origin X
POSDRAWY0Draw origin Y

Image Channel System

CPixmap manages 15 independent render channels, each backed by a separate DirectDraw surface. Content is rendered into these channels and composited to produce the final frame.

ChannelValueContentImage File
CHBACK0Background terraindecor000–031.blp
CHOBJECT1Foreground objects and pickupsobject.blp
CHBLUPI2Default player characterblupi000.blp
CHDECOR3Decorative overlaysdecor000–031.blp
CHBUTTON4UI buttonsbutton.blp
CHJAUGE5Gauge bar spritesjauge.blp
CHTEXT6Normal text characterstext.blp
CHLITTLE7Small text characterslittletxt.blp
CHMAP8Minimap spritesmap.blp
CHEXPLO9Explosion spritesexplo.blp
CHELEMENT10Particle/element effectselement.blp
CHBLUPI111Player variant 1 (multiplayer)blupi001.blp
CHBLUPI212Player variant 2 (multiplayer)blupi002.blp
CHBLUPI313Player variant 3 (multiplayer)blupi003.blp
CHTEMP14Temporary scratch surface

Sprite Dimensions

Sprite TypeWidthHeightConstants
Objects (enemies, items, vehicles)64 px64 pxDIMOBJX, DIMOBJY
Player character (Blupi)60 px60 pxDIMBLUPIX, DIMBLUPIY
Explosions128 px128 pxDIMEXPLOX, DIMEXPLOY
UI Buttons40 px40 pxDIMBUTTONX, DIMBUTTONY
Gauge bars124 px22 pxDIMJAUGEX, DIMJAUGEY
Normal text characters16 px max16 px maxDIMTEXTX, DIMTEXTY
Small text characters16 px max12 px maxDIMLITTLEX, DIMLITTLEY

Render Pipeline

Each game tick, the rendering sequence is approximately:

  1. CDecor::Build(rect) is called to render the game world
  2. Terrain cells in the visible area are blitted from CHBACK
  3. Moving objects are drawn from CHOBJECT, CHEXPLO, etc.
  4. Player character is drawn from CHBLUPI
  5. Decorative overlays from CHDECOR are applied
  6. UI elements (buttons, gauges, text) from CHBUTTON, CHJAUGE, CHTEXT, CHLITTLE
  7. Minimap drawn from CHMAP
  8. Final composited frame blitted from backbuffer to primary surface
  9. CPixmap::Display() presents the frame

Camera Scrolling

The camera scrolls to follow the player. Scrolling is triggered when the player approaches the screen edge:

ConstantValueDescription
SCROLL_SPEED8Camera scroll speed (pixels per tick)
SCROLL_MARGX80Horizontal scroll trigger margin (pixels from edge)
SCROLL_MARGY40Vertical scroll trigger margin (pixels from edge)

Color Depth Modes

The game supports both 8-bit palette and 16-bit true-color rendering, selected via the TrueColorBack and TrueColorDecor settings in config.def:

  • 8-bit mode — uses gamefiles/IMAGE08/ assets
  • 16-bit mode — uses gamefiles/IMAGE16/ assets (default)
  • jauge.blp and map.blp are always loaded from IMAGE08 (no 16-bit version)

Known Rendering Issues

Double Create() Issue
CPixmap::Create() is called twice during startup — once directly, and once inside CPixmap::CacheAll(TRUE, …). This is a likely decompilation artifact. Real DirectDraw may reject the second initialization. See Known Issues.
⚠️
Parameter Swap Bug
The bTrueColorBack and bTrueColorDecor parameters appear to be swapped between the declaration in pixmap.hpp and the definition in pixmap.cpp. This may produce incorrect behavior when the two color depth settings differ.