//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $Workfile:     $
// $Date:         $
// $NoKeywords: $
//=============================================================================//
#if !defined( CLIENTMODE_HLNORMAL_H )
#define CLIENTMODE_HLNORMAL_H
#ifdef _WIN32
#pragma once
#endif

#include "clientmode_shared.h"
#include <vgui_controls/EditablePanel.h>
#include <vgui/Cursor.h>

class CHudViewport;
class FileAbilityInfo_t;
class C_LocalTempEntity;
class C_HL2Wars_Player;

enum mouse_cursors
{
	CURSOR_NORMAL = 0,
	CURSOR_ATTACK,
	CURSOR_ABILITY,
	CURSOR_CAPTURE,
	CURSOR_COUNT,
};

enum visual_helpers_t
{
	VISUAL_NONE = 0,
	VISUAL_BUILD,		// shows a model of what we will build/spawn around the mouse cursor
};

namespace vgui
{
	typedef unsigned long HScheme;
}

//-----------------------------------------------------------------------------
// Purpose: this is the viewport that contains all the hud elements
//-----------------------------------------------------------------------------
class CHudViewport : public CBaseViewport
{
private:
	DECLARE_CLASS_SIMPLE( CHudViewport, CBaseViewport );

public:
	CHudViewport();

	virtual void LevelInit();
	virtual void LevelShutdown();
protected:
	virtual void Paint();
	virtual void OnThink(); 

	virtual void ApplySchemeSettings( vgui::IScheme *pScheme )
	{
		BaseClass::ApplySchemeSettings( pScheme );

		gHUD.InitColors( pScheme );

		SetPaintBackgroundEnabled( false );
	}

	virtual IViewPortPanel *CreatePanelByName( const char *szPanelName );

public:
	void					DrawVisualsSelection();
	virtual void			DrawMouseOverEntity( void );
	void					DrawHealthBar( C_BaseEntity *pTarget );
	void					DrawSelectionBox(); 
	void					DrawRightClick();

	void					SelectBox( void );
	void					SelectAllInScreenOfType( C_BaseEntity *pType );
	C_BaseEntity			*GetEntityMouse( void );
	Vector					RetrieveMouseGroundPos();

	void					UpdateAbility( );
	void					UpdateHover( void );
	void					UpdateMouseCursor( void );
	C_BaseEntity			*GetMouseOverEntity() { return m_pMouseOverEnt; }

	void					CreatePreviewEnt( FileAbilityInfo_t *pFAI, C_HL2Wars_Player* pPlayer );
	void					UpdatePreviewEnt( byte r, byte g, byte b, byte a );
	void					UpdatePreviewEnt( Vector origin );
	void					UpdatePreviewEnt( QAngle angle );
	void					DestroyPreviewEnt();

public:
	// mouse listeners
	MESSAGE_FUNC_INT_INT( OnCursorMoved, "OnCursorMoved", x, y );
	virtual void OnCursorEntered();
	virtual void OnCursorExited();
	virtual void OnMousePressed(MouseCode code);
	virtual void OnMouseDoublePressed(MouseCode code);
	virtual void OnMouseTriplePressed(MouseCode code);
	virtual void OnMouseReleased(MouseCode code);
	virtual void OnMouseWheeled(int delta);

private:
	Color			m_clrMouseCursor;
	int				m_iCursor;

	vgui::HCursor m_iMouseCursor[CURSOR_COUNT];
	CMaterialReference m_ProjectTextureArrow;
	C_LocalTempEntity	*pCursorEnt;

	EHANDLE m_pMouseOverEnt;

	// position mouse
	int m_iX;
	int m_iY;

	// model we are drawing
	C_LocalTempEntity	*m_pMainPreviewEnt;
	CUtlVector<C_LocalTempEntity *> m_SubPreviewEnts;
	int					m_iCurrentAbility;
	bool				m_bAllowBuildEnt;
	bool				m_bDrawDirectionArrow;		// some abilities don't want the arrow

	// selection
	EHANDLE					m_pDrawSelectionB;
};

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class ClientModeHL2WarsNormal : public ClientModeShared
{
public:
	DECLARE_CLASS( ClientModeHL2WarsNormal, ClientModeShared );

	ClientModeHL2WarsNormal();
	~ClientModeHL2WarsNormal();

	virtual void	Init();
	virtual int		GetDeathMessageStartHeight( void );

	virtual void	LevelInit( const char *newmap );
	virtual void	LevelShutdown( void );

public:
	CHudViewport	*m_pHL2WarsViewport;
};

extern IClientMode *GetClientModeNormal();
extern vgui::HScheme g_hVGuiCombineScheme;

extern ClientModeHL2WarsNormal* GetClientModeHL2WarsNormal();

#endif // CLIENTMODE_HLNORMAL_H
