Audio: in-game TRIGGERING works -- real StateIndicator attrs + audio-watcher databinding (task #50)

Enabling audio unlocked L4AudioRenderer::CreateEntityAudioObjects, which binds
AudioStateWatchers to entity/subsystem state attrs BY NAME (attribute-pointer
databinding) and calls AddAudioWatcher on them.  The reconstruction pointed the
Mech's state attrs at the scalar read-pad `attrPad` (fine for gauges that READ a
value, fatal for a state watcher that calls a METHOD) -> AV in SChainOf::Add on
0xCDCDCDCD.  Root-caused via cdb + a BT_ATTRBIND_LOG trace in AttributeWatcher.

Mech-level state audio now REAL + driven (verified: walking fires SetupPatch +
PlayNote/alSourcePlay, patches 78/80/116):
- AnimationState (0x1f) / ReplicantAnimationState (0x20): real StateIndicators
  (0x21 states covering MechAnimationState 0..0x20), driven from SetBodyAnimation
  so footstep/gait/transition sounds fire on animation change.
- CollisionState (0x16): real 4-state StateIndicator driven from ProcessCollision
  via collisionTemporaryState (the deferred @4aa741 per-frame zero + the
  part_012.c:15406-15413 contact tail, InitialHit accumulation; the 1-vs-2 Slide
  split awaits the 0x240/0x244 floats still stubbed by fieldAt()).
- @0x44c CORRECTED: "ammoState (0/1 leaking/2 dry)" was a mislabel -> it is
  collisionTemporaryState (never read as ammo).

Bring-up guards [T3, temporary, self-clearing] so audio-on is STABLE while the
subsystem state models are still stubs (Generators/Condensers/Myomers/Torso/
Avionics/Reservoir/ControlsMapper -- ~15 subsystems, ~40 attrs: GeneratorState,
CondenserState, ReportLeak, ...): a NULL subsystem attr redirects to an inert pad
(was a fatal Fail); an AudioStateWatcher on an unconstructed StateIndicator (null/
0xCDCDCDCD) skips instead of AV.  Both pass automatically once the subsystem is
reconstructed.  Those subsystem sounds stay silent until then (their audio wave).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-15 19:40:08 -05:00
co-authored by Claude Opus 4.8
parent c75abca857
commit 7b1e469ffa
6 changed files with 107 additions and 23 deletions
+17 -4
View File
@@ -5309,7 +5309,9 @@ void
const int freshBlock = isPlayer ? (gBlockCooldown <= 0.0f ? 1 : 0) : 1;
if (isPlayer && gBlockCooldown > 0.0f)
gBlockCooldown -= dt; // decay the out-of-contact window
// BINARY-TAIL-DEFERRED: collisionTemporaryState = 0 here (@4aa741).
// Per-frame collision-state reset (@4aa741): the walk below re-accumulates it
// per resolved contact, then it's pushed into the collisionState StateIndicator.
collisionTemporaryState = 0;
// COLLISION-DAMAGE ECONOMY GUARD: snapshot the TRUE frame motion for the
// per-contact velocity restore in Mech::ProcessCollision (see mech.hpp) --
// the list walk below reflects worldLinearVelocity at every StaticBounce,
@@ -5328,6 +5330,12 @@ void
if (cols != 0)
ProcessCollisionList(cols, dt, old_position, &dmg);
// Push the frame's accumulated contact state into the audio-bound
// collisionState indicator: 0->1 on a fresh contact fires the impact sound,
// 1->0 when contact breaks; SetState only fires on change so a pressed-against
// contact plays once, not every frame. (@4aa741 sibling of the reset above.)
collisionState.SetState((unsigned)collisionTemporaryState);
// 6. response policy (@4aa76c-4aab5f)
if (dmg.damageAmount == 0.00123f) // crushable icon: move STANDS
{
@@ -5669,9 +5677,14 @@ void
damage->damageAmount = 0.00123f; // walk-through sentinel 0x3aa137f4 (:15402-15404)
}
// BINARY-TAIL-DEFERRED: collisionTemporaryState tail (:15406-15413) --
// implement together with the per-frame zero (@4aa741) and the named
// StateIndicator members.
// Contact-state accumulator tail (decomp part_012.c:15406-15413). The
// authentic split is InitialHit(1) vs Slide(2), keyed on the two collision
// floats @0x240/0x244 -- both are still fieldAt() stubs (return 0), so the
// Slide branch can't be computed faithfully yet. A resolved contact IS an
// impact, so accumulate InitialHit(1) -- the decomp's dominant `else` branch;
// upgrade to the full 1-vs-2 split once 0x240/0x244 are reconstructed. [T3]
if (collisionTemporaryState == 0)
collisionTemporaryState = 1;
}