Files
TeslaRel410/restoration/source410/BT/MECHMPPR.NOTES.md
T
CydandClaude Fable 5 eb8bba3195 BT410 Phase 5.3.6: look-button state machine -- full eyepoint composition
Reconstructs the binary's five-state LOOK machine (controls mapper tail,
part_013.c:396-459) as proper members/methods:

- MECHMPPR: LookState enum (None/Left/Right/Behind/Down) + lookState/
  previousLookState (out of reserved[24] -> [22]). InterpretControls picks the
  state from the look buttons each frame and on a CHANGE calls
  Mech::CommitLookState. BT_FORCE_LOOK=<1..4> dev hook.
- MECH: authored look angles lookLeft/Right/Front/BackAngle (deg->rad from the
  GameModel resource, guarded) + lookPitch/lookYaw + CommitLookState(int):
  side looks yaw by the authored angle, look-behind = yaw pi + lookBackAngle
  pitch, look-down = lookFrontAngle pitch, forward = identity. The per-frame
  eyepoint compose in Simulate adds the live Torso elevation on top.
  (reservedState [208] -> [202].)
- Deferred inside the commit (needs MechWeapon viewFireEnable/rearFiring):
  per-view weapon fire re-arm + HUD pip group-mask flip.

Verified headlessly: model reads clean authored angles (L=60 R=-60 F=-10 B=0
deg -- ModelResource layout confirmed again); BT_FORCE_LOOK=3 fires ONE commit
([look] state=3 yaw=3.14159 pitch=0) and the per-frame compose holds eyeYaw=pi
with eyePitch=0.349066 (lookBackAngle + the 20deg-clamped elevation). Zero Fail.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 22:08:50 -05:00

65 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MECHMPPR.CPP / .HPP — reconstruction notes
`MechControlsMapper` (: Subsystem) is the mech's control-input subsystem,
installed at roster slot 0 via `Mech::SetMappingSubsystem`. It publishes the
control-input attributes (StickPosition..PilotArray, IDs 30x16) that the
streamed control mappings bind to, and — as of Phase 5.3 — interprets those raw
inputs into the locomotion/aim demands the mech drive consumes.
## Reconstructed
- The attribute table + AttributeIndex + shared-data statics (earlier wave).
- The ctor: primes the published inputs to neutral and (Phase 5.3) installs
`InterpretControls` as the per-frame Performance.
- `InterpretControls(Scalar)` — the per-frame control interpretation
(mechmppr.cpp @004afd10, authentic demand math):
- throttle → forward speed: `speedDemand = topSpeed · throttle · fwdScale`
(reverse thrust inverts and drops the forward scale). `topSpeed`/`walkSpeed`
are read from the owner via `Mech::GetReverseStrideLength()/GetWalkStrideLength()`.
- soft response: square the stick yaw (sign preserved), cube the pedals.
- Basic mode: stick yaw = `turnDemand`; Standard/Veteran: pedals = `turnDemand`.
- speed clamp while turning hard (`max_turn` ramps topSpeed → walkSpeed by
|turnDemand|); VeteranMode has no clamp.
- Demand accessors `GetSpeedDemand()/GetTurnDemand()` (read by `Mech::Simulate`).
- `GetMech()` = `(Mech *)GetEntity()`.
The mapper ticks in the engine's `Entity::PerformAndWatch` roster walk (slot 0),
which runs BEFORE the mech's own Performance (`Simulation::PerformAndWatch` at
the tail), so the demands are same-frame — no input latency.
## DEV hook (headless verification)
`BT_FORCE_THROTTLE` / `BT_FORCE_TURN` override the pushed raw inputs (the RIO/
keyboard aren't present in the headless smoke test), so the demand math + mech
drive are exercisable without hardware. `BT_MECH_LOG` prints a 1 Hz `[mppr]`
demand trace. Verified: `throttle=1.0` → speedDemand=30; `throttle=0.3,turn=1.0`
→ the mech walks a circle; neutral → 0. See MECH.NOTES.md (Phase 5.3 inc 2).
## Torso aim wired (2026-07-21)
InterpretControls now routes the stick PITCH (`stick_y`, squared soft response)
into the torso weapon-elevation axis every control mode
(`Torso::SetAnalogElevationAxis`), and in Standard/Veteran the stick YAW into the
torso twist (`SetAnalogTwistAxis`); Basic keeps the stick yaw as the leg turn.
`Torso::TorsoSimulation` slews + clamps the elevation/twist (see TORSO.NOTES.md).
Verified: `BT_FORCE_ELEV=0.8` → torsoElev clamps at the authentic 20° limit.
## Look-button state machine wired (2026-07-21)
The five-state LOOK machine is live: `LookState` enum + `lookState`/
`previousLookState` members; each frame InterpretControls picks the state from
the look buttons (left/right/behind/down, priority in that order) and on a
CHANGE calls `Mech::CommitLookState(state)`, which re-aims the eyepoint from
the mech's authored look angles (see MECH.NOTES.md increment 6).
`BT_FORCE_LOOK=<1..4>` dev hook. Verified: look-behind commits yaw=π once and
the per-frame eyepoint compose carries it with the live elevation.
## Deferred (the free-aim / camera wave)
Still not reconstructed: the HUD free-aim slew (`HUD::SetFreeAimSlew`, the
Standard/Veteran torso-disabled path), the torso recenter command, and the
weapon-side half of the look commit (per-view fire enables + HUD pip group
mask — needs the MechWeapon viewFireEnable/rearFiring members). The
skeleton-joint application of the torso angles is deferred with the render
wave (TORSO.NOTES.md).