#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
+34 -1
View File
@@ -1829,6 +1829,16 @@ void
<< ") alive=" << (int)(!IsMechDestroyed())
<< " zones=" << damageZoneCount
<< " subsys=" << GetSubsystemCount() << "\n" << std::flush;
// #55 step 0: a respawn used to be INVISIBLE in the matchlog (VEHICLE only
// logs on the CreatePlayerVehicle path, which reset-based respawn never
// takes) -- night 3's analysis had to infer every respawn from ammo
// arithmetic. One unconditional row per reset.
BTMatchLog("RESPAWN", "mech=%d:%d mode=%d alive=%d zones=%d subsys=%d "
"pos=%.1f,%.1f,%.1f",
BTMatchHostOf(GetEntityID()), (int)GetEntityID(), mode,
(int)(!IsMechDestroyed()), damageZoneCount, GetSubsystemCount(),
localOrigin.linearPosition.x, localOrigin.linearPosition.y,
localOrigin.linearPosition.z);
Check_Fpu();
}
@@ -1940,7 +1950,9 @@ void
{
Subsystem *s = GetSubsystem(i);
if (s != 0)
s->DeathShutdown(1);
s->DeathShutdown(0); // #55: the binary sweep @0049fe0c passes 0
// (wreck shape: alarms/state settle, ammo
// bins do NOT refill the corpse)
}
// Request the DEATH record BEFORE entering the disabled state (the
// ForceUpdate filter masks types 2..8 once IsDisabled) -- the binary
@@ -2052,6 +2064,27 @@ void
//
{
Player *owner = GetPlayerLink();
// #55 step 1 (the David fix): the death notification used to hinge on
// this single never-retried pointer -- playerLink is written once by
// Entity::PlayerLinkMessageHandler with no null check, so a lost race
// silently swallowed the whole respawn cycle. Resolve the SAME object
// by the reverse link the binary's own respawn branch uses
// (player+0x1FC == playerVehicle): the mission player whose vehicle is
// this mech. Not a stand-in -- the identical entity, second index.
if (owner == 0 && application != 0)
{
Player *mission_player = (Player *)application->GetMissionPlayer();
if (mission_player != 0
&& mission_player->GetPlayerVehicle() == (Entity *)this)
{
owner = mission_player;
}
}
// #55 step 0: a NULL link was a SILENT swallow -- record the
// resolution unconditionally so the matchlog can prove it either way.
BTMatchLog("DEAD_NOTIFY", "mech=%d:%d link=%p",
BTMatchHostOf(GetEntityID()), (int)GetEntityID(),
(void *)owner);
if (owner != 0)
{
Player::VehicleDeadMessage