//===========================================================================//
// File:	cammppr.hpp.                                                        //
// Project: MUNGA           Brick: Camera Controls Mapper                    //
// Contents: Interface specification for camera mapper                       //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  -----------------------------------------------------------//
// 06/20/95   JM   Initial Coding								                    //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. All rights reserved //
//                      PROPRIETARY and CONFIDENTIAL                         //
//===========================================================================//

#if !defined(CAMMPPR_HPP)
#	define CAMMPPR_HPP

#	if !defined (SUBSYSTM_HPP)
#		include	<subsystm.hpp>
#	endif

#	if !defined (CAMSHIP_HPP)
#		include	<camship.hpp>
#	endif

#	if !defined (CONTROLS_HPP)
#		include	<controls.hpp>
#	endif

	//##########################################################################
	//#######################    CameraControlsMapper   ########################
	//##########################################################################
	class CameraControlsMapper:
		public Subsystem
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Shared Data support
	//
	public:
		static Derivation ClassDerivations;
		static SharedData DefaultData;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Messaging Support
	//
	public:
		enum {
			KeypressMessageID = Subsystem::NextMessageID,
			DirectorModeMessageID,
			IncrementCameraMessageID,
			DecrementCameraMessageID,
			CreateCameraInstanceMessageID,
			DeleteCameraInstanceMessageID,
			OutputCameraInstancesMessageID,
			NextMessageID
		};

		void
			KeypressMessageHandler(ReceiverDataMessageOf<ControlsKey> *message);

		void
			DirectorModeMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
			);

		void
			IncrementCameraMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
			);

		void
			DecrementCameraMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
			);

		void
			CreateCameraInstanceMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
		);

		void
			DeleteCameraInstanceMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
		);

		void
			OutputCameraInstancesMessageHandler(
				ReceiverDataMessageOf<ControlsButton> *message
			);

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

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Attribute Support
	//
	public:
		enum {
			StickPositionAttributeID = Subsystem::NextAttributeID,
			ThrottlePositionAttributeID,
			PedalsPositionAttributeID,
			ReverseThrustAttributeID,
			DriveCameraAttributeID,
			SlideOrClampAttributeID,
			NextAttributeID
		};
	private:
		static const IndexEntry AttributePointers[];

	protected:
		static AttributeIndexSet	AttributeIndex;

	//
	// public attribute declarations go here
	//
	public:
		ControlsJoystick	stickPosition;
		Scalar				throttlePosition;
		Scalar				pedalsPosition;
		ControlsButton
      	reverseThrust,
			driveCamera,
			slideOrClamp;

	//##########################################################################
	// Model support
	//
	public:

		CameraShip*
			GetEntity()
				{return (CameraShip*)Subsystem::GetEntity();}

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

		void
			SetPerformance(Performance performance)
				{
					Check(this);
					activePerformance = (Simulation::Performance)performance;
				}

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Construction and Destruction
	//
	protected:
		CameraControlsMapper(
			CameraShip *owner,
			int subsystem_ID,
			SubsystemResource *subsystem_resource,
			SharedData &shared_data
		);

	public:
		~CameraControlsMapper();

		Logical
			TestInstance() const;
	};
#endif
