mech2.cpp exists. Six of its twelve functions are reconstructed: the two
Set*Animation binders, the two *Transition tails, and both *ClipFinished jump
tables (@0x4a69aa leg / @0x4a6e0a body). Compile-verified, BT 51/51, links
clean.
TWO CHANNELS, DELIBERATELY NEAR-DUPLICATE. A mech runs two clip channels over
the same states and the same clips; only the speed they consult differs:
LEG reads the LIVE mapper GetSpeedDemand() -- responds to the stick at once
BODY reads bodyTargetSpeed, a snapshot -- which is what lets a dead-reckoned
or networked mech walk with no controls mapper of its own
So LegClipFinished and BodyClipFinished are twins rather than one shared
routine, exactly as the binary has them. Kept that way on purpose: where the
two jump tables agree, a divergence in this file is a bug, and that mutual
check is worth more than the duplication costs.
EVERY CLIP IS ONE STRIDE, which is why every state is handed -- a walk is
Right, Left, Right, and each entry to and exit from a cycle has its own handed
pair so the mech always leaves on the correct foot. The 29-state enum is
VERBATIM from the 0x3c-stride name table at .data:0050cfe8, the table the
"Unsupported mech animation" assert indexes, so the names and their order are
the original's rather than inferred from behaviour.
THE COMMIT TEST. Both exits that leave a walk cycle test the demand AND the
current cycle speed slewed by one carryover:
if (demand < standSpeed && (cycle - rate*carryover) < standSpeed) -> stop
if (demand > walkStride && (cycle + rate*carryover) > walkStride) -> run
Requiring both is what stops a momentary flick of the stick yanking the mech
out of a stride it has already committed to. Drop either conjunct and you get
a mech that stutters between gaits on noisy input.
TWO THINGS THAT READ WRONG AND ARE NOT:
gimpStrideLength is authored NEGATIVE. The cycle time from it comes out
negative and is folded positive before being spent (@0x4a6c6e / @0x4a6d3d).
That fold is not defensive coding -- remove it and the limp plays backwards.
States 16-19 on the body channel are the REVERSE gait, not a limp, despite
sharing the gimp caps. BT411 records misreading these as "gimp, fall back to
standing" TWICE; that makes the body loop stand -> reverse-entry forever, a
slow reverse with a wrong-footed exit. Read here by structural symmetry with
the leg table, where every previously-decoded body case mirrors its leg twin.
DEFERRED, and named in the sidecar: the four Advance* per-frame entry points
and the two Gimp*ClipFinished limp machines -- with them the gimp-level branch
at the top of both *ClipFinished, so a limping mech currently runs the normal
machine. That branch needs a TU-safe read of the graphic alarm level (BT411
routes it through a mechdmg bridge to dodge an AlarmIndicator ODR split), worth
reproducing carefully rather than reaching for the alarm directly.
NOTHING CALLS ANY OF THIS YET. The Advance* functions are the entry points and
they are the deferred half, so no gait state is ever selected and a run behaves
exactly as before. Same caveat as 5.3.90: a blocker removed, not a behaviour
delivered.
HEADER: MECH.HPP gains the enum, six declarations, and the channel state --
legStateAlarm/bodyStateAlarm (read via GetLevel; the binary's +0x3b0/+0x728 are
mirrors of the alarm level, so no separate int is kept), legCycleSpeed,
bodyCycleSpeed, forwardCycleRate, gimpCycleRate, standSpeed, gimpSpeedMax,
gimpStrideLength, globalTimeScale, animationClips[0x1d]. 41 ints carved from
reservedState, 191 -> 150. walkStrideLength/reverseStrideLength/
reverseSpeedMax/bodyTargetSpeed already existed from the Phase 5.3 locomotion
work and are reused.
STILL UNSOURCED: animationClips[] is declared but nothing fills it. The clip
handles come from the mech's model resource and must be resolved before the
Advance* increment, or SetLegAnimation hands SelectSequence a garbage ID. It
fails soft (SelectSequence tolerates a missing resource with an inert
controller) but it is a hard prerequisite for the gait doing anything.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
source410 — literal reconstruction of the missing BT 4.10 game source
Everything in this directory is RECONSTRUCTED, not recovered. The authentic surviving
source lives in CODE/ and is never mixed with this tree. The goal here is an
archival-grade recreation of the d:\tesla_bt\ translation units that exist only inside
BTL4OPT.EXE (the shipped 4.10 binary), written in the 1995 VWE house style against the
1995 MUNGA/MUNGA_L4 engine headers that DID survive.
Ground rules
- Never copy a reconstructed file into
CODE/— the assembled buildable tree (originals + reconstructions) is produced by a script into a build directory, so provenance stays unambiguous file-by-file. - Every
.CPPhere has a.NOTES.mdsidecar carrying the evidence: the binary address map, decomp references, which sibling sources supplied each idiom, and every judgment call with its tier ([T1] decomp-proven … [T4] style guess). The.CPPitself stays clean 1995 style — no modern annotations inside. - Assert line numbers are constraints. The binary's
Fail()sites record the original file+line (BTL4APP.CPP:400etc.); reconstructed files are shaped so those calls land on their recorded lines. A file that can't meet its line constraints yet says so in the sidecar. - Layout mirrors the original tree:
BT/(bt.lib, 36 TUs) andBT_L4/(btl4.lib, 13 TUs + BTL4.CPP), matching the survivingBT.MAK/BTL4.MAK.
What drives the work
- The per-TU manifest:
C:\VWE\BT411\reference\BT410_SOURCE_MANIFEST.md(tooltools/manifest410.py; method logphases/phase-03-bt410-source-manifest.md). - The decomp:
C:\VWE\BT411\reference\decomp\all\part_*.c(+section_dump.txtstrings). - The port's semantic reconstructions:
C:\VWE\BT411\game\reconstructed\(WinTesla-hosted; each literal file here re-hosts one back onto the 1995 engine APIs). - Style/idiom exemplars: surviving
CODE/BT/*.CPP,CODE/RP/RP_L4/*.CPP,CODE/RP/MUNGA*/**(the 1995 engine source itself).
Status (2026-07-19)
Compile verification is LIVE: ./compile410.sh --sweep (BC4.52 + the authentic OPT.MAK
flags; the period compiler is the reviewer). backdate.py mechanizes WinTesla→1995 header
back-dating (donors: C:\VWE\BT412\engine\MUNGA\*.h).
| item | state |
|---|---|
| THE WHOLE TREE COMPILES (2026-07-19) | ✅ 11/11: all 10 surviving originals + the BTL4APP.CPP pilot build clean under BC4.52 + authentic OPT flags (./compile410.sh --sweep) |
| BT/BTCNSL.HPP + BT/BTSCNRL.HPP | ✅ reconstructed — console wire IDs recovered from the binary (Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1]; TeamScore=12 [T4 GUESS — verify]); see BTCNSL.NOTES.md |
| BT_L4/BTL4APP.CPP (pilot reconstruction) | ✅ compiles (18.5KB obj); 12/12 functions, Fail() at recorded line 400 |
| Staged header family (13: mech/mechsub/heat/powersub/mechweap/emitter/mechmppr/btplayer/projtile/missile + btl4mppr/btl4vid) | ✅ [T3] interface-proven by every surviving consumer; layouts parked in reserved[] blocks — see STAGED-HEADERS.NOTES.md + MECH-LAYOUT.md |
| MUNGA backfills (VDATA, ROTATION, VECTOR2D, AUDREND, APP, LAMP, GAUGREND, GAUGE) | ✅ compile-proven (BACKFILLS.NOTES.md) |
Next work package — the mech-family, REVISED (round-3 finding, 2026-07-19): the plan to "reconstruct mech.hpp first" was the wrong order. A full read of the port's mech.hpp shows it is a hybrid (1995 skeleton + Recon proxies + port-only members + relocated fields), and substantial regions of the binary's 0x854-byte Mech object remain UNMAPPED — the port declares "the remaining members up to sizeof==0x854" in its mech2-4 slices. A literal MECH.HPP that precedes those TU reconstructions would be fiction. Corrected order:
- MECH.HPP is the CAPSTONE, grown incrementally with each mech-family TU
reconstruction (mech.cpp → mech2-4 → subsystem TUs), starting as an interface +
known-ordered members with explicit
reserved[]filler for unmapped regions (sidecar-tracked), tightened as each TU pins its slice. - The dependent headers (
mechsub,mechmppr,btl4mppr,emitter+mechweap,btplayer,projtile,missile) ship WITH their TUs against the staged MECH.HPP. - The blocked originals (BTTOOL, GAUSS, PPC, BTREG) and the BTL4APP pilot compile green as those land — BTREG last (it includes the whole game-header world). Offset oracles for every stage: BT411 CLASSMAP.md, decomp-reference.md §3, and the port headers' static_assert-locked members.
Toolchain — IN HAND (2026-07-19)
Borland C++ 4.52, archived at ../../BORLAND/BC45/, chosen by byte-match: the fleet's own
CODE/RP/CW32.LIB is identical to 4.52's (and not 4.5's). BCC32/TLINK32/TLIB/MAKE run natively
on Win11. The shipped BTL4OPT.EXE recipe is CODE/BT/OPT.MAK (plain bcc32,
-DLBE4;DEBUG_LEVEL=0;DEBUG_STREAM=cout, -5 -a4 -ff -k- -V -Jg -x- -RT- + the full -O set,
PCH btopt.csm; link -Tpe -ax with c0x32.obj + dpmi32.lib + cw32.lib = Borland PowerPack
DPMI32, not Phar Lap TNT). Compile verification of reconstructed TUs is therefore possible
file-by-file; the current blocker for full closure is the 1995 engine header gap (vdata.hpp
first — only the drifted WinTesla VDATA.h survives, in BT412/engine). Include order for
builds: CODE/BT/* over CODE/RP/*, -DNO_PRECOMPILED_HEADERS until the mech-family headers
are reconstructed. Remaining gap: TASM32 (JOYSTICK.ASM only).
Link campaign (build410, 2026-07-19)
source410/build410.sh assembles BTL4OPT.EXE: merged-engine mass compile (152/152 green
— the ENTIRE surviving engine compiles), BT TUs (11/11), tlib libs (munga 1.25MB / mungal4
with the prebuilt-1995 objs / bt / btl4), then the authentic tlink32 link rooted by a probe
main (build scaffold). First true link run: 52 unresolved externals
(UNRESOLVED-LEDGER.txt) = the measured remaining gap. Kill-lists: l4gauge.cpp back-date
(14 widget statics), the missing-engine-body back-date wave (~24: rotation, player, team,
l4app, explode, dropzone, terrain, cultural, subsystm-statics, netclient...), the prebuilt
RANDOM.obj fold, and the staged game-TU statics blocks (MECH.CPP et al. — each TU file opens
with its binary-evidenced Derivation/SharedData statics and grows into the full body).
Link-lib arbitration: SOS = SOSDBXC+SOSMBXC (the 32-bit Borland-flat variants; SOSMW*=16-bit),
WATTCP excluded (it belongs to the 16-bit NetNub TSR — the game talks to it via shared
memory), filestrm = the RP-era pair (BT-tree pair is post-4.10 drift; override layer).