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 -1
View File
@@ -829,6 +829,18 @@ protected:
// forward ground speed the speed readout / arc / radar consume (binary @0x81c).
Scalar attrPad;
Scalar linearSpeed;
// Real StateIndicators for the animation-state attributes (0x1f/0x20).
// The audio subsystem binds AudioStateWatchers to these BY NAME and calls
// AddAudioWatcher() on them -- so unlike the scalar gauge attrs they CANNOT
// share the read-only attrPad (a Scalar has no watcher chain -> the watcher
// register AV'd on 0xCDCDCDCD). Driven from SetBodyAnimation so footstep/
// gait sounds fire on animation transitions. [T2]
StateIndicator animationState; // 0x1f AnimationState
StateIndicator replicantAnimationState; // 0x20 ReplicantAnimationState
// 0x16 CollisionState -- audio binds an AudioStateWatcher here too (impact/
// scrape sounds). Driven from ProcessCollision via collisionTemporaryState:
// NoCollision(0)/InitialHit(1)/Slide(2)/Rest(3) (RP VTV CollisionStateCount).
StateIndicator collisionState;
// Radar/map gauge attributes (binary @0x404/0x408/0x40c/0x3f8). The map
// widget reads position/angle as POINTERS into the mech's live origin, so
// radarLinearPosition/radarAngularPosition point at localOrigin.{linear,
@@ -1047,7 +1059,11 @@ protected:
int flags; // entity flags word (this+0x28 region)
Scalar lastInflictingDamage; // task #60: killing-blow magnitude (port-only; reuses
// the retired phantom `stance` slot -- feeds the kill score)
int ammoState; // @0x44c 0 none / 1 leaking / 2 dry
int collisionTemporaryState; // @0x44c per-frame collision accumulator
// (0 none / 1 InitialHit / 2 Slide) -- CORRECTED from
// the "ammoState 0/1 leaking/2 dry" mislabel; the decomp
// (part_012.c:15406-15413) sets it per resolved contact,
// pushed into collisionState each frame. Never read as ammo.
AlarmIndicator graphicAlarm; // body graphic-state alarm
EntityID lastInflictingID; // @0x43c last attacker (read by DamageZone routing)
Logical IsAirborne();