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

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


#include "c_basecombatcharacter.h"

// rts stuff
#include "hl2wars/rts_shareddefs.h"
//#include "particles_simple.h"

class CFXQuad2;

// NOTE: MOved all controller code into c_basestudiomodel
class C_AI_BaseNPC : public C_BaseCombatCharacter
{
	DECLARE_CLASS( C_AI_BaseNPC, C_BaseCombatCharacter );

public:
	DECLARE_CLIENTCLASS();

	C_AI_BaseNPC();
	virtual unsigned int	PhysicsSolidMaskForEntity( void ) const;
	virtual bool			IsNPC( void ) { return true; }
	bool					IsMoving( void ){ return m_bIsMoving; }
	bool					ShouldAvoidObstacle( void ){ return m_bPerformAvoidance; }
	virtual bool			AddRagdollToFadeQueue( void ) { return m_bFadeCorpse; }

	virtual void			GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt );

	int						GetDeathPose( void ) { return m_iDeathPose; }

	bool					ShouldModifyPlayerSpeed( void ) { return m_bSpeedModActive;	}
	int						GetSpeedModifyRadius( void ) { return m_iSpeedModRadius; }
	int						GetSpeedModifySpeed( void ) { return m_iSpeedModSpeed;	}

	void					ClientThink( void );
	void					OnDataChanged( DataUpdateType_t type );
	bool					ImportantRagdoll( void ) { return m_bImportanRagdoll;	}

public: 
	// to show the health of our units
	int						GetHealth() const { return m_iHealth; };
	int						GetMaxHealth() const { return m_iMaxHealth; };
	float					GetRechargeTime( int ability ) { return m_fAbilityRechargeTimes[ability]; };
	int 					GetUnitIndex() { return m_iUnitIndex; };
	const char					*GetUnitType( void );
	int						GetBehavior( void ) { return m_iBehavior; };

	// To receive messages about being dead
	void					UpdateOnRemove( void );

	// fog of war functions
	virtual void			UpdateFOW( bool visible );
	bool					IsVisibleForPlayer();

	// Create and destroy a selection circle
	void 					CreateSelectionCircle();
	void					DestroySelectionCircle();

	virtual int DrawModel( int flags );

	void					Blink( float blink_time = 3.0f );

	virtual void			Simulate();	

private:
	C_AI_BaseNPC( const C_AI_BaseNPC & ); // not defined, not accessible
	float m_flTimePingEffect;
	int  m_iDeathPose;
	int	 m_iDeathFrame;

	int m_iSpeedModRadius;
	int m_iSpeedModSpeed;

	bool m_bPerformAvoidance;
	bool m_bIsMoving;
	bool m_bFadeCorpse;
	bool m_bSpeedModActive;
	bool m_bImportanRagdoll;

	// rts/hl2wars data
	bool m_bVisFOW;
	float m_fNextUpdateFOW;

	int m_iBehavior;
	int m_iUnitIndex;
	float m_fAbilityRechargeTimes[MAXABILITIESSLOTS];
	int	m_iHealth;	// health of the npc
	int m_iMaxHealth;

	int m_iOldTeam;
	bool m_bCleanUp;

	EHANDLE m_hFowObjs[MAXFOWOBJ];
	int m_iFowObjsPointer;

	// testing particles
	//CNewParticleEffect *m_hSelectedEffect;

	bool					m_bForceCheapSelectionCircle;
	ClientShadowHandle_t	m_ProjectTextureUnlitHandle;
	ProjectTextureUnlitInfo_t m_Info;
	CMaterialReference		m_SelectionCircleShadow;
	CFXQuad2				*m_pCheapSelectionCircle;

	bool					m_bIsBlinking;
	float					m_fBlinkTimeOut;

protected:
	float					m_fSelectionCircleDist;

public:
	Vector2D m_vecOldPos;
};


#endif // C_AI_BASENPC_H
