Skip to content

Under Attack, Unit repaired, and what a unit says when it cannot comply - #37

Merged
CubeB merged 1 commit into
revivalfrom
27-unit-sounds
Sep 11, 2026
Merged

CubeB merged 1 commit into
revivalfrom
27-unit-sounds

Conversation

@HectorBailey

Copy link
Copy Markdown
Collaborator

Closes #27. The first decode job done against the flat listing of the same binary the notes were read from (MD5 matches).

The decode (now in docs/TOTALA-EXE.md §97, new subsection):

  • 0x47F780(unit, id, caption) has 82 direct callers. Two siblings add one gate each against the frame's draw list ("HOT UNITS", §18): 0x47F7E0 plays only for a unit on screen and is never called; 0x47F850 plays only for a unit off screen and has one caller.
  • The player 0x47FAD0 keeps a queue of eight, one pending voice per slot id, in priority order from the table's third dword. That is the only throttle.
  • underattack (slot 2, "Under Attack"): one site, 0x4071D8, the tail of the return-fire routine, reached on every hit whatever the fire mode. Gates: last attacker's owner differs from the victim's, else the cause byte must be a weapon hit (so an own-side paralyser is silent); the victim's mission flags bit 7 clear (no setter found, treated as never set); through 0x47F850, so off-screen units only.
  • repair (slot 10): five sites, all with "Unit repaired": SELFREPAIR and VTOL_GetRepaired (the aircraft on a pad reaching full health), VTOL_RepairUnit and the ground repair body (the repairer as the job lands).
  • cant (slot 7): 45 sites, every one passing its own caption, so "Cannot Comply" is never heard. Full table of captions and addresses in the notes.

What changed.

  • UnitDamagedEvent gains paralyzer (the cause). The scene plays slot 2 and prints ": Under Attack" when the victim is the local player's, the attacker is another side or it was a weapon hit, and the unit fails the same view-cull test the renderer uses.
  • UnitRepairedEvent, raised where the mending finishes in deployRepairArm (the repairer's voice) and in handleLandOnAirBaseOrder when a parked aircraft reaches full health (the aircraft's). An order to repair a unit that is already whole says nothing. Slot 10 with "Unit repaired".
  • UnitCannotComplyEvent{unit, message}, raised at the four refusals RWE already makes: the nanoframe capture ("That unit is a cloud of vapor and cannot be captured"), the Commander reclaim ("That unit cannot be reclaimed"), the taken pad ("Landing aborted: no pads available") and the vanished corpse ("Ressurection failed", the original's spelling). Slot 7 with the caption.
  • Throttle: RWE's one reserved voice channel drops a voice while busy; the original queues one per slot. Close enough; noted rather than reworked.

Verified.

  • unitnotifications.test.cpp: the damage event carries the cause; a repairer says it exactly once and the voice is the repairer's; the nanoframe and Commander refusals raise the event with the right caption; a refusal that ends the order raises it once and ticking on is silent.
  • rwe_test: all 557 test cases pass (71492 assertions), Linux gcc-14 Debug.
  • Not play-tested by ear (Linux runs need A chosen view refers to the caller's range, not a copy of it #17). The scene wiring follows the pattern of e69ec4d.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun

Three of the twenty-one unit voices never played. Where the original
plays them was read out of the callers of the routine that plays a
sound slot, and it turned out to have three entry points, a queue, and
a table whose captions are mostly never seen.

Under Attack, slot 2, has one call site: the tail of the return-fire
routine, reached on every hit whatever the fire mode. It plays for
damage from another side of any cause, for the unit's own side only on
a weapon hit, and only for a unit that is not in the frame's draw list:
it is the warning for what you cannot see. The damage event now carries
the cause and the scene tests the view.

Unit repaired, slot 10, plays from both ends of a repair job -- the
repairer as it lands, and an aircraft on a pad as its hit points reach
the maximum. A repaired event is raised at both.

Cannot comply, slot 7, has forty-five sites and every one passes its
own caption, so the table's "Cannot Comply" is never heard. An event
carries the caption; four of the refusals RWE already makes raise it,
and the notes carry the table of the other forty-one for when theirs
exist.

The original's voice queue holds one pending sound per slot, so a unit
under sustained fire says Under Attack once per playback. RWE's single
reserved voice channel drops a voice while it is busy, which comes to
nearly the same thing and is left as it is.

Issue: #27

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun
@CubeB
CubeB merged commit b9545df into revival Sep 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit sounds: cant1, underattack and repair are never played

2 participants