//===========================================================================// // File: ammobin.hpp // // Project: BattleTech Brick: Mech weapons // // Contents: AmmoBin -- an ammunition store (with cook-off heat) // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #if !defined(AMMOBIN_HPP) # define AMMOBIN_HPP # if !defined(HEAT_HPP) # include # endif //##################### Forward Class Declarations ####################### class Mech; //########################################################################### //###################### AmmoBin Model Resource ######################## //########################################################################### struct AmmoBin__SubsystemResource: public HeatWatcher::SubsystemResource { int ammoClassID; int ammoModelFile; int explosionModelFile; int ammoCount; Scalar feedRate; Scalar heatPerRound; }; //########################################################################### //############################## AmmoBin ############################### //########################################################################### class AmmoBin: public HeatWatcher { public: static Derivation ClassDerivations; static SharedData DefaultData; static Logical TestClass(Mech &); Logical TestInstance() const; int GetAmmoCount() const { return ammoCount; } // // The feed interface the ballistic fire path consumes. Ammo states // (the 1995 feed alarm): 1 = a round is chambered/ready, 2 = EMPTY. // FeedAmmo pulls one round (the launcher calls it on a granted shot); // returns 0 when dry. (Feed-rate pacing + the cook-off heat source // join with the heat wave; the launcher's own recharge already paces // shots.) // enum { AmmoLoadedState = 1, AmmoEmptyState = 2 }; int GetAmmoState() const { Check(this); return (ammoCount > 0) ? AmmoLoadedState : AmmoEmptyState; } int FeedAmmo() { Check(this); if (ammoCount <= 0) { return 0; } --ammoCount; return 1; } public: typedef AmmoBin__SubsystemResource SubsystemResource; AmmoBin( Mech *owner, int subsystem_ID, SubsystemResource *subsystem_resource, SharedData &shared_data = DefaultData ); ~AmmoBin(); protected: int ammoCount; int initialAmmoCount; Scalar feedTimer; Scalar feedRate; int ammoClassID; int ammoModelFile; int explosionModelFile; Scalar heatPerRound; int cookOffArmed; int cookOffTime; int reserved; AlarmIndicator ammoAlarm; // // Cook-off heat-source registration state (advanced by the heat sim). // Reserved until the per-frame path is reconstructed. // int cookOffState[12]; }; #endif