diff --git a/restoration/source410/BT/MECH.CPP b/restoration/source410/BT/MECH.CPP index a47861e9..bb089aee 100644 --- a/restoration/source410/BT/MECH.CPP +++ b/restoration/source410/BT/MECH.CPP @@ -1261,6 +1261,24 @@ void // damage model's limp hook (leg zone >= 0.5 -> mode 3/4) is // reconstructed. // + // + // STAGED (the master performance's job, mech4 @004a9b5c -- never + // decompiled): promote the damage model's limp signal (statusAlarm level + // 3/4, MECHDMG's leg-half write to mech+0x2c) into the movement mode the + // gait machinery keys on. The binary's damage code READS mode 3/4 to + // decide "already limping", so the promotion demonstrably exists; the + // master perf is the only unaccounted-for writer. Guarded so a death + // (mode 5+) is never overwritten. + // + { + unsigned status = statusAlarm.GetLevel(); + int mode = MovementMode(); + if ((status == 3 || status == 4) && mode < 3) + { + SetSimulationState(status); + } + } + int limping; { int mode = MovementMode(); diff --git a/restoration/source410/BT/MECHDMG.CPP b/restoration/source410/BT/MECHDMG.CPP index 62f09680..a0f43a3c 100644 --- a/restoration/source410/BT/MECHDMG.CPP +++ b/restoration/source410/BT/MECHDMG.CPP @@ -394,19 +394,28 @@ void RecurseSegmentTable(mech); } } - else if (damageLevel >= StructureMax) + else if (mech->MovementMode() == 3 || mech->MovementMode() == 4) { - // leg destroyed -> fall / mech kill - mech->statusAlarm.SetLevel(9); - if (getenv("BT_MECH_LOG")) + // + // ALREADY LIMPING (binary @0x49c88f/@0x49c8c5): only now does a + // DESTROYED leg fell the mech. A first leg hit -- even one that + // takes the zone straight to 1.0 -- limps first; the kill needs + // the second blow to land while the gait is already gimped. + // + if (damageLevel >= StructureMax) { - DEBUG_STREAM << "[death] LEG zone " << damageZoneIndex - << " destroyed -- mech down" << endl << flush; + mech->statusAlarm.SetLevel(9); + if (getenv("BT_MECH_LOG")) + { + DEBUG_STREAM << "[death] LEG zone " << damageZoneIndex + << " destroyed while limping -- mech down" + << endl << flush; + } } } else if (!mech->IsMechDestroyed()) { - // half-gone leg -> the gimp-gait graphic (right 4, left 3) + // half-gone leg -> the limp gait (right 4, left 3) if (rightLeg != 0 && damageLevel >= LegHalfStructure) { mech->statusAlarm.SetLevel(4);