//===========================================================================// // File: torso.hpp // // Project: BattleTech Brick: Mech subsystems // // Contents: Torso -- the torso twist / weapon-elevation subsystem // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #if !defined(TORSO_HPP) # define TORSO_HPP # if !defined(POWERSUB_HPP) # include # endif //##################### Forward Class Declarations ####################### class Mech; class Joint; //########################################################################### //##################### Torso Model Resource ########################### //########################################################################### struct Torso__SubsystemResource: public PowerWatcher::SubsystemResource { Scalar horizontalRotationPerSecond; Scalar verticalRotationPerSecond; Scalar horizontalLimitRight; Scalar horizontalLimitLeft; Scalar verticalLimitTop; Scalar verticalLimitBottom; char torsoHorizontalJoint[32]; char torsoHorizontalShadowJoint[32]; Logical torsoHorizontalEnabled; Scalar buttonAccelerationPerSecond; Scalar buttonAccelerationStartValue; }; //########################################################################### //############################### Torso ################################ //########################################################################### // // Drives torso twist (horizontal) and weapon elevation (vertical). The // tuning rates/limits come from the resource; the live twist/elevation state // and the resolved skeleton joints are advanced by the per-frame // TorsoSimulation (staged) once the Mech skeleton link is live. // class Torso: public PowerWatcher { public: static Derivation ClassDerivations; static SharedData DefaultData; typedef void (Torso::*Performance)(Scalar time_slice); void SetPerformance(Performance performance) { Check(this); activePerformance = (Simulation::Performance)performance; } static Logical TestClass(Mech &); Logical TestInstance() const; Scalar CurrentTwist() const { Check(this); return currentTwist; } Scalar CurrentElevation() const { Check(this); return currentElevation; } Logical GetHorizontalEnabled() const{ Check(this); return horizontalEnabled; } // // Analog aim inputs (written by MechControlsMapper::InterpretControls; // consumed by TorsoSimulation to slew the twist/elevation each frame). // void SetAnalogElevationAxis(Scalar axis) { Check(this); analogElevationAxis = axis; } void SetAnalogTwistAxis(Scalar axis) { Check(this); analogTwistAxis = axis; } void TorsoSimulation(Scalar time_slice); void TorsoCopySimulation(Scalar time_slice); public: typedef Torso__SubsystemResource SubsystemResource; Torso( Mech *owner, int subsystem_ID, SubsystemResource *subsystem_resource, SharedData &shared_data = DefaultData ); ~Torso(); protected: int isDamagedCopy; int statusFlags; Logical horizontalEnabled; Scalar baseTwistRate; Scalar baseElevationRate; Scalar horizontalLimitRight; Scalar horizontalLimitLeft; Scalar verticalLimitTop; Scalar verticalLimitBottom; Scalar twistCenterHigh; Scalar twistCenterLow; Scalar elevationCenter; Scalar elevationHalfBottom; Scalar buttonAccelerationPerSecond; Scalar buttonAccelerationStart; int buttonRampActive; Scalar buttonRamp; Joint *horizontalJointNode; Joint *horizontalShadowJointNode; Scalar currentTwist; Scalar currentElevation; Scalar analogElevationAxis; Scalar analogTwistAxis; // // Twist/elevation dynamics accumulators advanced by TorsoSimulation. // Reserved until the per-frame sim is reconstructed (phase 5). // Scalar dynamicsState[22]; }; #endif