//===========================================================================// // File: emitter.hpp // // Project: BattleTech // // Contents: Implementation details for energy weapon emitters // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #if !defined(EMITTER_HPP) # define EMITTER_HPP # if !defined(MECHWEAP_HPP) # include # endif //##################### Forward Class Declarations ####################### class Mech; //########################################################################### //####################### Emitter Model Resource ######################## //########################################################################### // // WIRE-VERIFIED layout: graphicLength, dischargeTime, then the SeekVoltage // curve -- five FRACTIONS of the generator's rated voltage (-1 sentinel // ends the list) -- and the recommended (default) gear index. (The earlier // two-field guess read seekVoltage[3] = 0.99 as "dischargeTime 0.99 s".) // struct Emitter__SubsystemResource: public MechWeapon::SubsystemResource { Scalar graphicLength; Scalar dischargeTime; Scalar seekVoltage[5]; int seekVoltageRecommendedIndex; }; //########################################################################### //############################## Emitter ################################ //########################################################################### class Emitter: public MechWeapon { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Shared Data Support // public: static Derivation ClassDerivations; static SharedData DefaultData; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Attribute Support. The energy-weapon family publishes past the MechWeapon // table end (0x1C) -- the binary's emitter IDs run 0x1D+. // public: enum { ChargeLevelAttributeID = MechWeapon::NextAttributeID, // 0x1D NextAttributeID }; static const IndexEntry AttributePointers[]; static AttributeIndexSet AttributeIndex; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Test Class Support // public: static Logical TestClass(Mech &); Logical TestInstance() const; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Construction and Destruction // public: typedef Emitter__SubsystemResource SubsystemResource; Emitter( Mech *owner, int subsystem_ID, SubsystemResource *subsystem_resource, SharedData &shared_data = DefaultData ); ~Emitter(); static int CreateStreamedSubsystem( ResourceFile *resource_file, NotationFile *model_file, const char *model_name, const char *subsystem_name, SubsystemResource *subsystem_resource, NotationFile *subsystem_file, const ResourceDirectories *directories, int passes = 1 ); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Weapon interface // public: void FireWeapon(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Per-frame simulation (the beam-weapon fire state machine) and the // electrical charge model: the Loading state integrates currentLevel // toward the powering generator's voltage (TrackSeekVoltage); Loaded snaps // when the recharge dial reaches 1.0 (level ~= the selected seek voltage). // public: typedef void (Emitter::*Performance)(Scalar time_slice); void SetPerformance(Performance performance) { Check(this); activePerformance = (Simulation::Performance)performance; } void EmitterSimulation(Scalar time_slice); void ResetFiringState(); void TrackSeekVoltage(Scalar time_slice); virtual void ComputeOutputVoltage(); // the charge-voltage form (level/seekV) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Local Data. chargeLevel is the ChargeLevel attribute alias of the raw // charge voltage (currentLevel in the binary's naming). // protected: Scalar chargeLevel; // the raw charge voltage (binary currentLevel @0x414) Scalar dischargeTime; Scalar dischargeTimer; Scalar graphicLength; Scalar seekRate; Scalar energyCoefficient; Scalar energyTotal; Scalar damageFraction; Scalar damagePortion; Scalar heatPortion; int firingActive; int seekVoltageIndex; int seekVoltageRecommendedIndex; int minSeekVoltageIndex; int maxSeekVoltageIndex; Scalar seekVoltage[5]; }; #endif