//===========================================================================// // File: gyro.cpp // // Project: BattleTech Brick: Mech subsystems // // Contents: Gyroscope -- eye/body stabilisation // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include #pragma hdrstop #if !defined(GYRO_HPP) # include #endif #if !defined(MECH_HPP) # include #endif Derivation Gyroscope::ClassDerivations( PowerWatcher::ClassDerivations, "Gyroscope" ); Gyroscope::SharedData Gyroscope::DefaultData( Gyroscope::ClassDerivations, Subsystem::MessageHandlers, Subsystem::AttributeIndex, Subsystem::StateCount ); Gyroscope::Gyroscope( Mech *owner, int subsystem_ID, SubsystemResource *r, SharedData &shared_data ): PowerWatcher(owner, subsystem_ID, r, shared_data) { Check(owner); Check_Pointer(r); exageration = r->exageration; maxAnimationNoise = r->maxAnimationNoise; minAnimationNoise = r->minAnimationNoise; rotationPerSecond = r->rotationPerSecond; percentageOnNormal = r->percentageOnNormal; percentageOnDestruction = r->percentageOnDestruction; percentageOnDegradation = r->percentageOnDegradation; percentageOnFailure = r->percentageOnFailure; springConstant = r->springConstant; dampingConstant = r->dampingConstant; posSpring = r->posSpring; negSpring = r->negSpring; rotationSpringConstant = r->rotationSpringConstant; rotationDampingConstant = r->rotationDampingConstant; rotationPosSpring = r->rotationPosSpring; rotationNegSpring = r->rotationNegSpring; damageMultiplier[0] = r->collisionDamageMultiplier; damageMultiplier[1] = r->ballisticDamageMultiplier; damageMultiplier[2] = r->explosiveDamageMultiplier; damageMultiplier[3] = r->laserDamageMultiplier; damageMultiplier[4] = r->energyDamageMultiplier; // // Zero the eye/body dynamics accumulators (the binary zeroes each; the // per-frame sim seeds them from the springs above). // for (int i = 0; i < 64; ++i) { dynamicsState[i] = 0.0f; } Check_Fpu(); } Gyroscope::~Gyroscope() { } Logical Gyroscope::TestClass(Mech &) { return True; } Logical Gyroscope::TestInstance() const { return IsDerivedFrom(ClassDerivations); } void Gyroscope::ResetToInitialState() { Check(this); for (int i = 0; i < 64; ++i) { dynamicsState[i] = 0.0f; } } // // Per-frame eye/body stabilisation (spring/damper integration driving the // cockpit eye joint). Not yet reconstructed. // void Gyroscope::GyroscopeSimulation(Scalar) { Fail("Gyroscope::GyroscopeSimulation -- gyro.cpp not yet reconstructed"); }