Mech: THE 0xBD3 UNTANGLE -- real SubsystemMessageManager in [0x10d], the mapper's one true home is roster slot 0 (task #7)

Binary census [T1]: mech+0x434 has exactly 2 writers (ctor init + factory
case 0xBD3) and ONE reader (@0x4b984b in MechWeapon::SendDamageMessage
@004b9728) -- pure message-manager semantics, nothing mapper-like.  The
factory case now builds the real SubsystemMessageManager (ctor @0049bca4,
0x130, ConsolidateAndSendDamage Performance); the misbuilt MechControlsMapper
squatter is evicted.  Every mapper consumer re-pointed to MappingMapper()
(roster slot 0 = the binary's **(mech+0x128); SetMappingSubsystem @0049fe40
touches ONLY slot 0 -- its [0x10d] mirror removed).  Non-viewpoint mechs get
a slot-0 demand LATCH (base mapper, [T3] accommodation -- the binary leaves
slot 0 NULL off-viewpoint but never drives/animates those paths; ours does).
Verified: solo drive+gait clean; MP replicant gait through the latch (full
run lifecycle); 3x kill/respawn cycle with type-6 records on the observer.
Remaining (task #7 tail): the messmgr's consolidated TakeDamageStream send +
weapon-path routing (@004b9728 real body).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-11 14:16:27 -05:00
co-authored by Claude Fable 5
parent 8ed6184d65
commit afefaeece5
7 changed files with 126 additions and 43 deletions
+26 -24
View File
@@ -1376,7 +1376,8 @@ void
// cadence matches the replicated speed (residual foot-slip is the
// inherent dead-reckoning artifact). The state machine self-arms
// stand->walk / winds down from the demand exactly as on the master.
if (!IsMechDestroyed() && controlsMapper != 0)
MechControlsMapper *replMppr = MappingMapper(); // roster slot 0 (task #7)
if (!IsMechDestroyed() && replMppr != 0)
{
const Vector3D &wv = updateVelocity.linearMotion;
float spd = sqrtf((float)(wv.x * wv.x + wv.z * wv.z));
@@ -1384,7 +1385,7 @@ void
localToWorld.GetFromAxis(Z_Axis, &zAxR);
const float fdot = -((float)wv.x * (float)zAxR.x
+ (float)wv.z * (float)zAxR.z); // mech faces -Z
controlsMapper->speedDemand = (fdot < 0.0f) ? -spd : spd;
replMppr->speedDemand = (fdot < 0.0f) ? -spd : spd;
// Prime the same clip-advance scalars the master's gait block sets
// each frame -- uninitialized on a replicant they read 0, freezing
// the clip at advance-time dt*0 (observed: legState engaged at 11,
@@ -1843,22 +1844,23 @@ void
// mode clamps, torso axes, HUD free-aim) is the real reconstructed tick,
// which runs in the subsystem-roster walk below (un-skipped under this env).
static const int s_realControls = BTEnvOn("BT_REAL_CONTROLS", 1); // default ON (=0 to disable)
if (s_realControls && controlsMapper != 0)
MechControlsMapper *mppr = MappingMapper(); // roster slot 0 (task #7)
if (s_realControls && mppr != 0)
{
// Diagnostic: what the ENGINE controls push left in the attribute since
// our last write (a stale device element overwriting the bridge shows
// here as pre != our previous write).
float preThrottle = controlsMapper->throttlePosition;
float preThrottle = mppr->throttlePosition;
(void)preThrottle;
controlsMapper->throttlePosition = (throttle >= 0.0f) ? throttle : -throttle;
controlsMapper->reverseThrust = (throttle < 0.0f) ? 1 : 0; // ControlsButton: >=1 engaged
controlsMapper->stickPosition.x = turn; // Basic mode: turn = stick yaw
controlsMapper->stickPosition.y = 0.0f;
mppr->throttlePosition = (throttle >= 0.0f) ? throttle : -throttle;
mppr->reverseThrust = (throttle < 0.0f) ? 1 : 0; // ControlsButton: >=1 engaged
mppr->stickPosition.x = turn; // Basic mode: turn = stick yaw
mppr->stickPosition.y = 0.0f;
// Consume the PREVIOUS frame's interpreted demands (the mapper ticks in
// the roster walk after this block -- one frame of input latency).
// turnDemand is the mode-shaped steering; speedDemand (world u/s, sign =
// reverse) feeds the gait target below.
turn = controlsMapper->turnDemand;
turn = mppr->turnDemand;
// BT_GOTO steering must reach the orientation integration DIRECTLY: the
// mapper round-trip (stickPosition -> turnDemand) zeroes out in -net mode
// (the key-bridge only shapes the local viewpoint mech there), which froze
@@ -1871,15 +1873,15 @@ void
if (s_mpprLog >= 1.0f)
{
s_mpprLog = 0.0f;
DEBUG_STREAM << "[mppr] in thr=" << controlsMapper->throttlePosition
DEBUG_STREAM << "[mppr] in thr=" << mppr->throttlePosition
<< " pre=" << preThrottle
<< " rev=" << controlsMapper->reverseThrust
<< " stickX=" << controlsMapper->stickPosition.x
<< " -> speedDemand=" << controlsMapper->speedDemand
<< " turnDemand=" << controlsMapper->turnDemand
<< " mode=" << controlsMapper->controlMode
<< " mapper=" << (void*)controlsMapper
<< " &mode=" << (void*)&controlsMapper->controlMode << "\n" << std::flush;
<< " rev=" << mppr->reverseThrust
<< " stickX=" << mppr->stickPosition.x
<< " -> speedDemand=" << mppr->speedDemand
<< " turnDemand=" << mppr->turnDemand
<< " mode=" << mppr->controlMode
<< " mapper=" << (void*)mppr
<< " &mode=" << (void*)&mppr->controlMode << "\n" << std::flush;
}
}
@@ -2018,8 +2020,8 @@ void
// while the animation transitioned gradually (the "physics don't
// line up with the animation" desync). Signed, the SM decelerates
// through stop -> reverse-entry exactly like the leg channel.
if (s_realControls && controlsMapper != 0)
bodyTargetSpeed = controlsMapper->speedDemand;
if (s_realControls && MappingMapper() != 0)
bodyTargetSpeed = MappingMapper()->speedDemand;
else
bodyTargetSpeed = ((throttle < 0.0f) ? -1.0f : 1.0f)
* (wantGait ? reverseSpeedMax : walkStrideLength);
@@ -2593,8 +2595,8 @@ void
// Commanded-speed deadband (binary @0x4aac88): the mapper's live
// speedDemand vs the last-replicated bodyTargetSpeed -> the tiny
// type-2 record. This is the AUTHENTIC replicant-gait feed.
if (controlsMapper != 0
&& controlsMapper->speedDemand != bodyTargetSpeed)
if (MappingMapper() != 0
&& MappingMapper()->speedDemand != bodyTargetSpeed)
{
ForceUpdate(1 << MechSpeedUpdateModelBit); // type 2
}
@@ -3229,13 +3231,13 @@ void
Subsystem *subsystem = subsystemArray[i];
if (subsystem == 0)
continue;
if (subsystem != (Subsystem *)controlsMapper)
if (i != 0) // slot 0 = the mapper (task #7)
++subsystemsPresent;
if (!subsystem->IsNonReplicantExecutable())
continue;
// The controls-mapping subsystem (roster slot 0 via Mech::SetMapping
// Subsystem, mirrored to controlsMapper) is TICKED under BT_REAL_CONTROLS
// Subsystem -- the [0x10d] mirror is GONE, task #7) is TICKED under BT_REAL_CONTROLS
// -- its InterpretControls chain is now reconciled: FillPilotArray reads
// the local player via application->GetMissionPlayer() (the old wild
// application+0x6c read was THE bypass-causing AV), and the main tick
@@ -3245,7 +3247,7 @@ void
// stands (default behavior unchanged).
{
static const int s_realControlsTick = BTEnvOn("BT_REAL_CONTROLS", 1);
if (!s_realControlsTick && subsystem == (Subsystem *)controlsMapper)
if (!s_realControlsTick && i == 0) // slot 0 = the mapper (task #7)
continue;
}