//===========================================================================//
// File:	btl4gaug.hh                                                         //
// Project: MUNGA           Brick: Gauge Renderer Manager	                 //
// Contents: 																					  //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 09/13/95  CPB  Initial coding.                                            //
//---------------------------------------------------------------------------//
// Copyright (C) 1994, Virtual World Entertainment, Inc. All rights reserved //
//                      PROPRIETARY and CONFIDENTIAL                         //
//===========================================================================//

#if !defined(BTL4RDR_HPP)
#	define BTL4RDR_HPP

#	if !defined(SLOT_HPP)
#		include <slot.hpp>
#	endif

#	if !defined(L4GREND_HPP)
#		include <l4grend.hpp>
#	endif

#	if !defined(L4GAUGE_HPP)
#		include <l4gauge.hpp>
#	endif

#	if !defined(ROTATION_HPP)
#		include <rotation.hpp>
#	endif

#	if !defined(RANDOM_HPP)
#		include <random.hpp>
#	endif

#	if !defined(POINT3D_HPP)
#		include "point3d.hpp"
#	endif

#	if !defined(HEAT_HPP)
#		include <heat.hpp>
#	endif

#	if !defined(POWERSUB_HPP)
#		include <powersub.hpp>
#	endif

	struct ShadowRecord
	{
   	int distance;
	};

	class MapDisplay;

	class MapName SIGNATURED		// Used exclusively by MapDisplay
	{
		friend class MapDisplay;

		MapName()
			{}
		~MapName()
			{}

		Logical
			TestInstance() const
				{
					return True;
				}

	protected:
		void
			ExtractFromEntity(
				Entity *entity,
				AffineMatrix &worldToView,
				Entity *exclude_entity=NULL,
				Entity *hotbox_entity=NULL
			);
		void
			Draw(
				GraphicsView *graphics_view,
				int hotbox_color
			);

		Point3D
			center;
		Vector3D
			direction;
		BitMap
			*nameBitmap;
		int
			color;
		Logical
			hotBoxed;
	};

	class MapDisplay :
		public GraphicGauge
	{
	public:
		enum OffsetPosition
		{
			center,
			bottom
		};

		static MethodDescription
			methodDescription;
		static Logical
			Make(
				int display_port_index,
				Vector2DOf<int> position,
				Entity *entity,
				GaugeRenderer *gauge_renderer
			);

		MapDisplay(
			GaugeRate rate,
			ModeMask mode_mask,
			L4GaugeRenderer *renderer,
			unsigned int owner_ID,
			int graphics_port_number,

			int left, int bottom,
			int right, int top,
			OffsetPosition offset_position,
			int view_width_in_degrees,
			int bg_color,
			int static_color,
			int hotbox_color,
         Scalar maximum_range,
			Entity *entity,
			Scalar *scale_value_pointer,
			Point3D **position_pointer,
			Quaternion **angle_pointer,
			Scalar *capabilities_ratio,
			Logical allow_rock_and_roll=False
		);

		~MapDisplay();

		Logical
			TestInstance() const;
		void
			ShowInstance(char *indent);
		void
			BecameActive();
		void
			Execute();

	protected:
		void
			CalculateBounds();
		void
			EraseDisplay();
		void
			DrawDisplay();
		void
			BuildRadarShadow(AffineMatrix &worldToView);
		void
			DrawViewWedge();
		void
			DrawStatic(AffineMatrix &worldToView);
		void
			DrawMoving(AffineMatrix &worldToView);
		void
			DrawNames(AffineMatrix &worldToView);

		enum
		{
			maximumNames = 16
		};

		MapName
			nameArray[maximumNames];

		OffsetPosition
			offsetPosition;
		Scalar
			currentScale;
		Point3D *
			currentPositionPointer;
		Quaternion *
			currentAngularPointer;
		Scalar
			currentCapabilitiesRatio;
		Scalar
      	LODIndex,
			pixelsPerMeter,
			metersPerPixel,
         maximumRange,
         maximumDistanceSquared,
			xMin,
			yMin,
			zMin,
			xMax,
			yMax,
			zMax;

		Point3D
			viewingPosition;
		Radian
			viewHorizontalRotation;
		Radian
			viewHalfHorizontalWidth;

		AffineMatrix
			worldToView;

		int
			operatingPhase,
			backgroundColor,
			staticColor,
			boxColor,
			halfWidth,
			halfHeight;

		Logical
      	operating,
			rockAndRoll,
			flashState;

		GaugeEntityList
			staticEntityList,
			movingEntityList;

		GraphicsViewRecord
			previousDrawing;

		int
			halfViewWidthInUnits;

		ShadowRecord
			*shadowTable;
	};

#endif

