diff --git a/game/reconstructed/mech4.cpp b/game/reconstructed/mech4.cpp index 06b0b80..d8b8ef2 100644 --- a/game/reconstructed/mech4.cpp +++ b/game/reconstructed/mech4.cpp @@ -2134,7 +2134,23 @@ void // once so a direct run-state entry can't slew from -4.3e8. if (legCycleSpeed < -100.0f || legCycleSpeed > 200.0f) legCycleSpeed = 0.0f; - const Scalar replLegAdv = AdvanceLegAnimation(dt); // joints + ROOT TRAVEL + // PEER POSE CHANNEL (decomp workflow w1s9ou02o -- the authentic fix): the + // 1995 peer posed the WHOLE skeleton from the BODY channel (FUN_004a5678) + // FOLLOWING the master's replicated body-anim state (bodyStateAlarm@0x728, + // set by the type-3 reader's SetBodyAnimation, mech.cpp:1913) + replicated + // bodyTargetSpeed@0x6b4. The LEG channel (FUN_004a5028) is DEAD CODE. Our + // port resurrected the leg SM as the peer's poser fed a LOCALLY re-derived + // commanded speed, and the leg SM's phase-independent pre-switch wind-down + // (mech2.cpp:560-568, force-jump {6,7,8,9}->stand when legCycleSpeed<=0) makes + // the peer SKIP the master's decel state 8 and snap to stand while the body + // coasts (the 'slid forward after legs stopped' bug). The body channel has + // NO such wind-down and follows the replicated decel state, playing the + // master's exact clips. Swapping the peer to the body channel RESTORES the + // original single-channel design (no new netcode). BT_PEER_LEGCH=1 = old. + static const int s_peerLegCh = getenv("BT_PEER_LEGCH") ? 1 : 0; + const Scalar replLegAdv = s_peerLegCh + ? AdvanceLegAnimation(dt) // old: re-derived leg SM + : AdvanceBodyAnimation(dt, 1); // authentic: body channel, mj=1 poses skeleton // AUTHENTIC coupled position (mirror of the master's world-step at // mech4.cpp:3325-3336 == Mech::IntegrateMotion tail @004ab1c8): between // records the body advances by the CLIP'S OWN travel rotated by the @@ -2195,7 +2211,7 @@ void if (getenv("BT_SLIDE")) { static Point3D s_slPrev; static int s_slInit = 0; - const int ls = (int)legStateAlarm.GetLevel(); + const int ls = getenv("BT_PEER_LEGCH") ? (int)legStateAlarm.GetLevel() : (int)bodyStateAlarm.GetLevel(); if (s_slInit) { const float dx = (float)(localOrigin.linearPosition.x - s_slPrev.x); @@ -2240,8 +2256,9 @@ void static float s_gvPrevF = -1.0f, s_gvAcc = 0.0f, s_gvSum = 0.0f, s_gvMax = 0.0f; static int s_gvN = 0, s_gvBack = 0, s_gvTrans = 0, s_gvPrevSt = -1; static float s_gvDemPrev = 0.0f; static int s_gvDemChg = 0; - const float gf = (float)legAnimation.currentFrame; - const int gs = (int)legStateAlarm.GetLevel(); + const int _pb = getenv("BT_PEER_LEGCH") ? 1 : 0; + const float gf = _pb ? (float)legAnimation.currentFrame : (float)bodyAnimation.currentFrame; + const int gs = _pb ? (int)legStateAlarm.GetLevel() : (int)bodyStateAlarm.GetLevel(); if (s_gvPrevF >= 0.0f) { float df = gf - s_gvPrevF;