//===========================================================================// // File: mechsub.hpp // // Project: BattleTech // // Contents: Implementation details for mech subsystems // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #if !defined(MECHSUB_HPP) # define MECHSUB_HPP # if !defined(SUBSYSTM_HPP) # include # endif # if !defined(ALARM_HPP) # include # endif //##################### Forward Class Declarations ####################### class Mech; class Damage; //########################################################################### //#################### MechSubsystem Model Resource ##################### //########################################################################### struct MechSubsystem__SubsystemResource: public Subsystem::SubsystemResource { Scalar armorByFacing[5]; Scalar structureReference; int vitalSubsystemIndex; char videoObjectName[128]; ResourceDescription::ResourceID alarmModel; int alarmModelReserved[2]; int printSimulationState; Scalar collisionCriticalHitWeight; Scalar criticalReference; }; //########################################################################### //########################## MechSubsystem ############################## //########################################################################### class MechSubsystem: public Subsystem { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Shared Data Support // public: static Derivation ClassDerivations; static SharedData DefaultData; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Status model // public: enum TechStatusType { Destroyed = 0, Damaged = 1, CoolantLeaking = 2, Overheating = 3, AmmoBurning = 4, Jammed = 5, BadPower = 6, TechStatusTypeCount }; // // The subsystem SIMULATION states (binary PrintState @4ac8c0 string // pool: "Destroyed" @0050df7f, "Exploding" @0050df8c). DestroyedState // (1) is the hard-failure gate every weapon simulation checks // (`GetSimulationState() == 1` -- emitter @4baab9, ballistic @4bbd36). // enum { DestroyedState = Simulation::DefaultState + 1, ExplodingState, MechSubsystemStateCount }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Test Class Support // public: static Logical TestClass(Mech &); Logical TestInstance() const; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Construction and Destruction // public: typedef MechSubsystem__SubsystemResource SubsystemResource; MechSubsystem( Mech *owner, int subsystem_ID, const char *subsystem_name, RegisteredClass::ClassID class_id, SharedData &shared_data = DefaultData ); MechSubsystem( Mech *owner, int subsystem_ID, SubsystemResource *subsystem_resource, SharedData &shared_data = DefaultData ); ~MechSubsystem(); static int CreateStreamedSubsystem( NotationFile *model_file, const char *model_name, const char *subsystem_name, SubsystemResource *subsystem_resource, NotationFile *subsystem_file, const ResourceDirectories *directories, int passes = 1 ); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Damage support // public: virtual void TakeDamage(Damage &damage); Scalar GetSubsystemDamageLevel() const; void SetSubsystemDamageLevel(Scalar level); void ForceCriticalFailure(); // // Critical-hit application (binary @4ac07c): run the damage through // TakeDamage and return how much the subsystem's own zone level // actually moved (the crit accountant charges it against the entry's // damagePercentage allotment). // Scalar ApplyDamageAndMeasure(Damage &damage); Logical IsVitalSubsystem() const { Check(this); return vitalSubsystem; } // // The NOVICE-experience lockout predicate (binary @4ac9c8): a novice // pilot's advanced cockpit controls (condenser valves, coolant flush, // cooling toggles) are locked out. Owner mech -> playerLink -> // experience level == novice. Unlinked mechs read UNLOCKED. // Logical NoviceLockout(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Local Data // protected: Mech *owner; AlarmIndicator statusAlarm; Logical vitalSubsystem; ResourceDescription::ResourceID alarmModel; Scalar criticalReference; Scalar collisionCriticalHitWeight; Logical printSimulationState; int configureActivePress; SubsystemResource *resource; }; #endif