//===========================================================================// // 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 # endif # if !defined(CSTR_HPP) # include # endif # if !defined(CONTROLS_HPP) # include # endif # if !defined(VECTOR2D_HPP) # include # 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; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 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; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 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