Apache Longbow Research archive

Cockpit panels

The .320 and .640 files in COCKPITS are headerless, row-major, eight-bit palette indices. Their dimensions are held in the executable's sprite descriptors rather than in the files. A descriptor contains five 32-bit words: width, height, x origin, y origin and pixel pointer. initialise_cockpits_ loads 30 pieces for the 320-pixel display and 46 for the 640-pixel display. The extra high-resolution pieces include instrument close-ups.

COCKPITS.RGB supplies 32 RGB triplets for palette entries 224 to 255. The cockpit fader adjusts these colours with lighting and the night-vision state. The browser uses the unmodified palette. Transparent areas show the checkerboard; these are where the game draws the outside world or live instruments.

draw_cockpit_ assembles ten views at each resolution: pilot ahead, left quarter, left, right quarter and right, followed by the same five gunner views. It mixes opaque block copies with sprites that skip index zero. Some opaque pieces are copied only when the view changes; other pieces are drawn every frame. At the two original resolutions the image is 320 × 240 or 640 × 480, with square pixels.

The extraction executes the original initialisation and drawing routines. An independent compositor reproduces every layout with both a blank and a patterned background, including full and incremental redraws. All 60 comparisons agree, as do the width × height sizes of all 76 source pieces. See the verification report and tools/cockpits.py.

The browser’s All five angles view tiles the panels edge to edge in the order left 90°, left 45°, ahead, right 45°, right 90°. It works for both seats, producing a 1,600 × 240 or 3,200 × 480 strip. The size control applies to the whole strip; native-pixel sizes account for display scaling.

The browser presents the artwork. Live instruments, warning lights and MFD content are separate drawing routines and will be documented with the avionics.

C++ reproduction

The C++ renderer loads the raw pieces directly and matches 1,280 original panel draws, covering all twenty view numbers, both resolutions, full and incremental redraws, blank and patterned backgrounds, four night levels and PNVS on/off. All 245,760,000 pixels and 983,040 palette bytes agree. The cockpit palette fades towards black at half the night level; the MFD range 208 to 223 fades at a quarter, and the map range 192 to 207 at half. PNVS disables these three fades. The two embedded instrument fonts also match all 130 characters and edge clipping in 1,560 draws. Reports are under work/checks/cpp/cockpits/ and work/checks/cpp/instrument-fonts/.

Mechanical instruments

The pilot's forward panel has five independently redrawn mechanical instruments. They use the engine's 2D world-window projection and ordinary software line/polygon routines, followed by raw bezel and shading sprites. High-resolution artwork has its own coordinates rather than uniformly doubled positions.

Instrument 320-pixel position and size 640-pixel position and size Input and behaviour
Airspeed (257,214), 25×25 (514,428), 51×51 Knots, clamped to 0 to 250; the needle sweeps about 345 degrees.
Altimeter (288,214), 25×25 (575,428), 51×51 Height in 1/256-foot units, clamped at zero; the hands turn once per 1,000 and 10,000 feet.
Clock (280,124), 25×25 (560,249), 51×51 Seconds, with separate 12-hour, minute and second hands.
Compass (19,133), 17×9 (36,266), 37×18 Unsigned full-turn heading; ten-degree ticks, letters at cardinal headings and numbers every thirty degrees.
Artificial horizon (274,186), 22×22 (548,373), 43×43 Pitch and roll recovered from the aircraft matrix; two clipped flat-colour polygons.

The airspeed, altimeter and clock restore rectangles from PLT_1 before drawing their hands. The low-resolution clock copies its background from one source row lower than its destination. The compass uses the 3×5 or 5×9 font, clips the scrolling text to its aperture, shades non-background pixels and overlays the bezel. Its background is palette index 225, its lettering 229. The artificial horizon uses 226 for ground and 232 for sky; beyond ±80 degrees of pitch it fills the instrument with the appropriate colour. The shading mask adjusts each nonzero pixel by its mask value minus 224.

tools/check_cpp_instruments.py compares 2,532 original and C++ frames, including instrument extremes, rollover boundaries, random headings and inverted attitudes. All 486,144,000 pixels match. The 2D line clipper and text positioning have another 10,980 comparisons covering transformed, off-screen and boundary-aligned inputs. Source functions are draw_airspeed_indicator_ (0x0045451c), draw_altimeter_ (0x0045463c), draw_analoge_clock_ (0x00454acc), draw_mechanical_compass_ (0x00454200) and draw_pilot_artificial_horizon_ (0x00454054).