#ifndef __MANEROBOSS_H__
#define __MANEROBOSS_H__

#include "g_local.h"
#include "actor.h"
#include "weapon.h"
#include "rocketpack.h"
#include "nuke.h"

class ManeroCopter:public ScriptModel
{
private:
	float lastrockettime;
	float lastguntime;
	float lastgrenadetime;
	Vector lastfiredir;
	EntityPtr maneromodel;
	EntityPtr manerogun;
public:
	CLASS_PROTOTYPE( ManeroCopter );

	ManeroCopter();

	virtual void Postthink( void );
	void StartAttacking( Event *ev );
	void StopAttacking( Event *ev );
	void RemoveManero( Event *ev );
	void FireRockets( Event *ev );
	void FireGrenade( void );
	void FireGun( void );
	void TraceAttack( Vector start, Vector end, int damage, trace_t *trace, int numricochets, int kick );
	void FireBullets( Vector spread, int mindamage, int maxdamage, Vector src, Vector dir );
	void FireTracer( Vector src, Vector end );
	Vector GunPosition( void );

	virtual void Archive( Archiver &arc );
	virtual void Unarchive( Archiver &arc );
};

inline void ManeroCopter::Archive (Archiver &arc)
{
	ScriptModel::Archive( arc );

	arc.WriteFloat( lastrockettime );
	arc.WriteFloat( lastguntime );
	arc.WriteFloat( lastgrenadetime );
	arc.WriteVector( lastfiredir );
	arc.WriteSafePointer( maneromodel );
	arc.WriteSafePointer( manerogun );
}

inline void ManeroCopter::Unarchive (Archiver &arc)
{
	ScriptModel::Unarchive(arc);
	
	lastrockettime = arc.ReadFloat();
	lastguntime = arc.ReadFloat();
	lastgrenadetime = arc.ReadFloat();
	arc.ReadVector(&lastfiredir);
	arc.ReadSafePointer(&maneromodel);
	arc.ReadSafePointer(&manerogun);
}

class ManeroCopterTracer:public Entity
{
public:
	CLASS_PROTOTYPE(ManeroCopterTracer);
		
	ManeroCopterTracer();

	void RemoveTracer(Event *ev);
};

class ManeroBoss : public Actor
{
private:
	WeaponPtr secondaryWeapon;
public:
	CLASS_PROTOTYPE( ManeroBoss );
	
	ManeroBoss();
	virtual void Postthink(void);
	void ShieldsOn(Event *ev);
	void ShieldsOff(Event *ev);
	void CloakOn(Event *ev);
	void CloakOff(Event *ev);
	void FireNuke(Event *ev);
	virtual void ArmorDamage(Event *ev);
	void Pain(Event *ev);
	void Dead(Event *ev);
	void Killed(Event *ev);

	virtual void Archive( Archiver &arc );
	virtual void Unarchive( Archiver &arc );
};

inline void ManeroBoss::Archive (Archiver &arc)
{
	Actor::Archive(arc);
	
	arc.WriteSafePointer(secondaryWeapon);
}

inline void ManeroBoss::Unarchive (Archiver &arc)
{
	Actor::Unarchive(arc);
	
	arc.ReadSafePointer(&secondaryWeapon);
}

class ManeroStingerPack : public StingerPack
{
public:
	CLASS_PROTOTYPE( ManeroStingerPack );
		
	ManeroStingerPack();
	virtual void Shoot( Event *ev );
};

class ManeroIP36 : public IP36
{
public:
	CLASS_PROTOTYPE( ManeroIP36 );
		
	ManeroIP36();
	virtual void Shoot( Event *ev );
};

#endif
