//===========================================================================// // File: misthrst.cpp // // Project: BattleTech Brick: Mech weapons // // Contents: MissileThruster -- the missile's propulsion subsystem // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// // // The class interface is the AUTHENTIC surviving CODE/BT/BT/MISTHRST.HPP. // Bodies reconstructed via the BT411 decomp (ctor @004be7c4). The Subsystem // base chain is the NAME ctor with the shipped string "MissleThruster" // @00512e25 (the 1995 misspelling is AUTHENTIC -- keep it). No streamed // resource in the pod content: the flight envelope defaults below are // STAGED until the missile GameModel record decode (see MISSILE.NOTES.md). // #include #pragma hdrstop #if !defined(MISTHRST_HPP) # include #endif #if !defined(MISSILE_HPP) # include #endif // // STAGED-DEFAULT burn envelope (a believable SRM: short hard burn). // static const Scalar DefaultBurnTime = 2.0f; static const Scalar DefaultThrusterAcceleration = 120.0f; // u/s^2 static const Scalar DefaultThrusterClimb = 0.0f; Derivation MissileThruster::ClassDerivations( Subsystem::ClassDerivations, "MissileThruster" ); const MissileThruster::IndexEntry MissileThruster::AttributePointers[] = { ATTRIBUTE_ENTRY(MissileThruster, BurnTimeRemaining, burnTimeRemaining), ATTRIBUTE_ENTRY(MissileThruster, MaxThrusterRotationRate, maxThrusterRotationRate), ATTRIBUTE_ENTRY(MissileThruster, ThrusterAcceleration, thrusterAcceleration) }; MissileThruster::AttributeIndexSet MissileThruster::AttributeIndex( ELEMENTS(MissileThruster::AttributePointers), MissileThruster::AttributePointers, Subsystem::AttributeIndex ); MissileThruster::SharedData MissileThruster::DefaultData( MissileThruster::ClassDerivations, Subsystem::MessageHandlers, MissileThruster::AttributeIndex, MissileThruster::StateCount ); // //############################################################################# // Construction (binary @004be7c4). The const burn/thrust envelope streams // from the missile resource in the binary; staged defaults here. //############################################################################# // MissileThruster::MissileThruster( Missile *owner, int subsystem_ID, SubsystemResource *subsystem_resource ): Subsystem( owner, subsystem_ID, "MissleThruster", (RegisteredClass::ClassID)ThrusterClassID, DefaultData ), thrusterAcceleration( (subsystem_resource != NULL) ? subsystem_resource->thrusterAcceleration : DefaultThrusterAcceleration ), thrusterClimb( (subsystem_resource != NULL) ? subsystem_resource->thrusterClimb : DefaultThrusterClimb ) { Check(owner); burnTimeRemaining = (subsystem_resource != NULL) ? subsystem_resource->burnTime : DefaultBurnTime; maxThrusterRotationRate = 0.0f; Check_Fpu(); } MissileThruster::~MissileThruster() { } Logical MissileThruster::TestInstance() const { return IsDerivedFrom(ClassDerivations); } // //############################################################################# // MissileThrusterSimulation -- bleed the burn. (Driven from the Missile's // MoveAndCollide integrator, not a roster Performance -- the binary folds // the thruster work into the integrate pass.) //############################################################################# // void MissileThruster::MissileThrusterSimulation(Scalar time_slice) { Check(this); if (burnTimeRemaining > 0.0f) { burnTimeRemaining -= time_slice; if (burnTimeRemaining < 0.0f) { burnTimeRemaining = 0.0f; } } }