From 0e05a22a5573456ac52f12d553612314c33acda6 Mon Sep 17 00:00:00 2001 From: arcattack Date: Wed, 15 Jul 2026 21:41:28 -0500 Subject: [PATCH] Audio: AmmoBin AmmoState + chain its attribute index -> ZERO state-watcher skips (task #50) AmmoBin::AttributeIndex was a bare, default-constructed static with NO parent chain, so nothing resolved on an AmmoBin -- even the inherited SimulationState came back NULL (the audio AmmoState + SimulationState watchers were skipped). - Chain AmmoBin::AttributeIndex to HeatWatcher::GetAttributeIndex() and give it a real AttributePointers[] with AmmoState -> ammoAlarm (@0x194, the 6-level 0x54 StateIndicator-compatible feed alarm, already SetLevel'd Feeding/Loaded/Empty/ Dumped by the sim) so reload/empty/feed audio fires on the ammo transition. With this every StateIndicator audio attribute across the mech + all subsystems binds to a real indicator: audiostate skips 85 -> 0. Remaining audio gaps are the inert Logical/Scalar/Enum subsystem attrs (ReportLeak/GeneratorOn/ConfigureActive Press/MotionState/SpeedOfTorsoHorizontal/TargetRangeExponent), which read 0 (silent, non-crashing) pending backing members in their size-locked layouts. Co-Authored-By: Claude Opus 4.8 (1M context) --- game/reconstructed/ammobin.cpp | 16 +++++++++++++++- game/reconstructed/ammobin.hpp | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/game/reconstructed/ammobin.cpp b/game/reconstructed/ammobin.cpp index 7dbe10e..caa9577 100644 --- a/game/reconstructed/ammobin.cpp +++ b/game/reconstructed/ammobin.cpp @@ -94,7 +94,21 @@ Derivation ); Receiver::MessageHandlerSet AmmoBin::MessageHandlers; -Simulation::AttributeIndexSet AmmoBin::AttributeIndex; + +// AmmoState -> ammoAlarm (@0x194). Chained to HeatWatcher so the inherited +// SimulationState (and any parent attrs) resolve -- the old bare AttributeIndex +// had no parent, so nothing resolved on an AmmoBin. +const AmmoBin::IndexEntry + AmmoBin::AttributePointers[]= +{ + ATTRIBUTE_ENTRY(AmmoBin, AmmoState, ammoAlarm) // @0x194 (0x54 StateIndicator-compatible feed alarm) +}; + +Simulation::AttributeIndexSet AmmoBin::AttributeIndex( + ELEMENTS(AmmoBin::AttributePointers), + AmmoBin::AttributePointers, + HeatWatcher::GetAttributeIndex() +); AmmoBin::SharedData AmmoBin::DefaultData( // resolved as &DAT_005125bc diff --git a/game/reconstructed/ammobin.hpp b/game/reconstructed/ammobin.hpp index de82ff7..06d8846 100644 --- a/game/reconstructed/ammobin.hpp +++ b/game/reconstructed/ammobin.hpp @@ -113,6 +113,17 @@ StateCount }; + // Attribute Support -- audio binds an AudioStateWatcher to AmmoState; it + // resolves to ammoAlarm (@0x194, a 0x54 StateIndicator-compatible alarm) so + // the feed/reload/empty audio fires on the AmmoState transition. The static + // AttributeIndex (ammobin.cpp) is now chained to HeatWatcher -- previously it + // was a bare, unchained index, so even SimulationState resolved to NULL. + enum { + AmmoStateAttributeID = HeatWatcher::NextAttributeID, + NextAttributeID + }; + static const IndexEntry AttributePointers[]; + typedef void (AmmoBin::*Performance)(Scalar time_slice);