
#ifndef __ROCKETPACK_H__
#define __ROCKETPACK_H__

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

class StingerRocket : public Projectile
{
private:
	float speed;
//	int owner;
	Vector movedir; // primary direction of travel
	Vector targpos; // where it should me going
	Vector destpos; // where it is going
	Vector offsets; // +/- offsets for swirving

public:
	CLASS_PROTOTYPE( StingerRocket );

	void Turn( Event *ev );
	void Explode( Event *ev );
	void Setup( Entity *owner, Vector pos, Vector firedest, Vector dir, Vector firedir );

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

inline void StingerRocket::Archive( Archiver &arc )
{
	Projectile::Archive( arc );

	arc.WriteFloat( speed );
//	arc.WriteInteger(owner);
	arc.WriteVector( movedir );
	arc.WriteVector( targpos );
	arc.WriteVector( destpos );
	arc.WriteVector( offsets );
}

inline void StingerRocket::Unarchive( Archiver &arc )
{
	Projectile::Unarchive( arc );

	speed = arc.ReadFloat();
	arc.ReadVector( &movedir );
	arc.ReadVector( &targpos );
	arc.ReadVector( &destpos );
	arc.ReadVector( &offsets );
}

class StingerPack : public Weapon
{
private:
	qboolean attached;
	int rocketnum; // for tracking firing positions

protected:
	virtual void AttachGun( void );
	virtual void DetachGun( void );

public:
	CLASS_PROTOTYPE( StingerPack );

	StingerPack();
	virtual void Shoot( Event *ev );
	virtual void SecondaryUse( Event *ev );

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

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

	arc.WriteBoolean( attached );
	arc.WriteInteger( rocketnum );
}

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

	attached = arc.ReadBoolean();
	rocketnum = arc.ReadInteger();
}

#endif /* rocketpack.h */
