# Expansion catalogue and implementation

The March 1995 expansion is now included in the inspection browsers. Select
**Expansion** in the model browser to find Apocalypse, Diablo, Headhunter,
Wasteland and Ruins scenery, the landing craft and bunker, and the revised
original HERCs. The original versions remain available alongside them.

## Resources and viewers

| Inspector | Expansion coverage |
|---|---|
| [Models](../analysis/models/index.html) | 35 separate model entries, 348 variant/LOD thumbnails, 19 HERC assemblies and 112 hangar/mission loadout presets. Equipment uses expansion weapon geometry and texture banks. |
| [Missions](../analysis/missions/index.html) | 24 campaign missions in three ordered chapters, 12 selectable single missions and one retained single-mission variant. All 37 have original constructed starting scenes; 74 launch cases cover two RNG seeds. There are 114 effective zone layouts. |
| [Cockpits](../analysis/cockpits/index.html) | Nine human HERC layouts, including Apocalypse, with expansion palettes, side mirroring and instrument metadata. |
| [Worlds](../analysis/worlds/index.html) | All 36 expansion conditions, original-renderer stills, moving clouds and complete horizon strips. Wasteland and Ruins add twelve conditions. |
| [Artwork and audio](../analysis/media/index.html) | 150 new/changed image resources, 26 palettes and 791 audio clips, including French and German speech. Exact base duplicates reuse existing exports. |
| [Music](../analysis/music/index.html) | 13 additional or changed songs, with MIDI, decoded events, and lossless GM, OPL2 and OPL3 auditions. |
| [Presentations](../analysis/presentations/index.html) | 61 new/changed TTM programs, 69 portrait timelines and six distinct or localized films. |
| [Shell](../analysis/shell/index.html) | 42 effective expansion dialog layouts, their original 44-key dispatch table, labels and 38 stored artwork previews. These previews show background resources, not complete running screens. |
| [Interface](../analysis/interface/index.html) | 220 new/changed strings, dialogs, viewports, masks, gauges and damage-diagram resources. |
| [Tables](../analysis/tables/index.html) | 89 additional or changed tables; full byte layouts, with uncertain fields retained under neutral names. |
| [Fonts](../analysis/fonts/index.html) | 15 changed DFN resources exported to TTF and WOFF2. All 3,345 glyph rasters, advances and colour layers pass independent FreeType checks. |
| [Recordings](../analysis/tapes/index.html) | Four expansion demos, their bundled mission state and all 11,421 input packets. These are different recordings from the original game's demos. |
| [Coverage](../analysis/resources/index.html) | All 4,274 members of the 20 expansion CD volumes, including source archive, hash, priority, selected consumer and duplicate links. |

Mission text includes 310 effective English, French and German resources across
the original and expansion missions. The mission browser has a language selector.
The short mission summaries are editorial descriptions of the supplied briefings.
`S2_RCN03` has source and briefing resources but is absent from the single-mission
selector; it is labelled as a retained variant.

The floppy expansion contains no unique VOL member bytes relative to this CD.
Its simulator is a different build. The April patch replaces the simulator only.
The three executable revisions remain separate in [Simulator versions](SIMULATOR_VERSIONS.md).

## Original-code checks

HERC assembly uses the expansion's original model loader and profile binding
routine, including every stored LOD. The nineteen chassis all pass. The native
mission launch path prepares counters, consumes its RNG and writes SCRIPT.DAT,
PLAYER.MEC and MISSION.VAR before the original simulator constructs actors.
Browser scenes use those captured placements and equipment. All 37 render without
missing model resources, invalid vertex references or JavaScript exceptions.
Inactive groups remain visible for inspection; the scene is the starting state,
not a running simulation.

The nine cockpit exports compare all four views, bitmap selections, mirroring,
425 instrument words and palette copies against original code. The expansion
copies sixteen cockpit colours to indices 32-47 and one selected highlight to
64. It leaves 65-79 from the world palette. The base game copies a second full
sixteen-colour bank there, so reusing its palette rule gives incorrect colours.

Every exported DFL delta is compared with PLAYFLIC's original decoder. That
executable is byte-identical on the original and expansion CDs. The expansion
shell calls its integrated movie player at 67 ms/frame for MI_INT1 and MECHVIC3;
localized original cinematics retain the ESCD launcher's 83 ms/frame. Header
rates differ and are recorded separately. MI_INT1 starts audio at frame 14;
its synchronized audition includes the corresponding leading silence.

FR_INTRO contains two overlong copies, on frames 100 and 360. Each writes two
bytes beyond the 64,000 visible pixels. Extraction keeps a bounded guard word,
compares it with the original decoder and exports only the visible image.

Expansion tapes use a sixteen-byte input packet, followed by mouse-event and
command counts, fourteen-byte mouse events and a separate sixteen-bit command
queue. The original version has a fourteen-byte packet and no command queue.
All expansion packets and queued events were checked against DBSIM 0x51f84,
stopping after the recorded state is copied at 0x5233f. Starting worlds were
also constructed by the original loader. The C++ game now runs all four recordings to completion. Comparison of every
subsequent world state with the original remains separate from packet decoding.

## Remaining uncertainties

The catalogue preserves existing uncertainties rather than assigning new meanings
to unchanged data. Two archive copies of CFG/TEST.DAT are identical to the base
release's unclassified test resource. Legacy HOVTANK.DMG and retained mission
layout exceptions remain identified. Module BND fields and some profile/table
words have no established semantic consumer. The coverage inspector distinguishes
those records from fully named layouts.

## C++ integration

The native launcher now offers the March CD expansion alongside the original
edition. Archive precedence, Battleset 2, career transfer, nine service-bay HERCs,
expanded weapons, combat, cockpit rules, deployment pods, terrain, music and
cinematics are connected. Saves use a separate expansion directory by default.

The executable comparisons add:

- 16 complete career constructors, eight transfers, 2,200 technology checks
  and 32 mission-return transactions. The returns compare career/history bytes,
  hangars, inventory, repair costs, debrief values and RNG for both battlesets.
- 108 bullet traces with 4,794 updates, 56 beam cases, and 160 radial shield
  cases. Expansion ordinary hits do not use the base difficulty multiplier;
  plasma area damage has its own multiplier. Recorded demos enable projectile
  falloff independently of preference 17.
- 3,240 landing-craft controller frames and 506 launches, including damaged
  weapon banks. Eleven structure types have 2,112 collision and 1,628 lifecycle
  comparisons.
- 192 deployment-point searches and 24 complete pod sequences. Modes 2/3 arrive
  in pods; modes 4/5 place a group directly. A pod warns on approach, lands with
  radial damage, opens and releases its group only if its landing was unobstructed.
  It leaves a crater. These paths retain the original separate clocks for falling
  and opening.
- 432 complete pixel, palette and visual RNG comparisons across all 36
  environments, including cockpit masks and smaller offset viewports. The
  expansion clips the projected ground polygon before generating texture spans;
  it also changes sky-band edges and cloud placement. The two extra WLD words
  specify cloud altitude and ground texture scale. Wasteland/Ruins use lower
  clouds and a shorter texture repeat.
- All 74 captured launches construct, advance and render in C++. All four
  expansion recordings run through with cockpit commands, audio and drawing.
  These integration runs do not establish full original replay equivalence.

See the native repository's `docs/EXPANSION.md` for its regression coverage.
The March CD engine is the implemented ruleset. The floppy engine and April
patch remain separately characterised builds, not selectable C++ modes.
Remaining work is broader consecutive gameplay comparison and playtesting,
plus the unidentified data fields listed above. No complete expansion campaign
playthrough is claimed by the component tests.

## Rebuilding

Generators write to `work/research`; only curated findings and viewer assets are
copied to `analysis`. Raw handoffs, original-code probes and individual film
frames stay in the working directory.

Run these with the project virtual environment, in order:

```sh
python tools/build_expansion_catalogue.py
python tools/build_expansion_links.py
python tools/build_expansion_worlds.py
python tools/build_expansion_missions.py
python tools/complete_expansion_models.py
python tools/build_expansion_text.py
python tools/build_expansion_interface.py
python tools/build_expansion_tables.py
python tools/build_expansion_shell_catalogue.py
python tools/build_expansion_cockpits.py
python tools/build_expansion_fonts.py
python tools/build_expansion_music.py
python tools/build_expansion_movies.py
python tools/build_expansion_environment.py
python tools/build_expansion_tapes.py
python tools/build_expansion_inventory.py
python tools/render_model_thumbnails.py --edition expansion
python tools/check_expansion_browsers.py
python tools/publish_analysis.py
```

The film and environment exporters reuse completed checked captures. To replace a
capture after changing its decoder, remove only that capture's cached report and
outputs first. The publication manifest controls which results are shared.
