//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef C_MOUSERTSBRUSH
#define C_MOUSERTSBRUSH
#ifdef _WIN32
#pragma once
#endif

#include "hl2wars/rts_shareddefs.h"
//#include "c_baseanimating.h"
#include "c_props.h"

// ##################################################################################
//	>> Mouse brush
//
// ##################################################################################
//-----------------------------------------------------------------------------
// Purpose: A model that will react on a mouse click, adds the npc of the rts player, 
//           and orders those to move to this brush to do something (trigger it).
//			client side: so we can detect the brush. Also this class provide support
//			to draw a rectangle selection visual around the brush.
//-----------------------------------------------------------------------------
class C_MouseRTSModel : public C_BaseAnimating
//class C_MouseRTSModel : public C_DynamicProp
{
public:
	DECLARE_CLASS( C_MouseRTSModel, C_BaseAnimating );
	//DECLARE_CLASS( C_MouseRTSModel, C_DynamicProp );

	DECLARE_CLIENTCLASS();

	C_MouseRTSModel();
	~C_MouseRTSModel();

	//void Spawn( void );

	virtual void			UpdateOnRemove( void );

	// important for the mouse detection!
	virtual bool			IsRTSModel( void ) { return true; }

	virtual int GetBrushType( void ) { return MOUSEBRUSH_BASIC; }

	virtual void Simulate();	
	virtual int	DrawModel( int flags );

	virtual bool ShouldDraw( void ) 
	{
		m_bBaseClassDraw = BaseClass::ShouldDraw();
		return true;
	}

	virtual void OnCursorEntered();
	virtual void OnCursorExited();

	// watch it, this is one is called in paint()
	virtual void OnCursorHover() {}

	virtual void SetDrawSelection( bool state );
	virtual bool IsSelected() { return false; }

	virtual void CreateSelection();
	virtual void DestroySelection();

	virtual color32 GetColor();
	//virtual Vector GetTargetSelection( void );
	virtual QAngle GetTargetSelectionAngle( void);

protected:
	
	bool m_bBaseClassDraw;
	float m_fYawSelection;

	// Drawing a selection around the model
	bool m_bDrawSelection;
	bool					m_bForceCheapSelection;
	ClientShadowHandle_t	m_PTSelection;
	ProjectTextureUnlitInfo_t m_Info;	
	CMaterialReference		m_SelectionShadow;
};

inline color32 C_MouseRTSModel::GetColor()
{
	color32 color = { 255, 255, 255, 200 };
	return color;
}

inline QAngle C_MouseRTSModel::GetTargetSelectionAngle( void)
{
	QAngle angle = GetAbsAngles();
	angle[YAW] += m_fYawSelection;
	return angle;
}

#endif // C_MOUSERTSBRUSH