#110: the zone destruction cascade is LIVE -- an arm now takes its gun pod with it
Lynx: "You can destroy an upper arm, and the gun pod is intact and can still fire." Conn Man's audit: three chassis, both arms, reproducible. And the user is right that this family was claimed fixed before: #86 gated fire on the WEAPON's own destruction and was verified by destroying the weapon directly (BT_KILL_SUBSYS) -- the field scenario was the ARM ZONE dying with the weapon subsystem healthy, which that bench never reproduced. Oracle's 693-night "I can still fire destroyed energy weapons" was almost certainly this mechanism. ROOT CAUSE -- a silent stub. Mech__DamageZone::RecurseSegmentTable @0049cad4 was transcribed faithfully... against three local shim types whose iterators unconditionally return NULL: struct SegmentIterator { DZRef *Next() { return 0; } }; struct SegTableX { SegmentRecord *operator[](int) { return 0; } }; The cascade fired on zone death (bench: 72 [cascade] lines), "descended", and touched nothing. Every line read correct; none of it did anything. THE REAL WALK (decomp re-read, FUN_0049cad4): iterate the mech's segment table (mech+0x300, vtbl+0x34 GetNth) to this zone's segment, then destroySiblingsOnDestruction (Wword 0x68): recurse every other zone on the SAME segment (seg+0xD0), setting graphic state 2 (Gone) descendOnDestruction (Wword 0x67): recurse every zone on every CHILD segment (seg+0xE8 -> child+0xD0) -- the arm takes the gun The engine ALREADY HAS both structures: EntitySegment::damageZoneTable @0xD0 / childIndexTable @0xE8 (TableOf is 0x18 -- byte-identical to the decomp offsets), populated at stream time by JMOVER.cpp:373 [T0]. The stub was never necessary. Implemented with the engine iterators via two new read accessors on EntitySegment (SEGMENT.h); the binary's asymmetry is reproduced as-is (the sibling loop checks graphic state != 1, the child loop does not; re-hits on a 1.0 zone re-run the cascade -- idempotent in effect). VERIFIED (ava1, self-damage to one zone, autofire everything): dz_rarm -> [cascade] zone 9 -> zone 17; AFC100 + AmmoBinAFC100 + Condenser6 ForceCriticalFailure'd; "[ammo] AFC100 -> NoAmmo (gate1): destroyed=1"; torso LRM5/SRM2 keep firing (correct) dz_larm -> [cascade] zone 2 -> zone 6; PPC + Condenser4 force-failed; "[emitter] 'PPC' fire REFUSED (destroyed=1)" x4998 -- the emitter gate now logs refusals BY NAME (the FIRED line never named its weapon, which is how #86's verification gap survived) regression smoke: frame time 7.13/7.20ms, 0 asserts, 0 cascades in ordinary combat (they fire only on genuine zone deaths) Authored data (now dumped under BT_DMG_LOG): descend=1 on exactly the four arm zones (ava1: 2/6/9/17), destroySibs=0 everywhere -- so legs/torso behavior is untouched by this change. KB: combat-damage.md cascade section; reconstruction-gotchas #26 (the silent-stub trap: a shim that returns EMPTY converts a reconstruction into fiction that reads correct -- shims must Fail() loudly or log their emptiness). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
da70bd58b2
commit
06adaee523
@@ -104,10 +104,11 @@ void BTGimpStompTrap(void *sim, unsigned cur, unsigned nw, void *ra)
|
||||
static struct ReconClock { Scalar CurrentTick() { return 0; } } TheTime; // FUN_00414b60
|
||||
static const Scalar TicksPerSecond = 1.0f; // DAT_0052140c
|
||||
|
||||
struct DZRef { int index; };
|
||||
struct SegmentRecord { int siblings; int children; }; // mech segment-tree node
|
||||
struct SegmentIterator { template<class A> SegmentIterator(const A &) {} DZRef *Next() { return 0; } };
|
||||
struct SegTableX { SegmentRecord *operator[](int) { return 0; } }; // cast of EntitySegment::SegmentTable
|
||||
// (#110: the DZRef/SegmentRecord/SegmentIterator/SegTableX stubs that lived here
|
||||
// are GONE. They silently no-op'ed the whole destruction cascade walk --
|
||||
// RecurseSegmentTable "descended" into nothing, so blowing an arm off never
|
||||
// touched the gun pod hanging from it. The walk now uses the REAL engine
|
||||
// segment tree; see RecurseSegmentTable below.)
|
||||
|
||||
// Subsystem facets the recovered code reaches that the engine Subsystem does
|
||||
// not expose under these names (cast of Subsystem*).
|
||||
@@ -283,7 +284,15 @@ Mech__DamageZone::Mech__DamageZone(
|
||||
<< " scale={" << damageScale[0] << "," << damageScale[1] << ","
|
||||
<< damageScale[2] << "," << damageScale[3] << "," << damageScale[4] << "}"
|
||||
<< " leg=" << (int)(rightLeg || leftLeg)
|
||||
<< " vital=" << (int)vitalDamageZone << std::endl;
|
||||
<< " vital=" << (int)vitalDamageZone
|
||||
// #110: the destruction-cascade authoring -- whether this zone's
|
||||
// death descends the segment tree / takes its siblings, and how many
|
||||
// critical subsystems it can fail. The arm chain lives or dies by
|
||||
// these values.
|
||||
<< " descend=" << (int)descendOnDestruction
|
||||
<< " destroySibs=" << (int)destroySiblingsOnDestruction
|
||||
<< " segIdx=" << segmentIndex
|
||||
<< " crits=" << criticalSubsystemCount << std::endl;
|
||||
|
||||
//
|
||||
// Critical-subsystem table.
|
||||
@@ -805,8 +814,11 @@ void
|
||||
}
|
||||
else if (getenv("BT_DEATH_LOG"))
|
||||
{
|
||||
DEBUG_STREAM << "[deathfx] crit-subsys " << i << " damaged -> "
|
||||
<< level << "\n" << std::flush;
|
||||
DEBUG_STREAM << "[deathfx] crit-subsys " << i
|
||||
<< " '" << (s->GetName() ? s->GetName() : "?") << "'"
|
||||
<< " damaged -> " << level
|
||||
<< " (pct=" << cs->damagePercentage
|
||||
<< " used=" << cs->damagePercentageUsed << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -822,35 +834,66 @@ void
|
||||
void
|
||||
Mech__DamageZone::RecurseSegmentTable(Mech *my_mech)
|
||||
{
|
||||
if (getenv("BT_DEATH_LOG"))
|
||||
DEBUG_STREAM << "[cascade] zone " << damageZoneIndex
|
||||
<< " DESTROYED -> descend=" << (int)descendOnDestruction
|
||||
<< " destroySibs=" << (int)destroySiblingsOnDestruction
|
||||
<< " crits=" << criticalSubsystemCount << std::endl;
|
||||
SendSubsystemDamage(); // FUN_0049c9a8
|
||||
SetGraphicState(1); // slot 0xc
|
||||
|
||||
SegmentRecord *seg = ((SegTableX &)my_mech->segmentTable)[segmentIndex]; // mech+0x300, Wword(0x65)
|
||||
//
|
||||
// The segment-tree walk (@0049cad4, re-read 2026-08-02 for #110). The
|
||||
// binary iterates the mech's segment table (mech+0x300, vtbl+0x34 GetNth)
|
||||
// to this zone's segment, then walks two lists ON the EntitySegment:
|
||||
// seg+0xD0 the damage-zone indices ATTACHED to this segment
|
||||
// seg+0xE8 the CHILD segment indices
|
||||
// Those are the engine's own EntitySegment::damageZoneTable /
|
||||
// childIndexTable -- byte-identical offsets (TableOf is 0x18: 0xD0+0x18 =
|
||||
// 0xE8), populated at stream time by JMOVER.cpp:373 (AddDamageZone) [T0].
|
||||
// The previous "reconstruction" here walked stub iterators that always
|
||||
// returned NULL, so the cascade never left this zone: an arm died and the
|
||||
// gun pod hanging off it kept firing (#110, Lynx + Conn Man's three-chassis
|
||||
// audit). Element payload = PlugOf<int> (operator int).
|
||||
//
|
||||
EntitySegment::SegmentTableIterator segs(my_mech->segmentTable); // mech+0x300
|
||||
EntitySegment *seg = segs.GetNth(segmentIndex); // vtbl+0x34
|
||||
if (seg == 0)
|
||||
return; // (binary derefs blind)
|
||||
|
||||
if (destroySiblingsOnDestruction) // Wword(0x68)
|
||||
{
|
||||
SegmentIterator sibs(&seg->siblings); // seg+0xd0
|
||||
for (DZRef *r; (r = sibs.Next()) != 0; ) // slot 0x28
|
||||
// Other zones on the SAME segment.
|
||||
EntitySegment::IntegerTableIterator sibs(seg->GetDamageZoneTable()); // seg+0xD0
|
||||
for (EntitySegment::IntegerPlug *r; (r = sibs.ReadAndNext()) != 0; )
|
||||
{
|
||||
Mech__DamageZone *sib = my_mech->Zone(r->index); // inherited damageZones[..], typed
|
||||
if (sib != this && sib->GetGraphicState() != 1)
|
||||
Mech__DamageZone *sib = my_mech->Zone((int)*r);
|
||||
if (sib != 0 && sib != this && sib->GetGraphicState() != 1)
|
||||
{
|
||||
sib->RecurseSegmentTable(my_mech);
|
||||
sib->SetGraphicState(2); // slot 0xc
|
||||
sib->SetGraphicState(2); // 2 = Gone
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (descendOnDestruction) // Wword(0x67)
|
||||
{
|
||||
SegmentIterator kids(&seg->children); // seg+0xe8
|
||||
for (DZRef *r; (r = kids.Next()) != 0; )
|
||||
// Every zone on every CHILD segment, recursively -- the arm takes the
|
||||
// gun with it. The binary's child-zone loop has NO graphic-state
|
||||
// guard (only the sibling loop has one); reproduced as-is.
|
||||
EntitySegment::IntegerTableIterator kids(seg->GetChildIndexTable()); // seg+0xE8
|
||||
for (EntitySegment::IntegerPlug *r; (r = kids.ReadAndNext()) != 0; )
|
||||
{
|
||||
SegmentRecord *child = ((SegTableX &)my_mech->segmentTable)[r->index];
|
||||
SegmentIterator czones(&child->siblings); // child+0xd0
|
||||
for (DZRef *cr; (cr = czones.Next()) != 0; )
|
||||
EntitySegment::SegmentTableIterator segs2(my_mech->segmentTable);
|
||||
EntitySegment *child = segs2.GetNth((int)*r);
|
||||
if (child == 0)
|
||||
continue;
|
||||
EntitySegment::IntegerTableIterator czones(child->GetDamageZoneTable()); // child+0xD0
|
||||
for (EntitySegment::IntegerPlug *cr; (cr = czones.ReadAndNext()) != 0; )
|
||||
{
|
||||
Mech__DamageZone *cz = my_mech->Zone(cr->index);
|
||||
Mech__DamageZone *cz = my_mech->Zone((int)*cr);
|
||||
if (cz == 0)
|
||||
continue;
|
||||
cz->RecurseSegmentTable(my_mech);
|
||||
cz->SetGraphicState(2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user