The "gimp" family had two conflicting donor readings -- limp vs jump-jet --
flagged in 5.3.94 rather than guessed at. The binary settles it: LIMP. The
mode test in every gimp function is mech+0x40 in {3,4}, the same values the
damage model documents as "limp gait graphic (left 3 / right 4)"; there is no
jump-jet control anywhere in the pod cockpit; and the donor's port routing
("graphicAlarm 3/4") was the same field under a different name. Its
"run-jump clip" mech3 annotations were the misreading that started the murk.
RECONSTRUCTED, completing all 12 of mech2's census functions:
GimpLegClipFinished @004a7970 GimpBodyClipFinished @004a6344
AdvanceLegAnimationGimp @004a71f4 AdvanceBodyAnimationGimp @004a5bf8
+ the limp branch atop both normal *ClipFinished
+ the limp pick in Simulate (replaces the normal advancers while limping)
HOW A LIMP WORKS, now from the bytes rather than description:
It replaces ONE stride. Limping left, the right stride (6) hands off to
the left limp figure (0x16 -> the self-cycling 0x18) while the other leg
keeps its normal clips. The asymmetry IS the limp.
Both machines CLAMP THEIR DEMAND while in a cycle -- the leg machine
writes the mapper's own speedDemand cell down to the damaged side's cap
(new MechControlsMapper::SetSpeedDemand, matching the binary's direct
mapper+0x128 write), the body machine clamps bodyTargetSpeed, both floor
at zero. A limping mech cannot command more than its figure carries, nor
reverse out of a forward cycle.
The limp advancers keep states 0x16-0x1b LIVE -- the normal advancers
treat those as the reset group, which is exactly why the limp flavours
must be selected while limping or the figure is neutralized mid-cycle.
No death latch, no wind-down: the movement modes are exclusive.
ALSO EXPLAINED IN PASSING: Ghidra's 3760-byte FUN_004a6344 -- the census's
largest function -- is really THREE functions. The two normal ClipFinished
callbacks (@004a6928/@004a6d8c) are reached only via data pointers, so the
decompiler folded them into the gimp-body machine's extent.
All movement-mode reads route through Mech::MovementMode() (mech+0x40 == the
simulation state), which honours a BT_FORCE_LIMP=3|4 dev hook so the gait
could be verified before the damage model's limp hook exists.
VERIFIED, two runs on the rig:
NO-REGRESSION: the normal mission's speed sequence is BIT-IDENTICAL to
5.3.95 (7.31972, 26.6726, 22.1601, ...). The branch costs nothing.
FORCED LEFT LIMP (new pod_render_limp.conf): the mapper still demands
26.9; the hull lurches at 10-23. And on the wire the healthy walk's tight
pose-count pairs (650/649 ... 434/421) BREAK to a 3x asymmetry -- the
drag-leg joint at 18 poses against its partner's 55. The limp is visible
in the data exactly the way it will be visible on screen.
STILL OPEN in this family: the damage hook (leg zone >= 0.5 -> mode 3/4, a
MECHDMG increment -- nothing sets the mode in real play yet), and
IntegrateMotion's remaining pieces.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
211 lines
6.5 KiB
C++
211 lines
6.5 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
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// 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
|