Phase 5.1: MechControlsMapper publishes its 20 control-input attributes

Reconstructed the MechControlsMapper attribute table (StickPosition..PilotArray,
IDs 3-0x16 chained from Subsystem::NextAttributeID==2) + the real members
(stickPosition ControlsJoystick, throttle/pedals/speed/turn Scalars, the look/
torso ControlsButtons, control/display/pilotArray ints) + AttributePointers[] +
AttributeIndex (chains Subsystem::AttributeIndex). Fixed the mapper hierarchy
statics in BTL4MPPR.CPP: L4/RIO/Thrustmaster ClassDerivations now chain correctly
(L4 defined first for static-init order) and all use MechControlsMapper::
AttributeIndex so the mapper instance publishes the control attributes the
streamed mappings bind to.

Mech still constructs (33 subsystems). The post-construction crash is UNCHANGED
(GetAttributePointer, attribute=0x13) -> so it's NOT the mapper; a streamed
AttributeWatcher (numeric ID 19) resolves on another object via GetSimulation.
Next diagnostic: which object/subsystemID the watcher targets. BT: 42 ok.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-20 11:10:44 -05:00
co-authored by Claude Fable 5
parent 9ebdfc4610
commit 1f2f8ac42a
3 changed files with 165 additions and 37 deletions
+66 -5
View File
@@ -21,11 +21,52 @@ Derivation
"MechControlsMapper"
);
//
//#############################################################################
// Published control-input attributes. The streamed control mappings bind (by
// name) to these; the pad entry fills the chain-vs-id gap at id 2.
//#############################################################################
//
const MechControlsMapper::IndexEntry
MechControlsMapper::AttributePointers[]=
{
{ (int)MechControlsMapper::MechControlsMapperPadFirstAttributeID,
"MechControlsMapperPad02",
(Simulation::AttributePointer)&MechControlsMapper::throttlePosition },
ATTRIBUTE_ENTRY(MechControlsMapper, StickPosition, stickPosition),
ATTRIBUTE_ENTRY(MechControlsMapper, ThrottlePosition, throttlePosition),
ATTRIBUTE_ENTRY(MechControlsMapper, PedalsPosition, pedalsPosition),
ATTRIBUTE_ENTRY(MechControlsMapper, ReverseThrust, reverseThrust),
ATTRIBUTE_ENTRY(MechControlsMapper, SpeedDemand, speedDemand),
ATTRIBUTE_ENTRY(MechControlsMapper, TurnDemand, turnDemand),
ATTRIBUTE_ENTRY(MechControlsMapper, LookForward, lookForward),
ATTRIBUTE_ENTRY(MechControlsMapper, LookLeft, lookLeft),
ATTRIBUTE_ENTRY(MechControlsMapper, LookRight, lookRight),
ATTRIBUTE_ENTRY(MechControlsMapper, LookBehind, lookBehind),
ATTRIBUTE_ENTRY(MechControlsMapper, LookDown, lookDown),
ATTRIBUTE_ENTRY(MechControlsMapper, TorsoUp, torsoUp),
ATTRIBUTE_ENTRY(MechControlsMapper, TorsoDown, torsoDown),
ATTRIBUTE_ENTRY(MechControlsMapper, TorsoLeft, torsoLeft),
ATTRIBUTE_ENTRY(MechControlsMapper, TorsoRight, torsoRight),
ATTRIBUTE_ENTRY(MechControlsMapper, TorsoCenter, torsoCenter),
ATTRIBUTE_ENTRY(MechControlsMapper, ControlMode, controlMode),
ATTRIBUTE_ENTRY(MechControlsMapper, DisplayMode, displayMode),
ATTRIBUTE_ENTRY(MechControlsMapper, PilotArrayPage, pilotArrayPage),
ATTRIBUTE_ENTRY(MechControlsMapper, PilotArray, pilotArray)
};
MechControlsMapper::AttributeIndexSet
MechControlsMapper::AttributeIndex(
ELEMENTS(MechControlsMapper::AttributePointers),
MechControlsMapper::AttributePointers,
Subsystem::AttributeIndex
);
MechControlsMapper::SharedData
MechControlsMapper::DefaultData(
MechControlsMapper::ClassDerivations,
Subsystem::MessageHandlers,
Subsystem::AttributeIndex,
MechControlsMapper::AttributeIndex,
1
);
@@ -46,12 +87,32 @@ MechControlsMapper::MechControlsMapper(
{
Check(owner);
//
// The mapper is the Mech's active control Performance; per-frame control
// interpretation (InterpretControls) is reconstructed with the mech2/3/4
// simulation (phase 5). Prime the published control state to neutral.
// Prime the published control inputs to neutral. Per-frame interpretation
// (InterpretControls) is reconstructed with the mech2/3/4 sim (phase 5.3).
//
stickPosition.x = 0.0f;
stickPosition.y = 0.0f;
throttlePosition = 0.0f;
pedalsPosition = 0.0f;
reverseThrust = 0;
speedDemand = 0.0f;
turnDemand = 0.0f;
lookForward = 0;
lookLeft = 0;
lookRight = 0;
lookBehind = 0;
lookDown = 0;
torsoUp = 0;
torsoDown = 0;
torsoLeft = 0;
torsoRight = 0;
torsoCenter = 0;
controlMode = BasicMode;
displayMode = 0;
pilotArrayPage = 0;
pilotArray = 0;
{
for (int i = 0; i < 64; ++i)
for (int i = 0; i < 24; ++i)
{
reserved[i] = 0;
}