Files
TeslaRel410/restoration/source410/BT/MECHWEAP.NOTES.md
T
CydandClaude Fable 5 d422dfffc0 BT410 Phase 5.3.7: weapon view-fire gating + build header-stamp hardening
Completes the weapon-side half of the look commit:

- MECHWEAP: real rearFiring/viewFireEnable members (binary @0x334/@0x3E0) +
  accessors. Ctor resolves REAR-FIRING authentically (@004b99a8 tail): the
  mount SEGMENT site name is tested for the 'b' (back) marker -- only the back
  gun ports (sitelbgunport/siterbgunport) carry it. Spawn = forward-armed.
- MECH CommitLookState: re-arms every roster weapon per view (forward =
  non-rear, LOOK-BACK = rear-mounted, side/down = none) and flips the HUD
  reticle pip group with the authentic Reticle::Front/RearFiringWeaponsOn flags
  (BT411's raw "bits 1/2" resolved to their 1995 names).
- MECHWEAP: defined MechWeapon::MessageHandlers (0-entry set inheriting the
  Subsystem chain) -- it was declared-but-undefined, and the surviving CODE
  PPC.CPP binds the inherited name into PPC::DefaultData; the zero-filled
  common block was a latent NULL deref (same trap as Emitter::AttributeIndex).

Discovery: the TEST.EGG mech genuinely mounts TWO REAR LASERS (ERMLaser_2/3 on
the b-ports). Verified on a full-clean baseline (engine 181 + bt 42, 0 fail):
look-behind arms exactly the rear lasers, disarms the other five,
pipMask=0xfffffffe; neutral run holds forward-armed; zero Fail.

build410.sh HARDENED against the stale-obj layout-skew trap this wave exposed:
cc() skipped recompiles on obj-vs-.cpp timestamps only, so the MECHWEAP.HPP
member additions left emitter.obj on the OLD MechWeapon layout -- its
chargeLevel=0.0f write landed exactly on the new rearFiring (a silent cross-TU
struct skew, heisenbug-grade). cc() now honors header stamps: a source410
engine-header edit invalidates every bucket, a BT/BT_L4 header edit
additionally invalidates the game buckets. CODE/ is immutable, no stamp needed.

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

2.1 KiB

MECHWEAP.CPP / .HPP — reconstruction notes

MechWeapon (: PoweredSubsystem) is the weapon base: PPC/GaussRifle bind it via Emitter, the SRMs via ProjectileWeapon/MissileLauncher. The resource streams rechargeRate / weaponRange / damage / heatCostToFire (+ pip fields).

Reconstructed

  • Statics (ClassDerivations, DefaultData on Subsystem::MessageHandlers/ AttributeIndex), ctor streaming the tuning fields, damageData prime.
  • View-fire gating (2026-07-21, the look-commit wave): real rearFiring / viewFireEnable members (1995 binary @0x334/@0x3E0) + IsRearFiring() / GetViewFireEnable() / SetViewFireEnable(). The ctor resolves REAR-FIRING authentically (binary ctor tail @004b99a8): the mount SEGMENT site name (owner->GetSegment(GetSegmentIndex())) is tested for the 'b' (back) marker — only the back gun ports (sitelbgunport/siterbgunport) carry it. Spawn state = armed for the forward view. Mech::CommitLookState re-arms on every view change (see MECH.NOTES.md increment 7). Verified: the TEST.EGG mech's two rear lasers (ERMLaser_2/3) arm only in LOOK-BACK.

Still staged

  • FireWeapon (abstract here; the concrete fire paths in Emitter/PPC/Gauss/ MissileLauncher are the combat wave), SendDamage (damage/networking), CreateStreamedSubsystem (tool-side model build).
  • The 1995 MechWeapon attribute table (RearFiring @0x1B, EstimatedReadyTime, ...) is not yet published — our DefaultData still uses the base Subsystem::AttributeIndex. Comes with the weapon-gauge/console wave.
  • MechWeapon::MessageHandlers declared but not definedFIXED 2026-07-21: it is now a real defined set ((0, NULL, Subsystem::MessageHandlers) — no own handlers yet, inherits the chain), and MechWeapon::DefaultData binds it. This mattered because the surviving CODE PPC.CPP binds the inherited name (PPC::MessageHandlers) into PPC::DefaultData, and a declared-but-undefined static links as a zero-filled common block — the same silent-NULL trap as the Emitter::AttributeIndex crash. Real weapon handlers (fire/damage messages) come with the combat wave (grow the table in place).