//===========================================================================// // File: sensor.cpp // // Project: BattleTech Brick: Mech subsystems // // Contents: Sensor -- the radar / targeting subsystem // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include #pragma hdrstop #if !defined(SENSOR_HPP) # include #endif #if !defined(MECH_HPP) # include #endif // //############################################################################# // Shared data support //############################################################################# // Derivation Sensor::ClassDerivations( PoweredSubsystem::ClassDerivations, "Sensor" ); Sensor::SharedData Sensor::DefaultData( Sensor::ClassDerivations, Subsystem::MessageHandlers, Subsystem::AttributeIndex, Subsystem::StateCount ); // //############################################################################# // The radar / targeting subsystem. A non-replicant (master) instance runs the // per-frame SensorSimulation. //############################################################################# // Sensor::Sensor( Mech *owner, int subsystem_ID, SubsystemResource *subsystem_resource ): PoweredSubsystem(owner, subsystem_ID, subsystem_resource, DefaultData) { Check(owner); Check_Pointer(subsystem_resource); radarPercent = 1.0f; // RadarBaseline selfTest = False; badVoltage = False; // // Install the per-frame performance unless the owner is a replicant copy // (which is driven by console updates instead). // if (owner->GetInstance() != Entity::ReplicantInstance) { SetPerformance(&Sensor::SensorSimulation); } Check_Fpu(); } // //############################################################################# //############################################################################# // Sensor::~Sensor() { } // //############################################################################# //############################################################################# // Logical Sensor::TestClass(Mech &) { return True; } Logical Sensor::TestInstance() const { return IsDerivedFrom(ClassDerivations); } // //############################################################################# //############################################################################# // void Sensor::ResetToInitialState() { Check(this); radarPercent = 1.0f; // RadarBaseline selfTest = False; badVoltage = False; PoweredSubsystem::ResetToInitialState(True); } // //############################################################################# // Per-frame radar / targeting update. Not yet reconstructed -- fires only once // the mech is ticking. //############################################################################# // void Sensor::SensorSimulation(Scalar) { Fail("Sensor::SensorSimulation -- sensor.cpp not yet reconstructed"); } // //############################################################################# // Damage / death. //############################################################################# // void Sensor::TakeDamage(Damage &damage) { Check(this); PoweredSubsystem::TakeDamage(damage); } void Sensor::DeathReset(Logical /*full_recovery*/) { Check(this); ResetToInitialState(); } // //############################################################################# // CreateStreamedSubsystem Model-load-time construction. Not yet reconstructed // (see MECHSUB.NOTES.md -- the 4.10 subsystem stream format). //############################################################################# // int Sensor::CreateStreamedSubsystem( NotationFile *, const char *, const char *, SubsystemResource *, NotationFile *, const ResourceDirectories *, int ) { Fail("Sensor::CreateStreamedSubsystem -- sensor.cpp not yet reconstructed"); return 0; }