Files
TeslaRel410/restoration/source410/BT/MECHMPPR.HPP
T
CydandClaude Fable 5 6b9811473b BT410 5.3.120: the mech ducks -- the master perf's duck driver landed whole, and the collision cylinder breathes with it
The first block reconstructed from the isolated master performance
(@004a9f61..@004aa155, instruction-level read of the ndisasm listing), and
with it the Mech's authentic message roster straight from the binary's own
handler table: RealMaxSpeed 0x15, BalanceCoolant 0x16, SetBurningState
0x17, ClearBurningState 0x18, EjectPilot 0x19, DuckRequest 0x1A -- the
enum now exists in MECH.HPP with those names.

The system end to end: a DuckRequest message (@0049fa00) latches ONE
evaluation -- the latch is consumed every master frame and cleared by
Reset. The phase machine reads the raw simulation state, the mapper's
duck button cell and the analog demand (deadzone 1e-4): from gait 0/4 it
arms the sqd clip on the LEG channel only (slot 2 -- the slot map, not
the enum's walk names), from the ducked hold it arms squ (slot 3), and a
mech that starts limping while ducked is stood up by force. The
collision-volume alarm (level 1 standing / 0 ducked, guarded by the
authentic "Whoa! Bad Collision Volume State!") swaps the collision
template's maxY -- the box TOP; the ground probe's minY is untouched --
between the ctor-captured height and 0.6x it (the double at @004a2d38).
duckState publishes for the cockpit's crouch selector.

Live-verified end to end: BT_FORCE_DUCK (an authentic press every 4s on
its own clock) cycles press -> sqd -> volume 9.91->5.94 -> ducked hold ->
press -> squ -> standing, continuously, no faults. En route the test
machine-checked three neighbors for free: the squat clips resolve and
play at the idle rate, the clip-finish transitions for slots 2/3 fire,
and the machine correctly REFUSES to duck while walking (legState 5).

Deferred, recorded: the per-arm MarkUpdate masks (8, 1) ride the
still-empty ForceUpdate (the MP update-record feed), and the mapper duck
cell's streamed binding id awaits a BT_MAP_LOG audit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-06 17:23:24 -05:00

224 lines
7.3 KiB
C++

//===========================================================================//
// File: mechmppr.hpp //
// Project: BattleTech //
// Contents: Implementation details for the mech controls mapper //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#if !defined(MECHMPPR_HPP)
# define MECHMPPR_HPP
# if !defined(SUBSYSTM_HPP)
# include <subsystm.hpp>
# endif
# if !defined(CSTR_HPP)
# include <cstr.hpp>
# endif
# if !defined(CONTROLS_HPP)
# include <controls.hpp>
# endif
# if !defined(VECTOR2D_HPP)
# include <vector2d.hpp>
# endif
//##################### Forward Class Declarations #######################
class Mech;
//###########################################################################
//######################## MechControlsMapper ###########################
//###########################################################################
class MechControlsMapper:
public Subsystem
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// The duck button cell (binary mapper+0x25c) -- a device-poll write
// destination like the torso command cells; the master perf's duck
// driver reads it as the held-button gate. The streamed attribute
// binding id is still to be audited (BT_MAP_LOG) -- until a RES table
// binds it, BT_FORCE_DUCK drives it.
//
public:
int
DuckCommand()
{ Check(this); return duckCommand; }
int duckCommand;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data Support
//
public:
static Derivation ClassDerivations;
static SharedData DefaultData;
static const IndexEntry AttributePointers[];
static AttributeIndexSet AttributeIndex;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Attribute IDs -- the control inputs the streamed mappings bind to.
// The chain ends at Subsystem::NextAttributeID == 2.
//
public:
enum {
MechControlsMapperPadFirstAttributeID = 2,
StickPositionAttributeID, // 3
ThrottlePositionAttributeID, // 4
PedalsPositionAttributeID, // 5
ReverseThrustAttributeID, // 6
SpeedDemandAttributeID, // 7
TurnDemandAttributeID, // 8
LookForwardAttributeID, // 9
LookLeftAttributeID, // a
LookRightAttributeID, // b
LookBehindAttributeID, // c
LookDownAttributeID, // d
TorsoUpAttributeID, // e
TorsoDownAttributeID, // f
TorsoLeftAttributeID, // 10
TorsoRightAttributeID, // 11
TorsoCenterAttributeID, // 12
ControlModeAttributeID, // 13
DisplayModeAttributeID, // 14
PilotArrayPageAttributeID, // 15
PilotArrayAttributeID, // 16
TargetRangeExponentAttributeID, // authored watcher
NextAttributeID
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Control modes
//
public:
enum ControlMode {
BasicMode = 0,
StandardMode,
VeteranMode
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Look states. A five-state machine off the pod's look buttons; on a state
// change InterpretControls calls Mech::CommitLookState, which re-aims the
// eyepoint from the model's authored look angles (and, once the weapon wave
// lands, re-arms the per-view weapon fire enables).
//
public:
enum LookState {
LookNone = 0,
LookLeftState,
LookRightState,
LookBehindState,
LookDownState
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction and Destruction
//
public:
MechControlsMapper(
Mech *owner,
int subsystem_ID,
CString subsystem_name,
RegisteredClass::ClassID class_ID,
SharedData &shared_data = DefaultData
);
~MechControlsMapper();
Logical
TestInstance() const;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Per-frame control interpretation (the mapper's Performance): reads the
// engine-pushed raw input attributes (throttle / stick / pedals / buttons)
// and publishes the locomotion + aim demands the mech drive consumes.
//
public:
typedef void
(MechControlsMapper::*Performance)(Scalar time_slice);
void
SetPerformance(Performance performance)
{
Check(this);
activePerformance = (Simulation::Performance)performance;
}
void
InterpretControls(Scalar time_slice);
Mech*
GetMech() { Check(this); return (Mech *)GetEntity(); }
Scalar
GetSpeedDemand() const { Check(this); return speedDemand; }
Scalar
GetTurnDemand() const { Check(this); return turnDemand; }
//
// The LIMP machines write the demand cell DOWN to the damaged side's
// speed cap (binary GimpLegClipFinished @004a7970 preamble writes
// mapper+0x128 directly) -- a limping mech cannot command more speed
// than its limp figure carries.
//
void
SetSpeedDemand(Scalar demand)
{ Check(this); speedDemand = demand; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Local Data -- the published control inputs (the streamed mappings write
// these; InterpretControls, phase 5.3, reads them to drive the mech).
//
public:
//
// The POD ROSTER (binary mapper attributes PilotArrayPage/PilotArray,
// ids 15/16): the comm scoreboard's row source. Zero = no roster
// authored (a solo mission), which is why the shipped cockpit leaves
// that page blank.
//
int
GetPilotArray() const { Check(this); return pilotArray; }
int
GetPilotArrayPage() const { Check(this); return pilotArrayPage; }
protected:
ControlsJoystick stickPosition;
Scalar throttlePosition;
Scalar pedalsPosition;
ControlsButton reverseThrust;
Scalar speedDemand;
Scalar turnDemand;
ControlsButton lookForward;
ControlsButton lookLeft;
ControlsButton lookRight;
ControlsButton lookBehind;
ControlsButton lookDown;
ControlsButton torsoUp;
ControlsButton torsoDown;
ControlsButton torsoLeft;
ControlsButton torsoRight;
ControlsButton torsoCenter;
int controlMode;
int displayMode;
int pilotArrayPage;
int pilotArray;
int lookState;
int previousLookState;
//
// Takes one reserved word (Scalar and int are both 4 bytes here), so
// the class size and every existing offset stay exactly as they were.
//
Scalar targetRangeExponent; // authored watcher
int reserved[21];
};
#endif