#ifndef __INFORMERGUN_H__
#define __INFORMERGUN_H__

#include "g_local.h"
#include "item.h"
#include "weapon.h"

class InformerBeam : public Entity
{
private:
	Vector start;
	Vector end;

public:
	int beamstate;

	CLASS_PROTOTYPE( InformerBeam );
	
	InformerBeam();
	void setBeam(Vector start, Vector end, int diameter, float r, float g, float b, float alpha, float lifespan);
	void FadeBeam(Event *ev);
	virtual void Archive( Archiver &arc );
	virtual void Unarchive( Archiver &arc );
};

inline void InformerBeam::Archive (Archiver &arc)
{
	Entity::Archive( arc );
	arc.WriteVector( start );
	arc.WriteVector( end );
	arc.WriteInteger( beamstate );
}

inline void InformerBeam::Unarchive (Archiver &arc)
{
	Entity::Unarchive( arc );
	arc.ReadVector( &start );
	arc.ReadVector( &end );
	beamstate = arc.ReadInteger();
}

class InformerGun : public Weapon
{
private:
	EntityPtr fadingbeam;
	int beamstate;
	Vector beamstart;
	Vector beamvec;

public:
	CLASS_PROTOTYPE(InformerGun);
		
	InformerGun ();
	virtual void Shoot(Event *ev);
	virtual void Informify(Entity *ent);
	virtual qboolean AutoChange(void);
	virtual qboolean Drop(void);
	virtual qboolean ReadyToChange(void);

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

inline void InformerGun::Archive (Archiver &arc)
{
	Weapon::Archive( arc );

	arc.WriteSafePointer( fadingbeam );
	arc.WriteInteger( beamstate );
	arc.WriteVector( beamstart );
	arc.WriteVector( beamvec );
}

inline void InformerGun::Unarchive (Archiver &arc)
{
	Weapon::Unarchive( arc );

	arc.ReadSafePointer( &fadingbeam );
	beamstate = arc.ReadInteger();
	arc.ReadVector( &beamstart );
	arc.ReadVector( &beamvec );
}

#endif /* informergun.h */
