#55 steps 0/1/2/4: the 1995 DEATH pass restored, the arg gate made real, and 5 subsystems the respawn sweep never reached

THE HEADLINE: the port's death sweep was a total no-op, and fixing it required
fixing the arg gate in the same commit -- otherwise corpses refill their ammo.

STEP 2 -- the authentic dispatch shape:
  * engine/MUNGA/SUBSYSTM.h: Subsystem::DeathShutdown gains the binary's
    universal base body { DeathReset(c) } (@004ad10e).  It was empty, and NO
    port class overrode it, so everything the 1995 game does at death was
    skipped entirely.
  * mech4.cpp death sweep now passes 0, not 1 (the binary's @0049fe0c arg) --
    the wreck shape: alarms/state settle, nothing refills.
  * ARG PROPAGATION (mandatory once the sweep runs): AmmoBin::DeathReset is now
    arg-gated exactly as @004bd26c -- refill only when arg != 0, ammoAlarm
    unconditional.  Ignoring the arg was harmless only while the sweep was
    dead; with it restored, every corpse would have re-armed.  Also forwarded
    in PoweredSubsystem / HeatSink / Condenser / HeatableSubsystem / Generator
    (each binary body forwards it -- verified addresses in the plan).

STEP 4 -- coverage for 5 classes that had an authentic slot-10 body but no
DeathReset, so the respawn sweep fell through to the empty base:
  Torso (this is Gitea #70 -- "loosing torso twist function after a death"),
  Gyroscope, Myomers, HUD, Seeker.

STEPS 0/1 -- observability + the David chain:
  * Three unconditional matchlog rows: DEAD_NOTIFY (mech + resolved link),
    PLAYER_LINK (player <-> vehicle), RESPAWN (mode/alive/zones/subsys/pos).
    A respawn was previously INVISIBLE in the matchlog -- night 3's analysis
    had to infer them from ammo arithmetic.
  * Mech::PlayerLinkMessageHandler + the death dispatch site: when the engine's
    one-shot registry lookup misses (no null check, no retry -> the whole
    death/respawn cycle silently swallowed), recover the SAME object via the
    reverse link the binary's own respawn branch walks (player+0x1FC ==
    playerVehicle).  Complete-type TU, no raw offsets.
  * deathPending cleared in the first-spawn branch (a latch carried in would
    permanently kill every later respawn -- the #57 class).

VERIFIED on the 2-pod rig (madcat vs thor, forced kills, 5 death/respawn cycles
per pod): build clean, ZERO new /FORCE unresolved externs from the 5 new
overrides; refill lines appear ONLY immediately before a Mech::Reset and NEVER
between a death and the next respawn (the corpse-refill regression this commit
had to pre-empt); all three probe rows present in both pods' matchlogs; every
DEAD_NOTIFY carried a non-null link.

DELIBERATELY DEFERRED (documented, not forgotten): the mechsub.cpp rename pair
(ResetToInitialState -> GenerateFault, ClearStatus -> the root reset @004ac22c),
deleting HeatableSubsystem::ResetToInitialState, and deleting RespawnRepair.
Those need the HeatableSubsystem vtable-slot-10 pre-flight the plan calls for,
and we have no binary image here to dump the vtable from -- guessing at it
risks the vptr-alias trap.  Next session with the decomp shards open.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-27 08:09:31 -05:00
co-authored by Claude Opus 5
parent 26e678e570
commit ef8e449a17
17 changed files with 187 additions and 21 deletions
+22 -8
View File
@@ -455,15 +455,29 @@ void AmmoBin::ReadUpdateRecord(UpdateRecord *update)
// respawn restores exactly those ctor values. (ResetToInitialState below
// stays authentically EMPTY per AMMOBIN.TCP.)
//
void AmmoBin::DeathReset(int /*reset_command*/)
void AmmoBin::DeathReset(int reset_command)
{
if (getenv("BT_DEATH_LOG"))
DEBUG_STREAM << "[respawn] ammo bin " << subsystemID << " refilled "
<< ammoCount << " -> " << initialAmmoCount << "\n" << std::flush;
ammoCount = initialAmmoCount; // @0x180 <- @0x220 (ctor value)
feedTimer = 0; // @0x184
cookOffArmed = 0; // @0x18C
ammoAlarm.SetLevel(Loaded); // @0x1A8 (ctor: 1)
//
// THE ARG GATE IS AUTHENTIC AND LOAD-BEARING (@004bd26c, #55 step 2):
// if (arg) { feedTimer = 0; [0x228] = 0; ammoCount = initialAmmoCount;
// cookOffArmed = 0; }
// ammoAlarm.SetLevel(Loaded); // UNCONDITIONAL
// The refill runs on a RESPAWN (arg 1) and must NOT run at DEATH (arg 0) --
// a wreck keeps its counts. This body used to ignore the arg, which was
// harmless only while the death sweep was a no-op; the moment that sweep
// was restored (SUBSYSTM.h DeathShutdown -> DeathReset with arg 0) an
// unguarded refill would have re-armed every corpse.
//
if (reset_command != 0)
{
if (getenv("BT_DEATH_LOG"))
DEBUG_STREAM << "[respawn] ammo bin " << subsystemID << " refilled "
<< ammoCount << " -> " << initialAmmoCount << "\n" << std::flush;
ammoCount = initialAmmoCount; // @0x180 <- @0x220 (ctor value)
feedTimer = 0; // @0x184
cookOffArmed = 0; // @0x18C
}
ammoAlarm.SetLevel(Loaded); // @0x1A8 -- unconditional per the binary
}
//#############################################################################