#ifndef CONTROLLEDBEAM_H
#define CONTROLLEDBEAM_H

/**
* Controlled Weapon
* @version 27-10-2001
* @author Herwin 'harSens' van Welbergen
*/
class CControlledBeam:public CBasePlayerWeapon
{	
public:
	/**
	* precaches sounds/models
	*/
	void Precache();
	
	/**
	* do idle animations, stop increasing magic damage
	*/
	void WeaponIdle( void );

	/**
	* Shoots a attack
	*/
	void PrimaryAttack( void );

	/**
	* Stops aiming
	*/
	void SecondaryAttack( void );

	/**
	* Called when the attack is selected as weapon
	*/
	BOOL Deploy( void );

	/**
	* Holsters the attack
	* @param int skiplocal: ???
	*/
	void Holster(int skiplocal);
	
	/**
	 * Checks if we can holster
	 * @return BOOL: can we holster
	 */
	BOOL CanHolster(void);

	/**
	 * Creates a new attack
	 * @param Vector vecSrc: the source of the beam
	 * @param Vector vecThrow: the direction of the new beam
	 * @param float flSize: size of the new beam
	 */
	virtual void CreateBeam(Vector vecSrc, Vector vecThrow, float flSize);

protected:
	/**
	* Silence the sounds for the weapon
	*/
	void SilenceWeaponSounds(){EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM);};

	/**
	* Silence the voice
	*/
	void SilenceVoice(){EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);};
	
	/**
	* Silence the voice
	*/
	void SilenceBodySounds(){EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_BODY, "common/null.wav", 1.0, ATTN_NORM);};
	
	/**
	* Emits control sound
	*/
	virtual void EmitControlSound();

	/**
	* Emits charge sound
	*/
	virtual void EmitChargeSound(){};

	/**
	* Emits shoot sound
	*/
	virtual void EmitShootSound(){};

	/**
	* Inits charge sprite
	*/
	virtual void InitChargeSprite(){};

	/**
	* Enable charge sprite
	*/
	virtual void EnableChargeSprite(){};

	/**
	* Disable charge sprite
	*/
	virtual void DisableChargeSprite(){};

	/**
	* Let the chargesprite grow
	*/
	virtual void GrowChargeSprite(){};

	/**
	* Remove charge sprite
	*/
	virtual void RemoveChargeSprite(){};

	/**
	* Stops Aiming the attack
	*/
	void StopAiming(void);

	/**
	* Shoots the attack
	*/
	virtual void Shoot(void);

	/**
	* Charges the attack
	*/
	void Charge(void);

	/**
	* Releases the control of the attack
	*/
	void ReleaseAttack(void);

	/**
	* Detonates the attack
	*/
	void DetonateAttack(void);

	/**
	 * Enables beamjumps
	 */
	void EnableBeamJump(void);
	
	/**
	 * Enables beamjumps
	 */	
	void DisableBeamJump(void);

	/**
	 * Starts beamjump mode
	 */
	void StartBeamJump(void);

	/**
	 * Checks for beam jumps
	 */
	void UpdateBeamJumpStatus(void);
	
	/**
	 * Stops beamjump mode
	 */	
	void StopBeamJump(void);

	/**
	 * Checks if you can jump with this beam 
	 * @return BOOL: (default = true)
	 */
	virtual BOOL CanBeamJump(void){return true;}

	/**
	 * Pcjoe: Check for walljump
	 * @return BOOL: true if we're in a walljump
	 */
	BOOL CheckWallJump(void);

	/**
	 * Finds a beam to auto-aim at
	 */
	CBaseEntity *FindFollower();
	

	enum {ATTACK_IDLE,ATTACK_CHARGE,ATTACK_AIM}m_eAttackState;
	CGuidedAttack *m_pMagic;		//the magic attack created after firing
	short m_sTrail;					//trail sprite
	short m_sFlareA;				//flare sprite 
	short m_sFlareB;				
	short m_sStartA;				//start sprite
	short m_sStartB;				
	int m_iCharge;					//how far is it charged
	int m_iMaxCharge;				//max charge for this attack
	int m_iSpeed;					//the speed of the attack
	int m_iKiCost;					//ki needed for 1 chargepoint
	int m_iDamage;					//damage for 1 chargepoint
	int m_iRadius;					//radius for the attack
	float m_flPlayerSlowdown;		//speed of the player when charging
	char m_pAttackName[255];		//name of the attack
	float m_flRateOfTurn;			//how fast the attacks reacts on the crosshair
	int m_iAttachment;				//attachment for the beam
	int m_iExplosionColor;			//explosioncolor of the attack
	int m_iOldMoveType;				//movetype before beamjump
	int m_fBeamJump;				
	int m_fBeamJumping;	
	CBaseEntity *m_pFollower;
};
#endif
