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>
140 lines
4.3 KiB
C++
140 lines
4.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
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// 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
|
|
NextAttributeID
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Control modes
|
|
//
|
|
public:
|
|
enum ControlMode {
|
|
BasicMode = 0,
|
|
StandardMode,
|
|
VeteranMode
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// 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;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Local Data -- the published control inputs (the streamed mappings write
|
|
// these; InterpretControls, phase 5.3, reads them to drive the mech).
|
|
//
|
|
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 reserved[24];
|
|
};
|
|
|
|
#endif
|