//===========================================================================//
// File:	booster.hh                                                           //
// Project: Red Planet                                                       //
// Contents: Interface specification for vectored thrust vehicles            //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 03/13/95  JM  Initial coding.                                            //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc.                     //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#if !defined(BOOSTER_HPP)
#	define BOOSTER_HPP

#	if !defined(VTVSUB_HPP)
#		include <vtvsub.hpp>
#	endif

	//##########################################################################
	//#####################    Booster::SubsystemResource    ###################
	//##########################################################################

	struct Booster__SubsystemResource:
		public VTVSubsystem::SubsystemResource
	{
		int boosterCount;
		Scalar
			burnTime,
			boosterAcceleration;
	};

	//##########################################################################
	//############################    Booster    ###############################
	//##########################################################################

	class Booster:
		public VTVSubsystem
	{
		friend class VTV;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Messageing Support
	//
	public:
		enum {
			ActivateMessageID = VTVSubsystem::NextMessageID,
			ConfigureMappablesMessageID,
			ChooseButtonMessageID,
			NextMessageID
		};

		void
			ActivateMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
			);
		void
			ConfigureMappablesMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
			);
		void
			ChooseButtonMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
			);

	protected:
		static const HandlerEntry
			MessageHandlerEntries[];
		static MessageHandlerSet
			MessageHandlers;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Shared Data support
	//
	public:
		static Derivation ClassDerivations;
		static SharedData DefaultData;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Attribute Support
	//
	public:
		enum {
			BurnTimeRemainingAttributeID = VTVSubsystem::NextAttributeID,
			BoostersRemainingAttributeID,
			ScaleFactorAttributeID,
			SmokeDensityAttributeID,
			PercentDoneAttributeID,
			NextAttributeID
		};

	private:
		static const IndexEntry AttributePointers[];

	protected:
		static AttributeIndexSet	AttributeIndex;

	//
	// public attribute declarations go here
	//
	public:
		Scalar 	burnTimeRemaining;
		Scalar 	boostersRemaining;
		Vector3D	scaleFactor;
		Scalar	smokeDensity;
		Scalar	percentDone;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Model Support
	//
	public:
		enum {
			BoosterBurning = Subsystem::StateCount,
			StateCount
		};

		typedef void
			(Booster::*Performance)(Scalar time_slice);

		void
			BoosterSimulation(Scalar time_slice);

		void
			SetPerformance(Performance performance)
				{
					Check(this);
					activePerformance = (Simulation::Performance)performance;
				}
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//   Damage Support
	//
	void
		DeathReset(int reset_command);
	void
		DeathShutdown(int shutdown_command);

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Construction and Destruction
	//
	public:
		typedef Booster__SubsystemResource SubsystemResource;

		static int
			CreateStreamedSubsystem(
				NotationFile	*model_file,
				const char		*model_name,
				const char						*subsystem_name,
				SubsystemResource				*subsystem_resource,
				NotationFile					*subsystem_file,
				const ResourceDirectories	*directories
			);

		Booster(
			VTV *owner,
			int subsystem_ID,
			SubsystemResource *subsystem_resource
		);
		~Booster();

		Logical
      	TestInstance() const;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Local data for the Booster class
	//
	protected:
		Scalar   burnTimeMax;
		Scalar   acceleration;
		int 		maxBoosters;
	};

#endif
