#ifndef SWOOP_H
#define SWOOP_H
/**
* Swoop
* @version 11-03-2003
* @author  Joseph 'Pcjoe' Florencio
*/

#define NUM_DIRECTIONS	6

struct double_tap_s
{	float	flStartFirst;	// Beginning of first tap
	float	flEndFirst;		// End of first tap
	float	flStartSecond;	// Beginning of second tap
	BOOL	fFirstTap;		// Have we done the first tap?
};

class CSwoop
{	
public:
	// Constructor
	CSwoop();

	/*
	* Reset Single double tap
	*/
	void ResetDT( double_tap_s *pDT );

	/*
	* Reset All double taps
	*/
	void ResetAllDT( void );

	/*
	* Reset All double taps except specified one
	*/
	void ResetAllDTExcept( int iExcept );

	/*
	* Get Swoop Start KI Cost
	* @param BOOL fDash: if this is a dash
	* @return int: KI Cost
	*/
	int GetSwoopStartKi( BOOL fDash );

	/*
	* Reset All
	*/
	void Reset( void );

	/*
	* Set Owner
	*/
	void SetOwner( CBasePlayer *pPlayer ) { m_pOwner = pPlayer; }

	/*
	* Manage Swoop
	*/
	void ManageSwoop( void );

	/*
	* Specific swoop direction multiplier
	* @return float: amount we should multiply the swoop speed by
	*/
	float SwoopSlowdown( void );

	/*
	* Handle Swoop (Player actually swooping)
	*/
	void HandleSwoop( void );

	/*
	* Update Double Tap
	* @return int: -1 if no direction is worth swooping in, elsewise, returned value will be of possible swoop direction
	*/
	int UpdateDoubleTap( void );

	/*
	* Get Current Direction ( Vector direction )
	*/
	Vector GetCurrentDirection( void );

	/*
	* Get Swoop Speed Start
	* @return float: swoop speed
	*/
	float GetSwoopSpeedStart( void );

	/*
	* Get Swoop Speed End
	* @return float: swoop boost speed
	*/
	float GetSwoopSpeedEnd( void );

	/*
	* Is this direction held down?
	* @param int direction: Direction ( MELEE_DIRECTION ) we're checking for
	*/
	BOOL IsHolding( int direction );

	/*
	* Did we double tap correctly so it's a valid dash?
	*/
	BOOL CanDash( void );

	/*
	* Can swoop?
	*/
	BOOL CanSwoop( int iDirection );
	
	/*
	* Can Pickup direction
	*/
	BOOL CanUseDirections( void );

	/*
	* Start Swoop
	* @param int iDirection: Direction we're swooping in
	* @param BOOL fDash: If this is a dash
	*/
	void StartSwoop( int iDirection, BOOL fDash );

	/*
	* Stop Swoop
	*/
	void StopSwoop( void );

	/*
	* Get Swoop time
	*/
	float GetSwoopTime( void );

	/*
	* Is Paused (paused in mid turbo/dash)
	*/
	BOOL IsPaused( void );

	/*
	* Can Pause
	*/
	BOOL CanPause( void );

	/*
	* Pause Player (perform pause)
	*/
	void PausePlayer( void );

	/*
	* Directions To Flags
	* @param int iDirections: Direction
	* @param int: flags
	*/
	int DirectionsToFlags( int iDirections );

	/*
	* Add to NullKeyset
	*/
	void AddToNullKeyset( int iFlags );

	/*
	* Remove from NullKeyset
	*/
	void RemoveFromNullKeyset( int iFlags );

	/*
	* Add All To NullKeyset
	*/
	void AddAllToNullKeyset( void );

	/*
	* Reset Null Keyset
	*/
	void ResetNullKeyset( void );

	/*
	* Manage Null Keyset
	*/
	void ManageNullKeyset( void );

	/*
	* Set Swoop Anim
	* @param char *pAnim: Animation
	* @param Activity &IdealActivity: Ideal Activity
	*/
	void SetSwoopAnim( char *pAnim, Activity &IdealActivity );

	/*
	* Get active direction
	* @return int: enum of direction
	*/
	int GetActiveDirection( void );

	/*
	* Is Swoopig
	*/
	BOOL IsSwooping( void );

	/*
	* Is Dashing
	*/
	BOOL IsDashing( void );

	int				m_iSwoopDirection;	// Swooping Direction
	int				m_iChainCount;		// Chain dash/swoop count
	BOOL			m_fSwoop;			// Player is Swooping
	BOOL			m_fChainSwoop;		// If player is in a chainswoop
	BOOL			m_fDash;			// Player is dashing (m_fSwoop and m_fDash is enabled when doing so)
	BOOL			m_fPause;			// Paused dash/swoop

private:
	int				m_iNullKeyset;		// Keys that don't count as "pressed", set after swoop is disabled
	int				m_iPressDirection;	// Active direction we're pressing (That we want to swoop in)
	float			m_flPressDirectionTime; // Time which the direction was pressed
	float			m_flStartSwoop;		// Time we started swoop
	float			m_flSwoopSpeed;		// Speed of swoop
	double_tap_s	m_DoubleTap[NUM_DIRECTIONS];	// Double tap
	CBasePlayer		*m_pOwner;			// Owner of this swoop
};

#endif
